aboutsummaryrefslogtreecommitdiff
path: root/project/jni.scala
diff options
context:
space:
mode:
Diffstat (limited to 'project/jni.scala')
-rw-r--r--project/jni.scala27
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",