aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2014-04-21 00:53:04 +0200
committerJakob Odersky <jodersky@gmail.com>2014-04-21 00:58:41 +0200
commit21768dcd18843620daf64fc759693385b8b6a547 (patch)
tree678799dba823b31f85d50086de07f4e8a7469848
parent2b8d4feff9a342910192218a33fc9880abc1f33d (diff)
downloadakka-serial-21768dcd18843620daf64fc759693385b8b6a547.tar.gz
akka-serial-21768dcd18843620daf64fc759693385b8b6a547.tar.bz2
akka-serial-21768dcd18843620daf64fc759693385b8b6a547.zip
move native build to separate sbt project
-rw-r--r--.gitignore1
-rw-r--r--project/FlowBuild.scala27
-rw-r--r--project/native.scala27
3 files changed, 31 insertions, 24 deletions
diff --git a/.gitignore b/.gitignore
index 108e17e..1d13dcc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@ project/plugins/project/
*.o
*.so*
*.jnilib
+*.dylib
# Temporary files
*~
diff --git a/project/FlowBuild.scala b/project/FlowBuild.scala
index 688743b..a9aef8d 100644
--- a/project/FlowBuild.scala
+++ b/project/FlowBuild.scala
@@ -8,7 +8,7 @@ import NativeKeys._
object FlowBuild extends Build {
val Organization = "com.github.jodersky"
val ScalaVersion = "2.10.3"
- val Version = "2.0.0-RC2"
+ val Version = "2.0.0-RC3"
lazy val commonSettings: Seq[Setting[_]] =
@@ -53,7 +53,7 @@ object FlowBuild extends Build {
)
lazy val root: Project = (
- Project("root", file(".")).aggregate(flow)
+ Project("root", file(".")).aggregate(flow, flowNative)
settings(
publish := (),
publishLocal := ()
@@ -62,13 +62,11 @@ object FlowBuild extends Build {
lazy val flow: Project = (
Project("flow", file("flow"))
- settings (commonSettings: _*)
- settings (publishSettings: _*)
- settings (JniDefaults.settings: _*)
- settings(NativeDefaults.settings: _*)
+ settings(commonSettings: _*)
+ settings(publishSettings: _*)
+ settings(JniDefaults.settings: _*)
settings(
- nativeBuildDirectory := (baseDirectory in ThisBuild).value / "flow-native",
- javahHeaderDirectory := nativeBuildDirectory.value / "src",
+ javahHeaderDirectory := (baseDirectory in ThisBuild).value / "flow-native" / "src",
javahClasses := Seq("com.github.jodersky.flow.internal.NativeSerial"),
compileOrder in Compile := CompileOrder.Mixed,
libraryDependencies += Dependencies.akkaActor,
@@ -77,13 +75,20 @@ object FlowBuild extends Build {
)
)
+ lazy val flowNative: Project = (
+ Project("flow-native", file("flow-native"))
+ settings(publishSettings: _*)
+ settings(commonSettings: _*)
+ settings(NativeDefaults.settings: _*)
+ settings(
+ nativeBuildDirectory := (baseDirectory in ThisBuild).value / "flow-native"
+ )
+ )
+
lazy val samplesTerminal = (
Project("flow-samples-terminal", file("flow-samples") / "flow-samples-terminal")
settings(commonSettings: _*)
settings(runSettings: _*)
- settings(
- unmanagedJars in Compile += (nativePackage in flow).value
- )
dependsOn(flow)
)
diff --git a/project/native.scala b/project/native.scala
index 84537a3..edd80c1 100644
--- a/project/native.scala
+++ b/project/native.scala
@@ -9,17 +9,21 @@ object NativeKeys {
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 nativePackageArtifact = settingKey[Artifact]("Native artifact.")
-
+ val nativeClean = taskKey[Unit]("Clean native build.")
val nativeBuild = taskKey[File]("Invoke native build.")
- val nativePackage = taskKey[File]("Package native products into a jar.")
-
}
object NativeDefaults {
import NativeKeys._
+ val autoClean = Def.task {
+ val log = streams.value.log
+ val build = nativeBuildDirectory.value
+
+ Process("make distclean", build) #|| Process("clean", build) ! log
+ }
+
val autoLib = Def.task {
val log = streams.value.log
val build = nativeBuildDirectory.value
@@ -45,15 +49,13 @@ object NativeDefaults {
out
}
- val nativePackageImpl = Def.task {
+ val nativePackageMappings = Def.task {
val managedDir = nativeTargetDirectory.value
val unmanagedDir = nativePackageUnmanagedDirectory.value
val managed = (nativeBuild.value ** "*").get
val unmanaged = (unmanagedDir ** "*").get
- val jarFile = nativeTargetDirectory.value / (name.value + "-" + version.value + "-native.jar")
-
val managedMappings: Seq[(File, String)] = for (file <- managed; if file.isFile) yield {
file -> ("native/" + (file relativeTo managedDir).get.getPath)
}
@@ -62,8 +64,7 @@ object NativeDefaults {
file -> ("native/" + (file relativeTo unmanagedDir).get.getPath)
}
- IO.jar(managedMappings ++ unmanagedMappings, jarFile, new Manifest())
- jarFile
+ managedMappings ++ unmanagedMappings
}
def os = System.getProperty("os.name").toLowerCase.filter(_ != ' ')
@@ -72,11 +73,11 @@ object NativeDefaults {
val settings: Seq[Setting[_]] = Seq(
nativeTargetDirectory := target.value / "native",
nativeOutputDirectory := nativeTargetDirectory.value / (os + "-" + arch),
+ nativeClean := autoClean.value,
nativeBuild := autoLib.value,
- nativePackage := nativePackageImpl.value,
- nativePackageArtifact := Artifact(name.value, "native"),
- nativePackageUnmanagedDirectory := baseDirectory.value / "lib_native"
- ) ++ addArtifact(nativePackageArtifact, nativePackage).settings
+ nativePackageUnmanagedDirectory := baseDirectory.value / "lib_native",
+ mappings in (Compile, packageBin) ++= nativePackageMappings.value
+ )
}