Merge branch 'develop' into remove-for-set-and-map

This commit is contained in:
David Gregory 2022-06-16 13:53:36 +01:00 committed by GitHub
commit 833483960f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
68 changed files with 813 additions and 211 deletions

View File

@ -49,8 +49,8 @@ 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.15 SCALA_212: 2.12.16
SCALA_213: 2.13.6 SCALA_213: 2.13.8
SCALA_3: 3.1.0 SCALA_3: 3.1.0
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
@ -80,18 +80,18 @@ jobs:
ref: develop ref: develop
path: zinc path: zinc
- name: Setup JDK - name: Setup JDK
uses: actions/setup-java@v2 uses: actions/setup-java@v3
with: with:
distribution: "${{ matrix.distribution }}" distribution: "${{ matrix.distribution }}"
java-version: "${{ matrix.java }}" java-version: "${{ matrix.java }}"
- name: Set up Python 3.7 - name: Set up Python 3.7
uses: actions/setup-python@v3 uses: actions/setup-python@v4
with: with:
python-version: 3.7 python-version: 3.7
- 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.7 uses: actions/cache@v3
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') }}

View File

@ -151,14 +151,14 @@ suite with `sbt testOnly`
#### Integration tests #### Integration tests
Scripted integration tests reside in `sbt/src/sbt-test` and are Scripted integration tests reside in `sbt-app/src/sbt-test` and are
written using the same testing infrastructure sbt plugin authors can written using the same testing infrastructure sbt plugin authors can
use to test their own plugins with sbt. You can read more about this use to test their own plugins with sbt. You can read more about this
style of tests [here](https://www.scala-sbt.org/1.0/docs/Testing-sbt-plugins). style of tests [here](https://www.scala-sbt.org/1.0/docs/Testing-sbt-plugins).
You can run the integration tests with the `sbt scripted` sbt You can run the integration tests with the `sbt scripted` sbt
command. To run a single test, such as the test in command. To run a single test, such as the test in
`sbt/src/sbt-test/project/global-plugin`, simply run: `sbt-app/src/sbt-test/project/global-plugin`, simply run:
sbt "scripted project/global-plugin" sbt "scripted project/global-plugin"

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.6.3-SNAPSHOT" val v = "1.7.0-SNAPSHOT"
nightlyVersion.getOrElse(v) nightlyVersion.getOrElse(v)
} }
ThisBuild / version2_13 := "2.0.0-SNAPSHOT" ThisBuild / version2_13 := "2.0.0-SNAPSHOT"
@ -46,7 +46,7 @@ ThisBuild / resolvers += Resolver.mavenLocal
Global / semanticdbEnabled := !(Global / insideCI).value Global / semanticdbEnabled := !(Global / insideCI).value
// Change main/src/main/scala/sbt/plugins/SemanticdbPlugin.scala too, if you change this. // Change main/src/main/scala/sbt/plugins/SemanticdbPlugin.scala too, if you change this.
Global / semanticdbVersion := "4.4.28" Global / semanticdbVersion := "4.5.9"
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
@ -1057,6 +1057,7 @@ lazy val mainProj = (project in file("main"))
exclude[DirectMissingMethodProblem]("sbt.Defaults.earlyArtifactPathSetting"), exclude[DirectMissingMethodProblem]("sbt.Defaults.earlyArtifactPathSetting"),
exclude[MissingClassProblem]("sbt.internal.server.BuildServerReporter$"), exclude[MissingClassProblem]("sbt.internal.server.BuildServerReporter$"),
exclude[IncompatibleTemplateDefProblem]("sbt.internal.server.BuildServerReporter"), exclude[IncompatibleTemplateDefProblem]("sbt.internal.server.BuildServerReporter"),
exclude[MissingClassProblem]("sbt.internal.CustomHttp*"),
) )
) )
.configure( .configure(

View File

@ -0,0 +1,23 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
package xsbti;
import java.util.Optional;
/**
* A DiagnosticCode is a unique identifier that the compiler can associate with a diagnostic. This
* is useful for tools to be able to quickly identify what diagnostic is being reported without
* having to rely on parsing the actual diagnostic message, which might not be stable.
*/
public interface DiagnosticCode {
/** The unique code. This is typically in the format of E000 */
String code();
/** Possible explanation to explain the meaning of the code */
Optional<String> explanation();
}

View File

@ -0,0 +1,20 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
package xsbti;
/**
* Related information for a given diagnostic. At times this can be another place in your code
* contributing to the diagnostic or just relevant code relating to the diagnostic.
*/
public interface DiagnosticRelatedInformation {
/** Position of the related information */
Position position();
/** Message indicating why this related information is attached to the diagnostic. */
String message();
}

View File

@ -7,6 +7,8 @@
package xsbti; package xsbti;
import java.util.Collections;
import java.util.List;
import java.util.Optional; import java.util.Optional;
public interface Problem { public interface Problem {
@ -26,4 +28,24 @@ public interface Problem {
default Optional<String> rendered() { default Optional<String> rendered() {
return Optional.empty(); return Optional.empty();
} }
/**
* The unique code attached to the diagnostic being reported.
*
* <p>NOTE: To avoid breaking compatibility we provide a default to account for older Scala
* versions that do not have codes.
*/
default Optional<DiagnosticCode> diagnosticCode() {
return Optional.empty();
}
/**
* The possible releated information for the diagnostic being reported.
*
* <p>NOTE: To avoid breaking compatibility we provide a default to account for older Scala
* versions that do not have the concept of "related information".
*/
default List<DiagnosticRelatedInformation> diagnosticRelatedInforamation() {
return Collections.emptyList();
}
} }

View File

@ -284,10 +284,11 @@ public class BootServerSocket implements AutoCloseable {
public BootServerSocket(final AppConfiguration configuration) public BootServerSocket(final AppConfiguration configuration)
throws ServerAlreadyBootingException, IOException { throws ServerAlreadyBootingException, IOException {
final Path base = configuration.baseDirectory().toPath().toRealPath(); final Path base = configuration.baseDirectory().toPath().toRealPath();
final Path target = base.resolve("project").resolve("target");
if (!isWindows) { if (!isWindows) {
final String actualSocketLocation = socketLocation(base);
final Path target = Paths.get(actualSocketLocation).getParent();
if (!Files.isDirectory(target)) Files.createDirectories(target); if (!Files.isDirectory(target)) Files.createDirectories(target);
socketFile = Paths.get(socketLocation(base)); socketFile = Paths.get(actualSocketLocation);
} else { } else {
socketFile = null; socketFile = null;
} }
@ -301,13 +302,20 @@ public class BootServerSocket implements AutoCloseable {
} }
} }
public static String socketLocation(final Path base) throws UnsupportedEncodingException { public static String socketLocation(final Path base)
throws UnsupportedEncodingException, IOException {
final Path target = base.resolve("project").resolve("target"); final Path target = base.resolve("project").resolve("target");
long hash = LongHashFunction.farmNa().hashBytes(target.toString().getBytes("UTF-8"));
if (isWindows) { if (isWindows) {
long hash = LongHashFunction.farmNa().hashBytes(target.toString().getBytes("UTF-8"));
return "sbt-load" + hash; return "sbt-load" + hash;
} else { } else {
return base.relativize(target.resolve("sbt-load.sock")).toString(); final String alternativeSocketLocation =
System.getenv().getOrDefault("XDG_RUNTIME_DIR", "/tmp");
final Path alternativeSocketLocationRoot =
Paths.get(alternativeSocketLocation).resolve(".sbt");
final Path locationForSocket = alternativeSocketLocationRoot.resolve("sbt-socket" + hash);
final Path pathForSocket = locationForSocket.resolve("sbt-load.sock");
return pathForSocket.toString();
} }
} }

View File

@ -406,7 +406,7 @@ object BasicCommands {
case Some(line) => case Some(line) =>
val newState = s val newState = s
.copy( .copy(
onFailure = Some(Exec(Shell, None)), onFailure = Some(Exec(OldShell, None)),
remainingCommands = Exec(line, s.source) +: Exec(OldShell, None) +: s.remainingCommands remainingCommands = Exec(line, s.source) +: Exec(OldShell, None) +: s.remainingCommands
) )
.setInteractive(true) .setInteractive(true)

View File

@ -67,7 +67,7 @@ trait ConsoleInterface {
} }
/** /**
* A NetworkClient connects to a running an sbt instance or starts a * A NetworkClient connects to a running sbt instance or starts a
* new instance if there isn't already one running. Once connected, * new instance if there isn't already one running. Once connected,
* it can send commands for sbt to run, it can send completions to sbt * it can send commands for sbt to run, it can send completions to sbt
* and print the completions to stdout so that a shell can consume * and print the completions to stdout so that a shell can consume
@ -78,15 +78,15 @@ trait ConsoleInterface {
* needs to start it. It also contains the sbt command * needs to start it. It also contains the sbt command
* arguments to send to the server if any are present. * arguments to send to the server if any are present.
* @param console a logging instance. This can use a ConsoleAppender or * @param console a logging instance. This can use a ConsoleAppender or
* just simply print to a PrintSream. * just simply print to a PrintStream.
* @param inputStream the InputStream from which the client reads bytes. It * @param inputStream the InputStream from which the client reads bytes. It
* is not hardcoded to System.in so that a NetworkClient * is not hardcoded to System.in so that a NetworkClient
* can be remotely controlled by a java process, which * can be remotely controlled by a java process, which
* is useful in test. * is useful in testing.
* @param errorStream the sink for messages that we always want to be printed. * @param errorStream the sink for messages that we always want to be printed.
* It is usually System.err but could be overridden in tests * It is usually System.err but could be overridden in tests
* or set to a null OutputStream if the NetworkClient needs * or set to a null OutputStream if the NetworkClient needs
* to be silent * to be silent.
* @param printStream the sink for standard out messages. It is typically * @param printStream the sink for standard out messages. It is typically
* System.out but in the case of completions, the bytes written * System.out but in the case of completions, the bytes written
* to System.out are usually treated as completion results * to System.out are usually treated as completion results
@ -139,7 +139,7 @@ class NetworkClient(
private val rebooting = new AtomicBoolean(false) private val rebooting = new AtomicBoolean(false)
private lazy val noTab = arguments.completionArguments.contains("--no-tab") private lazy val noTab = arguments.completionArguments.contains("--no-tab")
private lazy val noStdErr = arguments.completionArguments.contains("--no-stderr") && private lazy val noStdErr = arguments.completionArguments.contains("--no-stderr") &&
!sys.env.contains("SBTC_AUTO_COMPLETE") !sys.env.contains("SBTN_AUTO_COMPLETE") && !sys.env.contains("SBTC_AUTO_COMPLETE")
private def mkSocket(file: File): (Socket, Option[String]) = ClientSocket.socket(file, useJNI) private def mkSocket(file: File): (Socket, Option[String]) = ClientSocket.socket(file, useJNI)

View File

@ -75,7 +75,7 @@ private[sbt] object UITask {
this.synchronized(this.wait()) this.synchronized(this.wait())
Right("") // should be unreachable Right("") // should be unreachable
// JLine returns null on ctrl+d when there is no other input. This interprets // JLine returns null on ctrl+d when there is no other input. This interprets
// ctrl+d with no imput as an exit // ctrl+d with no input as an exit
case None => Left(TerminateAction) case None => Left(TerminateAction)
case Some(s: String) => case Some(s: String) =>
s.trim() match { s.trim() match {

View File

@ -44,7 +44,7 @@ abstract class BackgroundJobService extends Closeable {
start(logger, file)._2.apply() start(logger, file)._2.apply()
} }
/** Same as shutown. */ /** Same as shutdown. */
def close(): Unit def close(): Unit
/** Shuts down all background jobs. */ /** Shuts down all background jobs. */

View File

@ -43,7 +43,7 @@ import sbt.internal.librarymanagement.mavenint.{
PomExtraDependencyAttributes, PomExtraDependencyAttributes,
SbtPomExtraProperties SbtPomExtraProperties
} }
import sbt.internal.librarymanagement.{ CustomHttp => _, _ } import sbt.internal.librarymanagement._
import sbt.internal.nio.{ CheckBuildSources, Globs } import sbt.internal.nio.{ CheckBuildSources, Globs }
import sbt.internal.server.{ import sbt.internal.server.{
BspCompileProgress, BspCompileProgress,
@ -258,8 +258,6 @@ object Defaults extends BuildCommon {
artifactClassifier :== None, artifactClassifier :== None,
checksums := Classpaths.bootChecksums(appConfiguration.value), checksums := Classpaths.bootChecksums(appConfiguration.value),
conflictManager := ConflictManager.default, conflictManager := ConflictManager.default,
CustomHttp.okhttpClientBuilder :== CustomHttp.defaultHttpClientBuilder,
CustomHttp.okhttpClient := CustomHttp.okhttpClientBuilder.value.build,
pomExtra :== NodeSeq.Empty, pomExtra :== NodeSeq.Empty,
pomPostProcess :== idFun, pomPostProcess :== idFun,
pomAllRepositories :== false, pomAllRepositories :== false,
@ -1395,11 +1393,10 @@ object Defaults extends BuildCommon {
val x = { val x = {
import analysis.{ apis, relations => rel } import analysis.{ apis, relations => rel }
rel.internalClassDeps(c).map(intlStamp(_, analysis, s + c)) ++ rel.internalClassDeps(c).map(intlStamp(_, analysis, s + c)) ++
rel.externalDeps(c).map(stamp) + rel.externalDeps(c).map(stamp) ++
(apis.internal.get(c) match { rel.productClassName.reverse(c).flatMap { pc =>
case Some(x) => x.compilationTimestamp apis.internal.get(pc).map(_.compilationTimestamp)
case _ => Long.MinValue } + Long.MinValue
})
}.max }.max
if (x != Long.MinValue) { if (x != Long.MinValue) {
stamps(c) = x stamps(c) = x
@ -2641,7 +2638,7 @@ object Defaults extends BuildCommon {
def dependencyResolutionTask: Def.Initialize[Task[DependencyResolution]] = def dependencyResolutionTask: Def.Initialize[Task[DependencyResolution]] =
Def.taskIf { Def.taskIf {
if (useCoursier.value) CoursierDependencyResolution(csrConfiguration.value) if (useCoursier.value) CoursierDependencyResolution(csrConfiguration.value)
else IvyDependencyResolution(ivyConfiguration.value, CustomHttp.okhttpClient.value) else IvyDependencyResolution(ivyConfiguration.value)
} }
} }
@ -3065,7 +3062,7 @@ object Classpaths {
else None else None
}, },
dependencyResolution := dependencyResolutionTask.value, dependencyResolution := dependencyResolutionTask.value,
publisher := IvyPublisher(ivyConfiguration.value, CustomHttp.okhttpClient.value), publisher := IvyPublisher(ivyConfiguration.value),
ivyConfiguration := mkIvyConfiguration.value, ivyConfiguration := mkIvyConfiguration.value,
ivyConfigurations := { ivyConfigurations := {
val confs = thisProject.value.configurations val confs = thisProject.value.configurations
@ -3368,7 +3365,7 @@ object Classpaths {
private[sbt] def ivySbt0: Initialize[Task[IvySbt]] = private[sbt] def ivySbt0: Initialize[Task[IvySbt]] =
Def.task { Def.task {
Credentials.register(credentials.value, streams.value.log) Credentials.register(credentials.value, streams.value.log)
new IvySbt(ivyConfiguration.value, CustomHttp.okhttpClient.value) new IvySbt(ivyConfiguration.value)
} }
def moduleSettings0: Initialize[Task[ModuleSettings]] = Def.task { def moduleSettings0: Initialize[Task[ModuleSettings]] = Def.task {
val deps = allDependencies.value.toVector val deps = allDependencies.value.toVector
@ -4387,7 +4384,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
} }
@deprecated( @deprecated(
"externalIvyFile is not supported by Couriser, and will be removed in the future", "externalIvyFile is not supported by Coursier, and will be removed in the future",
since = "1.5.0" since = "1.5.0"
) )
def externalIvyFile( def externalIvyFile(

View File

@ -396,6 +396,7 @@ object Keys {
val usePipelining = settingKey[Boolean]("Use subproject pipelining for compilation.").withRank(BSetting) val usePipelining = settingKey[Boolean]("Use subproject pipelining for compilation.").withRank(BSetting)
val exportPipelining = settingKey[Boolean]("Product early output so downstream subprojects can do pipelining.").withRank(BSetting) val exportPipelining = settingKey[Boolean]("Product early output so downstream subprojects can do pipelining.").withRank(BSetting)
// BSP keys
val bspConfig = taskKey[Unit]("Create or update the BSP connection files").withRank(DSetting) val bspConfig = taskKey[Unit]("Create or update the BSP connection files").withRank(DSetting)
val bspEnabled = SettingKey[Boolean](BasicKeys.bspEnabled) val bspEnabled = SettingKey[Boolean](BasicKeys.bspEnabled)
val bspSbtEnabled = settingKey[Boolean]("Should BSP export meta-targets for the SBT build itself?") val bspSbtEnabled = settingKey[Boolean]("Should BSP export meta-targets for the SBT build itself?")
@ -418,6 +419,11 @@ object Keys {
val bspBuildTargetCleanCache = inputKey[Unit]("Corresponds to buildTarget/cleanCache request").withRank(DTask) val bspBuildTargetCleanCache = inputKey[Unit]("Corresponds to buildTarget/cleanCache request").withRank(DTask)
val bspBuildTargetScalacOptions = inputKey[Unit]("").withRank(DTask) val bspBuildTargetScalacOptions = inputKey[Unit]("").withRank(DTask)
val bspBuildTargetScalacOptionsItem = taskKey[ScalacOptionsItem]("").withRank(DTask) val bspBuildTargetScalacOptionsItem = taskKey[ScalacOptionsItem]("").withRank(DTask)
val bspBuildTargetJVMRunEnvironment = inputKey[Unit]("Corresponds to the buildTarget/jvmRunEnvironment request").withRank(DTask)
val bspBuildTargetJVMTestEnvironment = inputKey[Unit]("Corresponds to the buildTarget/jvmTestEnvironment request").withRank(DTask)
val bspBuildTargetJvmEnvironmentItem = taskKey[JvmEnvironmentItem]("Computes JVM environment item").withRank(DTask)
val bspScalaTestClasses = inputKey[Unit]("Corresponds to buildTarget/scalaTestClasses request").withRank(DTask) val bspScalaTestClasses = inputKey[Unit]("Corresponds to buildTarget/scalaTestClasses request").withRank(DTask)
val bspScalaTestClassesItem = taskKey[Seq[ScalaTestClassesItem]]("").withRank(DTask) val bspScalaTestClassesItem = taskKey[Seq[ScalaTestClassesItem]]("").withRank(DTask)
val bspScalaMainClasses = inputKey[Unit]("Corresponds to buildTarget/scalaMainClasses request").withRank(DTask) val bspScalaMainClasses = inputKey[Unit]("Corresponds to buildTarget/scalaMainClasses request").withRank(DTask)

View File

@ -329,7 +329,6 @@ object BuiltinCommands {
startServer, startServer,
eval, eval,
last, last,
oldLastGrep,
lastGrep, lastGrep,
export, export,
boot, boot,
@ -626,12 +625,6 @@ object BuiltinCommands {
s s
} }
@deprecated("Use `lastGrep` instead.", "1.2.0")
def oldLastGrep: Command =
lastGrepCommand(OldLastGrepCommand, oldLastGrepBrief, oldLastGrepDetailed, { s =>
lastGrepParser(s)
})
def lastGrep: Command = def lastGrep: Command =
lastGrepCommand(LastGrepCommand, lastGrepBrief, lastGrepDetailed, lastGrepParser) lastGrepCommand(LastGrepCommand, lastGrepBrief, lastGrepDetailed, lastGrepParser)
@ -643,9 +636,6 @@ object BuiltinCommands {
): Command = ): Command =
Command(name, briefHelp, detail)(parser) { (s: State, sks: (String, Option[AnyKeys])) => Command(name, briefHelp, detail)(parser) { (s: State, sks: (String, Option[AnyKeys])) =>
{ {
if (name == OldLastGrepCommand)
s.log.warn(deprecationWarningText(OldLastGrepCommand, LastGrepCommand))
(s, sks) match { (s, sks) match {
case (s, (pattern, Some(sks))) => case (s, (pattern, Some(sks))) =>
val (str, _, display) = extractLast(s) val (str, _, display) = extractLast(s)

View File

@ -41,8 +41,14 @@ object Opts {
} }
object resolver { object resolver {
import sbt.io.syntax._ import sbt.io.syntax._
@deprecated("Use sonatypeOssReleases instead", "1.7.0")
val sonatypeReleases = Resolver.sonatypeRepo("releases") val sonatypeReleases = Resolver.sonatypeRepo("releases")
val sonatypeOssReleases = Resolver.sonatypeOssRepos("releases")
@deprecated("Use sonatypeOssSnapshots instead", "1.7.0")
val sonatypeSnapshots = Resolver.sonatypeRepo("snapshots") val sonatypeSnapshots = Resolver.sonatypeRepo("snapshots")
val sonatypeOssSnapshots = Resolver.sonatypeOssRepos("snapshots")
val sonatypeStaging = MavenRepository( val sonatypeStaging = MavenRepository(
"sonatype-staging", "sonatype-staging",
"https://oss.sonatype.org/service/local/staging/deploy/maven2" "https://oss.sonatype.org/service/local/staging/deploy/maven2"

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.15" case VersionNumber(Seq(1, 0, _*), _, _) => "2.12.16"
case _ => sys.error(s"Unsupported sbt binary version: $sv") case _ => sys.error(s"Unsupported sbt binary version: $sv")
} }
} }

View File

@ -18,12 +18,12 @@ trait UpperStateOps extends Any {
/** /**
* ProjectRef to the current project of the state session that can be change using * ProjectRef to the current project of the state session that can be change using
* `project` commmand. * `project` command.
*/ */
def currentRef: ProjectRef def currentRef: ProjectRef
/** /**
* Current project of the state session that can be change using `project` commmand. * Current project of the state session that can be change using `project` command.
*/ */
def currentProject: ResolvedProject def currentProject: ResolvedProject

View File

@ -70,23 +70,10 @@ $PrintCommand <task>
def pluginsDetailed = pluginsBrief // TODO: expand def pluginsDetailed = pluginsBrief // TODO: expand
val LastCommand = "last" val LastCommand = "last"
val OldLastGrepCommand = "last-grep"
val LastGrepCommand = "lastGrep" val LastGrepCommand = "lastGrep"
val ExportCommand = "export" val ExportCommand = "export"
val ExportStream = "export" val ExportStream = "export"
val oldLastGrepBrief =
(OldLastGrepCommand, "Shows lines from the last output for 'key' that match 'pattern'.")
val oldLastGrepDetailed =
s"""$OldLastGrepCommand <pattern>
Displays lines from the logging of previous commands that match `pattern`.
$OldLastGrepCommand <pattern> [key]
Displays lines from logging associated with `key` that match `pattern`. The key typically refers to a task (for example, test:compile). The logging that is displayed is restricted to the logging for that particular task.
<pattern> is a regular expression interpreted by java.util.Pattern. Matching text is highlighted (when highlighting is supported and enabled).
See also '$LastCommand'."""
val lastGrepBrief = val lastGrepBrief =
(LastGrepCommand, "Shows lines from the last output for 'key' that match 'pattern'.") (LastGrepCommand, "Shows lines from the last output for 'key' that match 'pattern'.")
val lastGrepDetailed = val lastGrepDetailed =

View File

@ -1128,7 +1128,28 @@ private[sbt] object Continuous extends DeprecatedContinuous {
val callbacks: Callbacks, val callbacks: Callbacks,
val dynamicInputs: mutable.Set[DynamicInput], val dynamicInputs: mutable.Set[DynamicInput],
val pending: Boolean, val pending: Boolean,
var failAction: Option[Watch.Action],
) { ) {
def this(
count: Int,
commands: Seq[String],
beforeCommandImpl: (State, mutable.Set[DynamicInput]) => State,
afterCommand: State => State,
afterWatch: State => State,
callbacks: Callbacks,
dynamicInputs: mutable.Set[DynamicInput],
pending: Boolean,
) = this(
count,
commands,
beforeCommandImpl,
afterCommand,
afterWatch,
callbacks,
dynamicInputs,
pending,
None
)
def beforeCommand(state: State): State = beforeCommandImpl(state, dynamicInputs) def beforeCommand(state: State): State = beforeCommandImpl(state, dynamicInputs)
def incremented: ContinuousState = withCount(count + 1) def incremented: ContinuousState = withCount(count + 1)
def withPending(p: Boolean) = def withPending(p: Boolean) =
@ -1323,7 +1344,8 @@ private[sbt] object ContinuousCommands {
case Watch.Prompt => stop.map(_ :: s"$PromptChannel ${channel.name}" :: Nil mkString ";") case Watch.Prompt => stop.map(_ :: s"$PromptChannel ${channel.name}" :: Nil mkString ";")
case Watch.Run(commands) => case Watch.Run(commands) =>
stop.map(_ +: commands.map(_.commandLine).filter(_.nonEmpty) mkString "; ") stop.map(_ +: commands.map(_.commandLine).filter(_.nonEmpty) mkString "; ")
case Watch.HandleError(_) => case a @ Watch.HandleError(_) =>
cs.failAction = Some(a)
stop.map(_ :: s"$failWatch ${channel.name}" :: Nil mkString "; ") stop.map(_ :: s"$failWatch ${channel.name}" :: Nil mkString "; ")
case _ => stop case _ => stop
} }
@ -1353,27 +1375,31 @@ private[sbt] object ContinuousCommands {
} }
cs.afterCommand(postState) cs.afterCommand(postState)
} }
private[sbt] val stopWatchCommand = watchCommand(stopWatch) { (channel, state) => private[this] val exitWatchShared = (error: Boolean) =>
state.get(watchStates).flatMap(_.get(channel)) match { (channel: String, state: State) =>
case Some(cs) => state.get(watchStates).flatMap(_.get(channel)) match {
val afterWatchState = cs.afterWatch(state) case Some(cs) =>
cs.callbacks.onExit() val afterWatchState = cs.afterWatch(state)
StandardMain.exchange cs.callbacks.onExit()
.channelForName(channel) StandardMain.exchange
.foreach { c => .channelForName(channel)
c.terminal.setPrompt(Prompt.Pending) .foreach { c =>
c.unprompt(ConsoleUnpromptEvent(Some(CommandSource(channel)))) c.terminal.setPrompt(Prompt.Pending)
c.unprompt(ConsoleUnpromptEvent(Some(CommandSource(channel))))
}
val newState = afterWatchState.get(watchStates) match {
case None => afterWatchState
case Some(w) => afterWatchState.put(watchStates, w - channel)
} }
afterWatchState.get(watchStates) match { val commands = cs.commands.mkString("; ")
case None => afterWatchState val count = cs.count
case Some(w) => afterWatchState.put(watchStates, w - channel) val action = cs.failAction.getOrElse(Watch.CancelWatch)
} val st = cs.callbacks.onTermination(action, commands, count, newState)
case _ => state if (error) st.fail else st
} case _ => if (error) state.fail else state
} }
private[sbt] val failWatchCommand = watchCommand(failWatch) { (channel, state) => private[sbt] val stopWatchCommand = watchCommand(stopWatch)(exitWatchShared(false))
state.fail private[sbt] val failWatchCommand = watchCommand(failWatch)(exitWatchShared(true))
}
/* /*
* Creates a FileTreeRepository where it is safe to call close without inadvertently cancelling * Creates a FileTreeRepository where it is safe to call close without inadvertently cancelling
* still active watches. * still active watches.

View File

@ -1,25 +0,0 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
package sbt.internal
import sbt.internal.librarymanagement.{ CustomHttp => LMCustomHttp }
import okhttp3._
import sbt.BuildSyntax._
import sbt.KeyRanks._
object CustomHttp {
val okhttpClientBuilder =
settingKey[OkHttpClient.Builder]("Builder for the HTTP client.").withRank(CSetting)
val okhttpClient =
settingKey[OkHttpClient]("HTTP client used for library management.").withRank(CSetting)
def defaultHttpClientBuilder: OkHttpClient.Builder = {
LMCustomHttp.defaultHttpClientBuilder
}
}

View File

@ -139,7 +139,7 @@ object RemoteCache {
ivySbt := { ivySbt := {
Credentials.register(credentials.value, streams.value.log) Credentials.register(credentials.value, streams.value.log)
val config0 = ivyConfiguration.value val config0 = ivyConfiguration.value
new IvySbt(config0, sbt.internal.CustomHttp.okhttpClient.value) new IvySbt(config0)
}, },
) )
) ++ inTask(pullRemoteCache)( ) ++ inTask(pullRemoteCache)(

View File

@ -65,7 +65,9 @@ object BuildServerProtocol {
RunProvider(BuildServerConnection.languages), RunProvider(BuildServerConnection.languages),
dependencySourcesProvider = true, dependencySourcesProvider = true,
resourcesProvider = true, resourcesProvider = true,
canReload = true canReload = true,
jvmRunEnvironmentProvider = true,
jvmTestEnvironmentProvider = true,
) )
private val bspReload = "bspReload" private val bspReload = "bspReload"
@ -119,11 +121,7 @@ object BuildServerProtocol {
} }
}.value, }.value,
// https://github.com/build-server-protocol/build-server-protocol/blob/master/docs/specification.md#build-target-sources-request // https://github.com/build-server-protocol/build-server-protocol/blob/master/docs/specification.md#build-target-sources-request
bspBuildTargetSources := Def.inputTaskDyn { bspBuildTargetSources := bspInputTask { (state, _, workspace, filter) =>
val s = state.value
val targets = spaceDelimited().parsed.map(uri => BuildTargetIdentifier(URI.create(uri)))
val workspace = bspFullWorkspace.value.filter(targets)
val filter = ScopeFilter.in(workspace.scopes.values.toList)
// run the worker task concurrently // run the worker task concurrently
Def.task { Def.task {
val items = bspBuildTargetSourcesItem.result.all(filter).value val items = bspBuildTargetSourcesItem.result.all(filter).value
@ -147,64 +145,48 @@ object BuildServerProtocol {
} }
val successfulItems = anyOrThrow(items ++ buildItems) val successfulItems = anyOrThrow(items ++ buildItems)
val result = SourcesResult(successfulItems.toVector) val result = SourcesResult(successfulItems.toVector)
s.respondEvent(result) state.respondEvent(result)
} }
}.evaluated, }.evaluated,
bspBuildTargetSources / aggregate := false, bspBuildTargetSources / aggregate := false,
bspBuildTargetResources := Def.inputTaskDyn { bspBuildTargetResources := bspInputTask { (state, _, workspace, filter) =>
val s = state.value workspace.warnIfBuildsNonEmpty(Method.Resources, state.log)
val targets = spaceDelimited().parsed.map(uri => BuildTargetIdentifier(URI.create(uri)))
val workspace = bspFullWorkspace.value.filter(targets)
workspace.warnIfBuildsNonEmpty(Method.Resources, s.log)
val filter = ScopeFilter.in(workspace.scopes.values.toList)
// run the worker task concurrently // run the worker task concurrently
Def.task { Def.task {
val items = bspBuildTargetResourcesItem.result.all(filter).value val items = bspBuildTargetResourcesItem.result.all(filter).value
val successfulItems = anyOrThrow(items) val successfulItems = anyOrThrow(items)
val result = ResourcesResult(successfulItems.toVector) val result = ResourcesResult(successfulItems.toVector)
s.respondEvent(result) state.respondEvent(result)
} }
}.evaluated, }.evaluated,
bspBuildTargetResources / aggregate := false, bspBuildTargetResources / aggregate := false,
bspBuildTargetDependencySources := Def.inputTaskDyn { bspBuildTargetDependencySources := bspInputTask { (state, _, workspace, filter) =>
val s = state.value
val targets = spaceDelimited().parsed.map(uri => BuildTargetIdentifier(URI.create(uri)))
val workspace = bspFullWorkspace.value.filter(targets)
val filter = ScopeFilter.in(workspace.scopes.values.toList)
// run the worker task concurrently // run the worker task concurrently
Def.task { Def.task {
import sbt.internal.bsp.codec.JsonProtocol._ import sbt.internal.bsp.codec.JsonProtocol._
val items = bspBuildTargetDependencySourcesItem.result.all(filter).value val items = bspBuildTargetDependencySourcesItem.result.all(filter).value
val successfulItems = anyOrThrow(items) val successfulItems = anyOrThrow(items)
val result = DependencySourcesResult(successfulItems.toVector) val result = DependencySourcesResult(successfulItems.toVector)
s.respondEvent(result) state.respondEvent(result)
} }
}.evaluated, }.evaluated,
bspBuildTargetDependencySources / aggregate := false, bspBuildTargetDependencySources / aggregate := false,
bspBuildTargetCompile := Def.inputTaskDyn { bspBuildTargetCompile := bspInputTask { (state, _, workspace, filter) =>
val s: State = state.value workspace.warnIfBuildsNonEmpty(Method.Compile, state.log)
val targets = spaceDelimited().parsed.map(uri => BuildTargetIdentifier(URI.create(uri)))
val workspace = bspFullWorkspace.value.filter(targets)
workspace.warnIfBuildsNonEmpty(Method.Compile, s.log)
val filter = ScopeFilter.in(workspace.scopes.values.toList)
Def.task { Def.task {
val statusCodes = Keys.bspBuildTargetCompileItem.result.all(filter).value val statusCodes = Keys.bspBuildTargetCompileItem.result.all(filter).value
val aggregatedStatusCode = allOrThrow(statusCodes) match { val aggregatedStatusCode = allOrThrow(statusCodes) match {
case Seq() => StatusCode.Success case Seq() => StatusCode.Success
case codes => codes.max case codes => codes.max
} }
s.respondEvent(BspCompileResult(None, aggregatedStatusCode)) state.respondEvent(BspCompileResult(None, aggregatedStatusCode))
} }
}.evaluated, }.evaluated,
bspBuildTargetCompile / aggregate := false, bspBuildTargetCompile / aggregate := false,
bspBuildTargetTest := bspTestTask.evaluated, bspBuildTargetTest := bspTestTask.evaluated,
bspBuildTargetTest / aggregate := false, bspBuildTargetTest / aggregate := false,
bspBuildTargetCleanCache := Def.inputTaskDyn { bspBuildTargetCleanCache := bspInputTask { (state, targets, workspace, filter) =>
val s: State = state.value workspace.warnIfBuildsNonEmpty(Method.CleanCache, state.log)
val targets = spaceDelimited().parsed.map(uri => BuildTargetIdentifier(URI.create(uri)))
val workspace = bspFullWorkspace.value.filter(targets)
workspace.warnIfBuildsNonEmpty(Method.CleanCache, s.log)
val filter = ScopeFilter.in(workspace.scopes.values.toList)
Def.task { Def.task {
val results = Keys.clean.result.all(filter).value val results = Keys.clean.result.all(filter).value
val successes = anyOrThrow(results).size val successes = anyOrThrow(results).size
@ -214,18 +196,12 @@ object BuildServerProtocol {
// checking that the executed results plus this entry is equal to the total number of targets. // checking that the executed results plus this entry is equal to the total number of targets.
// When rebuilding a single module, the root build isn't sent, just the requested targets. // When rebuilding a single module, the root build isn't sent, just the requested targets.
val cleaned = successes + workspace.builds.size == targets.size val cleaned = successes + workspace.builds.size == targets.size
s.respondEvent(CleanCacheResult(None, cleaned)) state.respondEvent(CleanCacheResult(None, cleaned))
} }
}.evaluated, }.evaluated,
bspBuildTargetCleanCache / aggregate := false, bspBuildTargetCleanCache / aggregate := false,
bspBuildTargetScalacOptions := Def.inputTaskDyn { bspBuildTargetScalacOptions := bspInputTask { (state, _, workspace, filter) =>
val s = state.value
val targets = spaceDelimited().parsed.map(uri => BuildTargetIdentifier(URI.create(uri)))
val workspace = bspFullWorkspace.value.filter(targets)
val builds = workspace.builds val builds = workspace.builds
val filter = ScopeFilter.in(workspace.scopes.values.toList)
Def.task { Def.task {
val items = bspBuildTargetScalacOptionsItem.result.all(filter).value val items = bspBuildTargetScalacOptionsItem.result.all(filter).value
val appProvider = appConfiguration.value.provider() val appProvider = appConfiguration.value.provider()
@ -246,34 +222,26 @@ object BuildServerProtocol {
} }
val successfulItems = anyOrThrow(items ++ buildItems) val successfulItems = anyOrThrow(items ++ buildItems)
val result = ScalacOptionsResult(successfulItems.toVector) val result = ScalacOptionsResult(successfulItems.toVector)
s.respondEvent(result) state.respondEvent(result)
} }
}.evaluated, }.evaluated,
bspBuildTargetScalacOptions / aggregate := false, bspBuildTargetScalacOptions / aggregate := false,
bspScalaTestClasses := Def.inputTaskDyn { bspScalaTestClasses := bspInputTask { (state, _, workspace, filter) =>
val s = state.value workspace.warnIfBuildsNonEmpty(Method.ScalaTestClasses, state.log)
val targets = spaceDelimited().parsed.map(uri => BuildTargetIdentifier(URI.create(uri)))
val workspace = bspFullWorkspace.value.filter(targets)
workspace.warnIfBuildsNonEmpty(Method.ScalaTestClasses, s.log)
val filter = ScopeFilter.in(workspace.scopes.values.toList)
Def.task { Def.task {
val items = bspScalaTestClassesItem.result.all(filter).value val items = bspScalaTestClassesItem.result.all(filter).value
val successfulItems = anyOrThrow(items).flatten.toVector val successfulItems = anyOrThrow(items).flatten.toVector
val result = ScalaTestClassesResult(successfulItems.toVector, None) val result = ScalaTestClassesResult(successfulItems.toVector, None)
s.respondEvent(result) state.respondEvent(result)
} }
}.evaluated, }.evaluated,
bspScalaMainClasses := Def.inputTaskDyn { bspScalaMainClasses := bspInputTask { (state, _, workspace, filter) =>
val s = state.value workspace.warnIfBuildsNonEmpty(Method.ScalaMainClasses, state.log)
val targets = spaceDelimited().parsed.map(uri => BuildTargetIdentifier(URI.create(uri)))
val workspace = bspFullWorkspace.value.filter(targets)
workspace.warnIfBuildsNonEmpty(Method.ScalaMainClasses, s.log)
val filter = ScopeFilter.in(workspace.scopes.values.toList)
Def.task { Def.task {
val items = bspScalaMainClassesItem.result.all(filter).value val items = bspScalaMainClassesItem.result.all(filter).value
val successfulItems = anyOrThrow(items) val successfulItems = anyOrThrow(items)
val result = ScalaMainClassesResult(successfulItems.toVector, None) val result = ScalaMainClassesResult(successfulItems.toVector, None)
s.respondEvent(result) state.respondEvent(result)
} }
}.evaluated, }.evaluated,
bspScalaMainClasses / aggregate := false bspScalaMainClasses / aggregate := false
@ -315,6 +283,23 @@ object BuildServerProtocol {
bspBuildTargetCompileItem := bspCompileTask.value, bspBuildTargetCompileItem := bspCompileTask.value,
bspBuildTargetRun := bspRunTask.evaluated, bspBuildTargetRun := bspRunTask.evaluated,
bspBuildTargetScalacOptionsItem := scalacOptionsTask.value, bspBuildTargetScalacOptionsItem := scalacOptionsTask.value,
bspBuildTargetJVMRunEnvironment := bspInputTask { (state, _, _, filter) =>
Def.task {
val items = bspBuildTargetJvmEnvironmentItem.result.all(filter).value
val successfulItems = anyOrThrow(items)
val result = JvmRunEnvironmentResult(successfulItems.toVector, None)
state.respondEvent(result)
}
}.evaluated,
bspBuildTargetJVMTestEnvironment := bspInputTask { (state, _, _, filter) =>
Def.task {
val items = bspBuildTargetJvmEnvironmentItem.result.all(filter).value
val successfulItems = anyOrThrow(items)
val result = JvmTestEnvironmentResult(successfulItems.toVector, None)
state.respondEvent(result)
}
}.evaluated,
bspBuildTargetJvmEnvironmentItem := jvmEnvironmentItem().value,
bspInternalDependencyConfigurations := internalDependencyConfigurationsSetting.value, bspInternalDependencyConfigurations := internalDependencyConfigurationsSetting.value,
bspScalaTestClassesItem := scalaTestClassesTask.value, bspScalaTestClassesItem := scalaTestClassesTask.value,
bspScalaMainClassesItem := scalaMainClassesTask.value, bspScalaMainClassesItem := scalaMainClassesTask.value,
@ -344,6 +329,8 @@ object BuildServerProtocol {
final val Run = "buildTarget/run" final val Run = "buildTarget/run"
final val CleanCache = "buildTarget/cleanCache" final val CleanCache = "buildTarget/cleanCache"
final val ScalacOptions = "buildTarget/scalacOptions" final val ScalacOptions = "buildTarget/scalacOptions"
final val JvmRunEnvironment = "buildTarget/jvmRunEnvironment"
final val JvmTestEnvironment = "buildTarget/jvmTestEnvironment"
final val ScalaTestClasses = "buildTarget/scalaTestClasses" final val ScalaTestClasses = "buildTarget/scalaTestClasses"
final val ScalaMainClasses = "buildTarget/scalaMainClasses" final val ScalaMainClasses = "buildTarget/scalaMainClasses"
final val Exit = "build/exit" final val Exit = "build/exit"
@ -443,6 +430,18 @@ object BuildServerProtocol {
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 if r.method == Method.JvmRunEnvironment =>
val param = Converter.fromJson[JvmRunEnvironmentParams](json(r)).get
val targets = param.targets.map(_.uri).mkString(" ")
val command = Keys.bspBuildTargetJVMRunEnvironment.key
val _ = callback.appendExec(s"$command $targets", Some(r.id))
case r if r.method == Method.JvmTestEnvironment =>
val param = Converter.fromJson[JvmTestEnvironmentParams](json(r)).get
val targets = param.targets.map(_.uri).mkString(" ")
val command = Keys.bspBuildTargetJVMTestEnvironment.key
val _ = callback.appendExec(s"$command $targets", Some(r.id))
case r if r.method == Method.ScalaTestClasses => case r if r.method == Method.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(" ")
@ -648,6 +647,38 @@ object BuildServerProtocol {
) )
} }
private def bspInputTask[T](
taskImpl: (
State,
Seq[BuildTargetIdentifier],
BspFullWorkspace,
ScopeFilter
) => Def.Initialize[Task[T]]
): Def.Initialize[InputTask[T]] =
Def.inputTaskDyn {
val s = state.value
val targets = spaceDelimited().parsed.map(uri => BuildTargetIdentifier(URI.create(uri)))
val workspace: BspFullWorkspace = bspFullWorkspace.value.filter(targets)
val filter = ScopeFilter.in(workspace.scopes.values.toList)
taskImpl(s, targets, workspace, filter)
}
private def jvmEnvironmentItem(): Initialize[Task[JvmEnvironmentItem]] = Def.task {
val target = Keys.bspTargetIdentifier.value
val classpath = Keys.fullClasspath.value.map(_.data.toURI).toVector
val jvmOptions = Keys.javaOptions.value.toVector
val baseDir = Keys.baseDirectory.value.toURI().toString()
val env = envVars.value
JvmEnvironmentItem(
target,
classpath,
jvmOptions,
baseDir,
env
)
}
private def scalacOptionsTask: Def.Initialize[Task[ScalacOptionsItem]] = Def.taskDyn { private def scalacOptionsTask: Def.Initialize[Task[ScalacOptionsItem]] = Def.taskDyn {
val target = Keys.bspTargetIdentifier.value val target = Keys.bspTargetIdentifier.value
val scalacOptions = Keys.scalacOptions.value val scalacOptions = Keys.scalacOptions.value

View File

@ -259,7 +259,7 @@ private[sbt] object Settings {
* Provides an automatically generated clean method for a task that provides fileOutputs. * Provides an automatically generated clean method for a task that provides fileOutputs.
* *
* @param taskKey the task for which we add a custom clean implementation * @param taskKey the task for which we add a custom clean implementation
* @return a task specificic clean implementation * @return a task specific clean implementation
*/ */
@nowarn @nowarn
private[sbt] def cleanImpl[T: JsonFormat: ToSeqPath](taskKey: TaskKey[T]): Def.Setting[_] = { private[sbt] def cleanImpl[T: JsonFormat: ToSeqPath](taskKey: TaskKey[T]): Def.Setting[_] = {

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.28" semanticdbVersion := "4.5.9"
) )
override lazy val projectSettings: Seq[Def.Setting[_]] = Seq( override lazy val projectSettings: Seq[Def.Setting[_]] = Seq(

View File

@ -4,8 +4,8 @@ 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.15" val scala212 = "2.12.16"
val scala213 = "2.13.6" val scala213 = "2.13.8"
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] =
@ -14,8 +14,8 @@ object Dependencies {
// sbt modules // sbt modules
private val ioVersion = nightlyVersion.getOrElse("1.6.0") private val ioVersion = nightlyVersion.getOrElse("1.6.0")
private val lmVersion = private val lmVersion =
sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.6.1") sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.7.0-M1")
val zincVersion = nightlyVersion.getOrElse("1.6.0") val zincVersion = nightlyVersion.getOrElse("1.7.0-M2")
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion private val sbtIO = "org.scala-sbt" %% "io" % ioVersion

View File

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

View File

@ -17,22 +17,24 @@ final class BuildServerCapabilities private (
val runProvider: Option[sbt.internal.bsp.RunProvider], val runProvider: Option[sbt.internal.bsp.RunProvider],
val dependencySourcesProvider: Option[Boolean], val dependencySourcesProvider: Option[Boolean],
val resourcesProvider: Option[Boolean], val resourcesProvider: Option[Boolean],
val canReload: Option[Boolean]) extends Serializable { val canReload: Option[Boolean],
val jvmRunEnvironmentProvider: Option[Boolean],
val jvmTestEnvironmentProvider: Option[Boolean]) extends Serializable {
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match { override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
case x: BuildServerCapabilities => (this.compileProvider == x.compileProvider) && (this.testProvider == x.testProvider) && (this.runProvider == x.runProvider) && (this.dependencySourcesProvider == x.dependencySourcesProvider) && (this.resourcesProvider == x.resourcesProvider) && (this.canReload == x.canReload) case x: BuildServerCapabilities => (this.compileProvider == x.compileProvider) && (this.testProvider == x.testProvider) && (this.runProvider == x.runProvider) && (this.dependencySourcesProvider == x.dependencySourcesProvider) && (this.resourcesProvider == x.resourcesProvider) && (this.canReload == x.canReload) && (this.jvmRunEnvironmentProvider == x.jvmRunEnvironmentProvider) && (this.jvmTestEnvironmentProvider == x.jvmTestEnvironmentProvider)
case _ => false case _ => false
}) })
override def hashCode: Int = { override def hashCode: Int = {
37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.BuildServerCapabilities".##) + compileProvider.##) + testProvider.##) + runProvider.##) + dependencySourcesProvider.##) + resourcesProvider.##) + canReload.##) 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.BuildServerCapabilities".##) + compileProvider.##) + testProvider.##) + runProvider.##) + dependencySourcesProvider.##) + resourcesProvider.##) + canReload.##) + jvmRunEnvironmentProvider.##) + jvmTestEnvironmentProvider.##)
} }
override def toString: String = { override def toString: String = {
"BuildServerCapabilities(" + compileProvider + ", " + testProvider + ", " + runProvider + ", " + dependencySourcesProvider + ", " + resourcesProvider + ", " + canReload + ")" "BuildServerCapabilities(" + compileProvider + ", " + testProvider + ", " + runProvider + ", " + dependencySourcesProvider + ", " + resourcesProvider + ", " + canReload + ", " + jvmRunEnvironmentProvider + ", " + jvmTestEnvironmentProvider + ")"
} }
private[this] def copy(compileProvider: Option[sbt.internal.bsp.CompileProvider] = compileProvider, testProvider: Option[sbt.internal.bsp.TestProvider] = testProvider, runProvider: Option[sbt.internal.bsp.RunProvider] = runProvider, dependencySourcesProvider: Option[Boolean] = dependencySourcesProvider, resourcesProvider: Option[Boolean] = resourcesProvider, canReload: Option[Boolean] = canReload): BuildServerCapabilities = { private[this] def copy(compileProvider: Option[sbt.internal.bsp.CompileProvider] = compileProvider, testProvider: Option[sbt.internal.bsp.TestProvider] = testProvider, runProvider: Option[sbt.internal.bsp.RunProvider] = runProvider, dependencySourcesProvider: Option[Boolean] = dependencySourcesProvider, resourcesProvider: Option[Boolean] = resourcesProvider, canReload: Option[Boolean] = canReload, jvmRunEnvironmentProvider: Option[Boolean] = jvmRunEnvironmentProvider, jvmTestEnvironmentProvider: Option[Boolean] = jvmTestEnvironmentProvider): BuildServerCapabilities = {
new BuildServerCapabilities(compileProvider, testProvider, runProvider, dependencySourcesProvider, resourcesProvider, canReload) new BuildServerCapabilities(compileProvider, testProvider, runProvider, dependencySourcesProvider, resourcesProvider, canReload, jvmRunEnvironmentProvider, jvmTestEnvironmentProvider)
} }
def withCompileProvider(compileProvider: Option[sbt.internal.bsp.CompileProvider]): BuildServerCapabilities = { def withCompileProvider(compileProvider: Option[sbt.internal.bsp.CompileProvider]): BuildServerCapabilities = {
copy(compileProvider = compileProvider) copy(compileProvider = compileProvider)
@ -70,9 +72,21 @@ final class BuildServerCapabilities private (
def withCanReload(canReload: Boolean): BuildServerCapabilities = { def withCanReload(canReload: Boolean): BuildServerCapabilities = {
copy(canReload = Option(canReload)) copy(canReload = Option(canReload))
} }
def withJvmRunEnvironmentProvider(jvmRunEnvironmentProvider: Option[Boolean]): BuildServerCapabilities = {
copy(jvmRunEnvironmentProvider = jvmRunEnvironmentProvider)
}
def withJvmRunEnvironmentProvider(jvmRunEnvironmentProvider: Boolean): BuildServerCapabilities = {
copy(jvmRunEnvironmentProvider = Option(jvmRunEnvironmentProvider))
}
def withJvmTestEnvironmentProvider(jvmTestEnvironmentProvider: Option[Boolean]): BuildServerCapabilities = {
copy(jvmTestEnvironmentProvider = jvmTestEnvironmentProvider)
}
def withJvmTestEnvironmentProvider(jvmTestEnvironmentProvider: Boolean): BuildServerCapabilities = {
copy(jvmTestEnvironmentProvider = Option(jvmTestEnvironmentProvider))
}
} }
object BuildServerCapabilities { object BuildServerCapabilities {
def apply(compileProvider: Option[sbt.internal.bsp.CompileProvider], testProvider: Option[sbt.internal.bsp.TestProvider], runProvider: Option[sbt.internal.bsp.RunProvider], dependencySourcesProvider: Option[Boolean], resourcesProvider: Option[Boolean], canReload: Option[Boolean]): BuildServerCapabilities = new BuildServerCapabilities(compileProvider, testProvider, runProvider, dependencySourcesProvider, resourcesProvider, canReload) def apply(compileProvider: Option[sbt.internal.bsp.CompileProvider], testProvider: Option[sbt.internal.bsp.TestProvider], runProvider: Option[sbt.internal.bsp.RunProvider], dependencySourcesProvider: Option[Boolean], resourcesProvider: Option[Boolean], canReload: Option[Boolean], jvmRunEnvironmentProvider: Option[Boolean], jvmTestEnvironmentProvider: Option[Boolean]): BuildServerCapabilities = new BuildServerCapabilities(compileProvider, testProvider, runProvider, dependencySourcesProvider, resourcesProvider, canReload, jvmRunEnvironmentProvider, jvmTestEnvironmentProvider)
def apply(compileProvider: sbt.internal.bsp.CompileProvider, testProvider: sbt.internal.bsp.TestProvider, runProvider: sbt.internal.bsp.RunProvider, dependencySourcesProvider: Boolean, resourcesProvider: Boolean, canReload: Boolean): BuildServerCapabilities = new BuildServerCapabilities(Option(compileProvider), Option(testProvider), Option(runProvider), Option(dependencySourcesProvider), Option(resourcesProvider), Option(canReload)) def apply(compileProvider: sbt.internal.bsp.CompileProvider, testProvider: sbt.internal.bsp.TestProvider, runProvider: sbt.internal.bsp.RunProvider, dependencySourcesProvider: Boolean, resourcesProvider: Boolean, canReload: Boolean, jvmRunEnvironmentProvider: Boolean, jvmTestEnvironmentProvider: Boolean): BuildServerCapabilities = new BuildServerCapabilities(Option(compileProvider), Option(testProvider), Option(runProvider), Option(dependencySourcesProvider), Option(resourcesProvider), Option(canReload), Option(jvmRunEnvironmentProvider), Option(jvmTestEnvironmentProvider))
} }

View File

@ -0,0 +1,48 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp
final class JvmEnvironmentItem private (
val target: sbt.internal.bsp.BuildTargetIdentifier,
val classpath: Vector[java.net.URI],
val jvmOptions: Vector[String],
val workingDirectory: String,
val environmentVariables: scala.collection.immutable.Map[String, String]) extends Serializable {
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
case x: JvmEnvironmentItem => (this.target == x.target) && (this.classpath == x.classpath) && (this.jvmOptions == x.jvmOptions) && (this.workingDirectory == x.workingDirectory) && (this.environmentVariables == x.environmentVariables)
case _ => false
})
override def hashCode: Int = {
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.JvmEnvironmentItem".##) + target.##) + classpath.##) + jvmOptions.##) + workingDirectory.##) + environmentVariables.##)
}
override def toString: String = {
"JvmEnvironmentItem(" + target + ", " + classpath + ", " + jvmOptions + ", " + workingDirectory + ", " + environmentVariables + ")"
}
private[this] def copy(target: sbt.internal.bsp.BuildTargetIdentifier = target, classpath: Vector[java.net.URI] = classpath, jvmOptions: Vector[String] = jvmOptions, workingDirectory: String = workingDirectory, environmentVariables: scala.collection.immutable.Map[String, String] = environmentVariables): JvmEnvironmentItem = {
new JvmEnvironmentItem(target, classpath, jvmOptions, workingDirectory, environmentVariables)
}
def withTarget(target: sbt.internal.bsp.BuildTargetIdentifier): JvmEnvironmentItem = {
copy(target = target)
}
def withClasspath(classpath: Vector[java.net.URI]): JvmEnvironmentItem = {
copy(classpath = classpath)
}
def withJvmOptions(jvmOptions: Vector[String]): JvmEnvironmentItem = {
copy(jvmOptions = jvmOptions)
}
def withWorkingDirectory(workingDirectory: String): JvmEnvironmentItem = {
copy(workingDirectory = workingDirectory)
}
def withEnvironmentVariables(environmentVariables: scala.collection.immutable.Map[String, String]): JvmEnvironmentItem = {
copy(environmentVariables = environmentVariables)
}
}
object JvmEnvironmentItem {
def apply(target: sbt.internal.bsp.BuildTargetIdentifier, classpath: Vector[java.net.URI], jvmOptions: Vector[String], workingDirectory: String, environmentVariables: scala.collection.immutable.Map[String, String]): JvmEnvironmentItem = new JvmEnvironmentItem(target, classpath, jvmOptions, workingDirectory, environmentVariables)
}

View File

@ -0,0 +1,40 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp
final class JvmRunEnvironmentParams private (
val targets: Vector[sbt.internal.bsp.BuildTargetIdentifier],
val originId: Option[String]) extends Serializable {
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
case x: JvmRunEnvironmentParams => (this.targets == x.targets) && (this.originId == x.originId)
case _ => false
})
override def hashCode: Int = {
37 * (37 * (37 * (17 + "sbt.internal.bsp.JvmRunEnvironmentParams".##) + targets.##) + originId.##)
}
override def toString: String = {
"JvmRunEnvironmentParams(" + targets + ", " + originId + ")"
}
private[this] def copy(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier] = targets, originId: Option[String] = originId): JvmRunEnvironmentParams = {
new JvmRunEnvironmentParams(targets, originId)
}
def withTargets(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): JvmRunEnvironmentParams = {
copy(targets = targets)
}
def withOriginId(originId: Option[String]): JvmRunEnvironmentParams = {
copy(originId = originId)
}
def withOriginId(originId: String): JvmRunEnvironmentParams = {
copy(originId = Option(originId))
}
}
object JvmRunEnvironmentParams {
def apply(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier], originId: Option[String]): JvmRunEnvironmentParams = new JvmRunEnvironmentParams(targets, originId)
def apply(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier], originId: String): JvmRunEnvironmentParams = new JvmRunEnvironmentParams(targets, Option(originId))
}

View File

@ -0,0 +1,40 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp
final class JvmRunEnvironmentResult private (
val items: Vector[sbt.internal.bsp.JvmEnvironmentItem],
val originId: Option[String]) extends Serializable {
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
case x: JvmRunEnvironmentResult => (this.items == x.items) && (this.originId == x.originId)
case _ => false
})
override def hashCode: Int = {
37 * (37 * (37 * (17 + "sbt.internal.bsp.JvmRunEnvironmentResult".##) + items.##) + originId.##)
}
override def toString: String = {
"JvmRunEnvironmentResult(" + items + ", " + originId + ")"
}
private[this] def copy(items: Vector[sbt.internal.bsp.JvmEnvironmentItem] = items, originId: Option[String] = originId): JvmRunEnvironmentResult = {
new JvmRunEnvironmentResult(items, originId)
}
def withItems(items: Vector[sbt.internal.bsp.JvmEnvironmentItem]): JvmRunEnvironmentResult = {
copy(items = items)
}
def withOriginId(originId: Option[String]): JvmRunEnvironmentResult = {
copy(originId = originId)
}
def withOriginId(originId: String): JvmRunEnvironmentResult = {
copy(originId = Option(originId))
}
}
object JvmRunEnvironmentResult {
def apply(items: Vector[sbt.internal.bsp.JvmEnvironmentItem], originId: Option[String]): JvmRunEnvironmentResult = new JvmRunEnvironmentResult(items, originId)
def apply(items: Vector[sbt.internal.bsp.JvmEnvironmentItem], originId: String): JvmRunEnvironmentResult = new JvmRunEnvironmentResult(items, Option(originId))
}

View File

@ -0,0 +1,40 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp
final class JvmTestEnvironmentParams private (
val targets: Vector[sbt.internal.bsp.BuildTargetIdentifier],
val originId: Option[String]) extends Serializable {
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
case x: JvmTestEnvironmentParams => (this.targets == x.targets) && (this.originId == x.originId)
case _ => false
})
override def hashCode: Int = {
37 * (37 * (37 * (17 + "sbt.internal.bsp.JvmTestEnvironmentParams".##) + targets.##) + originId.##)
}
override def toString: String = {
"JvmTestEnvironmentParams(" + targets + ", " + originId + ")"
}
private[this] def copy(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier] = targets, originId: Option[String] = originId): JvmTestEnvironmentParams = {
new JvmTestEnvironmentParams(targets, originId)
}
def withTargets(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): JvmTestEnvironmentParams = {
copy(targets = targets)
}
def withOriginId(originId: Option[String]): JvmTestEnvironmentParams = {
copy(originId = originId)
}
def withOriginId(originId: String): JvmTestEnvironmentParams = {
copy(originId = Option(originId))
}
}
object JvmTestEnvironmentParams {
def apply(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier], originId: Option[String]): JvmTestEnvironmentParams = new JvmTestEnvironmentParams(targets, originId)
def apply(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier], originId: String): JvmTestEnvironmentParams = new JvmTestEnvironmentParams(targets, Option(originId))
}

View File

@ -0,0 +1,40 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp
final class JvmTestEnvironmentResult private (
val items: Vector[sbt.internal.bsp.JvmEnvironmentItem],
val originId: Option[String]) extends Serializable {
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
case x: JvmTestEnvironmentResult => (this.items == x.items) && (this.originId == x.originId)
case _ => false
})
override def hashCode: Int = {
37 * (37 * (37 * (17 + "sbt.internal.bsp.JvmTestEnvironmentResult".##) + items.##) + originId.##)
}
override def toString: String = {
"JvmTestEnvironmentResult(" + items + ", " + originId + ")"
}
private[this] def copy(items: Vector[sbt.internal.bsp.JvmEnvironmentItem] = items, originId: Option[String] = originId): JvmTestEnvironmentResult = {
new JvmTestEnvironmentResult(items, originId)
}
def withItems(items: Vector[sbt.internal.bsp.JvmEnvironmentItem]): JvmTestEnvironmentResult = {
copy(items = items)
}
def withOriginId(originId: Option[String]): JvmTestEnvironmentResult = {
copy(originId = originId)
}
def withOriginId(originId: String): JvmTestEnvironmentResult = {
copy(originId = Option(originId))
}
}
object JvmTestEnvironmentResult {
def apply(items: Vector[sbt.internal.bsp.JvmEnvironmentItem], originId: Option[String]): JvmTestEnvironmentResult = new JvmTestEnvironmentResult(items, originId)
def apply(items: Vector[sbt.internal.bsp.JvmEnvironmentItem], originId: String): JvmTestEnvironmentResult = new JvmTestEnvironmentResult(items, Option(originId))
}

View File

@ -17,8 +17,10 @@ implicit lazy val BuildServerCapabilitiesFormat: JsonFormat[sbt.internal.bsp.Bui
val dependencySourcesProvider = unbuilder.readField[Option[Boolean]]("dependencySourcesProvider") val dependencySourcesProvider = unbuilder.readField[Option[Boolean]]("dependencySourcesProvider")
val resourcesProvider = unbuilder.readField[Option[Boolean]]("resourcesProvider") val resourcesProvider = unbuilder.readField[Option[Boolean]]("resourcesProvider")
val canReload = unbuilder.readField[Option[Boolean]]("canReload") val canReload = unbuilder.readField[Option[Boolean]]("canReload")
val jvmRunEnvironmentProvider = unbuilder.readField[Option[Boolean]]("jvmRunEnvironmentProvider")
val jvmTestEnvironmentProvider = unbuilder.readField[Option[Boolean]]("jvmTestEnvironmentProvider")
unbuilder.endObject() unbuilder.endObject()
sbt.internal.bsp.BuildServerCapabilities(compileProvider, testProvider, runProvider, dependencySourcesProvider, resourcesProvider, canReload) sbt.internal.bsp.BuildServerCapabilities(compileProvider, testProvider, runProvider, dependencySourcesProvider, resourcesProvider, canReload, jvmRunEnvironmentProvider, jvmTestEnvironmentProvider)
case None => case None =>
deserializationError("Expected JsObject but found None") deserializationError("Expected JsObject but found None")
} }
@ -31,6 +33,8 @@ implicit lazy val BuildServerCapabilitiesFormat: JsonFormat[sbt.internal.bsp.Bui
builder.addField("dependencySourcesProvider", obj.dependencySourcesProvider) builder.addField("dependencySourcesProvider", obj.dependencySourcesProvider)
builder.addField("resourcesProvider", obj.resourcesProvider) builder.addField("resourcesProvider", obj.resourcesProvider)
builder.addField("canReload", obj.canReload) builder.addField("canReload", obj.canReload)
builder.addField("jvmRunEnvironmentProvider", obj.jvmRunEnvironmentProvider)
builder.addField("jvmTestEnvironmentProvider", obj.jvmTestEnvironmentProvider)
builder.endObject() builder.endObject()
} }
} }

View File

@ -63,4 +63,9 @@ trait JsonProtocol extends sjsonnew.BasicJsonProtocol
with sbt.internal.bsp.codec.ResourcesParamsFormats with sbt.internal.bsp.codec.ResourcesParamsFormats
with sbt.internal.bsp.codec.ResourcesItemFormats with sbt.internal.bsp.codec.ResourcesItemFormats
with sbt.internal.bsp.codec.ResourcesResultFormats with sbt.internal.bsp.codec.ResourcesResultFormats
with sbt.internal.bsp.codec.JvmEnvironmentItemFormats
with sbt.internal.bsp.codec.JvmTestEnvironmentParamsFormats
with sbt.internal.bsp.codec.JvmTestEnvironmentResultFormats
with sbt.internal.bsp.codec.JvmRunEnvironmentParamsFormats
with sbt.internal.bsp.codec.JvmRunEnvironmentResultFormats
object JsonProtocol extends JsonProtocol object JsonProtocol extends JsonProtocol

View File

@ -0,0 +1,35 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp.codec
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait JvmEnvironmentItemFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val JvmEnvironmentItemFormat: JsonFormat[sbt.internal.bsp.JvmEnvironmentItem] = new JsonFormat[sbt.internal.bsp.JvmEnvironmentItem] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.JvmEnvironmentItem = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val target = unbuilder.readField[sbt.internal.bsp.BuildTargetIdentifier]("target")
val classpath = unbuilder.readField[Vector[java.net.URI]]("classpath")
val jvmOptions = unbuilder.readField[Vector[String]]("jvmOptions")
val workingDirectory = unbuilder.readField[String]("workingDirectory")
val environmentVariables = unbuilder.readField[scala.collection.immutable.Map[String, String]]("environmentVariables")
unbuilder.endObject()
sbt.internal.bsp.JvmEnvironmentItem(target, classpath, jvmOptions, workingDirectory, environmentVariables)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.JvmEnvironmentItem, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("target", obj.target)
builder.addField("classpath", obj.classpath)
builder.addField("jvmOptions", obj.jvmOptions)
builder.addField("workingDirectory", obj.workingDirectory)
builder.addField("environmentVariables", obj.environmentVariables)
builder.endObject()
}
}
}

View File

@ -0,0 +1,29 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp.codec
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait JvmRunEnvironmentParamsFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val JvmRunEnvironmentParamsFormat: JsonFormat[sbt.internal.bsp.JvmRunEnvironmentParams] = new JsonFormat[sbt.internal.bsp.JvmRunEnvironmentParams] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.JvmRunEnvironmentParams = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val targets = unbuilder.readField[Vector[sbt.internal.bsp.BuildTargetIdentifier]]("targets")
val originId = unbuilder.readField[Option[String]]("originId")
unbuilder.endObject()
sbt.internal.bsp.JvmRunEnvironmentParams(targets, originId)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.JvmRunEnvironmentParams, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("targets", obj.targets)
builder.addField("originId", obj.originId)
builder.endObject()
}
}
}

View File

@ -0,0 +1,29 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp.codec
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait JvmRunEnvironmentResultFormats { self: sbt.internal.bsp.codec.JvmEnvironmentItemFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val JvmRunEnvironmentResultFormat: JsonFormat[sbt.internal.bsp.JvmRunEnvironmentResult] = new JsonFormat[sbt.internal.bsp.JvmRunEnvironmentResult] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.JvmRunEnvironmentResult = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val items = unbuilder.readField[Vector[sbt.internal.bsp.JvmEnvironmentItem]]("items")
val originId = unbuilder.readField[Option[String]]("originId")
unbuilder.endObject()
sbt.internal.bsp.JvmRunEnvironmentResult(items, originId)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.JvmRunEnvironmentResult, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("items", obj.items)
builder.addField("originId", obj.originId)
builder.endObject()
}
}
}

