aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2014-03-29 13:16:50 +0100
committerJakob Odersky <jodersky@gmail.com>2014-03-29 13:16:50 +0100
commitf34d5ccc120d2d2014a052966b183da7383bdc61 (patch)
treef70243e9f6c48cb4c5034c17c9c705f4741a257b /project
parentc0c3647bbf64af754d3cc9b6d167c8ca2b736f74 (diff)
downloadakka-serial-f34d5ccc120d2d2014a052966b183da7383bdc61.tar.gz
akka-serial-f34d5ccc120d2d2014a052966b183da7383bdc61.tar.bz2
akka-serial-f34d5ccc120d2d2014a052966b183da7383bdc61.zip
remove sbt native build and flow-pack
Diffstat (limited to 'project')
-rw-r--r--project/Dependencies.scala3
-rw-r--r--project/FlowBuild.scala110
-rw-r--r--project/native.scala133
-rw-r--r--project/nativepack.scala37
4 files changed, 5 insertions, 278 deletions
diff --git a/project/Dependencies.scala b/project/Dependencies.scala
index 7115ba6..9774a0f 100644
--- a/project/Dependencies.scala
+++ b/project/Dependencies.scala
@@ -3,8 +3,5 @@ import sbt._
object Dependencies {
lazy val akkaActor = "com.typesafe.akka" %% "akka-actor" % "2.3.0"
-
- lazy val ioCore = "com.github.scala-incubator.io" %% "scala-io-core" % "0.4.2"
- lazy val ioFile = "com.github.scala-incubator.io" %% "scala-io-file" % "0.4.2"
}
diff --git a/project/FlowBuild.scala b/project/FlowBuild.scala
index d509baa..dfef43c 100644
--- a/project/FlowBuild.scala
+++ b/project/FlowBuild.scala
@@ -1,16 +1,11 @@
import sbt._
import Keys._
import JniKeys._
-import NativeKeys._
-import NativePackKeys._
object FlowBuild extends Build {
val Organization = "com.github.jodersky"
val ScalaVersion = "2.10.3"
val Version = "2.0.0" //version of flow library
- val NativeMajorVersion = 3 //major version of native API
- val NativeMinorVersionPosix = 0 //minor version of native posix implementation
- val NativeVersionPosix = NativeMajorVersion + "." + NativeMinorVersionPosix
val gitHeadCommitSha = settingKey[String]("Current commit sha.")
@@ -32,7 +27,7 @@ object FlowBuild extends Build {
)
lazy val root: Project = (
- Project("root", file(".")).aggregate(flow, flowPack)
+ Project("root", file(".")).aggregate(flow)
settings(
publish := (),
publishLocal := ()
@@ -43,13 +38,9 @@ object FlowBuild extends Build {
Project("flow", file("flow"))
settings (commonSettings: _*)
settings (JniDefaults.settings: _*)
- settings (NativeDefaults.settings: _*)
- settings (selectHost().settings: _*)
settings(
- nativeIncludeDirectories += (sourceDirectory in Compile).value / "native" / "include",
- nativeIncludeDirectories ++= jdkHome.value.map(jdk => jdk / "include").toSeq,
javahClasses := Seq("com.github.jodersky.flow.internal.NativeSerial"),
- javahHeaderDirectory := (sourceDirectory in Compile).value / "native" / "include",
+ javahHeaderDirectory := (baseDirectory in ThisBuild).value / "flow-native" / "include",
compileOrder in Compile := CompileOrder.Mixed,
publishMavenStyle := true,
publishTo := {
@@ -73,106 +64,16 @@ object FlowBuild extends Build {
</developers>
},
libraryDependencies ++= Seq(
- Dependencies.akkaActor,
- Dependencies.ioCore,
- Dependencies.ioFile)
+ Dependencies.akkaActor
+ )
)
)
- //the current operating system used to run the native compile
- trait Host{ def settings: Seq[Setting[_]] }
-
- object Linux extends Host {
-
- val compiler = "gcc"
- val linker = compiler
- val cFlags = List("-O2", "-fPIC", "-Wall")
- val linkerFlags = List("-shared", s"-Wl,-soname,libflow.so.${NativeMajorVersion}")
- val binary = "libflow.so"
-
- val builds = List(
- NativeBuild("x86_64-linux-gnu", "gcc", "-m64" :: cFlags, "gcc", "-m64" :: linkerFlags, binary)
- //NativeBuild("x86-linux-gnu", "gcc", "-m32" :: cFlags, "gcc", "-m32" :: linkerFlags, binary),
- //NativeBuild("arm-linux-gnueabihf", "arm-linux-gnueabihf-gcc", cFlags, "arm-linux-gnueabihf-gcc", linkerFlags, binary),
- //NativeBuild("arm-linux-gnueabi", "arm-linux-gnueabi-gcc", cFlags, "arm-linux-gnueabi-gcc", linkerFlags, binary)
- //add other build configurations here or adapt existing ones to your needs
- )
-
- lazy val settings = Seq(
- nativeVersion := NativeVersionPosix,
- nativeIncludeDirectories ++= jdkHome.value.map(jdk => jdk / "include" / "linux").toSeq,
- nativeSource := nativeSource.value / "posix",
- nativeBuilds := builds
- )
-
- }
-
- //stub, not sure if this works
- object MacOSX extends Host {
-
- val compiler = "gcc"
- val linker = compiler
- val cFlags = Seq("-O2", "-fPIC")
- val linkerFlags = Seq("-dynamiclib")
- val binary = s"libflow.jnilib"
-
- val localBuild = NativeBuild(
- "amd64-macosx",
- compiler,
- cFlags,
- linker,
- linkerFlags,
- binary
- )
-
- lazy val settings = Seq(
- nativeVersion := NativeVersionPosix,
- nativeIncludeDirectories += file("/System/Library/Frameworks/JavaVM.framework/Headers/jni.h"),
- nativeIncludeDirectories += file("/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers"),
- nativeSource := nativeSource.value / "posix",
- nativeBuilds := Seq(localBuild)
- )
-
- }
-
- private def osError = throw new RuntimeException("Sorry, native compilation under the current OS is not supported.")
- def selectHost() = System.getProperty("os.name").toLowerCase match {
- case "linux" => Linux
- case "macosx" => MacOSX
- case _ => new Host{
- val settings = Seq(
- nativeCompile := osError,
- nativeLink := osError
- )
- }
- }
-
- lazy val flowPack: Project = (
- Project("flow-pack", file("flow-pack"))
- settings (commonSettings: _*)
- settings (NativePackDefaults.settings: _*)
- settings (
- nativePackLinkages := {
- val linkMappings = Map(
- "x86_64-linux-gnu" -> "amd64-linux",
- "x86-linux-gnu" -> "x86-linux",
- "arm-linux-gnueabihf" -> "arm-linux"
- )
- val ls: Seq[(NativeBuild, File)] = (nativeLink in flow).value.toSeq
- for ((build, binary) <- ls; n <- linkMappings.get(build.name)) yield {
- (build.copy(name = n), binary)
- }
- },
- exportJars := true
- )
- dependsOn(flow)
- )
-
lazy val samplesTerminal = (
Project("flow-samples-terminal", file("flow-samples") / "flow-samples-terminal")
settings(commonSettings: _*)
settings(runSettings: _*)
- dependsOn(flowPack)
+ //dependsOn(flowPack)
dependsOn(flow)
)
@@ -180,7 +81,6 @@ object FlowBuild extends Build {
Project("flow-samples-broadcast", file("flow-samples") / "flow-samples-broadcast")
settings(commonSettings: _*)
settings(runSettings: _*)
- dependsOn(flowPack)
dependsOn(flow)
)
diff --git a/project/native.scala b/project/native.scala
deleted file mode 100644
index 68c970e..0000000
--- a/project/native.scala
+++ /dev/null
@@ -1,133 +0,0 @@
-import sbt._
-import Keys._
-import java.io.File
-import scala.collection.mutable.HashSet
-
-case class NativeBuild(
- name: String,
- cCompiler: String,
- cFlags: Seq[String],
- linker: String,
- linkerFlags: Seq[String],
- binary: String)
-
-object NativeKeys {
-
- //build settings
- val nativeBuilds = taskKey[Seq[NativeBuild]]("All native build configurations, including cross-compilation.")
- val nativeVersion = settingKey[String]("Version of native binary")
-
- //compile settings
- val nativeIncludeDirectories = settingKey[Seq[File]]("Directories to include during build (gcc -I option)")
-
- //link settings
- val nativeLibraries = settingKey[Seq[String]]("Default names of libraries to use during linking.")
- val nativeLibraryDirectories = settingKey[Seq[File]]("Directories to search for libraries (gcc -L option)")
-
- //directories
- val nativeSource = settingKey[File]("Lowest level directory containing all native sources.")
- val nativeCSources = taskKey[Seq[File]]("All c source files.")
- val nativeTargetDirectory = settingKey[File]("Directory containing all compiled and linked files.")
-
- //tasks
- val nativeCompile = taskKey[Map[NativeBuild, Seq[File]]]("Compile all native build configurations.")
- val nativeLink = taskKey[Map[NativeBuild, File]]("Link all native build configurations.")
-
-}
-
-object NativeDefaults {
- import NativeKeys._
-
- private def generate(generators: SettingKey[Seq[Task[Seq[File]]]]) = generators { _.join.map(_.flatten) }
-
- private def compile(logger: Logger, compiler: String, flags: Seq[String], includeDirectories: Seq[File], src: File, out: File): File = {
- IO.createDirectory(out.getParentFile)
- val parts: Seq[String] =
- Seq(compiler) ++
- flags ++
- includeDirectories.map("-I" + _.getAbsolutePath) ++
- Seq("-o", out.getAbsolutePath) ++
- Seq("-c", src.getAbsolutePath)
-
- val cmd = parts.mkString(" ")
- logger.info(cmd)
- val ev = Process(cmd) ! logger
- if (ev != 0) throw new RuntimeException(s"Compilation of ${src.getAbsoluteFile()} failed.")
- out
- }
-
- private def link(logger: Logger, linker: String, flags: Seq[String], libraryDirectories: Seq[File], libraries: Seq[String], in: Seq[File], out: File): File = {
- val parts: Seq[String] =
- Seq(linker) ++
- flags ++
- Seq("-o", out.getAbsolutePath) ++
- in.map(_.getAbsolutePath) ++
- libraryDirectories.map("-L" + _.getAbsolutePath) ++
- libraries.map("-l" + _)
-
- val cmd = parts.mkString(" ")
- logger.info(cmd)
- val ev = Process(cmd) ! logger
- if (ev != 0) throw new RuntimeException(s"Linking of ${out.getAbsoluteFile()} failed.")
- out
- }
-
-
- def nativeCompileImpl() = Def.task {
- val logger = streams.value.log
- val builds = nativeBuilds.value
- val outDir = nativeTargetDirectory.value
- val includeDirs = nativeIncludeDirectories.value
- val csrcs = nativeCSources.value
-
- val compilations = for (build <- builds) yield {
- logger.info("Compiling configuration " + build.name)
- val objects = for (src <- csrcs) yield {
- compile(logger, build.cCompiler, build.cFlags, includeDirs, src, outDir / build.name / "objects" / (src.base + ".o"))
- }
- build -> objects
- }
- compilations.toMap
- }
-
- lazy val nativeLinkImpl = Def.task {
- val logger = streams.value.log
- val builds = nativeBuilds.value
- val outDir = nativeTargetDirectory.value
- val libDirs = nativeLibraryDirectories.value
- val libs = nativeLibraries.value
- val compilations = nativeCompile.value
- val version = nativeVersion.value
-
- val linkages = for (build <- builds) yield {
- logger.info("Linking configuration " + build.name)
- val objects = compilations(build)
- val binary = link(logger, build.linker, build.linkerFlags, libDirs, libs, objects, outDir / build.name / build.binary)
- build -> binary
- }
- linkages.toMap
- }
-
- def localPlatform = try {
- Process("gcc -dumpmachine").lines.headOption
- } catch {
- case ex: Exception => None
- }
-
-
- val settings: Seq[Setting[_]] = Seq(
- //nativeBuilds :=
-
- nativeSource := (sourceDirectory in Compile).value / "native",
- includeFilter in nativeCSources := "*.c",
- nativeCSources := (nativeSource.value ** (includeFilter in nativeCSources).value).get,
- nativeTargetDirectory := target.value / "native",
-
- nativeIncludeDirectories := Seq(nativeSource.value, nativeSource.value / "include"),
- nativeLibraries := Seq(),
- nativeLibraryDirectories := Seq(),
-
- nativeCompile := nativeCompileImpl.value,
- nativeLink := nativeLinkImpl.value
- )
-}
diff --git a/project/nativepack.scala b/project/nativepack.scala
deleted file mode 100644
index 293848d..0000000
--- a/project/nativepack.scala
+++ /dev/null
@@ -1,37 +0,0 @@
-import sbt._
-import Keys._
-import NativeKeys._
-import java.io.File
-import scala.collection.mutable.HashSet
-
-object NativePackKeys {
-
- val nativePackLinkages = taskKey[Seq[(NativeBuild, File)]]("")
- val nativePackUnmanaged = settingKey[File]("Directory containing any pre-compiled native binaries.")
-
-}
-
-object NativePackDefaults {
- import NativePackKeys._
-
- val mappingsImpl = Def.task {
- val links = nativePackLinkages.value
- val unamanagedDir = nativePackUnmanaged.value
-
- val managed: Seq[(File, String)] = for ( (build, binary) <- links.toSeq) yield {
- binary -> ("native/" + build.name + "/" + binary.name)
- }
-
- val unmanaged: Seq[(File, String)] = for (file <- (unamanagedDir ** "*").get; if file.isFile) yield {
- file -> ("native/" + (file relativeTo unamanagedDir).get.getPath)
- }
-
- managed ++ unmanaged
- }
-
- def settings = Seq(
- nativePackUnmanaged := baseDirectory.value / "lib_native",
- mappings in (Compile, packageBin) ++= mappingsImpl.value
- )
-
-} \ No newline at end of file