Merge branch 'develop' into patch-1

This commit is contained in:
Conny Brunnkvist 2022-08-31 22:42:22 +07:00 committed by GitHub
commit adc1b2a79b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 752 additions and 394 deletions

View File

@ -1,162 +0,0 @@
image:
- MacOS
- Visual Studio 2015
- Visual Studio 2019
- Ubuntu
build: off
init:
- git config --global core.autocrlf input
for:
-
matrix:
only:
- image: Ubuntu
branches:
only:
- build-graal
artifacts:
- path: client/target/bin/sbtn
name: sbtn
install:
- curl -sL https://github.com/sbt/sbt/releases/download/v1.3.10/sbt-1.3.10.tgz > ~/sbt-bin.tgz
- mkdir ~/sbt
- tar -xf ~/sbt-bin.tgz --directory ~/sbt
- curl -sL https://raw.githubusercontent.com/shyiko/jabba/0.11.0/install.sh | bash && . ~/.jabba/jabba.sh
- jabba install adopt@1.8.0-275
- jabba use adopt@1.8.0-275
- curl -sL https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.1.0/graalvm-ce-java8-linux-amd64-20.1.0.tar.gz > graalvm.tar.gz
- tar -xf graalvm.tar.gz
- export PATH="~/sbt/sbt/bin:$PATH"
- export PATH="$PATH:~/.jabba/jdk/adopt@1.8.0-275/bin"
- export JAVA_HOME="~/.jabba/jdk/adopt@1.8.0-275"
test_script:
- export PATH="$PATH:~/.jabba/jdk/adopt@1.8.0-275/bin"
- export PATH="$PATH:graalvm-ce-java8-20.1.0/bin"
- gu install native-image
- sbt "-Dsbt.io.virtual=false" "-Dsbt.native-image=$(pwd)/graalvm-ce-java8-20.1.0/bin/native-image" "sbtClientProj/buildNativeThinClient"
-
matrix:
only:
- image: MacOS
branches:
only:
- build-graal
artifacts:
- path: client/target/bin/sbtn
name: mac-native-sbt-client
install:
- curl -sL https://github.com/sbt/sbt/releases/download/v1.3.10/sbt-1.3.10.tgz > ~/sbt-bin.tgz
- mkdir ~/sbt
- tar -xf ~/sbt-bin.tgz --directory ~/sbt
- curl -sL https://raw.githubusercontent.com/shyiko/jabba/0.11.0/install.sh | bash && . ~/.jabba/jabba.sh
- jabba install adopt@1.8.0-222
- jabba use adopt@1.8.0-222
- curl -sL https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.1.0/graalvm-ce-java8-darwin-amd64-20.1.0.tar.gz > graalvm.tar.gz
- tar -xf graalvm.tar.gz
- export PATH="~/sbt/sbt/bin:$PATH"
- export PATH="$PATH:~/.jabba/jdk/adopt@1.8.0-222/bin"
- export JAVA_HOME="~/.jabba/jdk/adopt@1.8.0-222"
test_script:
- export PATH="$PATH:~/.jabba/jdk/adopt@1.8.0-222/Contents/Home/bin"
- export PATH="$PATH:graalvm-ce-java8-20.1.0/Contents/Home/bin"
- gu install native-image
- sbt "-Dsbt.io.virtual=false" "-Dsbt.native-image=$(pwd)/graalvm-ce-java8-20.1.0/Contents/Home/bin/native-image" "sbtClientProj/buildNativeThinClient"
-
matrix:
only:
- image: Visual Studio 2015
branches:
only:
- build-graal
artifacts:
- path: client\target\bin\sbtn.exe
name: sbtn.exe
install:
- cinst adoptopenjdk8 -params 'installdir=C:\\jdk8'
- SET CI=true
#- choco install windows-sdk-7.1 kb2519277
- call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd"
- ps: |
Add-Type -AssemblyName System.IO.Compression.FileSystem
if (!(Test-Path -Path "C:\sbt" )) {
(new-object System.Net.WebClient).DownloadFile(
'https://github.com/sbt/sbt/releases/download/v1.3.10/sbt-1.3.10.zip',
'C:\sbt-bin.zip'
)
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\sbt-bin.zip", "C:\sbt")
}
if (!(Test-Path -Path "C:\graalvm-ce-java8-20.2.0-dev" )) {
(new-object System.Net.WebClient).DownloadFile(
'https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.1.0/graalvm-ce-java8-windows-amd64-20.1.0.zip',
'C:\graalvm-ce-java8-20.1.0.zip'
)
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\graalvm-ce-java8-20.1.0.zip", "C:\")
}
if (!(Test-Path -Path "C:\zulu-jdk7" )) {
(new-object System.Net.WebClient).DownloadFile(
'https://cdn.azul.com/zulu/bin/zulu7.38.0.11-ca-jdk7.0.262-win_x64.zip',
'C:\zulu-jdk7.zip'
)
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\zulu-jdk7.zip", "C:\")
}
- SET PATH=C:\graalvm-ce-java8-20.1.0\bin;%PATH%
- SET PATH=C:\sbt\sbt\bin;%PATH%
- SET JAVA_HOME=C:\jdk8
- gu install native-image
- rm .sbtopts
cache:
- '%USERPROFILE%\.ivy2\cache'
- '%LOCALAPPDATA%\Coursier\Cache\v1'
- '%USERPROFILE%\.sbt'
test_script:
- sbt "-Dsbt.io.virtual=false" "-Dsbt.native-image=C:\graalvm-ce-java8-20.1.0\bin\native-image.cmd" "sbtClientProj/buildNativeThinClient"
-
matrix:
only:
- image: Visual Studio 2019
branches:
except:
- build-graal
install:
- cinst adoptopenjdk8 -params 'installdir=C:\\jdk8'
- SET JAVA_HOME=C:\jdk8
- SET PATH=C:\jdk8\bin;%PATH%
- SET CI=true
- ps: |
Add-Type -AssemblyName System.IO.Compression.FileSystem
if (!(Test-Path -Path "C:\sbt" )) {
(new-object System.Net.WebClient).DownloadFile(
'https://github.com/sbt/sbt/releases/download/v1.3.10/sbt-1.3.10.zip',
'C:\sbt-bin.zip'
)
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\sbt-bin.zip", "C:\sbt")
}
- SET PATH=C:\sbt\sbt\bin;%PATH%
- SET SBT_OPTS=-Xmx4g -Dsbt.supershell=never -Dfile.encoding=UTF8
- rm .sbtopts
cache:
- '%USERPROFILE%\.ivy2\cache'
- '%LOCALAPPDATA%\Coursier\Cache\v1'
- '%USERPROFILE%\.sbt'
test_script:
# The server tests often fail in CI when run together so just run a single test to ensure
# that the thin client works on windows
- sbt "-Dsbt.io.virtual=false" "scripted actions/* reporter/source-mapper classloader-cache/* nio/* watch/*" "serverTestProj/testOnly testpkg.ClientTest"

View File

@ -41,7 +41,7 @@ jobs:
java: 8
distribution: adopt
jobtype: 8
- os: windows-latest
- os: windows-2019
java: 8
distribution: adopt
jobtype: 9
@ -95,6 +95,9 @@ jobs:
with:
path: ~/.sbt
key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- name: Setup Windows C++ toolchain
uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.os == 'windows-2019' }}
- name: Build and test (1)
if: ${{ matrix.jobtype == 1 }}
shell: bash
@ -107,7 +110,6 @@ jobs:
./sbt -v --client serverTestProj/scalafmtCheckAll
./sbt -v --client headerCheck
./sbt -v --client "Test/headerCheck"
./sbt -v --client whitesourceOnPush
./sbt -v --client "Test/compile"
./sbt -v --client publishLocal
./sbt -v --client test
@ -152,6 +154,8 @@ jobs:
if: ${{ matrix.jobtype == 7 }}
shell: bash
run: |
# test building sbtn on Linux
sbt "-Dsbt.io.virtual=false" nativeImage
# test launcher script
echo build using JDK 8 test using JDK 8 and JDK 11
cd launcher-package
@ -165,6 +169,8 @@ jobs:
if: ${{ matrix.jobtype == 8 }}
shell: bash
run: |
# test building sbtn on macOS
sbt "-Dsbt.io.virtual=false" nativeImage
# test launcher script
echo build using JDK 8, test using JDK 8, on macOS
cd launcher-package
@ -175,6 +181,8 @@ jobs:
if: ${{ matrix.jobtype == 9 }}
shell: bash
run: |
# test building sbtn on Windows
sbt "-Dsbt.io.virtual=false" nativeImage
# test launcher script
echo build using JDK 8, test using JDK 8, on Windows
cd launcher-package