View File

@ -0,0 +1,29 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp.codec
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait JvmTestEnvironmentParamsFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val JvmTestEnvironmentParamsFormat: JsonFormat[sbt.internal.bsp.JvmTestEnvironmentParams] = new JsonFormat[sbt.internal.bsp.JvmTestEnvironmentParams] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.JvmTestEnvironmentParams = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val targets = unbuilder.readField[Vector[sbt.internal.bsp.BuildTargetIdentifier]]("targets")
val originId = unbuilder.readField[Option[String]]("originId")
unbuilder.endObject()
sbt.internal.bsp.JvmTestEnvironmentParams(targets, originId)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.JvmTestEnvironmentParams, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("targets", obj.targets)
builder.addField("originId", obj.originId)
builder.endObject()
}
}
}

View File

@ -0,0 +1,29 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp.codec
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait JvmTestEnvironmentResultFormats { self: sbt.internal.bsp.codec.JvmEnvironmentItemFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val JvmTestEnvironmentResultFormat: JsonFormat[sbt.internal.bsp.JvmTestEnvironmentResult] = new JsonFormat[sbt.internal.bsp.JvmTestEnvironmentResult] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.JvmTestEnvironmentResult = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val items = unbuilder.readField[Vector[sbt.internal.bsp.JvmEnvironmentItem]]("items")
val originId = unbuilder.readField[Option[String]]("originId")
unbuilder.endObject()
sbt.internal.bsp.JvmTestEnvironmentResult(items, originId)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.JvmTestEnvironmentResult, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("items", obj.items)
builder.addField("originId", obj.originId)
builder.endObject()
}
}
}

