diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | flow-main/build.sbt | 10 | ||||
-rw-r--r-- | flow-main/src/main/java/com/github/jodersky/flow/internal/NativeSerial.java | 4 | ||||
-rw-r--r-- | flow-native/Makefile.am | 4 | ||||
-rw-r--r-- | flow-native/build.sbt | 3 | ||||
-rw-r--r-- | flow-native/m4/ax_jni_include_dir.m4 | 124 | ||||
-rw-r--r-- | flow-native/src/.gitignore (renamed from flow-native/.gitignore) | 0 | ||||
-rw-r--r-- | flow-native/src/Makefile.am | 11 | ||||
-rwxr-xr-x | flow-native/src/bootstrap (renamed from flow-native/bootstrap) | 0 | ||||
-rw-r--r-- | flow-native/src/configure.ac (renamed from flow-native/configure.ac) | 0 | ||||
-rw-r--r-- | flow-native/src/debian/changelog (renamed from flow-native/debian/changelog) | 0 | ||||
-rw-r--r-- | flow-native/src/debian/compat (renamed from flow-native/debian/compat) | 0 | ||||
-rw-r--r-- | flow-native/src/debian/control (renamed from flow-native/debian/control) | 0 | ||||
-rw-r--r-- | flow-native/src/debian/copyright (renamed from flow-native/debian/copyright) | 0 | ||||
-rwxr-xr-x | flow-native/src/debian/rules (renamed from flow-native/debian/rules) | 0 | ||||
-rwxr-xr-x | flow-native/src/pkg/mkpkg (renamed from flow-native/pkg/mkpkg) | 0 | ||||
-rw-r--r-- | flow-native/src/readme.md (renamed from flow-native/readme.md) | 0 | ||||
-rw-r--r-- | flow-native/src/src/Makefile.am | 9 | ||||
-rw-r--r-- | flow-native/src/src/com_github_jodersky_flow_internal_NativeSerial.h (renamed from flow-native/src/com_github_jodersky_flow_internal_NativeSerial.h) | 0 | ||||
-rw-r--r-- | flow-native/src/src/flow.h (renamed from flow-native/src/flow.h) | 0 | ||||
-rw-r--r-- | flow-native/src/src/flow_jni.c (renamed from flow-native/src/flow_jni.c) | 0 | ||||
-rw-r--r-- | flow-native/src/src/platform/posix/flow.c (renamed from flow-native/src/platform/posix/flow.c) | 0 | ||||
-rw-r--r-- | flow-native/src/src/platform/windows/README (renamed from flow-native/src/platform/windows/README) | 0 | ||||
-rw-r--r-- | flow-native/src/src/platform/windows/flow.c.disabled (renamed from flow-native/src/platform/windows/flow.c.disabled) | 0 | ||||
-rw-r--r-- | project/Build.scala | 96 | ||||
-rw-r--r-- | project/FlowBuild.scala | 75 | ||||
-rw-r--r-- | project/jni.scala | 38 | ||||
-rw-r--r-- | project/native.scala | 83 | ||||
-rw-r--r-- | project/plugins.sbt | 1 |
29 files changed, 105 insertions, 354 deletions
@@ -22,6 +22,7 @@ project/plugins/project/ .ensime_cache # Native +lib_native/ *.o *.so* *.jnilib diff --git a/flow-main/build.sbt b/flow-main/build.sbt new file mode 100644 index 0000000..a852935 --- /dev/null +++ b/flow-main/build.sbt @@ -0,0 +1,10 @@ +enablePlugins(JniJvm) + +//there are also java sources in this project +compileOrder in Compile := CompileOrder.Mixed + +libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.4.1" + +target in (Compile, javah) := (baseDirectory in ThisBuild).value / "flow-native" / "src" / "src" + +name := "flow" diff --git a/flow-main/src/main/java/com/github/jodersky/flow/internal/NativeSerial.java b/flow-main/src/main/java/com/github/jodersky/flow/internal/NativeSerial.java index c159058..6fac8da 100644 --- a/flow-main/src/main/java/com/github/jodersky/flow/internal/NativeSerial.java +++ b/flow-main/src/main/java/com/github/jodersky/flow/internal/NativeSerial.java @@ -3,6 +3,8 @@ package com.github.jodersky.flow.internal; import java.io.IOException; import java.nio.ByteBuffer; +import ch.jodersky.jni.NativeLoader; + import com.github.jodersky.flow.AccessDeniedException; import com.github.jodersky.flow.InvalidSettingsException; import com.github.jodersky.flow.NoSuchPortException; @@ -25,7 +27,7 @@ import com.github.jodersky.flow.PortInterruptedException; final class NativeSerial { static { - NativeLoader.load("flow3"); + NativeLoader.load("/com/github/jodersky/flow", "flow3"); } final static int PARITY_NONE = 0; diff --git a/flow-native/Makefile.am b/flow-native/Makefile.am deleted file mode 100644 index e06bd75..0000000 --- a/flow-native/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -AUTOMAKE_OPTIONS = foreign -ACLOCAL_AMFLAGS = -I m4 - -SUBDIRS = src
\ No newline at end of file diff --git a/flow-native/build.sbt b/flow-native/build.sbt new file mode 100644 index 0000000..b175e05 --- /dev/null +++ b/flow-native/build.sbt @@ -0,0 +1,3 @@ +enablePlugins(JniNative) + +jniLibraryPath in (Compile, jni) := "com/github/jodersky/flow" diff --git a/flow-native/m4/ax_jni_include_dir.m4 b/flow-native/m4/ax_jni_include_dir.m4 deleted file mode 100644 index 20fa380..0000000 --- a/flow-native/m4/ax_jni_include_dir.m4 +++ /dev/null @@ -1,124 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_JNI_INCLUDE_DIR -# -# DESCRIPTION -# -# AX_JNI_INCLUDE_DIR finds include directories needed for compiling -# programs using the JNI interface. -# -# JNI include directories are usually in the Java distribution. This is -# deduced from the value of $JAVA_HOME, $JAVAC, or the path to "javac", in -# that order. When this macro completes, a list of directories is left in -# the variable JNI_INCLUDE_DIRS. -# -# Example usage follows: -# -# AX_JNI_INCLUDE_DIR -# -# for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS -# do -# CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR" -# done -# -# If you want to force a specific compiler: -# -# - at the configure.in level, set JAVAC=yourcompiler before calling -# AX_JNI_INCLUDE_DIR -# -# - at the configure level, setenv JAVAC -# -# Note: This macro can work with the autoconf M4 macros for Java programs. -# This particular macro is not part of the original set of macros. -# -# LICENSE -# -# Copyright (c) 2008 Don Anderson <dda@sleepycat.com> -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 10 - -AU_ALIAS([AC_JNI_INCLUDE_DIR], [AX_JNI_INCLUDE_DIR]) -AC_DEFUN([AX_JNI_INCLUDE_DIR],[ - -JNI_INCLUDE_DIRS="" - -if test "x$JAVA_HOME" != x; then - _JTOPDIR="$JAVA_HOME" -else - if test "x$JAVAC" = x; then - JAVAC=javac - fi - AC_PATH_PROG([_ACJNI_JAVAC], [$JAVAC], [no]) - if test "x$_ACJNI_JAVAC" = xno; then - AC_MSG_ERROR([cannot find JDK; try setting \$JAVAC or \$JAVA_HOME]) - fi - _ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC") - _JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'` -fi - -_JINC="$_JTOPDIR/include" - -_AS_ECHO_LOG([_JTOPDIR=$_JTOPDIR]) -_AS_ECHO_LOG([_JINC=$_JINC]) - -# On Mac OS X 10.6.4, jni.h is a symlink: -# /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h -# -> ../../CurrentJDK/Headers/jni.h. -AC_CHECK_FILE([$_JINC/jni.h], - [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"], - [_JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` - AC_CHECK_FILE([$_JTOPDIR/include/jni.h], - [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"], - AC_MSG_ERROR([cannot find JDK header files])) - ]) - -# get the likely subdirectories for system specific java includes -case "$host_os" in -bsdi*) _JNI_INC_SUBDIRS="bsdos";; -freebsd*) _JNI_INC_SUBDIRS="freebsd";; -linux*) _JNI_INC_SUBDIRS="linux genunix";; -osf*) _JNI_INC_SUBDIRS="alpha";; -solaris*) _JNI_INC_SUBDIRS="solaris";; -mingw*) _JNI_INC_SUBDIRS="win32";; -cygwin*) _JNI_INC_SUBDIRS="win32";; -darwin*) _JNI_INC_SUBDIRS="darwin";; -*) _JNI_INC_SUBDIRS="genunix";; -esac - -# add any subdirectories that are present -for JINCSUBDIR in $_JNI_INC_SUBDIRS -do - if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then - JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR" - fi -done -]) - -# _ACJNI_FOLLOW_SYMLINKS <path> -# Follows symbolic links on <path>, -# finally setting variable _ACJNI_FOLLOWED -# ---------------------------------------- -AC_DEFUN([_ACJNI_FOLLOW_SYMLINKS],[ -# find the include directory relative to the javac executable -_cur="$1" -while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do - AC_MSG_CHECKING([symlink for $_cur]) - _slink=`ls -ld "$_cur" | sed 's/.* -> //'` - case "$_slink" in - /*) _cur="$_slink";; - # 'X' avoids triggering unwanted echo options. - *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$_slink";; - esac - AC_MSG_RESULT([$_cur]) -done -_ACJNI_FOLLOWED="$_cur" -])# _ACJNI diff --git a/flow-native/.gitignore b/flow-native/src/.gitignore index b8d894c..b8d894c 100644 --- a/flow-native/.gitignore +++ b/flow-native/src/.gitignore diff --git a/flow-native/src/Makefile.am b/flow-native/src/Makefile.am index 9fefbd1..e06bd75 100644 --- a/flow-native/src/Makefile.am +++ b/flow-native/src/Makefile.am @@ -1,9 +1,4 @@ -lib_LTLIBRARIES = libflow3.la +AUTOMAKE_OPTIONS = foreign +ACLOCAL_AMFLAGS = -I m4 -libflow3_la_SOURCES = flow_jni.c platform/posix/flow.c flow.h com_github_jodersky_flow_internal_NativeSerial.h - -if ENABLE_VERSIONED_LIB -libflow3_la_LDFLAGS = -version-info 0:1:0 -else -libflow3_la_LDFLAGS = -avoid-version -endif
\ No newline at end of file +SUBDIRS = src
\ No newline at end of file diff --git a/flow-native/bootstrap b/flow-native/src/bootstrap index d4d064f..d4d064f 100755 --- a/flow-native/bootstrap +++ b/flow-native/src/bootstrap diff --git a/flow-native/configure.ac b/flow-native/src/configure.ac index 1b622c4..1b622c4 100644 --- a/flow-native/configure.ac +++ b/flow-native/src/configure.ac diff --git a/flow-native/debian/changelog b/flow-native/src/debian/changelog index 00bb566..00bb566 100644 --- a/flow-native/debian/changelog +++ b/flow-native/src/debian/changelog diff --git a/flow-native/debian/compat b/flow-native/src/debian/compat index ec63514..ec63514 100644 --- a/flow-native/debian/compat +++ b/flow-native/src/debian/compat diff --git a/flow-native/debian/control b/flow-native/src/debian/control index f335e0e..f335e0e 100644 --- a/flow-native/debian/control +++ b/flow-native/src/debian/control diff --git a/flow-native/debian/copyright b/flow-native/src/debian/copyright index d26a00a..d26a00a 100644 --- a/flow-native/debian/copyright +++ b/flow-native/src/debian/copyright diff --git a/flow-native/debian/rules b/flow-native/src/debian/rules index c062736..c062736 100755 --- a/flow-native/debian/rules +++ b/flow-native/src/debian/rules diff --git a/flow-native/pkg/mkpkg b/flow-native/src/pkg/mkpkg index c82d9cb..c82d9cb 100755 --- a/flow-native/pkg/mkpkg +++ b/flow-native/src/pkg/mkpkg diff --git a/flow-native/readme.md b/flow-native/src/readme.md index 4bee987..4bee987 100644 --- a/flow-native/readme.md +++ b/flow-native/src/readme.md diff --git a/flow-native/src/src/Makefile.am b/flow-native/src/src/Makefile.am new file mode 100644 index 0000000..9fefbd1 --- /dev/null +++ b/flow-native/src/src/Makefile.am @@ -0,0 +1,9 @@ +lib_LTLIBRARIES = libflow3.la + +libflow3_la_SOURCES = flow_jni.c platform/posix/flow.c flow.h com_github_jodersky_flow_internal_NativeSerial.h + +if ENABLE_VERSIONED_LIB +libflow3_la_LDFLAGS = -version-info 0:1:0 +else +libflow3_la_LDFLAGS = -avoid-version +endif
\ No newline at end of file diff --git a/flow-native/src/com_github_jodersky_flow_internal_NativeSerial.h b/flow-native/src/src/com_github_jodersky_flow_internal_NativeSerial.h index 04364fb..04364fb 100644 --- a/flow-native/src/com_github_jodersky_flow_internal_NativeSerial.h +++ b/flow-native/src/src/com_github_jodersky_flow_internal_NativeSerial.h diff --git a/flow-native/src/flow.h b/flow-native/src/src/flow.h index 44e2a47..44e2a47 100644 --- a/flow-native/src/flow.h +++ b/flow-native/src/src/flow.h diff --git a/flow-native/src/flow_jni.c b/flow-native/src/src/flow_jni.c index 8ec2aed..8ec2aed 100644 --- a/flow-native/src/flow_jni.c +++ b/flow-native/src/src/flow_jni.c diff --git a/flow-native/src/platform/posix/flow.c b/flow-native/src/src/platform/posix/flow.c index a2a239c..a2a239c 100644 --- a/flow-native/src/platform/posix/flow.c +++ b/flow-native/src/src/platform/posix/flow.c diff --git a/flow-native/src/platform/windows/README b/flow-native/src/src/platform/windows/README index 3d24410..3d24410 100644 --- a/flow-native/src/platform/windows/README +++ b/flow-native/src/src/platform/windows/README diff --git a/flow-native/src/platform/windows/flow.c.disabled b/flow-native/src/src/platform/windows/flow.c.disabled index 86a267c..86a267c 100644 --- a/flow-native/src/platform/windows/flow.c.disabled +++ b/flow-native/src/src/platform/windows/flow.c.disabled diff --git a/project/Build.scala b/project/Build.scala deleted file mode 100644 index 1ef55eb..0000000 --- a/project/Build.scala +++ /dev/null @@ -1,96 +0,0 @@ -import sbt._ -import Keys._ -import JniKeys._ -import NativeKeys._ - - -object FlowBuild extends Build { - - val scalaVersions = List("2.11.7", "2.12.0-M3") - - lazy val commonSettings: Seq[Setting[_]] = Seq( - version := "2.3.2-SNAPSHOT", - scalaVersion in ThisBuild := scalaVersions.head, - crossScalaVersions in ThisBuild := scalaVersions.reverse, - scalacOptions ++= Seq("-deprecation", "-unchecked", "-feature", "-target:jvm-1.8"), - organization := "com.github.jodersky", - licenses := Seq(("BSD New", url("http://opensource.org/licenses/BSD-3-Clause"))), - homepage := Some(url("https://github.com/jodersky/flow")), - pomIncludeRepository := { _ => false }, - pomExtra := { - <scm> - <url>git@github.com:jodersky/flow.git</url> - <connection>scm:git:git@github.com:jodersky/flow.git</connection> - </scm> - <developers> - <developer> - <id>jodersky</id> - <name>Jakob Odersky</name> - </developer> - </developers> - } - ) - - lazy val runSettings: Seq[Setting[_]] = Seq( - fork := true, - connectInput in run := true, - outputStrategy := Some(StdoutOutput) - ) - - lazy val root: Project = ( - Project("root", file(".")) - aggregate(main, native) - settings(commonSettings: _*) - settings( - publishArtifact := false, - publish := (), - publishLocal := (), - publishTo := Some(Resolver.file("Unused transient repository", target.value / "unusedrepo")) // make sbt-pgp happy - ) - ) - - lazy val main: Project = ( - Project("flow-main", file("flow-main")) - settings(commonSettings: _*) - settings(JniDefaults.settings: _*) - settings( - name := "flow", - javahHeaderDirectory := (baseDirectory in ThisBuild).value / "flow-native" / "src", - javahClasses := Seq("com.github.jodersky.flow.internal.NativeSerial"), - compileOrder in Compile := CompileOrder.Mixed, - libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.4.1" - ) - ) - - lazy val native: Project = ( - Project("flow-native", file("flow-native-sbt")) - settings(commonSettings: _*) - settings(NativeDefaults.settings: _*) - settings( - name := "flow-native", - crossPaths := false, - nativeBuildDirectory := (baseDirectory in ThisBuild).value / "flow-native" - ) - ) - - lazy val samplesTerminal = ( - Project("flow-samples-terminal", file("flow-samples") / "terminal") - settings(commonSettings: _*) - settings(runSettings: _*) - dependsOn(main) - - //kind of dirty, but it gets the sample to run without installing native libraries - settings( - (run in Compile) <<= (run in Compile).dependsOn(nativeBuild in native), - javaOptions += "-Djava.library.path=" + (nativeOutputDirectory in native).value.getAbsolutePath() - ) - ) - - lazy val samplesWatcher = ( - Project("flow-samples-watcher", file("flow-samples") / "watcher") - settings(commonSettings: _*) - settings(runSettings: _*) - dependsOn(main) - ) - -} diff --git a/project/FlowBuild.scala b/project/FlowBuild.scala new file mode 100644 index 0000000..15a3fe4 --- /dev/null +++ b/project/FlowBuild.scala @@ -0,0 +1,75 @@ +import sbt._ +import Keys._ + +object FlowBuild extends Build { + + val scalaVersions = List("2.11.7", "2.12.0-M3") + + lazy val commonSettings: Seq[Setting[_]] = Seq( + version := "2.4.0-SNAPSHOT", + scalaVersion in ThisBuild := scalaVersions.head, + crossScalaVersions in ThisBuild := scalaVersions.reverse, + scalacOptions ++= Seq("-deprecation", "-unchecked", "-feature", "-target:jvm-1.8"), + organization := "com.github.jodersky", + licenses := Seq(("BSD New", url("http://opensource.org/licenses/BSD-3-Clause"))), + homepage := Some(url("https://github.com/jodersky/flow")), + pomIncludeRepository := { _ => false }, + pomExtra := { + <scm> + <url>git@github.com:jodersky/flow.git</url> + <connection>scm:git:git@github.com:jodersky/flow.git</connection> + </scm> + <developers> + <developer> + <id>jodersky</id> + <name>Jakob Odersky</name> + </developer> + </developers> + } + ) + + lazy val runSettings: Seq[Setting[_]] = Seq( + fork := true, + connectInput in run := true, + outputStrategy := Some(StdoutOutput) + ) + + lazy val root: Project = ( + Project("root", file(".")) + aggregate(main, native) + settings(commonSettings: _*) + settings( + publishArtifact := false, + publish := (), + publishLocal := (), + publishTo := Some(Resolver.file("Unused transient repository", target.value / "unusedrepo")) // make sbt-pgp happy + ) + ) + + lazy val main = Project( + id = "flow-main", + base = file("flow-main"), + settings = commonSettings + ) + + lazy val native = Project( + id = "flow-native", + base = file("flow-native"), + settings = commonSettings + ) + + lazy val samplesTerminal = Project( + id = "flow-samples-terminal", + base = file("flow-samples") / "terminal", + settings = commonSettings, + dependencies = Seq(main, native % Runtime) + ) + + lazy val samplesWatcher = Project( + id = "flow-samples-watcher", + base = file("flow-samples"), + settings = commonSettings, + dependencies = Seq(main, native % Runtime) + ) + +} diff --git a/project/jni.scala b/project/jni.scala deleted file mode 100644 index 07d8406..0000000 --- a/project/jni.scala +++ /dev/null @@ -1,38 +0,0 @@ -import sbt._ -import Keys._ -import scala.util.Try - -object JniKeys { - 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.") - val javah = taskKey[Seq[File]]("Generate JNI headers.") -} - -object JniDefaults { - import JniKeys._ - - val settings: Seq[Setting[_]] = Seq( - javahHeaderDirectory := baseDirectory.value, - javahClasspath := Seq((classDirectory in Compile).value), - javah := javahImpl.value - ) - - def javahImpl = Def.task { - val jcp = javahClasspath.value - val cp = jcp.mkString(sys.props("path.separator")) - for (clazz <- javahClasses.value) { - val parts = Seq( - "javah", - "-d", javahHeaderDirectory.value, - "-classpath", cp, - clazz) - val cmd = parts.mkString(" ") - val ev = Process(cmd) ! streams.value.log - if (ev != 0) throw new RuntimeException(s"Error occured running javah. Exit code: ${ev}") - } - IO.listFiles(javahHeaderDirectory.value) - } - -} - diff --git a/project/native.scala b/project/native.scala deleted file mode 100644 index 342a863..0000000 --- a/project/native.scala +++ /dev/null @@ -1,83 +0,0 @@ -import sbt._ -import Keys._ -import java.io.File -import java.util.jar.Manifest - -object NativeKeys { - - val nativeBuildDirectory = settingKey[File]("Directory containing native build scripts.") - val nativeTargetDirectory = settingKey[File]("Base directory to store native products.") - val nativeOutputDirectory = settingKey[File]("Actual directory where native products are stored.") - val nativePackageUnmanagedDirectory = settingKey[File]("Directory containing external products that will be copied to the native jar.") - - val nativeClean = taskKey[Unit]("Clean native build.") - val nativeBuild = taskKey[File]("Invoke native build.") -} - -object NativeDefaults { - import NativeKeys._ - - val autoClean = Def.task { - val log = streams.value.log - val build = nativeBuildDirectory.value - - Process("make distclean", build) #|| Process("make clean", build) ! log - } - - val autoLib = Def.task { - val log = streams.value.log - val build = nativeBuildDirectory.value - val out = nativeOutputDirectory.value - - val configure = Process( - "./configure " + - "--prefix=" + out.getAbsolutePath + " " + - "--libdir=" + out.getAbsolutePath + " " + - "--disable-versioned-lib", //Disable producing versioned library files, not needed for fat jars. - build) - - val make = Process("make", build) - - val makeInstall = Process("make install", build) - - val ev = configure #&& make #&& makeInstall ! log - if (ev != 0) - throw new RuntimeException(s"Building native library failed. Exit code: ${ev}") - - (out ** ("*.la")).get.foreach(_.delete()) - - out - } - - val nativePackageMappings = Def.task { - val managedDir = nativeTargetDirectory.value - val unmanagedDir = nativePackageUnmanagedDirectory.value - - val managed = (nativeBuild.value ** "*").get - val unmanaged = (unmanagedDir ** "*").get - - val managedMappings: Seq[(File, String)] = for (file <- managed; if file.isFile) yield { - file -> ("native/" + (file relativeTo managedDir).get.getPath) - } - - val unmanagedMappings: Seq[(File, String)] = for (file <- unmanaged; if file.isFile) yield { - file -> ("native/" + (file relativeTo unmanagedDir).get.getPath) - } - - managedMappings ++ unmanagedMappings - } - - def os = System.getProperty("os.name").toLowerCase.filter(c => !c.isWhitespace) - def arch = System.getProperty("os.arch").toLowerCase - - val settings: Seq[Setting[_]] = Seq( - nativeTargetDirectory := target.value / "native", - nativeOutputDirectory := nativeTargetDirectory.value / (os + "-" + arch), - nativeClean := autoClean.value, - nativeBuild := autoLib.value, - nativePackageUnmanagedDirectory := baseDirectory.value / "lib_native", - mappings in (Compile, packageBin) ++= nativePackageMappings.value - ) - -} - diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..489fdbc --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("ch.jodersky" %% "sbt-jni" % "0.2-SNAPSHOT") |