From 780665a60c8492bc994e01f3f084ffdc03317d2f Mon Sep 17 00:00:00 2001 From: gontard Date: Fri, 24 Dec 2021 16:12:37 +0100 Subject: [PATCH] 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 --- .../scala/sbt/internal/bsp/BuildServerConnection.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/protocol/src/main/scala/sbt/internal/bsp/BuildServerConnection.scala b/protocol/src/main/scala/sbt/internal/bsp/BuildServerConnection.scala index 66ac7bdf0..fa7fce354 100644 --- a/protocol/src/main/scala/sbt/internal/bsp/BuildServerConnection.scala +++ b/protocol/src/main/scala/sbt/internal/bsp/BuildServerConnection.scala @@ -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)