diff --git a/bin/test-2.11 b/bin/test-2.11 index 0817a0c92e..2df4765f5d 100755 --- a/bin/test-2.11 +++ b/bin/test-2.11 @@ -6,4 +6,4 @@ # Akka snapshots which aren't being published for Scala 2.11 anymore. checkIfShouldSkip "Scala 2.11" -runSbtNoisy "+++2.11.12 test" +runSbtNoisy "++2.11.12 test" diff --git a/bin/test-2.12 b/bin/test-2.12 index 68ba5f8592..7a315ae1fa 100755 --- a/bin/test-2.12 +++ b/bin/test-2.12 @@ -2,4 +2,4 @@ . "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/scriptLib" -runSbtNoisy "+++2.12.8 test" +runSbtNoisy "++2.12.8 test" diff --git a/bin/test-sbt-1.0 b/bin/test-sbt-1.0 index a91abb6241..eb614e26cf 100755 --- a/bin/test-sbt-1.0 +++ b/bin/test-sbt-1.0 @@ -5,5 +5,5 @@ SCALA_VERSION="2.12.8" # disable publishing javadoc for scripted -runSbt ";set publishArtifact in (Compile, packageDoc) in ThisBuild := false ;+++ ${SCALA_VERSION} publishLocal" +runSbt ";set publishArtifact in (Compile, packageDoc) in ThisBuild := false ;++ ${SCALA_VERSION} publishLocal" runSbtNoisy ";set publishArtifact in (Compile, packageDoc) in ThisBuild := false ;++${SCALA_VERSION} scripted" diff --git a/build.sbt b/build.sbt index de6e5d6008..6c54b40fb1 100644 --- a/build.sbt +++ b/build.sbt @@ -10,7 +10,6 @@ import lagom.Protobuf import lagom.build._ import com.typesafe.sbt.SbtScalariform.ScalariformKeys import com.typesafe.tools.mima.core._ -import sbt.CrossVersion._ // Turn off "Resolving" log messages that clutter build logs ivyLoggingLevel in ThisBuild := UpdateLogging.Quiet @@ -128,7 +127,7 @@ def releaseStepCommandAndRemaining(command: String): State => State = { original if (newState.remainingCommands.isEmpty) { newState } else { - runCommand(newState.remainingCommands.head, newState.copy(remainingCommands = newState.remainingCommands.tail)) + runCommand(newState.remainingCommands.head.commandLine, newState.copy(remainingCommands = newState.remainingCommands.tail)) } } @@ -160,8 +159,6 @@ def runtimeLibCommon: Seq[Setting[_]] = common ++ sonatypeSettings ++ runtimeSca Dependencies.pruneWhitelistSetting, Dependencies.dependencyWhitelistSetting, - incOptions := incOptions.value.withNameHashing(true), - // show full stack traces and test case durations testOptions in Test += Tests.Argument("-oDF"), // -v Log "test run started" / "test started" / "test run finished" events on log level "info" instead of "debug". @@ -188,11 +185,11 @@ val defaultMultiJvmOptions: List[String] = { // -Djava.net.preferIPv4Stack=true or -Dmultinode.Xmx512m val MultinodeJvmArgs = "multinode\\.(D|X)(.*)".r val knownPrefix = Set("akka.", "lagom.") - val properties = System.getProperties.propertyNames.asScala.toList.collect { + val properties = System.getProperties.propertyNames.asScala.toList.collect { case s: String => s }.collect { case MultinodeJvmArgs(a, b) => val value = System.getProperty("multinode." + a + b) "-" + a + b + (if (value == "") "" else "=" + value) - case key: String if knownPrefix.exists(pre => key.startsWith(pre)) => "-D" + key + "=" + System.getProperty(key) + case key if knownPrefix.exists(pre => key.startsWith(pre)) => "-D" + key + "=" + System.getProperty(key) } "-Xmx128m" :: properties @@ -242,11 +239,15 @@ def multiJvmTestSettings: Seq[Setting[_]] = { executeTests in Test := { val testResults = (executeTests in Test).value val multiNodeResults = (executeTests in MultiJvm).value - val overall = - if (testResults.overall.id < multiNodeResults.overall.id) - multiNodeResults.overall - else - testResults.overall + import TestResult.{ Passed, Failed, Error } + val overall = (testResults.overall, multiNodeResults.overall) match { + case (Passed, Passed) => Passed + case (Failed, Failed) => Failed + case (Error, Error) => Error + case (Passed, Failed) | (Failed, Passed) => Failed + case (Passed, Error) | (Error, Passed) => Error + case (Failed, Error) | (Error, Failed) => Error + } Tests.Output(overall, testResults.events ++ multiNodeResults.events, testResults.summaries ++ multiNodeResults.summaries) @@ -260,7 +261,7 @@ def macroCompileSettings: Seq[Setting[_]] = Seq( compile in Test ~= { a => // Delete classes in "compile" packages after compiling. // These are used for compile-time tests and should be recompiled every time. - val products = a.relations.allProducts.toSeq ** new SimpleFileFilter(_.getParentFile.getName == "compile") + val products = (a.asInstanceOf[sbt.internal.inc.Analysis]).relations.allProducts.toSeq ** new SimpleFileFilter(_.getParentFile.getName == "compile") IO.delete(products.get) a } @@ -373,9 +374,8 @@ val sbtScriptedProjects = Seq[Project]( lazy val root = (project in file(".")) .settings(name := "lagom") .settings(runtimeLibCommon: _*) - .enablePlugins(CrossPerProjectPlugin) .settings( - crossScalaVersions := Dependencies.Versions.Scala, + crossScalaVersions := Nil, scalaVersion := Dependencies.Versions.Scala.head, PgpKeys.publishSigned := {}, publishLocal := {}, @@ -674,12 +674,12 @@ def forkedTests: Seq[Setting[_]] = Seq( def singleTestsGrouping(tests: Seq[TestDefinition]) = { // We could group non Cassandra tests into another group // to avoid new JVM for each test, see http://www.scala-sbt.org/release/docs/Testing.html - val javaOptions = Seq("-Xms256M", "-Xmx512M") + val javaOptions = Vector("-Xms256M", "-Xmx512M") tests map { test => Tests.Group( name = test.name, tests = Seq(test), - runPolicy = Tests.SubProcess(ForkOptions(runJVMOptions = javaOptions)) + runPolicy = Tests.SubProcess(ForkOptions().withRunJVMOptions(javaOptions)) ) } } @@ -1161,10 +1161,9 @@ lazy val `sbt-build-tool-support` = (project in file("dev") / "build-tool-suppor lazy val `sbt-plugin` = (project in file("dev") / "sbt-plugin") .settings(common: _*) .settings(scriptedSettings: _*) - .enablePlugins(SbtPluginPlugins) + .enablePlugins(SbtPluginPlugins, SbtPlugin) .settings( name := "lagom-sbt-plugin", - sbtPlugin := true, crossScalaVersions := Dependencies.Versions.SbtScala, scalaVersion := Dependencies.Versions.SbtScala.head, sbtVersion in pluginCrossBuild := defineSbtVersion(scalaBinaryVersion.value), @@ -1207,10 +1206,11 @@ lazy val `sbt-plugin` = (project in file("dev") / "sbt-plugin") val () = (publishLocal in LocalProject("sbt-scripted-tools")).value }, publishTo := { + val old = publishTo.value if (isSnapshot.value) { // Bintray doesn't support publishing snapshots, publish to Sonatype snapshots instead Some(Opts.resolver.sonatypeSnapshots) - } else publishTo.value + } else old }, publishMavenStyle := isSnapshot.value ).dependsOn(`sbt-build-tool-support`) @@ -1247,7 +1247,7 @@ lazy val `maven-launcher` = (project in file("dev") / "maven-launcher") Dependencies.`maven-launcher` ) -def scriptedSettings: Seq[Setting[_]] = ScriptedPlugin.scriptedSettings ++ +def scriptedSettings: Seq[Setting[_]] = Seq(scriptedLaunchOpts += s"-Dproject.version=${version.value}") ++ Seq( scripted := scripted.tag(Tags.Test).evaluated, @@ -1325,7 +1325,7 @@ lazy val `maven-dependencies` = (project in file("dev") / "maven-dependencies") Dependencies.Versions.Scala.map { supportedVersion => // we are sure this won't be a None val crossFunc = - CrossVersion(new Binary(binaryScalaVersion), supportedVersion, binaryScalaVersion(supportedVersion)).get + CrossVersion(Binary(), supportedVersion, CrossVersion.binaryScalaVersion(supportedVersion)).get // convert artifactName to match the desired scala version val artifactId = crossFunc(artifactName) @@ -1364,7 +1364,7 @@ lazy val `maven-dependencies` = (project in file("dev") / "maven-dependencies") // if it's a Scala dependency, // generate block for each supported scala version Dependencies.Versions.Scala.map { supportedVersion => - val crossDep = CrossVersion(supportedVersion, binaryScalaVersion(supportedVersion))(dep) + val crossDep = CrossVersion(supportedVersion, CrossVersion.binaryScalaVersion(supportedVersion))(dep) {crossDep.organization} {crossDep.name} @@ -1376,11 +1376,11 @@ lazy val `maven-dependencies` = (project in file("dev") / "maven-dependencies") } - } - ).settings( + }, // This disables creating jar, source jar and javadocs, and will cause the packaging type to be "pom" when the // pom is created - Classpaths.defaultPackageKeys.map(key => publishArtifact in key := false): _* + Classpaths.defaultPackageKeys.map(key => publishArtifact in key := false), + publishMavenStyle := true, // Disable publishing ("delivering") the ivy.xml file ) // This project doesn't get aggregated, it is only executed by the sbt-plugin scripted dependencies diff --git a/docs/build.sbt b/docs/build.sbt index 2f697e1f55..b3b0f30904 100644 --- a/docs/build.sbt +++ b/docs/build.sbt @@ -12,6 +12,7 @@ val HibernateVersion = "5.3.7.Final" val ValidationApiVersion = "2.0.1.Final" val branch = { + import scala.sys.process._ val rev = "git rev-parse --abbrev-ref HEAD".!!.trim if (rev == "HEAD") { // not on a branch, get the hash @@ -128,12 +129,13 @@ def forkedTests: Seq[Setting[_]] = Seq( def singleTestsGrouping(tests: Seq[TestDefinition]) = { // We could group non Cassandra tests into another group // to avoid new JVM for each test, see https://www.scala-sbt.org/release/docs/Testing.html - val javaOptions = Seq("-Xms256M", "-Xmx512M") + val javaOptions = Vector("-Xms256M", "-Xmx512M") tests map { test => new Tests.Group( name = test.name, tests = Seq(test), - runPolicy = Tests.SubProcess(javaOptions)) + runPolicy = Tests.SubProcess(ForkOptions().withRunJVMOptions(javaOptions)), + ) } } diff --git a/docs/manual/common/guide/devmode/code/dev-environment.sbt b/docs/manual/common/guide/devmode/code/dev-environment.sbt index 5bf964559a..9a571c6f6f 100644 --- a/docs/manual/common/guide/devmode/code/dev-environment.sbt +++ b/docs/manual/common/guide/devmode/code/dev-environment.sbt @@ -21,6 +21,7 @@ startElasticSearch in ThisBuild := { elasticsearch / "bin" / "elasticsearch" } + import scala.sys.process._ val process = Process(binFile.getAbsolutePath, elasticsearch).run(log) log.info("Elastic search started on port 9200") diff --git a/docs/project/build.properties b/docs/project/build.properties index 8e682c526d..c0bab04941 100644 --- a/docs/project/build.properties +++ b/docs/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.18 +sbt.version=1.2.8 diff --git a/docs/project/plugins.sbt b/docs/project/plugins.sbt index 2ee13b5062..c53c32def6 100644 --- a/docs/project/plugins.sbt +++ b/docs/project/plugins.sbt @@ -2,13 +2,11 @@ lazy val plugins = (project in file(".")).dependsOn(dev) lazy val dev = ProjectRef(Path.fileProperty("user.dir").getParentFile, "sbt-plugin") -resolvers += Resolver.typesafeIvyRepo("releases") -addSbtPlugin("com.lightbend.markdown" %% "sbt-lightbend-markdown" % "1.6.1") +addSbtPlugin("com.lightbend.markdown" %% "sbt-lightbend-markdown" % "1.7.0") -// Needed for bintray configuration code samples -addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0") +addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.4") -addSbtPlugin("com.typesafe.sbt" % "sbt-web" % "1.2.2") -addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.1.1") -addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.1") -addSbtPlugin("com.typesafe.sbt" % "sbt-uglify" % "1.0.3") +addSbtPlugin("com.typesafe.sbt" % "sbt-web" % "1.4.4") +addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.4.0") +addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.2") +addSbtPlugin("com.typesafe.sbt" % "sbt-uglify" % "2.0.0") diff --git a/project/Dependencies.scala b/project/Dependencies.scala index f25faed865..140bb8bac6 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -15,7 +15,7 @@ object Dependencies { val Scala211 = "2.11.12" val Scala212 = "2.12.8" val Scala = Seq(Scala212, Scala211) - val SbtScala = Seq(Scala210, Scala212) + val SbtScala = Seq(Scala212, Scala210) // If you update the version of Play, you probably need to update the other Play* variables. val Play = "2.7.0" @@ -165,7 +165,7 @@ object Dependencies { "jackson-datatype-jdk8", "jackson-datatype-jsr310", "jackson-datatype-guava", "jackson-datatype-pcollections" ) - val scalaParserCombinatorOverrides = Set(scalaParserCombinators) + val scalaParserCombinatorOverrides = Seq(scalaParserCombinators) // A whitelist of dependencies that Lagom is allowed to depend on, either directly or transitively. // This list is used to validate all of Lagom's dependencies. diff --git a/project/Protobuf.scala b/project/Protobuf.scala index 1b9663910b..03403b671e 100644 --- a/project/Protobuf.scala +++ b/project/Protobuf.scala @@ -5,8 +5,9 @@ package lagom import sbt._ -import Process._ -import Keys._ +import sbt.Keys._ +import sbt.util.CacheStoreFactory +import scala.sys.process._ import java.io.File import java.io.PrintWriter @@ -98,7 +99,7 @@ object Protobuf { * Create a transformed version of all files in a directory, given a predicate and a transform function for each file. */ def transformDirectory(sourceDir: File, targetDir: File, transformable: File => Boolean, transform: (File, File) => Unit, cache: File, log: Logger): File = { - val runTransform = FileFunction.cached(cache)(FilesInfo.hash, FilesInfo.exists) { (in, out) => + val runTransform = FileFunction.cached(CacheStoreFactory(cache), FilesInfo.hash, FilesInfo.exists) { (in, out) => val map = Path.rebase(sourceDir, targetDir) if (in.removed.nonEmpty || in.modified.nonEmpty) { log.info("Preprocessing directory %s..." format sourceDir) @@ -116,7 +117,7 @@ object Protobuf { updated } else Set.empty } - val sources = (sourceDir ***).get.toSet + val sources = sourceDir.allPaths.get.toSet runTransform(sources) targetDir } diff --git a/project/SbtMavenPlugin.scala b/project/SbtMavenPlugin.scala index bf8b3e591b..d6c106aff6 100644 --- a/project/SbtMavenPlugin.scala +++ b/project/SbtMavenPlugin.scala @@ -121,7 +121,7 @@ object SbtMavenPlugin extends AutoPlugin { test.getName -> mavenExecutions.foldLeft(true) { (success, execution) => if (success) { log.info(s"Executing mvn $execution") - val rc = Fork.java(ForkOptions(workingDirectory = Some(testDir)), args ++ execution.split(" +")) + val rc = Fork.java(ForkOptions().withWorkingDirectory(testDir), args ++ execution.split(" +")) rc == 0 } else { false diff --git a/project/build.properties b/project/build.properties index 8e682c526d..c0bab04941 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.18 +sbt.version=1.2.8 diff --git a/project/plugins.sbt b/project/plugins.sbt index 41fe566d7b..0e4402f816 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,9 +1,5 @@ // Copyright (C) 2016-2019 Lightbend Inc. -libraryDependencies ++= Seq( - "org.scala-sbt" % "scripted-plugin" % sbtVersion.value -) - addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.2") // the plugins used during release can have an impact on default values @@ -18,9 +14,8 @@ addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.4") addSbtPlugin("com.typesafe.sbt" % "sbt-multi-jvm" % "0.4.0") addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2") -addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.1") +addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.4") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.3.0") -addSbtPlugin("com.eed3si9n" % "sbt-doge" % "0.1.5") addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.0") addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.14")