View File

@ -208,6 +208,15 @@ type BuildServerCapabilities {
# The server sends notifications to the client on build # The server sends notifications to the client on build
# target change events via buildTarget/didChange # target change events via buildTarget/didChange
# buildTargetChangedProvider: Boolean # buildTargetChangedProvider: Boolean
# The JVM run/test environment request is sent from the client to the server
# in order to gather information required to launch a Java process.
# This is useful when the client wants to control the Java process execution,
# for example to enable custom Java agents or launch a custom main class during
# unit testing or debugging
jvmRunEnvironmentProvider: Boolean
jvmTestEnvironmentProvider: Boolean
} }
type CompileProvider { type CompileProvider {
@ -696,3 +705,34 @@ type ResourcesItem {
## List of resource files. ## List of resource files.
resources: [java.net.URI] resources: [java.net.URI]
} }
# JVM Environment requests
type JvmEnvironmentItem {
target: sbt.internal.bsp.BuildTargetIdentifier!
classpath: [java.net.URI]!
jvmOptions: [String]!
workingDirectory: String!
environmentVariables: StringStringMap!
}
type JvmTestEnvironmentParams {
targets: [sbt.internal.bsp.BuildTargetIdentifier]!
originId: String
}
type JvmTestEnvironmentResult{
items: [sbt.internal.bsp.JvmEnvironmentItem]!
originId: String
}
type JvmRunEnvironmentParams {
targets: [sbt.internal.bsp.BuildTargetIdentifier]!
originId: String
}
type JvmRunEnvironmentResult{
items: [sbt.internal.bsp.JvmEnvironmentItem]!
originId: String
}

View File

@ -1,6 +1,6 @@
lazy val check = taskKey[Unit]("") lazy val check = taskKey[Unit]("")
lazy val compile2 = taskKey[Unit]("") lazy val compile2 = taskKey[Unit]("")
lazy val scala212 = "2.12.15" lazy val scala212 = "2.12.16"
lazy val root = (project in file(".")) lazy val root = (project in file("."))
.aggregate(foo, bar, client) .aggregate(foo, bar, client)

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.15", "2.13.1") > set root/crossScalaVersions := Seq("2.12.16", "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,4 +1,4 @@
ThisBuild / scalaVersion := "2.12.15" ThisBuild / scalaVersion := "2.12.16"
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"com.novocode" % "junit-interface" % "0.5" % Test, "com.novocode" % "junit-interface" % "0.5" % Test,

View File

@ -1,4 +1,4 @@
ThisBuild / scalaVersion := "2.12.15" ThisBuild / scalaVersion := "2.12.16"
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % "1.7.2", "org.slf4j" % "slf4j-api" % "1.7.2",

View File

@ -1,5 +1,5 @@
// ThisBuild / useCoursier := false // ThisBuild / useCoursier := false
ThisBuild / scalaVersion := "2.12.15" ThisBuild / scalaVersion := "2.12.16"
ThisBuild / organization := "org.example" ThisBuild / organization := "org.example"
ThisBuild / version := "0.1" ThisBuild / version := "0.1"

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.15", scalaVersion := "2.12.16",
scalacOptions ++= Seq("-Xfatal-warnings", "-Xlint") scalacOptions ++= Seq("-Xfatal-warnings", "-Xlint")
) )

