Merge branch 'develop' into remote-cache

This commit is contained in:
Amina Adewusi 2021-06-18 20:13:55 +01:00 committed by GitHub
commit 24bb4de35e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 480 additions and 342 deletions

View File

@ -40,9 +40,9 @@ jobs:
env: env:
JAVA_OPTS: -Xms800M -Xmx2G -Xss6M -XX:ReservedCodeCacheSize=128M -server -Dsbt.io.virtual=false -Dfile.encoding=UTF-8 JAVA_OPTS: -Xms800M -Xmx2G -Xss6M -XX:ReservedCodeCacheSize=128M -server -Dsbt.io.virtual=false -Dfile.encoding=UTF-8
JVM_OPTS: -Xms800M -Xmx2G -Xss6M -XX:ReservedCodeCacheSize=128M -server -Dsbt.io.virtual=false -Dfile.encoding=UTF-8 JVM_OPTS: -Xms800M -Xmx2G -Xss6M -XX:ReservedCodeCacheSize=128M -server -Dsbt.io.virtual=false -Dfile.encoding=UTF-8
SCALA_212: 2.12.13 SCALA_212: 2.12.14
SCALA_213: 2.13.3 SCALA_213: 2.13.6
UTIL_TESTS: utilCache/test;utilControl/test;utilInterface/test;utilLogging/test;utilPosition/test;utilRelation/test;utilScripted/test;utilTracking/test UTIL_TESTS: "utilCache/test utilControl/test utilInterface/test utilLogging/test utilPosition/test utilRelation/test utilScripted/test utilTracking/test"
SBT_LOCAL: false SBT_LOCAL: false
TEST_SBT_VER: 1.5.0 TEST_SBT_VER: 1.5.0
SBT_ETC_FILE: $HOME/etc/sbt/sbtopts SBT_ETC_FILE: $HOME/etc/sbt/sbtopts
@ -70,7 +70,7 @@ jobs:
ref: develop ref: develop
path: zinc path: zinc
- name: Setup - name: Setup
uses: olafurpg/setup-scala@v10 uses: olafurpg/setup-scala@v12
with: with:
java-version: "adopt@1.${{ matrix.java }}" java-version: "adopt@1.${{ matrix.java }}"
- name: Set up Python 3.7 - name: Set up Python 3.7
@ -80,7 +80,7 @@ jobs:
- name: Coursier cache - name: Coursier cache
uses: coursier/cache-action@v6 uses: coursier/cache-action@v6
- name: Cache sbt - name: Cache sbt
uses: actions/cache@v2.1.5 uses: actions/cache@v2.1.6
with: with:
path: ~/.sbt path: ~/.sbt
key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
@ -90,7 +90,23 @@ jobs:
rm -rf "$HOME/.sbt/scripted/" || true rm -rf "$HOME/.sbt/scripted/" || true
case ${{ matrix.jobtype }} in case ${{ matrix.jobtype }} in
1) 1)
./sbt -v "mimaReportBinaryIssues ; javafmtCheck ; Test / javafmtCheck; scalafmtCheckAll ; scalafmtSbtCheck; serverTestProj/scalafmtCheckAll; headerCheck ;test:headerCheck ;whitesourceOnPush ;test:compile; publishLocal; test; serverTestProj/test; doc; $UTIL_TESTS; ++$SCALA_213; $UTIL_TESTS" ./sbt -v --client mimaReportBinaryIssues
./sbt -v --client javafmtCheck
./sbt -v --client "Test/javafmtCheck"
./sbt -v --client scalafmtCheckAll
./sbt -v --client scalafmtSbtCheck
./sbt -v --client serverTestProj/scalafmtCheckAll
./sbt -v --client headerCheck
./sbt -v --client "Test/headerCheck"
./sbt -v --client whitesourceOnPush
./sbt -v --client "Test/compile"
./sbt -v --client publishLocal
./sbt -v --client test
./sbt -v --client "serverTestProj/test"
./sbt -v --client doc
./sbt -v --client "all $UTIL_TESTS"
./sbt -v --client ++$SCALA_213
./sbt -v --client "all $UTIL_TESTS"
;; ;;
2) 2)
./sbt -v "scripted actions/* apiinfo/* compiler-project/* ivy-deps-management/* reporter/* tests/* watch/* classloader-cache/* package/*" ./sbt -v "scripted actions/* apiinfo/* compiler-project/* ivy-deps-management/* reporter/* tests/* watch/* classloader-cache/* package/*"
@ -112,7 +128,7 @@ jobs:
cd ../ cd ../
sbt -Dsbtlm.path=$HOME/work/sbt/sbt/librarymanagement -Dsbtzinc.path=$HOME/work/sbt/sbt/zinc -Dsbt.build.version=$BUILD_VERSION -Dsbt.build.fatal=false "+lowerUtils/publishLocal; {librarymanagement}/publishLocal; {zinc}/publishLocal; upperModules/publishLocal" sbt -Dsbtlm.path=$HOME/work/sbt/sbt/librarymanagement -Dsbtzinc.path=$HOME/work/sbt/sbt/zinc -Dsbt.build.version=$BUILD_VERSION -Dsbt.build.fatal=false "+lowerUtils/publishLocal; {librarymanagement}/publishLocal; {zinc}/publishLocal; upperModules/publishLocal"
rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true
sbt -v -Dsbt.version=$BUILD_VERSION "++$SCALA_213; $UTIL_TESTS; ++$SCALA_212; $UTIL_TESTS; scripted actions/* source-dependencies/*1of3 dependency-management/*1of4 java/*" sbt -v -Dsbt.version=$BUILD_VERSION "++$SCALA_213; all $UTIL_TESTS; ++$SCALA_212; all $UTIL_TESTS; scripted actions/* source-dependencies/*1of3 dependency-management/*1of4 java/*"
;; ;;
7) 7)
# test launcher script # test launcher script

View File

@ -36,7 +36,7 @@ jobs:
ref: develop ref: develop
path: zinc path: zinc
- name: Setup - name: Setup
uses: olafurpg/setup-scala@v10 uses: olafurpg/setup-scala@v12
with: with:
java-version: "adopt@1.${{ matrix.java }}" java-version: "adopt@1.${{ matrix.java }}"
- name: Coursier cache - name: Coursier cache

View File

