Port build to SBT 1.x (#23850)

* Port build to SBT 1.x

* Fix multinode tests, always enable genjavadoc bootstrap
This commit is contained in:
Martynas Mickevičius 2017-10-30 03:13:14 +02:00 committed by Konrad `ktoso` Malawski
parent 38622246d9
commit 82ca8a2cc7
44 changed files with 443 additions and 495 deletions

View file

@ -1,8 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting }
AkkaBuild.defaultSettings
AkkaBuild.dontPublishSettings
Formatting.formatSettings
Dependencies.actorTests
disablePlugins(MimaPlugin)

View file

@ -1,13 +0,0 @@
import akka.{ AkkaBuild, Formatting, OSGi, Dependencies, Version }
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.actor
Dependencies.actor
Version.versionSettings
unmanagedSourceDirectories in Compile += {
val ver = scalaVersion.value.take(4)
(scalaSource in Compile).value.getParentFile / s"scala-$ver"
}
enablePlugins(spray.boilerplate.BoilerplatePlugin)

View file

@ -1,8 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting, OSGi, ScaladocNoVerificationOfDiagrams }
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.agent
Dependencies.agent
enablePlugins(ScaladocNoVerificationOfDiagrams)

View file

@ -1,12 +0,0 @@
import akka._
import com.typesafe.sbt.pgp.PgpKeys.publishSigned
enablePlugins(JmhPlugin, ScaladocNoVerificationOfDiagrams)
disablePlugins(Unidoc, MimaPlugin)
AkkaBuild.defaultSettings
Formatting.formatSettings
AkkaBuild.dontPublishSettings
AkkaBuild.dontPublishDocsSettings
Dependencies.benchJmh

View file

@ -1,6 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting, OSGi }
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.camel
Dependencies.camel

View file

@ -1,12 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting, OSGi, MultiNodeScalaTest, SigarLoader }
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys._
AkkaBuild.defaultSettings
Formatting.formatSettings
SigarLoader.sigarSettings
OSGi.clusterMetrics
Dependencies.clusterMetrics
parallelExecution in Test := false
enablePlugins(MultiNodeScalaTest)

View file

@ -1,8 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting, MultiNode, ScaladocNoVerificationOfDiagrams, OSGi }
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.clusterSharding
Dependencies.clusterSharding
enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams)

View file

@ -1,8 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting, MultiNode, ScaladocNoVerificationOfDiagrams, OSGi }
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.clusterTools
Dependencies.clusterTools
enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams)

View file

@ -1,12 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting, OSGi, MultiNodeScalaTest }
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys._
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.cluster
Dependencies.cluster
// disable parallel tests
parallelExecution in Test := false
enablePlugins(MultiNodeScalaTest)

View file

@ -1,20 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting, OSGi, MultiNode, ScaladocNoVerificationOfDiagrams }
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.contrib
Dependencies.contrib
description := """|
|This subproject provides a home to modules contributed by external
|developers which may or may not move into the officially supported code
|base over time. A module in this subproject doesn't have to obey the rule
|of staying binary compatible between minor releases. Breaking API changes
|may be introduced in minor releases without notice as we refine and
|simplify based on your feedback. A module may be dropped in any release
|without prior deprecation. The Lightbend subscription does not cover
|support for these modules.
|""".stripMargin
enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams)
disablePlugins(MimaPlugin)

View file

@ -1,8 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting, MultiNode, Unidoc, OSGi }
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.distributedData
Dependencies.distributedData
enablePlugins(MultiNodeScalaTest)

View file

@ -1,55 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting, GitHub }
import akka.ValidatePullRequest._
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
AkkaBuild.defaultSettings
AkkaBuild.dontPublishSettings
Formatting.docFormatSettings
Dependencies.docs
unmanagedSourceDirectories in ScalariformKeys.format in Test := (unmanagedSourceDirectories in Test).value
additionalTasks in ValidatePR += paradox in Compile
enablePlugins(ScaladocNoVerificationOfDiagrams)
disablePlugins(MimaPlugin)
enablePlugins(AkkaParadoxPlugin)
name in (Compile, paradox) := "Akka"
val paradoxBrowse = taskKey[Unit]("Open the docs in the default browser")
paradoxBrowse := {
import java.awt.Desktop
val rootDocFile = (target in (Compile, paradox)).value / "index.html"
val log = streams.value.log
if (!rootDocFile.exists()) log.info("No generated docs found, generate with the 'paradox' task")
else if (Desktop.isDesktopSupported) Desktop.getDesktop.open(rootDocFile)
else log.info(s"Couldn't open default browser, but docs are at $rootDocFile")
}
paradoxProperties ++= Map(
"akka.canonical.base_url" -> "http://doc.akka.io/docs/akka/current",
"github.base_url" -> GitHub.url(version.value), // for links like this: @github[#1](#1) or @github[83986f9](83986f9)
"extref.akka.http.base_url" -> "http://doc.akka.io/docs/akka-http/current/%s",
"extref.wikipedia.base_url" -> "https://en.wikipedia.org/wiki/%s",
"extref.github.base_url" -> (GitHub.url(version.value) + "/%s"), // for links to our sources
"extref.samples.base_url" -> "https://github.com/akka/akka-samples/tree/2.5/%s",
"extref.ecs.base_url" -> "https://example.lightbend.com/v1/download/%s",
"scaladoc.akka.base_url" -> "https://doc.akka.io/api/akka/2.5",
"scaladoc.akka.http.base_url" -> "https://doc.akka.io/api/akka-http/current",
"javadoc.akka.base_url" -> "https://doc.akka.io/japi/akka/2.5",
"javadoc.akka.http.base_url" -> "http://doc.akka.io/japi/akka-http/current",
"scala.version" -> scalaVersion.value,
"scala.binary_version" -> scalaBinaryVersion.value,
"akka.version" -> version.value,
"sigar_loader.version" -> "1.6.6-rev002",
"algolia.docsearch.api_key" -> "543bad5ad786495d9ccd445ed34ed082",
"algolia.docsearch.index_name" -> "akka_io",
"google.analytics.account" -> "UA-21117439-1",
"google.analytics.domain.name" -> "akka.io",
"snip.code.base_dir" -> (sourceDirectory in Test).value.getAbsolutePath,
"snip.akka.base_dir" -> (baseDirectory in ThisBuild).value.getAbsolutePath,
"fiddle.code.base_dir" -> (sourceDirectory in Test).value.getAbsolutePath
)
paradoxGroups := Map("Languages" -> Seq("Scala", "Java"))
resolvers += Resolver.jcenterRepo

View file

@ -1,5 +0,0 @@
import akka.{AkkaBuild, Formatting}
AkkaBuild.mayChangeSettings
AkkaBuild.defaultSettings
Formatting.formatSettings

View file

@ -1,8 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting, OSGi }
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.osgi
Dependencies.osgi
parallelExecution in Test := false

View file

@ -1,10 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting, ScaladocNoVerificationOfDiagrams, OSGi }
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.persistenceQuery
Dependencies.persistenceQuery
fork in Test := true
enablePlugins(ScaladocNoVerificationOfDiagrams)

View file

@ -1,10 +0,0 @@
import akka._
AkkaBuild.defaultSettings
AkkaBuild.dontPublishSettings
Formatting.formatSettings
Dependencies.persistenceShared
fork in Test := true
disablePlugins(MimaPlugin)

View file

@ -1,10 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting, OSGi }
AkkaBuild.defaultSettings
Formatting.formatSettings
// OSGi.persistenceTck TODO: we do need to export this as OSGi bundle too?
Dependencies.persistenceTck
fork in Test := true
disablePlugins(MimaPlugin)

View file

@ -1,8 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting, OSGi }
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.persistence
Dependencies.persistence
fork in Test := true

View file

@ -1,8 +0,0 @@
import akka.{ AkkaBuild, Formatting, OSGi, Unidoc, Dependencies }
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.protobuf
enablePlugins(ScaladocNoVerificationOfDiagrams)
disablePlugins(MimaPlugin)

View file

@ -1,14 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting, MultiNodeScalaTest, Unidoc }
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys._
AkkaBuild.defaultSettings
AkkaBuild.dontPublishSettings
Formatting.formatSettings
Dependencies.remoteTests
// disable parallel tests
parallelExecution in Test := false
publishArtifact in Compile := false
enablePlugins(MultiNodeScalaTest)
disablePlugins(MimaPlugin)

