From 94a0ee545ab71c6779f15a5192745bedddfdb4d4 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Sun, 30 Jun 2013 11:56:29 +0200 Subject: solve cyclic dependency issue --- project/Build.scala | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'project/Build.scala') diff --git a/project/Build.scala b/project/Build.scala index c08e766..55002d4 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -9,7 +9,7 @@ import Jni._ object FlowBuild extends Build { val Organization = "com.github.jodersky" val Version = "1.0-SNAPSHOT" //version of flow library - val BinaryMajorVersion = 1 //binary major (api-level) version used to select so's and dlls when publishing + val BinaryMajorVersion = 1 //binary major version used to select so's and dlls when publishing (needs to be incremented if API changes are made to flow.h or NativeSerial.java) val ScalaVersion = "2.10.1" lazy val commonSettings: Seq[Setting[_]] = Seq( @@ -22,32 +22,43 @@ object FlowBuild extends Build { lazy val runSettings: Seq[Setting[_]] = Seq( fork := true, connectInput in run := true) + lazy val main: Project = ( Project("flow-main", file("flow-main")) settings (commonSettings: _*) settings ( - libraryDependencies += Dependencies.akka, - compileOrder in Compile := CompileOrder.Mixed + libraryDependencies ++= Seq( + Dependencies.akkaActor, + Dependencies.ioCore, + Dependencies.ioFile), + compileOrder in Compile := CompileOrder.Mixed, + resourceGenerators in Compile <+= (resourceManaged in Compile, link in Native in LocalProject("flow-native-linux")) map { (resDir, binary) => + val file = resDir / "native" / sys.props("os.name").toLowerCase / sys.props("os.arch").toLowerCase / binary.getName + IO.copyFile(binary, file) + Seq(file) + } ) ) - lazy val samples = ( - Project("flow-samples-rwc", file("samples") / "rwc") + lazy val rwc = ( + Project("flow-samples-rwc", file("flow-samples") / "rwc") settings(commonSettings: _*) settings(runSettings: _*) dependsOn(main) ) - - //---native projects -------------------------------------------------- + + //--- native settings -------------------------------------------------- lazy val commonNativeSettings: Seq[Setting[_]] = Seq( includeDirectories in Native += file("flow-native") / "include", + nativeCompile in Native := ((nativeCompile in Native) dependsOn (compile in Compile in main)).value, + javahClasspath := Seq((classDirectory in Compile in main).value), javahClasses := Seq("com.github.jodersky.flow.internal.NativeSerial")) ++ Jni.defaultSettings - //---native unix like settings ---------------------------------------- + //--- native unix like settings ---------------------------------------- val UnixBinaryName = "flow" val UnixBinaryMinorVersion = 0 @@ -55,18 +66,20 @@ object FlowBuild extends Build { lazy val unixNativeSettings: Seq[Setting[_]] = commonNativeSettings ++ Seq( flags in Native := Seq("-fPIC", "-O2"), linkFlags in Native ++= Seq("-shared", s"-Wl,-soname,lib${UnixBinaryName}.so.${BinaryMajorVersion}"), - binaryName in Native := s"lib${UnixBinaryName}.so.${BinaryMajorVersion}.${UnixBinaryMinorVersion}") + binaryName in Native := s"lib${UnixBinaryName}.so.${BinaryMajorVersion}.${UnixBinaryMinorVersion}", + version := s"${BinaryMajorVersion}.${UnixBinaryMinorVersion}-${sys.props("os.name").toLowerCase}-${sys.props("os.arch").toLowerCase}", + nativeSource in Native := baseDirectory.value / "src") lazy val nativeLinux = ( NativeProject("flow-native-linux", file("flow-native") / "unix") settings (unixNativeSettings: _*) settings ( - nativeSource in Native := baseDirectory.value / "src", includeDirectories in Native += jdkHome.value / "include" / "linux" ) dependsOn (main) ) - + + /* Seq( libraryDependencies ++= Dependencies.all, @@ -76,11 +89,7 @@ object FlowBuild extends Build { binaryName in Native := "flow", options in Native := Seq("-fPIC", "-O2"), linkOptions in Native := Seq("-Wl,-soname,libflow.so.1"), - resourceGenerators in Compile <+= (resourceManaged in Compile, link in Native) map { (resDir, binary) => - val file = resDir / "native" / sys.props("os.name").toLowerCase / sys.props("os.arch").toLowerCase / binary.getName - IO.copyFile(binary, file) - Seq(file) - } + ) ++ Jni.defaultSettings * */ -- cgit v1.2.3