Use lazy val's in sbt build (#1016)

This commit is contained in:
Matthew de Detrich 2024-01-22 07:15:16 +01:00 committed by GitHub
parent 9b00480828
commit 98d479f89f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 244 additions and 271 deletions

View file

@ -23,12 +23,12 @@ import sbt.internal.util.ConsoleOut
object AddLogTimestamps extends AutoPlugin { object AddLogTimestamps extends AutoPlugin {
val enableTimestamps: Boolean = CliOption("pekko.log.timestamps", false).get val enableTimestamps: Boolean = CliOption("pekko.log.timestamps", false).get
override def requires: Plugins = plugins.JvmPlugin override lazy val requires: Plugins = plugins.JvmPlugin
override def trigger: PluginTrigger = allRequirements override lazy val trigger: PluginTrigger = allRequirements
private val UTC = ZoneId.of("UTC") private val UTC = ZoneId.of("UTC")
override def projectSettings: Seq[Def.Setting[_]] = { override lazy val projectSettings: Seq[Def.Setting[_]] = {
logManager := { logManager := {
val original = logManager.value val original = logManager.value

View file

@ -78,7 +78,7 @@ object AddMetaInfLicenseFiles extends AutoPlugin {
} }
})) }))
override def trigger = allRequirements override lazy val trigger = allRequirements
override def requires = ApacheSonatypePlugin override lazy val requires = ApacheSonatypePlugin
} }

View file

