diff options
Diffstat (limited to 'project')
-rw-r--r-- | project/FlowBuild.scala | 77 | ||||
-rw-r--r-- | project/jni.scala | 4 | ||||
-rw-r--r-- | project/uniqueVersion.scala | 21 |
3 files changed, 62 insertions, 40 deletions
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 |