View File

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

View File

@ -1,4 +1,4 @@
ThisBuild / scalaVersion := "2.12.15" ThisBuild / scalaVersion := "2.12.16"
ThisBuild / semanticdbEnabled := true ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbIncludeInJar := true ThisBuild / semanticdbIncludeInJar := true

View File

@ -1,4 +1,4 @@
ThisBuild / scalaVersion := "2.12.15" ThisBuild / scalaVersion := "2.12.16"
import sbt.internal.CommandStrings.{ inspectBrief, inspectDetailed } import sbt.internal.CommandStrings.{ inspectBrief, inspectDetailed }
import sbt.internal.Inspect import sbt.internal.Inspect

View File

@ -1,4 +1,4 @@
> ++2.12.15! > ++2.12.16!
$ copy-file changes/B.scala B.scala $ copy-file changes/B.scala B.scala

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.15" ThisBuild / scalaVersion := "2.12.16"
lazy val root = (project in file(".")) lazy val root = (project in file("."))
.configs(OtherScala) .configs(OtherScala)

View File

@ -1,9 +1,8 @@
val scalatest = "org.scalatest" %% "scalatest" % "3.0.5" val scalatest = "org.scalatest" %% "scalatest" % "3.0.5"
val scalaxml = "org.scala-lang.modules" %% "scala-xml" % "1.1.1"
ThisBuild / scalaVersion := "2.12.12" ThisBuild / scalaVersion := "2.12.12"
lazy val root = (project in file(".")) lazy val root = (project in file("."))
.settings( .settings(
libraryDependencies ++= List(scalaxml, scalatest), libraryDependencies += scalatest % Test,
Test / parallelExecution := false Test / parallelExecution := false
) )

