aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2016-01-24 13:04:15 -0800
committerJakob Odersky <jakob@odersky.com>2016-01-24 13:04:15 -0800
commit22ec7e9927ac62b01a8864eb4dcf506a561355b5 (patch)
treea9518463ab3d1e849088beb05958e336feb5fb09 /project
parent5521a9377fa35278e2407ab13b26f86b5ce4eb36 (diff)
downloadakka-serial-22ec7e9927ac62b01a8864eb4dcf506a561355b5.tar.gz
akka-serial-22ec7e9927ac62b01a8864eb4dcf506a561355b5.tar.bz2
akka-serial-22ec7e9927ac62b01a8864eb4dcf506a561355b5.zip
Use release plugin
Diffstat (limited to 'project')
-rw-r--r--project/Bintray.scala.notyet70
-rw-r--r--project/FlowBuild.scala1
-rw-r--r--project/Release.scala117
-rw-r--r--project/plugins.sbt22
4 files changed, 209 insertions, 1 deletions
diff --git a/project/Bintray.scala.notyet b/project/Bintray.scala.notyet
new file mode 100644
index 0000000..8bcf442
--- /dev/null
+++ b/project/Bintray.scala.notyet
@@ -0,0 +1,70 @@
+package flow
+
+import sbt._
+import sbt.Keys._
+import ch.jodersky.sbt.jni.plugins.JniPackaging
+import ch.jodersky.sbt.jni.plugins.JniPackaging.autoImport._
+import bintray._
+import bintray.BintrayPlugin.autoImport._
+
+/** Custom bintray tasks. */
+object CustomBintray extends AutoPlugin {
+
+ override def requires = JniPackaging && BintrayPlugin
+ override def trigger = allRequirements
+
+ object autoImport {
+
+ val unmanagedNativeZip = taskKey[File](
+ "Packages unmanaged native libraries in a zip file."
+ )
+
+ val publishNativeZip = taskKey[Unit](
+ "Signs and publishes native zip files to a generic bintray repository."
+ )
+
+ }
+ import autoImport._
+
+ lazy val settings: Seq[Setting[_]] = Seq(
+
+ unmanagedNativeZip := {
+ val out = target.value / (name.value + "-native.zip")
+
+ val files: Seq[File] = unmanagedNativeDirectories.value flatMap {dir =>
+ (dir ** "*").get.filter(_.isFile)
+ }
+ val baseDirectories: Seq[File] = unmanagedNativeDirectories.value
+
+ val mappings: Seq[(File,String)] = files pair Path.relativeTo(baseDirectories)
+
+ IO.zip(mappings, out)
+ out
+ },
+
+
+ publishNativeZip := {
+ val credsFile = bintrayCredentialsFile.value
+ val btyOrg = bintrayOrganization.value
+ val repoName = "generic"
+
+ val zip = unmanagedNativeZip.value
+
+ Bintray.withRepo(credsFile, btyOrg, repoName, prompt = false) { repo =>
+ //def upload(packageName: String, vers: String, path: String, f: File, log: Logger): Unit =
+
+ repo.upload(
+ "flow",
+ version.value,
+ zip.name,
+ zip,
+ streams.value.log
+ )
+ }
+ }
+
+ )
+
+ override def projectSettings = inConfig(Compile)(settings)
+
+}
diff --git a/project/FlowBuild.scala b/project/FlowBuild.scala
index be1b7ef..3d981a5 100644
--- a/project/FlowBuild.scala
+++ b/project/FlowBuild.scala
@@ -8,7 +8,6 @@ object FlowBuild extends Build {
val scalaVersions = List("2.11.7", "2.12.0-M3")
lazy val commonSettings: Seq[Setting[_]] = Seq(
- version := "2.4.0-RC1",
scalaVersion in ThisBuild := scalaVersions.head,
crossScalaVersions in ThisBuild := scalaVersions.reverse,
scalacOptions ++= Seq("-deprecation", "-unchecked", "-feature", "-target:jvm-1.8"),
diff --git a/project/Release.scala b/project/Release.scala
new file mode 100644
index 0000000..1992a8b
--- /dev/null
+++ b/project/Release.scala
@@ -0,0 +1,117 @@
+package flow
+
+import sbt._
+import sbtrelease._
+import sbtrelease.ReleasePlugin.autoImport._
+import sbtrelease.ReleaseStateTransformations._
+
+import ch.jodersky.sbt.jni.plugins.JniNative.autoImport._
+import ch.jodersky.sbt.jni.plugins.JniPackaging.autoImport._
+
+import com.typesafe.sbt.pgp.PgpKeys._
+
+object Release {
+
+
+ def settings: Seq[Setting[_]] = Seq(
+
+ //sign git tags
+ releaseVcs := Some(new SignedGit(Keys.baseDirectory.value)),
+
+ //publish signed
+ releasePublishArtifactsAction := publishSigned.value,
+
+ //build for multiple scala versions,
+ releaseCrossBuild := true,
+
+ releaseProcess := Seq[ReleaseStep](
+
+ //Check that there are no snapshot dependencies
+ checkSnapshotDependencies,
+
+ //During a release, only native libraries in lib_native will be packaged
+ disableLocalBuild,
+
+ //Check that there are native libraries in lib_native and list all
+ //libraries that will be packaged
+ checkNativeLibs,
+
+ //Ask for release version and next development version
+ inquireVersions,
+
+ //Set version to release version and save
+ setReleaseVersion,
+
+ //Clean
+ runClean,
+
+ //Compile and test
+ runTest,
+
+ //If all tests pass, commit the updated version
+ commitReleaseVersion,
+
+ //Also create a tag
+ tagRelease,
+
+ //Publish artifacts, note that they will only be uploaded, not yet be released to the public
+ publishArtifacts,
+
+ //Bump version to next development
+ setNextVersion,
+
+ //update website
+
+ //Commit
+ commitNextVersion,
+
+ //Push all changes (commits and tags) to GitHub
+ pushChanges
+
+ //Release artifact on bintray
+ )
+ )
+
+ /** Set `enableNativeCompilations` to false. */
+ lazy val disableLocalBuild = ReleaseStep(st => {
+ val st1 = ReleaseStateTransformations.reapply(Seq(
+ enableNativeCompilation in FlowBuild.native in Compile := false
+ ), st)
+ st1.log.info("Disabled compilation of native libraries during release process.")
+ st1
+ })
+
+ /** Release step that prints all native libraries that will be packaged
+ * and awaits approval from user. */
+ lazy val checkNativeLibs = ReleaseStep(action = st0 => {
+ val log = st0.log
+ val project = FlowBuild.native
+
+ val extracted = Project.extract(st0)
+ val (st1, libs) = extracted.runTask(unmanagedNativeLibraries in project in Compile, st0)
+
+ log.info("The following native libraries will be packaged:")
+ log.info("Kernel\tArchitecture\tFile")
+ log.info("---------------------")
+ libs.toSeq.sortBy(_._1.id).foreach{ case (platform, file) =>
+ log.info(platform.kernel + "\t" + platform.arch + "\t" + file.getAbsolutePath)
+ }
+
+ val currentPlatform = extracted.get(nativePlatform in project in Compile)
+ if (!libs.contains(currentPlatform)) {
+ log.warn("Native library for the current platform does not exist! It will not be released.")
+ }
+ SimpleReader.readLine("Are the all native libraries listed (y/n)? [n] ") match {
+ case Some("y") => //do nothing
+ case _ => sys.error("Mssing native libaries. Aborting release.")
+ }
+ st1
+ })
+
+ /** A Git wrapper that signs tags. */
+ class SignedGit(baseDir: File) extends Git(baseDir) {
+ override def tag(name: String, comment: String, force: Boolean = false) =
+ cmd("tag", "-s", name, "-m", comment, if(force) "-f" else "")
+ }
+
+}
diff --git a/project/plugins.sbt b/project/plugins.sbt
index edd4ad3..4262019 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,7 +1,29 @@
+/*
+ * Main plugins
+ */
+
+// Build, package and load native libraries
addSbtPlugin("ch.jodersky" %% "sbt-jni" % "0.3.0")
+
+/*
+ * Utility plugins, can be disabled during plain build
+ */
+
+// Generate documentation for all sources
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.3.3")
+// Build website
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.8.2")
+// Integrate website with GitHub pages
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.4")
+
+// Automate release process
+addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.0")
+
+// Usually a global plugin, made explicit to work with release automation
+addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
+
+// Usually a global plugin, made explicit to work with release automation
+addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0")