mirror of https://github.com/sbt/sbt.git
Merge branch '1.10.x' into commands-progress
This commit is contained in:
commit
d53ccda9c4
|
|
@ -53,7 +53,6 @@ jobs:
|
|||
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.18
|
||||
SCALA_213: 2.13.11
|
||||
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
|
||||
|
|
@ -63,21 +62,21 @@ jobs:
|
|||
SPARK_LOCAL_IP: "127.0.0.1"
|
||||
steps:
|
||||
- name: Checkout sbt/sbt
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout sbt/io
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: sbt/io
|
||||
ref: develop
|
||||
path: io
|
||||
- name: Checkout sbt/librarymanagement
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: sbt/librarymanagement
|
||||
ref: develop
|
||||
path: librarymanagement
|
||||
- name: Checkout sbt/zinc
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: sbt/zinc
|
||||
ref: develop
|
||||
|
|
@ -120,7 +119,7 @@ jobs:
|
|||
./sbt -v --client "serverTestProj/test"
|
||||
./sbt -v --client doc
|
||||
./sbt -v --client "all $UTIL_TESTS"
|
||||
./sbt -v --client ++$SCALA_213
|
||||
./sbt -v --client ++2.13.x
|
||||
./sbt -v --client "all $UTIL_TESTS"
|
||||
- name: Build and test (2)
|
||||
if: ${{ matrix.jobtype == 2 }}
|
||||
|
|
@ -141,7 +140,7 @@ jobs:
|
|||
if: ${{ matrix.jobtype == 5 }}
|
||||
shell: bash
|
||||
run: |
|
||||
./sbt -v "++$SCALA_213!; test; ++$SCALA_3!; all utilControl/test utilRelation/test utilPosition/test"
|
||||
./sbt -v "++2.13.x; all utilControl/test utilRelation/test utilPosition/test; ++$SCALA_3!; all utilControl/test utilRelation/test utilPosition/test"
|
||||
- name: Build and test (6)
|
||||
if: ${{ matrix.jobtype == 6 }}
|
||||
shell: bash
|
||||
|
|
@ -153,7 +152,7 @@ jobs:
|
|||
cd ../
|
||||
sbt -Dsbtlm.path=$HOME/work/sbt/sbt/librarymanagement -Dsbtzinc.path=$HOME/work/sbt/sbt/zinc -Dsbt.build.version=$BUILD_VERSION -Dsbt.build.fatal=false "+lowerUtils/publishLocal; {librarymanagement}/publishLocal; {zinc}/publishLocal; upperModules/publishLocal"
|
||||
rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true
|
||||
sbt -v -Dsbt.version=$BUILD_VERSION "++$SCALA_213; all $UTIL_TESTS; ++$SCALA_212; all $UTIL_TESTS; scripted actions/* source-dependencies/*1of3 dependency-management/*1of4 java/*"
|
||||
sbt -v -Dsbt.version=$BUILD_VERSION "++2.13.x; all $UTIL_TESTS; ++$SCALA_212; all $UTIL_TESTS; scripted actions/* source-dependencies/*1of3 dependency-management/*1of4 java/*"
|
||||
- name: Build and test (7)
|
||||
if: ${{ matrix.jobtype == 7 }}
|
||||
shell: bash
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ jobs:
|
|||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Check CLA
|
||||
env:
|
||||
AUTHOR: ${{ github.event.pull_request.user.login }}
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@ jobs:
|
|||
name: Submit Dependency Graph
|
||||
runs-on: ubuntu-latest # or windows-latest, or macOS-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: scalacenter/sbt-dependency-submission@v2
|
||||
|
|
|
|||
|
|
@ -21,21 +21,21 @@ jobs:
|
|||
JAVA_OPTS: -Xms800M -Xmx800M -Xss6M -XX:ReservedCodeCacheSize=128M -server -Dsbt.io.virtual=false -Dfile.encoding=UTF-8
|
||||
steps:
|
||||
- name: Checkout sbt/sbt
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout sbt/io
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: sbt/io
|
||||
ref: develop
|
||||
path: io
|
||||
- name: Checkout sbt/librarymanagement
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: sbt/librarymanagement
|
||||
ref: develop
|
||||
path: librarymanagement
|
||||
- name: Checkout sbt/zinc
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: sbt/zinc
|
||||
ref: develop
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import scala.util.Try
|
|||
// ThisBuild settings take lower precedence,
|
||||
// but can be shared across the multi projects.
|
||||
ThisBuild / version := {
|
||||
val v = "1.9.4-SNAPSHOT"
|
||||
val v = "1.9.7-SNAPSHOT"
|
||||
nightlyVersion.getOrElse(v)
|
||||
}
|
||||
ThisBuild / version2_13 := "2.0.0-SNAPSHOT"
|
||||
|
|
@ -177,7 +177,9 @@ def mimaSettingsSince(versions: Seq[String]): Seq[Def.Setting[_]] = Def settings
|
|||
exclude[DirectMissingMethodProblem]("sbt.PluginData.copy"),
|
||||
exclude[DirectMissingMethodProblem]("sbt.PluginData.this"),
|
||||
exclude[IncompatibleResultTypeProblem]("sbt.EvaluateTask.executeProgress"),
|
||||
exclude[DirectMissingMethodProblem]("sbt.Keys.currentTaskProgress")
|
||||
exclude[DirectMissingMethodProblem]("sbt.Keys.currentTaskProgress"),
|
||||
exclude[IncompatibleResultTypeProblem]("sbt.PluginData.copy$default$10")
|
||||
|
||||
),
|
||||
)
|
||||
|
||||
|
|
@ -208,7 +210,6 @@ lazy val sbtRoot: Project = (project in file("."))
|
|||
scalacOptions += "-Ymacro-expand:none", // for both sxr and doc
|
||||
Util.publishPomSettings,
|
||||
otherRootSettings,
|
||||
Transform.conscriptSettings(bundledLauncherProj),
|
||||
publish := {},
|
||||
publishLocal := {},
|
||||
publish / skip := true,
|
||||
|
|
@ -369,7 +370,7 @@ lazy val utilPosition = (project in file("internal") / "util-position")
|
|||
)
|
||||
|
||||
lazy val utilLogging = (project in file("internal") / "util-logging")
|
||||
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
|
||||
.enablePlugins(ContrabandPlugin, JsonCodecPlugin
|
||||
.dependsOn(utilInterface, collectionProj, coreMacrosProj)
|
||||
.settings(
|
||||
testedBaseSettings,
|
||||
|
|
|
|||
|
|
@ -112,20 +112,22 @@ if not defined _JAVACMD (
|
|||
|
||||
if not defined _JAVACMD set _JAVACMD=java
|
||||
|
||||
rem users can set JAVA_OPTS via .jvmopts (sbt-extras style)
|
||||
if exist .jvmopts for /F %%A in (.jvmopts) do (
|
||||
set _jvmopts_line=%%A
|
||||
if not "!_jvmopts_line:~0,1!" == "#" (
|
||||
if defined _JAVA_OPTS (
|
||||
set _JAVA_OPTS=!_JAVA_OPTS! %%A
|
||||
) else (
|
||||
set _JAVA_OPTS=%%A
|
||||
)
|
||||
)
|
||||
)
|
||||
rem We use the value of the JAVA_OPTS environment variable if defined, rather than the config.
|
||||
if not defined _JAVA_OPTS if defined JAVA_OPTS set _JAVA_OPTS=%JAVA_OPTS%
|
||||
|
||||
rem We use the value of the JAVA_OPTS environment variable if defined, rather than the config.
|
||||
if not defined _JAVA_OPTS if defined JAVA_OPTS set _JAVA_OPTS=%JAVA_OPTS%
|
||||
rem users can set JAVA_OPTS via .jvmopts (sbt-extras style)
|
||||
if exist .jvmopts for /F %%A in (.jvmopts) do (
|
||||
set _jvmopts_line=%%A
|
||||
if not "!_jvmopts_line:~0,1!" == "#" (
|
||||
if defined _JAVA_OPTS (
|
||||
set _JAVA_OPTS=!_JAVA_OPTS! %%A
|
||||
) else (
|
||||
set _JAVA_OPTS=%%A
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
rem If nothing is defined, use the defaults.
|
||||
if not defined _JAVA_OPTS if defined default_java_opts set _JAVA_OPTS=!default_java_opts!
|
||||
|
||||
rem We use the value of the SBT_OPTS environment variable if defined, rather than the config.
|
||||
|
|
|
|||
|
|
@ -129,8 +129,12 @@ object BasicCommands {
|
|||
def runHelp(s: State, h: Help)(arg: Option[String]): State = {
|
||||
|
||||
val (extraArgs, remainingCommands) = s.remainingCommands match {
|
||||
case xs :+ exec if exec.commandLine == "shell" => (xs, exec :: Nil)
|
||||
case xs => (xs, nil[Exec])
|
||||
/*
|
||||
exec.commandLine.endsWith(Shell) is done to allow shells other than original shell works correctly with help command.
|
||||
It's assumed here that shell name must end with "shell" suffix which is true for e.g. shell, oldshell or idea-shell (https://github.com/JetBrains/sbt-idea-shell/blob/072b10e405860feb834402563773f12976be34b9/src/main/scala/org/jetbrains/sbt/constants.scala#L7)
|
||||
*/
|
||||
case xs :+ exec if exec.commandLine.endsWith(Shell) => (xs, exec :: Nil)
|
||||
case xs => (xs, nil[Exec])
|
||||
}
|
||||
|
||||
val topic = (arg.toList ++ extraArgs.map(_.commandLine)) match {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ object IPC {
|
|||
private val portMin = 1025
|
||||
private val portMax = 65536
|
||||
private val loopback = InetAddress.getByName(null)
|
||||
private[xsbt] val socketBacklog = 50 // 50 is the default backlog size for the java.net.Socket
|
||||
|
||||
def client[T](port: Int)(f: IPC => T): T = ipc(new Socket(loopback, port))(f)
|
||||
|
||||
|
|
@ -35,7 +36,7 @@ object IPC {
|
|||
|
||||
def createServer(attempts: Int): ServerSocket =
|
||||
if (attempts > 0) {
|
||||
try new ServerSocket(nextPort, 1, loopback)
|
||||
try new ServerSocket(nextPort, socketBacklog, loopback)
|
||||
catch { case NonFatal(_) => createServer(attempts - 1) }
|
||||
} else sys.error("Could not connect to socket: maximum attempts exceeded")
|
||||
|
||||
|
|
|
|||
|
|
@ -716,7 +716,9 @@ object Defaults extends BuildCommon {
|
|||
clean := clean.dependsOn(cleanIvy).value,
|
||||
scalaCompilerBridgeBinaryJar := Def.settingDyn {
|
||||
val sv = scalaVersion.value
|
||||
if (ScalaArtifacts.isScala3(sv)) fetchBridgeBinaryJarTask(sv)
|
||||
if (ScalaArtifacts.isScala3(sv) || VersionNumber(sv)
|
||||
.matchesSemVer(SemanticSelector(s"=2.13 >=${ZincLmUtil.scala2SbtBridgeStart}")))
|
||||
fetchBridgeBinaryJarTask(sv)
|
||||
else Def.task[Option[File]](None)
|
||||
}.value,
|
||||
scalaCompilerBridgeSource := ZincLmUtil.getDefaultBridgeSourceModule(scalaVersion.value),
|
||||
|
|
|
|||
|
|
@ -148,18 +148,20 @@ final case class PluginData(
|
|||
resolvers: Option[Vector[Resolver]],
|
||||
report: Option[UpdateReport],
|
||||
scalacOptions: Seq[String],
|
||||
javacOptions: Seq[String],
|
||||
unmanagedSourceDirectories: Seq[File],
|
||||
unmanagedSources: Seq[File],
|
||||
managedSourceDirectories: Seq[File],
|
||||
managedSources: Seq[File],
|
||||
classDirectory: Option[File],
|
||||
buildTarget: Option[BuildTargetIdentifier]
|
||||
) {
|
||||
val classpath: Seq[Attributed[File]] = definitionClasspath ++ dependencyClasspath
|
||||
}
|
||||
|
||||
object PluginData {
|
||||
private[sbt] def apply(dependencyClasspath: Def.Classpath): PluginData =
|
||||
PluginData(dependencyClasspath, Nil, None, None, Nil, Nil, Nil, Nil, Nil, None)
|
||||
private[sbt] def apply(depClasspath: Def.Classpath): PluginData =
|
||||
PluginData(depClasspath, Nil, None, None, Nil, Nil, Nil, Nil, Nil, Nil, None, None)
|
||||
}
|
||||
|
||||
object EvaluateTask {
|
||||
|
|
|
|||
|
|
@ -419,19 +419,21 @@ object Keys {
|
|||
val bspBuildTargetOutputPathsItem = taskKey[OutputPathsItem]("").withRank(DTask)
|
||||
val bspBuildTargetCompile = inputKey[Unit]("").withRank(DTask)
|
||||
val bspBuildTargetCompileItem = taskKey[Int]("").withRank(DTask)
|
||||
val bspBuildTargetTest = inputKey[Unit]("Corresponds to buildTarget/test request").withRank(DTask)
|
||||
val bspBuildTargetRun = inputKey[Unit]("Corresponds to buildTarget/run request").withRank(DTask)
|
||||
val bspBuildTargetCleanCache = inputKey[Unit]("Corresponds to buildTarget/cleanCache request").withRank(DTask)
|
||||
val bspBuildTargetTest = inputKey[Unit]("Implementation of buildTarget/test").withRank(DTask)
|
||||
val bspBuildTargetRun = inputKey[Unit]("Implementation of buildTarget/run").withRank(DTask)
|
||||
val bspBuildTargetCleanCache = inputKey[Unit]("Implementation of buildTarget/cleanCache").withRank(DTask)
|
||||
val bspBuildTargetScalacOptions = inputKey[Unit]("").withRank(DTask)
|
||||
val bspBuildTargetScalacOptionsItem = taskKey[ScalacOptionsItem]("").withRank(DTask)
|
||||
val bspBuildTargetJavacOptions = inputKey[Unit]("Implementation of buildTarget/javacOptions").withRank(DTask)
|
||||
val bspBuildTargetJavacOptionsItem = taskKey[JavacOptionsItem]("Item of buildTarget/javacOptions").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 bspBuildTargetJVMRunEnvironment = inputKey[Unit]("Implementation of buildTarget/jvmRunEnvironment").withRank(DTask)
|
||||
val bspBuildTargetJVMTestEnvironment = inputKey[Unit]("Implementation of buildTarget/jvmTestEnvironment").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]("Implementation of buildTarget/scalaTestClasses").withRank(DTask)
|
||||
val bspScalaTestClassesItem = taskKey[Seq[ScalaTestClassesItem]]("").withRank(DTask)
|
||||
val bspScalaMainClasses = inputKey[Unit]("Corresponds to buildTarget/scalaMainClasses request").withRank(DTask)
|
||||
val bspScalaMainClasses = inputKey[Unit]("Implementation of buildTarget/scalaMainClasses").withRank(DTask)
|
||||
val bspScalaMainClassesItem = taskKey[ScalaMainClassesItem]("").withRank(DTask)
|
||||
val bspReporter = taskKey[BuildServerReporter]("").withRank(DTask)
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ object ScriptedPlugin extends AutoPlugin {
|
|||
val ScriptedConf = Configurations.config("scripted-sbt") hide
|
||||
val ScriptedLaunchConf = Configurations.config("scripted-sbt-launch") hide
|
||||
|
||||
val scriptedSbt = settingKey[String]("")
|
||||
val scriptedSbt = settingKey[String]("sbt version that is used when running scripted tests")
|
||||
val sbtLauncher = taskKey[File]("")
|
||||
val sbtTestDirectory = settingKey[File]("")
|
||||
val scriptedBufferLog = settingKey[Boolean]("")
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ private[sbt] object TemplateCommandUtil {
|
|||
ScalaToolkitSlug -> "Scala Toolkit (beta) by Scala Center and VirtusLab",
|
||||
TypelevelToolkitSlug -> "Toolkit to start building Typelevel apps",
|
||||
SbtCrossPlatformSlug -> "A cross-JVM/JS/Native project",
|
||||
"scala/scala3.g8" -> "Scala 3 seed template",
|
||||
"scala/scala-seed.g8" -> "Scala 2 seed template",
|
||||
"playframework/play-scala-seed.g8" -> "A Play project in Scala",
|
||||
"playframework/play-java-seed.g8" -> "A Play project in Java",
|
||||
|
|
|
|||
|
|
@ -1176,21 +1176,25 @@ private[sbt] object Load {
|
|||
val prod = (Configurations.Runtime / exportedProducts).value
|
||||
val cp = (Configurations.Runtime / fullClasspath).value
|
||||
val opts = (Configurations.Compile / scalacOptions).value
|
||||
val javaOpts = (Configurations.Compile / javacOptions).value
|
||||
val unmanagedSrcDirs = (Configurations.Compile / unmanagedSourceDirectories).value
|
||||
val unmanagedSrcs = (Configurations.Compile / unmanagedSources).value
|
||||
val managedSrcDirs = (Configurations.Compile / managedSourceDirectories).value
|
||||
val managedSrcs = (Configurations.Compile / managedSources).value
|
||||
val buildTarget = (Configurations.Compile / bspTargetIdentifier).value
|
||||
val clsDir = (Configurations.Compile / classDirectory).value
|
||||
PluginData(
|
||||
removeEntries(cp, prod),
|
||||
prod,
|
||||
Some(fullResolvers.value.toVector),
|
||||
Some(update.value),
|
||||
opts,
|
||||
javaOpts,
|
||||
unmanagedSrcDirs,
|
||||
unmanagedSrcs,
|
||||
managedSrcDirs,
|
||||
managedSrcs,
|
||||
Some(clsDir),
|
||||
Some(buildTarget)
|
||||
)
|
||||
},
|
||||
|
|
@ -1244,11 +1248,7 @@ private[sbt] object Load {
|
|||
}
|
||||
|
||||
def noPlugins(dir: File, config: LoadBuildConfiguration): LoadedPlugins =
|
||||
loadPluginDefinition(
|
||||
dir,
|
||||
config,
|
||||
PluginData(config.globalPluginClasspath, Nil, None, None, Nil, Nil, Nil, Nil, Nil, None)
|
||||
)
|
||||
loadPluginDefinition(dir, config, PluginData(config.globalPluginClasspath))
|
||||
|
||||
def buildPlugins(dir: File, s: State, config: LoadBuildConfiguration): LoadedPlugins =
|
||||
loadPluginDefinition(dir, config, buildPluginDefinition(dir, s, config))
|
||||
|
|
@ -1444,6 +1444,8 @@ final case class LoadBuildConfiguration(
|
|||
Nil,
|
||||
Nil,
|
||||
Nil,
|
||||
Nil,
|
||||
None,
|
||||
None
|
||||
)
|
||||
case None => PluginData(globalPluginClasspath)
|
||||
|
|
|
|||
|
|
@ -201,24 +201,12 @@ object BuildServerProtocol {
|
|||
}.evaluated,
|
||||
bspBuildTargetCleanCache / aggregate := false,
|
||||
bspBuildTargetScalacOptions := bspInputTask { (state, _, workspace, filter) =>
|
||||
val builds = workspace.builds
|
||||
Def.task {
|
||||
val items = bspBuildTargetScalacOptionsItem.result.all(filter).value
|
||||
val appProvider = appConfiguration.value.provider()
|
||||
val sbtJars = appProvider.mainClasspath()
|
||||
val buildItems = builds.map {
|
||||
build =>
|
||||
val plugins: LoadedPlugins = build._2.unit.plugins
|
||||
val scalacOptions = plugins.pluginData.scalacOptions
|
||||
val pluginClassPath = plugins.classpath
|
||||
val classpath = (pluginClassPath ++ sbtJars).map(_.toURI).toVector
|
||||
val item = ScalacOptionsItem(
|
||||
build._1,
|
||||
scalacOptions.toVector,
|
||||
classpath,
|
||||
new File(build._2.localBase, "project/target").toURI
|
||||
)
|
||||
Value(item)
|
||||
val buildItems = workspace.builds.map {
|
||||
case (targetId, build) => Value(scalacOptionsBuildItem(sbtJars, targetId, build))
|
||||
}
|
||||
val successfulItems = anyOrThrow(items ++ buildItems)
|
||||
val result = ScalacOptionsResult(successfulItems.toVector)
|
||||
|
|
@ -226,6 +214,20 @@ object BuildServerProtocol {
|
|||
}
|
||||
}.evaluated,
|
||||
bspBuildTargetScalacOptions / aggregate := false,
|
||||
bspBuildTargetJavacOptions := bspInputTask { (state, _, workspace, filter) =>
|
||||
Def.task {
|
||||
val items = bspBuildTargetJavacOptionsItem.result.all(filter).value
|
||||
val appProvider = appConfiguration.value.provider()
|
||||
val sbtJars = appProvider.mainClasspath()
|
||||
val buildItems = workspace.builds.map {
|
||||
case (targetId, build) => Value(javacOptionsBuildItem(sbtJars, targetId, build))
|
||||
}
|
||||
val successfulItems = anyOrThrow(items ++ buildItems)
|
||||
val result = JavacOptionsResult(successfulItems.toVector)
|
||||
state.respondEvent(result)
|
||||
}
|
||||
}.evaluated,
|
||||
bspBuildTargetJavacOptions / aggregate := false,
|
||||
bspScalaTestClasses := bspInputTask { (state, _, workspace, filter) =>
|
||||
workspace.warnIfBuildsNonEmpty(Method.ScalaTestClasses, state.log)
|
||||
Def.task {
|
||||
|
|
@ -286,7 +288,20 @@ object BuildServerProtocol {
|
|||
},
|
||||
bspBuildTargetCompileItem := bspCompileTask.value,
|
||||
bspBuildTargetRun := bspRunTask.evaluated,
|
||||
bspBuildTargetScalacOptionsItem := scalacOptionsTask.value,
|
||||
bspBuildTargetScalacOptionsItem := {
|
||||
val target = Keys.bspTargetIdentifier.value
|
||||
val scalacOptions = Keys.scalacOptions.value.toVector
|
||||
val classDirectory = Keys.classDirectory.value
|
||||
val classpath = classpathTask.value
|
||||
ScalacOptionsItem(target, scalacOptions, classpath, classDirectory.toURI)
|
||||
},
|
||||
bspBuildTargetJavacOptionsItem := {
|
||||
val target = Keys.bspTargetIdentifier.value
|
||||
val javacOptions = Keys.javacOptions.value.toVector
|
||||
val classDirectory = Keys.classDirectory.value
|
||||
val classpath = classpathTask.value
|
||||
JavacOptionsItem(target, javacOptions, classpath, classDirectory.toURI)
|
||||
},
|
||||
bspBuildTargetJVMRunEnvironment := bspInputTask { (state, _, _, filter) =>
|
||||
Def.task {
|
||||
val items = bspBuildTargetJvmEnvironmentItem.result.all(filter).value
|
||||
|
|
@ -328,7 +343,7 @@ object BuildServerProtocol {
|
|||
}
|
||||
}
|
||||
)
|
||||
private object Method {
|
||||
private[sbt] object Method {
|
||||
final val Initialize = "build/initialize"
|
||||
final val BuildTargets = "workspace/buildTargets"
|
||||
final val Reload = "workspace/reload"
|
||||
|
|
@ -665,6 +680,34 @@ object BuildServerProtocol {
|
|||
)
|
||||
}
|
||||
|
||||
private def scalacOptionsBuildItem(
|
||||
sbtJars: Seq[File],
|
||||
targetId: BuildTargetIdentifier,
|
||||
build: LoadedBuildUnit
|
||||
): ScalacOptionsItem = {
|
||||
val plugins: LoadedPlugins = build.unit.plugins
|
||||
val scalacOptions = plugins.pluginData.scalacOptions.toVector
|
||||
val pluginClassPath = plugins.classpath
|
||||
val classpath = (pluginClassPath ++ sbtJars).map(_.toURI).toVector
|
||||
val classDirectory = plugins.pluginData.classDirectory.map(_.toURI)
|
||||
val item = ScalacOptionsItem(targetId, scalacOptions, classpath, classDirectory)
|
||||
item
|
||||
}
|
||||
|
||||
private def javacOptionsBuildItem(
|
||||
sbtJars: Seq[File],
|
||||
targetId: BuildTargetIdentifier,
|
||||
build: LoadedBuildUnit
|
||||
): JavacOptionsItem = {
|
||||
val plugins: LoadedPlugins = build.unit.plugins
|
||||
val javacOptions = plugins.pluginData.javacOptions.toVector
|
||||
val pluginClassPath = plugins.classpath
|
||||
val classpath = (pluginClassPath ++ sbtJars).map(_.toURI).toVector
|
||||
val classDirectory = plugins.pluginData.classDirectory.map(_.toURI)
|
||||
val item = JavacOptionsItem(targetId, javacOptions, classpath, classDirectory)
|
||||
item
|
||||
}
|
||||
|
||||
private def bspInputTask[T](
|
||||
taskImpl: (
|
||||
State,
|
||||
|
|
@ -697,26 +740,17 @@ object BuildServerProtocol {
|
|||
)
|
||||
}
|
||||
|
||||
private def scalacOptionsTask: Def.Initialize[Task[ScalacOptionsItem]] = Def.taskDyn {
|
||||
val target = Keys.bspTargetIdentifier.value
|
||||
val scalacOptions = Keys.scalacOptions.value
|
||||
val classDirectory = Keys.classDirectory.value
|
||||
private lazy val classpathTask: Def.Initialize[Task[Vector[URI]]] = Def.taskDyn {
|
||||
val externalDependencyClasspath = Keys.externalDependencyClasspath.value
|
||||
|
||||
val internalDependencyClasspath = for {
|
||||
(ref, configs) <- bspInternalDependencyConfigurations.value
|
||||
config <- configs
|
||||
} yield ref / config / Keys.classDirectory
|
||||
|
||||
Def.task {
|
||||
val classpath = internalDependencyClasspath.join.value.distinct ++
|
||||
externalDependencyClasspath.map(_.data)
|
||||
ScalacOptionsItem(
|
||||
target,
|
||||
scalacOptions.toVector,
|
||||
classpath.map(_.toURI).toVector,
|
||||
classDirectory.toURI
|
||||
)
|
||||
|
||||
classpath.map(_.toURI).toVector
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ object FakeState {
|
|||
Nil
|
||||
)
|
||||
|
||||
val pluginData = PluginData(Nil, Nil, None, None, Nil, Nil, Nil, Nil, Nil, None)
|
||||
val pluginData = PluginData(Nil, Nil, None, None, Nil, Nil, Nil, Nil, Nil, Nil, None, None)
|
||||
val builds: DetectedModules[BuildDef] = new DetectedModules[BuildDef](Nil)
|
||||
|
||||
val detectedAutoPlugins: Seq[DetectedAutoPlugin] =
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import sbt.contraband.ContrabandPlugin.autoImport._
|
|||
object Dependencies {
|
||||
// WARNING: Please Scala update versions in PluginCross.scala too
|
||||
val scala212 = "2.12.18"
|
||||
val scala213 = "2.13.11"
|
||||
val scala213 = "2.13.12"
|
||||
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.9.1")
|
||||
private val lmVersion =
|
||||
sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.9.1")
|
||||
val zincVersion = nightlyVersion.getOrElse("1.9.3")
|
||||
sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.9.3")
|
||||
val zincVersion = nightlyVersion.getOrElse("1.9.5")
|
||||
|
||||
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ object Dependencies {
|
|||
def addSbtZincCompile = addSbtModule(sbtZincPath, "zincCompile", zincCompile)
|
||||
def addSbtZincCompileCore = addSbtModule(sbtZincPath, "zincCompileCore", zincCompileCore)
|
||||
|
||||
val lmCoursierShaded = "io.get-coursier" %% "lm-coursier-shaded" % "2.1.0"
|
||||
val lmCoursierShaded = "io.get-coursier" %% "lm-coursier-shaded" % "2.1.1"
|
||||
|
||||
def sjsonNew(n: String) =
|
||||
Def.setting("com.eed3si9n" %% n % "0.9.1") // contrabandSjsonNewVersion.value
|
||||
|
|
|
|||
|
|
@ -2,27 +2,6 @@ import sbt._
|
|||
import sbt.Keys._
|
||||
|
||||
object Transform {
|
||||
private val conscriptConfigs = taskKey[Unit]("")
|
||||
|
||||
def conscriptSettings(launch: Reference) = Seq(
|
||||
conscriptConfigs := {
|
||||
val sourceFile = (launch / Compile / managedResources).value
|
||||
.find(_.getName == "sbt.boot.properties")
|
||||
.getOrElse(sys.error("No managed boot.properties file."))
|
||||
val source = IO.readLines(sourceFile)
|
||||
val conscriptBase = (Compile / sourceDirectory).value / "conscript"
|
||||
IO.delete(conscriptBase)
|
||||
val pairs = Seq(
|
||||
"sbt.xMain" -> "xsbt",
|
||||
"sbt.ScriptMain" -> "scalas",
|
||||
"sbt.ConsoleMain" -> "screpl",
|
||||
)
|
||||
for ((main, dir) <- pairs) {
|
||||
val lines = source.map(l => if (l.trim.startsWith("class:")) s" class: $main" else l)
|
||||
IO.writeLines(conscriptBase / dir / "launchconfig", lines)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def configSettings = Seq(
|
||||
resourceGenerators += Def.task {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* @param options Additional arguments to the compiler.
|
||||
For example, -deprecation.
|
||||
* @param classpath The dependency classpath for this target, must be
|
||||
identical to what is passed as arguments to
|
||||
the -classpath flag in the command line interface
|
||||
of scalac.
|
||||
* @param classDirectory The output directory for classfiles produced by this target
|
||||
*/
|
||||
final class JavacOptionsItem private (
|
||||
val target: sbt.internal.bsp.BuildTargetIdentifier,
|
||||
val options: Vector[String],
|
||||
val classpath: Vector[java.net.URI],
|
||||
val classDirectory: Option[java.net.URI]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: JavacOptionsItem => (this.target == x.target) && (this.options == x.options) && (this.classpath == x.classpath) && (this.classDirectory == x.classDirectory)
|
||||
case _ => false
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.JavacOptionsItem".##) + target.##) + options.##) + classpath.##) + classDirectory.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"JavacOptionsItem(" + target + ", " + options + ", " + classpath + ", " + classDirectory + ")"
|
||||
}
|
||||
private[this] def copy(target: sbt.internal.bsp.BuildTargetIdentifier = target, options: Vector[String] = options, classpath: Vector[java.net.URI] = classpath, classDirectory: Option[java.net.URI] = classDirectory): JavacOptionsItem = {
|
||||
new JavacOptionsItem(target, options, classpath, classDirectory)
|
||||
}
|
||||
def withTarget(target: sbt.internal.bsp.BuildTargetIdentifier): JavacOptionsItem = {
|
||||
copy(target = target)
|
||||
}
|
||||
def withOptions(options: Vector[String]): JavacOptionsItem = {
|
||||
copy(options = options)
|
||||
}
|
||||
def withClasspath(classpath: Vector[java.net.URI]): JavacOptionsItem = {
|
||||
copy(classpath = classpath)
|
||||
}
|
||||
def withClassDirectory(classDirectory: Option[java.net.URI]): JavacOptionsItem = {
|
||||
copy(classDirectory = classDirectory)
|
||||
}
|
||||
def withClassDirectory(classDirectory: java.net.URI): JavacOptionsItem = {
|
||||
copy(classDirectory = Option(classDirectory))
|
||||
}
|
||||
}
|
||||
object JavacOptionsItem {
|
||||
|
||||
def apply(target: sbt.internal.bsp.BuildTargetIdentifier, options: Vector[String], classpath: Vector[java.net.URI], classDirectory: Option[java.net.URI]): JavacOptionsItem = new JavacOptionsItem(target, options, classpath, classDirectory)
|
||||
def apply(target: sbt.internal.bsp.BuildTargetIdentifier, options: Vector[String], classpath: Vector[java.net.URI], classDirectory: java.net.URI): JavacOptionsItem = new JavacOptionsItem(target, options, classpath, Option(classDirectory))
|
||||
}
|
||||
37
protocol/src/main/contraband-scala/sbt/internal/bsp/JavacOptionsParams.scala
generated
Normal file
37
protocol/src/main/contraband-scala/sbt/internal/bsp/JavacOptionsParams.scala
generated
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* Javac options
|
||||
* The build target javac options request is sent from the client to the server
|
||||
* to query for the list of compiler options necessary to compile in a given list of targets.
|
||||
*/
|
||||
final class JavacOptionsParams private (
|
||||
val targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: JavacOptionsParams => (this.targets == x.targets)
|
||||
case _ => false
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.JavacOptionsParams".##) + targets.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"JavacOptionsParams(" + targets + ")"
|
||||
}
|
||||
private[this] def copy(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier] = targets): JavacOptionsParams = {
|
||||
new JavacOptionsParams(targets)
|
||||
}
|
||||
def withTargets(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): JavacOptionsParams = {
|
||||
copy(targets = targets)
|
||||
}
|
||||
}
|
||||
object JavacOptionsParams {
|
||||
|
||||
def apply(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): JavacOptionsParams = new JavacOptionsParams(targets)
|
||||
}
|
||||
32
protocol/src/main/contraband-scala/sbt/internal/bsp/JavacOptionsResult.scala
generated
Normal file
32
protocol/src/main/contraband-scala/sbt/internal/bsp/JavacOptionsResult.scala
generated
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
final class JavacOptionsResult private (
|
||||
val items: Vector[sbt.internal.bsp.JavacOptionsItem]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: JavacOptionsResult => (this.items == x.items)
|
||||
case _ => false
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.JavacOptionsResult".##) + items.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"JavacOptionsResult(" + items + ")"
|
||||
}
|
||||
private[this] def copy(items: Vector[sbt.internal.bsp.JavacOptionsItem] = items): JavacOptionsResult = {
|
||||
new JavacOptionsResult(items)
|
||||
}
|
||||
def withItems(items: Vector[sbt.internal.bsp.JavacOptionsItem]): JavacOptionsResult = {
|
||||
copy(items = items)
|
||||
}
|
||||
}
|
||||
object JavacOptionsResult {
|
||||
|
||||
def apply(items: Vector[sbt.internal.bsp.JavacOptionsItem]): JavacOptionsResult = new JavacOptionsResult(items)
|
||||
}
|
||||
33
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/JavacOptionsItemFormats.scala
generated
Normal file
33
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/JavacOptionsItemFormats.scala
generated
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* 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 JavacOptionsItemFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val JavacOptionsItemFormat: JsonFormat[sbt.internal.bsp.JavacOptionsItem] = new JsonFormat[sbt.internal.bsp.JavacOptionsItem] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.JavacOptionsItem = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val target = unbuilder.readField[sbt.internal.bsp.BuildTargetIdentifier]("target")
|
||||
val options = unbuilder.readField[Vector[String]]("options")
|
||||
val classpath = unbuilder.readField[Vector[java.net.URI]]("classpath")
|
||||
val classDirectory = unbuilder.readField[Option[java.net.URI]]("classDirectory")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.JavacOptionsItem(target, options, classpath, classDirectory)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.JavacOptionsItem, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("target", obj.target)
|
||||
builder.addField("options", obj.options)
|
||||
builder.addField("classpath", obj.classpath)
|
||||
builder.addField("classDirectory", obj.classDirectory)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/JavacOptionsParamsFormats.scala
generated
Normal file
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/JavacOptionsParamsFormats.scala
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* 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 JavacOptionsParamsFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val JavacOptionsParamsFormat: JsonFormat[sbt.internal.bsp.JavacOptionsParams] = new JsonFormat[sbt.internal.bsp.JavacOptionsParams] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.JavacOptionsParams = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val targets = unbuilder.readField[Vector[sbt.internal.bsp.BuildTargetIdentifier]]("targets")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.JavacOptionsParams(targets)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.JavacOptionsParams, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("targets", obj.targets)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/JavacOptionsResultFormats.scala
generated
Normal file
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/JavacOptionsResultFormats.scala
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* 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 JavacOptionsResultFormats { self: sbt.internal.bsp.codec.JavacOptionsItemFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val JavacOptionsResultFormat: JsonFormat[sbt.internal.bsp.JavacOptionsResult] = new JsonFormat[sbt.internal.bsp.JavacOptionsResult] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.JavacOptionsResult = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val items = unbuilder.readField[Vector[sbt.internal.bsp.JavacOptionsItem]]("items")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.JavacOptionsResult(items)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.JavacOptionsResult, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("items", obj.items)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -56,10 +56,13 @@ trait JsonProtocol extends sjsonnew.BasicJsonProtocol
|
|||
with sbt.internal.bsp.codec.RunParamsFormats
|
||||
with sbt.internal.bsp.codec.RunResultFormats
|
||||
with sbt.internal.bsp.codec.ScalaBuildTargetFormats
|
||||
with sbt.internal.bsp.codec.SbtBuildTargetFormats
|
||||
with sbt.internal.bsp.codec.ScalacOptionsParamsFormats
|
||||
with sbt.internal.bsp.codec.ScalacOptionsItemFormats
|
||||
with sbt.internal.bsp.codec.ScalacOptionsResultFormats
|
||||
with sbt.internal.bsp.codec.JavacOptionsParamsFormats
|
||||
with sbt.internal.bsp.codec.JavacOptionsItemFormats
|
||||
with sbt.internal.bsp.codec.JavacOptionsResultFormats
|
||||
with sbt.internal.bsp.codec.SbtBuildTargetFormats
|
||||
with sbt.internal.bsp.codec.BspConnectionDetailsFormats
|
||||
with sbt.internal.bsp.codec.MetalsMetadataFormats
|
||||
with sbt.internal.bsp.codec.ScalaTestClassesItemFormats
|
||||
|
|
|
|||
|
|
@ -625,31 +625,6 @@ type ScalaBuildTarget {
|
|||
jars: [String]!
|
||||
}
|
||||
|
||||
# sbt Extension
|
||||
|
||||
## Contains sbt-specific metadata for providing editor support for sbt build files.
|
||||
## This metadata is embedded in the data: Option[Json] field of the BuildTarget definition
|
||||
## when the dataKind field contains "sbt".
|
||||
type SbtBuildTarget {
|
||||
## The sbt version. Useful to support version-dependent syntax.
|
||||
sbtVersion: String!
|
||||
|
||||
## A sequence of Scala imports that are automatically imported in the sbt build files.
|
||||
autoImports: [String]!
|
||||
|
||||
## The Scala build target describing the scala
|
||||
## version and scala jars used by this sbt version.
|
||||
scalaBuildTarget: sbt.internal.bsp.ScalaBuildTarget!
|
||||
|
||||
## An optional parent if the target has an sbt meta project.
|
||||
parent: sbt.internal.bsp.BuildTargetIdentifier
|
||||
|
||||
## The inverse of parent, list of targets that have this build target
|
||||
## defined as their parent. It can contain normal project targets or
|
||||
## sbt build targets if this target represents an sbt meta-meta build.
|
||||
children: [sbt.internal.bsp.BuildTargetIdentifier]!
|
||||
}
|
||||
|
||||
## Scalac options
|
||||
## The build target scalac options request is sent from the client to the server
|
||||
## to query for the list of compiler options necessary to compile in a given list of targets.
|
||||
|
|
@ -678,6 +653,61 @@ type ScalacOptionsItem {
|
|||
classDirectory: java.net.URI
|
||||
}
|
||||
|
||||
# Java Extension
|
||||
|
||||
## Javac options
|
||||
## The build target javac options request is sent from the client to the server
|
||||
## to query for the list of compiler options necessary to compile in a given list of targets.
|
||||
type JavacOptionsParams {
|
||||
targets: [sbt.internal.bsp.BuildTargetIdentifier]
|
||||
}
|
||||
|
||||
type JavacOptionsResult {
|
||||
items: [sbt.internal.bsp.JavacOptionsItem]
|
||||
}
|
||||
|
||||
type JavacOptionsItem {
|
||||
target: sbt.internal.bsp.BuildTargetIdentifier!
|
||||
|
||||
## Additional arguments to the compiler.
|
||||
## For example, -deprecation.
|
||||
options: [String]
|
||||
|
||||
## The dependency classpath for this target, must be
|
||||
## identical to what is passed as arguments to
|
||||
## the -classpath flag in the command line interface
|
||||
## of scalac.
|
||||
classpath: [java.net.URI]
|
||||
|
||||
## The output directory for classfiles produced by this target
|
||||
classDirectory: java.net.URI
|
||||
}
|
||||
|
||||
# sbt Extension
|
||||
|
||||
## Contains sbt-specific metadata for providing editor support for sbt build files.
|
||||
## This metadata is embedded in the data: Option[Json] field of the BuildTarget definition
|
||||
## when the dataKind field contains "sbt".
|
||||
type SbtBuildTarget {
|
||||
## The sbt version. Useful to support version-dependent syntax.
|
||||
sbtVersion: String!
|
||||
|
||||
## A sequence of Scala imports that are automatically imported in the sbt build files.
|
||||
autoImports: [String]!
|
||||
|
||||
## The Scala build target describing the scala
|
||||
## version and scala jars used by this sbt version.
|
||||
scalaBuildTarget: sbt.internal.bsp.ScalaBuildTarget!
|
||||
|
||||
## An optional parent if the target has an sbt meta project.
|
||||
parent: sbt.internal.bsp.BuildTargetIdentifier
|
||||
|
||||
## The inverse of parent, list of targets that have this build target
|
||||
## defined as their parent. It can contain normal project targets or
|
||||
## sbt build targets if this target represents an sbt meta-meta build.
|
||||
children: [sbt.internal.bsp.BuildTargetIdentifier]!
|
||||
}
|
||||
|
||||
## https://build-server-protocol.github.io/docs/server-discovery.html
|
||||
type BspConnectionDetails {
|
||||
## The name of the build tool
|
||||
|
|
|
|||
2
sbt
2
sbt
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set +e
|
||||
declare builtin_sbt_version="1.9.3"
|
||||
declare builtin_sbt_version="1.9.6"
|
||||
declare -a residual_args
|
||||
declare -a java_args
|
||||
declare -a scalac_args
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
lazy val check = taskKey[Unit]("")
|
||||
lazy val compile2 = taskKey[Unit]("")
|
||||
lazy val scala212 = "2.12.18"
|
||||
lazy val scala213 = "2.13.12"
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
.aggregate(foo, bar, client)
|
||||
|
|
@ -11,7 +12,7 @@ lazy val root = (project in file("."))
|
|||
|
||||
lazy val foo = project
|
||||
.settings(
|
||||
crossScalaVersions := Seq(scala212, "2.13.11"),
|
||||
crossScalaVersions := Seq(scala212, scala213),
|
||||
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.0",
|
||||
|
||||
check := {
|
||||
|
|
@ -43,7 +44,7 @@ lazy val bar = project
|
|||
|
||||
lazy val baz = project
|
||||
.settings(
|
||||
crossScalaVersions := Seq("2.13.11"),
|
||||
crossScalaVersions := Seq(scala213),
|
||||
check := {
|
||||
// This tests that +baz/check will respect bar's crossScalaVersions and not switch
|
||||
val x = (LocalProject("bar") / scalaVersion).value
|
||||
|
|
@ -54,7 +55,7 @@ lazy val baz = project
|
|||
|
||||
lazy val client = project
|
||||
.settings(
|
||||
crossScalaVersions := Seq(scala212, "2.13.11"),
|
||||
crossScalaVersions := Seq(scala212, scala213),
|
||||
check := (Compile / compile).value,
|
||||
compile2 := (Compile / compile).value,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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.18", "2.13.11")
|
||||
> set root/crossScalaVersions := Seq("2.12.18", "2.13.12")
|
||||
> + build
|
||||
$ exists foo/target/scala-2.12
|
||||
$ exists foo/target/scala-2.13
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
scalaVersion := "2.12.18"
|
||||
crossScalaVersions := List("2.12.18", "2.13.11")
|
||||
crossScalaVersions := List("2.12.18", "2.13.12")
|
||||
|
||||
val setLastModified = taskKey[Unit]("Sets the last modified time for classfiles")
|
||||
setLastModified := {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
lazy val scala212 = "2.12.18"
|
||||
lazy val scala213 = "2.13.11"
|
||||
lazy val scala213 = "2.13.12"
|
||||
|
||||
ThisBuild / crossScalaVersions := Seq(scala212, scala213)
|
||||
ThisBuild / scalaVersion := scala212
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ $ exists extras/target/scala-2.12
|
|||
|
||||
# test safe switching
|
||||
> clean
|
||||
> ++ 2.13.11 -v compile
|
||||
> ++ 2.13.12 -v compile
|
||||
$ exists lib/target/scala-2.13
|
||||
-$ exists lib/target/scala-2.12
|
||||
# -$ exists sbt-foo/target/scala-2.12
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
lazy val scala212 = "2.12.18"
|
||||
lazy val scala213 = "2.13.11"
|
||||
lazy val scala213 = "2.13.12"
|
||||
|
||||
ThisBuild / scalaVersion := scala212
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
> clean
|
||||
|
||||
> ++2.13.11 compile
|
||||
> ++2.13.12 compile
|
||||
|
||||
$ exists core/target/scala-2.13
|
||||
-$ exists module/target/scala-2.13
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import Parsers._
|
|||
lazy val root = (project in file("."))
|
||||
.settings(
|
||||
crossPaths := false,
|
||||
crossScalaVersions := Seq("2.12.18", "2.13.11"),
|
||||
crossScalaVersions := Seq("2.12.18", "2.13.12"),
|
||||
scalaVersion := "2.12.18",
|
||||
Compile / doc / scalacOptions += "-Xfatal-warnings",
|
||||
commands += Command.command("excludeB") { s =>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
lazy val scala212 = "2.12.18"
|
||||
lazy val scala213 = "2.13.11"
|
||||
lazy val scala213 = "2.13.12"
|
||||
ThisBuild / scalaVersion := scala212
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
scalaVersion := "2.13.11"
|
||||
scalaVersion := "2.13.12"
|
||||
|
||||
// Send some bogus initial command so that it doesn't get stuck.
|
||||
// The task itself will still succeed.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
ThisBuild / version := "0.1.0-SNAPSHOT"
|
||||
ThisBuild / scalaVersion := "2.13.11"
|
||||
ThisBuild / scalaVersion := "2.13.12"
|
||||
|
||||
name := "asciiGraphWidthSpecs"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
ThisBuild / version := "0.1.0-SNAPSHOT"
|
||||
ThisBuild / scalaVersion := "2.13.11"
|
||||
ThisBuild / scalaVersion := "2.13.12"
|
||||
|
||||
name := "whatDependsOn"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
ThisBuild / version := "0.1.0-SNAPSHOT"
|
||||
ThisBuild / scalaVersion := "2.13.11"
|
||||
ThisBuild / scalaVersion := "2.13.12"
|
||||
|
||||
name := "whatDependsOn"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
scalaVersion := "2.13.11"
|
||||
scalaVersion := "2.13.12"
|
||||
csrConfiguration := csrConfiguration.value.withCache(target.value / "coursier-cache")
|
||||
|
||||
libraryDependencies += "com.typesafe.play" %% "play-test" % "2.8.0-RC1" % Test // worked around in 2.8.0
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ThisBuild / scalaVersion := "2.13.11"
|
||||
ThisBuild / scalaVersion := "2.13.12"
|
||||
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
|
||||
ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache"))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import xsbti.AppConfiguration
|
||||
// ThisBuild / useCoursier := false
|
||||
ThisBuild / organization := "com.example"
|
||||
ThisBuild / scalaVersion := "2.13.11"
|
||||
ThisBuild / scalaVersion := "2.13.12"
|
||||
ThisBuild / versionScheme := Some("semver-spec")
|
||||
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ThisBuild / scalaVersion := "2.13.11"
|
||||
ThisBuild / scalaVersion := "2.13.12"
|
||||
libraryDependencies ++= Seq(
|
||||
"com.chuusai" %% "shapeless" % "2.3.3",
|
||||
// non-existing
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ThisBuild / scalaVersion := "2.13.11"
|
||||
ThisBuild / scalaVersion := "2.13.12"
|
||||
ThisBuild / scalacOptions += "-Ytasty-reader"
|
||||
|
||||
lazy val scala3code = project
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
ThisBuild / scalaVersion := "3.1.3"
|
||||
ThisBuild / scalacOptions += "-Ytasty-reader"
|
||||
|
||||
lazy val scala213 = "2.13.11"
|
||||
lazy val scala213 = "2.13.12"
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
.aggregate(fooApp, fooCore, barApp, barCore)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ThisBuild / scalaVersion := "2.13.11"
|
||||
ThisBuild / scalaVersion := "2.13.12"
|
||||
ThisBuild / version := "0.1.0-SNAPSHOT"
|
||||
|
||||
lazy val check = taskKey[Unit]("")
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ $ copy-file changes/A2.scala A.scala
|
|||
> run 2
|
||||
|
||||
> clean
|
||||
> ++2.13.11!
|
||||
> ++2.13.12!
|
||||
|
||||
$ copy-file changes/A1.scala A.scala
|
||||
> run 1
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ThisBuild / scalaVersion := "2.13.11"
|
||||
ThisBuild / scalaVersion := "2.13.12"
|
||||
ThisBuild / usePipelining := true
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ThisBuild / scalaVersion := "2.13.11"
|
||||
ThisBuild / scalaVersion := "2.13.12"
|
||||
ThisBuild / usePipelining := true
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ThisBuild / scalaVersion := "2.13.11"
|
||||
ThisBuild / scalaVersion := "2.13.12"
|
||||
|
||||
val hedgehogVersion = "0.10.0"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ThisBuild / scalaVersion := "2.13.11"
|
||||
ThisBuild / scalaVersion := "2.13.12"
|
||||
ThisBuild / version := "0.1.0-SNAPSHOT"
|
||||
ThisBuild / organization := "com.example"
|
||||
ThisBuild / organizationName := "example"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
ThisBuild / scalaVersion := "2.13.11"
|
||||
ThisBuild / scalaVersion := "2.13.12"
|
||||
|
||||
libraryDependencies += "com.disneystreaming" %% "weaver-cats" % "0.8.3" % Test
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ThisBuild / scalaVersion := "2.13.11"
|
||||
ThisBuild / scalaVersion := "2.13.12"
|
||||
|
||||
libraryDependencies += "dev.zio" %% "zio-test" % "2.0.2" % Test
|
||||
libraryDependencies += "dev.zio" %% "zio-test-sbt" % "2.0.2" % Test
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
private def nextId(): Int = idGen.getAndIncrement()
|
||||
|
||||
test("build/initialize") { _ =>
|
||||
val id = nextId()
|
||||
initializeRequest(id)
|
||||
val id = initializeRequest()
|
||||
assert(svr.waitForString(10.seconds) { s =>
|
||||
(s contains s""""id":"${id}"""") &&
|
||||
(s contains """"resourcesProvider":true""") &&
|
||||
|
|
@ -42,10 +41,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
}
|
||||
|
||||
test("workspace/buildTargets") { _ =>
|
||||
svr.sendJsonRpc(
|
||||
s"""{ "jsonrpc": "2.0", "id": "${nextId()}", "method": "workspace/buildTargets", "params": {} }"""
|
||||
)
|
||||
assert(processing("workspace/buildTargets"))
|
||||
sendRequest("workspace/buildTargets")
|
||||
val result = svr.waitFor[WorkspaceBuildTargetsResult](10.seconds)
|
||||
val utilTarget = result.targets.find(_.displayName.contains("util")).get
|
||||
assert(utilTarget.id.uri.toString.endsWith("#util/Compile"))
|
||||
|
|
@ -58,16 +54,14 @@ object BuildServerTest extends AbstractServerTest {
|
|||
test("buildTarget/sources") { _ =>
|
||||
val buildTarget = buildTargetUri("util", "Compile")
|
||||
val badBuildTarget = buildTargetUri("badBuildTarget", "Compile")
|
||||
svr.sendJsonRpc(buildTargetSources(Seq(buildTarget, badBuildTarget)))
|
||||
assert(processing("buildTarget/sources"))
|
||||
buildTargetSources(Seq(buildTarget, badBuildTarget))
|
||||
val s = svr.waitFor[SourcesResult](10.seconds)
|
||||
val sources = s.items.head.sources.map(_.uri)
|
||||
assert(sources.contains(new File(svr.baseDirectory, "util/src/main/scala").toURI))
|
||||
}
|
||||
test("buildTarget/sources: base sources") { _ =>
|
||||
val buildTarget = buildTargetUri("buildserver", "Compile")
|
||||
svr.sendJsonRpc(buildTargetSources(Seq(buildTarget)))
|
||||
assert(processing("buildTarget/sources"))
|
||||
buildTargetSources(Seq(buildTarget))
|
||||
val s = svr.waitFor[SourcesResult](10.seconds)
|
||||
val sources = s.items.head.sources
|
||||
val expectedSource = SourceItem(
|
||||
|
|
@ -80,8 +74,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
|
||||
test("buildTarget/sources: sbt") { _ =>
|
||||
val x = new URI(s"${svr.baseDirectory.getAbsoluteFile.toURI}#buildserver-build")
|
||||
svr.sendJsonRpc(buildTargetSources(Seq(x)))
|
||||
assert(processing("buildTarget/sources"))
|
||||
buildTargetSources(Seq(x))
|
||||
val s = svr.waitFor[SourcesResult](10.seconds)
|
||||
val sources = s.items.head.sources.map(_.uri).sorted
|
||||
val expectedSources = Vector(
|
||||
|
|
@ -99,17 +92,13 @@ object BuildServerTest extends AbstractServerTest {
|
|||
|
||||
test("buildTarget/compile") { _ =>
|
||||
val buildTarget = buildTargetUri("util", "Compile")
|
||||
|
||||
compile(buildTarget, id = nextId())
|
||||
|
||||
assert(processing("buildTarget/compile"))
|
||||
compile(buildTarget)
|
||||
val res = svr.waitFor[BspCompileResult](10.seconds)
|
||||
assert(res.statusCode == StatusCode.Success)
|
||||
}
|
||||
|
||||
test("buildTarget/compile - reports compilation progress") { _ =>
|
||||
val buildTarget = buildTargetUri("runAndTest", "Compile")
|
||||
|
||||
compile(buildTarget)
|
||||
|
||||
// This doesn't always come back in 10s on CI.
|
||||
|
|
@ -271,18 +260,19 @@ object BuildServerTest extends AbstractServerTest {
|
|||
)
|
||||
}
|
||||
|
||||
test("buildTarget/scalacOptions") { _ =>
|
||||
test("buildTarget/scalacOptions, buildTarget/javacOptions") { _ =>
|
||||
val buildTarget = buildTargetUri("util", "Compile")
|
||||
val badBuildTarget = buildTargetUri("badBuildTarget", "Compile")
|
||||
val id = nextId()
|
||||
svr.sendJsonRpc(
|
||||
s"""{ "jsonrpc": "2.0", "id": "$id", "method": "buildTarget/scalacOptions", "params": {
|
||||
| "targets": [{ "uri": "$buildTarget" }, { "uri": "$badBuildTarget" }]
|
||||
|} }""".stripMargin
|
||||
)
|
||||
assert(processing("buildTarget/scalacOptions"))
|
||||
val id1 = scalacOptions(Seq(buildTarget, badBuildTarget))
|
||||
|
||||
assert(svr.waitForString(10.seconds) { s =>
|
||||
(s contains s""""id":"$id"""") &&
|
||||
(s contains s""""id":"$id1"""") &&
|
||||
(s contains "scala-library-2.13.11.jar")
|
||||
})
|
||||
|
||||
val id2 = javacOptions(Seq(buildTarget, badBuildTarget))
|
||||
assert(svr.waitForString(10.seconds) { s =>
|
||||
(s contains s""""id":"$id2"""") &&
|
||||
(s contains "scala-library-2.13.11.jar")
|
||||
})
|
||||
}
|
||||
|
|
@ -306,7 +296,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
| "targets": [{ "uri": "$buildTarget" }]
|
||||
|} }""".stripMargin
|
||||
)
|
||||
assert(processing("buildTarget/cleanCache"))
|
||||
assertProcessing("buildTarget/cleanCache")
|
||||
val res = svr.waitFor[CleanCacheResult](10.seconds)
|
||||
assert(res.cleaned)
|
||||
assert(targetDir.list().isEmpty)
|
||||
|
|
@ -316,7 +306,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
svr.sendJsonRpc(
|
||||
s"""{ "jsonrpc": "2.0", "id": "${nextId()}", "method": "workspace/buildTargets", "params": {} }"""
|
||||
)
|
||||
assert(processing("workspace/buildTargets"))
|
||||
assertProcessing("workspace/buildTargets")
|
||||
val result = svr.waitFor[WorkspaceBuildTargetsResult](10.seconds)
|
||||
val allTargets = result.targets.map(_.id.uri)
|
||||
|
||||
|
|
@ -327,7 +317,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
| ]
|
||||
|} }""".stripMargin
|
||||
)
|
||||
assert(processing("buildTarget/cleanCache"))
|
||||
assertProcessing("buildTarget/cleanCache")
|
||||
val res = svr.waitFor[CleanCacheResult](10.seconds)
|
||||
assert(res.cleaned)
|
||||
}
|
||||
|
|
@ -337,7 +327,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
svr.sendJsonRpc(
|
||||
s"""{ "jsonrpc": "2.0", "id": "$id", "method": "workspace/reload"}"""
|
||||
)
|
||||
assert(processing("workspace/reload"))
|
||||
assertProcessing("workspace/reload")
|
||||
assert(svr.waitForString(10.seconds) { s =>
|
||||
(s contains s""""id":"$id"""") &&
|
||||
(s contains """"result":null""")
|
||||
|
|
@ -355,9 +345,8 @@ object BuildServerTest extends AbstractServerTest {
|
|||
|)
|
||||
|""".stripMargin
|
||||
)
|
||||
val id = nextId()
|
||||
val id = reloadWorkspace()
|
||||
// reload
|
||||
reloadWorkspace(id)
|
||||
assert(
|
||||
svr.waitForString(10.seconds) { s =>
|
||||
s.contains(s""""buildTarget":{"uri":"$metaBuildTarget"}""") &&
|
||||
|
|
@ -405,7 +394,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
| "targets": [{ "uri": "$buildTarget" }, { "uri": "$badBuildTarget" }]
|
||||
|} }""".stripMargin
|
||||
)
|
||||
assert(processing("buildTarget/scalaMainClasses"))
|
||||
assertProcessing("buildTarget/scalaMainClasses")
|
||||
assert(svr.waitForString(30.seconds) { s =>
|
||||
(s contains s""""id":"$id"""") &&
|
||||
(s contains """"class":"main.Main"""")
|
||||
|
|
@ -422,7 +411,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
| "data": { "class": "main.Main" }
|
||||
|} }""".stripMargin
|
||||
)
|
||||
assert(processing("buildTarget/run"))
|
||||
assertProcessing("buildTarget/run")
|
||||
assert(svr.waitForString(10.seconds) { s =>
|
||||
(s contains "build/logMessage") &&
|
||||
(s contains """"message":"Hello World!"""")
|
||||
|
|
@ -443,7 +432,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
| "params": { "targets": [{ "uri": "$buildTarget" }] }
|
||||
|}""".stripMargin
|
||||
)
|
||||
assert(processing("buildTarget/jvmRunEnvironment"))
|
||||
assertProcessing("buildTarget/jvmRunEnvironment")
|
||||
assert {
|
||||
svr.waitForString(10.seconds) { s =>
|
||||
(s contains s""""id":"$id"""") &&
|
||||
|
|
@ -465,7 +454,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
| "params": { "targets": [{ "uri": "$buildTarget" }] }
|
||||
|}""".stripMargin
|
||||
)
|
||||
assert(processing("buildTarget/jvmTestEnvironment"))
|
||||
assertProcessing("buildTarget/jvmTestEnvironment")
|
||||
assert {
|
||||
svr.waitForString(10.seconds) { s =>
|
||||
(s contains s""""id":"$id"""") &&
|
||||
|
|
@ -487,7 +476,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
| "targets": [{ "uri": "$buildTarget" }, { "uri": "$badBuildTarget" }]
|
||||
|} }""".stripMargin
|
||||
)
|
||||
assert(processing("buildTarget/scalaTestClasses"))
|
||||
assertProcessing("buildTarget/scalaTestClasses")
|
||||
assert(svr.waitForString(10.seconds) { s =>
|
||||
(s contains s""""id":"$id"""") &&
|
||||
(s contains """"tests.FailingTest"""") &&
|
||||
|
|
@ -504,7 +493,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
| "targets": [{ "uri": "$buildTarget" }]
|
||||
|} }""".stripMargin
|
||||
)
|
||||
assert(processing("buildTarget/test"))
|
||||
assertProcessing("buildTarget/test")
|
||||
assert(svr.waitForString(10.seconds) { s =>
|
||||
(s contains s""""id":"$id"""") &&
|
||||
(s contains """"statusCode":2""")
|
||||
|
|
@ -528,7 +517,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
| }
|
||||
|} }""".stripMargin
|
||||
)
|
||||
assert(processing("buildTarget/test"))
|
||||
assertProcessing("buildTarget/test")
|
||||
assert(svr.waitForString(10.seconds) { s =>
|
||||
(s contains s""""id":"$id"""") &&
|
||||
(s contains """"statusCode":1""")
|
||||
|
|
@ -557,8 +546,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
|
||||
test("buildTarget/compile: respond error") { _ =>
|
||||
val buildTarget = buildTargetUri("respondError", "Compile")
|
||||
val id = nextId()
|
||||
compile(buildTarget, id)
|
||||
val id = compile(buildTarget)
|
||||
assert(svr.waitForString(10.seconds) { s =>
|
||||
s.contains(s""""id":"$id"""") &&
|
||||
s.contains(""""error"""") &&
|
||||
|
|
@ -576,7 +564,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
| "targets": [{ "uri": "$buildTarget" }, { "uri": "$badBuildTarget" }]
|
||||
|} }""".stripMargin
|
||||
)
|
||||
assert(processing("buildTarget/resources"))
|
||||
assertProcessing("buildTarget/resources")
|
||||
assert(svr.waitForString(10.seconds) { s =>
|
||||
(s contains s""""id":"$id"""") && (s contains "util/src/main/resources/")
|
||||
})
|
||||
|
|
@ -590,7 +578,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
| "targets": [{ "uri": "$buildTarget" }, { "uri": "$badBuildTarget" }]
|
||||
|} }""".stripMargin
|
||||
)
|
||||
assert(processing("buildTarget/outputPaths"))
|
||||
assertProcessing("buildTarget/outputPaths")
|
||||
val actualResult = svr.waitFor[OutputPathsResult](10.seconds)
|
||||
val expectedResult = OutputPathsResult(
|
||||
items = Vector(
|
||||
|
|
@ -608,7 +596,7 @@ object BuildServerTest extends AbstractServerTest {
|
|||
assert(actualResult == expectedResult)
|
||||
}
|
||||
|
||||
private def initializeRequest(id: Int): Unit = {
|
||||
private def initializeRequest(): Int = {
|
||||
val params = InitializeBuildParams(
|
||||
"test client",
|
||||
"1.0.0",
|
||||
|
|
@ -617,35 +605,55 @@ object BuildServerTest extends AbstractServerTest {
|
|||
BuildClientCapabilities(Vector("scala")),
|
||||
None
|
||||
)
|
||||
svr.sendJsonRpc(request(id, "build/initialize", params))
|
||||
sendRequest("build/initialize", params)
|
||||
}
|
||||
|
||||
private def processing(method: String, debug: Boolean = false): Boolean = {
|
||||
svr.waitForString(10.seconds) { msg =>
|
||||
private def assertProcessing(method: String, debug: Boolean = false): Unit = {
|
||||
assert(svr.waitForString(10.seconds) { msg =>
|
||||
if (debug) println(msg)
|
||||
msg.contains("build/logMessage") &&
|
||||
msg.contains(s""""message":"Processing $method"""")
|
||||
}
|
||||
msg.contains("build/logMessage") && msg.contains(s""""message":"Processing $method"""")
|
||||
})
|
||||
}
|
||||
|
||||
private def reloadWorkspace(id: Int = nextId()): Unit =
|
||||
svr.sendJsonRpc(s"""{ "jsonrpc": "2.0", "id": "$id", "method": "workspace/reload"}""")
|
||||
private def reloadWorkspace(): Int =
|
||||
sendRequest("workspace/reload")
|
||||
|
||||
private def compile(buildTarget: URI, id: Int = nextId()): Unit = {
|
||||
private def compile(buildTarget: URI): Int = {
|
||||
val params =
|
||||
CompileParams(targets = Vector(BuildTargetIdentifier(buildTarget)), None, Vector.empty)
|
||||
svr.sendJsonRpc(request(id, "buildTarget/compile", params))
|
||||
sendRequest("buildTarget/compile", params)
|
||||
}
|
||||
|
||||
private def buildTargetSources(buildTargets: Seq[URI], id: Int = nextId()): String = {
|
||||
private def scalacOptions(buildTargets: Seq[URI]): Int = {
|
||||
val targets = buildTargets.map(BuildTargetIdentifier.apply).toVector
|
||||
request(id, "buildTarget/sources", SourcesParams(targets))
|
||||
sendRequest("buildTarget/scalacOptions", ScalacOptionsParams(targets))
|
||||
}
|
||||
|
||||
private def request[T: JsonWriter](id: Int, method: String, params: T): String = {
|
||||
val request = JsonRpcRequestMessage("2.0", id.toString, method, Converter.toJson(params).get)
|
||||
val json = Converter.toJson(request).get
|
||||
CompactPrinter(json)
|
||||
private def javacOptions(buildTargets: Seq[URI]): Int = {
|
||||
val targets = buildTargets.map(BuildTargetIdentifier.apply).toVector
|
||||
sendRequest("buildTarget/scalacOptions", ScalacOptionsParams(targets))
|
||||
}
|
||||
|
||||
private def buildTargetSources(buildTargets: Seq[URI]): Int = {
|
||||
val targets = buildTargets.map(BuildTargetIdentifier.apply).toVector
|
||||
sendRequest("buildTarget/sources", SourcesParams(targets))
|
||||
}
|
||||
|
||||
private def sendRequest(method: String): Int = {
|
||||
val id = nextId()
|
||||
val msg = JsonRpcRequestMessage("2.0", id.toString, method, None)
|
||||
val json = Converter.toJson(msg).get
|
||||
svr.sendJsonRpc(CompactPrinter(json))
|
||||
id
|
||||
}
|
||||
|
||||
private def sendRequest[T: JsonWriter](method: String, params: T): Int = {
|
||||
val id = nextId()
|
||||
val msg = JsonRpcRequestMessage("2.0", id.toString, method, Converter.toJson(params).get)
|
||||
val json = Converter.toJson(msg).get
|
||||
svr.sendJsonRpc(CompactPrinter(json))
|
||||
if (method != "build/initialize") assertProcessing(method)
|
||||
id
|
||||
}
|
||||
|
||||
private def buildTargetUri(project: String, config: String): URI =
|
||||
|
|
|
|||
|
|
@ -15,8 +15,10 @@ import sbt.librarymanagement.{
|
|||
DependencyResolution,
|
||||
ModuleID,
|
||||
ScalaArtifacts,
|
||||
SemanticSelector,
|
||||
UnresolvedWarningConfiguration,
|
||||
UpdateConfiguration
|
||||
UpdateConfiguration,
|
||||
VersionNumber,
|
||||
}
|
||||
import sbt.librarymanagement.syntax._
|
||||
import xsbti.ArtifactInfo.SbtOrganization
|
||||
|
|
@ -25,6 +27,8 @@ import xsbti.compile.{ ClasspathOptions, ScalaInstance => XScalaInstance }
|
|||
|
||||
object ZincLmUtil {
|
||||
|
||||
final val scala2SbtBridgeStart = "2.13.12"
|
||||
|
||||
/**
|
||||
* Instantiate a Scala compiler that is instrumented to analyze dependencies.
|
||||
* This Scala compiler is useful to create your own instance of incremental
|
||||
|
|
@ -86,6 +90,11 @@ object ZincLmUtil {
|
|||
if (ScalaArtifacts.isScala3(scalaVersion)) {
|
||||
ModuleID(ScalaArtifacts.Organization, "scala3-sbt-bridge", scalaVersion)
|
||||
.withConfigurations(Some(Compile.name))
|
||||
} else if (VersionNumber(scalaVersion).matchesSemVer(
|
||||
SemanticSelector(s"=2.13 >=$scala2SbtBridgeStart")
|
||||
)) {
|
||||
ModuleID(ScalaArtifacts.Organization, "scala2-sbt-bridge", scalaVersion)
|
||||
.withConfigurations(Some(Compile.name))
|
||||
} else {
|
||||
val compilerBridgeId = scalaVersion match {
|
||||
case sc if sc startsWith "2.10." => "compiler-bridge_2.10"
|
||||
|
|
|
|||
Loading…
Reference in New Issue