aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2014-04-15 23:52:40 +0200
committerJakob Odersky <jodersky@gmail.com>2014-04-15 23:52:40 +0200
commit975a07373e4ffe5ff269675bc8da896e60f84427 (patch)
treeefd7c87b086c1a8a5643b3939b50086b1ae05f01
parent416aacf8940ba0f281a3d7afb90f27b3ae99e664 (diff)
downloadakka-serial-975a07373e4ffe5ff269675bc8da896e60f84427.tar.gz
akka-serial-975a07373e4ffe5ff269675bc8da896e60f84427.tar.bz2
akka-serial-975a07373e4ffe5ff269675bc8da896e60f84427.zip
reorganize build
-rw-r--r--flow-native/Makefile.mac12
-rw-r--r--flow-native/flow/flow_jni.c (renamed from flow-native/flow_jni.c)0
-rw-r--r--flow-native/mac/Makefile12
-rw-r--r--flow-native/mac/Readme2
-rw-r--r--flow-native/platform/posix/flow.c (renamed from flow-native/posix/flow.c)0
-rw-r--r--flow-native/platform/windows/README (renamed from flow-native/windows/README)0
-rw-r--r--flow-native/platform/windows/flow.c.disabled (renamed from flow-native/windows/flow.c.disabled)0
-rw-r--r--project/FlowBuild.scala77
-rw-r--r--project/jni.scala4
-rw-r--r--project/uniqueVersion.scala21
10 files changed, 74 insertions, 54 deletions
diff --git a/flow-native/Makefile.mac b/flow-native/Makefile.mac
new file mode 100644
index 0000000..03418e7
--- /dev/null
+++ b/flow-native/Makefile.mac
@@ -0,0 +1,12 @@
+# Include common settings
+include ../common.mk
+
+JAVALIB=lib$(NAME)$(MAJOR).dylib
+
+all: $(JAVALIB)
+
+$(JAVALIB):
+ gcc -dynamiclib -I$(JAVA_HOME)/include/darwin -I$(JAVA_HOME)/include -I../include ../flow_jni.c ../posix/flow.c -o $(JAVALIB) -m64
+
+clean:
+ -del $(JAVALIB) \ No newline at end of file
diff --git a/flow-native/flow_jni.c b/flow-native/flow/flow_jni.c
index 8ec2aed..8ec2aed 100644
--- a/flow-native/flow_jni.c
+++ b/flow-native/flow/flow_jni.c
diff --git a/flow-native/mac/Makefile b/flow-native/mac/Makefile
deleted file mode 100644
index 0f73b68..0000000
--- a/flow-native/mac/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# Include common settings
-include ../common.mk
-
-JAVALIB=lib$(NAME)$(MAJOR).dylib
-
-all: $(JAVALIB)
-
-$(JAVALIB):
- gcc -dynamiclib -I$(JAVA_HOME)/include/darwin -I$(JAVA_HOME)/include -I../include ../flow_jni.c ../posix/flow.c -o $(JAVALIB) -m64
-
-clean:
- -del $(JAVALIB) \ No newline at end of file
diff --git a/flow-native/mac/Readme b/flow-native/mac/Readme
deleted file mode 100644
index 6df640b..0000000
--- a/flow-native/mac/Readme
+++ /dev/null
@@ -1,2 +0,0 @@
-You should be able to build on OSX by just running make in this directory.
-The libFlow3.dylib file produced will have to be copied manually into the classpath of your project \ No newline at end of file
diff --git a/flow-native/posix/flow.c b/flow-native/platform/posix/flow.c
index 1adb10c..1adb10c 100644
--- a/flow-native/posix/flow.c
+++ b/flow-native/platform/posix/flow.c
diff --git a/flow-native/windows/README b/flow-native/platform/windows/README
index 3d24410..3d24410 100644
--- a/flow-native/windows/README
+++ b/flow-native/platform/windows/README
diff --git a/flow-native/windows/flow.c.disabled b/flow-native/platform/windows/flow.c.disabled
index 86a267c..86a267c 100644
--- a/flow-native/windows/flow.c.disabled
+++ b/flow-native/platform/windows/flow.c.disabled
diff --git a/project/FlowBuild.scala b/project/FlowBuild.scala
index 4d51d33..cce9ea3 100644
--- a/project/FlowBuild.scala
+++ b/project/FlowBuild.scala
@@ -1,24 +1,49 @@
import sbt._
import Keys._
import JniKeys._
+import UniqueVersionKeys._
+
object FlowBuild extends Build {
val Organization = "com.github.jodersky"
val ScalaVersion = "2.10.3"
- val Version = "2.0.0-RC2" //version of flow library
+ val Version = "2.0.0-RC2"
- val gitHeadCommitSha = settingKey[String]("Current commit sha.")
- lazy val commonSettings: Seq[Setting[_]] = Seq(
- organization := Organization,
- scalaVersion := ScalaVersion,
- isSnapshot := sys.props("release") != "true",
- gitHeadCommitSha in ThisBuild := Process("git rev-parse HEAD").lines.head,
- 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"))
+ lazy val commonSettings: Seq[Setting[_]] =
+ UniqueVersionDefaults.settings ++
+ Seq(
+ organization := Organization,
+ scalaVersion := ScalaVersion,
+ baseVersion := Version,
+ 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"))
+
+ lazy val publishSettings: Seq[Setting[_]] = Seq(
+ 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 },
+ 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,
@@ -37,35 +62,13 @@ object FlowBuild extends Build {
lazy val flow: Project = (
Project("flow", file("flow"))
settings (commonSettings: _*)
+ settings (publishSettings: _*)
settings (JniDefaults.settings: _*)
settings(
- javahClasses := Seq("com.github.jodersky.flow.internal.NativeSerial"),
javahHeaderDirectory := (baseDirectory in ThisBuild).value / "flow-native" / "include",
+ javahClasses := Seq("com.github.jodersky.flow.internal.NativeSerial"),
compileOrder in Compile := CompileOrder.Mixed,
- 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 },
- 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>
- },
- libraryDependencies ++= Seq(
- Dependencies.akkaActor
- )
+ libraryDependencies += Dependencies.akkaActor
)
)
diff --git a/project/jni.scala b/project/jni.scala
index e87f0c7..6686078 100644
--- a/project/jni.scala
+++ b/project/jni.scala
@@ -3,7 +3,6 @@ import Keys._
import scala.util.Try
object JniKeys {
- val jdkHome = settingKey[Option[File]]("Home of JDK.")
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.")
@@ -14,7 +13,6 @@ object JniDefaults {
import JniKeys._
val settings: Seq[Setting[_]] = Seq(
- jdkHome := Try(file(sys.env("JAVA_HOME"))).toOption,
javahHeaderDirectory := baseDirectory.value,
javahClasspath := Seq((classDirectory in Compile).value),
javah := javahImpl.value
@@ -22,7 +20,7 @@ object JniDefaults {
def javahImpl = Def.task {
val jcp = javahClasspath.value
- val cp = jcp.mkString(":")
+ val cp = jcp.mkString(sys.props("path.separator"))
for (clazz <- javahClasses.value) {
val parts = Seq(
"javah",
diff --git a/project/uniqueVersion.scala b/project/uniqueVersion.scala
new file mode 100644
index 0000000..1a7860f
--- /dev/null
+++ b/project/uniqueVersion.scala
@@ -0,0 +1,21 @@
+import sbt._
+import Keys._
+
+object UniqueVersionKeys {
+
+ val gitHeadCommitSha = settingKey[String]("Current commit sha.")
+ val baseVersion = settingKey[String]("Base part of version, string without unique hash appended.")
+ val isRelease = settingKey[Boolean]("Is this a release? Should the unique hash be appended to the version string?")
+
+}
+
+object UniqueVersionDefaults {
+ import UniqueVersionKeys._
+
+ lazy val settings: Seq[Setting[_]] = Seq(
+ gitHeadCommitSha := Process("git rev-parse HEAD").lines.head,
+ isRelease := sys.props("release") == "true",
+ version := { if (isRelease.value) baseVersion.value else baseVersion.value + "-" + gitHeadCommitSha.value }
+ )
+
+} \ No newline at end of file