View file

@ -1,8 +0,0 @@
import akka.{AkkaBuild, Dependencies, Formatting, OSGi}
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.remote
Dependencies.remote
parallelExecution in Test := false

View file

@ -1,6 +0,0 @@
import akka.{ AkkaBuild, Dependencies, Formatting, OSGi }
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.slf4j
Dependencies.slf4j

View file

@ -1,6 +0,0 @@
import akka._
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.streamTestkit
Dependencies.streamTestkit

View file

@ -1,14 +0,0 @@
import akka._
AkkaBuild.defaultSettings
AkkaBuild.dontPublishSettings
Formatting.formatSettings
Dependencies.streamTestsTck
disablePlugins(MimaPlugin)
// These TCK tests are using System.gc(), which
// is causing long GC pauses when running with G1 on
// the CI build servers. Therefore we fork these tests
// to run with small heap without G1.
fork in Test := true

View file

@ -1,8 +0,0 @@
import akka._
AkkaBuild.defaultSettings
AkkaBuild.dontPublishSettings
Formatting.formatSettings
Dependencies.streamTests
disablePlugins(MimaPlugin)

View file

@ -1,8 +0,0 @@
import akka._
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.stream
Dependencies.stream
enablePlugins(spray.boilerplate.BoilerplatePlugin)

View file

@ -1,8 +0,0 @@
import akka.{ AkkaBuild, Formatting, OSGi, Dependencies }
AkkaBuild.defaultSettings
Formatting.formatSettings
OSGi.testkit
Dependencies.testkit // to fix scaladoc generation
initialCommands += "import akka.testkit._"

View file

@ -1,6 +0,0 @@
import akka.{ AkkaBuild, Formatting, OSGi }
AkkaBuild.defaultSettings
Formatting.formatSettings
disablePlugins(MimaPlugin)

View file

@ -1,8 +0,0 @@
import akka.{ AkkaBuild, Formatting }
AkkaBuild.defaultSettings
AkkaBuild.mayChangeSettings
Formatting.formatSettings
disablePlugins(MimaPlugin)

View file

@ -1,16 +0,0 @@
import akka.{ AkkaBuild, Formatting }
AkkaBuild.defaultSettings
AkkaBuild.mayChangeSettings
Formatting.formatSettings
disablePlugins(MimaPlugin)
initialCommands := """
import akka.typed._
import akka.typed.scaladsl.Actor
import scala.concurrent._
import scala.concurrent.duration._
import akka.util.Timeout
implicit val timeout = Timeout(5.seconds)
"""

233
build.sbt
View file