@ -18,10 +18,10 @@ import sbt._
object CopyrightHeader extends AutoPlugin { object CopyrightHeader extends AutoPlugin {
import HeaderPlugin.autoImport._ import HeaderPlugin.autoImport._
override def requires = HeaderPlugin override lazy val requires = HeaderPlugin
override def trigger = allRequirements override lazy val trigger = allRequirements
override def projectSettings = Def.settings( override lazy val projectSettings = Def.settings(
Seq(Compile, Test).flatMap { config => Seq(Compile, Test).flatMap { config =>
inConfig(config)( inConfig(config)(
Seq( Seq(

View file

@ -18,10 +18,10 @@ import sbt.{ inConfig, Compile, Def, Plugins, Test, _ }
import spray.boilerplate.BoilerplatePlugin import spray.boilerplate.BoilerplatePlugin
object CopyrightHeaderForBoilerplate extends AutoPlugin { object CopyrightHeaderForBoilerplate extends AutoPlugin {
override def requires: Plugins = BoilerplatePlugin && CopyrightHeader override lazy val requires: Plugins = BoilerplatePlugin && CopyrightHeader
override def trigger: PluginTrigger = allRequirements override lazy val trigger: PluginTrigger = allRequirements
override def projectSettings: Seq[Def.Setting[_]] = { override lazy val projectSettings: Seq[Def.Setting[_]] = {
Seq(Compile, Test).flatMap { config => Seq(Compile, Test).flatMap { config =>
inConfig(config) { inConfig(config) {
Seq( Seq(

View file

@ -17,10 +17,10 @@ import sbt.Keys.baseDirectory
import sbt.{ inConfig, Compile, Def, PluginTrigger, Test, _ } import sbt.{ inConfig, Compile, Def, PluginTrigger, Test, _ }
object CopyrightHeaderForBuild extends AutoPlugin { object CopyrightHeaderForBuild extends AutoPlugin {
override def requires: Plugins = CopyrightHeader override lazy val requires: Plugins = CopyrightHeader
override def trigger: PluginTrigger = noTrigger override lazy val trigger: PluginTrigger = noTrigger
override def projectSettings: Seq[Def.Setting[_]] = { override lazy val projectSettings: Seq[Def.Setting[_]] = {
Seq(Compile, Test).flatMap { config => Seq(Compile, Test).flatMap { config =>
inConfig(config) { inConfig(config) {
Seq( Seq(

View file

@ -17,10 +17,10 @@ import sbt.{ Compile, Def, Test, _ }
object CopyrightHeaderForJdk9 extends AutoPlugin { object CopyrightHeaderForJdk9 extends AutoPlugin {
override def requires = CopyrightHeader && Jdk9 override lazy val requires = CopyrightHeader && Jdk9
override def trigger = allRequirements override lazy val trigger = allRequirements
override def projectSettings: Seq[Def.Setting[_]] = { override lazy val projectSettings: Seq[Def.Setting[_]] = {
import Jdk9._ import Jdk9._
Seq( Seq(
Compile / headerSources ++= Compile / headerSources ++=

View file

@ -18,10 +18,10 @@ import sbt.{ inConfig, Compile, Def, Test, _ }
object CopyrightHeaderForProtobuf extends AutoPlugin { object CopyrightHeaderForProtobuf extends AutoPlugin {
override def requires = CopyrightHeader override lazy val requires = CopyrightHeader
override def trigger = allRequirements override lazy val trigger = allRequirements
override def projectSettings: Seq[Def.Setting[_]] = { override lazy val projectSettings: Seq[Def.Setting[_]] = {
Seq(Compile, Test).flatMap { config => Seq(Compile, Test).flatMap { config =>
inConfig(config) { inConfig(config) {
Seq( Seq(

View file

@ -77,9 +77,7 @@ object Dependencies {
val reactiveStreams = "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion val reactiveStreams = "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion
// ssl-config // ssl-config
val sslConfigCore = Def.setting { val sslConfigCore = "com.typesafe" %% "ssl-config-core" % sslConfigVersion
"com.typesafe" %% "ssl-config-core" % sslConfigVersion
}
val lmdb = "org.lmdbjava" % "lmdbjava" % "0.9.0" val lmdb = "org.lmdbjava" % "lmdbjava" % "0.9.0"
@ -87,7 +85,7 @@ object Dependencies {
val junit5 = "org.junit.jupiter" % "junit-jupiter-engine" % junit5Version val junit5 = "org.junit.jupiter" % "junit-jupiter-engine" % junit5Version
// For Java 8 Conversions // For Java 8 Conversions
val java8Compat = Def.setting { lazy val java8Compat = Def.setting {
"org.scala-lang.modules" %% "scala-java8-compat" % java8CompatVersion.value "org.scala-lang.modules" %% "scala-java8-compat" % java8CompatVersion.value
} }
@ -98,30 +96,14 @@ object Dependencies {
val asnOne = ("com.hierynomus" % "asn-one" % "0.6.0").exclude("org.slf4j", "slf4j-api") val asnOne = ("com.hierynomus" % "asn-one" % "0.6.0").exclude("org.slf4j", "slf4j-api")
val jacksonCore = Def.setting { val jacksonCore = "com.fasterxml.jackson.core" % "jackson-core" % jacksonCoreVersion
"com.fasterxml.jackson.core" % "jackson-core" % jacksonCoreVersion val jacksonAnnotations = "com.fasterxml.jackson.core" % "jackson-annotations" % jacksonCoreVersion
} // ApacheV2 val jacksonDatabind = "com.fasterxml.jackson.core" % "jackson-databind" % jacksonDatabindVersion
val jacksonAnnotations = Def.setting { val jacksonJdk8 = "com.fasterxml.jackson.datatype" % "jackson-datatype-jdk8" % jacksonCoreVersion
"com.fasterxml.jackson.core" % "jackson-annotations" % jacksonCoreVersion val jacksonJsr310 = "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % jacksonCoreVersion
} // ApacheV2 val jacksonScala = "com.fasterxml.jackson.module" %% "jackson-module-scala" % jacksonCoreVersion
val jacksonDatabind = Def.setting { val jacksonParameterNames = "com.fasterxml.jackson.module" % "jackson-module-parameter-names" % jacksonCoreVersion
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonDatabindVersion val jacksonCbor = "com.fasterxml.jackson.dataformat" % "jackson-dataformat-cbor" % jacksonCoreVersion
} // ApacheV2
val jacksonJdk8 = Def.setting {
"com.fasterxml.jackson.datatype" % "jackson-datatype-jdk8" % jacksonCoreVersion
} // ApacheV2
val jacksonJsr310 = Def.setting {
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % jacksonCoreVersion
} // ApacheV2
val jacksonScala = Def.setting {
"com.fasterxml.jackson.module" %% "jackson-module-scala" % jacksonCoreVersion
} // ApacheV2
val jacksonParameterNames = Def.setting {
"com.fasterxml.jackson.module" % "jackson-module-parameter-names" % jacksonCoreVersion
} // ApacheV2
val jacksonCbor = Def.setting {
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-cbor" % jacksonCoreVersion
} // ApacheV2
val lz4Java = "org.lz4" % "lz4-java" % "1.8.0" val lz4Java = "org.lz4" % "lz4-java" % "1.8.0"
val logback = "ch.qos.logback" % "logback-classic" % logbackVersion val logback = "ch.qos.logback" % "logback-classic" % logbackVersion
@ -140,23 +122,16 @@ object Dependencies {
val logback = Compile.logback % Test val logback = Compile.logback % Test
val scalatest = Def.setting { "org.scalatest" %% "scalatest" % scalaTestVersion % Test } // ApacheV2 val scalatest = "org.scalatest" %% "scalatest" % scalaTestVersion % Test
// The 'scalaTestPlus' projects are independently versioned, // The 'scalaTestPlus' projects are independently versioned,
// but the version of each module starts with the scalatest // but the version of each module starts with the scalatest
// version it was intended to work with // version it was intended to work with
val scalatestJUnit = Def.setting { val scalatestJUnit = "org.scalatestplus" %% "junit-4-13" % (scalaTestVersion + ".0") % Test
"org.scalatestplus" %% "junit-4-13" % (scalaTestVersion + ".0") % Test val scalatestTestNG = "org.scalatestplus" %% "testng-7-5" % (scalaTestVersion + ".0") % Test
} val scalatestScalaCheck =
val scalatestTestNG = Def.setting {
"org.scalatestplus" %% "testng-7-5" % (scalaTestVersion + ".0") % Test
}
val scalatestScalaCheck = Def.setting {
"org.scalatestplus" %% s"scalacheck-$scalaTestScalaCheckVersion" % (scalaTestVersion + ".0") % Test "org.scalatestplus" %% s"scalacheck-$scalaTestScalaCheckVersion" % (scalaTestVersion + ".0") % Test
} val scalatestMockito = "org.scalatestplus" %% "mockito-4-11" % (scalaTestVersion + ".0") % Test
val scalatestMockito = Def.setting {
"org.scalatestplus" %% "mockito-4-11" % (scalaTestVersion + ".0") % Test
}
val pojosr = "com.googlecode.pojosr" % "de.kalpatec.pojosr.framework" % "0.2.1" % Test val pojosr = "com.googlecode.pojosr" % "de.kalpatec.pojosr.framework" % "0.2.1" % Test
val tinybundles = "org.ops4j.pax.tinybundles" % "tinybundles" % "3.0.0" % Test val tinybundles = "org.ops4j.pax.tinybundles" % "tinybundles" % "3.0.0" % Test
@ -164,21 +139,17 @@ object Dependencies {
// in-memory filesystem for file related tests // in-memory filesystem for file related tests
val jimfs = "com.google.jimfs" % "jimfs" % "1.3.0" % Test val jimfs = "com.google.jimfs" % "jimfs" % "1.3.0" % Test
val dockerClient = Def.setting { val dockerClient = Seq(
Seq( "com.github.docker-java" % "docker-java-core" % "3.3.4" % Test,
"com.github.docker-java" % "docker-java-core" % "3.3.4" % Test, "com.github.docker-java" % "docker-java-transport-httpclient5" % "3.3.4" % Test)
"com.github.docker-java" % "docker-java-transport-httpclient5" % "3.3.4" % Test)
}
val jackson = Def.setting { val jackson = Seq(
Seq( (jacksonCore % Test).force(),
(jacksonCore.value % Test).force(), (jacksonAnnotations % Test).force(),
(jacksonAnnotations.value % Test).force(), (jacksonDatabind % Test).force(),
(jacksonDatabind.value % Test).force(), ("com.fasterxml.jackson.jaxrs" % "jackson-jaxrs-base" % jacksonCoreVersion % Test).force(),
("com.fasterxml.jackson.jaxrs" % "jackson-jaxrs-base" % jacksonCoreVersion % Test).force(), ("com.fasterxml.jackson.jaxrs" % "jackson-jaxrs-json-provider" % jacksonCoreVersion % Test).force(),
("com.fasterxml.jackson.jaxrs" % "jackson-jaxrs-json-provider" % jacksonCoreVersion % Test).force(), ("com.fasterxml.jackson.datatype" % "jackson-datatype-guava" % jacksonCoreVersion % Test).force())
("com.fasterxml.jackson.datatype" % "jackson-datatype-guava" % jacksonCoreVersion % Test).force())
}
// metrics, measurements, perf testing // metrics, measurements, perf testing
val metrics = "io.dropwizard.metrics" % "metrics-core" % "4.2.24" % Test val metrics = "io.dropwizard.metrics" % "metrics-core" % "4.2.24" % Test
@ -214,7 +185,7 @@ object Dependencies {
val junit = Compile.junit % "optional;provided;test" val junit = Compile.junit % "optional;provided;test"
val junit5 = Compile.junit5 % "optional;provided;test" val junit5 = Compile.junit5 % "optional;provided;test"
val scalatest = Def.setting { "org.scalatest" %% "scalatest" % scalaTestVersion % "optional;provided;test" } val scalatest = "org.scalatest" %% "scalatest" % scalaTestVersion % "optional;provided;test"
val logback = Compile.logback % "optional;provided;test" val logback = Compile.logback % "optional;provided;test"
@ -226,164 +197,165 @@ object Dependencies {
import Compile._ import Compile._
// TODO check if `l ++=` everywhere expensive? // TODO check if `l ++=` everywhere expensive?
val l = libraryDependencies lazy val l = libraryDependencies
val actor = l ++= (CrossVersion.partialVersion(scalaVersion.value) match { lazy val actor = l ++= (CrossVersion.partialVersion(scalaVersion.value) match {
// java8-compat is only used in a couple of places for 2.13, // java8-compat is only used in a couple of places for 2.13,
// it is probably possible to remove the dependency if needed. // it is probably possible to remove the dependency if needed.
case Some((2, n)) if n == 12 => case Some((2, n)) if n == 12 =>
List("org.scala-lang.modules" %% "scala-java8-compat" % java8CompatVersion.value) // Scala License List("org.scala-lang.modules" %% "scala-java8-compat" % java8CompatVersion.value)
case _ => List.empty case _ => List.empty
}) ++ Seq(config) }) ++ Seq(config)
val actorTyped = l ++= Seq(slf4jApi) val actorTyped = l ++= Seq(slf4jApi)
val discovery = l ++= Seq(TestDependencies.junit, TestDependencies.scalatest.value) val discovery = l ++= Seq(TestDependencies.junit, TestDependencies.scalatest)
val coordination = l ++= Seq(TestDependencies.junit, TestDependencies.scalatest.value) val coordination = l ++= Seq(TestDependencies.junit, TestDependencies.scalatest)
val testkit = l ++= Seq(TestDependencies.junit, TestDependencies.scalatest.value) ++ TestDependencies.metricsAll val testkit = l ++= Seq(TestDependencies.junit, TestDependencies.scalatest) ++ TestDependencies.metricsAll
// TestDependencies.dockerClient brings in older versions of jackson libs that have CVEs // TestDependencies.dockerClient brings in older versions of jackson libs that have CVEs
val actorTests = l ++= Seq( val actorTests = l ++= Seq(
TestDependencies.junit, TestDependencies.junit,
TestDependencies.scalatest.value, TestDependencies.scalatest,
TestDependencies.scalatestJUnit.value, TestDependencies.scalatestJUnit,
TestDependencies.scalatestScalaCheck.value, TestDependencies.scalatestScalaCheck,
TestDependencies.commonsCodec, TestDependencies.commonsCodec,
TestDependencies.jimfs) ++ TestDependencies.jimfs) ++
TestDependencies.jackson.value ++ TestDependencies.dockerClient.value TestDependencies.jackson ++ TestDependencies.dockerClient
val actorTestkitTyped = l ++= Seq( lazy val actorTestkitTyped = l ++= Seq(
Provided.logback, Provided.logback,
Provided.junit, Provided.junit,
Provided.junit5, Provided.junit5,
Provided.scalatest.value, Provided.scalatest,
TestDependencies.scalatestJUnit.value) TestDependencies.scalatestJUnit)
val pki = l ++= lazy val pki = l ++=
Seq( Seq(
asnOne, asnOne,
// pull up slf4j version from the one provided transitively in asnOne to fix unidoc // pull up slf4j version from the one provided transitively in asnOne to fix unidoc
Compile.slf4jApi, Compile.slf4jApi,
TestDependencies.scalatest.value) TestDependencies.scalatest)
val remoteDependencies = Seq(`netty-transport`, `netty-handler`, aeronDriver, aeronClient) val remoteDependencies = Seq(`netty-transport`, `netty-handler`, aeronDriver, aeronClient)
val remoteOptionalDependencies = remoteDependencies.map(_ % "optional") val remoteOptionalDependencies = remoteDependencies.map(_ % "optional")
val remote = l ++= Seq( lazy val remote = l ++= Seq(
agrona, agrona,
TestDependencies.junit, TestDependencies.junit,
TestDependencies.scalatest.value, TestDependencies.scalatest,
TestDependencies.jimfs, TestDependencies.jimfs,
TestDependencies.protobufRuntime) ++ remoteOptionalDependencies TestDependencies.protobufRuntime) ++ remoteOptionalDependencies
val remoteTests = l ++= Seq(TestDependencies.junit, TestDependencies.scalatest.value) ++ remoteDependencies lazy val remoteTests = l ++= Seq(TestDependencies.junit, TestDependencies.scalatest) ++ remoteDependencies
val multiNodeTestkit = l ++= Seq(`netty-transport`, `netty-handler`) lazy val multiNodeTestkit = l ++= Seq(`netty-transport`, `netty-handler`)
val cluster = l ++= Seq(TestDependencies.junit, TestDependencies.scalatest.value, TestDependencies.logback) lazy val cluster = l ++= Seq(TestDependencies.junit, TestDependencies.scalatest, TestDependencies.logback)
val clusterTools = l ++= Seq(TestDependencies.junit, TestDependencies.scalatest.value) lazy val clusterTools = l ++= Seq(TestDependencies.junit, TestDependencies.scalatest)
val clusterSharding = l ++= Seq( lazy val clusterSharding = l ++= Seq(
Provided.levelDBmultiJVM, Provided.levelDBmultiJVM,
Provided.levelDBNative, Provided.levelDBNative,
TestDependencies.junit, TestDependencies.junit,
TestDependencies.scalatest.value, TestDependencies.scalatest,
TestDependencies.commonsIo, TestDependencies.commonsIo,
TestDependencies.ycsb) TestDependencies.ycsb)
val clusterMetrics = l ++= Seq( lazy val clusterMetrics = l ++= Seq(
Provided.sigarLoader, Provided.sigarLoader,
TestDependencies.slf4jJul, TestDependencies.slf4jJul,
TestDependencies.slf4jLog4j, TestDependencies.slf4jLog4j,
TestDependencies.logback, TestDependencies.logback,
TestDependencies.scalatestMockito.value) TestDependencies.scalatestMockito)
val distributedData = l ++= Seq(lmdb, TestDependencies.junit, TestDependencies.scalatest.value) lazy val distributedData = l ++= Seq(lmdb, TestDependencies.junit, TestDependencies.scalatest)
val slf4j = l ++= Seq(slf4jApi, TestDependencies.logback) lazy val slf4j = l ++= Seq(slf4jApi, TestDependencies.logback)
val persistence = l ++= Seq( lazy val persistence = l ++= Seq(
Provided.levelDB, Provided.levelDB,
Provided.levelDBNative, Provided.levelDBNative,
TestDependencies.scalatest.value, TestDependencies.scalatest,
TestDependencies.scalatestJUnit.value, TestDependencies.scalatestJUnit,
TestDependencies.junit, TestDependencies.junit,
TestDependencies.commonsIo, TestDependencies.commonsIo,
TestDependencies.commonsCodec) TestDependencies.commonsCodec)
val persistenceQuery = l ++= Seq( lazy val persistenceQuery = l ++= Seq(
TestDependencies.scalatest.value, TestDependencies.scalatest,
TestDependencies.junit, TestDependencies.junit,
TestDependencies.commonsIo, TestDependencies.commonsIo,
Provided.levelDB, Provided.levelDB,
Provided.levelDBNative) Provided.levelDBNative)
val persistenceTck = l ++= Seq( lazy val persistenceTck = l ++= Seq(
TestDependencies.scalatest.value.withConfigurations(Some("compile")), TestDependencies.scalatest.withConfigurations(Some("compile")),
TestDependencies.junit.withConfigurations(Some("compile")), TestDependencies.junit.withConfigurations(Some("compile")),
Provided.levelDB, Provided.levelDB,
Provided.levelDBNative) Provided.levelDBNative)
val persistenceTestKit = l ++= Seq(TestDependencies.scalatest.value, TestDependencies.logback) lazy val persistenceTestKit = l ++= Seq(TestDependencies.scalatest, TestDependencies.logback)
val persistenceTypedTests = l ++= Seq(TestDependencies.scalatest.value, TestDependencies.logback) lazy val persistenceTypedTests = l ++= Seq(TestDependencies.scalatest, TestDependencies.logback)
val persistenceShared = l ++= Seq(Provided.levelDB, Provided.levelDBNative, TestDependencies.logback) lazy val persistenceShared = l ++= Seq(Provided.levelDB, Provided.levelDBNative, TestDependencies.logback)
val jackson = l ++= Seq( lazy val jackson = l ++= Seq(
jacksonCore.value, jacksonCore,
jacksonAnnotations.value, jacksonAnnotations,
jacksonDatabind.value, jacksonDatabind,
jacksonJdk8.value, jacksonJdk8,
jacksonJsr310.value, jacksonJsr310,
jacksonParameterNames.value, jacksonParameterNames,
jacksonCbor.value, jacksonCbor,
jacksonScala.value, jacksonScala,
lz4Java, lz4Java,
TestDependencies.junit, TestDependencies.junit,
TestDependencies.scalatest.value) TestDependencies.scalatest)
val osgi = l ++= Seq(
lazy val osgi = l ++= Seq(
osgiCore, osgiCore,
osgiCompendium, osgiCompendium,
TestDependencies.logback, TestDependencies.logback,
TestDependencies.commonsIo, TestDependencies.commonsIo,
TestDependencies.pojosr, TestDependencies.pojosr,
TestDependencies.tinybundles, TestDependencies.tinybundles,
TestDependencies.scalatest.value, TestDependencies.scalatest,
TestDependencies.junit) TestDependencies.junit)
val docs = l ++= Seq( lazy val docs = l ++= Seq(
TestDependencies.scalatest.value, TestDependencies.scalatest,
TestDependencies.junit, TestDependencies.junit,
Docs.sprayJson, Docs.sprayJson,
Docs.gson, Docs.gson,
Provided.levelDB) Provided.levelDB)
val benchJmh = l ++= Seq(logback, Provided.levelDB, Provided.levelDBNative, Compile.jctools) lazy val benchJmh = l ++= Seq(logback, Provided.levelDB, Provided.levelDBNative, Compile.jctools)
// pekko stream // pekko stream
lazy val stream = l ++= Seq[sbt.ModuleID](reactiveStreams, sslConfigCore.value, TestDependencies.scalatest.value) lazy val stream = l ++= Seq[sbt.ModuleID](reactiveStreams, sslConfigCore, TestDependencies.scalatest)
lazy val streamTestkit = l ++= Seq( lazy val streamTestkit = l ++= Seq(
TestDependencies.scalatest.value, TestDependencies.scalatest,
TestDependencies.scalatestScalaCheck.value, TestDependencies.scalatestScalaCheck,
TestDependencies.junit) TestDependencies.junit)
lazy val streamTests = l ++= Seq( lazy val streamTests = l ++= Seq(
TestDependencies.scalatest.value, TestDependencies.scalatest,
TestDependencies.scalatestScalaCheck.value, TestDependencies.scalatestScalaCheck,
TestDependencies.junit, TestDependencies.junit,
TestDependencies.commonsIo, TestDependencies.commonsIo,
TestDependencies.jimfs) TestDependencies.jimfs)
lazy val streamTestsTck = l ++= Seq( lazy val streamTestsTck = l ++= Seq(
TestDependencies.scalatest.value, TestDependencies.scalatest,
TestDependencies.scalatestTestNG.value, TestDependencies.scalatestTestNG,
TestDependencies.scalatestScalaCheck.value, TestDependencies.scalatestScalaCheck,
TestDependencies.junit, TestDependencies.junit,
TestDependencies.reactiveStreamsTck) TestDependencies.reactiveStreamsTck)

View file

@ -25,12 +25,12 @@ import sbt.ScopeFilter.ProjectFilter
object Scaladoc extends AutoPlugin { object Scaladoc extends AutoPlugin {
object CliOptions { object CliOptions {
val scaladocDiagramsEnabled = CliOption("pekko.scaladoc.diagrams", true) lazy val scaladocDiagramsEnabled = CliOption("pekko.scaladoc.diagrams", true)
val scaladocAutoAPI = CliOption("pekko.scaladoc.autoapi", true) lazy val scaladocAutoAPI = CliOption("pekko.scaladoc.autoapi", true)
} }
override def trigger = allRequirements override lazy val trigger = allRequirements
override def requires = plugins.JvmPlugin override lazy val requires = plugins.JvmPlugin
val validateDiagrams = settingKey[Boolean]("Validate generated scaladoc diagrams") val validateDiagrams = settingKey[Boolean]("Validate generated scaladoc diagrams")
@ -112,8 +112,8 @@ object Scaladoc extends AutoPlugin {
*/ */
object ScaladocNoVerificationOfDiagrams extends AutoPlugin { object ScaladocNoVerificationOfDiagrams extends AutoPlugin {
override def trigger = noTrigger override lazy val trigger = noTrigger
override def requires = Scaladoc override lazy val requires = Scaladoc
override lazy val projectSettings = Seq(Compile / Scaladoc.validateDiagrams := false) override lazy val projectSettings = Seq(Compile / Scaladoc.validateDiagrams := false)
} }
@ -124,21 +124,21 @@ object ScaladocNoVerificationOfDiagrams extends AutoPlugin {
object UnidocRoot extends AutoPlugin { object UnidocRoot extends AutoPlugin {
object CliOptions { object CliOptions {
val genjavadocEnabled = CliOption("pekko.genjavadoc.enabled", false) lazy val genjavadocEnabled = CliOption("pekko.genjavadoc.enabled", false)
} }
object autoImport { object autoImport {
val unidocRootIgnoreProjects = settingKey[Seq[ProjectReference]]("Projects to ignore when generating unidoc") lazy val unidocRootIgnoreProjects = settingKey[Seq[ProjectReference]]("Projects to ignore when generating unidoc")
} }
import autoImport._ import autoImport._
override def trigger = noTrigger override lazy val trigger = noTrigger
override def requires = override lazy val requires =
UnidocRoot.CliOptions.genjavadocEnabled UnidocRoot.CliOptions.genjavadocEnabled
.ifTrue(sbtunidoc.ScalaUnidocPlugin && sbtunidoc.JavaUnidocPlugin && sbtunidoc.GenJavadocPlugin) .ifTrue(sbtunidoc.ScalaUnidocPlugin && sbtunidoc.JavaUnidocPlugin && sbtunidoc.GenJavadocPlugin)
.getOrElse(sbtunidoc.ScalaUnidocPlugin) .getOrElse(sbtunidoc.ScalaUnidocPlugin)
val pekkoSettings = UnidocRoot.CliOptions.genjavadocEnabled lazy val pekkoSettings = UnidocRoot.CliOptions.genjavadocEnabled
.ifTrue(Seq( .ifTrue(Seq(
JavaUnidoc / unidoc / javacOptions := { JavaUnidoc / unidoc / javacOptions := {
if (JdkOptions.isJdk8) Seq("-Xdoclint:none") if (JdkOptions.isJdk8) Seq("-Xdoclint:none")
@ -209,9 +209,9 @@ object UnidocRoot extends AutoPlugin {
*/ */
object BootstrapGenjavadoc extends AutoPlugin { object BootstrapGenjavadoc extends AutoPlugin {
override def trigger = allRequirements override lazy val trigger = allRequirements
override def requires = override lazy val requires =
UnidocRoot.CliOptions.genjavadocEnabled UnidocRoot.CliOptions.genjavadocEnabled
.ifTrue { .ifTrue {
// require 11, fail fast for 8, 9, 10 // require 11, fail fast for 8, 9, 10

View file

@ -16,9 +16,9 @@ import sbt.{ AutoPlugin, PluginTrigger, Plugins }
object JavaFormatter extends AutoPlugin { object JavaFormatter extends AutoPlugin {
override def trigger = PluginTrigger.AllRequirements override lazy val trigger = PluginTrigger.AllRequirements
override def requires: Plugins = JavaFormatterPlugin override lazy val requires: Plugins = JavaFormatterPlugin
private val ignoreConfigFileName: String = ".sbt-java-formatter.conf" private val ignoreConfigFileName: String = ".sbt-java-formatter.conf"
private val descriptor: String = "sbt-java-formatter" private val descriptor: String = "sbt-java-formatter"
@ -28,7 +28,7 @@ object JavaFormatter extends AutoPlugin {
import sbt._ import sbt._
import sbt.io._ import sbt.io._
override def projectSettings: Seq[Def.Setting[_]] = override lazy val projectSettings: Seq[Def.Setting[_]] =
Seq( Seq(
// below is for sbt java formatter // below is for sbt java formatter
javafmt / excludeFilter := { javafmt / excludeFilter := {

View file

@ -17,16 +17,16 @@ import sbt.Keys._
object Jdk9 extends AutoPlugin { object Jdk9 extends AutoPlugin {
import JdkOptions.notOnJdk8 import JdkOptions.notOnJdk8
val CompileJdk9 = config("CompileJdk9").extend(Compile) lazy val CompileJdk9 = config("CompileJdk9").extend(Compile)
val TestJdk9 = config("TestJdk9").extend(Test).extend(CompileJdk9) lazy val TestJdk9 = config("TestJdk9").extend(Test).extend(CompileJdk9)
val SCALA_SOURCE_DIRECTORY = "scala-jdk-9" val SCALA_SOURCE_DIRECTORY = "scala-jdk-9"
val SCALA_TEST_SOURCE_DIRECTORY = "scala-jdk9-only" val SCALA_TEST_SOURCE_DIRECTORY = "scala-jdk9-only"
val JAVA_SOURCE_DIRECTORY = "java-jdk-9" val JAVA_SOURCE_DIRECTORY = "java-jdk-9"
val JAVA_TEST_SOURCE_DIRECTORY = "java-jdk9-only" val JAVA_TEST_SOURCE_DIRECTORY = "java-jdk9-only"
val compileJdk9Settings = Seq( lazy val compileJdk9Settings = Seq(
// following the scala-2.12, scala-sbt-1.0, ... convention // following the scala-2.12, scala-sbt-1.0, ... convention
unmanagedSourceDirectories := notOnJdk8( unmanagedSourceDirectories := notOnJdk8(
Seq( Seq(
@ -35,7 +35,7 @@ object Jdk9 extends AutoPlugin {
scalacOptions := PekkoBuild.DefaultScalacOptions.value ++ notOnJdk8(Seq("-release", "11")), scalacOptions := PekkoBuild.DefaultScalacOptions.value ++ notOnJdk8(Seq("-release", "11")),
javacOptions := PekkoBuild.DefaultJavacOptions ++ notOnJdk8(Seq("--release", "11"))) javacOptions := PekkoBuild.DefaultJavacOptions ++ notOnJdk8(Seq("--release", "11")))
val testJdk9Settings = Seq( lazy val testJdk9Settings = Seq(
// following the scala-2.12, scala-sbt-1.0, ... convention // following the scala-2.12, scala-sbt-1.0, ... convention
unmanagedSourceDirectories := notOnJdk8( unmanagedSourceDirectories := notOnJdk8(
Seq( Seq(
@ -47,20 +47,20 @@ object Jdk9 extends AutoPlugin {
classpathConfiguration := TestJdk9, classpathConfiguration := TestJdk9,
externalDependencyClasspath := (Test / externalDependencyClasspath).value) externalDependencyClasspath := (Test / externalDependencyClasspath).value)
val compileSettings = Seq( lazy val compileSettings = Seq(
// It might have been more 'neat' to add the jdk9 products to the jar via packageBin/mappings, but that doesn't work with the OSGi plugin, // It might have been more 'neat' to add the jdk9 products to the jar via packageBin/mappings, but that doesn't work with the OSGi plugin,
// so we add them to the fullClasspath instead. // so we add them to the fullClasspath instead.
// Compile / packageBin / mappings // Compile / packageBin / mappings
// ++= (CompileJdk9 / products).value.flatMap(Path.allSubpaths), // ++= (CompileJdk9 / products).value.flatMap(Path.allSubpaths),
Compile / fullClasspath ++= (CompileJdk9 / exportedProducts).value) Compile / fullClasspath ++= (CompileJdk9 / exportedProducts).value)
val testSettings = Seq((Test / test) := { lazy val testSettings = Seq((Test / test) := {
(Test / test).value (Test / test).value
(TestJdk9 / test).value (TestJdk9 / test).value
}) })
override def trigger = noTrigger override lazy val trigger = noTrigger
override def projectConfigurations = Seq(CompileJdk9) override lazy val projectConfigurations = Seq(CompileJdk9)
override lazy val projectSettings = override lazy val projectSettings =
inConfig(CompileJdk9)(Defaults.compileSettings) ++ inConfig(CompileJdk9)(Defaults.compileSettings) ++
inConfig(CompileJdk9)(compileJdk9Settings) ++ inConfig(CompileJdk9)(compileJdk9Settings) ++

View file

@ -19,22 +19,22 @@ import sbt.librarymanagement.VersionNumber
object JdkOptions extends AutoPlugin { object JdkOptions extends AutoPlugin {
object autoImport { object autoImport {
val jdk8home = settingKey[String]("JDK 8 home. Only needs to be set when it cannot be auto-detected by sbt") lazy val jdk8home = settingKey[String]("JDK 8 home. Only needs to be set when it cannot be auto-detected by sbt")
val targetSystemJdk = settingKey[Boolean]( lazy val targetSystemJdk = settingKey[Boolean](
"Target the system JDK instead of building against JDK 8. When this is enabled resulting artifacts may not work on JDK 8!") "Target the system JDK instead of building against JDK 8. When this is enabled resulting artifacts may not work on JDK 8!")
} }
import autoImport._ import autoImport._
val specificationVersion: String = sys.props("java.specification.version") lazy val specificationVersion: String = sys.props("java.specification.version")
val isJdk8: Boolean = lazy val isJdk8: Boolean =
VersionNumber(specificationVersion).matchesSemVer(SemanticSelector(s"=1.8")) VersionNumber(specificationVersion).matchesSemVer(SemanticSelector(s"=1.8"))
val isJdk11orHigher: Boolean = lazy val isJdk11orHigher: Boolean =
VersionNumber(specificationVersion).matchesSemVer(SemanticSelector(">=11")) VersionNumber(specificationVersion).matchesSemVer(SemanticSelector(">=11"))
val isJdk17orHigher: Boolean = lazy val isJdk17orHigher: Boolean =
VersionNumber(specificationVersion).matchesSemVer(SemanticSelector(">=17")) VersionNumber(specificationVersion).matchesSemVer(SemanticSelector(">=17"))
val versionSpecificJavaOptions = lazy val versionSpecificJavaOptions =
if (isJdk17orHigher) { if (isJdk17orHigher) {
// for aeron // for aeron
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED" :: "--add-opens=java.base/sun.nio.ch=ALL-UNNAMED" ::
@ -87,5 +87,5 @@ object JdkOptions extends AutoPlugin {
"A JDK 8 installation was not found, but is required to build Apache Pekko. To manually specify a JDK 8 installation, set the JAVA_8_HOME environment variable to its path or use the \"set every jdk8home := \\\"/path/to/jdk\\\" sbt command. If you have no JDK 8 installation, target your system JDK with the \"set every targetSystemJdk := true\" sbt command, but beware resulting artifacts will not work on JDK 8") "A JDK 8 installation was not found, but is required to build Apache Pekko. To manually specify a JDK 8 installation, set the JAVA_8_HOME environment variable to its path or use the \"set every jdk8home := \\\"/path/to/jdk\\\" sbt command. If you have no JDK 8 installation, target your system JDK with the \"set every targetSystemJdk := true\" sbt command, but beware resulting artifacts will not work on JDK 8")
} }
val targetJdkSettings = Seq(targetSystemJdk := false, jdk8home := sys.env.get("JAVA_8_HOME").getOrElse("")) lazy val targetJdkSettings = Seq(targetSystemJdk := false, jdk8home := sys.env.get("JAVA_8_HOME").getOrElse(""))
} }

View file

@ -37,8 +37,8 @@ object LicenseReport extends AutoPlugin {
Column.OriginatingArtifactName, Column.OriginatingArtifactName,
Column.Configuration)) Column.Configuration))
override def requires = plugins.JvmPlugin && SbtLicenseReport override lazy val requires = plugins.JvmPlugin && SbtLicenseReport
override def trigger = allRequirements override lazy val trigger = allRequirements
} }

View file

@ -25,33 +25,33 @@ import sbtassembly.AssemblyKeys._
object MultiNode extends AutoPlugin { object MultiNode extends AutoPlugin {
object autoImport { object autoImport {
val validateCompile = taskKey[Unit]("Validates compile for any project it is enabled") lazy val validateCompile = taskKey[Unit]("Validates compile for any project it is enabled")
} }
import autoImport._ import autoImport._
// MultiJvm tests can be excluded from normal test target an validatePullRequest // MultiJvm tests can be excluded from normal test target an validatePullRequest
// with -Dpekko.test.multi-in-test=false // with -Dpekko.test.multi-in-test=false
val multiNodeTestInTest: Boolean = sys.props.getOrElse("pekko.test.multi-in-test", "true").toBoolean lazy val multiNodeTestInTest: Boolean = sys.props.getOrElse("pekko.test.multi-in-test", "true").toBoolean
object CliOptions { object CliOptions {
val multiNode = CliOption("pekko.test.multi-node", false) lazy val multiNode = CliOption("pekko.test.multi-node", false)
val sbtLogNoFormat = CliOption("sbt.log.noformat", false) lazy val sbtLogNoFormat = CliOption("sbt.log.noformat", false)
val hostsFileName = sys.props.get("pekko.test.multi-node.hostsFileName").toSeq lazy val hostsFileName = sys.props.get("pekko.test.multi-node.hostsFileName").toSeq
val javaName = sys.props.get("pekko.test.multi-node.java").toSeq lazy val javaName = sys.props.get("pekko.test.multi-node.java").toSeq
val targetDirName = sys.props.get("pekko.test.multi-node.targetDirName").toSeq lazy val targetDirName = sys.props.get("pekko.test.multi-node.targetDirName").toSeq
} }
val multiExecuteTests = lazy val multiExecuteTests =
CliOptions.multiNode.ifTrue(MultiJvm / multiNodeExecuteTests).getOrElse(MultiJvm / executeTests) CliOptions.multiNode.ifTrue(MultiJvm / multiNodeExecuteTests).getOrElse(MultiJvm / executeTests)
val multiTest = CliOptions.multiNode.ifTrue(MultiJvm / multiNodeTest).getOrElse(MultiJvm / test) lazy val multiTest = CliOptions.multiNode.ifTrue(MultiJvm / multiNodeTest).getOrElse(MultiJvm / test)
override def trigger = noTrigger override lazy val trigger = noTrigger
override def requires = plugins.JvmPlugin && MultiJvmPlugin override lazy val requires = plugins.JvmPlugin && MultiJvmPlugin
override lazy val projectSettings: Seq[Def.Setting[_]] = multiJvmSettings override lazy val projectSettings: Seq[Def.Setting[_]] = multiJvmSettings
private val defaultMultiJvmOptions: Seq[String] = { private lazy val defaultMultiJvmOptions: Seq[String] = {
import scala.collection.JavaConverters._ import scala.collection.JavaConverters._
// multinode.D= and multinode.X= makes it possible to pass arbitrary // multinode.D= and multinode.X= makes it possible to pass arbitrary
// -D or -X arguments to the forked jvm, e.g. // -D or -X arguments to the forked jvm, e.g.
@ -69,9 +69,9 @@ object MultiNode extends AutoPlugin {
"-Xmx256m" :: pekkoProperties ::: CliOptions.sbtLogNoFormat.ifTrue("-Dpekko.test.nocolor=true").toList "-Xmx256m" :: pekkoProperties ::: CliOptions.sbtLogNoFormat.ifTrue("-Dpekko.test.nocolor=true").toList
} ++ JdkOptions.versionSpecificJavaOptions } ++ JdkOptions.versionSpecificJavaOptions
private val anyConfigsInThisProject = ScopeFilter(configurations = inAnyConfiguration) private lazy val anyConfigsInThisProject = ScopeFilter(configurations = inAnyConfiguration)
private val multiJvmSettings = private lazy val multiJvmSettings =
MultiJvmPlugin.multiJvmSettings ++ MultiJvmPlugin.multiJvmSettings ++
inConfig(MultiJvm)(scalafmtConfigSettings) ++ inConfig(MultiJvm)(scalafmtConfigSettings) ++
Seq( Seq(
@ -137,7 +137,7 @@ object MultiNode extends AutoPlugin {
*/ */
object MultiNodeScalaTest extends AutoPlugin { object MultiNodeScalaTest extends AutoPlugin {
override def requires = MultiNode override lazy val requires = MultiNode
override lazy val projectSettings = override lazy val projectSettings =
Seq( Seq(

View file

@ -23,7 +23,7 @@ object OSGi {
// The included osgiSettings that creates bundles also publish the jar files // The included osgiSettings that creates bundles also publish the jar files
// in the .../bundles directory which makes testing locally published artifacts // in the .../bundles directory which makes testing locally published artifacts
// a pain. Create bundles but publish them to the normal .../jars directory. // a pain. Create bundles but publish them to the normal .../jars directory.
def osgiSettings = lazy val osgiSettings =
defaultOsgiSettings ++ Seq( defaultOsgiSettings ++ Seq(
Compile / packageBin := { Compile / packageBin := {
val bundle = OsgiKeys.bundle.value val bundle = OsgiKeys.bundle.value
@ -45,7 +45,7 @@ object OSGi {
// Recent versions of BND create corrupted jars so use JDK jar instead, see https://github.com/sbt/sbt-osgi/pull/81 // Recent versions of BND create corrupted jars so use JDK jar instead, see https://github.com/sbt/sbt-osgi/pull/81
OsgiKeys.packageWithJVMJar := true) OsgiKeys.packageWithJVMJar := true)
val actor = osgiSettings ++ Seq( lazy val actor = osgiSettings ++ Seq(
OsgiKeys.exportPackage := Seq("org.apache.pekko*"), OsgiKeys.exportPackage := Seq("org.apache.pekko*"),
OsgiKeys.privatePackage := Seq("org.apache.pekko.osgi.impl"), OsgiKeys.privatePackage := Seq("org.apache.pekko.osgi.impl"),
// pekko-actor packages are not imported, as contained in the CP // pekko-actor packages are not imported, as contained in the CP
@ -58,22 +58,23 @@ object OSGi {
// dynamicImportPackage needed for loading classes defined in configuration // dynamicImportPackage needed for loading classes defined in configuration
OsgiKeys.dynamicImportPackage := Seq("*")) OsgiKeys.dynamicImportPackage := Seq("*"))
val actorTyped = exports(Seq("org.apache.pekko.actor.typed.*")) lazy val actorTyped = exports(Seq("org.apache.pekko.actor.typed.*"))
val cluster = exports(Seq("org.apache.pekko.cluster.*")) lazy val cluster = exports(Seq("org.apache.pekko.cluster.*"))
val clusterTools = exports(Seq("org.apache.pekko.cluster.singleton.*", "org.apache.pekko.cluster.client.*", lazy val clusterTools = exports(Seq("org.apache.pekko.cluster.singleton.*", "org.apache.pekko.cluster.client.*",
"org.apache.pekko.cluster.pubsub.*")) "org.apache.pekko.cluster.pubsub.*"))
val clusterSharding = exports(Seq("org.apache.pekko.cluster.sharding.*")) lazy val clusterSharding = exports(Seq("org.apache.pekko.cluster.sharding.*"))
val clusterMetrics = exports(Seq("org.apache.pekko.cluster.metrics.*"), imports = Seq(kamonImport(), sigarImport())) lazy val clusterMetrics =
exports(Seq("org.apache.pekko.cluster.metrics.*"), imports = Seq(kamonImport(), sigarImport()))
val distributedData = exports(Seq("org.apache.pekko.cluster.ddata.*")) lazy val distributedData = exports(Seq("org.apache.pekko.cluster.ddata.*"))
val osgi = exports(Seq("org.apache.pekko.osgi.*")) lazy val osgi = exports(Seq("org.apache.pekko.osgi.*"))
val protobufV3 = osgiSettings ++ Seq( lazy val protobufV3 = osgiSettings ++ Seq(
OsgiKeys.importPackage := Seq( OsgiKeys.importPackage := Seq(
"!sun.misc", "!sun.misc",
scalaJava8CompatImport(), scalaJava8CompatImport(),
@ -89,11 +90,11 @@ object OSGi {
// (including typical ones such as scala runtime) // (including typical ones such as scala runtime)
OsgiKeys.explodedJars := Seq(assembly.value)) OsgiKeys.explodedJars := Seq(assembly.value))
val jackson = exports(Seq("org.apache.pekko.serialization.jackson.*")) lazy val jackson = exports(Seq("org.apache.pekko.serialization.jackson.*"))
val remote = exports(Seq("org.apache.pekko.remote.*")) lazy val remote = exports(Seq("org.apache.pekko.remote.*"))
val stream = lazy val stream =
exports( exports(
packages = Seq("org.apache.pekko.stream.*", "com.typesafe.sslconfig.pekko.*"), packages = Seq("org.apache.pekko.stream.*", "com.typesafe.sslconfig.pekko.*"),
imports = Seq( imports = Seq(
@ -103,25 +104,25 @@ object OSGi {
sslConfigCoreImport("com.typesafe.sslconfig.util.*"), sslConfigCoreImport("com.typesafe.sslconfig.util.*"),
"!com.typesafe.sslconfig.pekko.*")) "!com.typesafe.sslconfig.pekko.*"))
val streamTestkit = exports(Seq("org.apache.pekko.stream.testkit.*")) lazy val streamTestkit = exports(Seq("org.apache.pekko.stream.testkit.*"))
val slf4j = exports(Seq("org.apache.pekko.event.slf4j.*")) lazy val slf4j = exports(Seq("org.apache.pekko.event.slf4j.*"))
val persistence = exports( lazy val persistence = exports(
Seq("org.apache.pekko.persistence.*"), Seq("org.apache.pekko.persistence.*"),
imports = Seq(optionalResolution("org.fusesource.leveldbjni.*"), optionalResolution("org.iq80.leveldb.*"))) imports = Seq(optionalResolution("org.fusesource.leveldbjni.*"), optionalResolution("org.iq80.leveldb.*")))
val persistenceTyped = exports(Seq("org.apache.pekko.persistence.typed.*")) lazy val persistenceTyped = exports(Seq("org.apache.pekko.persistence.typed.*"))
val persistenceQuery = exports(Seq("org.apache.pekko.persistence.query.*")) lazy val persistenceQuery = exports(Seq("org.apache.pekko.persistence.query.*"))
val testkit = exports(Seq("org.apache.pekko.testkit.*")) lazy val testkit = exports(Seq("org.apache.pekko.testkit.*"))
val discovery = exports(Seq("org.apache.pekko.discovery.*")) lazy val discovery = exports(Seq("org.apache.pekko.discovery.*"))
val coordination = exports(Seq("org.apache.pekko.coordination.*")) lazy val coordination = exports(Seq("org.apache.pekko.coordination.*"))
val osgiOptionalImports = Seq( lazy val osgiOptionalImports = Seq(
// needed because testkit is normally not used in the application bundle, // needed because testkit is normally not used in the application bundle,
// but it should still be included as transitive dependency and used by BundleDelegatingClassLoader // but it should still be included as transitive dependency and used by BundleDelegatingClassLoader
// to be able to find reference.conf // to be able to find reference.conf

View file

@ -24,7 +24,7 @@ import scala.concurrent.duration._
object Paradox { object Paradox {
val pekkoBaseURL = "https://pekko.apache.org" val pekkoBaseURL = "https://pekko.apache.org"
val propertiesSettings = Seq( lazy val propertiesSettings = Seq(
Compile / paradoxProperties ++= Map( Compile / paradoxProperties ++= Map(
"canonical.base_url" -> s"$pekkoBaseURL/docs/pekko/current", "canonical.base_url" -> s"$pekkoBaseURL/docs/pekko/current",
"github.base_url" -> GitHub "github.base_url" -> GitHub
@ -69,18 +69,18 @@ object Paradox {
"netty_version" -> Dependencies.nettyVersion, "netty_version" -> Dependencies.nettyVersion,
"logback_version" -> Dependencies.logbackVersion)) "logback_version" -> Dependencies.logbackVersion))
val rootsSettings = Seq( lazy val rootsSettings = Seq(
paradoxRoots := List( paradoxRoots := List(
"index.html", "index.html",
// TODO page not linked to // TODO page not linked to
"fault-tolerance-sample.html")) "fault-tolerance-sample.html"))
val themeSettings = Seq( lazy val themeSettings = Seq(
pekkoParadoxGithub := Some("https://github.com/apache/incubator-pekko")) pekkoParadoxGithub := Some("https://github.com/apache/incubator-pekko"))
// FIXME https://github.com/lightbend/paradox/issues/350 // FIXME https://github.com/lightbend/paradox/issues/350
// Exclusions from direct compilation for includes dirs/files not belonging in a TOC // Exclusions from direct compilation for includes dirs/files not belonging in a TOC
val includesSettings = Seq( lazy val includesSettings = Seq(
(Compile / paradoxMarkdownToHtml / excludeFilter) := (Compile / paradoxMarkdownToHtml / excludeFilter).value || (Compile / paradoxMarkdownToHtml / excludeFilter) := (Compile / paradoxMarkdownToHtml / excludeFilter).value ||
ParadoxPlugin.InDirectoryFilter((Compile / paradox / sourceDirectory).value / "includes"), ParadoxPlugin.InDirectoryFilter((Compile / paradox / sourceDirectory).value / "includes"),
// Links are interpreted relative to the page the snippet is included in, // Links are interpreted relative to the page the snippet is included in,
@ -88,11 +88,11 @@ object Paradox {
(Compile / paradoxMarkdownToHtml / excludeFilter) := (Compile / paradoxMarkdownToHtml / excludeFilter).value || (Compile / paradoxMarkdownToHtml / excludeFilter) := (Compile / paradoxMarkdownToHtml / excludeFilter).value ||
ParadoxPlugin.InDirectoryFilter((Compile / paradox / sourceDirectory).value / "includes.html")) ParadoxPlugin.InDirectoryFilter((Compile / paradox / sourceDirectory).value / "includes.html"))
val groupsSettings = Seq(Compile / paradoxGroups := Map("Language" -> Seq("Scala", "Java"))) lazy val groupsSettings = Seq(Compile / paradoxGroups := Map("Language" -> Seq("Scala", "Java")))
val parsingSettings = Seq(Compile / paradoxParsingTimeout := 5.seconds) lazy val parsingSettings = Seq(Compile / paradoxParsingTimeout := 5.seconds)
val sourceGeneratorSettings = Seq( lazy val sourceGeneratorSettings = Seq(
Compile / paradoxMarkdownToHtml / sourceGenerators += Def.taskDyn { Compile / paradoxMarkdownToHtml / sourceGenerators += Def.taskDyn {
val targetFile = (Compile / paradox / sourceManaged).value / "project" / "license-report.md" val targetFile = (Compile / paradox / sourceManaged).value / "project" / "license-report.md"
@ -101,7 +101,7 @@ object Paradox {
} }
}.taskValue) }.taskValue)
val settings = lazy val settings =
propertiesSettings ++ propertiesSettings ++
rootsSettings ++ rootsSettings ++
includesSettings ++ includesSettings ++

View file

@ -19,12 +19,12 @@ import sbt._
object ParadoxBrowse extends AutoPlugin { object ParadoxBrowse extends AutoPlugin {
object autoImport { object autoImport {
val paradoxBrowse = taskKey[Unit]("Open the docs in the default browser") lazy val paradoxBrowse = taskKey[Unit]("Open the docs in the default browser")
} }
import autoImport._ import autoImport._
override def trigger = allRequirements override lazy val trigger = allRequirements
override def requires = ParadoxPlugin override lazy val requires = ParadoxPlugin
override lazy val projectSettings = Seq(paradoxBrowse := { override lazy val projectSettings = Seq(paradoxBrowse := {
import java.awt.Desktop import java.awt.Desktop

View file

@ -17,12 +17,12 @@ import sbt.plugins.JvmPlugin
object PekkoDisciplinePlugin extends AutoPlugin { object PekkoDisciplinePlugin extends AutoPlugin {
override def trigger: PluginTrigger = allRequirements override lazy val trigger: PluginTrigger = allRequirements
override def requires: Plugins = JvmPlugin override lazy val requires: Plugins = JvmPlugin
override lazy val projectSettings = disciplineSettings override lazy val projectSettings = disciplineSettings
// allow toggling for pocs/exploration of ideas without discipline // allow toggling for pocs/exploration of ideas without discipline
val enabled = !sys.props.contains("pekko.no.discipline") lazy val enabled = !sys.props.contains("pekko.no.discipline")
// We allow warnings in docs to get the 'snippets' right // We allow warnings in docs to get the 'snippets' right
val nonFatalJavaWarningsFor = Set( val nonFatalJavaWarningsFor = Set(
@ -95,7 +95,7 @@ object PekkoDisciplinePlugin extends AutoPlugin {
/** /**
* We are a little less strict in docs * We are a little less strict in docs
*/ */
val docs = lazy val docs =
Seq( Seq(
Compile / scalacOptions -= defaultScalaOptions, Compile / scalacOptions -= defaultScalaOptions,
Compile / scalacOptions ++= ( Compile / scalacOptions ++= (

View file

@ -17,7 +17,7 @@ import com.typesafe.config.ConfigFactory
import sbt.ConsoleLogger import sbt.ConsoleLogger
class ProjectFileIgnoreSupport(ignoreConfigFile: File, descriptor: String) { class ProjectFileIgnoreSupport(ignoreConfigFile: File, descriptor: String) {
private val stdoutLogger = ConsoleLogger(System.out) private lazy val stdoutLogger = ConsoleLogger(System.out)
private val javaSourceDirectories = Set("java", Jdk9.JAVA_SOURCE_DIRECTORY, Jdk9.JAVA_TEST_SOURCE_DIRECTORY) private val javaSourceDirectories = Set("java", Jdk9.JAVA_SOURCE_DIRECTORY, Jdk9.JAVA_TEST_SOURCE_DIRECTORY)

View file

@ -23,15 +23,15 @@ import Keys._
import sbtassembly.AssemblyKeys._ import sbtassembly.AssemblyKeys._
object Protobuf { object Protobuf {
val paths = SettingKey[Seq[File]]("protobuf-paths", "The paths that contain *.proto files.") lazy val paths = SettingKey[Seq[File]]("protobuf-paths", "The paths that contain *.proto files.")
val outputPaths = lazy val outputPaths =
SettingKey[Seq[File]]("protobuf-output-paths", "The paths where to save the generated *.java files.") SettingKey[Seq[File]]("protobuf-output-paths", "The paths where to save the generated *.java files.")
val importPath = SettingKey[Option[File]]( lazy val importPath = SettingKey[Option[File]](
"protobuf-import-path", "protobuf-import-path",
"The path that contain additional *.proto files that can be imported.") "The path that contain additional *.proto files that can be imported.")
val protoc = SettingKey[String]("protobuf-protoc", "The path and name of the protoc executable.") lazy val protoc = SettingKey[String]("protobuf-protoc", "The path and name of the protoc executable.")
val protocVersion = SettingKey[String]("protobuf-protoc-version", "The version of the protoc executable.") lazy val protocVersion = SettingKey[String]("protobuf-protoc-version", "The version of the protoc executable.")
val generate = TaskKey[Unit]("protobuf-generate", "Compile the protobuf sources and do all processing.") lazy val generate = TaskKey[Unit]("protobuf-generate", "Compile the protobuf sources and do all processing.")
lazy val settings: Seq[Setting[_]] = Seq( lazy val settings: Seq[Setting[_]] = Seq(
paths := Seq((Compile / sourceDirectory).value, (Test / sourceDirectory).value).map(_ / "protobuf"), paths := Seq((Compile / sourceDirectory).value, (Test / sourceDirectory).value).map(_ / "protobuf"),

View file

@ -19,7 +19,7 @@ import sbtdynver.DynVerPlugin.autoImport.dynverSonatypeSnapshots
object Publish extends AutoPlugin { object Publish extends AutoPlugin {
override def trigger = allRequirements override lazy val trigger = allRequirements
override lazy val projectSettings = Seq( override lazy val projectSettings = Seq(
startYear := Some(2022), startYear := Some(2022),
@ -33,15 +33,15 @@ object Publish extends AutoPlugin {
override lazy val buildSettings = Seq( override lazy val buildSettings = Seq(
dynverSonatypeSnapshots := true) dynverSonatypeSnapshots := true)
override def requires = ApacheSonatypePlugin && DynVerPlugin override lazy val requires = ApacheSonatypePlugin && DynVerPlugin
} }
/** /**
* For projects that are not to be published. * For projects that are not to be published.
*/ */
object NoPublish extends AutoPlugin { object NoPublish extends AutoPlugin {
override def requires = plugins.JvmPlugin override lazy val requires = plugins.JvmPlugin
override def projectSettings = override lazy val projectSettings =
Seq(publish / skip := true, Compile / doc / sources := Seq.empty) Seq(publish / skip := true, Compile / doc / sources := Seq.empty)
} }

View file

@ -78,11 +78,11 @@ object MultiJvmPlugin extends AutoPlugin {
import MultiJvmKeys._ import MultiJvmKeys._
override def requires = plugins.JvmPlugin override lazy val requires = plugins.JvmPlugin
override def projectConfigurations = Seq(MultiJvm) override def projectConfigurations = Seq(MultiJvm)
override def projectSettings = multiJvmSettings override lazy val projectSettings = multiJvmSettings
private[this] def noTestsMessage(scoped: ScopedKey[_])(implicit display: Show[ScopedKey[_]]): String = private[this] def noTestsMessage(scoped: ScopedKey[_])(implicit display: Show[ScopedKey[_]]): String =
"No tests to run for " + display.show(scoped) "No tests to run for " + display.show(scoped)

View file

@ -15,13 +15,13 @@ import sbt.{ AutoPlugin, PluginTrigger, Plugins }
import scalafix.sbt.ScalafixPlugin import scalafix.sbt.ScalafixPlugin
object ScalaFixExtraRulesPlugin extends AutoPlugin with ScalafixSupport { object ScalaFixExtraRulesPlugin extends AutoPlugin with ScalafixSupport {
override def trigger: PluginTrigger = allRequirements override lazy val trigger: PluginTrigger = allRequirements
override def requires: Plugins = ScalafixPlugin override lazy val requires: Plugins = ScalafixPlugin
import sbt._ import sbt._
import scalafix.sbt.ScalafixPlugin.autoImport.scalafixDependencies import scalafix.sbt.ScalafixPlugin.autoImport.scalafixDependencies
override def projectSettings: Seq[Def.Setting[_]] = super.projectSettings ++ { override lazy val projectSettings: Seq[Def.Setting[_]] = super.projectSettings ++ {
ThisBuild / scalafixDependencies ++= Seq( ThisBuild / scalafixDependencies ++= Seq(
"com.nequissimus" %% "sort-imports" % "0.6.1", "com.nequissimus" %% "sort-imports" % "0.6.1",
// https://github.com/ohze/scala-rewrites // https://github.com/ohze/scala-rewrites

View file

@ -15,16 +15,16 @@ import sbt.{ AutoPlugin, PluginTrigger, Plugins }
import scalafix.sbt.ScalafixPlugin import scalafix.sbt.ScalafixPlugin
object ScalaFixForJdk9Plugin extends AutoPlugin with ScalafixSupport { object ScalaFixForJdk9Plugin extends AutoPlugin with ScalafixSupport {
override def trigger: PluginTrigger = allRequirements override lazy val trigger: PluginTrigger = allRequirements
import Jdk9._ import Jdk9._
override def requires: Plugins = Jdk9 && ScalafixPlugin override lazy val requires: Plugins = Jdk9 && ScalafixPlugin
import ScalafixPlugin.autoImport.scalafixConfigSettings import ScalafixPlugin.autoImport.scalafixConfigSettings
import sbt._ import sbt._
lazy val scalafixIgnoredSetting: Seq[Setting[_]] = Seq(ignore(TestJdk9)) lazy val scalafixIgnoredSetting: Seq[Setting[_]] = Seq(ignore(TestJdk9))
override def projectSettings: Seq[Def.Setting[_]] = override lazy val projectSettings: Seq[Def.Setting[_]] =
Seq(CompileJdk9, TestJdk9).flatMap(c => inConfig(c)(scalafixConfigSettings(c))) ++ Seq(CompileJdk9, TestJdk9).flatMap(c => inConfig(c)(scalafixConfigSettings(c))) ++
scalafixIgnoredSetting ++ Seq( scalafixIgnoredSetting ++ Seq(
updateProjectCommands( updateProjectCommands(

View file

@ -16,15 +16,15 @@ import scalafix.sbt.ScalafixPlugin
import scalafix.sbt.ScalafixPlugin.autoImport.scalafixConfigSettings import scalafix.sbt.ScalafixPlugin.autoImport.scalafixConfigSettings
object ScalafixForMultiNodePlugin extends AutoPlugin with ScalafixSupport { object ScalafixForMultiNodePlugin extends AutoPlugin with ScalafixSupport {
override def trigger: PluginTrigger = allRequirements override lazy val trigger: PluginTrigger = allRequirements
override def requires: Plugins = MultiNode && ScalafixPlugin override lazy val requires: Plugins = MultiNode && ScalafixPlugin
import MultiJvmPlugin.autoImport._ import MultiJvmPlugin.autoImport._
lazy val scalafixIgnoredSetting: Seq[Setting[_]] = Seq(ignore(MultiJvm)) lazy val scalafixIgnoredSetting: Seq[Setting[_]] = Seq(ignore(MultiJvm))
override def projectSettings: Seq[Def.Setting[_]] = override lazy val projectSettings: Seq[Def.Setting[_]] =
Seq(MultiJvm).flatMap(c => inConfig(c)(scalafixConfigSettings(c))) ++ Seq(MultiJvm).flatMap(c => inConfig(c)(scalafixConfigSettings(c))) ++
scalafixIgnoredSetting ++ Seq( scalafixIgnoredSetting ++ Seq(
updateProjectCommands(alias = "fixall", value = ";scalafixEnable;scalafixAll;scalafmtAll"), updateProjectCommands(alias = "fixall", value = ";scalafixEnable;scalafixAll;scalafmtAll"),

View file

@ -16,13 +16,13 @@ import sbt.{ AutoPlugin, PluginTrigger, Plugins }
import scalafix.sbt.ScalafixPlugin import scalafix.sbt.ScalafixPlugin
object ScalafixIgnoreFilePlugin extends AutoPlugin with ScalafixSupport { object ScalafixIgnoreFilePlugin extends AutoPlugin with ScalafixSupport {
override def trigger: PluginTrigger = allRequirements override lazy val trigger: PluginTrigger = allRequirements
override def requires: Plugins = JvmPlugin && ScalafixPlugin override lazy val requires: Plugins = JvmPlugin && ScalafixPlugin
import sbt._ import sbt._
lazy val scalafixIgnoredSetting: Seq[Setting[_]] = if (ScalafixSupport.fixTestScope) Nil else Seq(ignore(Test)) lazy val scalafixIgnoredSetting: Seq[Setting[_]] = if (ScalafixSupport.fixTestScope) Nil else Seq(ignore(Test))
override def projectSettings: Seq[Def.Setting[_]] = override lazy val projectSettings: Seq[Def.Setting[_]] =
scalafixIgnoredSetting ++ Seq( scalafixIgnoredSetting ++ Seq(
addProjectCommandsIfAbsent(alias = "fixall", value = ";scalafixEnable;scalafixAll;test:compile;reload")) addProjectCommandsIfAbsent(alias = "fixall", value = ";scalafixEnable;scalafixAll;test:compile;reload"))
} }

View file

@ -49,5 +49,5 @@ trait ScalafixSupport {
} }
object ScalafixSupport { object ScalafixSupport {
def fixTestScope: Boolean = System.getProperty("pekko.scalafix.fixTestScope", "false").toBoolean lazy val fixTestScope: Boolean = System.getProperty("pekko.scalafix.fixTestScope", "false").toBoolean
} }

View file

@ -18,25 +18,25 @@ object TestExtras {
import JdkOptions.isJdk8 import JdkOptions.isJdk8
object Filter { object Filter {
object Keys { object Keys {
val excludeTestNames = settingKey[Set[String]]( lazy val excludeTestNames = settingKey[Set[String]](
"Names of tests to be excluded. Not supported by MultiJVM tests. Example usage: -Dpekko.test.names.exclude=TimingSpec") "Names of tests to be excluded. Not supported by MultiJVM tests. Example usage: -Dpekko.test.names.exclude=TimingSpec")
val excludeTestTags = settingKey[Set[String]]( lazy val excludeTestTags = settingKey[Set[String]](
"Tags of tests to be excluded. It will not be used if you specify -Dpekko.test.tags.only. Example usage: -Dpekko.test.tags.exclude=long-running") "Tags of tests to be excluded. It will not be used if you specify -Dpekko.test.tags.only. Example usage: -Dpekko.test.tags.exclude=long-running")
val onlyTestTags = lazy val onlyTestTags =
settingKey[Set[String]]("Tags of tests to be ran. Example usage: -Dpekko.test.tags.only=long-running") settingKey[Set[String]]("Tags of tests to be ran. Example usage: -Dpekko.test.tags.only=long-running")
val checkTestsHaveRun = taskKey[Unit]("Verify a number of notable tests have actually run") lazy val checkTestsHaveRun = taskKey[Unit]("Verify a number of notable tests have actually run")
} }
import Keys._ import Keys._
private[Filter] object Params { private[Filter] object Params {
val testNamesExclude = systemPropertyAsSeq("pekko.test.names.exclude").toSet lazy val testNamesExclude = systemPropertyAsSeq("pekko.test.names.exclude").toSet
val testTagsExlcude = systemPropertyAsSeq("pekko.test.tags.exclude").toSet lazy val testTagsExlcude = systemPropertyAsSeq("pekko.test.tags.exclude").toSet
val testTagsOnly = systemPropertyAsSeq("pekko.test.tags.only").toSet lazy val testTagsOnly = systemPropertyAsSeq("pekko.test.tags.only").toSet
} }
def settings = { lazy val settings = {
Seq( Seq(
excludeTestNames := Params.testNamesExclude, excludeTestNames := Params.testNamesExclude,
excludeTestTags := { excludeTestTags := {

View file

@ -20,12 +20,12 @@ import sbt.Keys._
import sbt.plugins.JvmPlugin import sbt.plugins.JvmPlugin
object TestQuickUntilPassed extends AutoPlugin { object TestQuickUntilPassed extends AutoPlugin {
override def requires = JvmPlugin override lazy val requires = JvmPlugin
override def trigger = allRequirements override lazy val trigger = allRequirements
object autoImport { object autoImport {
val testQuickUntilPassed = inputKey[Unit]("runs testQuick continuously until it passes") lazy val testQuickUntilPassed = inputKey[Unit]("runs testQuick continuously until it passes")
} }
import autoImport._ import autoImport._

View file

@ -24,19 +24,19 @@ import sbt._
object PekkoValidatePullRequest extends AutoPlugin { object PekkoValidatePullRequest extends AutoPlugin {
object CliOptions { object CliOptions {
val mimaEnabled = CliOption("pekko.mima.enabled", true) lazy val mimaEnabled = CliOption("pekko.mima.enabled", true)
} }
import ValidatePullRequest.autoImport._ import ValidatePullRequest.autoImport._
override def trigger = allRequirements override lazy val trigger = allRequirements
override def requires = ValidatePullRequest override lazy val requires = ValidatePullRequest
val ValidatePR = config("pr-validation").extend(Test) lazy val ValidatePR = config("pr-validation").extend(Test)
override lazy val projectConfigurations = Seq(ValidatePR) override lazy val projectConfigurations = Seq(ValidatePR)
val additionalTasks = settingKey[Seq[TaskKey[_]]]("Additional tasks for pull request validation") lazy val additionalTasks = settingKey[Seq[TaskKey[_]]]("Additional tasks for pull request validation")
override lazy val globalSettings = Seq(credentials ++= { override lazy val globalSettings = Seq(credentials ++= {
// todo this should probably be supplied properly // todo this should probably be supplied properly
@ -86,8 +86,8 @@ object PekkoValidatePullRequest extends AutoPlugin {
object MultiNodeWithPrValidation extends AutoPlugin { object MultiNodeWithPrValidation extends AutoPlugin {
import PekkoValidatePullRequest._ import PekkoValidatePullRequest._
override def trigger = allRequirements override lazy val trigger = allRequirements
override def requires = PekkoValidatePullRequest && MultiNode override lazy val requires = PekkoValidatePullRequest && MultiNode
override lazy val projectSettings = override lazy val projectSettings =
if (MultiNode.multiNodeTestInTest) Seq(additionalTasks += MultiNode.multiTest) if (MultiNode.multiNodeTestInTest) Seq(additionalTasks += MultiNode.multiTest)
else Seq.empty else Seq.empty
@ -100,8 +100,8 @@ object MultiNodeWithPrValidation extends AutoPlugin {
object MimaWithPrValidation extends AutoPlugin { object MimaWithPrValidation extends AutoPlugin {
import PekkoValidatePullRequest._ import PekkoValidatePullRequest._
override def trigger = allRequirements override lazy val trigger = allRequirements
override def requires = PekkoValidatePullRequest && MimaPlugin override lazy val requires = PekkoValidatePullRequest && MimaPlugin
override lazy val projectSettings = override lazy val projectSettings =
CliOptions.mimaEnabled.ifTrue(additionalTasks += mimaReportBinaryIssues).toList CliOptions.mimaEnabled.ifTrue(additionalTasks += mimaReportBinaryIssues).toList
} }
@ -113,14 +113,14 @@ object MimaWithPrValidation extends AutoPlugin {
object ParadoxWithPrValidation extends AutoPlugin { object ParadoxWithPrValidation extends AutoPlugin {
import PekkoValidatePullRequest._ import PekkoValidatePullRequest._
override def trigger = allRequirements override lazy val trigger = allRequirements
override def requires = PekkoValidatePullRequest && ParadoxPlugin override lazy val requires = PekkoValidatePullRequest && ParadoxPlugin
override lazy val projectSettings = Seq(additionalTasks += Compile / paradox) override lazy val projectSettings = Seq(additionalTasks += Compile / paradox)
} }
object UnidocWithPrValidation extends AutoPlugin { object UnidocWithPrValidation extends AutoPlugin {
import PekkoValidatePullRequest._ import PekkoValidatePullRequest._
override def trigger = noTrigger override lazy val trigger = noTrigger
override lazy val projectSettings = Seq(additionalTasks += Compile / unidoc) override lazy val projectSettings = Seq(additionalTasks += Compile / unidoc)
} }

View file

@ -19,7 +19,7 @@ import sbt.Keys._
*/ */
object VersionGenerator { object VersionGenerator {
val settings: Seq[Setting[_]] = inConfig(Compile)( lazy val settings: Seq[Setting[_]] = inConfig(Compile)(
Seq( Seq(
resourceGenerators += generateVersion( resourceGenerators += generateVersion(
resourceManaged, _ / "version.conf", resourceManaged, _ / "version.conf",