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:
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
SCALA_212: 2.12.15
SCALA_213: 2.13.6
SCALA_212: 2.12.16
SCALA_213: 2.13.8
SCALA_3: 3.1.0
UTIL_TESTS: "utilCache/test utilControl/test utilInterface/test utilLogging/test utilPosition/test utilRelation/test utilScripted/test utilTracking/test"
SBT_LOCAL: false
@ -80,18 +80,18 @@ jobs:
ref: develop
path: zinc
- name: Setup JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: "${{ matrix.distribution }}"
java-version: "${{ matrix.java }}"
- name: Set up Python 3.7
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Coursier cache
uses: coursier/cache-action@v6
- name: Cache sbt
uses: actions/cache@v2.1.7
uses: actions/cache@v3
with:
path: ~/.sbt
key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

View File

@ -151,14 +151,14 @@ suite with `sbt testOnly`
#### 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
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).
You can run the integration tests with the `sbt scripted` sbt
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"

View File

@ -10,7 +10,7 @@ import scala.util.Try
// ThisBuild settings take lower precedence,
// but can be shared across the multi projects.
ThisBuild / version := {
val v = "1.6.3-SNAPSHOT"
val v = "1.7.0-SNAPSHOT"
nightlyVersion.getOrElse(v)
}
ThisBuild / version2_13 := "2.0.0-SNAPSHOT"
@ -46,7 +46,7 @@ ThisBuild / resolvers += Resolver.mavenLocal
Global / semanticdbEnabled := !(Global / insideCI).value
// 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")
Global / excludeLint := (Global / excludeLint).?.value.getOrElse(Set.empty)
Global / excludeLint += componentID
@ -1057,6 +1057,7 @@ lazy val mainProj = (project in file("main"))
exclude[DirectMissingMethodProblem]("sbt.Defaults.earlyArtifactPathSetting"),
exclude[MissingClassProblem]("sbt.internal.server.BuildServerReporter$"),
exclude[IncompatibleTemplateDefProblem]("sbt.internal.server.BuildServerReporter"),
exclude[MissingClassProblem]("sbt.internal.CustomHttp*"),
)
)
.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;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
public interface Problem {
@ -26,4 +28,24 @@ public interface Problem {
default Optional<String> rendered() {
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)
throws ServerAlreadyBootingException, IOException {
final Path base = configuration.baseDirectory().toPath().toRealPath();
final Path target = base.resolve("project").resolve("target");
if (!isWindows) {
final String actualSocketLocation = socketLocation(base);
final Path target = Paths.get(actualSocketLocation).getParent();
if (!Files.isDirectory(target)) Files.createDirectories(target);
socketFile = Paths.get(socketLocation(base));
socketFile = Paths.get(actualSocketLocation);
} else {
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");
long hash = LongHashFunction.farmNa().hashBytes(target.toString().getBytes("UTF-8"));
if (isWindows) {
long hash = LongHashFunction.farmNa().hashBytes(target.toString().getBytes("UTF-8"));
return "sbt-load" + hash;
} 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) =>
val newState = s
.copy(
onFailure = Some(Exec(Shell, None)),
onFailure = Some(Exec(OldShell, None)),
remainingCommands = Exec(line, s.source) +: Exec(OldShell, None) +: s.remainingCommands
)
.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,
* 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
@ -78,15 +78,15 @@ trait ConsoleInterface {
* needs to start it. It also contains the sbt command
* arguments to send to the server if any are present.
* @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
* is not hardcoded to System.in so that a NetworkClient
* 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.
* It is usually System.err but could be overridden in tests
* 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
* System.out but in the case of completions, the bytes written
* to System.out are usually treated as completion results
@ -139,7 +139,7 @@ class NetworkClient(
private val rebooting = new AtomicBoolean(false)
private lazy val noTab = arguments.completionArguments.contains("--no-tab")
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)

View File

@ -75,7 +75,7 @@ private[sbt] object UITask {
this.synchronized(this.wait())
Right("") // should be unreachable
// 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 Some(s: String) =>
s.trim() match {

View File

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

View File

@ -43,7 +43,7 @@ import sbt.internal.librarymanagement.mavenint.{
PomExtraDependencyAttributes,
SbtPomExtraProperties
}
import sbt.internal.librarymanagement.{ CustomHttp => _, _ }
import sbt.internal.librarymanagement._
import sbt.internal.nio.{ CheckBuildSources, Globs }
import sbt.internal.server.{
BspCompileProgress,
@ -258,8 +258,6 @@ object Defaults extends BuildCommon {
artifactClassifier :== None,
checksums := Classpaths.bootChecksums(appConfiguration.value),
conflictManager := ConflictManager.default,
CustomHttp.okhttpClientBuilder :== CustomHttp.defaultHttpClientBuilder,
CustomHttp.okhttpClient := CustomHttp.okhttpClientBuilder.value.build,
pomExtra :== NodeSeq.Empty,
pomPostProcess :== idFun,
pomAllRepositories :== false,
@ -1395,11 +1393,10 @@ object Defaults extends BuildCommon {
val x = {
import analysis.{ apis, relations => rel }
rel.internalClassDeps(c).map(intlStamp(_, analysis, s + c)) ++
rel.externalDeps(c).map(stamp) +
(apis.internal.get(c) match {
case Some(x) => x.compilationTimestamp
case _ => Long.MinValue
})
rel.externalDeps(c).map(stamp) ++
rel.productClassName.reverse(c).flatMap { pc =>
apis.internal.get(pc).map(_.compilationTimestamp)
} + Long.MinValue
}.max
if (x != Long.MinValue) {
stamps(c) = x
@ -2641,7 +2638,7 @@ object Defaults extends BuildCommon {
def dependencyResolutionTask: Def.Initialize[Task[DependencyResolution]] =
Def.taskIf {
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
},
dependencyResolution := dependencyResolutionTask.value,
publisher := IvyPublisher(ivyConfiguration.value, CustomHttp.okhttpClient.value),
publisher := IvyPublisher(ivyConfiguration.value),
ivyConfiguration := mkIvyConfiguration.value,
ivyConfigurations := {
val confs = thisProject.value.configurations
@ -3368,7 +3365,7 @@ object Classpaths {
private[sbt] def ivySbt0: Initialize[Task[IvySbt]] =
Def.task {
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 {
val deps = allDependencies.value.toVector
@ -4387,7 +4384,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
}
@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"
)
def externalIvyFile(

View File

@ -396,6 +396,7 @@ object Keys {
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)
// BSP keys
val bspConfig = taskKey[Unit]("Create or update the BSP connection files").withRank(DSetting)
val bspEnabled = SettingKey[Boolean](BasicKeys.bspEnabled)
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 bspBuildTargetScalacOptions = inputKey[Unit]("").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 bspScalaTestClassesItem = taskKey[Seq[ScalaTestClassesItem]]("").withRank(DTask)
val bspScalaMainClasses = inputKey[Unit]("Corresponds to buildTarget/scalaMainClasses request").withRank(DTask)

View File

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

View File

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

View File

@ -99,7 +99,7 @@ private[sbt] object PluginCross {
VersionNumber(sv) match {
case VersionNumber(Seq(0, 12, _*), _, _) => "2.9.2"
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")
}
}

View File

@ -18,12 +18,12 @@ trait UpperStateOps extends Any {
/**
* ProjectRef to the current project of the state session that can be change using
* `project` commmand.
* `project` command.
*/
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

View File

@ -70,23 +70,10 @@ $PrintCommand <task>
def pluginsDetailed = pluginsBrief // TODO: expand
val LastCommand = "last"
val OldLastGrepCommand = "last-grep"
val LastGrepCommand = "lastGrep"
val ExportCommand = "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 =
(LastGrepCommand, "Shows lines from the last output for 'key' that match 'pattern'.")
val lastGrepDetailed =

View File

@ -1128,7 +1128,28 @@ private[sbt] object Continuous extends DeprecatedContinuous {
val callbacks: Callbacks,
val dynamicInputs: mutable.Set[DynamicInput],
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 incremented: ContinuousState = withCount(count + 1)
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.Run(commands) =>
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 "; ")
case _ => stop
}
@ -1353,27 +1375,31 @@ private[sbt] object ContinuousCommands {
}
cs.afterCommand(postState)
}
private[sbt] val stopWatchCommand = watchCommand(stopWatch) { (channel, state) =>
state.get(watchStates).flatMap(_.get(channel)) match {
case Some(cs) =>
val afterWatchState = cs.afterWatch(state)
cs.callbacks.onExit()
StandardMain.exchange
.channelForName(channel)
.foreach { c =>
c.terminal.setPrompt(Prompt.Pending)
c.unprompt(ConsoleUnpromptEvent(Some(CommandSource(channel))))
private[this] val exitWatchShared = (error: Boolean) =>
(channel: String, state: State) =>
state.get(watchStates).flatMap(_.get(channel)) match {
case Some(cs) =>
val afterWatchState = cs.afterWatch(state)
cs.callbacks.onExit()
StandardMain.exchange
.channelForName(channel)
.foreach { c =>
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 {
case None => afterWatchState
case Some(w) => afterWatchState.put(watchStates, w - channel)
}
case _ => state
}
}
private[sbt] val failWatchCommand = watchCommand(failWatch) { (channel, state) =>
state.fail
}
val commands = cs.commands.mkString("; ")
val count = cs.count
val action = cs.failAction.getOrElse(Watch.CancelWatch)
val st = cs.callbacks.onTermination(action, commands, count, newState)
if (error) st.fail else st
case _ => if (error) state.fail else state
}
private[sbt] val stopWatchCommand = watchCommand(stopWatch)(exitWatchShared(false))
private[sbt] val failWatchCommand = watchCommand(failWatch)(exitWatchShared(true))
/*
* Creates a FileTreeRepository where it is safe to call close without inadvertently cancelling
* 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 := {
Credentials.register(credentials.value, streams.value.log)
val config0 = ivyConfiguration.value
new IvySbt(config0, sbt.internal.CustomHttp.okhttpClient.value)
new IvySbt(config0)
},
)
) ++ inTask(pullRemoteCache)(

View File

@ -65,7 +65,9 @@ object BuildServerProtocol {
RunProvider(BuildServerConnection.languages),
dependencySourcesProvider = true,
resourcesProvider = true,
canReload = true
canReload = true,
jvmRunEnvironmentProvider = true,
jvmTestEnvironmentProvider = true,
)
private val bspReload = "bspReload"
@ -119,11 +121,7 @@ object BuildServerProtocol {
}
}.value,
// https://github.com/build-server-protocol/build-server-protocol/blob/master/docs/specification.md#build-target-sources-request
bspBuildTargetSources := Def.inputTaskDyn {
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)
bspBuildTargetSources := bspInputTask { (state, _, workspace, filter) =>
// run the worker task concurrently
Def.task {
val items = bspBuildTargetSourcesItem.result.all(filter).value
@ -147,64 +145,48 @@ object BuildServerProtocol {
}
val successfulItems = anyOrThrow(items ++ buildItems)
val result = SourcesResult(successfulItems.toVector)
s.respondEvent(result)
state.respondEvent(result)
}
}.evaluated,
bspBuildTargetSources / aggregate := false,
bspBuildTargetResources := Def.inputTaskDyn {
val s = state.value
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)
bspBuildTargetResources := bspInputTask { (state, _, workspace, filter) =>
workspace.warnIfBuildsNonEmpty(Method.Resources, state.log)
// run the worker task concurrently
Def.task {
val items = bspBuildTargetResourcesItem.result.all(filter).value
val successfulItems = anyOrThrow(items)
val result = ResourcesResult(successfulItems.toVector)
s.respondEvent(result)
state.respondEvent(result)
}
}.evaluated,
bspBuildTargetResources / aggregate := false,
bspBuildTargetDependencySources := Def.inputTaskDyn {
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)
bspBuildTargetDependencySources := bspInputTask { (state, _, workspace, filter) =>
// run the worker task concurrently
Def.task {
import sbt.internal.bsp.codec.JsonProtocol._
val items = bspBuildTargetDependencySourcesItem.result.all(filter).value
val successfulItems = anyOrThrow(items)
val result = DependencySourcesResult(successfulItems.toVector)
s.respondEvent(result)
state.respondEvent(result)
}
}.evaluated,
bspBuildTargetDependencySources / aggregate := false,
bspBuildTargetCompile := Def.inputTaskDyn {
val s: State = state.value
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)
bspBuildTargetCompile := bspInputTask { (state, _, workspace, filter) =>
workspace.warnIfBuildsNonEmpty(Method.Compile, state.log)
Def.task {
val statusCodes = Keys.bspBuildTargetCompileItem.result.all(filter).value
val aggregatedStatusCode = allOrThrow(statusCodes) match {
case Seq() => StatusCode.Success
case codes => codes.max
}
s.respondEvent(BspCompileResult(None, aggregatedStatusCode))
state.respondEvent(BspCompileResult(None, aggregatedStatusCode))
}
}.evaluated,
bspBuildTargetCompile / aggregate := false,
bspBuildTargetTest := bspTestTask.evaluated,
bspBuildTargetTest / aggregate := false,
bspBuildTargetCleanCache := Def.inputTaskDyn {
val s: State = state.value
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)
bspBuildTargetCleanCache := bspInputTask { (state, targets, workspace, filter) =>
workspace.warnIfBuildsNonEmpty(Method.CleanCache, state.log)
Def.task {
val results = Keys.clean.result.all(filter).value
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.
// When rebuilding a single module, the root build isn't sent, just the requested targets.
val cleaned = successes + workspace.builds.size == targets.size
s.respondEvent(CleanCacheResult(None, cleaned))
state.respondEvent(CleanCacheResult(None, cleaned))
}
}.evaluated,
bspBuildTargetCleanCache / aggregate := false,
bspBuildTargetScalacOptions := Def.inputTaskDyn {
val s = state.value
val targets = spaceDelimited().parsed.map(uri => BuildTargetIdentifier(URI.create(uri)))
val workspace = bspFullWorkspace.value.filter(targets)
bspBuildTargetScalacOptions := bspInputTask { (state, _, workspace, filter) =>
val builds = workspace.builds
val filter = ScopeFilter.in(workspace.scopes.values.toList)
Def.task {
val items = bspBuildTargetScalacOptionsItem.result.all(filter).value
val appProvider = appConfiguration.value.provider()
@ -246,34 +222,26 @@ object BuildServerProtocol {
}
val successfulItems = anyOrThrow(items ++ buildItems)
val result = ScalacOptionsResult(successfulItems.toVector)
s.respondEvent(result)
state.respondEvent(result)
}
}.evaluated,
bspBuildTargetScalacOptions / aggregate := false,
bspScalaTestClasses := Def.inputTaskDyn {
val s = state.value
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)
bspScalaTestClasses := bspInputTask { (state, _, workspace, filter) =>
workspace.warnIfBuildsNonEmpty(Method.ScalaTestClasses, state.log)
Def.task {
val items = bspScalaTestClassesItem.result.all(filter).value
val successfulItems = anyOrThrow(items).flatten.toVector
val result = ScalaTestClassesResult(successfulItems.toVector, None)
s.respondEvent(result)
state.respondEvent(result)
}
}.evaluated,
bspScalaMainClasses := Def.inputTaskDyn {
val s = state.value
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)
bspScalaMainClasses := bspInputTask { (state, _, workspace, filter) =>
workspace.warnIfBuildsNonEmpty(Method.ScalaMainClasses, state.log)
Def.task {
val items = bspScalaMainClassesItem.result.all(filter).value
val successfulItems = anyOrThrow(items)
val result = ScalaMainClassesResult(successfulItems.toVector, None)
s.respondEvent(result)
state.respondEvent(result)
}
}.evaluated,
bspScalaMainClasses / aggregate := false
@ -315,6 +283,23 @@ object BuildServerProtocol {
bspBuildTargetCompileItem := bspCompileTask.value,
bspBuildTargetRun := bspRunTask.evaluated,
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,
bspScalaTestClassesItem := scalaTestClassesTask.value,
bspScalaMainClassesItem := scalaMainClassesTask.value,
@ -344,6 +329,8 @@ object BuildServerProtocol {
final val Run = "buildTarget/run"
final val CleanCache = "buildTarget/cleanCache"
final val ScalacOptions = "buildTarget/scalacOptions"
final val JvmRunEnvironment = "buildTarget/jvmRunEnvironment"
final val JvmTestEnvironment = "buildTarget/jvmTestEnvironment"
final val ScalaTestClasses = "buildTarget/scalaTestClasses"
final val ScalaMainClasses = "buildTarget/scalaMainClasses"
final val Exit = "build/exit"
@ -443,6 +430,18 @@ object BuildServerProtocol {
val command = Keys.bspBuildTargetScalacOptions.key
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 =>
val param = Converter.fromJson[ScalaTestClassesParams](json(r)).get
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 {
val target = Keys.bspTargetIdentifier.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.
*
* @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
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,
semanticdbIncludeInJar := false,
semanticdbOptions := List(),
semanticdbVersion := "4.4.28"
semanticdbVersion := "4.5.9"
)
override lazy val projectSettings: Seq[Def.Setting[_]] = Seq(

View File

@ -4,8 +4,8 @@ import sbt.contraband.ContrabandPlugin.autoImport._
object Dependencies {
// WARNING: Please Scala update versions in PluginCross.scala too
val scala212 = "2.12.15"
val scala213 = "2.13.6"
val scala212 = "2.12.16"
val scala213 = "2.13.8"
val checkPluginCross = settingKey[Unit]("Make sure scalaVersion match up")
val baseScalaVersion = scala212
def nightlyVersion: Option[String] =
@ -14,8 +14,8 @@ object Dependencies {
// sbt modules
private val ioVersion = nightlyVersion.getOrElse("1.6.0")
private val lmVersion =
sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.6.1")
val zincVersion = nightlyVersion.getOrElse("1.6.0")
sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.7.0-M1")
val zincVersion = nightlyVersion.getOrElse("1.7.0-M2")
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 dependencySourcesProvider: 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 {
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
})
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 = {
"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 = {
new BuildServerCapabilities(compileProvider, testProvider, runProvider, dependencySourcesProvider, resourcesProvider, canReload)
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, jvmRunEnvironmentProvider, jvmTestEnvironmentProvider)
}
def withCompileProvider(compileProvider: Option[sbt.internal.bsp.CompileProvider]): BuildServerCapabilities = {
copy(compileProvider = compileProvider)
@ -70,9 +72,21 @@ final class BuildServerCapabilities private (
def withCanReload(canReload: Boolean): BuildServerCapabilities = {
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 {
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: 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: 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, 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 resourcesProvider = unbuilder.readField[Option[Boolean]]("resourcesProvider")
val canReload = unbuilder.readField[Option[Boolean]]("canReload")
val jvmRunEnvironmentProvider = unbuilder.readField[Option[Boolean]]("jvmRunEnvironmentProvider")
val jvmTestEnvironmentProvider = unbuilder.readField[Option[Boolean]]("jvmTestEnvironmentProvider")
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 =>
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("resourcesProvider", obj.resourcesProvider)
builder.addField("canReload", obj.canReload)
builder.addField("jvmRunEnvironmentProvider", obj.jvmRunEnvironmentProvider)
builder.addField("jvmTestEnvironmentProvider", obj.jvmTestEnvironmentProvider)
builder.endObject()
}
}

View File

@ -63,4 +63,9 @@ trait JsonProtocol extends sjsonnew.BasicJsonProtocol
with sbt.internal.bsp.codec.ResourcesParamsFormats
with sbt.internal.bsp.codec.ResourcesItemFormats
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

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
# target change events via buildTarget/didChange
# 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 {
@ -696,3 +705,34 @@ type ResourcesItem {
## List of resource files.
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 compile2 = taskKey[Unit]("")
lazy val scala212 = "2.12.15"
lazy val scala212 = "2.12.16"
lazy val root = (project in file("."))
.aggregate(foo, bar, client)

View File

@ -17,7 +17,7 @@
## test + with command or alias
> clean
## 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
$ exists foo/target/scala-2.12
$ exists foo/target/scala-2.13

View File

@ -1,4 +1,4 @@
ThisBuild / scalaVersion := "2.12.15"
ThisBuild / scalaVersion := "2.12.16"
libraryDependencies ++= Seq(
"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(
"org.slf4j" % "slf4j-api" % "1.7.2",

View File

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

View File

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

View File

@ -1,6 +1,6 @@
lazy val root = project.in(file("."))
.settings(
scalaVersion := "2.12.15",
scalaVersion := "2.12.16",
sbtPlugin := true,
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 / 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.Inspect

View File

@ -1,4 +1,4 @@
> ++2.12.15!
> ++2.12.16!
$ 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 junitinterface = "com.novocode" % "junit-interface" % "0.11"
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("."))
.configs(OtherScala)

View File

@ -1,9 +1,8 @@
val scalatest = "org.scalatest" %% "scalatest" % "3.0.5"
val scalaxml = "org.scala-lang.modules" %% "scala-xml" % "1.1.1"
ThisBuild / scalaVersion := "2.12.12"
lazy val root = (project in file("."))
.settings(
libraryDependencies ++= List(scalaxml, scalatest),
libraryDependencies += scalatest % Test,
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.matchers.ShouldMatchers
class Create extends FlatSpec with ShouldMatchers with Base {
class Create extends FlatSpec with Base {
"a file" should "not exist" in {
A(new B).foo
marker.exists should equal(false)
marker.createNewFile() should equal (true)
assert(marker.exists == false)
assert(marker.createNewFile() == true)
}
}

View File

@ -1,9 +1,8 @@
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 {
marker.exists should equal(true)
assert(marker.exists == true)
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 Delete
> 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
val root = Build.root
watchOnIteration := { (count, project, commands) =>
Watch.CancelWatch
}
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
# In the build, watchOnEvent should return CancelWatch which should be successful, but we
# override watchTasks to fail the state instead
$ exists foo.txt
> ~compile
$ 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
lazy val runAndTest = project.in(file("run-and-test"))
.settings(
libraryDependencies += "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % "2.13.11",
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)

View File

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

View File

@ -157,7 +157,7 @@ object BuildServerTest extends AbstractServerTest {
assert(processing("buildTarget/scalacOptions"))
assert(svr.waitForString(10.seconds) { s =>
(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") { _ =>
val buildTarget = buildTargetUri("runAndTest", "Test")
val badBuildTarget = buildTargetUri("badBuildTarget", "Test")