View File

@ -0,0 +1,3 @@
object MathFunction {
def times2(i: Int): Int = 2 * 2
}

View File

@ -0,0 +1,3 @@
object MathFunction {
def times2(i: Int): Int = i * 2
}

View File

@ -1,11 +1,10 @@
import org.scalatest.FlatSpec import org.scalatest.FlatSpec
import org.scalatest.matchers.ShouldMatchers
class Create extends FlatSpec with ShouldMatchers with Base { class Create extends FlatSpec with Base {
"a file" should "not exist" in { "a file" should "not exist" in {
A(new B).foo A(new B).foo
marker.exists should equal(false) assert(marker.exists == false)
marker.createNewFile() should equal (true) assert(marker.createNewFile() == true)
} }
} }

View File

@ -1,9 +1,8 @@
import org.scalatest.FlatSpec import org.scalatest.FlatSpec
import org.scalatest.matchers.ShouldMatchers
class Delete extends FlatSpec with ShouldMatchers with Base { class Delete extends FlatSpec with Base {
"a file" should "exist" in { "a file" should "exist" in {
marker.exists should equal(true) assert(marker.exists == true)
marker.delete() marker.delete()
} }

View File

@ -0,0 +1,7 @@
import org.scalatest.FlatSpec
class MathFunctionTest extends FlatSpec {
"times2" should "double the input" in {
assert(MathFunction.times2(4) == 8)
}
}

View File

@ -32,3 +32,9 @@ $ sleep 2000
-> testQuick Create -> testQuick Create
> testQuick Delete > testQuick Delete
> testQuick Create > testQuick Create
# https://github.com/sbt/sbt/issues/5504
$ copy-file changed/MathFunction.scala src/test/scala/MathFunction.scala
> compile
$ sleep 2000
-> testQuick MathFunctionTest

View File

@ -0,0 +1,3 @@
import sbt.watch.task.Build
val root = Build.root

View File

@ -0,0 +1,7 @@
# This tests that we can override the state transformation in the watch task
# In the build, watchOnEvent should return CancelWatch which should be successful, but we
# override watchTasks to fail the state instead
-> ~ root / setStringValue foo.txt bar
> checkStringValue foo.txt bar

View File

@ -1,3 +1,15 @@
import sbt.watch.task.Build watchOnIteration := { (count, project, commands) =>
Watch.CancelWatch
val root = Build.root }
watchOnTermination := { (action, count, command, state) =>
action match {
case Watch.CancelWatch =>
java.nio.file.Files.delete(java.nio.file.Paths.get("foo.txt"))
case Watch.HandleError(e) =>
if (e.getMessage == "fail")
java.nio.file.Files.delete(java.nio.file.Paths.get("bar.txt"))
else
throw new IllegalStateException("unexpected error")
}
state
}

View File

@ -1,7 +1,8 @@
# This tests that we can override the state transformation in the watch task $ exists foo.txt
# In the build, watchOnEvent should return CancelWatch which should be successful, but we > ~compile
# override watchTasks to fail the state instead $ absent foo.txt
> set watchOnIteration := { (_, _, _) => new Watch.HandleError(new IllegalStateException("fail")) }
$ exists bar.txt
-> ~compile
$ absent bar.txt
-> ~ root / setStringValue foo.txt bar
> checkStringValue foo.txt bar

View File

@ -1,10 +1,16 @@
ThisBuild / scalaVersion := "2.13.1" ThisBuild / scalaVersion := "2.13.8"
Global / serverLog / logLevel := Level.Debug Global / serverLog / logLevel := Level.Debug
lazy val runAndTest = project.in(file("run-and-test")) lazy val runAndTest = project.in(file("run-and-test"))
.settings( .settings(
libraryDependencies += "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % "2.13.11",
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.8" % "test", libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.8" % "test",
Compile / javaOptions := Vector("Xmx256M"),
Compile / envVars := Map("KEY" -> "VALUE"),
Test / javaOptions := Vector("Xmx512M"),
Test / envVars := Map("KEY_TEST" -> "VALUE_TEST"),
) )
.dependsOn(util) .dependsOn(util)

View File

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

View File

@ -157,7 +157,7 @@ object BuildServerTest extends AbstractServerTest {
assert(processing("buildTarget/scalacOptions")) assert(processing("buildTarget/scalacOptions"))
assert(svr.waitForString(10.seconds) { s => assert(svr.waitForString(10.seconds) { s =>
(s contains """"id":"40"""") && (s contains """"id":"40"""") &&
(s contains "scala-library-2.13.1.jar") (s contains "scala-library-2.13.8.jar")
}) })
} }
@ -311,6 +311,49 @@ object BuildServerTest extends AbstractServerTest {
}) })
} }
test("buildTarget/jvmRunEnvironment") { _ =>
val buildTarget = buildTargetUri("runAndTest", "Compile")
svr.sendJsonRpc(
s"""|{ "jsonrpc": "2.0",
| "id": "97",
| "method": "buildTarget/jvmRunEnvironment",
| "params": { "targets": [{ "uri": "$buildTarget" }] }
|}""".stripMargin
)
assert(processing("buildTarget/jvmRunEnvironment"))
assert {
svr.waitForString(10.seconds) { s =>
(s contains """"id":"97"""") &&
(s contains "jsoniter-scala-core_2.13-2.13.11.jar") && // compile dependency
(s contains "\"jvmOptions\":[\"Xmx256M\"]") &&
(s contains "\"environmentVariables\":{\"KEY\":\"VALUE\"}") &&
(s contains "/buildserver/run-and-test/") // working directory
}
}
}
test("buildTarget/jvmTestEnvironment") { _ =>
val buildTarget = buildTargetUri("runAndTest", "Test")
svr.sendJsonRpc(
s"""|{ "jsonrpc": "2.0",
| "id": "98",
| "method": "buildTarget/jvmTestEnvironment",
| "params": { "targets": [{ "uri": "$buildTarget" }] }
|}""".stripMargin
)
assert(processing("buildTarget/jvmTestEnvironment"))
assert {
svr.waitForString(10.seconds) { s =>
(s contains """"id":"98"""") &&
// test depends on compile so it has dependencies from both
(s contains "jsoniter-scala-core_2.13-2.13.11.jar") && // compile dependency
(s contains "scalatest_2.13-3.0.8.jar") && // test dependency
(s contains "\"jvmOptions\":[\"Xmx512M\"]") &&
(s contains "\"environmentVariables\":{\"KEY_TEST\":\"VALUE_TEST\"}")
}
}
}
test("buildTarget/scalaTestClasses") { _ => test("buildTarget/scalaTestClasses") { _ =>
val buildTarget = buildTargetUri("runAndTest", "Test") val buildTarget = buildTargetUri("runAndTest", "Test")
val badBuildTarget = buildTargetUri("badBuildTarget", "Test") val badBuildTarget = buildTargetUri("badBuildTarget", "Test")