diff options
author | Jakob Odersky <jodersky@gmail.com> | 2014-01-13 17:40:34 +0100 |
---|---|---|
committer | Jakob Odersky <jodersky@gmail.com> | 2014-01-14 15:43:00 +0100 |
commit | 5c94ee017051d51f51e06a61a8bc4e70a15e36da (patch) | |
tree | 2e48701ebb4177557234dbbd22b3b7058cad36de /project/jni.scala | |
parent | 84f640208ed6e4e155e87ebcb73a82c021174ea7 (diff) | |
download | akka-serial-5c94ee017051d51f51e06a61a8bc4e70a15e36da.tar.gz akka-serial-5c94ee017051d51f51e06a61a8bc4e70a15e36da.tar.bz2 akka-serial-5c94ee017051d51f51e06a61a8bc4e70a15e36da.zip |
enable easier cross-compilation
Diffstat (limited to 'project/jni.scala')
-rw-r--r-- | project/jni.scala | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/project/jni.scala b/project/jni.scala index 5e248f2..e87f0c7 100644 --- a/project/jni.scala +++ b/project/jni.scala @@ -1,11 +1,9 @@ import sbt._ import Keys._ -import NativeKeys._ import scala.util.Try object JniKeys { val jdkHome = settingKey[Option[File]]("Home of JDK.") - val jdkHomeNotFound = taskKey[Unit]("Utility task that informs user that no JDK was found.") val javahHeaderDirectory = settingKey[File]("Directory where generated javah header files are placed.") val javahClasses = settingKey[Seq[String]]("Fully qualified names of classes containing native declarations.") val javahClasspath = taskKey[Seq[File]]("Classpath to use in javah.") @@ -15,27 +13,16 @@ object JniKeys { object JniDefaults { import JniKeys._ - val defaultSettings: Seq[Setting[_]] = Seq( + val settings: Seq[Setting[_]] = Seq( jdkHome := Try(file(sys.env("JAVA_HOME"))).toOption, - jdkHomeNotFound := jdkHomeNotFoundImpl.value, - nativeCompile in Native := ((nativeCompile in Native) dependsOn jdkHomeNotFound).value, - javahHeaderDirectory := (sourceManaged in Native).value / "javah", - javah := javahImpl.value, - sourceGenerators in Native <+= javah map { headers => headers}, - includeDirectories in Native += javahHeaderDirectory.value, - includeDirectories in Native ++= jdkHome.value.map( jdk => jdk / "include").toSeq) + javahHeaderDirectory := baseDirectory.value, + javahClasspath := Seq((classDirectory in Compile).value), + javah := javahImpl.value + ) - def jdkHomeNotFoundImpl = Def.task { - if (jdkHome.value == None) { - streams.value.log.warn( - "No JDK home directory found, any native code using JNI may not compile. Please set JAVA_HOME environment variable.") - } - () - } - def javahImpl = Def.task { - val cps = javahClasspath.value - val cp = cps.mkString(":") + val jcp = javahClasspath.value + val cp = jcp.mkString(":") for (clazz <- javahClasses.value) { val parts = Seq( "javah", |