Scala 3 cross compatible akka-actor / akka-testkit / akka-actor-tests (#29956)
* Remove @switch when it doesn't take effect * Use ActorRef.noSender * Minor tweaks to SchedulerSpec * Disambiguate TypedActor for Scala 3 * Bump ScalaTest to a version compatible with Scala 3 * Bump ScalaCheck * Disambiguate Event in SupervisorHierarchySpec * Scala 3 compatible EventBusSpec * Prevent private unused variables to be erased by Scala 3 * Bump mockito * Explicit actorRef2Scala import * restore original .scalafix.conf * Scala 3 compatible tailrec * Reminder to re add switch annotation in case * Move to nowarn instead of silencer * Bump to Scala 2.12.13 * Cross compatible annotations * fix docs generation * adapt the build for Scala 3 * fix errors but bus * remove more SerialVersion from trait * scalacheck only from scalatest * cross-compile akka-actor-tests * restore cross-compilation * early initializers workaround * scalacheck switch * cross compatible FSM.State class * cross compatible LARS spec * Change results to pass LineNumberSpec * fix stackoverflow in AsyncDnsResolverIntegrationSpec * FSM.State unapply * fix Scala 2.13 mima * SerialVersionRemover compiler plugin * removed unused nowarns
This commit is contained in:
parent
0f27ed6189
commit
da70e0ccd4
370 changed files with 4058 additions and 1373 deletions
|
|
@ -5,7 +5,7 @@
|
|||
package akka
|
||||
|
||||
import java.io.FileReader
|
||||
import java.io.{FileInputStream, InputStreamReader}
|
||||
import java.io.{ FileInputStream, InputStreamReader }
|
||||
import java.util.Properties
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.time.ZonedDateTime
|
||||
|
|
@ -25,20 +25,18 @@ object AkkaBuild {
|
|||
|
||||
val parallelExecutionByDefault = false // TODO: enable this once we're sure it does not break things
|
||||
|
||||
lazy val buildSettings = Def.settings(
|
||||
organization := "com.typesafe.akka",
|
||||
Dependencies.Versions)
|
||||
lazy val buildSettings = Def.settings(organization := "com.typesafe.akka", Dependencies.Versions)
|
||||
|
||||
lazy val rootSettings = Def.settings(
|
||||
UnidocRoot.akkaSettings,
|
||||
Protobuf.settings,
|
||||
parallelExecution in GlobalScope := System.getProperty("akka.parallelExecution", parallelExecutionByDefault.toString).toBoolean,
|
||||
parallelExecution in GlobalScope := System
|
||||
.getProperty("akka.parallelExecution", parallelExecutionByDefault.toString)
|
||||
.toBoolean,
|
||||
// used for linking to API docs (overwrites `project-info.version`)
|
||||
ThisBuild / projectInfoVersion := { if (isSnapshot.value) "snapshot" else version.value }
|
||||
)
|
||||
ThisBuild / projectInfoVersion := { if (isSnapshot.value) "snapshot" else version.value })
|
||||
|
||||
lazy val mayChangeSettings = Seq(
|
||||
description := """|This module of Akka is marked as
|
||||
lazy val mayChangeSettings = Seq(description := """|This module of Akka is marked as
|
||||
|'may change', which means that it is in early
|
||||
|access mode, which also means that it is not covered
|
||||
|by commercial support. An module marked 'may change' doesn't
|
||||
|
|
@ -59,18 +57,20 @@ object AkkaBuild {
|
|||
(outputPath / "[artifact]-[revision](-[classifier]).[ext]").absolutePath
|
||||
|
||||
val resolver = Resolver.file("user-publish-m2-local", new File(path))
|
||||
(resolver, Seq(
|
||||
otherResolvers := resolver :: publishTo.value.toList,
|
||||
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)))
|
||||
(
|
||||
resolver,
|
||||
Seq(
|
||||
otherResolvers := resolver :: publishTo.value.toList,
|
||||
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 = Def.settings(
|
||||
|
|
@ -82,18 +82,31 @@ object AkkaBuild {
|
|||
if (System.getProperty("akka.build.useSnapshotSonatypeResolver", "false").toBoolean)
|
||||
resolvers += Resolver.sonatypeRepo("snapshots")
|
||||
else Seq.empty,
|
||||
pomIncludeRepository := (_ => false), // do not leak internal repositories during staging
|
||||
pomIncludeRepository := (_ => false) // do not leak internal repositories during staging
|
||||
)
|
||||
|
||||
private def allWarnings: Boolean = System.getProperty("akka.allwarnings", "false").toBoolean
|
||||
|
||||
final val DefaultScalacOptions = Seq(
|
||||
"-encoding", "UTF-8",
|
||||
"-feature",
|
||||
"-unchecked",
|
||||
"-Xlog-reflective-calls",
|
||||
// 'blessed' since 2.13.1
|
||||
"-language:higherKinds")
|
||||
final val DefaultScalacOptions = {
|
||||
if (Dependencies.getScalaVersion().startsWith("3.0")) {
|
||||
Seq(
|
||||
"-encoding",
|
||||
"UTF-8",
|
||||
"-feature",
|
||||
"-unchecked",
|
||||
// 'blessed' since 2.13.1
|
||||
"-language:higherKinds")
|
||||
} else {
|
||||
Seq(
|
||||
"-encoding",
|
||||
"UTF-8",
|
||||
"-feature",
|
||||
"-unchecked",
|
||||
"-Xlog-reflective-calls",
|
||||
// 'blessed' since 2.13.1
|
||||
"-language:higherKinds")
|
||||
}
|
||||
}
|
||||
|
||||
// -XDignore.symbol.file suppresses sun.misc.Unsafe warnings
|
||||
final val DefaultJavacOptions = Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-XDignore.symbol.file")
|
||||
|
|
@ -107,30 +120,26 @@ object AkkaBuild {
|
|||
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 =>
|
||||
opt == "-Xlog-reflective-calls" || opt.contains("genjavadoc")),
|
||||
opt == "-Xlog-reflective-calls" || opt.contains("genjavadoc")),
|
||||
javacOptions in Compile ++= {
|
||||
DefaultJavacOptions ++
|
||||
JdkOptions.targetJdkJavacOptions(targetSystemJdk.value, optionalDir(jdk8home.value), fullJavaHomes.value)
|
||||
JdkOptions.targetJdkJavacOptions(targetSystemJdk.value, optionalDir(jdk8home.value), fullJavaHomes.value)
|
||||
},
|
||||
javacOptions in Test ++= DefaultJavacOptions ++
|
||||
JdkOptions.targetJdkJavacOptions(targetSystemJdk.value, optionalDir(jdk8home.value), fullJavaHomes.value),
|
||||
javacOptions in Compile ++= (if (allWarnings) Seq("-Xlint:deprecation") else Nil),
|
||||
javacOptions in doc := Seq(),
|
||||
|
||||
crossVersion := CrossVersion.binary,
|
||||
|
||||
ivyLoggingLevel in ThisBuild := 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.",
|
||||
scmInfo := Some(ScmInfo(
|
||||
url("https://github.com/akka/akka"),
|
||||
"scm:git:https://github.com/akka/akka.git",
|
||||
"scm:git:git@github.com:akka/akka.git",
|
||||
)),
|
||||
scmInfo := Some(
|
||||
ScmInfo(
|
||||
url("https://github.com/akka/akka"),
|
||||
"scm:git:https://github.com/akka/akka.git",
|
||||
"scm:git:git@github.com:akka/akka.git")),
|
||||
apiURL := Some(url(s"https://doc.akka.io/api/akka/${version.value}")),
|
||||
|
||||
initialCommands :=
|
||||
"""|import language.postfixOps
|
||||
|import akka.actor._
|
||||
|
|
@ -146,12 +155,10 @@ object AkkaBuild {
|
|||
|implicit def ec = system.dispatcher
|
||||
|implicit val timeout: Timeout = Timeout(5 seconds)
|
||||
|""".stripMargin,
|
||||
|
||||
/**
|
||||
* Test settings
|
||||
*/
|
||||
fork in Test := true,
|
||||
|
||||
// default JVM config for tests
|
||||
javaOptions in Test ++= {
|
||||
val defaults = Seq(
|
||||
|
|
@ -159,10 +166,10 @@ object AkkaBuild {
|
|||
"-XX:+UseG1GC",
|
||||
// most tests actually don't really use _that_ much memory (>1g usually)
|
||||
// twice used (and then some) keeps G1GC happy - very few or to no full gcs
|
||||
"-Xms3g", "-Xmx3g",
|
||||
"-Xms3g",
|
||||
"-Xmx3g",
|
||||
// increase stack size (todo why?)
|
||||
"-Xss2m",
|
||||
|
||||
// ## extra memory/gc tuning
|
||||
// this breaks jstat, but could avoid costly syncs to disc see http://www.evanjones.ca/jvm-mmap-pause.html
|
||||
"-XX:+PerfDisableSharedMem",
|
||||
|
|
@ -171,7 +178,6 @@ object AkkaBuild {
|
|||
"-XX:MaxGCPauseMillis=300",
|
||||
// nio direct memory limit for artery/aeron (probably)
|
||||
"-XX:MaxDirectMemorySize=256m",
|
||||
|
||||
// faster random source
|
||||
"-Djava.security.egd=file:/dev/./urandom")
|
||||
|
||||
|
|
@ -180,17 +186,14 @@ object AkkaBuild {
|
|||
else
|
||||
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
|
||||
val akkaSysProps: Seq[String] =
|
||||
sys.props.filter(_._1.startsWith("akka"))
|
||||
.map { case (key, value) => s"-D$key=$value" }(breakOut)
|
||||
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 := {
|
||||
|
|
@ -199,31 +202,32 @@ object AkkaBuild {
|
|||
original.map { group =>
|
||||
group.runPolicy match {
|
||||
case Tests.SubProcess(forkOptions) =>
|
||||
group.copy(runPolicy = Tests.SubProcess(forkOptions.withWorkingDirectory(
|
||||
workingDirectory = Some(new File(System.getProperty("user.dir"))))))
|
||||
// format: off
|
||||
group.copy(runPolicy = Tests.SubProcess(
|
||||
forkOptions.withWorkingDirectory(workingDirectory = Some(new File(System.getProperty("user.dir"))))))
|
||||
// format: on
|
||||
case _ => group
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
parallelExecution in Test := System.getProperty("akka.parallelExecution", parallelExecutionByDefault.toString).toBoolean,
|
||||
parallelExecution in Test := System
|
||||
.getProperty("akka.parallelExecution", parallelExecutionByDefault.toString)
|
||||
.toBoolean,
|
||||
logBuffered in Test := System.getProperty("akka.logBufferedTests", "false").toBoolean,
|
||||
|
||||
// show full stack traces and test case durations
|
||||
testOptions in Test += Tests.Argument("-oDF"),
|
||||
|
||||
mavenLocalResolverSettings,
|
||||
docLintingSettings,
|
||||
JdkOptions.targetJdkSettings,
|
||||
|
||||
// a workaround for https://github.com/akka/akka/issues/27661
|
||||
// see also project/Protobuf.scala that introduces /../ to make "intellij happy"
|
||||
MultiJvm / assembly / fullClasspath := {
|
||||
val old = (MultiJvm / assembly / fullClasspath).value.toVector
|
||||
val files = old.map(_.data.getCanonicalFile).distinct
|
||||
files map { x => Attributed.blank(x) }
|
||||
},
|
||||
)
|
||||
files.map { x =>
|
||||
Attributed.blank(x)
|
||||
}
|
||||
})
|
||||
|
||||
private def optionalDir(path: String): Option[File] =
|
||||
Option(path).filter(_.nonEmpty).map { path =>
|
||||
|
|
@ -239,9 +243,7 @@ object AkkaBuild {
|
|||
javacOptions in doc ++= {
|
||||
if (JdkOptions.isJdk8) Seq("-Xdoclint:none")
|
||||
else Seq("-Xdoclint:none", "--ignore-source-errors")
|
||||
}
|
||||
)
|
||||
|
||||
})
|
||||
|
||||
def loadSystemProperties(fileName: String): Unit = {
|
||||
import scala.collection.JavaConverters._
|
||||
|
|
|
|||
|
|
@ -63,22 +63,48 @@ object AkkaDisciplinePlugin extends AutoPlugin {
|
|||
"akka-stream-tests-tck",
|
||||
"akka-testkit")
|
||||
|
||||
lazy val silencerSettings = {
|
||||
val silencerVersion = "1.7.1"
|
||||
val libs = Seq(
|
||||
compilerPlugin(("com.github.ghik" %% "silencer-plugin" % silencerVersion).cross(CrossVersion.patch)),
|
||||
("com.github.ghik" %% "silencer-lib" % silencerVersion % Provided).cross(CrossVersion.patch))
|
||||
Seq(libraryDependencies ++= (if (autoScalaLibrary.value) libs else Nil))
|
||||
val defaultScalaOptions = "-Wconf:cat=unused-nowarn:s,any:e"
|
||||
|
||||
lazy val nowarnSettings = {
|
||||
Dependencies.getScalaVersion() match {
|
||||
case three if three.startsWith("3.0") =>
|
||||
Seq(Compile / scalacOptions := Seq(), Compile / doc / scalacOptions := Seq())
|
||||
case _ =>
|
||||
Seq(
|
||||
Compile / scalacOptions += defaultScalaOptions,
|
||||
Test / scalacOptions += defaultScalaOptions,
|
||||
Compile / doc / scalacOptions := Seq())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We are a little less strict in docs
|
||||
*/
|
||||
val docs = {
|
||||
Dependencies.getScalaVersion() match {
|
||||
case _ =>
|
||||
Seq(
|
||||
Compile / scalacOptions -= defaultScalaOptions,
|
||||
Compile / scalacOptions += "-Wconf:cat=unused:s,cat=deprecation:s,cat=unchecked:s,any:e",
|
||||
Test / scalacOptions --= Seq("-Xlint", "-unchecked", "-deprecation"),
|
||||
Test / scalacOptions -= defaultScalaOptions,
|
||||
Test / scalacOptions += "-Wconf:cat=unused:s,cat=deprecation:s,cat=unchecked:s,any:e",
|
||||
Compile / doc / scalacOptions := Seq())
|
||||
}
|
||||
}
|
||||
|
||||
lazy val disciplineSettings =
|
||||
if (enabled) {
|
||||
silencerSettings ++ Seq(
|
||||
nowarnSettings ++ Seq(
|
||||
Compile / scalacOptions ++= Seq("-Xfatal-warnings"),
|
||||
Test / scalacOptions --= testUndicipline,
|
||||
Compile / javacOptions ++= (
|
||||
if (!nonFatalJavaWarningsFor(name.value)) Seq("-Werror", "-Xlint:deprecation", "-Xlint:unchecked")
|
||||
else Seq.empty
|
||||
if (Dependencies.getScalaVersion().startsWith("3.0")) {
|
||||
Seq()
|
||||
} else {
|
||||
if (!nonFatalJavaWarningsFor(name.value)) Seq("-Werror", "-Xlint:deprecation", "-Xlint:unchecked")
|
||||
else Seq.empty
|
||||
}
|
||||
),
|
||||
Compile / javacOptions in doc := Seq("-Xdoclint:none"),
|
||||
Compile / scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
|
||||
|
|
@ -107,7 +133,7 @@ object AkkaDisciplinePlugin extends AutoPlugin {
|
|||
Compile / console / scalacOptions --= disciplineScalacOptions.toSeq)
|
||||
} else {
|
||||
// we still need these in opt-out since the annotations are present
|
||||
silencerSettings ++ Seq(Compile / scalacOptions += "-deprecation")
|
||||
nowarnSettings ++ Seq(Compile / scalacOptions += "-deprecation")
|
||||
}
|
||||
|
||||
val testUndicipline = Seq("-Ywarn-dead-code" // '???' used in compile only specs
|
||||
|
|
@ -133,23 +159,4 @@ object AkkaDisciplinePlugin extends AutoPlugin {
|
|||
"-Ypartial-unification",
|
||||
"-Ywarn-extra-implicit")
|
||||
|
||||
/**
|
||||
* We are a little less strict in docs
|
||||
*/
|
||||
val docs = Seq(
|
||||
scalacOptions ++= Seq(
|
||||
// In docs, 'unused' variables can be useful for naming and showing the type
|
||||
"-P:silencer:globalFilters=is never used",
|
||||
// Import statements are often duplicated across multiple snippets in one file
|
||||
"-P:silencer:globalFilters=Unused import",
|
||||
// We keep documentation for this old API around for a while:
|
||||
"-P:silencer:globalFilters=in object Dns is deprecated",
|
||||
"-P:silencer:globalFilters=in class Dns is deprecated",
|
||||
// Because we sometimes wrap things in a class:
|
||||
"-P:silencer:globalFilters=The outer reference in this type test cannot be checked at run time",
|
||||
// Because we show some things that are deprecated in
|
||||
// 2.13 but don't have a replacement that was in 2.12:
|
||||
"-P:silencer:globalFilters=deprecated \\(since 2.13.0\\)"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
package akka
|
||||
|
||||
import sbt.{Def, _}
|
||||
import sbt.{ Def, _ }
|
||||
import sbt.Keys._
|
||||
|
||||
/**
|
||||
|
|
@ -15,10 +15,9 @@ import sbt.Keys._
|
|||
* The names carry a lot of implications and DO NOT have to always align 1:1 with the group ids or package names,
|
||||
* though there should be of course a strong relationship between them.
|
||||
*/
|
||||
object AutomaticModuleName {
|
||||
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)
|
||||
)
|
||||
def settings(name: String): Seq[Def.Setting[Task[Seq[PackageOption]]]] =
|
||||
Seq(packageOptions in (Compile, packageBin) += Package.ManifestAttributes(AutomaticModuleName -> name))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,13 +30,14 @@ 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 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
|
||||
})
|
||||
|
||||
// We hard-code this so PR's created in year X will not suddenly fail in X+1.
|
||||
// Of course we should remember to update it early in the year.
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ package akka
|
|||
import de.heikoseeberger.sbtheader.HeaderPlugin
|
||||
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport._
|
||||
import sbt.Keys.sourceDirectory
|
||||
import sbt.{Compile, Def, Plugins, Test, inConfig, _}
|
||||
import sbt.{ Compile, Def, Plugins, Test, inConfig, _ }
|
||||
import spray.boilerplate.BoilerplatePlugin
|
||||
|
||||
object CopyrightHeaderForBoilerplate extends CopyrightHeader {
|
||||
override def requires: Plugins = BoilerplatePlugin && HeaderPlugin
|
||||
|
||||
|
||||
override protected def headerMappingSettings: Seq[Def.Setting[_]] = {
|
||||
super.headerMappingSettings
|
||||
Seq(Compile, Test).flatMap { config =>
|
||||
|
|
@ -20,10 +20,7 @@ object CopyrightHeaderForBoilerplate extends CopyrightHeader {
|
|||
Seq(
|
||||
headerSources in config ++=
|
||||
(((sourceDirectory in config).value / "boilerplate") ** "*.template").get,
|
||||
headerMappings := headerMappings.value ++ Map(
|
||||
HeaderFileType("template") -> cStyleComment
|
||||
)
|
||||
)
|
||||
headerMappings := headerMappings.value ++ Map(HeaderFileType("template") -> cStyleComment))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
package akka
|
||||
|
||||
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport.{HeaderFileType, headerMappings, headerSources}
|
||||
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport.{ headerMappings, headerSources, HeaderFileType }
|
||||
import sbt.Keys.baseDirectory
|
||||
import sbt.{Compile, Def, PluginTrigger, Test, inConfig, _}
|
||||
import sbt.{ Compile, Def, PluginTrigger, Test, inConfig, _ }
|
||||
|
||||
object CopyrightHeaderForBuild extends CopyrightHeader {
|
||||
override def trigger: PluginTrigger = noTrigger
|
||||
|
|
@ -16,10 +16,7 @@ object CopyrightHeaderForBuild extends CopyrightHeader {
|
|||
inConfig(config) {
|
||||
Seq(
|
||||
headerSources in config ++= (((baseDirectory in config).value / "project") ** "*.scala").get,
|
||||
headerMappings := headerMappings.value ++ Map(
|
||||
HeaderFileType.scala -> cStyleComment
|
||||
)
|
||||
)
|
||||
headerMappings := headerMappings.value ++ Map(HeaderFileType.scala -> cStyleComment))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ package akka
|
|||
|
||||
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport.headerSources
|
||||
import sbt.Keys.sourceDirectory
|
||||
import sbt.{Compile, Def, Test, _}
|
||||
|
||||
import sbt.{ Compile, Def, Test, _ }
|
||||
|
||||
object CopyrightHeaderForJdk9 extends CopyrightHeader {
|
||||
|
||||
|
|
@ -22,7 +21,6 @@ object CopyrightHeaderForJdk9 extends CopyrightHeader {
|
|||
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,
|
||||
)
|
||||
(((sourceDirectory in Test).value / JAVA_TEST_SOURCE_DIRECTORY) ** "*.java").get)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
package akka
|
||||
|
||||
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport.{HeaderFileType, headerMappings, headerSources}
|
||||
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport.{ headerMappings, headerSources, HeaderFileType }
|
||||
import sbt.Keys.sourceDirectory
|
||||
import sbt.{Compile, Def, Test, inConfig, _}
|
||||
import sbt.{ Compile, Def, Test, inConfig, _ }
|
||||
|
||||
object CopyrightHeaderForProtobuf extends CopyrightHeader {
|
||||
override protected def headerMappingSettings: Seq[Def.Setting[_]] = {
|
||||
|
|
@ -16,10 +16,7 @@ object CopyrightHeaderForProtobuf extends CopyrightHeader {
|
|||
Seq(
|
||||
headerSources in config ++=
|
||||
(((sourceDirectory in config).value / "protobuf") ** "*.proto").get,
|
||||
headerMappings := headerMappings.value ++ Map(
|
||||
HeaderFileType("proto") -> cStyleComment
|
||||
)
|
||||
)
|
||||
headerMappings := headerMappings.value ++ Map(HeaderFileType("proto") -> cStyleComment))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package akka
|
|||
import sbt._
|
||||
import Keys._
|
||||
import scala.language.implicitConversions
|
||||
import dotty.tools.sbtplugin.DottyPlugin.autoImport.DottyCompatModuleID
|
||||
|
||||
object Dependencies {
|
||||
import DependencyHelpers._
|
||||
|
|
@ -27,33 +28,51 @@ object Dependencies {
|
|||
val jacksonVersion = "2.10.5"
|
||||
val jacksonDatabindVersion = "2.10.5.1"
|
||||
|
||||
val scala212Version = "2.12.11"
|
||||
val scala212Version = "2.12.13"
|
||||
val scala213Version = "2.13.3"
|
||||
val scala3Version = "3.0.0-M3"
|
||||
|
||||
val reactiveStreamsVersion = "1.0.3"
|
||||
|
||||
val sslConfigVersion = "0.4.2"
|
||||
|
||||
val scalaTestVersion = "3.1.4"
|
||||
val scalaTestVersion = {
|
||||
if (getScalaVersion().startsWith("3.0")) {
|
||||
"3.2.3"
|
||||
} else {
|
||||
"3.1.4"
|
||||
}
|
||||
}
|
||||
val scalaTestScalaCheckVersion = {
|
||||
if (getScalaVersion().startsWith("3.0")) {
|
||||
"1-15"
|
||||
} else {
|
||||
"1-14"
|
||||
}
|
||||
}
|
||||
val scalaCheckVersion = "1.15.1"
|
||||
|
||||
def getScalaVersion() = {
|
||||
// don't mandate patch not specified to allow builds to migrate
|
||||
System.getProperty("akka.build.scalaVersion", "default") match {
|
||||
case twoThirteen if twoThirteen.startsWith("2.13") => scala213Version
|
||||
case twoTwelve if twoTwelve.startsWith("2.12") => scala212Version
|
||||
case three if three.startsWith("3.0") => scala3Version
|
||||
case "default" => scala212Version
|
||||
case other =>
|
||||
throw new IllegalArgumentException(s"Unsupported scala version [$other]. Must be 2.12, 2.13 or 3.0.")
|
||||
}
|
||||
}
|
||||
|
||||
val Versions =
|
||||
Seq(
|
||||
crossScalaVersions := Seq(scala212Version, scala213Version),
|
||||
scalaVersion := {
|
||||
// don't allow full override to keep compatible with the version of silencer
|
||||
// don't mandate patch not specified to allow builds to migrate
|
||||
System.getProperty("akka.build.scalaVersion", "default") match {
|
||||
case twoThirteen if twoThirteen.startsWith("2.13") => scala213Version
|
||||
case twoTwelve if twoTwelve.startsWith("2.12") => scala212Version
|
||||
case "default" => crossScalaVersions.value.head
|
||||
case other => throw new IllegalArgumentException(s"Unsupported scala version [$other]. Must be 2.12 or 2.13.")
|
||||
}
|
||||
},
|
||||
scalaVersion := getScalaVersion(),
|
||||
java8CompatVersion := {
|
||||
CrossVersion.partialVersion(scalaVersion.value) match {
|
||||
// java8-compat is only used in a couple of places for 2.13,
|
||||
// it is probably possible to remove the dependency if needed.
|
||||
case Some((3, _)) => "0.9.0"
|
||||
case Some((2, n)) if n >= 13 => "0.9.0"
|
||||
case _ => "0.8.0"
|
||||
}
|
||||
|
|
@ -81,14 +100,18 @@ object Dependencies {
|
|||
val reactiveStreams = "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion // CC0
|
||||
|
||||
// ssl-config
|
||||
val sslConfigCore = "com.typesafe" %% "ssl-config-core" % sslConfigVersion // ApacheV2
|
||||
val sslConfigCore = DottyCompatModuleID("com.typesafe" %% "ssl-config-core" % sslConfigVersion)
|
||||
.withDottyCompat(getScalaVersion()) // ApacheV2
|
||||
|
||||
val lmdb = "org.lmdbjava" % "lmdbjava" % "0.7.0" // ApacheV2, OpenLDAP Public License
|
||||
|
||||
val junit = "junit" % "junit" % junitVersion // Common Public License 1.0
|
||||
|
||||
// For Java 8 Conversions
|
||||
val java8Compat = Def.setting { "org.scala-lang.modules" %% "scala-java8-compat" % java8CompatVersion.value } // Scala License
|
||||
val java8Compat = Def.setting {
|
||||
DottyCompatModuleID("org.scala-lang.modules" %% "scala-java8-compat" % java8CompatVersion.value)
|
||||
.withDottyCompat(getScalaVersion())
|
||||
} // Scala License
|
||||
|
||||
val aeronDriver = "io.aeron" % "aeron-driver" % aeronVersion // ApacheV2
|
||||
val aeronClient = "io.aeron" % "aeron-client" % aeronVersion // ApacheV2
|
||||
|
|
@ -122,15 +145,14 @@ object Dependencies {
|
|||
val logback = Compile.logback % "test" // EPL 1.0
|
||||
|
||||
val scalatest = "org.scalatest" %% "scalatest" % scalaTestVersion % "test" // ApacheV2
|
||||
val scalacheck = "org.scalacheck" %% "scalacheck" % scalaCheckVersion % "test" // New BSD
|
||||
|
||||
// The 'scalaTestPlus' projects are independently versioned,
|
||||
// but the version of each module starts with the scalatest
|
||||
// version it was intended to work with
|
||||
val scalatestJUnit = "org.scalatestplus" %% "junit-4-13" % (scalaTestVersion + ".0") % "test" // ApacheV2
|
||||
val scalatestTestNG = "org.scalatestplus" %% "testng-6-7" % (scalaTestVersion + ".0") % "test" // ApacheV2
|
||||
val scalatestScalaCheck = "org.scalatestplus" %% "scalacheck-1-14" % (scalaTestVersion + ".0") % "test" // ApacheV2
|
||||
val scalatestMockito = "org.scalatestplus" %% "mockito-3-3" % (scalaTestVersion + ".0") % "test" // ApacheV2
|
||||
val scalatestScalaCheck = "org.scalatestplus" %% s"scalacheck-${scalaTestScalaCheckVersion}" % (scalaTestVersion + ".0") % "test" // ApacheV2
|
||||
val scalatestMockito = "org.scalatestplus" %% "mockito-3-4" % (scalaTestVersion + ".0") % "test" // ApacheV2
|
||||
|
||||
val pojosr = "com.googlecode.pojosr" % "de.kalpatec.pojosr.framework" % "0.2.1" % "test" // ApacheV2
|
||||
val tinybundles = "org.ops4j.pax.tinybundles" % "tinybundles" % "3.0.0" % "test" // ApacheV2
|
||||
|
|
@ -202,7 +224,6 @@ object Dependencies {
|
|||
Test.scalatestScalaCheck,
|
||||
Test.commonsCodec,
|
||||
Test.commonsMath,
|
||||
Test.scalacheck,
|
||||
Test.jimfs,
|
||||
Test.dockerClient,
|
||||
Provided.activation // dockerClient needs javax.activation.DataSource in JDK 11+
|
||||
|
|
@ -302,20 +323,14 @@ object Dependencies {
|
|||
|
||||
lazy val stream = l ++= Seq[sbt.ModuleID](reactiveStreams, sslConfigCore, Test.scalatest)
|
||||
|
||||
lazy val streamTestkit = l ++= Seq(Test.scalatest, Test.scalacheck, Test.junit)
|
||||
lazy val streamTestkit = l ++= Seq(Test.scalatest, Test.scalatestScalaCheck, Test.junit)
|
||||
|
||||
lazy val streamTests = l ++= Seq(
|
||||
Test.scalatest,
|
||||
Test.scalacheck,
|
||||
Test.scalatestScalaCheck,
|
||||
Test.junit,
|
||||
Test.commonsIo,
|
||||
Test.jimfs)
|
||||
lazy val streamTests = l ++= Seq(Test.scalatest, Test.scalatestScalaCheck, Test.junit, Test.commonsIo, Test.jimfs)
|
||||
|
||||
lazy val streamTestsTck = l ++= Seq(
|
||||
Test.scalatest,
|
||||
Test.scalatestTestNG,
|
||||
Test.scalacheck,
|
||||
Test.scalatestScalaCheck,
|
||||
Test.junit,
|
||||
Test.reactiveStreamsTck)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,10 @@ package akka
|
|||
object GitHub {
|
||||
|
||||
def envTokenOrThrow: Option[String] =
|
||||
sys.env.get("PR_VALIDATOR_GH_TOKEN") orElse {
|
||||
sys.env.get("PR_VALIDATOR_GH_TOKEN").orElse {
|
||||
if (sys.env.contains("ghprbPullId")) {
|
||||
throw new Exception("No PR_VALIDATOR_GH_TOKEN env var provided during GitHub Pull Request Builder build, unable to reach GitHub!")
|
||||
throw new Exception(
|
||||
"No PR_VALIDATOR_GH_TOKEN env var provided during GitHub Pull Request Builder build, unable to reach GitHub!")
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,13 +22,14 @@ object JavaFormatter extends AutoPlugin {
|
|||
import sbt._
|
||||
import sbt.io._
|
||||
|
||||
override def projectSettings: Seq[Def.Setting[_]] = Seq(
|
||||
//below is for sbt java formatter
|
||||
(excludeFilter in javafmt) := {
|
||||
val ignoreSupport =
|
||||
new ProjectFileIgnoreSupport((baseDirectory in ThisBuild).value / ignoreConfigFileName, descriptor)
|
||||
val simpleFileFilter = new SimpleFileFilter(file => ignoreSupport.isIgnoredByFileOrPackages(file))
|
||||
simpleFileFilter || (excludeFilter in javafmt).value
|
||||
},
|
||||
javafmtOnCompile := formatOnCompile)
|
||||
override def projectSettings: Seq[Def.Setting[_]] =
|
||||
Seq(
|
||||
//below is for sbt java formatter
|
||||
(excludeFilter in javafmt) := {
|
||||
val ignoreSupport =
|
||||
new ProjectFileIgnoreSupport((baseDirectory in ThisBuild).value / ignoreConfigFileName, descriptor)
|
||||
val simpleFileFilter = new SimpleFileFilter(file => ignoreSupport.isIgnoredByFileOrPackages(file))
|
||||
simpleFileFilter || (excludeFilter in javafmt).value
|
||||
},
|
||||
javafmtOnCompile := formatOnCompile)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ object MultiNode extends AutoPlugin {
|
|||
scalacOptions in MultiJvm := (scalacOptions in Test).value,
|
||||
logLevel in multiJvmCreateLogger := Level.Debug, // to see ssh establishment
|
||||
assemblyMergeStrategy in assembly in MultiJvm := {
|
||||
case n if n.endsWith("logback-test.xml") ⇒ MergeStrategy.first
|
||||
case n if n.endsWith("logback-test.xml") => MergeStrategy.first
|
||||
case n if n.toLowerCase.matches("meta-inf.*\\.default") => MergeStrategy.first
|
||||
case n => (assemblyMergeStrategy in assembly in MultiJvm).value.apply(n)
|
||||
case n => (assemblyMergeStrategy in assembly in MultiJvm).value.apply(n)
|
||||
},
|
||||
multiJvmCreateLogger in MultiJvm := { // to use normal sbt logging infra instead of custom sbt-multijvm-one
|
||||
val previous = (multiJvmCreateLogger in MultiJvm).value
|
||||
|
|
|
|||
|
|
@ -19,13 +19,11 @@ object ParadoxBrowse extends AutoPlugin {
|
|||
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")
|
||||
}
|
||||
)
|
||||
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")
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,39 +12,28 @@ import sbt.internal.sbtscalafix.Compat
|
|||
class ProjectFileIgnoreSupport(ignoreConfigFile: File, descriptor: String) {
|
||||
private val stdoutLogger = Compat.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)
|
||||
|
||||
private val scalaSourceDirectories = Set(
|
||||
"scala",
|
||||
Jdk9.SCALA_SOURCE_DIRECTORY,
|
||||
Jdk9.SCALA_TEST_SOURCE_DIRECTORY
|
||||
)
|
||||
private val scalaSourceDirectories = Set("scala", Jdk9.SCALA_SOURCE_DIRECTORY, Jdk9.SCALA_TEST_SOURCE_DIRECTORY)
|
||||
|
||||
private lazy val ignoreConfig = {
|
||||
require(ignoreConfigFile.exists(), s"Expected ignore configuration for $descriptor at ${ignoreConfigFile.getAbsolutePath} but was missing")
|
||||
require(
|
||||
ignoreConfigFile.exists(),
|
||||
s"Expected ignore configuration for $descriptor at ${ignoreConfigFile.getAbsolutePath} but was missing")
|
||||
ConfigFactory.parseFile(ignoreConfigFile)
|
||||
}
|
||||
|
||||
private lazy val ignoredFiles: Set[String] = {
|
||||
import scala.collection.JavaConverters._
|
||||
stdoutLogger.debug(s"Loading ignored-files from $ignoreConfigFile:[${ignoreConfig.origin().url().toURI.getPath}]")
|
||||
ignoreConfig
|
||||
.getStringList("ignored-files")
|
||||
.asScala
|
||||
.toSet
|
||||
ignoreConfig.getStringList("ignored-files").asScala.toSet
|
||||
}
|
||||
|
||||
private lazy val ignoredPackages: Set[String] = {
|
||||
import scala.collection.JavaConverters._
|
||||
stdoutLogger.debug(s"Loading ignored-packages from $ignoreConfigFile:[${ignoreConfig.origin().url().toURI.getPath}]")
|
||||
ignoreConfig
|
||||
.getStringList("ignored-packages")
|
||||
.asScala
|
||||
.toSet
|
||||
stdoutLogger.debug(
|
||||
s"Loading ignored-packages from $ignoreConfigFile:[${ignoreConfig.origin().url().toURI.getPath}]")
|
||||
ignoreConfig.getStringList("ignored-packages").asScala.toSet
|
||||
}
|
||||
|
||||
def isIgnoredByFileOrPackages(file: File): Boolean =
|
||||
|
|
@ -64,7 +53,8 @@ class ProjectFileIgnoreSupport(ignoreConfigFile: File, descriptor: String) {
|
|||
case Some(packageName) =>
|
||||
val ignored = packageName.startsWith(pkg)
|
||||
if (ignored) {
|
||||
stdoutLogger.debug(s"$descriptor ignored file with pkg:$pkg for package:$packageName file:[${file.toPath}] ")
|
||||
stdoutLogger.debug(
|
||||
s"$descriptor ignored file with pkg:$pkg for package:$packageName file:[${file.toPath}] ")
|
||||
}
|
||||
ignored
|
||||
case None => false
|
||||
|
|
@ -74,9 +64,10 @@ class ProjectFileIgnoreSupport(ignoreConfigFile: File, descriptor: String) {
|
|||
}
|
||||
|
||||
private def getPackageName(fileName: String): Option[String] = {
|
||||
def getPackageName0(sourceDirectories:Set[String]): String = {
|
||||
import java.io.{File => JFile}
|
||||
val packageName = fileName.split(JFile.separatorChar)
|
||||
def getPackageName0(sourceDirectories: Set[String]): String = {
|
||||
import java.io.{ File => JFile }
|
||||
val packageName = fileName
|
||||
.split(JFile.separatorChar)
|
||||
.dropWhile(part => !sourceDirectories(part))
|
||||
.drop(1)
|
||||
.dropRight(1)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
package akka
|
||||
|
||||
import sbt.{AutoPlugin, PluginTrigger, Plugins, ScalafixSupport}
|
||||
import sbt.{ AutoPlugin, PluginTrigger, Plugins, ScalafixSupport }
|
||||
import scalafix.sbt.ScalafixPlugin
|
||||
object ScalaFixForJdk9Plugin extends AutoPlugin with ScalafixSupport {
|
||||
override def trigger: PluginTrigger = allRequirements
|
||||
|
|
@ -14,18 +14,13 @@ object ScalaFixForJdk9Plugin extends AutoPlugin with ScalafixSupport {
|
|||
import ScalafixPlugin.autoImport.scalafixConfigSettings
|
||||
import sbt._
|
||||
|
||||
lazy val scalafixIgnoredSetting: Seq[Setting[_]] = Seq(
|
||||
ignore(TestJdk9)
|
||||
)
|
||||
lazy val scalafixIgnoredSetting: Seq[Setting[_]] = Seq(ignore(TestJdk9))
|
||||
|
||||
override def projectSettings: Seq[Def.Setting[_]] =
|
||||
Seq(CompileJdk9, TestJdk9).flatMap(c => inConfig(c)(scalafixConfigSettings(c))) ++
|
||||
scalafixIgnoredSetting ++ Seq(
|
||||
scalafixIgnoredSetting ++ Seq(
|
||||
updateProjectCommands(
|
||||
alias = "fixall",
|
||||
value = ";scalafixEnable;scalafixAll;scalafmtAll;test:compile;multi-jvm:compile;reload"),
|
||||
updateProjectCommands(
|
||||
alias = "sortImports",
|
||||
value = ";scalafixEnable;scalafixAll SortImports;scalafmtAll")
|
||||
)
|
||||
updateProjectCommands(alias = "sortImports", value = ";scalafixEnable;scalafixAll SortImports;scalafmtAll"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
package akka
|
||||
|
||||
import com.typesafe.sbt.MultiJvmPlugin
|
||||
import sbt.{AutoPlugin, Def, PluginTrigger, Plugins, ScalafixSupport, Setting, inConfig}
|
||||
import sbt.{ inConfig, AutoPlugin, Def, PluginTrigger, Plugins, ScalafixSupport, Setting }
|
||||
import scalafix.sbt.ScalafixPlugin
|
||||
import scalafix.sbt.ScalafixPlugin.autoImport.scalafixConfigSettings
|
||||
|
||||
|
|
@ -16,18 +16,11 @@ object ScalafixForMultiNodePlugin extends AutoPlugin with ScalafixSupport {
|
|||
|
||||
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[_]] =
|
||||
Seq(MultiJvm).flatMap(c => inConfig(c)(scalafixConfigSettings(c))) ++
|
||||
scalafixIgnoredSetting ++ Seq(
|
||||
updateProjectCommands(
|
||||
alias = "fixall",
|
||||
value = ";scalafixEnable;scalafixAll;scalafmtAll"),
|
||||
updateProjectCommands(
|
||||
alias = "sortImports",
|
||||
value = ";scalafixEnable;scalafixAll SortImports;scalafmtAll")
|
||||
)
|
||||
scalafixIgnoredSetting ++ Seq(
|
||||
updateProjectCommands(alias = "fixall", value = ";scalafixEnable;scalafixAll;scalafmtAll"),
|
||||
updateProjectCommands(alias = "sortImports", value = ";scalafixEnable;scalafixAll SortImports;scalafmtAll"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,19 +33,17 @@ object SigarLoader {
|
|||
// Prepare Sigar agent options.
|
||||
sigarArtifact := {
|
||||
val report = update.value
|
||||
val artifactList = report.matching(
|
||||
moduleFilter(organization = sigarLoader.organization, name = sigarLoader.name))
|
||||
val artifactList =
|
||||
report.matching(moduleFilter(organization = sigarLoader.organization, name = sigarLoader.name))
|
||||
require(artifactList.size == 1, "Expecting single artifact, while found: " + artifactList)
|
||||
artifactList.head
|
||||
},
|
||||
sigarFolder := target.value / "native",
|
||||
sigarOptions := "-javaagent:" + sigarArtifact.value + "=" + sigarFolderProperty + "=" + sigarFolder.value,
|
||||
//
|
||||
fork in Test := true) ++ (
|
||||
// Invoke Sigar agent at JVM init time, to extract and load native Sigar library.
|
||||
if (sigarTestEnabled) Seq(
|
||||
javaOptions in Test += sigarOptions.value)
|
||||
else Seq())
|
||||
fork in Test := true) ++ (// Invoke Sigar agent at JVM init time, to extract and load native Sigar library.
|
||||
if (sigarTestEnabled) Seq(javaOptions in Test += sigarOptions.value)
|
||||
else Seq())
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,9 +11,12 @@ object TestExtras {
|
|||
|
||||
object Filter {
|
||||
object Keys {
|
||||
val excludeTestNames = settingKey[Set[String]]("Names of tests to be excluded. Not supported by MultiJVM tests. Example usage: -Dakka.test.names.exclude=TimingSpec")
|
||||
val excludeTestTags = settingKey[Set[String]]("Tags of tests to be excluded. It will not be used if you specify -Dakka.test.tags.only. Example usage: -Dakka.test.tags.exclude=long-running")
|
||||
val onlyTestTags = settingKey[Set[String]]("Tags of tests to be ran. Example usage: -Dakka.test.tags.only=long-running")
|
||||
val excludeTestNames = settingKey[Set[String]](
|
||||
"Names of tests to be excluded. Not supported by MultiJVM tests. Example usage: -Dakka.test.names.exclude=TimingSpec")
|
||||
val excludeTestTags = settingKey[Set[String]](
|
||||
"Tags of tests to be excluded. It will not be used if you specify -Dakka.test.tags.only. Example usage: -Dakka.test.tags.exclude=long-running")
|
||||
val onlyTestTags =
|
||||
settingKey[Set[String]]("Tags of tests to be ran. Example usage: -Dakka.test.tags.only=long-running")
|
||||
|
||||
val checkTestsHaveRun = taskKey[Unit]("Verify a number of notable tests have actually run");
|
||||
}
|
||||
|
|
@ -34,22 +37,19 @@ object TestExtras {
|
|||
else Set.empty
|
||||
},
|
||||
onlyTestTags := Params.testTagsOnly,
|
||||
|
||||
// add filters for tests excluded by name
|
||||
testOptions in Test ++= excludeTestNames.value.toSeq.map(exclude => Tests.Filter(test => !test.contains(exclude))),
|
||||
|
||||
testOptions in Test ++= excludeTestNames.value.toSeq.map(exclude =>
|
||||
Tests.Filter(test => !test.contains(exclude))),
|
||||
// add arguments for tests excluded by tag
|
||||
testOptions in Test ++= {
|
||||
val tags = excludeTestTags.value
|
||||
if (tags.isEmpty) Seq.empty else Seq(Tests.Argument("-l", tags.mkString(" ")))
|
||||
},
|
||||
|
||||
// add arguments for running only tests by tag
|
||||
testOptions in Test ++= {
|
||||
val tags = onlyTestTags.value
|
||||
if (tags.isEmpty) Seq.empty else Seq(Tests.Argument("-n", tags.mkString(" ")))
|
||||
},
|
||||
|
||||
checkTestsHaveRun := {
|
||||
def shouldExist(description: String, filename: String): Unit =
|
||||
require(file(filename).exists, s"$description should be run as part of the build")
|
||||
|
|
@ -57,10 +57,9 @@ object TestExtras {
|
|||
List(
|
||||
"The java JavaExtension.java" -> "akka-actor-tests/target/test-reports/TEST-akka.actor.JavaExtension.xml",
|
||||
"The jdk9-only FlowPublisherSinkSpec.scala" -> "akka-stream-tests/target/test-reports/TEST-akka.stream.scaladsl.FlowPublisherSinkSpec.xml",
|
||||
"The jdk9-only JavaFlowSupportCompileTest.java" -> "akka-stream-tests/target/test-reports/TEST-akka.stream.javadsl.JavaFlowSupportCompileTest.xml",
|
||||
).foreach((shouldExist _).tupled)
|
||||
}
|
||||
)
|
||||
"The jdk9-only JavaFlowSupportCompileTest.java" -> "akka-stream-tests/target/test-reports/TEST-akka.stream.javadsl.JavaFlowSupportCompileTest.xml")
|
||||
.foreach((shouldExist _).tupled)
|
||||
})
|
||||
}
|
||||
|
||||
def containsOrNotExcludesTag(tag: String) = {
|
||||
|
|
|
|||
|
|
@ -25,52 +25,45 @@ object AkkaValidatePullRequest extends AutoPlugin {
|
|||
override def trigger = allRequirements
|
||||
override def requires = ValidatePullRequest
|
||||
|
||||
val ValidatePR = config("pr-validation") extend Test
|
||||
val ValidatePR = config("pr-validation").extend(Test)
|
||||
|
||||
override lazy val projectConfigurations = Seq(ValidatePR)
|
||||
|
||||
val additionalTasks = settingKey[Seq[TaskKey[_]]]("Additional tasks for pull request validation")
|
||||
|
||||
override lazy val globalSettings = Seq(
|
||||
credentials ++= {
|
||||
// todo this should probably be supplied properly
|
||||
GitHub.envTokenOrThrow.map { token =>
|
||||
Credentials("GitHub API", "api.github.com", "", token)
|
||||
}
|
||||
},
|
||||
additionalTasks := Seq.empty
|
||||
)
|
||||
override lazy val globalSettings = Seq(credentials ++= {
|
||||
// todo this should probably be supplied properly
|
||||
GitHub.envTokenOrThrow.map { token =>
|
||||
Credentials("GitHub API", "api.github.com", "", token)
|
||||
}
|
||||
}, additionalTasks := Seq.empty)
|
||||
|
||||
override lazy val buildSettings = Seq(
|
||||
validatePullRequest / includeFilter := PathGlobFilter("akka-*/**"),
|
||||
validatePullRequestBuildAll / excludeFilter := PathGlobFilter("project/MiMa.scala"),
|
||||
prValidatorGithubRepository := Some("akka/akka")
|
||||
)
|
||||
prValidatorGithubRepository := Some("akka/akka"))
|
||||
|
||||
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", "long-running"),
|
||||
testOptions in ValidatePR += Tests.Argument(TestFrameworks.ScalaTest, "-l", "timing"),
|
||||
|
||||
// make it fork just like regular test running
|
||||
fork in ValidatePR := (fork in Test).value,
|
||||
testGrouping in ValidatePR := (testGrouping in Test).value,
|
||||
javaOptions in ValidatePR := (javaOptions in Test).value,
|
||||
|
||||
prValidatorTasks := Seq(test in ValidatePR) ++ additionalTasks.value,
|
||||
prValidatorEnforcedBuildAllTasks := Seq(test in Test) ++ additionalTasks.value
|
||||
)
|
||||
testOptions in ValidatePR += Tests.Argument(TestFrameworks.ScalaTest, "-l", "performance"),
|
||||
testOptions in ValidatePR += Tests.Argument(TestFrameworks.ScalaTest, "-l", "long-running"),
|
||||
testOptions in ValidatePR += Tests.Argument(TestFrameworks.ScalaTest, "-l", "timing"),
|
||||
// make it fork just like regular test running
|
||||
fork in ValidatePR := (fork in Test).value,
|
||||
testGrouping in ValidatePR := (testGrouping in Test).value,
|
||||
javaOptions in ValidatePR := (javaOptions in Test).value,
|
||||
prValidatorTasks := Seq(test in ValidatePR) ++ additionalTasks.value,
|
||||
prValidatorEnforcedBuildAllTasks := Seq(test in Test) ++ additionalTasks.value)
|
||||
}
|
||||
|
||||
/**
|
||||
* This autoplugin adds Multi Jvm tests to validatePullRequest task.
|
||||
* 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
|
||||
* build strategy is being determined.
|
||||
*
|
||||
* Making ValidatePullRequest depend on MultiNode is impossible, as then ValidatePullRequest
|
||||
* autoplugin would trigger only on projects which have both of these plugins enabled.
|
||||
*/
|
||||
* This autoplugin adds Multi Jvm tests to validatePullRequest task.
|
||||
* 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
|
||||
* build strategy is being determined.
|
||||
*
|
||||
* Making ValidatePullRequest depend on MultiNode is impossible, as then ValidatePullRequest
|
||||
* autoplugin would trigger only on projects which have both of these plugins enabled.
|
||||
*/
|
||||
object MultiNodeWithPrValidation extends AutoPlugin {
|
||||
import AkkaValidatePullRequest._
|
||||
import com.typesafe.sbt.MultiJvmPlugin.MultiJvmKeys.MultiJvm
|
||||
|
|
@ -83,9 +76,9 @@ object MultiNodeWithPrValidation extends AutoPlugin {
|
|||
}
|
||||
|
||||
/**
|
||||
* This autoplugin adds MiMa binary issue reporting to validatePullRequest task,
|
||||
* when a project has MimaPlugin autoplugin enabled.
|
||||
*/
|
||||
* This autoplugin adds MiMa binary issue reporting to validatePullRequest task,
|
||||
* when a project has MimaPlugin autoplugin enabled.
|
||||
*/
|
||||
object MimaWithPrValidation extends AutoPlugin {
|
||||
import AkkaValidatePullRequest._
|
||||
|
||||
|
|
@ -96,24 +89,20 @@ object MimaWithPrValidation extends AutoPlugin {
|
|||
}
|
||||
|
||||
/**
|
||||
* This autoplugin adds Paradox doc generation to validatePullRequest task,
|
||||
* when a project has ParadoxPlugin autoplugin enabled.
|
||||
*/
|
||||
* This autoplugin adds Paradox doc generation to validatePullRequest task,
|
||||
* when a project has ParadoxPlugin autoplugin enabled.
|
||||
*/
|
||||
object ParadoxWithPrValidation extends AutoPlugin {
|
||||
import AkkaValidatePullRequest._
|
||||
|
||||
override def trigger = allRequirements
|
||||
override def requires = AkkaValidatePullRequest && ParadoxPlugin
|
||||
override lazy val projectSettings = Seq(
|
||||
additionalTasks += paradox in Compile
|
||||
)
|
||||
override lazy val projectSettings = Seq(additionalTasks += paradox in Compile)
|
||||
}
|
||||
|
||||
object UnidocWithPrValidation extends AutoPlugin {
|
||||
import AkkaValidatePullRequest._
|
||||
|
||||
override def trigger = noTrigger
|
||||
override lazy val projectSettings = Seq(
|
||||
additionalTasks += unidoc in Compile
|
||||
)
|
||||
override lazy val projectSettings = Seq(additionalTasks += unidoc in Compile)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,12 +12,11 @@ import sbt.Keys._
|
|||
*/
|
||||
object VersionGenerator {
|
||||
|
||||
val settings: Seq[Setting[_]] = inConfig(Compile)(Seq(
|
||||
resourceGenerators += generateVersion(resourceManaged, _ / "version.conf",
|
||||
"""|akka.version = "%s"
|
||||
val settings: Seq[Setting[_]] = inConfig(Compile)(
|
||||
Seq(
|
||||
resourceGenerators += generateVersion(resourceManaged, _ / "version.conf", """|akka.version = "%s"
|
||||
|"""),
|
||||
sourceGenerators += generateVersion(sourceManaged, _ / "akka" / "Version.scala",
|
||||
"""|package akka
|
||||
sourceGenerators += generateVersion(sourceManaged, _ / "akka" / "Version.scala", """|package akka
|
||||
|
|
||||
|object Version {
|
||||
| val current: String = "%s"
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
sbt.version=1.3.13
|
||||
sbt.version=1.4.6
|
||||
|
|
|
|||
|
|
@ -28,3 +28,4 @@ addSbtPlugin("com.hpe.sbt" % "sbt-pull-request-validator" % "1.0.0")
|
|||
addSbtPlugin("net.bzzt" % "sbt-reproducible-builds" % "0.25")
|
||||
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
|
||||
addSbtPlugin("com.lightbend.sbt" % "sbt-publish-rsync" % "0.2")
|
||||
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.1")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue