From 5d631ebba2829fa10b66149a8405534cd2143a0d Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Sun, 4 Dec 2016 00:30:11 -0800 Subject: Refactor project to use .sbt build definitions and add continuous deployment script --- project/Dependencies.scala | 4 +- project/FlowBuild.scala | 64 -------------------------- project/Release.scala | 111 --------------------------------------------- project/plugins.sbt | 9 ++-- 4 files changed, 5 insertions(+), 183 deletions(-) delete mode 100644 project/FlowBuild.scala delete mode 100644 project/Release.scala (limited to 'project') diff --git a/project/Dependencies.scala b/project/Dependencies.scala index f02b039..0e7d1ac 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -7,7 +7,7 @@ object Dependencies { val akkaActor = "com.typesafe.akka" %% "akka-actor" % "2.4.14" val akkaStream ="com.typesafe.akka" %% "akka-stream" % "2.4.14" - val akkaTestKit = "com.typesafe.akka" %% "akka-testkit" % "2.4.14" % "test" - val scalatest = "org.scalatest" %% "scalatest" % "3.0.1" % "test" + val akkaTestKit = "com.typesafe.akka" %% "akka-testkit" % "2.4.14" + val scalatest = "org.scalatest" %% "scalatest" % "3.0.1" } diff --git a/project/FlowBuild.scala b/project/FlowBuild.scala deleted file mode 100644 index 19042b6..0000000 --- a/project/FlowBuild.scala +++ /dev/null @@ -1,64 +0,0 @@ -package flow - -import sbt._ -import Keys._ - -object FlowBuild extends Build { - - val scalaVersions = List("2.11.8", "2.12.0") - - lazy val commonSettings: Seq[Setting[_]] = Seq( - resolvers += Resolver.jcenterRepo, - scalaVersion := scalaVersions.head, - crossScalaVersions := scalaVersions.reverse, - scalacOptions ++= Seq("-deprecation", "-unchecked", "-feature", "-target:jvm-1.8"), - organization := "ch.jodersky", - licenses := Seq(("BSD New", url("http://opensource.org/licenses/BSD-3-Clause"))), - homepage := Some(url("https://jodersky.github.io/flow")), - 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 := { - - git@github.com:jodersky/flow.git - scm:git:git@github.com:jodersky/flow.git - - - - jodersky - Jakob Odersky - - - } - ) - - lazy val root = (project in file(".")). - aggregate(core, native, stream) - - lazy val core = (project in file("flow-core")). - settings(name:= "flow-core"). - dependsOn(native % "test->runtime") - - lazy val native = (project in file("flow-native")). - settings(name:= "flow-native") - - lazy val stream = (project in file("flow-stream")). - settings(name:= "flow-stream"). - dependsOn(core, core % "test->test", native % "test->runtime") - - lazy val samplesTerminal = (project in file("flow-samples") / "terminal"). - dependsOn(core, native % Runtime) - - lazy val samplesTerminalStream = (project in file("flow-samples") / "terminal-stream"). - dependsOn(stream, native % Runtime) - - lazy val samplesWatcher = (project in file("flow-samples") / "watcher"). - dependsOn(core, native % Runtime) - -} diff --git a/project/Release.scala b/project/Release.scala deleted file mode 100644 index a203262..0000000 --- a/project/Release.scala +++ /dev/null @@ -1,111 +0,0 @@ -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.JniPackage.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, - - //TODO: update website - - //Commit - commitNextVersion, - - //Push all changes (commits and tags) to GitHub - pushChanges - - ) - ) - - /** Set `enableNativeCompilations` to false. */ - lazy val disableLocalBuild = ReleaseStep(st => { - val st1 = ReleaseStateTransformations.reapply(Seq( - enableNativeCompilation in FlowBuild.native in Compile := false, - enableNativeCompilation in FlowBuild.native in Test := 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("---------------------") - libs.toSeq.sortBy(_._2).foreach{ case (file, path) => - log.info(path) - } - SimpleReader.readLine("Are the all native libraries listed (y/n)? [n] ") match { - case Some("y") => //do nothing - case _ => sys.error("Missing 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 3db4586..2ff38e5 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -14,11 +14,8 @@ addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.3.3") // Generate website content addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.0.0") +// Sign published artifacts +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") + // Publish to sonatype and sync with maven central addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1") - -// 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") -- cgit v1.2.3