Skip to content

Commit

Permalink
Update Scala to 3.0.0 final, sbt to 1.5.2 (#30248)
Browse files Browse the repository at this point in the history
Also: Migrate to sbt slash syntax
  • Loading branch information
lrytz committed May 25, 2021
1 parent 4975961 commit aa03e8b
Show file tree
Hide file tree
Showing 27 changed files with 145 additions and 148 deletions.
48 changes: 24 additions & 24 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,16 @@ lazy val root = Project(id = "akka", base = file("."))
akkaScalaNightly,
docs,
serialversionRemoverPlugin))
.settings(unmanagedSources in (Compile, headerCreate) := (baseDirectory.value / "project").**("*.scala").get)
.settings(Compile / headerCreate / unmanagedSources := (baseDirectory.value / "project").**("*.scala").get)
.enablePlugins(CopyrightHeaderForBuild)

lazy val actor = akkaModule("akka-actor")
.settings(Dependencies.actor)
.settings(OSGi.actor)
.settings(AutomaticModuleName.settings("akka.actor"))
.settings(unmanagedSourceDirectories in Compile += {
.settings(Compile / unmanagedSourceDirectories += {
val ver = scalaVersion.value.take(4)
(scalaSource in Compile).value.getParentFile / s"scala-$ver"
(Compile / scalaSource).value.getParentFile / s"scala-$ver"
})
.settings(VersionGenerator.settings)
.settings(serialversionRemoverPluginSettings)
Expand Down Expand Up @@ -158,7 +158,7 @@ lazy val cluster = akkaModule("akka-cluster")
.settings(AutomaticModuleName.settings("akka.cluster"))
.settings(OSGi.cluster)
.settings(Protobuf.settings)
.settings(parallelExecution in Test := false)
.settings(Test / parallelExecution := false)
.configs(MultiJvm)
.enablePlugins(MultiNodeScalaTest)

Expand All @@ -172,7 +172,7 @@ lazy val clusterMetrics = akkaModule("akka-cluster-metrics")
.settings(AutomaticModuleName.settings("akka.cluster.metrics"))
.settings(Protobuf.settings)
.settings(SigarLoader.sigarSettings)
.settings(parallelExecution in Test := false)
.settings(Test / parallelExecution := false)
.configs(MultiJvm)
.enablePlugins(MultiNodeScalaTest)

Expand Down Expand Up @@ -283,29 +283,29 @@ lazy val osgi = akkaModule("akka-osgi")
.settings(Dependencies.osgi)
.settings(AutomaticModuleName.settings("akka.osgi"))
.settings(OSGi.osgi)
.settings(parallelExecution in Test := false)
.settings(Test / parallelExecution := false)

lazy val persistence = akkaModule("akka-persistence")
.dependsOn(actor, stream, testkit % "test->test")
.settings(Dependencies.persistence)
.settings(AutomaticModuleName.settings("akka.persistence"))
.settings(OSGi.persistence)
.settings(Protobuf.settings)
.settings(fork in Test := true)
.settings(Test / fork := true)

lazy val persistenceQuery = akkaModule("akka-persistence-query")
.dependsOn(stream, persistence % "compile->compile;test->test", streamTestkit % "test")
.settings(Dependencies.persistenceQuery)
.settings(AutomaticModuleName.settings("akka.persistence.query"))
.settings(OSGi.persistenceQuery)
.settings(fork in Test := true)
.settings(Test / fork := true)
.enablePlugins(ScaladocNoVerificationOfDiagrams)

lazy val persistenceShared = akkaModule("akka-persistence-shared")
.dependsOn(persistence % "test->test", testkit % "test->test", remote % "test")
.settings(Dependencies.persistenceShared)
.settings(AutomaticModuleName.settings("akka.persistence.shared"))
.settings(fork in Test := true)
.settings(Test / fork := true)
.enablePlugins(NoPublish)
.disablePlugins(MimaPlugin, WhiteSourcePlugin)

Expand All @@ -314,7 +314,7 @@ lazy val persistenceTck = akkaModule("akka-persistence-tck")
.settings(Dependencies.persistenceTck)
.settings(AutomaticModuleName.settings("akka.persistence.tck"))
//.settings(OSGi.persistenceTck) TODO: we do need to export this as OSGi bundle too?
.settings(fork in Test := true)
.settings(Test / fork := true)
.disablePlugins(MimaPlugin)

lazy val persistenceTestkit = akkaModule("akka-persistence-testkit")
Expand Down Expand Up @@ -349,25 +349,25 @@ lazy val protobufV3 = akkaModule("akka-protobuf-v3")
.disablePlugins(MimaPlugin)
.settings(
libraryDependencies += Dependencies.Compile.Provided.protobufRuntime,
assemblyShadeRules in assembly := Seq(
assembly / assemblyShadeRules := Seq(
ShadeRule
.rename("com.google.protobuf.**" -> "akka.protobufv3.internal.@1")
// https://github.com/sbt/sbt-assembly/issues/400
.inLibrary(Dependencies.Compile.Provided.protobufRuntime)
.inProject),
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false, includeBin = false),
assembly / assemblyOption := (assembly / assemblyOption).value.copy(includeScala = false, includeBin = false),
autoScalaLibrary := false, // do not include scala dependency in pom
exportJars := true, // in dependent projects, use assembled and shaded jar
makePomConfiguration := makePomConfiguration.value
.withConfigurations(Vector(Compile)), // prevent original dependency to be added to pom as runtime dep
packagedArtifact in (Compile, packageBin) := Scoped.mkTuple2(
(artifact in (Compile, packageBin)).value,
Compile / packageBin / packagedArtifact := Scoped.mkTuple2(
(Compile / packageBin / artifact).value,
ReproducibleBuildsPlugin.postProcessJar(OsgiKeys.bundle.value)),
packageBin in Compile := ReproducibleBuildsPlugin
.postProcessJar((assembly in Compile).value), // package by running assembly
Compile / packageBin := ReproducibleBuildsPlugin
.postProcessJar((Compile / assembly).value), // package by running assembly
// Prevent cyclic task dependencies, see https://github.com/sbt/sbt-assembly/issues/365
fullClasspath in assembly := (managedClasspath in Runtime).value, // otherwise, there's a cyclic dependency between packageBin and assembly
test in assembly := {}, // assembly runs tests for unknown reason which introduces another cyclic dependency to packageBin via exportedJars
assembly / fullClasspath := (Runtime / managedClasspath).value, // otherwise, there's a cyclic dependency between packageBin and assembly
assembly / test := {}, // assembly runs tests for unknown reason which introduces another cyclic dependency to packageBin via exportedJars
description := "Akka Protobuf V3 is a shaded version of the protobuf runtime. Original POM: https://github.com/protocolbuffers/protobuf/blob/v3.9.0/java/pom.xml")

lazy val pki =
Expand All @@ -393,7 +393,7 @@ lazy val remote =
.settings(AutomaticModuleName.settings("akka.remote"))
.settings(OSGi.remote)
.settings(Protobuf.settings)
.settings(parallelExecution in Test := false)
.settings(Test / parallelExecution := false)
.enablePlugins(Jdk9)

lazy val remoteTests = akkaModule("akka-remote-tests")
Expand All @@ -405,7 +405,7 @@ lazy val remoteTests = akkaModule("akka-remote-tests")
jackson % "test->test")
.settings(Dependencies.remoteTests)
.settings(Protobuf.settings)
.settings(parallelExecution in Test := false)
.settings(Test / parallelExecution := false)
.configs(MultiJvm)
.enablePlugins(MultiNodeScalaTest, NoPublish)
.disablePlugins(MimaPlugin, WhiteSourcePlugin)
Expand Down Expand Up @@ -445,7 +445,7 @@ lazy val streamTestsTck = akkaModule("akka-stream-tests-tck")
// 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)
Test / fork := true)
.enablePlugins(NoPublish)
.disablePlugins(MimaPlugin, WhiteSourcePlugin)

Expand Down Expand Up @@ -581,14 +581,14 @@ lazy val serialversionRemoverPlugin =
scalaVersion := akka.Dependencies.scala3Version,
libraryDependencies += ("org.scala-lang" %% "scala3-compiler" % akka.Dependencies.scala3Version),
Compile / doc / sources := Nil,
publishArtifact in Compile := false)
Compile / publishArtifact := false)

