aboutsummaryrefslogtreecommitdiff
path: root/project/FlowBuild.scala
diff options
context:
space:
mode:
Diffstat (limited to 'project/FlowBuild.scala')
-rw-r--r--project/FlowBuild.scala59
1 files changed, 43 insertions, 16 deletions
diff --git a/project/FlowBuild.scala b/project/FlowBuild.scala
index 0de60bb..42b9cda 100644
--- a/project/FlowBuild.scala
+++ b/project/FlowBuild.scala
@@ -2,25 +2,26 @@ 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 = "1.1.1" //version of flow library
+ val Version = "1.1.0" //version of flow library
val NativeMajorVersion = 2 //major version of native API
val NativeMinorVersionPosix = 0 //minor version of native posix implementation
val NativeVersionPosix = NativeMajorVersion + "." + NativeMinorVersionPosix
- val release = settingKey[Boolean]("Indicates if this build is a release.")
val gitHeadCommitSha = settingKey[String]("Current commit sha.")
lazy val commonSettings: Seq[Setting[_]] = Seq(
organization := Organization,
scalaVersion := ScalaVersion,
- release in ThisBuild := sys.props("release") == "true",
+ isSnapshot := sys.props("release") != "true",
gitHeadCommitSha in ThisBuild := Process("git rev-parse HEAD").lines.head,
- version in ThisBuild:= { if (release.value ) Version else Version + "-" + gitHeadCommitSha.value },
+ version in ThisBuild:= { if (!isSnapshot.value) Version else Version + "-" + gitHeadCommitSha.value },
licenses := Seq(("BSD-3-Clause", url("http://opensource.org/licenses/BSD-3-Clause"))),
+ homepage := Some(url("http://github.com/jodersky/flow")),
resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/",
scalacOptions ++= Seq("-deprecation", "-unchecked", "-feature"))
@@ -31,13 +32,12 @@ object FlowBuild extends Build {
)
lazy val root: Project = (
- Project("root", file(".")).aggregate(flow)
+ Project("root", file(".")).aggregate(flow, flowPack)
settings(
publish := (),
publishLocal := ()
)
)
-
lazy val flow: Project = (
Project("flow", file("flow"))
@@ -51,8 +51,15 @@ object FlowBuild extends Build {
javahClasses := Seq("com.github.jodersky.flow.internal.NativeSerial"),
javahHeaderDirectory := (sourceDirectory in Compile).value / "native" / "include",
compileOrder in Compile := CompileOrder.Mixed,
- publishTo := Some("Sonatype Snapshots Nexus" at "https://oss.sonatype.org/content/repositories/snapshots"),
- credentials += Credentials(Path.userHome / ".ivy2" / ".credentials"),
+ publishMavenStyle := true,
+ publishTo := {
+ val nexus = "https://oss.sonatype.org/"
+ if (isSnapshot.value)
+ Some("snapshots" at nexus + "content/repositories/snapshots")
+ else
+ Some("releases" at nexus + "service/local/staging/deploy/maven2")
+ },
+ pomIncludeRepository := { _ => false },
libraryDependencies ++= Seq(
Dependencies.akkaActor,
Dependencies.ioCore,
@@ -67,15 +74,15 @@ object FlowBuild extends Build {
val compiler = "gcc"
val linker = compiler
- val cFlags = Seq("-O2", "-fPIC")
-
- val linkerFlags = Seq("-shared", s"-Wl,-soname,libflow.so.${NativeMajorVersion}")
- val binary = s"libflow.so"
+ val cFlags = List("-O2", "-fPIC")
+ val linkerFlags = List("-shared", s"-Wl,-soname,libflow.so.${NativeMajorVersion}")
+ val binary = "libflow.so"
val builds = List(
- NativeBuild("amd64-linux", "gcc", cFlags :+ "-m64", "gcc", linkerFlags :+ "-m64", binary),
- NativeBuild("x86-linux", "gcc", cFlags :+ "-m32", "gcc", linkerFlags :+ "-m32", binary),
- NativeBuild("arm-linux", "arm-linux-gnueabihf-gcc", cFlags, "arm-linux-gnueabihf-gcc", linkerFlags, binary)
+ 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
)
@@ -128,12 +135,32 @@ object FlowBuild extends Build {
}
}
+ 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)
+ }
+ }
+ )
+ //settings(NativeFatDefaults.settings: _*)
+ dependsOn(flow)
+ )
lazy val samplesTerminal = (
Project("flow-samples-terminal", file("flow-samples") / "flow-samples-terminal")
settings(commonSettings: _*)
settings(runSettings: _*)
- dependsOn(flow)
+ dependsOn(flowPack)
)