12
.github/workflows/dependency-graph.yml vendored Normal file
View File

@ -0,0 +1,12 @@
# .github/workflows/dependency-graph.yml
name: Submit Dependency Graph
on:
push:
branches: [1.7.x] # default branch of the project
jobs:
submit-graph:
name: Submit Dependency Graph
runs-on: ubuntu-latest # or windows-latest, or macOS-latest
steps:
- uses: actions/checkout@v3
- uses: scalacenter/sbt-dependency-submission@v2

View File

@ -1,8 +1,9 @@
name: Nightly
on:
schedule:
# 08:00 UTC = 03:00 EST
- cron: '0 8 * * *'
workflow_dispatch:
# schedule:
# # 08:00 UTC = 03:00 EST
# - cron: '0 8 * * *'
jobs:
deploy:

View File

@ -1,6 +1,6 @@
[![CI](https://github.com/sbt/sbt/actions/workflows/ci.yml/badge.svg)](https://github.com/sbt/sbt/actions/workflows/ci.yml)
[![Latest version](https://img.shields.io/github/tag/sbt/sbt.svg)](https://index.scala-lang.org/sbt/sbt)
[![Gitter Chat](https://badges.gitter.im/sbt/sbt.svg)](https://gitter.im/sbt/sbt)
[![Discord](https://img.shields.io/discord/632150470000902164?label=Discord%20%23sbt)](https://discord.com/channels/632150470000902164/922600050989875282)
[sbt/sbt-zero-seven]: https://github.com/sbt/sbt-zero-seven
[CONTRIBUTING]: CONTRIBUTING.md

116
build.sbt
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.7.0-SNAPSHOT"
val v = "1.7.2-SNAPSHOT"
nightlyVersion.getOrElse(v)
}
ThisBuild / version2_13 := "2.0.0-SNAPSHOT"
@ -50,7 +50,6 @@ Global / semanticdbVersion := "4.5.9"
val excludeLint = SettingKey[Set[Def.KeyedInitialize[_]]]("excludeLintKeys")
Global / excludeLint := (Global / excludeLint).?.value.getOrElse(Set.empty)
Global / excludeLint += componentID
Global / excludeLint += whitesourceIgnoredScopes
Global / excludeLint += scriptedBufferLog
Global / excludeLint += checkPluginCross
@ -129,6 +128,8 @@ val sbt13Plus =
"1.3.0",
"1.4.0",
"1.5.0",
"1.6.0",
"1.7.0",
)
val sbt10Plus =
Seq(
@ -211,7 +212,7 @@ lazy val sbtRoot: Project = (project in file("."))
mimaSettings,
mimaPreviousArtifacts := Set.empty,
buildThinClient := (sbtClientProj / buildThinClient).evaluated,
buildNativeThinClient := (sbtClientProj / buildNativeThinClient).value,
nativeImage := (sbtClientProj / nativeImage).value,
installNativeThinClient := {
// nativeInstallDirectory can be set globally or in a gitignored local file
val dir = nativeInstallDirectory.?.value
@ -226,7 +227,7 @@ lazy val sbtRoot: Project = (project in file("."))
}
}
val base = baseDirectory.value.toPath
val exec = (sbtClientProj / buildNativeThinClient).value
val exec = (sbtClientProj / nativeImage).value.toPath
streams.value.log.info(s"installing thin client ${base.relativize(exec)} to ${target}")
Files.copy(exec, target, java.nio.file.StandardCopyOption.REPLACE_EXISTING)
}
@ -246,6 +247,7 @@ lazy val bundledLauncherProj =
description := "sbt application launcher",
autoScalaLibrary := false,
crossPaths := false,
Compile / doc / javacOptions := Nil,
Compile / packageBin := sbtLaunchJar.value,
mimaSettings,
mimaPreviousArtifacts := Set()
@ -340,6 +342,7 @@ lazy val utilInterface = (project in file("internal") / "util-interface").settin
javaOnlySettings,
crossPaths := false,
autoScalaLibrary := false,
Compile / doc / javacOptions := Nil,
name := "Util Interface",
exportJars := true,
utilMimaSettings,
@ -532,6 +535,7 @@ lazy val testAgentProj = (project in file("testing") / "agent")
crossScalaVersions := Seq(baseScalaVersion),
crossPaths := false,
autoScalaLibrary := false,
Compile / doc / javacOptions := Nil,
name := "Test Agent",
libraryDependencies += testInterface,
mimaSettings,
@ -618,6 +622,7 @@ lazy val scriptedSbtReduxProj = (project in file("scripted-sbt-redux"))
.dependsOn(sbtProj % "compile;test->test", commandProj, utilLogging, utilScripted)
.settings(
baseSettings,
crossScalaVersions := Seq(baseScalaVersion),
name := "Scripted sbt Redux",
libraryDependencies ++= Seq(launcherInterface % "provided"),
mimaSettings,
@ -629,6 +634,7 @@ lazy val scriptedSbtOldProj = (project in file("scripted-sbt-old"))
.dependsOn(scriptedSbtReduxProj)
.settings(
baseSettings,
crossScalaVersions := Seq(baseScalaVersion),
name := "Scripted sbt",
mimaSettings,
mimaBinaryIssueFilters ++= Seq(
@ -656,6 +662,7 @@ lazy val dependencyTreeProj = (project in file("dependency-tree"))
.settings(
sbtPlugin := true,
baseSettings,
crossScalaVersions := Seq(baseScalaVersion),
name := "sbt-dependency-tree",
publishMavenStyle := true,
// mimaSettings,
@ -1140,17 +1147,11 @@ lazy val serverTestProj = (project in file("server-test"))
val isWin = scala.util.Properties.isWin
val buildThinClient =
inputKey[JPath]("generate a java implementation of the thin client")
val thinClientClasspath =
taskKey[Seq[JPath]]("Generate the classpath for thin client (compacted for windows)")
val thinClientNativeImageCommand = taskKey[String]("The native image command")
val thinClientNativeImageOptions = settingKey[Seq[String]]("The native image options")
val thinClientNativeImageClass = settingKey[String]("The class for the native image")
val buildNativeThinClient = taskKey[JPath]("Generate a native executable")
// Use a TaskKey rather than SettingKey for nativeInstallDirectory so it can left unset by default
val nativeInstallDirectory = taskKey[JPath]("The install directory for the native executable")
val installNativeThinClient = inputKey[JPath]("Install the native executable")
val nativeThinClientPath = settingKey[JPath]("The location of the native executable")
lazy val sbtClientProj = (project in file("client"))
.enablePlugins(NativeImagePlugin)
.dependsOn(commandProj)
.settings(
commonBaseSettings,
@ -1161,65 +1162,16 @@ lazy val sbtClientProj = (project in file("client"))
crossPaths := false,
exportJars := true,
libraryDependencies += jansi,
libraryDependencies += scalatest % "test",
/*
* On windows, the raw classpath is too large to be a command argument to an
* external process so we create symbolic links with short names to get the
* classpath length under the limit.
*/
thinClientClasspath := {
val original = (Compile / fullClasspathAsJars).value.map(_.data)
val outputDir = target.value / "thinclientcp"
IO.createDirectory(outputDir)
Files.walk(outputDir.toPath).forEach {
case f if f.getFileName.toString.endsWith(".jar") => Files.deleteIfExists(f)
case _ =>
}
original.zipWithIndex.map {
case (f, i) => Files.createSymbolicLink(outputDir.toPath / s"$i.jar", f.toPath)
}
libraryDependencies += scalatest % Test,
Compile / mainClass := Some("sbt.client.Client"),
nativeImageReady := { () =>
()
},
thinClientNativeImageCommand := System.getProperty("sbt.native-image", "native-image").toString,
buildNativeThinClient / name := s"sbtn${if (isWin) ".exe" else ""}",
nativeThinClientPath := target.value.toPath / "bin" / (buildNativeThinClient / name).value,
thinClientNativeImageClass := "sbt.client.Client",
buildNativeThinClient := {
val hasChanges = thinClientClasspath.outputFileChanges.hasChanges
val cpString =
thinClientClasspath.value.map(_.getFileName).mkString(java.io.File.pathSeparator)
val prefix = Seq(thinClientNativeImageCommand.value, "-cp", cpString)
val full = prefix ++ thinClientNativeImageOptions.value :+ thinClientNativeImageClass.value
val dir = target.value
if (hasChanges || !Files.exists(nativeThinClientPath.value)) {
val pb = new java.lang.ProcessBuilder(full: _*)
pb.directory(dir / "thinclientcp")
val proc = pb.start()
val thread = new Thread {
setDaemon(true)
val is = proc.getInputStream
val es = proc.getErrorStream
override def run(): Unit = {
Thread.sleep(100)
while (proc.isAlive) {
if (is.available > 0 || es.available > 0) {
while (is.available > 0) System.out.print(is.read.toChar)
while (es.available > 0) System.err.print(es.read.toChar)
}
if (proc.isAlive) Thread.sleep(10)
}
}
}
thread.start()
proc.waitFor(5, java.util.concurrent.TimeUnit.MINUTES)
assert(proc.exitValue == 0, s"Exit value ${proc.exitValue} was nonzero")
}
nativeThinClientPath.value
},
thinClientNativeImageOptions := Seq(
nativeImageOutput := target.value / "bin" / "sbtn",
nativeImageOptions ++= Seq(
"--no-fallback",
s"--initialize-at-run-time=sbt.client",
"--verbose",
// "--verbose",
"-H:IncludeResourceBundles=jline.console.completer.CandidateListCompletionHandler",
"-H:+ReportExceptionStackTraces",
"-H:-ParseRuntimeOptions",
@ -1506,15 +1458,6 @@ def customCommands: Seq[Setting[_]] = Seq(
s"""set scalaVersion in ThisBuild := "$scala212" """ ::
state
},
commands += Command.command("whitesourceOnPush") { state =>
sys.env.get("TRAVIS_EVENT_TYPE") match {
case Some("push") =>
"whitesourceCheckPolicies" ::
"whitesourceUpdate" ::
state
case _ => state
}
},
commands += Command.command("release-sbt-local") { state =>
"clean" ::
"so compile" ::
@ -1571,24 +1514,3 @@ ThisBuild / publishTo := {
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
ThisBuild / publishMavenStyle := true
ThisBuild / whitesourceProduct := "Lightbend Reactive Platform"
ThisBuild / whitesourceAggregateProjectName := {
// note this can get detached on tag build etc
val b = sys.process.Process("git rev-parse --abbrev-ref HEAD").!!.trim
val Stable = """1\.([0-9]+)\.x""".r
b match {
case Stable(y) => "sbt-1." + y.toString + "-stable"
case _ => "sbt-master"
}
}
ThisBuild / whitesourceAggregateProjectToken := {
(ThisBuild / whitesourceAggregateProjectName).value match {
case "sbt-master" => "e7a1e55518c0489a98e9c7430c8b2ccd53d9f97c12ed46148b592ebe4c8bf128"
case "sbt-1.3-stable" => "7e38cbb4d2fc4599835cd5d2cfb41b150597a4147b15424bb65841664ab2ec0d"
case "sbt-1.2-stable" => "54f2313767aa47198971e65595670ee16e1ad0000d20458588e72d3ac2c34763"
case _ => "" // it's ok to fail here
}
}
ThisBuild / whitesourceIgnoredScopes ++= Seq("plugin", "scalafmt", "sxr")
ThisBuild / whitesourceFailOnError := sys.env.contains("WHITESOURCE_PASSWORD") // fail if pwd is present
ThisBuild / whitesourceForceCheckAllDependencies := true

View File

@ -189,6 +189,14 @@ object Terminal {
try Terminal.console.printStream.println(s"[info] $string")
catch { case _: IOException => }
}
private[this] val writeLock = new AnyRef
def withWriteLock[A](f: => A): A = {
writeLock.synchronized {
f
}
}
private[sbt] def set(terminal: Terminal): Terminal = activeTerminal.getAndSet(terminal)
implicit class TerminalOps(private val term: Terminal) extends AnyVal {
def ansi(richString: => String, string: => String): String =
@ -462,7 +470,7 @@ object Terminal {
val sepBytes = System.lineSeparator.getBytes("UTF-8")
private class LinePrintStream(outputStream: OutputStream)
extends PrintStream(outputStream, true) {
override def println(s: String): Unit = synchronized {
override def println(s: String): Unit = withWriteLock {
out.write(s.getBytes("UTF-8") ++ sepBytes)
out.flush()
}
@ -667,7 +675,7 @@ object Terminal {
}
override def close(): Unit = if (running.compareAndSet(true, false)) this.interrupt()
}
def read(): Int = {
override def read(): Int = {
if (isScripted) -1
else if (bootInputStreamHolder.get == null) activeTerminal.get().inputStream.read()
else {
@ -681,6 +689,13 @@ object Terminal {
poll()
}
}
override def available(): Int =
if (isScripted) 0
else
bootInputStreamHolder.get match {
case null => activeTerminal.get().inputStream.available()
case stream => stream.available() + activeTerminal.get().inputStream.available()
}
}
private[this] object proxyOutputStream extends OutputStream {
private[this] def os: OutputStream = activeTerminal.get().outputStream
@ -911,7 +926,6 @@ object Terminal {
override def getWidth: Int = getSize._1
override def getHeight: Int = getSize._2
private[this] val rawMode = new AtomicBoolean(false)
private[this] val writeLock = new AnyRef
def throwIfClosed[R](f: => R): R = if (isStopped.get) throw new ClosedChannelException else f
override def getLastLine: Option[String] = progressState.currentLine
override def getLines: Seq[String] = progressState.getLines
@ -939,7 +953,7 @@ object Terminal {
write(Array((b & 0xFF).toByte))
}
override def write(b: Array[Byte]): Unit = throwIfClosed {
writeLock.synchronized(doWrite(b))
withWriteLock(doWrite(b))
}
override def write(b: Array[Byte], offset: Int, length: Int): Unit = throwIfClosed {
write(Arrays.copyOfRange(b, offset, offset + length))

View File

@ -7,10 +7,14 @@
package sbt.util
import xsbti.{ Position, Problem, Severity, T2 }
import java.io.File
import java.util.Optional
import java.util.function.Supplier
import java.{ util => ju }
import xsbti.{ DiagnosticCode, DiagnosticRelatedInformation, Position, Problem, Severity, T2 }
import scala.collection.mutable.ListBuffer
object InterfaceUtil {
def toSupplier[A](a: => A): Supplier[A] = new Supplier[A] {
@ -43,6 +47,18 @@ object InterfaceUtil {
case None => Optional.empty[A]()
}
def l2jl[A](l: List[A]): ju.List[A] = {
val jl = new ju.ArrayList[A](l.size)
l.foreach(jl.add(_))
jl
}
def jl2l[A](jl: ju.List[A]): List[A] = {
val l = ListBuffer[A]()
jl.forEach(l += _)
l.toList
}
@deprecated("Use the overload of this method with more arguments", "1.2.2")
def position(
line0: Option[Integer],
@ -104,6 +120,7 @@ object InterfaceUtil {
def problem(cat: String, pos: Position, msg: String, sev: Severity): Problem =
problem(cat, pos, msg, sev, None)
@deprecated("Use the overload of this method with more arguments", "1.7.2")
def problem(
cat: String,
pos: Position,
@ -111,7 +128,18 @@ object InterfaceUtil {
sev: Severity,
rendered: Option[String]
): Problem =
new ConcreteProblem(cat, pos, msg, sev, rendered)
problem(cat, pos, msg, sev, rendered, None, List.empty[DiagnosticRelatedInformation])
def problem(
cat: String,
pos: Position,
msg: String,
sev: Severity,
rendered: Option[String],
diagnosticCode: Option[DiagnosticCode],
diagnosticRelatedInforamation: List[DiagnosticRelatedInformation]
): Problem =
new ConcreteProblem(cat, pos, msg, sev, rendered, diagnosticCode, diagnosticRelatedInforamation)
private final class ConcreteT2[A1, A2](a1: A1, a2: A2) extends T2[A1, A2] {
val get1: A1 = a1
@ -166,13 +194,18 @@ object InterfaceUtil {
pos: Position,
msg: String,
sev: Severity,
rendered0: Option[String]
rendered0: Option[String],
diagnosticCode0: Option[DiagnosticCode],
diagnosticRelatedInformation0: List[DiagnosticRelatedInformation]
) extends Problem {
val category = cat
val position = pos
val message = msg
val severity = sev
override val rendered = o2jo(rendered0)
override def diagnosticCode: Optional[DiagnosticCode] = o2jo(diagnosticCode0)
override def diagnosticRelatedInforamation(): ju.List[DiagnosticRelatedInformation] =
l2jl(diagnosticRelatedInformation0)
override def toString = s"[$severity] $pos: $message"
}
}

View File

@ -119,7 +119,7 @@ val root = (project in file(".")).
file
},
// update sbt.sh at root
sbtnVersion := "1.4.7",
sbtnVersion := "1.7.0",
sbtnJarsBaseUrl := "https://github.com/sbt/sbtn-dist/releases/download",
sbtnJarsMappings := {
val baseUrl = sbtnJarsBaseUrl.value

View File

@ -310,7 +310,7 @@ public class BootServerSocket implements AutoCloseable {
return "sbt-load" + hash;
} else {
final String alternativeSocketLocation =
System.getenv().getOrDefault("XDG_RUNTIME_DIR", "/tmp");
System.getenv().getOrDefault("XDG_RUNTIME_DIR", System.getProperty("java.io.tmpdir"));
final Path alternativeSocketLocationRoot =
Paths.get(alternativeSocketLocation).resolve(".sbt");
final Path locationForSocket = alternativeSocketLocationRoot.resolve("sbt-socket" + hash);

View File

@ -8,7 +8,6 @@
package sbt
import java.io.File
import java.util.regex.Pattern
import sbt.Def.{ ScopedKey, Setting }
import sbt.Keys._
import sbt.SlashSyntax0._
@ -16,10 +15,11 @@ import sbt.internal.Act
import sbt.internal.CommandStrings._
import sbt.internal.inc.ScalaInstance
import sbt.internal.util.AttributeKey
import sbt.internal.util.MessageOnlyException
import sbt.internal.util.complete.DefaultParsers._
import sbt.internal.util.complete.{ DefaultParsers, Parser }
import sbt.io.IO
import sbt.librarymanagement.CrossVersion
import sbt.librarymanagement.{ SemanticSelector, VersionNumber }
/**
* Cross implements the Scala cross building commands:
@ -295,7 +295,14 @@ object Cross {
if (switch.version.force) {
state.log.info(s"Forcing Scala version to $version on all projects.")
} else {
state.log.info(s"Setting Scala version to $version on ${included.size} projects.")
included
.groupBy(_._2)
.foreach {
case (selectedVersion, projects) =>
state.log.info(
s"Setting Scala version to $selectedVersion on ${projects.size} projects."
)
}
}
if (excluded.nonEmpty && !switch.verbose) {
state.log.info(s"Excluded ${excluded.size} projects, run ++ $version -v for more details.")
@ -327,10 +334,11 @@ object Cross {
} ++ structure.units.keys
.map(BuildRef.apply)
.map(proj => (proj, Some(version), crossVersions(extracted, proj)))
} else if (version.contains('*')) {
} else {
projectScalaVersions.map {
case (project, scalaVersions) =>
globFilter(version, scalaVersions) match {
val selector = SemanticSelector(version)
scalaVersions.filter(v => selector.matches(VersionNumber(v))) match {
case Nil => (project, None, scalaVersions)
case Seq(version) => (project, Some(version), scalaVersions)
case multiple =>
@ -339,15 +347,6 @@ object Cross {
)
}
}
} else {
val binaryVersion = CrossVersion.binaryScalaVersion(version)
projectScalaVersions.map {
case (project, scalaVersions) =>
if (scalaVersions.exists(v => CrossVersion.binaryScalaVersion(v) == binaryVersion))
(project, Some(version), scalaVersions)
else
(project, None, scalaVersions)
}
}
}
@ -359,10 +358,15 @@ object Cross {
}
if (included.isEmpty) {
sys.error(
s"""Switch failed: no subprojects list "$version" (or compatible version) in crossScalaVersions setting.
|If you want to force it regardless, call ++ $version!""".stripMargin
)
if (isSelector(version))
throw new MessageOnlyException(
s"""Switch failed: no subprojects have a version matching "$version" in the crossScalaVersions setting."""
)
else
throw new MessageOnlyException(
s"""Switch failed: no subprojects list "$version" (or compatible version) in crossScalaVersions setting.
|If you want to force it regardless, call ++ $version!""".stripMargin
)
}
logSwitchInfo(included, excluded)
@ -370,19 +374,13 @@ object Cross {
(setScalaVersionsForProjects(instance, included, state, extracted), included.map(_._1))
}
def globFilter(pattern: String, candidates: Seq[String]): Seq[String] = {
def createGlobRegex(remainingPattern: String): String =
remainingPattern.indexOf("*") match {
case -1 => Pattern.quote(remainingPattern)
case n =>
val chunk = Pattern.quote(remainingPattern.substring(0, n)) + ".*"
if (remainingPattern.length > n)
chunk + createGlobRegex(remainingPattern.substring(n + 1))
else chunk
}
val compiledPattern = Pattern.compile(createGlobRegex(pattern))
candidates.filter(compiledPattern.matcher(_).matches())
}
// determine whether this is a 'specific' version or a selector
// to be passed to SemanticSelector
private def isSelector(version: String): Boolean =
version.contains('*') || version.contains('x') || version.contains('X') || version.contains(' ') ||
version.contains('<') || version.contains('>') || version.contains('|') || version.contains(
'='
)
private def setScalaVersionsForProjects(
instance: Option[(File, ScalaInstance)],

View File

@ -412,6 +412,8 @@ object Keys {
val bspBuildTargetResourcesItem = taskKey[ResourcesItem]("").withRank(DTask)
val bspBuildTargetDependencySources = inputKey[Unit]("").withRank(DTask)
val bspBuildTargetDependencySourcesItem = taskKey[DependencySourcesItem]("").withRank(DTask)
val bspBuildTargetOutputPaths = inputKey[Unit]("").withRank(DTask)
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)

View File

@ -141,23 +141,31 @@ private[sbt] object xMain {
private def getSocketOrExit(
configuration: xsbti.AppConfiguration
): (Option[BootServerSocket], Option[Exit]) =
try (Some(new BootServerSocket(configuration)) -> None)
): (Option[BootServerSocket], Option[Exit]) = {
def printThrowable(e: Throwable): Unit = {
println("sbt thinks that server is already booting because of this exception:")
e.printStackTrace()
}
try Some(new BootServerSocket(configuration)) -> None
catch {
case e: ServerAlreadyBootingException
if System.console != null && !ITerminal.startedByRemoteClient =>
println("sbt thinks that server is already booting because of this exception:")
e.printStackTrace()
printThrowable(e)
println("Create a new server? y/n (default y)")
val exit =
if (ITerminal.get.withRawInput(System.in.read) == 'n'.toInt) Some(Exit(1))
else None
(None, exit)
case _: ServerAlreadyBootingException =>
case e: ServerAlreadyBootingException =>
if (SysProp.forceServerStart) (None, None)
else (None, Some(Exit(2)))
else {
printThrowable(e)
(None, Some(Exit(2)))
}
case _: UnsatisfiedLinkError => (None, None)
}
}
}
final class ScriptMain extends xsbti.AppMain {

View File

@ -10,6 +10,15 @@ package sbt.internal
private[sbt] object Banner {
def apply(version: String): Option[String] =
version match {
case v if v.startsWith("1.7.0") =>
Some(s"""
|Here are some highlights of this release:
| - `++ <sv> <command1>` updates
| - Scala 3 compiler error improvements
| - Improved Build Server Protocol (BSP) support
|See https://eed3si9n.com/sbt-1.7.0 for full release notes.
|Hide the banner for this release by running `skipBanner`.
|""".stripMargin.linesIterator.mkString("\n"))
case v if v.startsWith("1.6.0") =>
Some(s"""
|Here are some highlights of this release:

View File

@ -374,17 +374,23 @@ $SwitchCommand [<scala-version>=]<scala-home>[!] [-v] [<command>]
Uses the Scala installation at <scala-home> by configuring the scalaHome setting for
all projects.
If <scala-version> is specified, it is used as the value of the scalaVersion setting.
If <scala-version> is specified, it is used to select the value of the scalaVersion setting
from one of the values of crossScalaVersions setting.
This is important when using managed dependencies. This version will determine the
cross-version used as well as transitive dependencies.
Only projects that are listed to be binary compatible with the selected Scala version
<scala-version> may be an actual Scala version such as 3.1.3, or a Semantic Version selector
pattern such as 2.13.x. Only subprojects that are listed to match the version pattern
have their Scala version switched. If ! is supplied, then all projects projects have
their Scala version switched.
If -v is supplied, verbose logging of the Scala version switching is done.
If <command> is provided, it is then executed.
If <command> is provided, it is then executed. For example:
++ 2.13.x test
The above will run test on all subprojects that contain a 2.13 Scala version.
See also `help $CrossCommand`
"""

View File

@ -101,10 +101,8 @@ private[sbt] object Load {
val delegates = defaultDelegates
val pluginMgmt = PluginManagement(loader)
val inject = InjectSettings(injectGlobal(state), Nil, const(Nil))
System.setProperty(
"swoval.tmpdir",
System.getProperty("swoval.tmpdir", globalBase.getAbsolutePath.toString)
)
SysProp.setSwovalTempDir()
SysProp.setIpcSocketTempDir()
LoadBuildConfiguration(
stagingDirectory,
classpath,

View File

@ -9,6 +9,7 @@ package sbt
package internal
import java.io.File
import java.nio.file.{ Path, Paths }
import java.util.Locale
import scala.util.control.NonFatal
@ -220,4 +221,33 @@ object SysProp {
lazy val sbtCredentialsEnv: Option[Credentials] =
sys.env.get("SBT_CREDENTIALS").map(raw => new FileCredentials(new File(raw)))
private[sbt] def setSwovalTempDir(): Unit = {
val _ = getOrUpdateSwovalTmpDir(
runtimeDirectory.resolve("swoval").toString
)
}
private[sbt] def setIpcSocketTempDir(): Unit = {
val _ = getOrUpdateIpcSocketTmpDir(
runtimeDirectory.resolve("ipcsocket").toString
)
}
private[this] lazy val getOrUpdateSwovalTmpDir: String => String =
getOrUpdateSysProp("swoval.tmpdir")(_)
private[this] lazy val getOrUpdateIpcSocketTmpDir: String => String =
getOrUpdateSysProp("sbt.ipcsocket.tmpdir")(_)
private[this] def getOrUpdateSysProp(key: String)(value: String): String = {
val newVal = sys.props.getOrElse(key, value)
sys.props += (key -> newVal)
newVal
}
/**
* This returns a temporary directory that is friendly to macOS, Linux,
* Windows, and Docker environment.
* Mostly these directories will be used as throw-away location to extract
* native files etc.
*/
private[this] def runtimeDirectory: Path =
Paths.get(sys.env.getOrElse("XDG_RUNTIME_DIR", sys.props("java.io.tmpdir"))).resolve(".sbt")
}

View File

@ -52,6 +52,7 @@ object BuildServerProtocol {
RunProvider(BuildServerConnection.languages),
dependencySourcesProvider = true,
resourcesProvider = true,
outputPathsProvider = true,
canReload = true,
jvmRunEnvironmentProvider = true,
jvmTestEnvironmentProvider = true,
@ -158,6 +159,16 @@ object BuildServerProtocol {
}
}.evaluated,
bspBuildTargetDependencySources / aggregate := false,
bspBuildTargetOutputPaths := bspInputTask { (state, _, workspace, filter) =>
Def.task {
import sbt.internal.bsp.codec.JsonProtocol._
val items = bspBuildTargetOutputPathsItem.result.all(filter).value
val successfulItems = anyOrThrow(items)
val result = OutputPathsResult(successfulItems.toVector)
state.respondEvent(result)
}
}.evaluated,
bspBuildTargetOutputPaths / aggregate := false,
bspBuildTargetCompile := bspInputTask { (state, _, workspace, filter) =>
workspace.warnIfBuildsNonEmpty(Method.Compile, state.log)
Def.task {
@ -267,6 +278,10 @@ object BuildServerProtocol {
ResourcesItem(id, uris)
},
bspBuildTargetDependencySourcesItem := dependencySourcesItemTask.value,
bspBuildTargetOutputPathsItem := {
val id = bspTargetIdentifier.value
OutputPathsItem(id, Vector(OutputPathItem(target.value.toURI, OutputPathItemKind.Directory)))
},
bspBuildTargetCompileItem := bspCompileTask.value,
bspBuildTargetRun := bspRunTask.evaluated,
bspBuildTargetScalacOptionsItem := scalacOptionsTask.value,
@ -318,6 +333,7 @@ object BuildServerProtocol {
final val Shutdown = "build/shutdown"
final val Sources = "buildTarget/sources"
final val Resources = "buildTarget/resources"
final val OutputPaths = "buildTarget/outputPaths"
final val DependencySources = "buildTarget/dependencySources"
final val Compile = "buildTarget/compile"
final val Test = "buildTarget/test"
@ -453,6 +469,12 @@ object BuildServerProtocol {
val targets = param.targets.map(_.uri).mkString(" ")
val command = Keys.bspBuildTargetResources.key
val _ = callback.appendExec(s"$command $targets", Some(r.id))
case r if r.method == Method.OutputPaths =>
val param = Converter.fromJson[OutputPathsParams](json(r)).get
val targets = param.targets.map(_.uri).mkString(" ")
val command = Keys.bspBuildTargetOutputPaths.key
val _ = callback.appendExec(s"$command $targets", Some(r.id))
},
onResponse = PartialFunction.empty,
onNotification = {
@ -661,7 +683,7 @@ object BuildServerProtocol {
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 baseDir = Keys.baseDirectory.value.getAbsolutePath
val env = envVars.value
JvmEnvironmentItem(

View File

@ -1,20 +0,0 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
package sbt
object CrossSpec extends verify.BasicTestSuite {
import Cross._
test("glob filter should work as expected") {
assert(globFilter("2.13.*", Seq("2.12.8", "2.13.16", "3.0.1")) == Seq("2.13.16"))
assert(globFilter("3.*", Seq("2.12.8", "2.13.16", "3.0.1")) == Seq("3.0.1"))
assert(globFilter("3.*", Seq("3.0.1", "30.1")) == Seq("3.0.1"))
assert(globFilter("2.*", Seq("2.12.8", "2.13.16", "3.0.1")) == Seq("2.12.8", "2.13.16"))
assert(globFilter("4.*", Seq("2.12.8", "2.13.16", "3.0.1")) == Nil)
}
}

View File

@ -0,0 +1,8 @@
[@ruippeixotog]: https://github.com/ruippeixotog
[#6915]: https://github.com/sbt/sbt/issues/6915
[#6926]: https://github.com/sbt/sbt/pull/6926
### Bug Fixes
- Make `++ <scala-version> <command>` run `<command>` only on compatible Scala 3 subprojects. [#6915][]/[#6926][] by [@ruippeixotog][]

View File

@ -0,0 +1,4 @@
[@povder]: https://github.com/povder
### Improvements
- Add support for newly introduced `buildTarget/outputPaths` method of BSP protocol. See [bsp#269](https://github.com/build-server-protocol/build-server-protocol/pull/269) pull request and [bsp#205](https://github.com/build-server-protocol/build-server-protocol/issues/205) issue.

View File

@ -12,10 +12,10 @@ object Dependencies {
sys.env.get("BUILD_VERSION") orElse sys.props.get("sbt.build.version")
// sbt modules
private val ioVersion = nightlyVersion.getOrElse("1.6.0")
private val ioVersion = nightlyVersion.getOrElse("1.7.0")
private val lmVersion =
sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.7.0-M1")
val zincVersion = nightlyVersion.getOrElse("1.7.0-M2")
sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.7.0")
val zincVersion = nightlyVersion.getOrElse("1.7.1")
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
@ -26,7 +26,7 @@ object Dependencies {
val launcherInterface = "org.scala-sbt" % "launcher-interface" % launcherVersion
val rawLauncher = "org.scala-sbt" % "launcher" % launcherVersion
val testInterface = "org.scala-sbt" % "test-interface" % "1.0"
val ipcSocket = "org.scala-sbt.ipcsocket" % "ipcsocket" % "1.3.1"
val ipcSocket = "org.scala-sbt.ipcsocket" % "ipcsocket" % "1.5.0"
private val compilerInterface = "org.scala-sbt" % "compiler-interface" % zincVersion
private val compilerClasspath = "org.scala-sbt" %% "zinc-classpath" % zincVersion

View File

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

View File

@ -7,8 +7,8 @@ addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.0")
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.5.1")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.5")
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.14")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.8.1")
addSbtPlugin("com.swoval" % "sbt-java-format" % "0.3.1")
addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.3.1")
addDependencyTreePlugin

View File

@ -17,6 +17,7 @@ final class BuildServerCapabilities private (
val runProvider: Option[sbt.internal.bsp.RunProvider],
val dependencySourcesProvider: Option[Boolean],
val resourcesProvider: Option[Boolean],
val outputPathsProvider: Option[Boolean],
val canReload: Option[Boolean],
val jvmRunEnvironmentProvider: Option[Boolean],
val jvmTestEnvironmentProvider: Option[Boolean]) extends Serializable {
@ -24,17 +25,17 @@ final class BuildServerCapabilities private (
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) && (this.jvmRunEnvironmentProvider == x.jvmRunEnvironmentProvider) && (this.jvmTestEnvironmentProvider == x.jvmTestEnvironmentProvider)
case x: BuildServerCapabilities => (this.compileProvider == x.compileProvider) && (this.testProvider == x.testProvider) && (this.runProvider == x.runProvider) && (this.dependencySourcesProvider == x.dependencySourcesProvider) && (this.resourcesProvider == x.resourcesProvider) && (this.outputPathsProvider == x.outputPathsProvider) && (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 * (37 * (37 * (17 + "sbt.internal.bsp.BuildServerCapabilities".##) + compileProvider.##) + testProvider.##) + runProvider.##) + dependencySourcesProvider.##) + resourcesProvider.##) + canReload.##) + jvmRunEnvironmentProvider.##) + jvmTestEnvironmentProvider.##)
37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.BuildServerCapabilities".##) + compileProvider.##) + testProvider.##) + runProvider.##) + dependencySourcesProvider.##) + resourcesProvider.##) + outputPathsProvider.##) + canReload.##) + jvmRunEnvironmentProvider.##) + jvmTestEnvironmentProvider.##)
}
override def toString: String = {
"BuildServerCapabilities(" + compileProvider + ", " + testProvider + ", " + runProvider + ", " + dependencySourcesProvider + ", " + resourcesProvider + ", " + canReload + ", " + jvmRunEnvironmentProvider + ", " + jvmTestEnvironmentProvider + ")"
"BuildServerCapabilities(" + compileProvider + ", " + testProvider + ", " + runProvider + ", " + dependencySourcesProvider + ", " + resourcesProvider + ", " + outputPathsProvider + ", " + 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, jvmRunEnvironmentProvider: Option[Boolean] = jvmRunEnvironmentProvider, jvmTestEnvironmentProvider: Option[Boolean] = jvmTestEnvironmentProvider): BuildServerCapabilities = {
new 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, outputPathsProvider: Option[Boolean] = outputPathsProvider, canReload: Option[Boolean] = canReload, jvmRunEnvironmentProvider: Option[Boolean] = jvmRunEnvironmentProvider, jvmTestEnvironmentProvider: Option[Boolean] = jvmTestEnvironmentProvider): BuildServerCapabilities = {
new BuildServerCapabilities(compileProvider, testProvider, runProvider, dependencySourcesProvider, resourcesProvider, outputPathsProvider, canReload, jvmRunEnvironmentProvider, jvmTestEnvironmentProvider)
}
def withCompileProvider(compileProvider: Option[sbt.internal.bsp.CompileProvider]): BuildServerCapabilities = {
copy(compileProvider = compileProvider)
@ -66,6 +67,12 @@ final class BuildServerCapabilities private (
def withResourcesProvider(resourcesProvider: Boolean): BuildServerCapabilities = {
copy(resourcesProvider = Option(resourcesProvider))
}
def withOutputPathsProvider(outputPathsProvider: Option[Boolean]): BuildServerCapabilities = {
copy(outputPathsProvider = outputPathsProvider)
}
def withOutputPathsProvider(outputPathsProvider: Boolean): BuildServerCapabilities = {
copy(outputPathsProvider = Option(outputPathsProvider))
}
def withCanReload(canReload: Option[Boolean]): BuildServerCapabilities = {
copy(canReload = canReload)
}
@ -87,6 +94,6 @@ final class BuildServerCapabilities private (
}
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], 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))
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], outputPathsProvider: Option[Boolean], canReload: Option[Boolean], jvmRunEnvironmentProvider: Option[Boolean], jvmTestEnvironmentProvider: Option[Boolean]): BuildServerCapabilities = new BuildServerCapabilities(compileProvider, testProvider, runProvider, dependencySourcesProvider, resourcesProvider, outputPathsProvider, canReload, jvmRunEnvironmentProvider, jvmTestEnvironmentProvider)
def apply(compileProvider: sbt.internal.bsp.CompileProvider, testProvider: sbt.internal.bsp.TestProvider, runProvider: sbt.internal.bsp.RunProvider, dependencySourcesProvider: Boolean, resourcesProvider: Boolean, outputPathsProvider: Boolean, canReload: Boolean, jvmRunEnvironmentProvider: Boolean, jvmTestEnvironmentProvider: Boolean): BuildServerCapabilities = new BuildServerCapabilities(Option(compileProvider), Option(testProvider), Option(runProvider), Option(dependencySourcesProvider), Option(resourcesProvider), Option(outputPathsProvider), Option(canReload), Option(jvmRunEnvironmentProvider), Option(jvmTestEnvironmentProvider))
}

View File

@ -0,0 +1,36 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp
final class OutputPathItem private (
val uri: java.net.URI,
val kind: Int) extends Serializable {
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
case x: OutputPathItem => (this.uri == x.uri) && (this.kind == x.kind)
case _ => false
})
override def hashCode: Int = {
37 * (37 * (37 * (17 + "sbt.internal.bsp.OutputPathItem".##) + uri.##) + kind.##)
}
override def toString: String = {
"OutputPathItem(" + uri + ", " + kind + ")"
}
private[this] def copy(uri: java.net.URI = uri, kind: Int = kind): OutputPathItem = {
new OutputPathItem(uri, kind)
}
def withUri(uri: java.net.URI): OutputPathItem = {
copy(uri = uri)
}
def withKind(kind: Int): OutputPathItem = {
copy(kind = kind)
}
}
object OutputPathItem {
def apply(uri: java.net.URI, kind: Int): OutputPathItem = new OutputPathItem(uri, kind)
}

View File

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

View 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
/** Build Target OutputPaths Request */
final class OutputPathsParams 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: OutputPathsParams => (this.targets == x.targets)
case _ => false
})
override def hashCode: Int = {
37 * (37 * (17 + "sbt.internal.bsp.OutputPathsParams".##) + targets.##)
}
override def toString: String = {
"OutputPathsParams(" + targets + ")"
}
private[this] def copy(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier] = targets): OutputPathsParams = {
new OutputPathsParams(targets)
}
def withTargets(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): OutputPathsParams = {
copy(targets = targets)
}
}
object OutputPathsParams {
def apply(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): OutputPathsParams = new OutputPathsParams(targets)
}

View 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
/** Build Target OutputPaths response */
final class OutputPathsResult private (
val items: Vector[sbt.internal.bsp.OutputPathsItem]) extends Serializable {
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
case x: OutputPathsResult => (this.items == x.items)
case _ => false
})
override def hashCode: Int = {
37 * (37 * (17 + "sbt.internal.bsp.OutputPathsResult".##) + items.##)
}
override def toString: String = {
"OutputPathsResult(" + items + ")"
}
private[this] def copy(items: Vector[sbt.internal.bsp.OutputPathsItem] = items): OutputPathsResult = {
new OutputPathsResult(items)
}
def withItems(items: Vector[sbt.internal.bsp.OutputPathsItem]): OutputPathsResult = {
copy(items = items)
}
}
object OutputPathsResult {
def apply(items: Vector[sbt.internal.bsp.OutputPathsItem]): OutputPathsResult = new OutputPathsResult(items)
}

View File

@ -16,11 +16,12 @@ implicit lazy val BuildServerCapabilitiesFormat: JsonFormat[sbt.internal.bsp.Bui
val runProvider = unbuilder.readField[Option[sbt.internal.bsp.RunProvider]]("runProvider")
val dependencySourcesProvider = unbuilder.readField[Option[Boolean]]("dependencySourcesProvider")
val resourcesProvider = unbuilder.readField[Option[Boolean]]("resourcesProvider")
val outputPathsProvider = unbuilder.readField[Option[Boolean]]("outputPathsProvider")
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, jvmRunEnvironmentProvider, jvmTestEnvironmentProvider)
sbt.internal.bsp.BuildServerCapabilities(compileProvider, testProvider, runProvider, dependencySourcesProvider, resourcesProvider, outputPathsProvider, canReload, jvmRunEnvironmentProvider, jvmTestEnvironmentProvider)
case None =>
deserializationError("Expected JsObject but found None")
}
@ -32,6 +33,7 @@ implicit lazy val BuildServerCapabilitiesFormat: JsonFormat[sbt.internal.bsp.Bui
builder.addField("runProvider", obj.runProvider)
builder.addField("dependencySourcesProvider", obj.dependencySourcesProvider)
builder.addField("resourcesProvider", obj.resourcesProvider)
builder.addField("outputPathsProvider", obj.outputPathsProvider)
builder.addField("canReload", obj.canReload)
builder.addField("jvmRunEnvironmentProvider", obj.jvmRunEnvironmentProvider)
builder.addField("jvmTestEnvironmentProvider", obj.jvmTestEnvironmentProvider)

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 ExcludeItemFormats { self: sjsonnew.BasicJsonProtocol =>
implicit lazy val ExcludeItemFormat: JsonFormat[sbt.internal.bsp.ExcludeItem] = new JsonFormat[sbt.internal.bsp.ExcludeItem] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.ExcludeItem = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val uri = unbuilder.readField[java.net.URI]("uri")
val kind = unbuilder.readField[Int]("kind")
unbuilder.endObject()
sbt.internal.bsp.ExcludeItem(uri, kind)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.ExcludeItem, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("uri", obj.uri)
builder.addField("kind", obj.kind)
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 ExcludesItemFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sbt.internal.bsp.codec.ExcludeItemFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val ExcludesItemFormat: JsonFormat[sbt.internal.bsp.ExcludesItem] = new JsonFormat[sbt.internal.bsp.ExcludesItem] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.ExcludesItem = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val target = unbuilder.readField[sbt.internal.bsp.BuildTargetIdentifier]("target")
val excludes = unbuilder.readField[Vector[sbt.internal.bsp.ExcludeItem]]("excludes")
unbuilder.endObject()
sbt.internal.bsp.ExcludesItem(target, excludes)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.ExcludesItem, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("target", obj.target)
builder.addField("excludes", obj.excludes)
builder.endObject()
}
}
}

View 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 ExcludesParamsFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val ExcludesParamsFormat: JsonFormat[sbt.internal.bsp.ExcludesParams] = new JsonFormat[sbt.internal.bsp.ExcludesParams] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.ExcludesParams = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val targets = unbuilder.readField[Vector[sbt.internal.bsp.BuildTargetIdentifier]]("targets")
unbuilder.endObject()
sbt.internal.bsp.ExcludesParams(targets)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.ExcludesParams, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("targets", obj.targets)
builder.endObject()
}
}
}

View 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 ExcludesResultFormats { self: sbt.internal.bsp.codec.ExcludesItemFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val ExcludesResultFormat: JsonFormat[sbt.internal.bsp.ExcludesResult] = new JsonFormat[sbt.internal.bsp.ExcludesResult] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.ExcludesResult = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val items = unbuilder.readField[Vector[sbt.internal.bsp.ExcludesItem]]("items")
unbuilder.endObject()
sbt.internal.bsp.ExcludesResult(items)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.ExcludesResult, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("items", obj.items)
builder.endObject()
}
}
}

View File

@ -29,6 +29,10 @@ trait JsonProtocol extends sjsonnew.BasicJsonProtocol
with sbt.internal.bsp.codec.SourceItemFormats
with sbt.internal.bsp.codec.SourcesItemFormats
with sbt.internal.bsp.codec.SourcesResultFormats
with sbt.internal.bsp.codec.OutputPathsParamsFormats
with sbt.internal.bsp.codec.OutputPathItemFormats
with sbt.internal.bsp.codec.OutputPathsItemFormats
with sbt.internal.bsp.codec.OutputPathsResultFormats
with sbt.internal.bsp.codec.DependencySourcesParamsFormats
with sbt.internal.bsp.codec.DependencySourcesItemFormats
with sbt.internal.bsp.codec.DependencySourcesResultFormats

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 OutputPathItemFormats { self: sjsonnew.BasicJsonProtocol =>
implicit lazy val OutputPathItemFormat: JsonFormat[sbt.internal.bsp.OutputPathItem] = new JsonFormat[sbt.internal.bsp.OutputPathItem] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.OutputPathItem = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val uri = unbuilder.readField[java.net.URI]("uri")
val kind = unbuilder.readField[Int]("kind")
unbuilder.endObject()
sbt.internal.bsp.OutputPathItem(uri, kind)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.OutputPathItem, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("uri", obj.uri)
builder.addField("kind", obj.kind)
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 OutputPathsItemFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sbt.internal.bsp.codec.OutputPathItemFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val OutputPathsItemFormat: JsonFormat[sbt.internal.bsp.OutputPathsItem] = new JsonFormat[sbt.internal.bsp.OutputPathsItem] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.OutputPathsItem = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val target = unbuilder.readField[sbt.internal.bsp.BuildTargetIdentifier]("target")
val outputPaths = unbuilder.readField[Vector[sbt.internal.bsp.OutputPathItem]]("outputPaths")
unbuilder.endObject()
sbt.internal.bsp.OutputPathsItem(target, outputPaths)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.OutputPathsItem, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("target", obj.target)
builder.addField("outputPaths", obj.outputPaths)
builder.endObject()
}
}
}

View 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 OutputPathsParamsFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val OutputPathsParamsFormat: JsonFormat[sbt.internal.bsp.OutputPathsParams] = new JsonFormat[sbt.internal.bsp.OutputPathsParams] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.OutputPathsParams = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val targets = unbuilder.readField[Vector[sbt.internal.bsp.BuildTargetIdentifier]]("targets")
unbuilder.endObject()
sbt.internal.bsp.OutputPathsParams(targets)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.OutputPathsParams, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("targets", obj.targets)
builder.endObject()
}
}
}

View 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 OutputPathsResultFormats { self: sbt.internal.bsp.codec.OutputPathsItemFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val OutputPathsResultFormat: JsonFormat[sbt.internal.bsp.OutputPathsResult] = new JsonFormat[sbt.internal.bsp.OutputPathsResult] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.OutputPathsResult = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val items = unbuilder.readField[Vector[sbt.internal.bsp.OutputPathsItem]]("items")
unbuilder.endObject()
sbt.internal.bsp.OutputPathsResult(items)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.OutputPathsResult, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("items", obj.items)
builder.endObject()
}
}
}

View File

@ -202,6 +202,10 @@ type BuildServerCapabilities {
# via method buildTarget/resources
resourcesProvider: Boolean
# The server provides output paths
# via method buildTarget/outputPaths
outputPathsProvider: Boolean
## Reloading the workspace state through workspace/reload is supported
canReload: Boolean
@ -290,6 +294,26 @@ type SourceItem {
generated: Boolean!
}
## Build Target OutputPaths Request
type OutputPathsParams {
targets: [sbt.internal.bsp.BuildTargetIdentifier]
}
## Build Target OutputPaths response
type OutputPathsResult {
items: [sbt.internal.bsp.OutputPathsItem]
}
type OutputPathsItem {
target: sbt.internal.bsp.BuildTargetIdentifier!
outputPaths: [sbt.internal.bsp.OutputPathItem]
}
type OutputPathItem {
uri: java.net.URI!
kind: Int!
}
## Dependency Sources Request
type DependencySourcesParams {
targets: [sbt.internal.bsp.BuildTargetIdentifier]

View File

@ -17,7 +17,7 @@ import scala.util.Properties
object BuildServerConnection {
final val name = "sbt"
final val bspVersion = "2.0.0-M5"
final val bspVersion = "2.1.0-M1"
final val languages = Vector("scala")
private final val SbtLaunchJar = "sbt-launch(-.*)?\\.jar".r

View File

@ -0,0 +1,17 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
package sbt.internal.bsp
object OutputPathItemKind {
/** The output path item references a normal file. */
val File: Int = 1
/** The output path item references a directory. */
val Directory: Int = 2
}

4
sbt
View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set +e
declare builtin_sbt_version="1.6.2"
declare builtin_sbt_version="1.7.1"
declare -a residual_args
declare -a java_args
declare -a scalac_args
@ -24,7 +24,7 @@ declare build_props_sbt_version=
declare use_sbtn=
declare no_server=
declare sbtn_command="$SBTN_CMD"
declare sbtn_version="1.4.7"
declare sbtn_version="1.7.0"
### ------------------------------- ###
### Helper methods for BASH scripts ###

View File

@ -52,7 +52,7 @@ $ exists sbt-foo/target/scala-2.12
# test wildcard switching (2.13)
> clean
> ++ 2.13.* -v compile
> ++ 2.13.x -v compile
$ exists lib/target/scala-2.13
-$ exists lib/target/scala-2.12
# -$ exists sbt-foo/target/scala-2.12

View File

@ -0,0 +1,14 @@
scalaVersion := "2.12.16"
lazy val core = project
.settings(
crossScalaVersions := Seq("2.12.16", "3.0.2", "3.1.2")
)
lazy val subproj = project
.dependsOn(core)
.settings(
crossScalaVersions := Seq("2.12.16", "3.1.2"),
// a random library compiled against Scala 3.1
libraryDependencies += "org.http4s" %% "http4s-core" % "0.23.12"
)

View File

@ -0,0 +1,6 @@
import org.http4s.Uri
object A {
// Just using something from http4s
Uri.fromString("example.com")
}

View File

@ -0,0 +1,14 @@
> ++3.0.2 compile
$ exists core/target/scala-3.0.2
-$ exists core/target/scala-3.1.2
-$ exists subproj/target/scala-3.0.2
-$ exists subproj/target/scala-3.1.2
> clean
> ++3.1.2 compile
-$ exists core/target/scala-3.0.2
$ exists core/target/scala-3.1.2
-$ exists subproj/target/scala-3.0.2
$ exists subproj/target/scala-3.1.2

View File

@ -1,4 +1,4 @@
lazy val scala212 = "2.12.12"
lazy val scala212 = "2.12.16"
lazy val scala213 = "2.13.1"
ThisBuild / scalaVersion := scala212

View File

@ -1,5 +1,7 @@
-> ++2.12.0-magic
-> ++2.12.12
> ++2.13.1 compile
$ exists core/target/scala-2.13

View File

@ -1,4 +1,4 @@
ThisBuild / scalaVersion := "3.0.0-M1"
ThisBuild / scalaVersion := "3.1.3"
lazy val plugin = project
.in(file("plugin"))
@ -12,7 +12,7 @@ lazy val plugin = project
),
libraryDependencies ++= Seq(
"ch.epfl.lamp" %% "dotty-compiler" % scalaVersion.value % "provided"
"org.scala-lang" %% "scala3-compiler" % scalaVersion.value % "provided"
)
)

View File

@ -1,4 +1,4 @@
lazy val dottyVersion = "3.0.0-M1"
lazy val dottyVersion = "3.1.3"
lazy val plugin = project
.in(file("plugin"))
@ -7,10 +7,6 @@ lazy val plugin = project
version := "0.0.1",
organization := "ch.epfl.lamp",
scalaVersion := dottyVersion,
libraryDependencies ++= Seq(
"ch.epfl.lamp" %% "dotty" % scalaVersion.value % "provided"
)
)
lazy val app = project

View File

@ -1 +0,0 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.6")

View File

@ -1,15 +1,15 @@
ThisBuild / scalaVersion := "2.13.4"
ThisBuild / scalaVersion := "2.13.8"
ThisBuild / scalacOptions += "-Ytasty-reader"
lazy val scala3code = project
.enablePlugins(ScalaJSPlugin)
.settings(scalaVersion := "3.0.0-M1")
.settings(scalaVersion := "3.1.3")
lazy val app = project
.enablePlugins(ScalaJSPlugin)
.dependsOn(scala3code)
.settings(
libraryDependencies ~= (_.filterNot(_.name.contains("scalajs-compiler"))),
addCompilerPlugin("org.scala-js" % "scalajs-compiler_2.13.4" % scalaJSVersion),
addCompilerPlugin("org.scala-js" % "scalajs-compiler_2.13.8" % scalaJSVersion),
scalaJSUseMainModuleInitializer := true,
)

View File

@ -1,2 +1 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.6")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1")

View File

@ -1,7 +1,7 @@
ThisBuild / scalaVersion := "3.0.0-M1"
ThisBuild / scalaVersion := "3.1.3"
ThisBuild / scalacOptions += "-Ytasty-reader"
lazy val scala213 = "2.13.4"
lazy val scala213 = "2.13.8"
lazy val root = (project in file("."))
.aggregate(fooApp, fooCore, barApp, barCore)

View File

@ -1 +0,0 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.6")

View File

@ -1 +1 @@
ThisBuild / scalaVersion := "3.0.0-M1"
ThisBuild / scalaVersion := "3.1.3"

View File

@ -1,3 +0,0 @@
# sbt-coursier scripted tests: required, as we default to sbt 1.0.3,
# but sbt-dotty requires sbt >= 1.2.7
sbt.version=1.2.7

View File

@ -1 +0,0 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.6")

View File

@ -2,6 +2,6 @@ name := "source-plugins"
organization := "org.example"
proguardSettings
enablePlugins(SbtProguard)
useJGit

View File

@ -1,5 +1,5 @@
lazy val proguard = uri("git://github.com/sbt/sbt-proguard.git#e7b4732969c137db1b5")
lazy val git = uri("git://github.com/sbt/sbt-git.git#2e7c2503850698d60bb")
lazy val proguard = RootProject(uri("https://github.com/sbt/sbt-proguard.git#95b27788a5b00ab89e8ae7c05ef5bfe538129280"))
lazy val git = RootProject(uri("https://github.com/sbt/sbt-git.git#a81a110af1c5693cd3fd0204248f5c529a43a112"))
lazy val root = (project in file(".")).
dependsOn(proguard, git)

View File

@ -1,7 +0,0 @@
lazy val plugins = (project in file("."))
.dependsOn(proguard, git)
// e7b4732969c137db1b5
// d4974f7362bf55d3f52
lazy val proguard = uri("git://github.com/sbt/sbt-proguard.git#e7b4732969c137db1b5")
lazy val git = uri("git://github.com/sbt/sbt-git.git#2e7c2503850698d60bb")

View File

@ -30,7 +30,9 @@ lazy val respondError = project.in(file("respond-error"))
}
)
lazy val util = project
lazy val util = project.settings(
Compile / target := baseDirectory.value / "custom-target",
)
lazy val diagnostics = project
@ -44,6 +46,7 @@ lazy val badBuildTarget = project.in(file("bad-build-target"))
Compile / bspBuildTargetDependencySourcesItem := somethingBad,
Compile / bspBuildTargetScalacOptionsItem := somethingBad,
Compile / bspBuildTargetCompileItem := somethingBad,
Compile / bspBuildTargetOutputPathsItem := somethingBad,
Compile / bspScalaMainClasses := somethingBad,
Test / bspBuildTarget := somethingBad,
Test / bspScalaTestClasses := somethingBad,

View File

@ -31,7 +31,8 @@ object BuildServerTest extends AbstractServerTest {
initializeRequest()
assert(svr.waitForString(10.seconds) { s =>
(s contains """"id":"8"""") &&
(s contains """"resourcesProvider":true""")
(s contains """"resourcesProvider":true""") &&
(s contains """"outputPathsProvider":true""")
})
}
@ -412,7 +413,7 @@ object BuildServerTest extends AbstractServerTest {
(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
(s contains s""""workingDirectory":"${svr.baseDirectory.getAbsolutePath}/run-and-test"""")
}
}
}
@ -434,7 +435,8 @@ object BuildServerTest extends AbstractServerTest {
(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\"}")
(s contains "\"environmentVariables\":{\"KEY_TEST\":\"VALUE_TEST\"}") &&
(s contains s""""workingDirectory":"${svr.baseDirectory.getAbsolutePath}/run-and-test"""")
}
}
}
@ -538,13 +540,39 @@ object BuildServerTest extends AbstractServerTest {
})
}
test("buildTarget/outputPaths") { _ =>
val buildTarget = buildTargetUri("util", "Compile")
val badBuildTarget = buildTargetUri("badBuildTarget", "Compile")
svr.sendJsonRpc(
s"""{ "jsonrpc": "2.0", "id": "97", "method": "buildTarget/outputPaths", "params": {
| "targets": [{ "uri": "$buildTarget" }, { "uri": "$badBuildTarget" }]
|} }""".stripMargin
)
assert(processing("buildTarget/outputPaths"))
val actualResult = svr.waitFor[OutputPathsResult](10.seconds)
val expectedResult = OutputPathsResult(
items = Vector(
OutputPathsItem(
target = BuildTargetIdentifier(buildTarget),
outputPaths = Vector(
OutputPathItem(
uri = new File(svr.baseDirectory, "util/custom-target").toURI,
kind = OutputPathItemKind.Directory
)
)
)
)
)
assert(actualResult == expectedResult)
}
private def initializeRequest(): Unit = {
svr.sendJsonRpc(
"""{ "jsonrpc": "2.0", "id": "8", "method": "build/initialize",
| "params": {
| "displayName": "test client",
| "version": "1.0.0",
| "bspVersion": "2.0.0-M5",
| "bspVersion": "2.1.0-M1",
| "rootUri": "file://root/",
| "capabilities": { "languageIds": ["scala"] }
| }