@ -1,6 +1,10 @@
Developer guide Developer guide
=============== ===============
### Getting started
Create a [fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) of the repository and [clone](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository) it to create a local copy.
### Branch to work against ### Branch to work against
sbt uses two branches for development: sbt uses two branches for development:
@ -8,10 +12,13 @@ sbt uses two branches for development:
- Development branch: `develop` (this is also called "master") - Development branch: `develop` (this is also called "master")
- Stable branch: `1.$MINOR.x`, where `$MINOR` is current minor version (e.g. `1.1.x` during 1.1.x series) - Stable branch: `1.$MINOR.x`, where `$MINOR` is current minor version (e.g. `1.1.x` during 1.1.x series)
The `develop` branch represents the next major version of sbt. Only new features are pushed to the `develop` branch. This is the branch that you will branch off of to make your changes.
The `stable` branch represents the current stable sbt release. Only bug fixes are back-ported to the stable branch.
### Instruction to build just sbt ### Instruction to build just sbt
If the change you are making is contained in sbt/sbt, you could publishLocal on sbt/sbt: Sbt has a number of sub-modules. If the change you are making is just contained in sbt/sbt (not one of the sub-modules),
you can use the `publishLocal` command to publish the sbt project to your local machine. This is helpful for testing your changes.
``` ```
$ sbt $ sbt
@ -20,6 +27,9 @@ sbt:sbtRoot> publishLocal
### Instruction to build all modules from source ### Instruction to build all modules from source
When working on a change that requires changing one or more sub modules, the source code for these modules can be pulled in by running the following script
(instead of building them from Maven for example and not being able to change the source code for these sub-modules).
1. Install the current stable binary release of sbt (see [Setup]), which will be used to build sbt from source. 1. Install the current stable binary release of sbt (see [Setup]), which will be used to build sbt from source.
2. Get the source code. 2. Get the source code.
@ -42,7 +52,7 @@ sbt:sbtRoot> publishLocal
### Using the locally built sbt ### Using the locally built sbt
The `publishLocal` above will build and publish version `1.$MINOR.$PATCH-SNAPSHOT` (e.g. 1.1.2-SNAPSHOT) to your local ivy repository. The `publishLocal` command above will build and publish version `1.$MINOR.$PATCH-SNAPSHOT` (e.g. 1.1.2-SNAPSHOT) to your local ivy repository.
To use the locally built sbt, set the version in `build.properties` file in your project to `1.$MINOR.$PATCH-SNAPSHOT` then launch `sbt` (this can be the `sbt` launcher installed in your machine). To use the locally built sbt, set the version in `build.properties` file in your project to `1.$MINOR.$PATCH-SNAPSHOT` then launch `sbt` (this can be the `sbt` launcher installed in your machine).
@ -54,6 +64,8 @@ $ sbt
### Nightly builds ### Nightly builds
_Note: The following section may require an update._
The latest development versions are available as nightly builds on sbt-maven-snapshots (<https://repo.scala-sbt.org/scalasbt/maven-snapshots>) repo, which is a redirect proxy whose underlying repository is subject to change it could be Bintray, Linux box, etc. The latest development versions are available as nightly builds on sbt-maven-snapshots (<https://repo.scala-sbt.org/scalasbt/maven-snapshots>) repo, which is a redirect proxy whose underlying repository is subject to change it could be Bintray, Linux box, etc.
To use a nightly build: To use a nightly build:
@ -75,9 +87,16 @@ If you're overriding the repositories via `~/.sbt/repositories`, make sure that
### Clearing out boot and local cache ### Clearing out boot and local cache
When you run a locally built sbt, the JAR artifacts will be now cached under `$HOME/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.$MINOR.$PATCH-SNAPSHOT` directory. To clear this out run: `reboot dev` command from sbt's session of your test application. sbt consists of lots of JAR files. When running sbt locally, these JAR artifacts are cached in the `boot` directory under `$HOME/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.$MINOR.$PATCH-SNAPSHOT` directory.
One drawback of `-SNAPSHOT` version is that it's slow to resolve as it tries to hit all the resolvers. You can workaround that by using a version name like `1.$MINOR.$PATCH-LOCAL1`. A non-SNAPSHOT artifacts will now be cached under `$HOME/.ivy/cache/` directory, so you need to clear that out using [sbt-dirty-money](https://github.com/sbt/sbt-dirty-money)'s `cleanCache` task. In order to see a change you've made to sbt's source code, this cache should be cleared. To clear this out run: `reboot dev` command from sbt's session of your test application.
By default sbt uses a snapshot version (this is a scala convention for quick local changes- it tells users that this version could change).
One drawback of `-SNAPSHOT` version is that it's slow to resolve as it tries to hit all the resolvers.
This is important when testing perfomance, so that the slowness of the resolution does not impact sbt.
You can workaround that by using a version name like `1.$MINOR.$PATCH-LOCAL1`.
A non-SNAPSHOT artifacts will now be cached under `$HOME/.ivy/cache/` directory, so you need to clear that out using [sbt-dirty-money](https://github.com/sbt/sbt-dirty-money)'s `cleanCache` task.
### Running sbt "from source" - `sbtOn` ### Running sbt "from source" - `sbtOn`

106
build.sbt
View File

@ -10,7 +10,7 @@ import scala.util.Try
// ThisBuild settings take lower precedence, // ThisBuild settings take lower precedence,
// but can be shared across the multi projects. // but can be shared across the multi projects.
ThisBuild / version := { ThisBuild / version := {
val v = "1.5.2-SNAPSHOT" val v = "1.5.5-SNAPSHOT"
nightlyVersion.getOrElse(v) nightlyVersion.getOrElse(v)
} }
ThisBuild / version2_13 := "2.0.0-SNAPSHOT" ThisBuild / version2_13 := "2.0.0-SNAPSHOT"
@ -45,7 +45,7 @@ ThisBuild / scmInfo := Some(
ThisBuild / resolvers += Resolver.mavenLocal ThisBuild / resolvers += Resolver.mavenLocal
Global / semanticdbEnabled := !(Global / insideCI).value Global / semanticdbEnabled := !(Global / insideCI).value
Global / semanticdbVersion := "4.4.10" Global / semanticdbVersion := "4.4.20"
val excludeLint = SettingKey[Set[Def.KeyedInitialize[_]]]("excludeLintKeys") val excludeLint = SettingKey[Set[Def.KeyedInitialize[_]]]("excludeLintKeys")
Global / excludeLint := (Global / excludeLint).?.value.getOrElse(Set.empty) Global / excludeLint := (Global / excludeLint).?.value.getOrElse(Set.empty)
Global / excludeLint += componentID Global / excludeLint += componentID
@ -73,21 +73,23 @@ def commonBaseSettings: Seq[Setting[_]] = Def.settings(
)(Resolver.ivyStylePatterns), )(Resolver.ivyStylePatterns),
testFrameworks += TestFramework("hedgehog.sbt.Framework"), testFrameworks += TestFramework("hedgehog.sbt.Framework"),
testFrameworks += TestFramework("verify.runner.Framework"), testFrameworks += TestFramework("verify.runner.Framework"),
concurrentRestrictions in Global += Util.testExclusiveRestriction, Global / concurrentRestrictions += Util.testExclusiveRestriction,
testOptions in Test += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
testOptions in Test += Tests.Argument(TestFrameworks.ScalaCheck, "-verbosity", "2"), Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-verbosity", "2"),
javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"), compile / javacOptions ++= Seq("-Xlint", "-Xlint:-serial"),
/*
Compile / doc / scalacOptions ++= { Compile / doc / scalacOptions ++= {
import scala.sys.process._ import scala.sys.process._
val devnull = ProcessLogger(_ => ()) val devnull = ProcessLogger(_ => ())
val tagOrSha = ("git describe --exact-match" #|| "git rev-parse HEAD").lineStream(devnull).head val tagOrSha = ("git describe --exact-match" #|| "git rev-parse HEAD").lineStream(devnull).head
Seq( Seq(
"-sourcepath", "-sourcepath",
(baseDirectory in LocalRootProject).value.getAbsolutePath, (LocalRootProject / baseDirectory).value.getAbsolutePath,
"-doc-source-url", "-doc-source-url",
s"https://github.com/sbt/sbt/tree/$tagOrSha€{FILE_PATH}.scala" s"https://github.com/sbt/sbt/tree/$tagOrSha€{FILE_PATH}.scala"
) )
}, },
*/
Compile / javafmtOnCompile := Def Compile / javafmtOnCompile := Def
.taskDyn(if ((scalafmtOnCompile).value) Compile / javafmt else Def.task(())) .taskDyn(if ((scalafmtOnCompile).value) Compile / javafmt else Def.task(()))
.value, .value,
@ -99,8 +101,8 @@ def commonBaseSettings: Seq[Setting[_]] = Def.settings(
Test / unmanagedSources / inputFileStamps := Test / unmanagedSources / inputFileStamps :=
(Test / unmanagedSources / inputFileStamps).dependsOn(Test / javafmtOnCompile).value, (Test / unmanagedSources / inputFileStamps).dependsOn(Test / javafmtOnCompile).value,
crossScalaVersions := List(scala212, scala213), crossScalaVersions := List(scala212, scala213),
publishArtifact in Test := false, Test / publishArtifact := false,
fork in run := true, run / fork := true,
) )
def commonSettings: Seq[Setting[_]] = def commonSettings: Seq[Setting[_]] =
commonBaseSettings :+ commonBaseSettings :+
@ -118,7 +120,12 @@ def baseSettings: Seq[Setting[_]] =
def testedBaseSettings: Seq[Setting[_]] = def testedBaseSettings: Seq[Setting[_]] =
baseSettings ++ testDependencies baseSettings ++ testDependencies
val sbt13Plus = Seq("1.3.0") val sbt13Plus =
Seq(
"1.3.0",
"1.4.0",
"1.5.0",
)
val sbt10Plus = val sbt10Plus =
Seq( Seq(
"1.0.0", "1.0.0",
@ -191,8 +198,8 @@ lazy val sbtRoot: Project = (project in file("."))
Transform.conscriptSettings(bundledLauncherProj), Transform.conscriptSettings(bundledLauncherProj),
publish := {}, publish := {},
publishLocal := {}, publishLocal := {},
skip in publish := true, publish / skip := true,
commands in Global += Command Global / commands += Command
.single("sbtOn")((state, dir) => s"sbtProj/test:runMain sbt.RunFromSourceMain $dir" :: state), .single("sbtOn")((state, dir) => s"sbtProj/test:runMain sbt.RunFromSourceMain $dir" :: state),
mimaSettings, mimaSettings,
mimaPreviousArtifacts := Set.empty, mimaPreviousArtifacts := Set.empty,
@ -232,7 +239,7 @@ lazy val bundledLauncherProj =
description := "sbt application launcher", description := "sbt application launcher",
autoScalaLibrary := false, autoScalaLibrary := false,
crossPaths := false, crossPaths := false,
packageBin in Compile := sbtLaunchJar.value, Compile / packageBin := sbtLaunchJar.value,
mimaSettings, mimaSettings,
mimaPreviousArtifacts := Set() mimaPreviousArtifacts := Set()
) )
@ -369,11 +376,11 @@ lazy val utilLogging = (project in file("internal") / "util-logging")
case v if v.startsWith("2.12.") => List("-Ywarn-unused:-locals,-explicits,-privates") case v if v.startsWith("2.12.") => List("-Ywarn-unused:-locals,-explicits,-privates")
case _ => List() case _ => List()
}), }),
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala", Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
managedSourceDirectories in Compile += Compile / managedSourceDirectories +=
baseDirectory.value / "src" / "main" / "contraband-scala", baseDirectory.value / "src" / "main" / "contraband-scala",
contrabandFormatsForType in generateContrabands in Compile := { tpe => Compile / generateContrabands / contrabandFormatsForType := { tpe =>
val old = (contrabandFormatsForType in generateContrabands in Compile).value val old = (Compile / generateContrabands / contrabandFormatsForType).value
val name = tpe.removeTypeParameters.name val name = tpe.removeTypeParameters.name
if (name == "Throwable") Nil if (name == "Throwable") Nil
else old(tpe) else old(tpe)
@ -407,6 +414,7 @@ lazy val utilLogging = (project in file("internal") / "util-logging")
exclude[IncompatibleSignatureProblem]("sbt.internal.util.MainAppender*"), exclude[IncompatibleSignatureProblem]("sbt.internal.util.MainAppender*"),
exclude[MissingTypesProblem]("sbt.internal.util.ConsoleAppender"), exclude[MissingTypesProblem]("sbt.internal.util.ConsoleAppender"),
exclude[MissingTypesProblem]("sbt.internal.util.BufferedAppender"), exclude[MissingTypesProblem]("sbt.internal.util.BufferedAppender"),
exclude[MissingClassProblem]("sbt.internal.util.Terminal$BlockingInputStream$"),
), ),
) )
.configure(addSbtIO) .configure(addSbtIO)
@ -475,10 +483,10 @@ lazy val testingProj = (project in file("testing"))
sjsonNewScalaJson.value sjsonNewScalaJson.value
), ),
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates", Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
managedSourceDirectories in Compile += Compile / managedSourceDirectories +=
baseDirectory.value / "src" / "main" / "contraband-scala", 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",
contrabandFormatsForType in generateContrabands in Compile := ContrabandConfig.getFormats, Compile / generateContrabands / contrabandFormatsForType := ContrabandConfig.getFormats,
mimaSettings, mimaSettings,
mimaBinaryIssueFilters ++= Seq( mimaBinaryIssueFilters ++= Seq(
// private[sbt] // private[sbt]
@ -559,6 +567,7 @@ lazy val stdTaskProj = (project in file("tasks-standard"))
mimaBinaryIssueFilters ++= Seq( mimaBinaryIssueFilters ++= Seq(
// unused private[sbt] // unused private[sbt]
exclude[DirectMissingMethodProblem]("sbt.Task.mapTask"), exclude[DirectMissingMethodProblem]("sbt.Task.mapTask"),
exclude[NewMixinForwarderProblem]("sbt.std.TaskExtra.joinAnyTasks"),
), ),
) )
.configure(addSbtIO) .configure(addSbtIO)
@ -571,9 +580,9 @@ lazy val runProj = (project in file("run"))
testedBaseSettings, testedBaseSettings,
name := "Run", name := "Run",
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates", Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
managedSourceDirectories in Compile += Compile / managedSourceDirectories +=
baseDirectory.value / "src" / "main" / "contraband-scala", 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, mimaSettings,
mimaBinaryIssueFilters ++= Seq( mimaBinaryIssueFilters ++= Seq(
// copy method was never meant to be public // copy method was never meant to be public
@ -668,6 +677,7 @@ lazy val actionsProj = (project in file("main-actions"))
exclude[DirectMissingMethodProblem]("sbt.Doc.generate"), exclude[DirectMissingMethodProblem]("sbt.Doc.generate"),
exclude[DirectMissingMethodProblem]("sbt.compiler.Eval.filesModifiedBytes"), exclude[DirectMissingMethodProblem]("sbt.compiler.Eval.filesModifiedBytes"),
exclude[DirectMissingMethodProblem]("sbt.compiler.Eval.fileModifiedBytes"), exclude[DirectMissingMethodProblem]("sbt.compiler.Eval.fileModifiedBytes"),
exclude[DirectMissingMethodProblem]("sbt.Doc.$init$"),
), ),
) )
.configure( .configure(
@ -687,10 +697,10 @@ lazy val protocolProj = (project in file("protocol"))
name := "Protocol", name := "Protocol",
libraryDependencies ++= Seq(sjsonNewScalaJson.value, ipcSocket), libraryDependencies ++= Seq(sjsonNewScalaJson.value, ipcSocket),
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates", Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
managedSourceDirectories in Compile += Compile / managedSourceDirectories +=
baseDirectory.value / "src" / "main" / "contraband-scala", 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",
contrabandFormatsForType in generateContrabands in Compile := ContrabandConfig.getFormats, Compile / generateContrabands / contrabandFormatsForType := ContrabandConfig.getFormats,
mimaSettings, mimaSettings,
mimaBinaryIssueFilters ++= Seq( mimaBinaryIssueFilters ++= Seq(
// copy method was never meant to be public // copy method was never meant to be public
@ -729,10 +739,10 @@ lazy val commandProj = (project in file("main-command"))
name := "Command", name := "Command",
libraryDependencies ++= Seq(launcherInterface, sjsonNewScalaJson.value, templateResolverApi), libraryDependencies ++= Seq(launcherInterface, sjsonNewScalaJson.value, templateResolverApi),
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates", Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
managedSourceDirectories in Compile += Compile / managedSourceDirectories +=
baseDirectory.value / "src" / "main" / "contraband-scala", 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",
contrabandFormatsForType in generateContrabands in Compile := ContrabandConfig.getFormats, Compile / generateContrabands / contrabandFormatsForType := ContrabandConfig.getFormats,
mimaSettings, mimaSettings,
mimaBinaryIssueFilters ++= Vector( mimaBinaryIssueFilters ++= Vector(
exclude[DirectMissingMethodProblem]("sbt.Exit.apply"), exclude[DirectMissingMethodProblem]("sbt.Exit.apply"),
@ -766,8 +776,8 @@ lazy val commandProj = (project in file("main-command"))
exclude[MissingTypesProblem]("sbt.internal.server.ServerConnection*"), exclude[MissingTypesProblem]("sbt.internal.server.ServerConnection*"),
exclude[IncompatibleSignatureProblem]("sbt.internal.server.ServerConnection.*") exclude[IncompatibleSignatureProblem]("sbt.internal.server.ServerConnection.*")
), ),
unmanagedSources in (Compile, headerCreate) := { Compile / headerCreate / unmanagedSources := {
val old = (unmanagedSources in (Compile, headerCreate)).value val old = (Compile / headerCreate / unmanagedSources).value
old filterNot { x => old filterNot { x =>
(x.getName startsWith "NG") || (x.getName == "ReferenceCountedFileDescriptor.java") (x.getName startsWith "NG") || (x.getName == "ReferenceCountedFileDescriptor.java")
} }
@ -807,7 +817,7 @@ lazy val mainSettingsProj = (project in file("main-settings"))
.settings( .settings(
testedBaseSettings, testedBaseSettings,
name := "Main Settings", name := "Main Settings",
testOptions in Test ++= { Test / testOptions ++= {
val cp = (Test / fullClasspathAsJars).value.map(_.data).mkString(java.io.File.pathSeparator) val cp = (Test / fullClasspathAsJars).value.map(_.data).mkString(java.io.File.pathSeparator)
val framework = TestFrameworks.ScalaTest val framework = TestFrameworks.ScalaTest
Tests.Argument(framework, s"-Dsbt.server.classpath=$cp") :: Tests.Argument(framework, s"-Dsbt.server.classpath=$cp") ::
@ -861,7 +871,7 @@ lazy val zincLmIntegrationProj = (project in file("zinc-lm-integration"))
.settings( .settings(
name := "Zinc LM Integration", name := "Zinc LM Integration",
testedBaseSettings, testedBaseSettings,
testOptions in Test += Test / testOptions +=
Tests.Argument(TestFrameworks.ScalaTest, s"-Dsbt.zinc.version=$zincVersion"), Tests.Argument(TestFrameworks.ScalaTest, s"-Dsbt.zinc.version=$zincVersion"),
mimaSettingsSince(sbt13Plus), mimaSettingsSince(sbt13Plus),
mimaBinaryIssueFilters ++= Seq( mimaBinaryIssueFilters ++= Seq(
@ -903,10 +913,10 @@ lazy val mainProj = (project in file("main"))
case v if v.startsWith("2.12.") => List() case v if v.startsWith("2.12.") => List()
case _ => List(scalaPar) case _ => List(scalaPar)
}), }),
managedSourceDirectories in Compile += Compile / managedSourceDirectories +=
baseDirectory.value / "src" / "main" / "contraband-scala", 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",
testOptions in Test += Tests Test / testOptions += Tests
.Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"), .Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"),
SettingKey[Boolean]("usePipelining") := false, SettingKey[Boolean]("usePipelining") := false,
mimaSettings, mimaSettings,
@ -1025,6 +1035,10 @@ lazy val mainProj = (project in file("main"))
exclude[IncompatibleSignatureProblem]("sbt.internal.Act.taskAxis"), exclude[IncompatibleSignatureProblem]("sbt.internal.Act.taskAxis"),
// private[sbt] method, used to call the correct sourcePositionMapper // private[sbt] method, used to call the correct sourcePositionMapper
exclude[DirectMissingMethodProblem]("sbt.Defaults.foldMappers"), 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( .configure(
@ -1059,7 +1073,7 @@ lazy val sbtProj = (project in file("sbt-app"))
Test / run / connectInput := true, Test / run / connectInput := true,
Test / run / outputStrategy := Some(StdoutOutput), Test / run / outputStrategy := Some(StdoutOutput),
Test / run / fork := true, Test / run / fork := true,
testOptions in Test ++= { Test / testOptions ++= {
val cp = (Test / fullClasspathAsJars).value.map(_.data).mkString(java.io.File.pathSeparator) val cp = (Test / fullClasspathAsJars).value.map(_.data).mkString(java.io.File.pathSeparator)
val framework = TestFrameworks.ScalaTest val framework = TestFrameworks.ScalaTest
Tests.Argument(framework, s"-Dsbt.server.classpath=$cp") :: Tests.Argument(framework, s"-Dsbt.server.classpath=$cp") ::
@ -1302,6 +1316,8 @@ lazy val sbtIgnoredProblems = {
exclude[ReversedMissingMethodProblem]("sbt.Import.sbt$Import$_setter_$SemanticSelector_="), exclude[ReversedMissingMethodProblem]("sbt.Import.sbt$Import$_setter_$SemanticSelector_="),
// Dropped in favour of plain scala.Function, and its compose method // Dropped in favour of plain scala.Function, and its compose method
exclude[DirectMissingMethodProblem]("sbt.package.toFn1"), 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, bspEnabled := false,
crossPaths := false, crossPaths := false,
crossScalaVersions := Seq(baseScalaVersion), crossScalaVersions := Seq(baseScalaVersion),
skip in publish := true, publish / skip := true,
compile in Compile := { Compile / compile := {
val _ = update.value val _ = update.value
runNpm("run compile", baseDirectory.value, streams.value.log) runNpm("run compile", baseDirectory.value, streams.value.log)
sbt.internal.inc.Analysis.empty sbt.internal.inc.Analysis.empty
@ -1355,7 +1371,7 @@ def scriptedTask(launch: Boolean): Def.Initialize[InputTask[Unit]] = Def.inputTa
val _ = publishLocalBinAll.value val _ = publishLocalBinAll.value
val launchJar = s"-Dsbt.launch.jar=${(bundledLauncherProj / Compile / packageBin).value}" val launchJar = s"-Dsbt.launch.jar=${(bundledLauncherProj / Compile / packageBin).value}"
Scripted.doScripted( Scripted.doScripted(
(scalaInstance in scriptedSbtReduxProj).value, (scriptedSbtReduxProj / scalaInstance).value,
scriptedSource.value, scriptedSource.value,
scriptedBufferLog.value, scriptedBufferLog.value,
Def.setting(Scripted.scriptedParser(scriptedSource.value)).parsed, Def.setting(Scripted.scriptedParser(scriptedSource.value)).parsed,
@ -1421,9 +1437,9 @@ def otherRootSettings =
Seq( Seq(
scripted := scriptedTask(false).evaluated, scripted := scriptedTask(false).evaluated,
scriptedUnpublished := scriptedTask(false).evaluated, scriptedUnpublished := scriptedTask(false).evaluated,
scriptedSource := (sourceDirectory in sbtProj).value / "sbt-test", scriptedSource := (sbtProj / sourceDirectory).value / "sbt-test",
watchTriggers in scripted += scriptedSource.value.toGlob / **, scripted / watchTriggers += scriptedSource.value.toGlob / **,
watchTriggers in scriptedUnpublished := (watchTriggers in scripted).value, scriptedUnpublished / watchTriggers := (scripted / watchTriggers).value,
scriptedLaunchOpts := List("-Xmx1500M", "-Xms512M", "-server") ::: scriptedLaunchOpts := List("-Xmx1500M", "-Xms512M", "-server") :::
(sys.props.get("sbt.ivy.home") match { (sys.props.get("sbt.ivy.home") match {
case Some(home) => List(s"-Dsbt.ivy.home=$home") case Some(home) => List(s"-Dsbt.ivy.home=$home")
@ -1447,7 +1463,7 @@ def otherRootSettings =
}), }),
scripted := scriptedTask(true).evaluated, scripted := scriptedTask(true).evaluated,
scriptedUnpublished := 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 ::: (lmOpt map { case ProjectRef(build, _) => "{" + build.toString + "}/publishLocal" }).toList :::
(zincOpt map { (zincOpt map {
case ProjectRef(build, _) => case ProjectRef(build, _) =>
val zincSv = get(scalaVersion in ProjectRef(build, "zinc")) val zincSv = get((ProjectRef(build, "zinc") / scalaVersion))
val csv = get(crossScalaVersions in ProjectRef(build, "compilerBridge")).toList val csv = get((ProjectRef(build, "compilerBridge") / crossScalaVersions)).toList
(csv flatMap { bridgeSv => (csv flatMap { bridgeSv =>
s"++$bridgeSv" :: ("{" + build.toString + "}compilerBridge/publishLocal") :: Nil s"++$bridgeSv" :: ("{" + build.toString + "}compilerBridge/publishLocal") :: Nil
}) ::: }) :::

View File

@ -26,7 +26,7 @@ lazy val sbtVersionToRelease = sys.props.getOrElse("sbt.build.version", sys.env.
})) }))
lazy val scala210 = "2.10.7" lazy val scala210 = "2.10.7"
lazy val scala212 = "2.12.10" lazy val scala212 = "2.12.14"
lazy val scala210Jline = "org.scala-lang" % "jline" % scala210 lazy val scala210Jline = "org.scala-lang" % "jline" % scala210
lazy val jansi = { lazy val jansi = {
if (sbtVersionToRelease startsWith "1.") "org.fusesource.jansi" % "jansi" % "1.12" if (sbtVersionToRelease startsWith "1.") "org.fusesource.jansi" % "jansi" % "1.12"
@ -34,7 +34,7 @@ lazy val jansi = {
} }
lazy val scala212Compiler = "org.scala-lang" % "scala-compiler" % scala212 lazy val scala212Compiler = "org.scala-lang" % "scala-compiler" % scala212
lazy val scala212Jline = "jline" % "jline" % "2.14.6" lazy val scala212Jline = "jline" % "jline" % "2.14.6"
// use the scala-xml version used by the compiler not the latest: https://github.com/scala/scala/blob/v2.12.10/versions.properties#L22 // use the scala-xml version used by the compiler not the latest: https://github.com/scala/scala/blob/v2.12.14/versions.properties#L21
lazy val scala212Xml = "org.scala-lang.modules" % "scala-xml_2.12" % "1.0.6" lazy val scala212Xml = "org.scala-lang.modules" % "scala-xml_2.12" % "1.0.6"
lazy val sbtActual = "org.scala-sbt" % "sbt" % sbtVersionToRelease lazy val sbtActual = "org.scala-sbt" % "sbt" % sbtVersionToRelease
@ -118,6 +118,7 @@ val root = (project in file(".")).
// TODO - GPG Trust validation. // TODO - GPG Trust validation.
file file
}, },
// update sbt.sh at root
sbtnVersion := "1.4.7", sbtnVersion := "1.4.7",
sbtnJarsBaseUrl := "https://github.com/sbt/sbtn-dist/releases/download", sbtnJarsBaseUrl := "https://github.com/sbt/sbtn-dist/releases/download",
sbtnJarsMappings := { sbtnJarsMappings := {

View File

@ -210,6 +210,7 @@ $AliasCommand name=
def Client: String = "client" def Client: String = "client"
def ClientDetailed: String = def ClientDetailed: String =
"Provides an interactive prompt from which commands can be run on a server." "Provides an interactive prompt from which commands can be run on a server."
def JavaClient: String = "--java-client"
def DashClient: String = "-client" def DashClient: String = "-client"
def DashDashClient: String = "--client" def DashDashClient: String = "--client"
def DashDashDetachStdio: String = "--detach-stdio" def DashDashDetachStdio: String = "--detach-stdio"

View File

@ -67,15 +67,21 @@ public final class MetaBuildLoader extends URLClassLoader {
final String jlineJars = "jline-?[0-9.]+-sbt-.*|jline-terminal(-(jna|jansi))?-[0-9.]+"; final String jlineJars = "jline-?[0-9.]+-sbt-.*|jline-terminal(-(jna|jansi))?-[0-9.]+";
final String testInterfaceJars = "test-interface(-.*)?"; final String testInterfaceJars = "test-interface(-.*)?";
final String compilerInterfaceJars = "compiler-interface(-.*)?"; final String compilerInterfaceJars = "compiler-interface(-.*)?";
final String utilInterfaceJars = "util-interface(-.*)?";
final String jansiJars = "jansi-[0-9.]+"; final String jansiJars = "jansi-[0-9.]+";
final String jnaJars = "jna-(platform-)?[0-9.]+"; final String jnaJars = "jna-(platform-)?[0-9.]+";
final String fullPattern = final String fullPattern =
String.format( String.format(
"^(%s|%s|%s|%s|%s)\\.jar", "^(%s|%s|%s|%s|%s|%s)\\.jar",
jlineJars, testInterfaceJars, compilerInterfaceJars, jansiJars, jnaJars); jlineJars,
testInterfaceJars,
compilerInterfaceJars,
utilInterfaceJars,
jansiJars,
jnaJars);
final Pattern pattern = Pattern.compile(fullPattern); final Pattern pattern = Pattern.compile(fullPattern);
final File[] cp = appProvider.mainClasspath(); final File[] cp = appProvider.mainClasspath();
final URL[] interfaceURLs = new URL[2]; final URL[] interfaceURLs = new URL[3];
final URL[] jlineURLs = new URL[7]; final URL[] jlineURLs = new URL[7];
final File[] extra = final File[] extra =
appProvider.id().classpathExtra() == null ? new File[0] : appProvider.id().classpathExtra(); appProvider.id().classpathExtra() == null ? new File[0] : appProvider.id().classpathExtra();
@ -86,7 +92,9 @@ public final class MetaBuildLoader extends URLClassLoader {
int jlineIndex = 0; int jlineIndex = 0;
for (final File file : cp) { for (final File file : cp) {
final String name = file.getName(); final String name = file.getName();
if ((name.contains("test-interface") || name.contains("compiler-interface")) if ((name.contains("test-interface")
|| name.contains("compiler-interface")
|| name.contains("util-interface"))
&& pattern.matcher(name).find()) { && pattern.matcher(name).find()) {
interfaceURLs[interfaceIndex] = file.toURI().toURL(); interfaceURLs[interfaceIndex] = file.toURI().toURL();
interfaceIndex += 1; interfaceIndex += 1;

View File

@ -18,7 +18,13 @@ class SbtInterfaceLoader extends URLClassLoader {
@Override @Override
public String toString() { public String toString() {
return "SbtInterfaceClassLoader(" + getURLs()[0] + ")"; final StringBuilder builder = new StringBuilder();
URL[] urls = getURLs();
for (int i = 0; i < urls.length; ++i) {
builder.append(urls[i].toString());
if (i < urls.length - 2) builder.append(", ");
}
return "SbtInterfaceClassLoader(" + builder + ")";
} }
static { static {

View File

@ -35,7 +35,7 @@ import sbt.Scope.{ GlobalScope, ThisScope, fillTaskAxis }
import sbt.coursierint._ import sbt.coursierint._
import sbt.internal.CommandStrings.ExportStream import sbt.internal.CommandStrings.ExportStream
import sbt.internal._ import sbt.internal._
import sbt.internal.classpath.{ AlternativeZincUtil, ClassLoaderCache } import sbt.internal.classpath.AlternativeZincUtil
import sbt.internal.inc.JavaInterfaceUtil._ import sbt.internal.inc.JavaInterfaceUtil._
import sbt.internal.inc.classpath.{ ClasspathFilter, ClasspathUtil } import sbt.internal.inc.classpath.{ ClasspathFilter, ClasspathUtil }
import sbt.internal.inc.{ CompileOutput, MappedFileConverter, Stamps, ZincLmUtil, ZincUtil } import sbt.internal.inc.{ CompileOutput, MappedFileConverter, Stamps, ZincLmUtil, ZincUtil }
@ -745,7 +745,7 @@ object Defaults extends BuildCommon {
scalaSrcDir.getParentFile / s"${scalaSrcDir.name}-$sv", scalaSrcDir.getParentFile / s"${scalaSrcDir.name}-$sv",
scalaSrcDir.getParentFile / s"${scalaSrcDir.name}-$epochVersion", scalaSrcDir.getParentFile / s"${scalaSrcDir.name}-$epochVersion",
javaSrcDir, javaSrcDir,
) ).distinct
else else
Seq(scalaSrcDir, javaSrcDir) Seq(scalaSrcDir, javaSrcDir)
} }
@ -959,6 +959,13 @@ object Defaults extends BuildCommon {
Vector("-Ypickle-java", "-Ypickle-write", converter.toPath(earlyOutput.value).toString) ++ old Vector("-Ypickle-java", "-Ypickle-write", converter.toPath(earlyOutput.value).toString) ++ old
else old else old
}, },
scalacOptions := {
val old = scalacOptions.value
if (sbtPlugin.value && VersionNumber(scalaVersion.value)
.matchesSemVer(SemanticSelector("=2.12 >=2.12.13")))
old ++ Seq("-Wconf:cat=unused-nowarn:s")
else old
},
persistJarClasspath :== true, persistJarClasspath :== true,
classpathEntryDefinesClassVF := { classpathEntryDefinesClassVF := {
(if (persistJarClasspath.value) classpathDefinesClassCache.value (if (persistJarClasspath.value) classpathDefinesClassCache.value
@ -975,12 +982,17 @@ object Defaults extends BuildCommon {
selectMainClass := mainClass.value orElse askForMainClass(discoveredMainClasses.value), selectMainClass := mainClass.value orElse askForMainClass(discoveredMainClasses.value),
run / mainClass := (run / selectMainClass).value, run / mainClass := (run / selectMainClass).value,
mainClass := { mainClass := {
val logWarning = state.value.currentCommand val logWarning = state.value.currentCommand.forall(!_.commandLine.split(" ").exists {
.flatMap(_.commandLine.split(" ").headOption.map(_.trim)) case "run" | "runMain" => true
.fold(true) { case r =>
case "run" | "runMain" => false r.split("/") match {
case _ => true case Array(parts @ _*) =>
} parts.lastOption match {
case Some("run" | "runMain") => true
case _ => false
}
}
})
pickMainClassOrWarn(discoveredMainClasses.value, streams.value.log, logWarning) pickMainClassOrWarn(discoveredMainClasses.value, streams.value.log, logWarning)
}, },
runMain := foregroundRunMainTask.evaluated, runMain := foregroundRunMainTask.evaluated,
@ -1077,13 +1089,12 @@ object Defaults extends BuildCommon {
val libraryJars = allJars.filter(_.getName == "scala-library.jar") val libraryJars = allJars.filter(_.getName == "scala-library.jar")
allJars.filter(_.getName == "scala-compiler.jar") match { allJars.filter(_.getName == "scala-compiler.jar") match {
case Array(compilerJar) if libraryJars.nonEmpty => case Array(compilerJar) if libraryJars.nonEmpty =>
val cache = state.value.extendedClassLoaderCache makeScalaInstance(
mkScalaInstance(
version, version,
libraryJars, libraryJars,
allJars, allJars,
Seq.empty, Seq.empty,
cache, state.value,
scalaInstanceTopLoader.value scalaInstanceTopLoader.value
) )
case _ => ScalaInstance(version, scalaProvider) case _ => ScalaInstance(version, scalaProvider)
@ -1135,21 +1146,21 @@ object Defaults extends BuildCommon {
.flatMap(_.artifacts.map(_._2)) .flatMap(_.artifacts.map(_._2))
val libraryJars = ScalaArtifacts.libraryIds(sv).map(file) val libraryJars = ScalaArtifacts.libraryIds(sv).map(file)
mkScalaInstance( makeScalaInstance(
sv, sv,
libraryJars, libraryJars,
allCompilerJars, allCompilerJars,
allDocJars, allDocJars,
state.value.extendedClassLoaderCache, state.value,
scalaInstanceTopLoader.value, scalaInstanceTopLoader.value,
) )
} }
private[this] def mkScalaInstance( def makeScalaInstance(
version: String, version: String,
libraryJars: Array[File], libraryJars: Array[File],
allCompilerJars: Seq[File], allCompilerJars: Seq[File],
allDocJars: Seq[File], allDocJars: Seq[File],
classLoaderCache: ClassLoaderCache, state: State,
topLoader: ClassLoader, topLoader: ClassLoader,
): ScalaInstance = { ): ScalaInstance = {
// Scala 2.10 shades jline in the console so we need to make sure that it loads a compatible // Scala 2.10 shades jline in the console so we need to make sure that it loads a compatible
@ -1162,6 +1173,7 @@ object Defaults extends BuildCommon {
} }
else topLoader else topLoader
val classLoaderCache = state.extendedClassLoaderCache
val compilerJars = allCompilerJars.filterNot(libraryJars.contains).distinct.toArray val compilerJars = allCompilerJars.filterNot(libraryJars.contains).distinct.toArray
val docJars = allDocJars val docJars = allDocJars
.filterNot(jar => libraryJars.contains(jar) || compilerJars.contains(jar)) .filterNot(jar => libraryJars.contains(jar) || compilerJars.contains(jar))
@ -1170,12 +1182,7 @@ object Defaults extends BuildCommon {
val allJars = libraryJars ++ compilerJars ++ docJars val allJars = libraryJars ++ compilerJars ++ docJars
val libraryLoader = classLoaderCache(libraryJars.toList, jansiExclusionLoader) val libraryLoader = classLoaderCache(libraryJars.toList, jansiExclusionLoader)
val compilerLoader = classLoaderCache( val compilerLoader = classLoaderCache(compilerJars.toList, libraryLoader)
// It should be `compilerJars` but it would break on `3.0.0-M2` because of
// https://github.com/lampepfl/dotty/blob/d932af954ef187d7bdb87500d49ed0ff530bd1e7/sbt-bridge/src/xsbt/CompilerClassLoader.java#L108-L117
allCompilerJars.toList,
libraryLoader
)
val fullLoader = val fullLoader =
if (docJars.isEmpty) compilerLoader if (docJars.isEmpty) compilerLoader
else classLoaderCache(docJars.distinct.toList, compilerLoader) else classLoaderCache(docJars.distinct.toList, compilerLoader)
@ -1196,12 +1203,12 @@ object Defaults extends BuildCommon {
case a: AutoCloseable => a.close() case a: AutoCloseable => a.close()
case _ => case _ =>
} }
mkScalaInstance( makeScalaInstance(
dummy.version, dummy.version,
dummy.libraryJars, dummy.libraryJars,
dummy.compilerJars, dummy.compilerJars,
dummy.allJars, dummy.allJars,
state.value.extendedClassLoaderCache, state.value,
scalaInstanceTopLoader.value, scalaInstanceTopLoader.value,
) )
} }
@ -2107,7 +2114,11 @@ object Defaults extends BuildCommon {
val projectName = name.value val projectName = name.value
if (ScalaArtifacts.isScala3(sv)) { if (ScalaArtifacts.isScala3(sv)) {
val project = if (config == Compile) projectName else s"$projectName-$config" val project = if (config == Compile) projectName else s"$projectName-$config"
Seq("-project", project) if (scalaVersion.value.startsWith("3.0.0")) {
Seq("-project", project)
} else {
compileOptions ++ Seq("-project", project)
}
} else compileOptions } else compileOptions
}, },
(TaskZero / key) := { (TaskZero / key) := {

View File

@ -15,7 +15,7 @@ import java.util.Properties
import java.util.concurrent.ForkJoinPool import java.util.concurrent.ForkJoinPool
import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicBoolean
import sbt.BasicCommandStrings.{ Shell, Shutdown, TemplateCommand } import sbt.BasicCommandStrings.{ JavaClient, Shell, Shutdown, TemplateCommand }
import sbt.Project.LoadAction import sbt.Project.LoadAction
import sbt.compiler.EvalImports import sbt.compiler.EvalImports
import sbt.internal.Aggregation.AnyKeys import sbt.internal.Aggregation.AnyKeys
@ -23,22 +23,22 @@ import sbt.internal.CommandStrings.BootCommand
import sbt.internal._ import sbt.internal._
import sbt.internal.client.BspClient import sbt.internal.client.BspClient
import sbt.internal.inc.ScalaInstance import sbt.internal.inc.ScalaInstance
import sbt.internal.io.Retry
import sbt.internal.nio.{ CheckBuildSources, FileTreeRepository } import sbt.internal.nio.{ CheckBuildSources, FileTreeRepository }
import sbt.internal.server.{ BuildServerProtocol, NetworkChannel } import sbt.internal.server.{ BuildServerProtocol, NetworkChannel }
import sbt.internal.util.Types.{ const, idFun } import sbt.internal.util.Types.{ const, idFun }
import sbt.internal.util.{ Terminal => ITerminal, _ }
import sbt.internal.util.complete.{ Parser, SizeParser } import sbt.internal.util.complete.{ Parser, SizeParser }
import sbt.internal.util.{ Terminal => ITerminal, _ }
import sbt.io._ import sbt.io._
import sbt.io.syntax._ import sbt.io.syntax._
import sbt.util.{ Level, Logger, Show } import sbt.util.{ Level, Logger, Show }
import xsbti.AppProvider
import xsbti.compile.CompilerCache import xsbti.compile.CompilerCache
import scala.annotation.{ nowarn, tailrec } import scala.annotation.{ nowarn, tailrec }
import scala.concurrent.ExecutionContext import scala.concurrent.ExecutionContext
import scala.concurrent.duration.Duration import scala.concurrent.duration.Duration
import scala.util.control.NonFatal import scala.util.control.NonFatal
import sbt.internal.io.Retry
import xsbti.AppProvider
/** This class is the entry point for sbt. */ /** This class is the entry point for sbt. */
final class xMain extends xsbti.AppMain { final class xMain extends xsbti.AppMain {
@ -58,7 +58,7 @@ private[sbt] object xMain {
} }
private[sbt] def run(configuration: xsbti.AppConfiguration): xsbti.MainResult = { private[sbt] def run(configuration: xsbti.AppConfiguration): xsbti.MainResult = {
try { try {
import BasicCommandStrings.{ DashClient, DashDashClient, DashDashServer, runEarly } import BasicCommandStrings.{ DashDashClient, DashDashServer, runEarly }
import BasicCommands.early import BasicCommands.early
import BuiltinCommands.defaults import BuiltinCommands.defaults
import sbt.internal.CommandStrings.{ BootCommand, DefaultsCommand, InitCommand } import sbt.internal.CommandStrings.{ BootCommand, DefaultsCommand, InitCommand }
@ -69,24 +69,56 @@ private[sbt] object xMain {
val userCommands = configuration.arguments val userCommands = configuration.arguments
.map(_.trim) .map(_.trim)
.filterNot(_ == DashDashServer) .filterNot(_ == DashDashServer)
val isClient: String => Boolean = cmd => (cmd == DashClient) || (cmd == DashDashClient) val isClient: String => Boolean = cmd => (cmd == JavaClient) || (cmd == DashDashClient)
val isBsp: String => Boolean = cmd => (cmd == "-bsp") || (cmd == "--bsp") val isBsp: String => Boolean = cmd => (cmd == "-bsp") || (cmd == "--bsp")
val isServer = !userCommands.exists(c => isBsp(c) || isClient(c)) val isNew: String => Boolean = cmd => (cmd == "new")
val bootServerSocket = if (isServer) getSocketOrExit(configuration) match { lazy val isServer = !userCommands.exists(c => isBsp(c) || isClient(c))
// keep this lazy to prevent project directory created prematurely
lazy val bootServerSocket = if (isServer) getSocketOrExit(configuration) match {
case (_, Some(e)) => return e case (_, Some(e)) => return e
case (s, _) => s case (s, _) => s
} }
else None else None
if (userCommands.exists(isBsp)) { lazy val detachStdio = userCommands.exists(_ == BasicCommandStrings.DashDashDetachStdio)
BspClient.run(dealiasBaseDirectory(configuration)) def withStreams[A](f: => A): A =
} else { try {
bootServerSocket.foreach(l => ITerminal.setBootStreams(l.inputStream, l.outputStream)) bootServerSocket.foreach(l => ITerminal.setBootStreams(l.inputStream, l.outputStream))
val detachStdio = userCommands.exists(_ == BasicCommandStrings.DashDashDetachStdio) ITerminal.withStreams(true, isSubProcess = detachStdio) {
ITerminal.withStreams(true, isSubProcess = detachStdio) { f
if (clientModByEnv || userCommands.exists(isClient)) { }
} finally {
if (ITerminal.isAnsiSupported) {
// Clear any stray progress lines
System.out.print(ConsoleAppender.ClearScreenAfterCursor)
System.out.flush()
}
}
userCommands match {
case cmds if cmds.exists(isBsp) =>
BspClient.run(dealiasBaseDirectory(configuration))
case cmds if cmds.exists(isNew) =>
IO.withTemporaryDirectory { tempDir =>
val rebasedConfig = new xsbti.AppConfiguration {
override def arguments: Array[String] = configuration.arguments()
override val baseDirectory: File = tempDir / "new"
override def provider: AppProvider = configuration.provider()
}
val state = StandardMain
.initialState(
rebasedConfig,
Seq(defaults, early),
runEarly(DefaultsCommand) :: runEarly(InitCommand) :: BootCommand :: Nil
)
StandardMain.runManaged(state)
}
case _ if clientModByEnv || userCommands.exists(isClient) =>
withStreams {
val args = userCommands.toList.filterNot(isClient) val args = userCommands.toList.filterNot(isClient)
Exit(NetworkClient.run(dealiasBaseDirectory(configuration), args)) Exit(NetworkClient.run(dealiasBaseDirectory(configuration), args))
} else { }
case _ =>
withStreams {
val state0 = StandardMain val state0 = StandardMain
.initialState( .initialState(
dealiasBaseDirectory(configuration), dealiasBaseDirectory(configuration),
@ -101,15 +133,9 @@ private[sbt] object xMain {
try StandardMain.runManaged(state) try StandardMain.runManaged(state)
finally bootServerSocket.foreach(_.close()) finally bootServerSocket.foreach(_.close())
} }
}
} }
} finally { } finally {
// Clear any stray progress lines
ShutdownHooks.close() ShutdownHooks.close()
if (ITerminal.isAnsiSupported) {
System.out.print(ConsoleAppender.ClearScreenAfterCursor)
System.out.flush()
}
} }
} }

View File

@ -99,7 +99,7 @@ private[sbt] object PluginCross {
VersionNumber(sv) match { VersionNumber(sv) match {
case VersionNumber(Seq(0, 12, _*), _, _) => "2.9.2" case VersionNumber(Seq(0, 12, _*), _, _) => "2.9.2"
case VersionNumber(Seq(0, 13, _*), _, _) => "2.10.7" case VersionNumber(Seq(0, 13, _*), _, _) => "2.10.7"
case VersionNumber(Seq(1, 0, _*), _, _) => "2.12.13" case VersionNumber(Seq(1, 0, _*), _, _) => "2.12.14"
case _ => sys.error(s"Unsupported sbt binary version: $sv") case _ => sys.error(s"Unsupported sbt binary version: $sv")
} }
} }

View File

@ -33,30 +33,19 @@ private[sbt] object TemplateCommandUtil {
private def runTemplate(s0: State, inputArg: Seq[String]): State = { private def runTemplate(s0: State, inputArg: Seq[String]): State = {
import BuildPaths._ import BuildPaths._
val extracted0 = (Project extract s0)
val globalBase = getGlobalBase(s0) val globalBase = getGlobalBase(s0)
val stagingDirectory = getStagingDirectory(s0, globalBase).getCanonicalFile val infos = (s0 get templateResolverInfos getOrElse Nil).toList
val templateStage = stagingDirectory / "new" val log = s0.globalLogging.full
// This moves the target directory to a staging directory val extracted = (Project extract s0)
// https://github.com/sbt/sbt/issues/2835 val (s1, ivyConf) = extracted.runTask(Keys.ivyConfiguration, s0)
val state = extracted0.appendWithSession(
Seq(
Keys.target := templateStage
),
s0
)
val infos = (state get templateResolverInfos getOrElse Nil).toList
val log = state.globalLogging.full
val extracted = (Project extract state)
val (s2, ivyConf) = extracted.runTask(Keys.ivyConfiguration, state)
val scalaModuleInfo = extracted.get(Keys.updateSbtClassifiers / Keys.scalaModuleInfo) val scalaModuleInfo = extracted.get(Keys.updateSbtClassifiers / Keys.scalaModuleInfo)
val arguments = inputArg.toList ++ val arguments = inputArg.toList ++
(state.remainingCommands match { (s0.remainingCommands match {
case exec :: Nil if exec.commandLine == "shell" => Nil case exec :: Nil if exec.commandLine == "shell" => Nil
case xs => xs map (_.commandLine) case xs => xs map (_.commandLine)
}) })
run(infos, arguments, state.configuration, ivyConf, globalBase, scalaModuleInfo, log) run(infos, arguments, s0.configuration, ivyConf, globalBase, scalaModuleInfo, log)
TerminateAction :: s2.copy(remainingCommands = Nil) TerminateAction :: s1.copy(remainingCommands = Nil)
} }
private def run( private def run(

View File

@ -187,7 +187,8 @@ object RemoteCache {
val artp = artifactPath.value val artp = artifactPath.value
val af = compileAnalysisFile.value val af = compileAnalysisFile.value
IO.copyFile(original, artp) IO.copyFile(original, artp)
if (af.exists) { // skip zip manipulation if the artp is a blank file
if (af.exists && artp.length() > 0) {
JarUtils.includeInJar(artp, Vector(af -> s"META-INF/inc_compile.zip")) JarUtils.includeInJar(artp, Vector(af -> s"META-INF/inc_compile.zip"))
} }
val rf = getResourceFilePaths.value val rf = getResourceFilePaths.value

View File

@ -11,7 +11,6 @@ package server
import java.net.URI import java.net.URI
import sbt.BasicCommandStrings.Shutdown
import sbt.BuildSyntax._ import sbt.BuildSyntax._
import sbt.Def._ import sbt.Def._
import sbt.Keys._ import sbt.Keys._
@ -239,7 +238,7 @@ object BuildServerProtocol {
ServerHandler { callback => ServerHandler { callback =>
ServerIntent( ServerIntent(
onRequest = { onRequest = {
case r: JsonRpcRequestMessage if r.method == "build/initialize" => case r if r.method == "build/initialize" =>
val params = Converter.fromJson[InitializeBuildParams](json(r)).get val params = Converter.fromJson[InitializeBuildParams](json(r)).get
checkMetalsCompatibility(semanticdbEnabled, semanticdbVersion, params, callback.log) checkMetalsCompatibility(semanticdbEnabled, semanticdbVersion, params, callback.log)
@ -252,19 +251,16 @@ object BuildServerProtocol {
) )
callback.jsonRpcRespond(response, Some(r.id)); () callback.jsonRpcRespond(response, Some(r.id)); ()
case r: JsonRpcRequestMessage if r.method == "workspace/buildTargets" => case r if r.method == "workspace/buildTargets" =>
val _ = callback.appendExec(Keys.bspWorkspaceBuildTargets.key.toString, Some(r.id)) val _ = callback.appendExec(Keys.bspWorkspaceBuildTargets.key.toString, Some(r.id))
case r: JsonRpcRequestMessage if r.method == "workspace/reload" => case r if r.method == "workspace/reload" =>
val _ = callback.appendExec(s"$bspReload ${r.id}", Some(r.id)) val _ = callback.appendExec(s"$bspReload ${r.id}", Some(r.id))
case r: JsonRpcRequestMessage if r.method == "build/shutdown" => case r if r.method == "build/shutdown" =>
callback.jsonRpcRespond(JNull, Some(r.id)) callback.jsonRpcRespond(JNull, Some(r.id))
case r: JsonRpcRequestMessage if r.method == "build/exit" => case r if r.method == "buildTarget/sources" =>
val _ = callback.appendExec(Shutdown, Some(r.id))
case r: JsonRpcRequestMessage if r.method == "buildTarget/sources" =>
val param = Converter.fromJson[SourcesParams](json(r)).get val param = Converter.fromJson[SourcesParams](json(r)).get
val targets = param.targets.map(_.uri).mkString(" ") val targets = param.targets.map(_.uri).mkString(" ")
val command = Keys.bspBuildTargetSources.key val command = Keys.bspBuildTargetSources.key
@ -306,26 +302,29 @@ object BuildServerProtocol {
Some(r.id) Some(r.id)
) )
case r: JsonRpcRequestMessage if r.method == "buildTarget/scalacOptions" => case r if r.method == "buildTarget/scalacOptions" =>
val param = Converter.fromJson[ScalacOptionsParams](json(r)).get val param = Converter.fromJson[ScalacOptionsParams](json(r)).get
val targets = param.targets.map(_.uri).mkString(" ") val targets = param.targets.map(_.uri).mkString(" ")
val command = Keys.bspBuildTargetScalacOptions.key val command = Keys.bspBuildTargetScalacOptions.key
val _ = callback.appendExec(s"$command $targets", Some(r.id)) val _ = callback.appendExec(s"$command $targets", Some(r.id))
case r: JsonRpcRequestMessage if r.method == "buildTarget/scalaTestClasses" => case r if r.method == "buildTarget/scalaTestClasses" =>
val param = Converter.fromJson[ScalaTestClassesParams](json(r)).get val param = Converter.fromJson[ScalaTestClassesParams](json(r)).get
val targets = param.targets.map(_.uri).mkString(" ") val targets = param.targets.map(_.uri).mkString(" ")
val command = Keys.bspScalaTestClasses.key val command = Keys.bspScalaTestClasses.key
val _ = callback.appendExec(s"$command $targets", Some(r.id)) val _ = callback.appendExec(s"$command $targets", Some(r.id))
case r: JsonRpcRequestMessage if r.method == "buildTarget/scalaMainClasses" => case r if r.method == "buildTarget/scalaMainClasses" =>
val param = Converter.fromJson[ScalaMainClassesParams](json(r)).get val param = Converter.fromJson[ScalaMainClassesParams](json(r)).get
val targets = param.targets.map(_.uri).mkString(" ") val targets = param.targets.map(_.uri).mkString(" ")
val command = Keys.bspScalaMainClasses.key val command = Keys.bspScalaMainClasses.key
val _ = callback.appendExec(s"$command $targets", Some(r.id)) val _ = callback.appendExec(s"$command $targets", Some(r.id))
}, },
onResponse = PartialFunction.empty, onResponse = PartialFunction.empty,
onNotification = PartialFunction.empty, onNotification = {
case r if r.method == "build/exit" =>
val _ = callback.appendExec(BasicCommandStrings.TerminateAction, None)
},
) )
} }
} }

View File

@ -8,24 +8,13 @@
package sbt package sbt
package plugins package plugins
import Keys._ import sbt.Def.Setting
import Def.Setting import sbt.Keys._
import sbt.SlashSyntax0._
import sbt.librarymanagement.Configurations.Compile
import sbt.librarymanagement.{ SemanticSelector, VersionNumber }
object SbtPlugin extends AutoPlugin { object SbtPlugin extends AutoPlugin {
override def requires = ScriptedPlugin override def requires = ScriptedPlugin
override lazy val projectSettings: Seq[Setting[_]] = Seq( override lazy val projectSettings: Seq[Setting[_]] = Seq(
sbtPlugin := true, sbtPlugin := true
Compile / scalacOptions ++= {
// silence unused @nowarns in 2.12 because of https://github.com/sbt/sbt/issues/6398
// the option is only available since 2.12.13
if (VersionNumber(scalaVersion.value).matchesSemVer(SemanticSelector("=2.12 >=2.12.13")))
Some("-Wconf:cat=unused-nowarn:s")
else
None
}
) )
} }

View File

@ -26,7 +26,7 @@ object SemanticdbPlugin extends AutoPlugin {
semanticdbEnabled := SysProp.semanticdb, semanticdbEnabled := SysProp.semanticdb,
semanticdbIncludeInJar := false, semanticdbIncludeInJar := false,
semanticdbOptions := List(), semanticdbOptions := List(),
semanticdbVersion := "4.4.10" semanticdbVersion := "4.4.20"
) )
override lazy val projectSettings: Seq[Def.Setting[_]] = Seq( override lazy val projectSettings: Seq[Def.Setting[_]] = Seq(

View File

@ -4,29 +4,29 @@ import sbt.contraband.ContrabandPlugin.autoImport._
object Dependencies { object Dependencies {
// WARNING: Please Scala update versions in PluginCross.scala too // WARNING: Please Scala update versions in PluginCross.scala too
val scala212 = "2.12.13" val scala212 = "2.12.14"
val scala213 = "2.13.5" val scala213 = "2.13.6"
val checkPluginCross = settingKey[Unit]("Make sure scalaVersion match up") val checkPluginCross = settingKey[Unit]("Make sure scalaVersion match up")
val baseScalaVersion = scala212 val baseScalaVersion = scala212
def nightlyVersion: Option[String] = def nightlyVersion: Option[String] =
sys.env.get("BUILD_VERSION") orElse sys.props.get("sbt.build.version") sys.env.get("BUILD_VERSION") orElse sys.props.get("sbt.build.version")
// sbt modules // sbt modules
private val ioVersion = nightlyVersion.getOrElse("1.5.0") private val ioVersion = nightlyVersion.getOrElse("1.5.1")
private val lmVersion = private val lmVersion =
sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.5.0") sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.5.2")
val zincVersion = nightlyVersion.getOrElse("1.5.1") val zincVersion = nightlyVersion.getOrElse("1.5.5")
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
private val libraryManagementCore = "org.scala-sbt" %% "librarymanagement-core" % lmVersion private val libraryManagementCore = "org.scala-sbt" %% "librarymanagement-core" % lmVersion
private val libraryManagementIvy = "org.scala-sbt" %% "librarymanagement-ivy" % lmVersion private val libraryManagementIvy = "org.scala-sbt" %% "librarymanagement-ivy" % lmVersion
val launcherVersion = "1.3.1" val launcherVersion = "1.3.2"
val launcherInterface = "org.scala-sbt" % "launcher-interface" % launcherVersion val launcherInterface = "org.scala-sbt" % "launcher-interface" % launcherVersion
val rawLauncher = "org.scala-sbt" % "launcher" % launcherVersion val rawLauncher = "org.scala-sbt" % "launcher" % launcherVersion
val testInterface = "org.scala-sbt" % "test-interface" % "1.0" val testInterface = "org.scala-sbt" % "test-interface" % "1.0"
val ipcSocket = "org.scala-sbt.ipcsocket" % "ipcsocket" % "1.3.0" val ipcSocket = "org.scala-sbt.ipcsocket" % "ipcsocket" % "1.3.1"
private val compilerInterface = "org.scala-sbt" % "compiler-interface" % zincVersion private val compilerInterface = "org.scala-sbt" % "compiler-interface" % zincVersion
private val compilerClasspath = "org.scala-sbt" %% "zinc-classpath" % zincVersion private val compilerClasspath = "org.scala-sbt" %% "zinc-classpath" % zincVersion
@ -116,5 +116,5 @@ object Dependencies {
val hedgehog = "qa.hedgehog" %% "hedgehog-sbt" % "0.6.1" val hedgehog = "qa.hedgehog" %% "hedgehog-sbt" % "0.6.1"
val disruptor = "com.lmax" % "disruptor" % "3.4.2" val disruptor = "com.lmax" % "disruptor" % "3.4.2"
val kindProjector = ("org.typelevel" % "kind-projector" % "0.11.3").cross(CrossVersion.full) val kindProjector = ("org.typelevel" % "kind-projector" % "0.13.0").cross(CrossVersion.full)
} }

View File

@ -30,7 +30,7 @@ object HouseRulesPlugin extends AutoPlugin {
scalacOptions += "-Ywarn-value-discard", scalacOptions += "-Ywarn-value-discard",
scalacOptions ++= "-Ywarn-unused-import".ifScala(v => 11 <= v && v <= 12).value.toList scalacOptions ++= "-Ywarn-unused-import".ifScala(v => 11 <= v && v <= 12).value.toList
) ++ Seq(Compile, Test).flatMap( ) ++ 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) private def scalaPartV = Def setting (CrossVersion partialVersion scalaVersion.value)

View File

@ -27,8 +27,8 @@ object PublishBinPlugin extends AutoPlugin {
Classpaths.deliverPattern(crossTarget.value), Classpaths.deliverPattern(crossTarget.value),
if (isSnapshot.value) "integration" else "release", if (isSnapshot.value) "integration" else "release",
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector, ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
(packagedArtifacts in publishLocalBin).value.toVector, (publishLocalBin / packagedArtifacts).value.toVector,
(checksums in publishLocalBin).value.toVector, (publishLocalBin / checksums).value.toVector,
logging = ivyLoggingLevel.value, logging = ivyLoggingLevel.value,
overwrite = isSnapshot.value overwrite = isSnapshot.value
), ),
@ -59,9 +59,9 @@ object PublishBinPlugin extends AutoPlugin {
dummyFile dummyFile
}, },
dummyDoc / packagedArtifact := (Compile / packageDoc / artifact).value -> dummyDoc.value, dummyDoc / packagedArtifact := (Compile / packageDoc / artifact).value -> dummyDoc.value,
packagedArtifacts in publishLocalBin := publishLocalBin / packagedArtifacts :=
Classpaths Classpaths
.packaged(Seq(packageBin in Compile, packageSrc in Compile, makePom, dummyDoc)) .packaged(Seq(Compile / packageBin, Compile / packageSrc, makePom, dummyDoc))
.value .value
) )
} }

View File

@ -26,7 +26,7 @@ object SbtLauncherPlugin extends AutoPlugin {
} }
}, },
sbtLaunchJar := { sbtLaunchJar := {
val propFiles = (resources in Compile).value val propFiles = (Compile / resources).value
val propFileLocations = val propFileLocations =
for (file <- propFiles; if file.getName != "resources") yield { for (file <- propFiles; if file.getName != "resources") yield {
if (file.getName == "sbt.boot.properties") "sbt/sbt.boot.properties" -> file if (file.getName == "sbt.boot.properties") "sbt/sbt.boot.properties" -> file

View File

@ -22,7 +22,7 @@ object Util {
lazy val javaOnlySettings: Seq[Setting[_]] = Seq( lazy val javaOnlySettings: Seq[Setting[_]] = Seq(
// crossPaths := false, // crossPaths := false,
// compileOrder := CompileOrder.JavaThenScala, // compileOrder := CompileOrder.JavaThenScala,
unmanagedSourceDirectories in Compile := Seq((javaSource in Compile).value) Compile / unmanagedSourceDirectories := Seq((Compile / javaSource).value)
) )
lazy val baseScalacOptions = Seq( lazy val baseScalacOptions = Seq(
@ -131,7 +131,7 @@ object Util {
def excludePomArtifact(artifactId: String) = (artifactId startsWith "compiler-bridge") 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 // TODO: replace with Tags.exclusive after 0.12.0
val testExclusiveRestriction = Tags.customLimit { (tags: Map[Tags.Tag, Int]) => val testExclusiveRestriction = Tags.customLimit { (tags: Map[Tags.Tag, Int]) =>
@ -184,9 +184,9 @@ object Licensed {
def settings: Seq[Setting[_]] = Seq( def settings: Seq[Setting[_]] = Seq(
notice := (baseDirectory.value / "NOTICE"), notice := (baseDirectory.value / "NOTICE"),
unmanagedResources in Compile ++= notice.value +: extractLicenses.value, Compile / unmanagedResources ++= notice.value +: extractLicenses.value,
extractLicenses := extractLicenses0( extractLicenses := extractLicenses0(
(baseDirectory in ThisBuild).value, (ThisBuild / baseDirectory).value,
notice.value, notice.value,
streams.value streams.value
) )

View File

@ -1 +1 @@
sbt.version=1.4.9 sbt.version=1.5.4

View File

@ -9,5 +9,5 @@ addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.5.1")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "3.0.2") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "3.0.2")
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.14") addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.14")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9") 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") addSbtPlugin("com.swoval" % "sbt-java-format" % "0.3.1")

View File

@ -18,6 +18,7 @@ object BuildTargetTag {
def fromConfig(config: String): Vector[String] = config match { def fromConfig(config: String): Vector[String] = config match {
case "test" => Vector(test) case "test" => Vector(test)
case "it" => Vector(integrationTest)
case "compile" => Vector(library) case "compile" => Vector(library)
case _ => Vector.empty case _ => Vector.empty
} }

106
sbt
View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set +e set +e
declare builtin_sbt_version="1.5.1" declare builtin_sbt_version="1.5.4"
declare -a residual_args declare -a residual_args
declare -a java_args declare -a java_args
declare -a scalac_args declare -a scalac_args
@ -22,6 +22,7 @@ declare sbt_debug=
declare build_props_sbt_version= declare build_props_sbt_version=
declare use_sbtn= declare use_sbtn=
declare sbtn_command="$SBTN_CMD" declare sbtn_command="$SBTN_CMD"
declare sbtn_version="1.4.7"
### ------------------------------- ### ### ------------------------------- ###
### Helper methods for BASH scripts ### ### Helper methods for BASH scripts ###
@ -126,7 +127,8 @@ acquire_sbt_jar () {
launcher_sv="$builtin_sbt_version" launcher_sv="$builtin_sbt_version"
fi fi
fi fi
download_jar="$HOME/.cache/sbt/boot/sbt-launch/$launcher_sv/sbt-launch-$launcher_sv.jar" local user_home && user_home=$(findProperty user.home)
download_jar="${user_home:-$HOME}/.cache/sbt/boot/sbt-launch/$launcher_sv/sbt-launch-$launcher_sv.jar"
if [[ -f "$download_jar" ]]; then if [[ -f "$download_jar" ]]; then
sbt_jar="$download_jar" sbt_jar="$download_jar"
else else
@ -153,6 +155,42 @@ acquire_sbt_jar () {
fi fi
} }
acquire_sbtn () {
local sbtn_v="$1"
local user_home && user_home=$(findProperty user.home)
local p="${user_home:-$HOME}/.cache/sbt/boot/sbtn/$sbtn_v"
local target="$p/sbtn"
local archive_target=
local url=
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
archive_target="$p/sbtn-x86_64-pc-linux-${sbtn_v}.tar.gz"
url="https://github.com/sbt/sbtn-dist/releases/download/v${sbtn_v}/sbtn-x86_64-pc-linux-${sbtn_v}.tar.gz"
elif [[ "$OSTYPE" == "darwin"* ]]; then
archive_target="$p/sbtn-x86_64-apple-darwin-${sbtn_v}.tar.gz"
url="https://github.com/sbt/sbtn-dist/releases/download/v${sbtn_v}/sbtn-x86_64-apple-darwin-${sbtn_v}.tar.gz"
elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
target="$p/sbtn.exe"
archive_target="$p/sbtn-x86_64-pc-win32-${sbtn_v}.zip"
url="https://github.com/sbt/sbtn-dist/releases/download/v${sbtn_v}/sbtn-x86_64-pc-win32-${sbtn_v}.zip"
else
echoerr "sbtn is not supported on $OSTYPE"
exit 2
fi
if [[ -f "$target" ]]; then
sbtn_command="$target"
else
echoerr "downloading sbtn ${sbtn_v}"
download_url "$url" "$archive_target"
if [[ "$OSTYPE" == "linux-gnu"* ]] || [[ "$OSTYPE" == "darwin"* ]]; then
tar zxf "$archive_target" --directory "$p"
else
unzip "$archive_target" -d "$p"
fi
sbtn_command="$target"
fi
}
# execRunner should be called only once to give up control to java # execRunner should be called only once to give up control to java
execRunner () { execRunner () {
# print the arguments one to a line, quoting any containing spaces # print the arguments one to a line, quoting any containing spaces
@ -301,39 +339,49 @@ jdk_version() {
echo "$result" echo "$result"
} }
# Extracts the preloaded directory from either -Dsbt.preloaded or -Dsbt.global.base # Find the first occurrence of the given property name and returns its value by looking at:
# properties by looking at: # - properties set by command-line options,
# - _JAVA_OPTIONS environment variable, # - JAVA_OPTS environment variable,
# - SBT_OPTS environment variable, # - SBT_OPTS environment variable,
# - JAVA_OPTS environment variable and # - _JAVA_OPTIONS environment variable and
# - properties set by command-line options # - JAVA_TOOL_OPTIONS environment variable
# in that order. The last one will be chosen such that `sbt.preloaded` is # in that order.
# always preferred over `sbt.global.base`. findProperty() {
getPreloaded() {
local -a _java_options_array
local -a sbt_opts_array
local -a java_opts_array local -a java_opts_array
read -a _java_options_array <<< "$_JAVA_OPTIONS" local -a sbt_opts_array
read -a sbt_opts_array <<< "$SBT_OPTS" local -a _java_options_array
local -a java_tool_options_array
read -a java_opts_array <<< "$JAVA_OPTS" read -a java_opts_array <<< "$JAVA_OPTS"
read -a sbt_opts_array <<< "$SBT_OPTS"
read -a _java_options_array <<< "$_JAVA_OPTIONS"
read -a java_tool_options_array <<< "$JAVA_TOOL_OPTIONS"
local args_to_check=( local args_to_check=(
"${_java_options_array[@]}" "${java_args[@]}"
"${sbt_opts_array[@]}"
"${java_opts_array[@]}" "${java_opts_array[@]}"
"${java_args[@]}") "${sbt_opts_array[@]}"
local via_global_base="$HOME/.sbt/preloaded" "${_java_options_array[@]}"
local via_explicit="" "${java_tool_options_array[@]}")
for opt in "${args_to_check[@]}"; do for opt in "${args_to_check[@]}"; do
if [[ "$opt" == -Dsbt.preloaded=* ]]; then if [[ "$opt" == -D$1=* ]]; then
via_explicit="${opt#-Dsbt.preloaded=}" echo "${opt#-D$1=}"
elif [[ "$opt" == -Dsbt.global.base=* ]]; then return
via_global_base="${opt#-Dsbt.global.base=}/preloaded"
fi fi
done done
}
echo "${via_explicit:-${via_global_base}}" # Extracts the preloaded directory from either -Dsbt.preloaded, -Dsbt.global.base or -Duser.home
# in that order.
getPreloaded() {
local preloaded && preloaded=$(findProperty sbt.preloaded)
[ "$preloaded" ] && echo "$preloaded" && return
local global_base && global_base=$(findProperty sbt.global.base)
[ "$global_base" ] && echo "$global_base/preloaded" && return
local user_home && user_home=$(findProperty user.home)
echo "${user_home:-$HOME}/.sbt/preloaded"
} }
syncPreloaded() { syncPreloaded() {
@ -582,7 +630,7 @@ process_args () {
--numeric-version) print_sbt_version=1 && shift ;; --numeric-version) print_sbt_version=1 && shift ;;
--script-version) print_sbt_script_version=1 && shift ;; --script-version) print_sbt_script_version=1 && shift ;;
-d|-debug|--debug) sbt_debug=1 && addSbt "-debug" && shift ;; -d|-debug|--debug) sbt_debug=1 && addSbt "-debug" && shift ;;
--client) use_sbtn=1 && shift ;; -client|--client) use_sbtn=1 && shift ;;
--server) use_sbtn=0 && shift ;; --server) use_sbtn=0 && shift ;;
-mem|--mem) require_arg integer "$1" "$2" && addMemory "$2" && shift 2 ;; -mem|--mem) require_arg integer "$1" "$2" && addMemory "$2" && shift 2 ;;
@ -650,7 +698,7 @@ isRunNativeClient() {
sbtBinaryV_1=$(echo "$sbtV" | sed 's/^\([0-9]*\)\.\([0-9]*\).*$/\1/') sbtBinaryV_1=$(echo "$sbtV" | sed 's/^\([0-9]*\)\.\([0-9]*\).*$/\1/')
sbtBinaryV_2=$(echo "$sbtV" | sed 's/^\([0-9]*\)\.\([0-9]*\).*$/\2/') sbtBinaryV_2=$(echo "$sbtV" | sed 's/^\([0-9]*\)\.\([0-9]*\).*$/\2/')
if (( $sbtBinaryV_1 >= 2 )) || ( (( $sbtBinaryV_1 >= 1 )) && (( $sbtBinaryV_2 >= 4 )) ); then if (( $sbtBinaryV_1 >= 2 )) || ( (( $sbtBinaryV_1 >= 1 )) && (( $sbtBinaryV_2 >= 4 )) ); then
if [[ "$use_sbtn" == "1" ]] && [[ "$sbtn_command" != "" ]]; then if [[ "$use_sbtn" == "1" ]]; then
echo "true" echo "true"
else else
echo "false" echo "false"
@ -662,6 +710,10 @@ isRunNativeClient() {
runNativeClient() { runNativeClient() {
vlog "[debug] running native client" vlog "[debug] running native client"
detectNativeClient
[[ -f "$sbtn_command" ]] || acquire_sbtn "$sbtn_version" || {
exit 1
}
for i in "${!original_args[@]}"; do for i in "${!original_args[@]}"; do
if [[ "${original_args[i]}" = "--client" ]]; then if [[ "${original_args[i]}" = "--client" ]]; then
unset 'original_args[i]' unset 'original_args[i]'
@ -691,8 +743,6 @@ original_args=("$@")
[[ -f "$build_props_file" ]] && loadPropFile "$build_props_file" [[ -f "$build_props_file" ]] && loadPropFile "$build_props_file"
detectNativeClient
java_args=($JAVA_OPTS) java_args=($JAVA_OPTS)
sbt_options0=(${SBT_OPTS:-$default_sbt_opts}) sbt_options0=(${SBT_OPTS:-$default_sbt_opts})
if [[ "$SBT_NATIVE_CLIENT" == "true" ]]; then if [[ "$SBT_NATIVE_CLIENT" == "true" ]]; then

View File

@ -10,19 +10,19 @@ lazy val root = (project in file("."))
lazy val foo = project lazy val foo = project
.settings( .settings(
crossScalaVersions := Seq("2.12.13", "2.13.1"), crossScalaVersions := Seq("2.12.14", "2.13.1"),
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.0", libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.0",
check := { check := {
// This tests that +check will respect bar's crossScalaVersions and not switch // This tests that +check will respect bar's crossScalaVersions and not switch
val x = (LocalProject("bar") / scalaVersion).value val x = (LocalProject("bar") / scalaVersion).value
assert(x == "2.12.13", s"$x == 2.12.12") assert(x == "2.12.14", s"$x == 2.12.12")
(Compile / compile).value (Compile / compile).value
}, },
(Test / testOnly) := { (Test / testOnly) := {
// This tests that +testOnly will respect bar's crossScalaVersions and not switch // This tests that +testOnly will respect bar's crossScalaVersions and not switch
val x = (LocalProject("bar") / scalaVersion).value val x = (LocalProject("bar") / scalaVersion).value
assert(x == "2.12.13", s"$x == 2.12.12") assert(x == "2.12.14", s"$x == 2.12.12")
val _ = (Test / testOnly).evaluated val _ = (Test / testOnly).evaluated
}, },
compile2 := { compile2 := {
@ -35,7 +35,7 @@ lazy val foo = project
lazy val bar = project lazy val bar = project
.settings( .settings(
crossScalaVersions := Seq("2.12.13"), crossScalaVersions := Seq("2.12.14"),
check := (Compile / compile).value, check := (Compile / compile).value,
compile2 := (Compile / compile).value, compile2 := (Compile / compile).value,
) )
@ -46,14 +46,14 @@ lazy val baz = project
check := { check := {
// This tests that +baz/check will respect bar's crossScalaVersions and not switch // This tests that +baz/check will respect bar's crossScalaVersions and not switch
val x = (LocalProject("bar") / scalaVersion).value val x = (LocalProject("bar") / scalaVersion).value
assert(x == "2.12.13", s"$x == 2.12.13") assert(x == "2.12.14", s"$x == 2.12.14")
(Compile / compile).value (Compile / compile).value
}, },
) )
lazy val client = project lazy val client = project
.settings( .settings(
crossScalaVersions := Seq("2.12.13", "2.13.1"), crossScalaVersions := Seq("2.12.14", "2.13.1"),
check := (Compile / compile).value, check := (Compile / compile).value,
compile2 := (Compile / compile).value, compile2 := (Compile / compile).value,
) )

View File

@ -17,7 +17,7 @@
## test + with command or alias ## test + with command or alias
> clean > clean
## for command cross building you do need crossScalaVerions on root ## for command cross building you do need crossScalaVerions on root
> set root/crossScalaVersions := Seq("2.12.13", "2.13.1") > set root/crossScalaVersions := Seq("2.12.14", "2.13.1")
> + build > + build
$ exists foo/target/scala-2.12 $ exists foo/target/scala-2.12
$ exists foo/target/scala-2.13 $ exists foo/target/scala-2.13

View File

@ -1,6 +1,6 @@
import xsbti.compile.TastyFiles import xsbti.compile.TastyFiles
ThisBuild / scalaVersion := "3.0.0-M2" ThisBuild / scalaVersion := "3.0.0-M3"
TaskKey[Unit]("check") := { TaskKey[Unit]("check") := {
assert((Compile / auxiliaryClassFiles).value == Seq(TastyFiles.instance)) assert((Compile / auxiliaryClassFiles).value == Seq(TastyFiles.instance))

View File

@ -1,12 +1,12 @@
> check > check
> compile > compile
$ exists target/scala-3.0.0-M2/classes/A.tasty $ exists target/scala-3.0.0-M3/classes/A.tasty
$ exists target/scala-3.0.0-M2/classes/B.tasty $ exists target/scala-3.0.0-M3/classes/B.tasty
$ delete src/main/scala/B.scala $ delete src/main/scala/B.scala
> compile > compile
$ exists target/scala-3.0.0-M2/classes/A.tasty $ exists target/scala-3.0.0-M3/classes/A.tasty
-$ exists target/scala-3.0.0-M2/classes/B.tasty -$ exists target/scala-3.0.0-M3/classes/B.tasty

View File

@ -1,18 +1,11 @@
ThisBuild / useCoursier := false ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / scalaVersion := "2.13.5"
version := "0.1.0-SNAPSHOT"
organization := "default"
name := "whatDependsOn" name := "whatDependsOn"
scalaVersion := "2.9.1"
resolvers += "typesafe maven" at "https://repo.typesafe.com/typesafe/maven-releases/"
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"com.codahale" % "jerkson_2.9.1" % "0.5.0", "co.fs2" %% "fs2-core" % "1.0.4",
"org.codehaus.jackson" % "jackson-mapper-asl" % "1.9.10" // as another version of asl "org.typelevel" %% "cats-effect" % "3.1.0"
) )
val check = TaskKey[Unit]("check") val check = TaskKey[Unit]("check")
@ -23,36 +16,36 @@ check := {
require(sanitize(expected) == sanitize(output), s"Tree should have been [\n${sanitize(expected)}\n] but was [\n${sanitize(output)}\n]") require(sanitize(expected) == sanitize(output), s"Tree should have been [\n${sanitize(expected)}\n] but was [\n${sanitize(output)}\n]")
val withVersion = val withVersion =
(whatDependsOn in Compile) (Compile / whatDependsOn)
.toTask(" org.codehaus.jackson jackson-core-asl 1.9.11") .toTask(" org.typelevel cats-core_2.13 2.6.0")
.value .value
val expectedGraphWithVersion = val expectedGraphWithVersion = {
"""org.codehaus.jackson:jackson-core-asl:1.9.11 """org.typelevel:cats-core_2.13:2.6.0 [S]
| +-com.codahale:jerkson_2.9.1:0.5.0 [S] |+-org.typelevel:cats-effect-kernel_2.13:3.1.0 [S]
| | +-default:whatdependson_2.9.1:0.1.0-SNAPSHOT [S] |+-org.typelevel:cats-effect-std_2.13:3.1.0 [S]
| | || +-org.typelevel:cats-effect_2.13:3.1.0 [S]
| +-org.codehaus.jackson:jackson-mapper-asl:1.9.11 || +-whatdependson:whatdependson_2.13:0.1.0-SNAPSHOT [S]
| +-com.codahale:jerkson_2.9.1:0.5.0 [S] ||
| | +-default:whatdependson_2.9.1:0.1.0-SNAPSHOT [S] |+-org.typelevel:cats-effect_2.13:3.1.0 [S]
| | |+-whatdependson:whatdependson_2.13:0.1.0-SNAPSHOT [S]""".stripMargin
| +-default:whatdependson_2.9.1:0.1.0-SNAPSHOT [S] }
| """.stripMargin
checkOutput(withVersion, expectedGraphWithVersion) checkOutput(withVersion.trim, expectedGraphWithVersion.trim)
val withoutVersion = val withoutVersion =
(whatDependsOn in Compile) (Compile / whatDependsOn)
.toTask(" org.codehaus.jackson jackson-mapper-asl") .toTask(" org.typelevel cats-core_2.13")
.value .value
val expectedGraphWithoutVersion = val expectedGraphWithoutVersion =
"""org.codehaus.jackson:jackson-mapper-asl:1.9.11 """org.typelevel:cats-core_2.13:2.6.0 [S]
| +-com.codahale:jerkson_2.9.1:0.5.0 [S] |+-org.typelevel:cats-effect-kernel_2.13:3.1.0 [S]
| | +-default:whatdependson_2.9.1:0.1.0-SNAPSHOT [S] |+-org.typelevel:cats-effect-std_2.13:3.1.0 [S]
| | || +-org.typelevel:cats-effect_2.13:3.1.0 [S]
| +-default:whatdependson_2.9.1:0.1.0-SNAPSHOT [S] || +-whatdependson:whatdependson_2.13:0.1.0-SNAPSHOT [S]
| ||
|org.codehaus.jackson:jackson-mapper-asl:1.9.10 (evicted by: 1.9.11) |+-org.typelevel:cats-effect_2.13:3.1.0 [S]
| +-default:whatdependson_2.9.1:0.1.0-SNAPSHOT [S] |+-whatdependson:whatdependson_2.13:0.1.0-SNAPSHOT [S]""".stripMargin
| """.stripMargin
checkOutput(withoutVersion, expectedGraphWithoutVersion) checkOutput(withoutVersion.trim, expectedGraphWithoutVersion.trim)
} }

View File

@ -1,13 +1,11 @@
ThisBuild / version := "0.1.0-SNAPSHOT" ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / scalaVersion := "2.9.1" ThisBuild / scalaVersion := "2.13.5"
name := "whatDependsOn" name := "whatDependsOn"
resolvers += "typesafe maven" at "https://repo.typesafe.com/typesafe/maven-releases/"
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"com.codahale" % "jerkson_2.9.1" % "0.5.0", "co.fs2" %% "fs2-core" % "1.0.4",
"org.codehaus.jackson" % "jackson-mapper-asl" % "1.9.10" // as another version of asl "org.typelevel" %% "cats-effect" % "3.1.0"
) )
val check = TaskKey[Unit]("check") val check = TaskKey[Unit]("check")
@ -18,37 +16,36 @@ check := {
require(sanitize(expected) == sanitize(output), s"Tree should have been [\n${sanitize(expected)}\n] but was [\n${sanitize(output)}\n]") require(sanitize(expected) == sanitize(output), s"Tree should have been [\n${sanitize(expected)}\n] but was [\n${sanitize(output)}\n]")
val withVersion = val withVersion =
(whatDependsOn in Compile) (Compile / whatDependsOn)
.toTask(" org.codehaus.jackson jackson-core-asl 1.9.10") .toTask(" org.typelevel cats-core_2.13 2.6.0")
.value .value
val expectedGraphWithVersion = val expectedGraphWithVersion = {
"""org.codehaus.jackson:jackson-core-asl:1.9.10 """org.typelevel:cats-core_2.13:2.6.0 [S]
| +-com.codahale:jerkson_2.9.1:0.5.0 [S] |+-org.typelevel:cats-effect-kernel_2.13:3.1.0 [S]
| | +-whatdependson:whatdependson_2.9.1:0.1.0-SNAPSHOT [S] |+-org.typelevel:cats-effect-std_2.13:3.1.0 [S]
| | || +-org.typelevel:cats-effect_2.13:3.1.0 [S]
| +-org.codehaus.jackson:jackson-mapper-asl:1.9.10 || +-whatdependson:whatdependson_2.13:0.1.0-SNAPSHOT [S]
| +-com.codahale:jerkson_2.9.1:0.5.0 [S] ||
| | +-whatdependson:whatdependson_2.9.1:0.1.0-SNAPSHOT [S] |+-org.typelevel:cats-effect_2.13:3.1.0 [S]
| | |+-whatdependson:whatdependson_2.13:0.1.0-SNAPSHOT [S]""".stripMargin
| +-whatdependson:whatdependson_2.9.1:0.1.0-SNAPSHOT [S] }
| """.stripMargin
checkOutput(withVersion, expectedGraphWithVersion) checkOutput(withVersion.trim, expectedGraphWithVersion.trim)
val withoutVersion = val withoutVersion =
(whatDependsOn in Compile) (Compile / whatDependsOn)
.toTask(" org.codehaus.jackson jackson-mapper-asl") .toTask(" org.typelevel cats-core_2.13")
.value .value
val expectedGraphWithoutVersion = val expectedGraphWithoutVersion =
"""org.codehaus.jackson:jackson-mapper-asl:1.9.10 """org.typelevel:cats-core_2.13:2.6.0 [S]
| +-com.codahale:jerkson_2.9.1:0.5.0 [S] |+-org.typelevel:cats-effect-kernel_2.13:3.1.0 [S]
| | +-whatdependson:whatdependson_2.9.1:0.1.0-SNAPSHOT [S] |+-org.typelevel:cats-effect-std_2.13:3.1.0 [S]
| | || +-org.typelevel:cats-effect_2.13:3.1.0 [S]
| +-whatdependson:whatdependson_2.9.1:0.1.0-SNAPSHOT [S] || +-whatdependson:whatdependson_2.13:0.1.0-SNAPSHOT [S]
| ||
|org.codehaus.jackson:jackson-mapper-asl:[1.9.0,2.0.0) (evicted by: 1.9.10) |+-org.typelevel:cats-effect_2.13:3.1.0 [S]
| +-com.codahale:jerkson_2.9.1:0.5.0 [S] |+-whatdependson:whatdependson_2.13:0.1.0-SNAPSHOT [S]""".stripMargin
| +-whatdependson:whatdependson_2.9.1:0.1.0-SNAPSHOT [S]
| """.stripMargin checkOutput(withoutVersion.trim, expectedGraphWithoutVersion.trim)
checkOutput(withoutVersion, expectedGraphWithoutVersion)
} }

View File

@ -1,6 +0,0 @@
case class A(msg: String)
object A {
def default = A("OK")
}

View File

@ -1,14 +0,0 @@
import java.io.File
import java.nio.file.Files
import scalaz.stream._
import scalaz.concurrent.Task
object Main extends App {
val pch = Process.constant((i:Int) => Task.now(())).take(3)
val count = Process.constant(1).toSource.to(pch).runLog.run.size
assert(count == 3)
Files.write(new File("output").toPath, A.default.msg.getBytes("UTF-8"))
}

View File

@ -1,17 +0,0 @@
ThisBuild / scalaVersion := "2.11.12"
lazy val a = project
.settings(
resolvers += "Scalaz Bintray Repo" at "https://dl.bintray.com/scalaz/releases"
)
lazy val b = project
.dependsOn(a)
.settings(
// resolver added in inter-project dependency only - should still be fine
libraryDependencies += "org.scalaz.stream" %% "scalaz-stream" % "0.7.1a"
)
lazy val root = project
.in(file("."))
.aggregate(a, b)

View File

@ -1,3 +0,0 @@
$ delete output
> b/run
$ exists output

View File

@ -1,9 +1,9 @@
# write the default pom. The only repositories should be Scala Tools Releases and Snapshots # write the default pom. The only repositories should be Scala Tools Releases and Snapshots
> checkPom https://scala-ci.typesafe.com/artifactory/scala-integration/ https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/ https://oss.sonatype.org/content/repositories/releases/ https://oss.sonatype.org/content/repositories/snapshots/ > checkPom https://scala-ci.typesafe.com/artifactory/scala-integration/ https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/ https://oss.sonatype.org/service/local/repositories/releases/content/ https://oss.sonatype.org/content/repositories/snapshots/
# include file:// repositories. The generated repositories section should include the local Maven repository as well # include file:// repositories. The generated repositories section should include the local Maven repository as well
$ touch repo.all $ touch repo.all
> checkPom https://scala-ci.typesafe.com/artifactory/scala-integration/ https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/ https://oss.sonatype.org/content/repositories/releases/ https://oss.sonatype.org/content/repositories/snapshots/ file://*.m2/repository/ > checkPom https://scala-ci.typesafe.com/artifactory/scala-integration/ https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/ https://oss.sonatype.org/service/local/repositories/releases/content/ https://oss.sonatype.org/content/repositories/snapshots/ file://*.m2/repository/
$ delete repo.all $ delete repo.all
$ touch repo.none $ touch repo.none

View File

@ -1,4 +1,4 @@
ThisBuild / scalaVersion := "3.0.0-M2" ThisBuild / scalaVersion := "3.0.0-M3"
lazy val check = taskKey[Unit]("") lazy val check = taskKey[Unit]("")

View File

@ -0,0 +1,12 @@
val scala3Version = "3.0.1-RC1-bin-20210525-8f3fdf5-NIGHTLY"
enablePlugins(ScalaJSPlugin)
lazy val root = project
.in(file("."))
.settings(
name := "scala3-simple",
version := "0.1.0",
scalaVersion := scala3Version,
)

View File

@ -0,0 +1 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1")

View File

@ -0,0 +1,21 @@
package test
import scala.scalajs.js
final case class RouteLocation(loc: String, state: js.UndefOr[js.Any])
object RouteLocation:
def apply(loc: String): RouteLocation = RouteLocation(loc, js.undefined)
/**
* ```scala sc:compile
* import scala.scalajs.js
* final case class RouteLocation(loc: String, state: js.UndefOr[js.Any])
*
*
* object RouteLocation:
* def apply(loc: String): RouteLocation = RouteLocation(loc, js.undefined)
* ```
*/
case class Test(s: String)

View File

@ -0,0 +1 @@
> doc

View File

@ -1,6 +1,6 @@
lazy val root = project.in(file(".")) lazy val root = project.in(file("."))
.enablePlugins(SbtPlugin) .enablePlugins(SbtPlugin)
.settings( .settings(
scalaVersion := "2.12.13", scalaVersion := "2.12.14",
scalacOptions ++= Seq("-Xfatal-warnings", "-Xlint") scalacOptions ++= Seq("-Xfatal-warnings", "-Xlint")
) )

View File

@ -0,0 +1,6 @@
lazy val root = project.in(file("."))
.settings(
scalaVersion := "2.12.14",
sbtPlugin := true,
scalacOptions ++= Seq("-Xfatal-warnings", "-Xlint")
)

View File

@ -1 +1,3 @@
> compile > compile
$ copy-file changes/oldSbtPlugin.sbt build.sbt
> compile

View File

@ -0,0 +1,11 @@
ThisBuild / scalaVersion := "3.0.0"
lazy val check = taskKey[Unit]("check")
lazy val root = project.in(file("."))
.settings(
check := {
val dirs = (Compile / unmanagedSourceDirectories).value
assert(dirs == dirs.distinct)
}
)

View File

@ -0,0 +1 @@
> check

View File

@ -1,15 +1,15 @@
ThisBuild / scalaVersion := "2.13.4" ThisBuild / scalaVersion := "2.13.6"
ThisBuild / scalacOptions += "-Ytasty-reader" ThisBuild / scalacOptions += "-Ytasty-reader"
lazy val scala3code = project lazy val scala3code = project
.enablePlugins(ScalaJSPlugin) .enablePlugins(ScalaJSPlugin)
.settings(scalaVersion := "3.0.0-M1") .settings(scalaVersion := "3.0.0")
lazy val app = project lazy val app = project
.enablePlugins(ScalaJSPlugin) .enablePlugins(ScalaJSPlugin)
.dependsOn(scala3code) .dependsOn(scala3code)
.settings( .settings(
scalaVersion := "2.13.4", scalaVersion := "2.13.6",
scalacOptions += "-Ytasty-reader", scalacOptions += "-Ytasty-reader",
scalaJSUseMainModuleInitializer := true scalaJSUseMainModuleInitializer := true
) )

View File

@ -1 +1 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.1") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.6.0")

View File

@ -1,6 +1,6 @@
ThisBuild / scalaVersion := "3.0.0-M1" ThisBuild / scalaVersion := "3.0.0"
lazy val scala213 = "2.13.4" lazy val scala213 = "2.13.6"
lazy val root = (project in file(".")) lazy val root = (project in file("."))
.aggregate(fooApp, fooCore, barApp, barCore) .aggregate(fooApp, fooCore, barApp, barCore)

View File

@ -1,6 +1,6 @@
ThisBuild / scalaVersion := "2.12.13" ThisBuild / scalaVersion := "2.12.14"
ThisBuild / semanticdbEnabled := true ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := "4.4.10" ThisBuild / semanticdbVersion := "4.4.20"
ThisBuild / semanticdbIncludeInJar := false ThisBuild / semanticdbIncludeInJar := false
lazy val root = (project in file(".")) lazy val root = (project in file("."))
@ -8,7 +8,7 @@ lazy val root = (project in file("."))
lazy val check = taskKey[Unit]("Checks the configured semanticdbVersion") lazy val check = taskKey[Unit]("Checks the configured semanticdbVersion")
check := { check := {
val expected = Some("4.4.10") val expected = Some("4.4.20")
val actual = allDependencies val actual = allDependencies
.value .value
.find(_.name == "semanticdb-scalac") .find(_.name == "semanticdb-scalac")

View File

@ -3,7 +3,7 @@ import sbt.internal.inc.ScalaInstance
lazy val OtherScala = config("other-scala").hide lazy val OtherScala = config("other-scala").hide
lazy val junitinterface = "com.novocode" % "junit-interface" % "0.11" lazy val junitinterface = "com.novocode" % "junit-interface" % "0.11"
lazy val akkaActor = "com.typesafe.akka" %% "akka-actor" % "2.5.17" lazy val akkaActor = "com.typesafe.akka" %% "akka-actor" % "2.5.17"
ThisBuild / scalaVersion := "2.12.13" ThisBuild / scalaVersion := "2.12.14"
lazy val root = (project in file(".")) lazy val root = (project in file("."))
.configs(OtherScala) .configs(OtherScala)

View File

@ -1,6 +1,6 @@
import sbt.internal.server.{ ServerHandler, ServerIntent } import sbt.internal.server.{ ServerHandler, ServerIntent }
ThisBuild / scalaVersion := "2.12.13" ThisBuild / scalaVersion := "2.12.14"
Global / serverLog / logLevel := Level.Debug Global / serverLog / logLevel := Level.Debug
// custom handler // custom handler