aboutsummaryrefslogtreecommitdiff
path: root/project/JNIBuild.scala
diff options
context:
space:
mode:
Diffstat (limited to 'project/JNIBuild.scala')
-rw-r--r--project/JNIBuild.scala21
1 files changed, 21 insertions, 0 deletions
diff --git a/project/JNIBuild.scala b/project/JNIBuild.scala
new file mode 100644
index 0000000..95509fb
--- /dev/null
+++ b/project/JNIBuild.scala
@@ -0,0 +1,21 @@
+import sbt._
+import Keys._
+
+object JNIBuild {
+ val jdkHome = SettingKey[File]("jdk-home", "Home of JDK.")
+ val javaClass = SettingKey[String]("jni-class", "Fully qualified name of class containing native declarations.")
+
+ val javah = TaskKey[Unit]("javah", "Generate JNI headers.")
+
+ val javahTask = javah <<= (javaClass, NativeBuild.sourceDirectory, Keys.classDirectory in Compile) map { (j, src, cp) =>
+ val cmd = "javah -d " + src.absolutePath + " -classpath " + cp.absolutePath + " " + j
+ cmd !;
+ {}
+ } dependsOn (Keys.compile in Compile)
+
+ val defaults = NativeBuild.defaults ++ Seq(
+ javahTask,
+ NativeBuild.compile <<= NativeBuild.compile.dependsOn(javah))
+
+}
+