@ -1,8 +1,12 @@
enablePlugins(akka.UnidocRoot, akka.TimeStampede, akka.UnidocWithPrValidation) enablePlugins(UnidocRoot, TimeStampede, UnidocWithPrValidation, NoPublish)
disablePlugins(MimaPlugin) disablePlugins(MimaPlugin)
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.MultiJvm import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.MultiJvm
import com.typesafe.tools.mima.plugin.MimaPlugin import com.typesafe.tools.mima.plugin.MimaPlugin
import spray.boilerplate.BoilerplatePlugin
import akka.AkkaBuild._ import akka.AkkaBuild._
import akka.{AkkaBuild, Dependencies, GitHub, OSGi, Protobuf, SigarLoader, VersionGenerator}
import sbt.Keys.{initialCommands, parallelExecution}
initialize := { initialize := {
// Load system properties from a file to make configuration from Jenkins easier // Load system properties from a file to make configuration from Jenkins easier
@ -42,16 +46,33 @@ lazy val root = Project(
.settings(unidocRootIgnoreProjects := Seq(remoteTests, benchJmh, protobuf, akkaScalaNightly, docs)) .settings(unidocRootIgnoreProjects := Seq(remoteTests, benchJmh, protobuf, akkaScalaNightly, docs))
lazy val actor = akkaModule("akka-actor") lazy val actor = akkaModule("akka-actor")
.settings(Dependencies.actor)
.settings(OSGi.actor)
.settings(
unmanagedSourceDirectories in Compile += {
val ver = scalaVersion.value.take(4)
(scalaSource in Compile).value.getParentFile / s"scala-$ver"
}
)
.settings(VersionGenerator.settings)
.enablePlugins(BoilerplatePlugin)
lazy val actorTests = akkaModule("akka-actor-tests") lazy val actorTests = akkaModule("akka-actor-tests")
.dependsOn(testkit % "compile->compile;test->test") .dependsOn(testkit % "compile->compile;test->test")
.settings(Dependencies.actorTests)
.enablePlugins(NoPublish)
.disablePlugins(MimaPlugin, WhiteSourcePlugin)
lazy val agent = akkaModule("akka-agent") lazy val agent = akkaModule("akka-agent")
.dependsOn(actor, testkit % "test->test") .dependsOn(actor, testkit % "test->test")
.settings(Dependencies.agent)
.settings(OSGi.agent)
.enablePlugins(ScaladocNoVerificationOfDiagrams)
lazy val akkaScalaNightly = akkaModule("akka-scala-nightly") lazy val akkaScalaNightly = akkaModule("akka-scala-nightly")
// remove dependencies that we have to build ourselves (Scala STM) // remove dependencies that we have to build ourselves (Scala STM)
.aggregate(aggregatedProjects diff List[ProjectReference](agent, docs): _*) .aggregate(aggregatedProjects diff List[ProjectReference](agent, docs): _*)
.disablePlugins(MimaPlugin)
.disablePlugins(ValidatePullRequest, MimaPlugin) .disablePlugins(ValidatePullRequest, MimaPlugin)
lazy val benchJmh = akkaModule("akka-bench-jmh") lazy val benchJmh = akkaModule("akka-bench-jmh")
@ -62,18 +83,39 @@ lazy val benchJmh = akkaModule("akka-bench-jmh")
persistence, distributedData, persistence, distributedData,
testkit testkit
).map(_ % "compile->compile;compile->test;provided->provided"): _* ).map(_ % "compile->compile;compile->test;provided->provided"): _*
).disablePlugins(ValidatePullRequest) )
.settings(Dependencies.benchJmh)
.enablePlugins(JmhPlugin, ScaladocNoVerificationOfDiagrams, NoPublish)
.disablePlugins(MimaPlugin, WhiteSourcePlugin, ValidatePullRequest)
lazy val camel = akkaModule("akka-camel") lazy val camel = akkaModule("akka-camel")
.dependsOn(actor, slf4j, testkit % "test->test") .dependsOn(actor, slf4j, testkit % "test->test")
.settings(Dependencies.camel)
.settings(OSGi.camel)
lazy val cluster = akkaModule("akka-cluster") lazy val cluster = akkaModule("akka-cluster")
.dependsOn(remote, remoteTests % "test->test" , testkit % "test->test") .dependsOn(remote, remoteTests % "test->test" , testkit % "test->test")
.settings(Dependencies.cluster)
.settings(OSGi.cluster)
.settings(Protobuf.settings)
.settings(
parallelExecution in Test := false
)
.configs(MultiJvm) .configs(MultiJvm)
.enablePlugins(MultiNodeScalaTest)
lazy val clusterMetrics = akkaModule("akka-cluster-metrics") lazy val clusterMetrics = akkaModule("akka-cluster-metrics")
.dependsOn(cluster % "compile->compile;test->test;multi-jvm->multi-jvm", slf4j % "test->compile") .dependsOn(cluster % "compile->compile;test->test;multi-jvm->multi-jvm", slf4j % "test->compile")
.settings(OSGi.clusterMetrics)
.settings(Dependencies.clusterMetrics)
.settings(Protobuf.settings)
.settings(SigarLoader.sigarSettings)
.settings(
parallelExecution in Test := false
)
.configs(MultiJvm) .configs(MultiJvm)
.enablePlugins(MultiNodeScalaTest)
lazy val clusterSharding = akkaModule("akka-cluster-sharding") lazy val clusterSharding = akkaModule("akka-cluster-sharding")
// TODO akka-persistence dependency should be provided in pom.xml artifact. // TODO akka-persistence dependency should be provided in pom.xml artifact.
@ -81,23 +123,52 @@ lazy val clusterSharding = akkaModule("akka-cluster-sharding")
// Scope "test" is alright in the pom.xml, but would have been nicer with // Scope "test" is alright in the pom.xml, but would have been nicer with
// provided. // provided.
.dependsOn( .dependsOn(
cluster % "compile->compile;test->test;multi-jvm->multi-jvm", cluster % "compile->compile;test->test;multi-jvm->multi-jvm",
distributedData, distributedData,
persistence % "compile->compile;test->provided", persistence % "compile->compile;test->provided",
clusterTools) clusterTools
)
.settings(Dependencies.clusterSharding)
.settings(OSGi.clusterSharding)
.settings(Protobuf.settings)
.configs(MultiJvm) .configs(MultiJvm)
.enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams)
lazy val clusterTools = akkaModule("akka-cluster-tools") lazy val clusterTools = akkaModule("akka-cluster-tools")
.dependsOn(cluster % "compile->compile;test->test;multi-jvm->multi-jvm") .dependsOn(cluster % "compile->compile;test->test;multi-jvm->multi-jvm")
.settings(Dependencies.clusterTools)
.settings(OSGi.clusterTools)
.settings(Protobuf.settings)
.configs(MultiJvm) .configs(MultiJvm)
.enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams)
lazy val contrib = akkaModule("akka-contrib") lazy val contrib = akkaModule("akka-contrib")
.dependsOn(remote, remoteTests % "test->test", cluster, clusterTools, persistence % "compile->compile;test->provided") .dependsOn(remote, remoteTests % "test->test", cluster, clusterTools, persistence % "compile->compile;test->provided")
.settings(Dependencies.contrib)
.settings(OSGi.contrib)
.settings(
description := """|
|This subproject provides a home to modules contributed by external
|developers which may or may not move into the officially supported code
|base over time. A module in this subproject doesn't have to obey the rule
|of staying binary compatible between minor releases. Breaking API changes
|may be introduced in minor releases without notice as we refine and
|simplify based on your feedback. A module may be dropped in any release
|without prior deprecation. The Lightbend subscription does not cover
|support for these modules.
|""".stripMargin
)
.configs(MultiJvm) .configs(MultiJvm)
.enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams)
.disablePlugins(MimaPlugin)
lazy val distributedData = akkaModule("akka-distributed-data") lazy val distributedData = akkaModule("akka-distributed-data")
.dependsOn(cluster % "compile->compile;test->test;multi-jvm->multi-jvm") .dependsOn(cluster % "compile->compile;test->test;multi-jvm->multi-jvm")
.settings(Dependencies.distributedData)
.settings(OSGi.distributedData)
.settings(Protobuf.settings)
.configs(MultiJvm) .configs(MultiJvm)
.enablePlugins(MultiNodeScalaTest)
lazy val docs = akkaModule("akka-docs") lazy val docs = akkaModule("akka-docs")
.dependsOn( .dependsOn(
@ -111,51 +182,159 @@ lazy val docs = akkaModule("akka-docs")
typedTests % "compile->compile;test->test", typedTests % "compile->compile;test->test",
streamTestkit % "compile->compile;test->test" streamTestkit % "compile->compile;test->test"
) )
.settings(Dependencies.docs)
.settings(
name in (Compile, paradox) := "Akka",
paradoxProperties ++= Map(
"akka.canonical.base_url" -> "http://doc.akka.io/docs/akka/current",
"github.base_url" -> GitHub.url(version.value), // for links like this: @github[#1](#1) or @github[83986f9](83986f9)
"extref.akka.http.base_url" -> "http://doc.akka.io/docs/akka-http/current/%s",
"extref.wikipedia.base_url" -> "https://en.wikipedia.org/wiki/%s",
"extref.github.base_url" -> (GitHub.url(version.value) + "/%s"), // for links to our sources
"extref.samples.base_url" -> "https://github.com/akka/akka-samples/tree/2.5/%s",
"extref.ecs.base_url" -> "https://example.lightbend.com/v1/download/%s",
"scaladoc.akka.base_url" -> "https://doc.akka.io/api/akka/2.5",
"scaladoc.akka.http.base_url" -> "https://doc.akka.io/api/akka-http/current",
"javadoc.akka.base_url" -> "https://doc.akka.io/japi/akka/2.5",
"javadoc.akka.http.base_url" -> "http://doc.akka.io/japi/akka-http/current",
"scala.version" -> scalaVersion.value,
"scala.binary_version" -> scalaBinaryVersion.value,
"akka.version" -> version.value,
"sigar_loader.version" -> "1.6.6-rev002",
"algolia.docsearch.api_key" -> "543bad5ad786495d9ccd445ed34ed082",
"algolia.docsearch.index_name" -> "akka_io",
"google.analytics.account" -> "UA-21117439-1",
"google.analytics.domain.name" -> "akka.io",
"snip.code.base_dir" -> (sourceDirectory in Test).value.getAbsolutePath,
"snip.akka.base_dir" -> (baseDirectory in ThisBuild).value.getAbsolutePath,
"fiddle.code.base_dir" -> (sourceDirectory in Test).value.getAbsolutePath
),
paradoxGroups := Map("Languages" -> Seq("Scala", "Java")),
resolvers += Resolver.jcenterRepo
)
.enablePlugins(AkkaParadoxPlugin, NoPublish, ParadoxBrowse, ScaladocNoVerificationOfDiagrams)
.disablePlugins(MimaPlugin, WhiteSourcePlugin)
lazy val multiNodeTestkit = akkaModule("akka-multi-node-testkit") lazy val multiNodeTestkit = akkaModule("akka-multi-node-testkit")
.dependsOn(remote, testkit) .dependsOn(remote, testkit)
.settings(Protobuf.settings)
.settings(AkkaBuild.mayChangeSettings)
lazy val osgi = akkaModule("akka-osgi") lazy val osgi = akkaModule("akka-osgi")
.dependsOn(actor) .dependsOn(actor)
.settings(Dependencies.osgi)
.settings(OSGi.osgi)
.settings(
parallelExecution in Test := false
)
lazy val persistence = akkaModule("akka-persistence") lazy val persistence = akkaModule("akka-persistence")
.dependsOn(actor, testkit % "test->test", protobuf) .dependsOn(actor, testkit % "test->test", protobuf)
.settings(Dependencies.persistence)
.settings(OSGi.persistence)
.settings(Protobuf.settings)
.settings(
fork in Test := true
)
lazy val persistenceQuery = akkaModule("akka-persistence-query") lazy val persistenceQuery = akkaModule("akka-persistence-query")
.dependsOn( .dependsOn(
stream, stream,
persistence % "compile->compile;provided->provided;test->test", persistence % "compile->compile;provided->provided;test->test",
streamTestkit % "test") streamTestkit % "test"
)
.settings(Dependencies.persistenceQuery)
.settings(OSGi.persistenceQuery)
.settings(
fork in Test := true
)
.enablePlugins(ScaladocNoVerificationOfDiagrams)
lazy val persistenceShared = akkaModule("akka-persistence-shared") lazy val persistenceShared = akkaModule("akka-persistence-shared")
.dependsOn(persistence % "test->test", testkit % "test->test", remote % "test", protobuf) .dependsOn(persistence % "test->test", testkit % "test->test", remote % "test", protobuf)
.settings(Dependencies.persistenceShared)
.settings(
fork in Test := true
)
.enablePlugins(NoPublish)
.disablePlugins(MimaPlugin, WhiteSourcePlugin)
lazy val persistenceTck = akkaModule("akka-persistence-tck") lazy val persistenceTck = akkaModule("akka-persistence-tck")
.dependsOn(persistence % "compile->compile;provided->provided;test->test", testkit % "compile->compile;test->test") .dependsOn(persistence % "compile->compile;provided->provided;test->test", testkit % "compile->compile;test->test")
.settings(Dependencies.persistenceTck)
//.settings(OSGi.persistenceTck) TODO: we do need to export this as OSGi bundle too?
.settings(
fork in Test := true
)
.disablePlugins(MimaPlugin)
lazy val protobuf = akkaModule("akka-protobuf") lazy val protobuf = akkaModule("akka-protobuf")
.settings(OSGi.protobuf)
.enablePlugins(ScaladocNoVerificationOfDiagrams)
.disablePlugins(MimaPlugin)
lazy val remote = akkaModule("akka-remote") lazy val remote = akkaModule("akka-remote")
.dependsOn(actor, stream, actorTests % "test->test", testkit % "test->test", streamTestkit % "test", protobuf) .dependsOn(actor, stream, actorTests % "test->test", testkit % "test->test", streamTestkit % "test", protobuf)
.settings(Dependencies.remote)
.settings(OSGi.remote)
.settings(Protobuf.settings)
.settings(
parallelExecution in Test := false
)
lazy val remoteTests = akkaModule("akka-remote-tests") lazy val remoteTests = akkaModule("akka-remote-tests")
.dependsOn(actorTests % "test->test", remote % "test->test", streamTestkit % "test", multiNodeTestkit) .dependsOn(actorTests % "test->test", remote % "test->test", streamTestkit % "test", multiNodeTestkit)
.settings(Dependencies.remoteTests)
.settings(Protobuf.settings)
.settings(
parallelExecution in Test := false
)
.configs(MultiJvm) .configs(MultiJvm)
.enablePlugins(MultiNodeScalaTest, NoPublish)
.disablePlugins(MimaPlugin, WhiteSourcePlugin)
lazy val slf4j = akkaModule("akka-slf4j") lazy val slf4j = akkaModule("akka-slf4j")
.dependsOn(actor, testkit % "test->test") .dependsOn(actor, testkit % "test->test")
.settings(Dependencies.slf4j)
.settings(OSGi.slf4j)
lazy val stream = akkaModule("akka-stream") lazy val stream = akkaModule("akka-stream")
.dependsOn(actor) .dependsOn(actor)
.settings(Dependencies.stream)
.settings(OSGi.stream)
.enablePlugins(BoilerplatePlugin)
lazy val streamTestkit = akkaModule("akka-stream-testkit") lazy val streamTestkit = akkaModule("akka-stream-testkit")
.dependsOn(stream, testkit % "compile->compile;test->test") .dependsOn(stream, testkit % "compile->compile;test->test")
.settings(Dependencies.streamTestkit)
.settings(OSGi.streamTestkit)
lazy val streamTests = akkaModule("akka-stream-tests") lazy val streamTests = akkaModule("akka-stream-tests")
.dependsOn(streamTestkit % "test->test", stream) .dependsOn(streamTestkit % "test->test", stream)
.settings(Dependencies.streamTests)
.enablePlugins(NoPublish)
.disablePlugins(MimaPlugin, WhiteSourcePlugin)
lazy val streamTestsTck = akkaModule("akka-stream-tests-tck") lazy val streamTestsTck = akkaModule("akka-stream-tests-tck")
.dependsOn(streamTestkit % "test->test", stream) .dependsOn(streamTestkit % "test->test", stream)
.settings(Dependencies.streamTestsTck)
.settings(
// These TCK tests are using System.gc(), which
// is causing long GC pauses when running with G1 on
// the CI build servers. Therefore we fork these tests
// to run with small heap without G1.
fork in Test := true
)
.enablePlugins(NoPublish)
.disablePlugins(MimaPlugin, WhiteSourcePlugin)
lazy val testkit = akkaModule("akka-testkit")
.dependsOn(actor)
.settings(Dependencies.testkit)
.settings(OSGi.testkit)
.settings(
initialCommands += "import akka.testkit._"
)
lazy val typed = akkaModule("akka-typed") lazy val typed = akkaModule("akka-typed")
.dependsOn( .dependsOn(
@ -164,27 +343,43 @@ lazy val typed = akkaModule("akka-typed")
cluster % "provided->compile", cluster % "provided->compile",
clusterTools % "provided->compile", clusterTools % "provided->compile",
clusterSharding % "provided->compile", clusterSharding % "provided->compile",
distributedData % "provided->compile") distributedData % "provided->compile"
)
.settings(AkkaBuild.mayChangeSettings)
.settings(
initialCommands := """
import akka.typed._
import akka.typed.scaladsl.Actor
import scala.concurrent._
import scala.concurrent.duration._
import akka.util.Timeout
implicit val timeout = Timeout(5.seconds)
"""
)
.disablePlugins(MimaPlugin)
lazy val typedTestkit = akkaModule("akka-typed-testkit")
.dependsOn(typed, testkit % "compile->compile;test->test")
.disablePlugins(MimaPlugin)
lazy val typedTests = akkaModule("akka-typed-tests") lazy val typedTests = akkaModule("akka-typed-tests")
.dependsOn(typed, typedTestkit % "compile->compile;test->provided;test->test")
// the provided dependencies
.dependsOn( .dependsOn(
typed,
typedTestkit % "compile->compile;test->provided;test->test",
// the provided dependencies
persistence % "compile->compile;test->test", persistence % "compile->compile;test->test",
cluster % "test->test", cluster % "test->test",
clusterTools, clusterTools,
clusterSharding, clusterSharding,
distributedData) distributedData
)
lazy val typedTestkit = akkaModule("akka-typed-testkit") .settings(AkkaBuild.mayChangeSettings)
.dependsOn(typed, testkit % "compile->compile;test->test") .disablePlugins(MimaPlugin)
lazy val testkit = akkaModule("akka-testkit")
.dependsOn(actor)
def akkaModule(name: String): Project = def akkaModule(name: String): Project =
Project(id = name, base = file(name)) Project(id = name, base = file(name))
.settings(akka.AkkaBuild.buildSettings) .settings(akka.AkkaBuild.buildSettings)
.settings(akka.AkkaBuild.defaultSettings)
.settings(akka.Formatting.formatSettings)
.enablePlugins(BootstrapGenjavadoc)

