diff --git a/build.sbt b/build.sbt index 5bfb197a2..5589af998 100644 --- a/build.sbt +++ b/build.sbt @@ -73,17 +73,17 @@ def commonBaseSettings: Seq[Setting[_]] = Def.settings( )(Resolver.ivyStylePatterns), testFrameworks += TestFramework("hedgehog.sbt.Framework"), testFrameworks += TestFramework("verify.runner.Framework"), - concurrentRestrictions in Global += Util.testExclusiveRestriction, - testOptions in Test += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), - testOptions in Test += Tests.Argument(TestFrameworks.ScalaCheck, "-verbosity", "2"), - javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"), + Global / concurrentRestrictions += Util.testExclusiveRestriction, + Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), + Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-verbosity", "2"), + compile / javacOptions ++= Seq("-Xlint", "-Xlint:-serial"), Compile / doc / scalacOptions ++= { import scala.sys.process._ val devnull = ProcessLogger(_ => ()) val tagOrSha = ("git describe --exact-match" #|| "git rev-parse HEAD").lineStream(devnull).head Seq( "-sourcepath", - (baseDirectory in LocalRootProject).value.getAbsolutePath, + (LocalRootProject / baseDirectory).value.getAbsolutePath, "-doc-source-url", s"https://github.com/sbt/sbt/tree/$tagOrSha€{FILE_PATH}.scala" ) @@ -99,8 +99,8 @@ def commonBaseSettings: Seq[Setting[_]] = Def.settings( Test / unmanagedSources / inputFileStamps := (Test / unmanagedSources / inputFileStamps).dependsOn(Test / javafmtOnCompile).value, crossScalaVersions := List(scala212, scala213), - publishArtifact in Test := false, - fork in run := true, + Test / publishArtifact := false, + run / fork := true, ) def commonSettings: Seq[Setting[_]] = commonBaseSettings :+ @@ -118,7 +118,12 @@ def baseSettings: Seq[Setting[_]] = def testedBaseSettings: Seq[Setting[_]] = baseSettings ++ testDependencies -val sbt13Plus = Seq("1.3.0") +val sbt13Plus = + Seq( + "1.3.0", + "1.4.0", + "1.5.0", + ) val sbt10Plus = Seq( "1.0.0", @@ -191,8 +196,8 @@ lazy val sbtRoot: Project = (project in file(".")) Transform.conscriptSettings(bundledLauncherProj), publish := {}, publishLocal := {}, - skip in publish := true, - commands in Global += Command + publish / skip := true, + Global / commands += Command .single("sbtOn")((state, dir) => s"sbtProj/test:runMain sbt.RunFromSourceMain $dir" :: state), mimaSettings, mimaPreviousArtifacts := Set.empty, @@ -232,7 +237,7 @@ lazy val bundledLauncherProj = description := "sbt application launcher", autoScalaLibrary := false, crossPaths := false, - packageBin in Compile := sbtLaunchJar.value, + Compile / packageBin := sbtLaunchJar.value, mimaSettings, mimaPreviousArtifacts := Set() ) @@ -369,11 +374,11 @@ lazy val utilLogging = (project in file("internal") / "util-logging") case v if v.startsWith("2.12.") => List("-Ywarn-unused:-locals,-explicits,-privates") case _ => List() }), - sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala", - managedSourceDirectories in Compile += + Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala", + Compile / managedSourceDirectories += baseDirectory.value / "src" / "main" / "contraband-scala", - contrabandFormatsForType in generateContrabands in Compile := { tpe => - val old = (contrabandFormatsForType in generateContrabands in Compile).value + Compile / generateContrabands / contrabandFormatsForType := { tpe => + val old = (Compile / generateContrabands / contrabandFormatsForType).value val name = tpe.removeTypeParameters.name if (name == "Throwable") Nil else old(tpe) @@ -407,6 +412,7 @@ lazy val utilLogging = (project in file("internal") / "util-logging") exclude[IncompatibleSignatureProblem]("sbt.internal.util.MainAppender*"), exclude[MissingTypesProblem]("sbt.internal.util.ConsoleAppender"), exclude[MissingTypesProblem]("sbt.internal.util.BufferedAppender"), + exclude[MissingClassProblem]("sbt.internal.util.Terminal$BlockingInputStream$"), ), ) .configure(addSbtIO) @@ -475,10 +481,10 @@ lazy val testingProj = (project in file("testing")) sjsonNewScalaJson.value ), Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates", - managedSourceDirectories in Compile += + Compile / managedSourceDirectories += baseDirectory.value / "src" / "main" / "contraband-scala", - sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala", - contrabandFormatsForType in generateContrabands in Compile := ContrabandConfig.getFormats, + Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala", + Compile / generateContrabands / contrabandFormatsForType := ContrabandConfig.getFormats, mimaSettings, mimaBinaryIssueFilters ++= Seq( // private[sbt] @@ -559,6 +565,7 @@ lazy val stdTaskProj = (project in file("tasks-standard")) mimaBinaryIssueFilters ++= Seq( // unused private[sbt] exclude[DirectMissingMethodProblem]("sbt.Task.mapTask"), + exclude[NewMixinForwarderProblem]("sbt.std.TaskExtra.joinAnyTasks"), ), ) .configure(addSbtIO) @@ -571,9 +578,9 @@ lazy val runProj = (project in file("run")) testedBaseSettings, name := "Run", Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates", - managedSourceDirectories in Compile += + Compile / managedSourceDirectories += baseDirectory.value / "src" / "main" / "contraband-scala", - sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala", + Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala", mimaSettings, mimaBinaryIssueFilters ++= Seq( // copy method was never meant to be public @@ -668,6 +675,7 @@ lazy val actionsProj = (project in file("main-actions")) exclude[DirectMissingMethodProblem]("sbt.Doc.generate"), exclude[DirectMissingMethodProblem]("sbt.compiler.Eval.filesModifiedBytes"), exclude[DirectMissingMethodProblem]("sbt.compiler.Eval.fileModifiedBytes"), + exclude[DirectMissingMethodProblem]("sbt.Doc.$init$"), ), ) .configure( @@ -687,10 +695,10 @@ lazy val protocolProj = (project in file("protocol")) name := "Protocol", libraryDependencies ++= Seq(sjsonNewScalaJson.value, ipcSocket), Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates", - managedSourceDirectories in Compile += + Compile / managedSourceDirectories += baseDirectory.value / "src" / "main" / "contraband-scala", - sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala", - contrabandFormatsForType in generateContrabands in Compile := ContrabandConfig.getFormats, + Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala", + Compile / generateContrabands / contrabandFormatsForType := ContrabandConfig.getFormats, mimaSettings, mimaBinaryIssueFilters ++= Seq( // copy method was never meant to be public @@ -729,10 +737,10 @@ lazy val commandProj = (project in file("main-command")) name := "Command", libraryDependencies ++= Seq(launcherInterface, sjsonNewScalaJson.value, templateResolverApi), Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates", - managedSourceDirectories in Compile += + Compile / managedSourceDirectories += baseDirectory.value / "src" / "main" / "contraband-scala", - sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala", - contrabandFormatsForType in generateContrabands in Compile := ContrabandConfig.getFormats, + Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala", + Compile / generateContrabands / contrabandFormatsForType := ContrabandConfig.getFormats, mimaSettings, mimaBinaryIssueFilters ++= Vector( exclude[DirectMissingMethodProblem]("sbt.Exit.apply"), @@ -766,8 +774,8 @@ lazy val commandProj = (project in file("main-command")) exclude[MissingTypesProblem]("sbt.internal.server.ServerConnection*"), exclude[IncompatibleSignatureProblem]("sbt.internal.server.ServerConnection.*") ), - unmanagedSources in (Compile, headerCreate) := { - val old = (unmanagedSources in (Compile, headerCreate)).value + Compile / headerCreate / unmanagedSources := { + val old = (Compile / headerCreate / unmanagedSources).value old filterNot { x => (x.getName startsWith "NG") || (x.getName == "ReferenceCountedFileDescriptor.java") } @@ -807,7 +815,7 @@ lazy val mainSettingsProj = (project in file("main-settings")) .settings( testedBaseSettings, name := "Main Settings", - testOptions in Test ++= { + Test / testOptions ++= { val cp = (Test / fullClasspathAsJars).value.map(_.data).mkString(java.io.File.pathSeparator) val framework = TestFrameworks.ScalaTest Tests.Argument(framework, s"-Dsbt.server.classpath=$cp") :: @@ -861,7 +869,7 @@ lazy val zincLmIntegrationProj = (project in file("zinc-lm-integration")) .settings( name := "Zinc LM Integration", testedBaseSettings, - testOptions in Test += + Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, s"-Dsbt.zinc.version=$zincVersion"), mimaSettingsSince(sbt13Plus), mimaBinaryIssueFilters ++= Seq( @@ -870,6 +878,7 @@ lazy val zincLmIntegrationProj = (project in file("zinc-lm-integration")) exclude[IncompatibleSignatureProblem]("sbt.internal.inc.ZincLMHelper.update"), ), libraryDependencies += launcherInterface, + Test / fork := true, ) .configure(addSbtZincCompileCore, addSbtLmCore, addSbtLmIvyTest) @@ -903,11 +912,12 @@ lazy val mainProj = (project in file("main")) case v if v.startsWith("2.12.") => List() case _ => List(scalaPar) }), - managedSourceDirectories in Compile += + Compile / managedSourceDirectories += baseDirectory.value / "src" / "main" / "contraband-scala", - sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala", - testOptions in Test += Tests + Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala", + Test / testOptions += Tests .Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"), + Test / fork := true, SettingKey[Boolean]("usePipelining") := false, mimaSettings, mimaBinaryIssueFilters ++= Vector( @@ -1025,6 +1035,10 @@ lazy val mainProj = (project in file("main")) exclude[IncompatibleSignatureProblem]("sbt.internal.Act.taskAxis"), // private[sbt] method, used to call the correct sourcePositionMapper exclude[DirectMissingMethodProblem]("sbt.Defaults.foldMappers"), + exclude[DirectMissingMethodProblem]("sbt.Defaults.toAbsoluteSourceMapper"), + exclude[DirectMissingMethodProblem]("sbt.Defaults.earlyArtifactPathSetting"), + exclude[MissingClassProblem]("sbt.internal.server.BuildServerReporter$"), + exclude[IncompatibleTemplateDefProblem]("sbt.internal.server.BuildServerReporter"), ) ) .configure( @@ -1059,7 +1073,7 @@ lazy val sbtProj = (project in file("sbt-app")) Test / run / connectInput := true, Test / run / outputStrategy := Some(StdoutOutput), Test / run / fork := true, - testOptions in Test ++= { + Test / testOptions ++= { val cp = (Test / fullClasspathAsJars).value.map(_.data).mkString(java.io.File.pathSeparator) val framework = TestFrameworks.ScalaTest Tests.Argument(framework, s"-Dsbt.server.classpath=$cp") :: @@ -1302,6 +1316,8 @@ lazy val sbtIgnoredProblems = { exclude[ReversedMissingMethodProblem]("sbt.Import.sbt$Import$_setter_$SemanticSelector_="), // Dropped in favour of plain scala.Function, and its compose method exclude[DirectMissingMethodProblem]("sbt.package.toFn1"), + exclude[NewMixinForwarderProblem]("sbt.IOSyntax1.singleFileFinder"), + exclude[DirectMissingMethodProblem]("sbt.IOSyntax1.$init$"), ) } @@ -1320,8 +1336,8 @@ lazy val vscodePlugin = (project in file("vscode-sbt-scala")) bspEnabled := false, crossPaths := false, crossScalaVersions := Seq(baseScalaVersion), - skip in publish := true, - compile in Compile := { + publish / skip := true, + Compile / compile := { val _ = update.value runNpm("run compile", baseDirectory.value, streams.value.log) sbt.internal.inc.Analysis.empty @@ -1355,7 +1371,7 @@ def scriptedTask(launch: Boolean): Def.Initialize[InputTask[Unit]] = Def.inputTa val _ = publishLocalBinAll.value val launchJar = s"-Dsbt.launch.jar=${(bundledLauncherProj / Compile / packageBin).value}" Scripted.doScripted( - (scalaInstance in scriptedSbtReduxProj).value, + (scriptedSbtReduxProj / scalaInstance).value, scriptedSource.value, scriptedBufferLog.value, Def.setting(Scripted.scriptedParser(scriptedSource.value)).parsed, @@ -1421,9 +1437,9 @@ def otherRootSettings = Seq( scripted := scriptedTask(false).evaluated, scriptedUnpublished := scriptedTask(false).evaluated, - scriptedSource := (sourceDirectory in sbtProj).value / "sbt-test", - watchTriggers in scripted += scriptedSource.value.toGlob / **, - watchTriggers in scriptedUnpublished := (watchTriggers in scripted).value, + scriptedSource := (sbtProj / sourceDirectory).value / "sbt-test", + scripted / watchTriggers += scriptedSource.value.toGlob / **, + scriptedUnpublished / watchTriggers := (scripted / watchTriggers).value, scriptedLaunchOpts := List("-Xmx1500M", "-Xms512M", "-server") ::: (sys.props.get("sbt.ivy.home") match { case Some(home) => List(s"-Dsbt.ivy.home=$home") @@ -1447,7 +1463,7 @@ def otherRootSettings = }), scripted := scriptedTask(true).evaluated, scriptedUnpublished := scriptedTask(true).evaluated, - scriptedSource := (sourceDirectory in sbtProj).value / "repo-override-test" + scriptedSource := (sbtProj / sourceDirectory).value / "repo-override-test" ) ) @@ -1501,8 +1517,8 @@ def customCommands: Seq[Setting[_]] = Seq( (lmOpt map { case ProjectRef(build, _) => "{" + build.toString + "}/publishLocal" }).toList ::: (zincOpt map { case ProjectRef(build, _) => - val zincSv = get(scalaVersion in ProjectRef(build, "zinc")) - val csv = get(crossScalaVersions in ProjectRef(build, "compilerBridge")).toList + val zincSv = get((ProjectRef(build, "zinc") / scalaVersion)) + val csv = get((ProjectRef(build, "compilerBridge") / crossScalaVersions)).toList (csv flatMap { bridgeSv => s"++$bridgeSv" :: ("{" + build.toString + "}compilerBridge/publishLocal") :: Nil }) ::: diff --git a/project/HouseRulesPlugin.scala b/project/HouseRulesPlugin.scala index 42d1c2e6d..4a0b9fa1e 100644 --- a/project/HouseRulesPlugin.scala +++ b/project/HouseRulesPlugin.scala @@ -30,7 +30,7 @@ object HouseRulesPlugin extends AutoPlugin { scalacOptions += "-Ywarn-value-discard", scalacOptions ++= "-Ywarn-unused-import".ifScala(v => 11 <= v && v <= 12).value.toList ) ++ Seq(Compile, Test).flatMap( - c => scalacOptions in (c, console) --= Seq("-Ywarn-unused-import", "-Xlint") + c => (c / console / scalacOptions) --= Seq("-Ywarn-unused-import", "-Xlint") ) private def scalaPartV = Def setting (CrossVersion partialVersion scalaVersion.value) diff --git a/project/PublishBinPlugin.scala b/project/PublishBinPlugin.scala index 804f6461a..5e5397c4b 100644 --- a/project/PublishBinPlugin.scala +++ b/project/PublishBinPlugin.scala @@ -27,8 +27,8 @@ object PublishBinPlugin extends AutoPlugin { Classpaths.deliverPattern(crossTarget.value), if (isSnapshot.value) "integration" else "release", ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector, - (packagedArtifacts in publishLocalBin).value.toVector, - (checksums in publishLocalBin).value.toVector, + (publishLocalBin / packagedArtifacts).value.toVector, + (publishLocalBin / checksums).value.toVector, logging = ivyLoggingLevel.value, overwrite = isSnapshot.value ), @@ -59,9 +59,9 @@ object PublishBinPlugin extends AutoPlugin { dummyFile }, dummyDoc / packagedArtifact := (Compile / packageDoc / artifact).value -> dummyDoc.value, - packagedArtifacts in publishLocalBin := + publishLocalBin / packagedArtifacts := Classpaths - .packaged(Seq(packageBin in Compile, packageSrc in Compile, makePom, dummyDoc)) + .packaged(Seq(Compile / packageBin, Compile / packageSrc, makePom, dummyDoc)) .value ) } diff --git a/project/SbtLauncherPlugin.scala b/project/SbtLauncherPlugin.scala index 0c24d2de5..65f9f2e67 100644 --- a/project/SbtLauncherPlugin.scala +++ b/project/SbtLauncherPlugin.scala @@ -26,7 +26,7 @@ object SbtLauncherPlugin extends AutoPlugin { } }, sbtLaunchJar := { - val propFiles = (resources in Compile).value + val propFiles = (Compile / resources).value val propFileLocations = for (file <- propFiles; if file.getName != "resources") yield { if (file.getName == "sbt.boot.properties") "sbt/sbt.boot.properties" -> file diff --git a/project/Util.scala b/project/Util.scala index 8618f206d..cf8b75cc8 100644 --- a/project/Util.scala +++ b/project/Util.scala @@ -22,7 +22,7 @@ object Util { lazy val javaOnlySettings: Seq[Setting[_]] = Seq( // crossPaths := false, // compileOrder := CompileOrder.JavaThenScala, - unmanagedSourceDirectories in Compile := Seq((javaSource in Compile).value) + Compile / unmanagedSourceDirectories := Seq((Compile / javaSource).value) ) lazy val baseScalacOptions = Seq( @@ -131,7 +131,7 @@ object Util { def excludePomArtifact(artifactId: String) = (artifactId startsWith "compiler-bridge") - val testExclusive = tags in test += ((ExclusiveTest, 1)) + val testExclusive = test / tags += (ExclusiveTest, 1) // TODO: replace with Tags.exclusive after 0.12.0 val testExclusiveRestriction = Tags.customLimit { (tags: Map[Tags.Tag, Int]) => @@ -184,9 +184,9 @@ object Licensed { def settings: Seq[Setting[_]] = Seq( notice := (baseDirectory.value / "NOTICE"), - unmanagedResources in Compile ++= notice.value +: extractLicenses.value, + Compile / unmanagedResources ++= notice.value +: extractLicenses.value, extractLicenses := extractLicenses0( - (baseDirectory in ThisBuild).value, + (ThisBuild / baseDirectory).value, notice.value, streams.value ) diff --git a/project/build.properties b/project/build.properties index dbae93bcf..f0be67b9f 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.4.9 +sbt.version=1.5.1 diff --git a/project/plugins.sbt b/project/plugins.sbt index 6fd8635fe..245e11f02 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -9,5 +9,5 @@ addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.5.1") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "3.0.2") addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.14") addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9") -addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.6.1") +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.8.1") addSbtPlugin("com.swoval" % "sbt-java-format" % "0.3.1")