lazy val serialversionRemoverPluginSettings = {
if (akka.Dependencies.getScalaVersion() == akka.Dependencies.scala3Version) {
Seq(
autoCompilerPlugins := true,
scalacOptions in Compile += (
"-Xplugin:" + (Keys.`package` in (serialversionRemoverPlugin, Compile)).value.getAbsolutePath.toString
Compile / scalacOptions += (
"-Xplugin:" + (serialversionRemoverPlugin / Compile / Keys.`package`).value.getAbsolutePath.toString
))
} else {
Seq()
Expand Down
46 changes: 23 additions & 23 deletions project/AkkaBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ object AkkaBuild {
lazy val rootSettings = Def.settings(
UnidocRoot.akkaSettings,
Protobuf.settings,
parallelExecution in GlobalScope := System
GlobalScope / parallelExecution := System
.getProperty("akka.parallelExecution", parallelExecutionByDefault.toString)
.toBoolean,
// used for linking to API docs (overwrites `project-info.version`)
Expand Down Expand Up @@ -68,7 +68,7 @@ object AkkaBuild {
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
artifacts = packagedArtifacts.value.toVector,
resolverName = resolver.name,
checksums = checksums.in(publishM2).value.toVector,
checksums = (publishM2 / checksums).value.toVector,
logging = ivyLoggingLevel.value,
overwrite = true)))
}
Expand Down Expand Up @@ -115,22 +115,22 @@ object AkkaBuild {
resolverSettings,
TestExtras.Filter.settings,
// compile options
scalacOptions in Compile ++= DefaultScalacOptions,
scalacOptions in Compile ++=
Compile / scalacOptions ++= DefaultScalacOptions,
Compile / scalacOptions ++=
JdkOptions.targetJdkScalacOptions(targetSystemJdk.value, optionalDir(jdk8home.value), fullJavaHomes.value),
scalacOptions in Compile ++= (if (allWarnings) Seq("-deprecation") else Nil),
scalacOptions in Test := (scalacOptions in Test).value.filterNot(opt =>
Compile / scalacOptions ++= (if (allWarnings) Seq("-deprecation") else Nil),
Test / scalacOptions := (Test / scalacOptions).value.filterNot(opt =>
opt == "-Xlog-reflective-calls" || opt.contains("genjavadoc")),
javacOptions in Compile ++= {
Compile / javacOptions ++= {
DefaultJavacOptions ++
JdkOptions.targetJdkJavacOptions(targetSystemJdk.value, optionalDir(jdk8home.value), fullJavaHomes.value)
},
javacOptions in Test ++= DefaultJavacOptions ++
Test / javacOptions ++= DefaultJavacOptions ++
JdkOptions.targetJdkJavacOptions(targetSystemJdk.value, optionalDir(jdk8home.value), fullJavaHomes.value),
javacOptions in Compile ++= (if (allWarnings) Seq("-Xlint:deprecation") else Nil),
javacOptions in doc := Seq(),
Compile / javacOptions ++= (if (allWarnings) Seq("-Xlint:deprecation") else Nil),
doc / javacOptions := Seq(),
crossVersion := CrossVersion.binary,
ivyLoggingLevel in ThisBuild := UpdateLogging.Quiet,
ThisBuild / ivyLoggingLevel := UpdateLogging.Quiet,
licenses := Seq(("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.html"))),
homepage := Some(url("https://akka.io/")),
description := "Akka is a toolkit for building highly concurrent, distributed, and resilient message-driven applications for Java and Scala.",
Expand Down Expand Up @@ -158,9 +158,9 @@ object AkkaBuild {
/**
* Test settings
*/
fork in Test := true,
Test / fork := true,
// default JVM config for tests
javaOptions in Test ++= {
Test / javaOptions ++= {
val defaults = Seq(
// ## core memory settings
"-XX:+UseG1GC",
Expand All @@ -187,17 +187,17 @@ object AkkaBuild {
defaults
},
// all system properties passed to sbt prefixed with "akka." will be passed on to the forked jvms as is
javaOptions in Test := {
val base = (javaOptions in Test).value
Test / javaOptions := {
val base = (Test / javaOptions).value
val akkaSysProps: Seq[String] =
sys.props.filter(_._1.startsWith("akka")).map { case (key, value) => s"-D$key=$value" }(breakOut)

base ++ akkaSysProps
},
// with forked tests the working directory is set to each module's home directory
// rather than the Akka root, some tests depend on Akka root being working dir, so reset
testGrouping in Test := {
val original: Seq[Tests.Group] = (testGrouping in Test).value
Test / testGrouping := {
val original: Seq[Tests.Group] = (Test / testGrouping).value

original.map { group =>
group.runPolicy match {
Expand All @@ -210,12 +210,12 @@ object AkkaBuild {
}
}
},
parallelExecution in Test := System
Test / parallelExecution := System
.getProperty("akka.parallelExecution", parallelExecutionByDefault.toString)
.toBoolean,
logBuffered in Test := System.getProperty("akka.logBufferedTests", "false").toBoolean,
Test / logBuffered := System.getProperty("akka.logBufferedTests", "false").toBoolean,
// show full stack traces and test case durations
testOptions in Test += Tests.Argument("-oDF"),
Test / testOptions += Tests.Argument("-oDF"),
mavenLocalResolverSettings,
docLintingSettings,
JdkOptions.targetJdkSettings,
Expand All @@ -238,9 +238,9 @@ object AkkaBuild {
}

lazy val docLintingSettings = Seq(
javacOptions in compile ++= Seq("-Xdoclint:none"),
javacOptions in test ++= Seq("-Xdoclint:none"),
javacOptions in doc ++= {
compile / javacOptions ++= Seq("-Xdoclint:none"),
test / javacOptions ++= Seq("-Xdoclint:none"),
doc / javacOptions ++= {
if (JdkOptions.isJdk8) Seq("-Xdoclint:none")
else Seq("-Xdoclint:none", "--ignore-source-errors")
})
Expand Down
2 changes: 1 addition & 1 deletion project/AkkaDisciplinePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ object AkkaDisciplinePlugin extends AutoPlugin {
else Seq.empty
}
),
Compile / javacOptions in doc := Seq("-Xdoclint:none"),
Compile / doc / javacOptions := Seq("-Xdoclint:none"),
Compile / scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) =>
disciplineScalacOptions -- Set(
Expand Down
2 changes: 1 addition & 1 deletion project/AutomaticModuleName.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ object AutomaticModuleName {
private val AutomaticModuleName = "Automatic-Module-Name"

def settings(name: String): Seq[Def.Setting[Task[Seq[PackageOption]]]] =
Seq(packageOptions in (Compile, packageBin) += Package.ManifestAttributes(AutomaticModuleName -> name))
Seq(Compile / packageBin / packageOptions += Package.ManifestAttributes(AutomaticModuleName -> name))
}
14 changes: 7 additions & 7 deletions project/CopyrightHeader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ trait CopyrightHeader extends AutoPlugin {
override def projectSettings: Seq[Def.Setting[_]] = Def.settings(headerMappingSettings, additional)

def additional: Seq[Def.Setting[_]] =
Def.settings((compile in Compile) := {
(headerCreate in Compile).value
(compile in Compile).value
}, (compile in Test) := {
(headerCreate in Test).value
(compile in Test).value
Def.settings(Compile / compile := {
(Compile / headerCreate).value
(Compile / compile).value
}, Test / compile := {
(Test / headerCreate).value
(Test / compile).value
})

// We hard-code this so PR's created in year X will not suddenly fail in X+1.
Expand Down Expand Up @@ -101,5 +101,5 @@ object CopyrightHeader extends CopyrightHeader
object CopyrightHeaderInPr extends CopyrightHeader {

override val additional =
Def.settings(additionalTasks += headerCheck in Compile, additionalTasks += headerCheck in Test)
Def.settings(additionalTasks += Compile / headerCheck, additionalTasks += Test / headerCheck)
}
4 changes: 2 additions & 2 deletions project/CopyrightHeaderForBoilerplate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ object CopyrightHeaderForBoilerplate extends CopyrightHeader {
Seq(Compile, Test).flatMap { config =>
inConfig(config) {
Seq(
headerSources in config ++=
(((sourceDirectory in config).value / "boilerplate") ** "*.template").get,
config / headerSources ++=
(((config / sourceDirectory).value / "boilerplate") ** "*.template").get,
headerMappings := headerMappings.value ++ Map(HeaderFileType("template") -> cStyleComment))
}
}
Expand Down
2 changes: 1 addition & 1 deletion project/CopyrightHeaderForBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object CopyrightHeaderForBuild extends CopyrightHeader {
Seq(Compile, Test).flatMap { config =>
inConfig(config) {
Seq(
headerSources in config ++= (((baseDirectory in config).value / "project") ** "*.scala").get,
config / headerSources ++= (((config / baseDirectory).value / "project") ** "*.scala").get,
headerMappings := headerMappings.value ++ Map(HeaderFileType.scala -> cStyleComment))
}
}
Expand Down
16 changes: 8 additions & 8 deletions project/CopyrightHeaderForJdk9.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ object CopyrightHeaderForJdk9 extends CopyrightHeader {
super.headerMappingSettings
import Jdk9._
Seq(
headerSources in Compile ++=
(((sourceDirectory in Compile).value / SCALA_SOURCE_DIRECTORY) ** "*.scala").get,
headerSources in Test ++=
(((sourceDirectory in Test).value / SCALA_TEST_SOURCE_DIRECTORY) ** "*.scala").get,
headerSources in Compile ++=
(((sourceDirectory in Compile).value / JAVA_SOURCE_DIRECTORY) ** "*.java").get,
headerSources in Test ++=
(((sourceDirectory in Test).value / JAVA_TEST_SOURCE_DIRECTORY) ** "*.java").get)
Compile / headerSources ++=
(((Compile / sourceDirectory).value / SCALA_SOURCE_DIRECTORY) ** "*.scala").get,
Test / headerSources ++=
(((Test / sourceDirectory).value / SCALA_TEST_SOURCE_DIRECTORY) ** "*.scala").get,
Compile / headerSources ++=
(((Compile / sourceDirectory).value / JAVA_SOURCE_DIRECTORY) ** "*.java").get,
Test / headerSources ++=
(((Test / sourceDirectory).value / JAVA_TEST_SOURCE_DIRECTORY) ** "*.java").get)
}
}
4 changes: 2 additions & 2 deletions project/CopyrightHeaderForProtobuf.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ object CopyrightHeaderForProtobuf extends CopyrightHeader {
Seq(Compile, Test).flatMap { config =>
inConfig(config) {
Seq(
headerSources in config ++=
(((sourceDirectory in config).value / "protobuf") ** "*.proto").get,
config / headerSources ++=
(((config / sourceDirectory).value / "protobuf") ** "*.proto").get,
headerMappings := headerMappings.value ++ Map(HeaderFileType("proto") -> cStyleComment))
}
}
Expand Down

0 comments on commit aa03e8b

Please sign in to comment.