View file

@ -23,24 +23,12 @@ object AkkaBuild {
organization := "com.typesafe.akka", organization := "com.typesafe.akka",
version := "2.5-SNAPSHOT") version := "2.5-SNAPSHOT")
lazy val rootSettings = parentSettings ++ Release.settings ++ lazy val rootSettings = Release.settings ++
UnidocRoot.akkaSettings ++ UnidocRoot.akkaSettings ++
Formatting.formatSettings ++ Formatting.formatSettings ++
Protobuf.settings ++ Seq( Protobuf.settings ++ Seq(
parallelExecution in GlobalScope := System.getProperty("akka.parallelExecution", parallelExecutionByDefault.toString).toBoolean) parallelExecution in GlobalScope := System.getProperty("akka.parallelExecution", parallelExecutionByDefault.toString).toBoolean)
val dontPublishSettings = Seq(
publishSigned := (),
publish := (),
publishArtifact in Compile := false,
whitesourceIgnore := true)
val dontPublishDocsSettings = Seq(
sources in doc in Compile := List())
lazy val parentSettings = Seq(
publishArtifact := false) ++ dontPublishSettings
lazy val mayChangeSettings = Seq( lazy val mayChangeSettings = Seq(
description := """|This module of Akka is marked as description := """|This module of Akka is marked as
|'may change', which means that it is in early |'may change', which means that it is in early
@ -59,10 +47,22 @@ object AkkaBuild {
case null (Resolver.mavenLocal, Seq.empty) case null (Resolver.mavenLocal, Seq.empty)
case path case path
// Maven resolver settings // Maven resolver settings
def deliverPattern(outputPath: File): String =
(outputPath / "[artifact]-[revision](-[classifier]).[ext]").absolutePath
val resolver = Resolver.file("user-publish-m2-local", new File(path)) val resolver = Resolver.file("user-publish-m2-local", new File(path))
(resolver, Seq( (resolver, Seq(
otherResolvers := resolver :: publishTo.value.toList, otherResolvers := resolver :: publishTo.value.toList,
publishM2Configuration := Classpaths.publishConfig(packagedArtifacts.value, None, resolverName = resolver.name, checksums = checksums.in(publishM2).value, logging = ivyLoggingLevel.value, overwrite = true))) publishM2Configuration := Classpaths.publishConfig(
publishMavenStyle.value,
deliverPattern(crossTarget.value),
if (isSnapshot.value) "integration" else "release",
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
artifacts = packagedArtifacts.value.toVector,
resolverName = resolver.name,
checksums = checksums.in(publishM2).value.toVector,
logging = ivyLoggingLevel.value,
overwrite = true)))
} }
lazy val resolverSettings = { lazy val resolverSettings = {
@ -93,7 +93,6 @@ object AkkaBuild {
javacOptions in compile ++= Seq("-encoding", "UTF-8", "-source", "1.8", "-target", "1.8", "-Xlint:unchecked", "-XDignore.symbol.file"), javacOptions in compile ++= Seq("-encoding", "UTF-8", "-source", "1.8", "-target", "1.8", "-Xlint:unchecked", "-XDignore.symbol.file"),
javacOptions in compile ++= (if (allWarnings) Seq("-Xlint:deprecation") else Nil), javacOptions in compile ++= (if (allWarnings) Seq("-Xlint:deprecation") else Nil),
javacOptions in doc ++= Seq(), javacOptions in doc ++= Seq(),
incOptions := incOptions.value.withNameHashing(true),
crossVersion := CrossVersion.binary, crossVersion := CrossVersion.binary,
@ -173,7 +172,7 @@ object AkkaBuild {
original.map { group original.map { group
group.runPolicy match { group.runPolicy match {
case Tests.SubProcess(forkOptions) case Tests.SubProcess(forkOptions)
group.copy(runPolicy = Tests.SubProcess(forkOptions.copy( group.copy(runPolicy = Tests.SubProcess(forkOptions.withWorkingDirectory(
workingDirectory = Some(new File(System.getProperty("user.dir")))))) workingDirectory = Some(new File(System.getProperty("user.dir"))))))
case _ group case _ group
} }

View file

@ -154,7 +154,7 @@ object Dependencies {
val persistenceQuery = l ++= Seq(Test.scalatest.value, Test.junit, Test.commonsIo) val persistenceQuery = l ++= Seq(Test.scalatest.value, Test.junit, Test.commonsIo)
val persistenceTck = l ++= Seq(Test.scalatest.value.copy(configurations = Some("compile")), Test.junit.copy(configurations = Some("compile"))) val persistenceTck = l ++= Seq(Test.scalatest.value.withConfigurations(Some("compile")), Test.junit.withConfigurations(Some("compile")))
val persistenceShared = l ++= Seq(Provided.levelDB, Provided.levelDBNative) val persistenceShared = l ++= Seq(Provided.levelDB, Provided.levelDBNative)

View file

@ -4,8 +4,10 @@
package akka package akka
import sbt._ import sbt._
import sbtunidoc.Plugin.UnidocKeys._ import sbtunidoc.BaseUnidocPlugin.autoImport.{ unidoc, unidocProjectFilter }
import sbtunidoc.Plugin.{ ScalaUnidoc, JavaUnidoc, Genjavadoc, scalaJavaUnidocSettings, genjavadocExtraSettings, scalaUnidocSettings } import sbtunidoc.JavaUnidocPlugin.autoImport.JavaUnidoc
import sbtunidoc.ScalaUnidocPlugin.autoImport.ScalaUnidoc
import sbtunidoc.GenJavadocPlugin.autoImport.Genjavadoc
import sbt.Keys._ import sbt.Keys._
import sbt.File import sbt.File
import scala.annotation.tailrec import scala.annotation.tailrec
@ -100,15 +102,14 @@ object UnidocRoot extends AutoPlugin {
import autoImport._ import autoImport._
override def trigger = noTrigger override def trigger = noTrigger
override def requires =
UnidocRoot.CliOptions.genjavadocEnabled.ifTrue(sbtunidoc.ScalaUnidocPlugin && sbtunidoc.JavaUnidocPlugin && sbtunidoc.GenJavadocPlugin)
.getOrElse(sbtunidoc.ScalaUnidocPlugin)
val akkaSettings = UnidocRoot.CliOptions.genjavadocEnabled.ifTrue(Seq( val akkaSettings = UnidocRoot.CliOptions.genjavadocEnabled.ifTrue(
javacOptions in (JavaUnidoc, unidoc) ++= Seq("-Xdoclint:none"), Seq(javacOptions in (JavaUnidoc, unidoc) := Seq("-Xdoclint:none"))).getOrElse(Nil)
// genjavadoc needs to generate synthetic methods since the java code uses them
scalacOptions += "-P:genjavadoc:suppressSynthetic=false",
// FIXME: see #18056
sources in (JavaUnidoc, unidoc) ~= (_.filterNot(_.getPath.contains("Access$minusControl$minusAllow$minusOrigin"))))).getOrElse(Nil)
val settings = { override lazy val projectSettings = {
def unidocRootProjectFilter(ignoreProjects: Seq[Project]) = def unidocRootProjectFilter(ignoreProjects: Seq[Project]) =
ignoreProjects.foldLeft(inAnyProject) { _ -- inProjects(_) } ignoreProjects.foldLeft(inAnyProject) { _ -- inProjects(_) }
@ -117,23 +118,20 @@ object UnidocRoot extends AutoPlugin {
unidocProjectFilter in JavaUnidoc := unidocRootProjectFilter(unidocRootIgnoreProjects.value), unidocProjectFilter in JavaUnidoc := unidocRootProjectFilter(unidocRootIgnoreProjects.value),
apiMappings in ScalaUnidoc := (apiMappings in (Compile, doc)).value)) apiMappings in ScalaUnidoc := (apiMappings in (Compile, doc)).value))
} }
override lazy val projectSettings =
CliOptions.genjavadocEnabled.ifTrue(scalaJavaUnidocSettings).getOrElse(scalaUnidocSettings) ++ settings
} }
/** /**
* Unidoc settings for every multi-project. Adds genjavadoc specific settings. * Unidoc settings for every multi-project. Adds genjavadoc specific settings.
*/ */
object Unidoc extends AutoPlugin { object BootstrapGenjavadoc extends AutoPlugin {
override def trigger = allRequirements override def trigger = allRequirements
override def requires = plugins.JvmPlugin override def requires = UnidocRoot.CliOptions.genjavadocEnabled.ifTrue(sbtunidoc.GenJavadocPlugin)
.getOrElse(plugins.JvmPlugin)
override lazy val projectSettings = UnidocRoot.CliOptions.genjavadocEnabled.ifTrue( override lazy val projectSettings = UnidocRoot.CliOptions.genjavadocEnabled.ifTrue(
genjavadocExtraSettings ++ Seq( Seq(
scalacOptions in Compile += "-P:genjavadoc:fabricateParams=true", scalacOptions in Compile ++= Seq("-P:genjavadoc:fabricateParams=true", "-P:genjavadoc:suppressSynthetic=false")
unidocGenjavadocVersion in Global := "0.10", )
// FIXME: see #18056 ).getOrElse(Nil)
sources in (Genjavadoc, doc) ~= (_.filterNot(_.getPath.contains("Access$minusControl$minusAllow$minusOrigin"))))).getOrElse(Seq.empty)
} }

View file

@ -24,7 +24,7 @@ object MiMa extends AutoPlugin {
val akka24NoStreamVersions = Seq("2.4.0", "2.4.1") val akka24NoStreamVersions = Seq("2.4.0", "2.4.1")
val akka25Versions = (0 to latestMinorOf25).map(patch s"2.5.$patch") val akka25Versions = (0 to latestMinorOf25).map(patch s"2.5.$patch")
val akka24StreamVersions = (2 to 12) map ("2.4." + _) val akka24StreamVersions = (2 to 12) map ("2.4." + _)
val akka24WithAtLeastScala212 = val akka24WithScala212 =
(13 to latestMinorOf24) (13 to latestMinorOf24)
.map("2.4." + _) .map("2.4." + _)
.filterNot(_ == "2.4.15") // 2.4.15 was released from the wrong branch and never announced .filterNot(_ == "2.4.15") // 2.4.15 was released from the wrong branch and never announced
@ -41,10 +41,10 @@ object MiMa extends AutoPlugin {
else { else {
if (!akka242NewArtifacts.contains(projectName)) akka24NoStreamVersions if (!akka242NewArtifacts.contains(projectName)) akka24NoStreamVersions
else Seq.empty else Seq.empty
} ++ akka24StreamVersions ++ akka24WithAtLeastScala212 ++ akka25Versions } ++ akka24StreamVersions ++ akka24WithScala212 ++ akka25Versions
case "2.12" case "2.12"
akka24WithAtLeastScala212 ++ akka25Versions akka24WithScala212 ++ akka25Versions
case "2.13" case "2.13"
// no Akka released for 2.13 yet, no jars to check BC against // no Akka released for 2.13 yet, no jars to check BC against

View file

@ -74,12 +74,21 @@ object MultiNode extends AutoPlugin {
multiNodeResults.overall multiNodeResults.overall
else else
testResults.overall testResults.overall
Tests.Output( Tests.Output(
overall, overall,
testResults.events ++ multiNodeResults.events, testResults.events ++ multiNodeResults.events,
testResults.summaries ++ multiNodeResults.summaries) testResults.summaries ++ multiNodeResults.summaries)
} }
} else Nil) } else Nil)
implicit class TestResultOps(val self: TestResult) extends AnyVal {
def id: Int = self match {
case TestResult.Passed 0
case TestResult.Failed 1
case TestResult.Error 2
}
}
} }
/** /**

View file

@ -0,0 +1,27 @@
package akka
import com.lightbend.paradox.sbt.ParadoxPlugin
import com.lightbend.paradox.sbt.ParadoxPlugin.autoImport._
import sbt.Keys._
import sbt._
object ParadoxBrowse extends AutoPlugin {
object autoImport {
val paradoxBrowse = taskKey[Unit]("Open the docs in the default browser")
}
import autoImport._
override def trigger = allRequirements
override def requires = ParadoxPlugin
override lazy val projectSettings = Seq(
paradoxBrowse := {
import java.awt.Desktop
val rootDocFile = (paradox in Compile).value / "index.html"
val log = streams.value.log
if (Desktop.isDesktopSupported) Desktop.getDesktop.open(rootDocFile)
else log.info(s"Couldn't open default browser, but docs are at $rootDocFile")
}
)
}

View file

@ -4,12 +4,14 @@
package akka package akka
import sbt._
import Process._
import Keys._
import com.typesafe.sbt.preprocess.Preprocess._
import java.io.File import java.io.File
import java.io.PrintWriter
import scala.sys.process._
import sbt._
import sbt.util.CacheStoreFactory
import Keys._
object Protobuf { object Protobuf {
val paths = SettingKey[Seq[File]]("protobuf-paths", "The paths that contain *.proto files.") val paths = SettingKey[Seq[File]]("protobuf-paths", "The paths that contain *.proto files.")
@ -26,13 +28,14 @@ object Protobuf {
generate := { generate := {
val sourceDirs = paths.value val sourceDirs = paths.value
val targetDirs = outputPaths.value val targetDirs = outputPaths.value
val log = streams.value.log
if (sourceDirs.size != targetDirs.size) if (sourceDirs.size != targetDirs.size)
sys.error(s"Unbalanced number of paths and destination paths!\nPaths: $sourceDirs\nDestination Paths: $targetDirs") sys.error(s"Unbalanced number of paths and destination paths!\nPaths: $sourceDirs\nDestination Paths: $targetDirs")
if (sourceDirs exists (_.exists)) { if (sourceDirs exists (_.exists)) {
val cmd = protoc.value val cmd = protoc.value
val log = streams.value.log
checkProtocVersion(cmd, protocVersion.value, log) checkProtocVersion(cmd, protocVersion.value, log)
val base = baseDirectory.value val base = baseDirectory.value
@ -85,4 +88,44 @@ object Protobuf {
sys.error("protoc returned exit code: %d" format exitCode) sys.error("protoc returned exit code: %d" format exitCode)
} }
} }
/**
* Create a transformed version of all files in a directory, given a predicate and a transform function for each file. From sbt-site
*/
private def transformDirectory(sourceDir: File, targetDir: File, transformable: File Boolean, transform: (File, File) Unit, cache: File, log: Logger): File = {
val runTransform = FileFunction.cached(CacheStoreFactory(cache), FilesInfo.hash, FilesInfo.exists) { (in: ChangeReport[File], out: ChangeReport[File])
val map = Path.rebase(sourceDir, targetDir)
if (in.removed.nonEmpty || in.modified.nonEmpty) {
log.info("Preprocessing directory %s..." format sourceDir)
for (source in.removed; target map(source)) {
IO delete target
}
val updated = for (source in.modified; target map(source)) yield {
if (source.isFile) {
if (transformable(source)) transform(source, target)
else IO.copyFile(source, target)
}
target
}
log.info("Directory preprocessed: " + targetDir)
updated
} else Set.empty
}
val sources = (sourceDir.allPaths).get.toSet
runTransform(sources)
targetDir
}
/**
* Transform a file, line by line.
*/
def transformFile(transform: String String)(source: File, target: File): Unit = {
IO.reader(source) { reader
IO.writer(target, "", IO.defaultCharset) { writer
val pw = new PrintWriter(writer)
IO.foreachLine(reader) { line pw.println(transform(line)) }
}
}
}
} }

