Ensure sbtConfig argv does not need sbt in PATH

Before, the BSP config .bsp/sbt.json generated by `sbt bspConfig`
contained a command line which required the sbt binary in the PATH.
This fix changes the nature of the -Dsbt.script option. It was
an argument of the main class xsbt.boot.Boot, it's now a system
property and thus it's used to launch the sbt server.

Fixes https://github.com/sbt/sbt/issues/6760
This commit is contained in:
gontard 2021-12-24 16:12:37 +01:00
parent 450c87f576
commit 780665a60c
1 changed files with 5 additions and 3 deletions

View File

@ -49,9 +49,11 @@ object BuildServerConnection {
"-Xmx100m",
"-classpath",
classPath,
"xsbt.boot.Boot",
"-bsp"
) ++ sbtScript.orElse(sbtLaunchJar)
) ++
sbtScript ++
Vector("xsbt.boot.Boot", "-bsp") ++
(if (sbtScript.isEmpty) sbtLaunchJar else None)
val details = BspConnectionDetails(name, sbtVersion, bspVersion, languages, argv)
val json = Converter.toJson(details).get
IO.write(bspConnectionFile, CompactPrinter(json), append = false)