View file

@ -25,12 +25,6 @@ object Publish extends AutoPlugin {
defaultPublishTo := crossTarget.value / "repository") defaultPublishTo := crossTarget.value / "repository")
def akkaPomExtra = { def akkaPomExtra = {
/* The scm info is automatic from the sbt-git plugin
<scm>
<url>git://github.com/akka/akka.git</url>
<connection>scm:git:git@github.com:akka/akka.git</connection>
</scm>
*/
<inceptionYear>2009</inceptionYear> <inceptionYear>2009</inceptionYear>
<developers> <developers>
<developer> <developer>
@ -58,5 +52,19 @@ object Publish extends AutoPlugin {
private def akkaCredentials: Seq[Credentials] = private def akkaCredentials: Seq[Credentials] =
Option(System.getProperty("akka.publish.credentials", null)).map(f Credentials(new File(f))).toSeq Option(System.getProperty("akka.publish.credentials", null)).map(f Credentials(new File(f))).toSeq
}
/**
* For projects that are not to be published.
*/
object NoPublish extends AutoPlugin {
override def requires = plugins.JvmPlugin
override def projectSettings = Seq(
publishArtifact := false,
publishArtifact in Compile := false,
publish := {},
skip in publish := true,
publishLocal := {}
)
} }

View file

@ -7,7 +7,7 @@ import sbt._
import sbt.Keys._ import sbt.Keys._
import java.io.File import java.io.File
import com.typesafe.sbt.pgp.PgpKeys.publishSigned import com.typesafe.sbt.pgp.PgpKeys.publishSigned
import sbtunidoc.Plugin.UnidocKeys._ import sbtunidoc.BaseUnidocPlugin.autoImport.unidoc
import com.lightbend.paradox.sbt.ParadoxKeys import com.lightbend.paradox.sbt.ParadoxKeys
object Release extends ParadoxKeys { object Release extends ParadoxKeys {
@ -26,6 +26,8 @@ object Release extends ParadoxKeys {
val projectRef = extracted.get(thisProjectRef) val projectRef = extracted.get(thisProjectRef)
val repo = extracted.get(Publish.defaultPublishTo) val repo = extracted.get(Publish.defaultPublishTo)
val state1 = extracted.runAggregated(publishSigned in projectRef, state) val state1 = extracted.runAggregated(publishSigned in projectRef, state)
// Make sure you set "-Dakka.genjavadoc.enabled=true" otherwise no
// japi will be generated and this following match will fail:
val (state2, Seq(api, japi)) = extracted.runTask(unidoc in Compile, state1) val (state2, Seq(api, japi)) = extracted.runTask(unidoc in Compile, state1)
val (state3, docs) = extracted.runTask(paradox in ProjectRef(projectRef.build, "akka-docs") in Compile, state2) val (state3, docs) = extracted.runTask(paradox in ProjectRef(projectRef.build, "akka-docs") in Compile, state2)

View file

@ -3,17 +3,20 @@
*/ */
package akka package akka
import com.lightbend.paradox.sbt.ParadoxPlugin
import com.lightbend.paradox.sbt.ParadoxPlugin.autoImport.paradox
import com.typesafe.tools.mima.plugin.MimaKeys.mimaReportBinaryIssues import com.typesafe.tools.mima.plugin.MimaKeys.mimaReportBinaryIssues
import com.typesafe.tools.mima.plugin.MimaPlugin import com.typesafe.tools.mima.plugin.MimaPlugin
import net.virtualvoid.sbt.graph.backend.SbtUpdateReport import net.virtualvoid.sbt.graph.backend.SbtUpdateReport
import net.virtualvoid.sbt.graph.DependencyGraphKeys._ import net.virtualvoid.sbt.graph.DependencyGraphKeys._
import net.virtualvoid.sbt.graph.ModuleGraph import net.virtualvoid.sbt.graph.ModuleGraph
import org.kohsuke.github._ import org.kohsuke.github._
import sbtunidoc.Plugin.UnidocKeys.unidoc import sbtunidoc.BaseUnidocPlugin.autoImport.unidoc
import sbt.Keys._ import sbt.Keys._
import sbt._ import sbt._
import scala.collection.immutable import scala.collection.immutable
import scala.sys.process._
import scala.util.matching.Regex import scala.util.matching.Regex
object ValidatePullRequest extends AutoPlugin { object ValidatePullRequest extends AutoPlugin {
@ -80,24 +83,22 @@ object ValidatePullRequest extends AutoPlugin {
val validatePullRequest = taskKey[Unit]("Validate pull request") val validatePullRequest = taskKey[Unit]("Validate pull request")
val additionalTasks = taskKey[Seq[TaskKey[_]]]("Additional tasks for pull request validation") val additionalTasks = taskKey[Seq[TaskKey[_]]]("Additional tasks for pull request validation")
def changedDirectoryIsDependency( def changedDirectoryIsDependency(changedDirs: Set[String],
changedDirs: Set[String], name: String,
name: String, graphsToTest: Seq[(Configuration, ModuleGraph)])(log: Logger): Boolean = {
graphsToTest: Seq[(Configuration, ModuleGraph)])(log: Logger): Boolean = { graphsToTest exists { case (ivyScope, deps) =>
graphsToTest exists { log.debug(s"Analysing [$ivyScope] scoped dependencies...")
case (ivyScope, deps)
log.debug(s"Analysing [$ivyScope] scoped dependencies...")
deps.nodes.foreach { m log.debug(" -> " + m.id) } deps.nodes.foreach { m log.debug(" -> " + m.id) }
// if this project depends on a modified module, we must test it // if this project depends on a modified module, we must test it
deps.nodes.exists { m deps.nodes.exists { m =>
// match just by name, we'd rather include too much than too little // match just by name, we'd rather include too much than too little
val dependsOnModule = changedDirs.find(m.id.name contains _) val dependsOnModule = changedDirs.find(m.id.name contains _)
val depends = dependsOnModule.isDefined val depends = dependsOnModule.isDefined
if (depends) log.info(s"Project [$name] must be verified, because depends on [${dependsOnModule.get}]") if (depends) log.info(s"Project [$name] must be verified, because depends on [${dependsOnModule.get}]")
depends depends
} }
} }
} }
@ -107,7 +108,6 @@ object ValidatePullRequest extends AutoPlugin {
def runningLocally: Boolean = !runningOnJenkins def runningLocally: Boolean = !runningOnJenkins
override lazy val buildSettings = Seq( override lazy val buildSettings = Seq(
sourceBranch in Global in ValidatePR := { sourceBranch in Global in ValidatePR := {
sys.env.get(SourceBranchEnvVarName) orElse sys.env.get(SourceBranchEnvVarName) orElse
sys.env.get(SourcePullIdJenkinsEnvVarName).map("pullreq/" + _) getOrElse // Set by "GitHub pull request builder plugin" sys.env.get(SourcePullIdJenkinsEnvVarName).map("pullreq/" + _) getOrElse // Set by "GitHub pull request builder plugin"
@ -116,18 +116,19 @@ object ValidatePullRequest extends AutoPlugin {
targetBranch in Global in ValidatePR := { targetBranch in Global in ValidatePR := {
(localTargetBranch, jenkinsTargetBranch) match { (localTargetBranch, jenkinsTargetBranch) match {
case (Some(local), _) local // local override case (Some(local), _) => local // local override
case (None, Some(branch)) s"origin/$branch" // usually would be "master" or "release-2.3" etc case (None, Some(branch)) => s"origin/$branch" // usually would be "master" or "release-2.3" etc
case (None, None) "origin/master" // defaulting to diffing with "master" case (None, None) => "origin/master" // defaulting to diffing with "master"
} }
}, },
buildAllKeyword in Global in ValidatePR := """PLS BUILD ALL""".r, buildAllKeyword in Global in ValidatePR := """PLS BUILD ALL""".r,
githubEnforcedBuildAll in Global in ValidatePR := { githubEnforcedBuildAll in Global in ValidatePR := {
sys.env.get(PullIdEnvVarName).map(_.toInt) flatMap { prId val log = streams.value.log
val log = streams.value.log val buildAllMagicPhrase = (buildAllKeyword in ValidatePR).value
val buildAllMagicPhrase = (buildAllKeyword in ValidatePR).value
sys.env.get(PullIdEnvVarName).map(_.toInt) flatMap { prId =>
log.info("Checking GitHub comments for PR validation options...") log.info("Checking GitHub comments for PR validation options...")
try { try {
@ -136,12 +137,11 @@ object ValidatePullRequest extends AutoPlugin {
val comments = gh.getRepository("akka/akka").getIssue(prId).getComments.asScala val comments = gh.getRepository("akka/akka").getIssue(prId).getComments.asScala
def triggersBuildAll(c: GHIssueComment): Boolean = buildAllMagicPhrase.findFirstIn(c.getBody).isDefined def triggersBuildAll(c: GHIssueComment): Boolean = buildAllMagicPhrase.findFirstIn(c.getBody).isDefined
comments collectFirst { comments collectFirst { case c if triggersBuildAll(c) =>
case c if triggersBuildAll(c) BuildCommentForcedAll(buildAllMagicPhrase.toString(), c)
BuildCommentForcedAll(buildAllMagicPhrase.toString(), c)
} }
} catch { } catch {
case ex: Exception case ex: Exception =>
log.warn("Unable to reach GitHub! Exception was: " + ex.getMessage) log.warn("Unable to reach GitHub! Exception was: " + ex.getMessage)
None None
} }
@ -160,10 +160,11 @@ object ValidatePullRequest extends AutoPlugin {
val diffOutput = s"git diff $target --name-only".!!.split("\n") val diffOutput = s"git diff $target --name-only".!!.split("\n")
val diffedModuleNames = val diffedModuleNames =
diffOutput diffOutput
.map(l l.trim) .map(l => l.trim)
.filter(l .filter(l =>
l.startsWith("akka-") || l.startsWith("akka-") ||
(l.startsWith("project") && l != "project/MiMa.scala")) (l.startsWith("project") && l != "project/MiMa.scala")
)
.map(l l.takeWhile(_ != '/')) .map(l l.takeWhile(_ != '/'))
.toSet .toSet
@ -174,16 +175,18 @@ object ValidatePullRequest extends AutoPlugin {
val dirtyDirectories = statusOutput val dirtyDirectories = statusOutput
.map(l l.trim.dropWhile(_ != ' ').drop(1)) .map(l l.trim.dropWhile(_ != ' ').drop(1))
.map(_.takeWhile(_ != '/')) .map(_.takeWhile(_ != '/'))
.filter(dir dir.startsWith("akka-") || dir == "project") .filter(dir => dir.startsWith("akka-") || dir == "project")
.toSet .toSet
log.info("Detected uncommitted changes in directories (including in dependency analysis): " + dirtyDirectories.mkString("[", ",", "]")) log.info("Detected uncommitted changes in directories (including in dependency analysis): " + dirtyDirectories.mkString("[", ",", "]"))
dirtyDirectories dirtyDirectories
} }
val allModuleNames = dirtyModuleNames ++ diffedModuleNames val allModuleNames = dirtyModuleNames ++ diffedModuleNames
log.info("Detected changes in directories: " + allModuleNames.mkString("[", ", ", "]")) log.info("Detected changes in directories: " + allModuleNames.mkString("[", ", ", "]"))
allModuleNames allModuleNames
}) }
)
override lazy val projectSettings = inConfig(ValidatePR)(Defaults.testTasks) ++ Seq( override lazy val projectSettings = inConfig(ValidatePR)(Defaults.testTasks) ++ Seq(
testOptions in ValidatePR += Tests.Argument(TestFrameworks.ScalaTest, "-l", "performance"), testOptions in ValidatePR += Tests.Argument(TestFrameworks.ScalaTest, "-l", "performance"),
@ -204,7 +207,7 @@ object ValidatePullRequest extends AutoPlugin {
val thisProjectId = CrossVersion(scalaVersion.value, scalaBinaryVersion.value)(projectID.value) val thisProjectId = CrossVersion(scalaVersion.value, scalaBinaryVersion.value)(projectID.value)
def graphFor(updateReport: UpdateReport, config: Configuration): (Configuration, ModuleGraph) = def graphFor(updateReport: UpdateReport, config: Configuration): (Configuration, ModuleGraph) =
config -> SbtUpdateReport.fromConfigurationReport(updateReport.configuration(config.name).get, thisProjectId) config -> SbtUpdateReport.fromConfigurationReport(updateReport.configuration(config).get, thisProjectId)
def isDependency: Boolean = def isDependency: Boolean =
changedDirectoryIsDependency( changedDirectoryIsDependency(
@ -236,34 +239,34 @@ object ValidatePullRequest extends AutoPlugin {
buildMode.log(name.value, log) buildMode.log(name.value, log)
val validationTasks = buildMode.task.toSeq ++ (buildMode match { val validationTasks = buildMode.task.toSeq ++ (buildMode match {
case BuildSkip Seq.empty // do not run the additional task if project is skipped during pr validation case BuildSkip => Seq.empty // do not run the additional task if project is skipped during pr validation
case _ (additionalTasks in ValidatePR).value case _ => (additionalTasks in ValidatePR).value
}) })
// Create a task for every validation task key and // Create a task for every validation task key and
// then zip all of the tasks together discarding outputs. // then zip all of the tasks together discarding outputs.
// Task failures are propagated as normal. // Task failures are propagated as normal.
val zero: Def.Initialize[Seq[Task[Any]]] = Def.setting { Seq(task()) } val zero: Def.Initialize[Seq[Task[Any]]] = Def.setting { Seq(task(()))}
validationTasks.map(taskKey Def.task { taskKey.value }).foldLeft(zero) { (acc, current) validationTasks.map(taskKey => Def.task { taskKey.value } ).foldLeft(zero) { (acc, current) =>
acc.zipWith(current) { acc.zipWith(current) { case (taskSeq, task) =>
case (taskSeq, task) taskSeq :+ task.asInstanceOf[Task[Any]]
taskSeq :+ task.asInstanceOf[Task[Any]]
} }
} apply { tasks: Seq[Task[Any]] } apply { tasks: Seq[Task[Any]] =>
tasks.join map { seq () /* Ignore the sequence of unit returned */ } tasks.join map { seq => () /* Ignore the sequence of unit returned */ }
} }
}.value) }.value
)
} }
/** /**
* This autoplugin adds Multi Jvm tests to validatePullRequest task. * This autoplugin adds Multi Jvm tests to validatePullRequest task.
* It is needed, because ValidatePullRequest autoplugin does not depend on MultiNode and * It is needed, because ValidatePullRequest autoplugin does not depend on MultiNode and
* therefore test:executeTests is not yet modified to include multi-jvm tests when ValidatePullRequest * therefore test:executeTests is not yet modified to include multi-jvm tests when ValidatePullRequest
* build strategy is being determined. * build strategy is being determined.
* *
* Making ValidatePullRequest depend on MultiNode is impossible, as then ValidatePullRequest * Making ValidatePullRequest depend on MultiNode is impossible, as then ValidatePullRequest
* autoplugin would trigger only on projects which have both of these plugins enabled. * autoplugin would trigger only on projects which have both of these plugins enabled.
*/ */
object MultiNodeWithPrValidation extends AutoPlugin { object MultiNodeWithPrValidation extends AutoPlugin {
import ValidatePullRequest._ import ValidatePullRequest._
@ -275,16 +278,31 @@ object MultiNodeWithPrValidation extends AutoPlugin {
} }
/** /**
* This autoplugin adds MiMa binary issue reporting to validatePullRequest task, * This autoplugin adds MiMa binary issue reporting to validatePullRequest task,
* when a project has MimaPlugin autoplugin enabled. * when a project has MimaPlugin autoplugin enabled.
*/ */
object MimaWithPrValidation extends AutoPlugin { object MimaWithPrValidation extends AutoPlugin {
import ValidatePullRequest._ import ValidatePullRequest._
override def trigger = allRequirements override def trigger = allRequirements
override def requires = ValidatePullRequest && MimaPlugin override def requires = ValidatePullRequest && MimaPlugin
override lazy val projectSettings = Seq( override lazy val projectSettings = Seq(
additionalTasks in ValidatePR += mimaReportBinaryIssues) additionalTasks in ValidatePR += mimaReportBinaryIssues
)
}
/**
* This autoplugin adds Paradox doc generation to validatePullRequest task,
* when a project has ParadoxPlugin autoplugin enabled.
*/
object ParadoxWithPrValidation extends AutoPlugin {
import ValidatePullRequest._
override def trigger = allRequirements
override def requires = ValidatePullRequest && ParadoxPlugin
override lazy val projectSettings = Seq(
additionalTasks in ValidatePR += paradox in Compile
)
} }
object UnidocWithPrValidation extends AutoPlugin { object UnidocWithPrValidation extends AutoPlugin {
@ -292,5 +310,6 @@ object UnidocWithPrValidation extends AutoPlugin {
override def trigger = noTrigger override def trigger = noTrigger
override lazy val projectSettings = Seq( override lazy val projectSettings = Seq(
additionalTasks in ValidatePR += unidoc in Compile) additionalTasks in ValidatePR += unidoc in Compile
)
} }

View file

@ -9,9 +9,9 @@ import sbt.Keys._
/** /**
* Generate version.conf and akka/Version.scala files based on the version setting. * Generate version.conf and akka/Version.scala files based on the version setting.
*/ */
object Version { object VersionGenerator {
def versionSettings: Seq[Setting[_]] = inConfig(Compile)(Seq( val settings: Seq[Setting[_]] = inConfig(Compile)(Seq(
resourceGenerators += generateVersion(resourceManaged, _ / "version.conf", resourceGenerators += generateVersion(resourceManaged, _ / "version.conf",
"""|akka.version = "%s" """|akka.version = "%s"
|"""), |"""),

View file

@ -1 +1 @@
sbt.version=0.13.16 sbt.version=1.0.2

View file

@ -1,45 +1,24 @@
resolvers += Classpaths.typesafeResolver
// need this to resolve http://jcenter.bintray.com/org/jenkins-ci/jenkins/1.26/ // need this to resolve http://jcenter.bintray.com/org/jenkins-ci/jenkins/1.26/
// which is used by plugin "org.kohsuke" % "github-api" % "1.68" // which is used by plugin "org.kohsuke" % "github-api" % "1.68"
resolvers += "Bintray Jcenter" at "https://jcenter.bintray.com/" resolvers += "Bintray Jcenter" at "https://jcenter.bintray.com/"
libraryDependencies += "org.kohsuke" % "github-api" % "1.68"
// these comment markers are for including code into the docs // these comment markers are for including code into the docs
//#sbt-multi-jvm //#sbt-multi-jvm
addSbtPlugin("com.typesafe.sbt" % "sbt-multi-jvm" % "0.3.8") addSbtPlugin("com.typesafe.sbt" % "sbt-multi-jvm" % "0.4.0")
//#sbt-multi-jvm //#sbt-multi-jvm
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.1") addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.7.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.1")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.18") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.18")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0-M1")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.1")
addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "2.0.0") // FIXME broken on jdk9
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.3.3")
addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "1.0.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.27") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.27")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.2.2-RC2")
addSbtPlugin("pl.project13.sbt" % "sbt-jol" % "0.1.1") addSbtPlugin("io.spray" % "sbt-boilerplate" % "0.6.1")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.3.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.0-RC1") addSbtPlugin("com.lightbend.akka" % "sbt-paradox-akka" % "0.4")
// for advanced PR validation features
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.2")
libraryDependencies += "org.kohsuke" % "github-api" % "1.68"
addSbtPlugin("io.spray" % "sbt-boilerplate" % "0.6.0")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.1.10")
addSbtPlugin("com.lightbend.akka" % "sbt-paradox-akka" % "0.3")
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.6") addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.6")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.0") // for advanced PR validation features