mirror of https://github.com/sbt/sbt.git
Specify full java path in BSP connection details
Use System properties to add java path and classpath to BSP connection details
This commit is contained in:
parent
eceb1d896e
commit
2c0d09dfb3
|
|
@ -10,7 +10,6 @@ package internal
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import java.io.{ File, IOException }
|
import java.io.{ File, IOException }
|
||||||
import java.lang.management.ManagementFactory
|
|
||||||
import java.net.{ InetAddress, ServerSocket, Socket, SocketTimeoutException }
|
import java.net.{ InetAddress, ServerSocket, Socket, SocketTimeoutException }
|
||||||
import java.util.concurrent.atomic.{ AtomicBoolean, AtomicReference }
|
import java.util.concurrent.atomic.{ AtomicBoolean, AtomicReference }
|
||||||
import java.nio.file.attribute.{ AclEntry, AclEntryPermission, AclEntryType, UserPrincipal }
|
import java.nio.file.attribute.{ AclEntry, AclEntryPermission, AclEntryType, UserPrincipal }
|
||||||
|
|
@ -219,8 +218,7 @@ private[sbt] object Server {
|
||||||
private[this] def writeBspConnectionDetails(): Unit = {
|
private[this] def writeBspConnectionDetails(): Unit = {
|
||||||
import bsp.codec.JsonProtocol._
|
import bsp.codec.JsonProtocol._
|
||||||
val sbtVersion = appConfiguration.provider.id.version
|
val sbtVersion = appConfiguration.provider.id.version
|
||||||
val launcherClassPath = ManagementFactory.getRuntimeMXBean.getClassPath
|
val details = BuildServerConnection.details(sbtVersion)
|
||||||
val details = BuildServerConnection.details(sbtVersion, launcherClassPath)
|
|
||||||
val json = Converter.toJson(details).get
|
val json = Converter.toJson(details).get
|
||||||
IO.write(bspConnectionFile, CompactPrinter(json), append = false)
|
IO.write(bspConnectionFile, CompactPrinter(json), append = false)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,6 @@ object BuildServerProtocol {
|
||||||
|
|
||||||
case r if r.method == "buildTarget/compile" =>
|
case r if r.method == "buildTarget/compile" =>
|
||||||
val param = Converter.fromJson[CompileParams](json(r)).get
|
val param = Converter.fromJson[CompileParams](json(r)).get
|
||||||
callback.log.info(param.toString)
|
|
||||||
val targets = param.targets.map(_.uri).mkString(" ")
|
val targets = param.targets.map(_.uri).mkString(" ")
|
||||||
val command = Keys.bspBuildTargetCompile.key
|
val command = Keys.bspBuildTargetCompile.key
|
||||||
val _ = callback.appendExec(s"$command $targets", Some(r.id))
|
val _ = callback.appendExec(s"$command $targets", Some(r.id))
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,16 @@ object BuildServerConnection {
|
||||||
final val bspVersion = "2.0.0-M5"
|
final val bspVersion = "2.0.0-M5"
|
||||||
final val languages = Vector("scala")
|
final val languages = Vector("scala")
|
||||||
|
|
||||||
def details(sbtVersion: String, launcherClassPath: String): BspConnectionDetails = {
|
private[sbt] def details(sbtVersion: String): BspConnectionDetails = {
|
||||||
|
val javaHome = System.getProperty("java.home")
|
||||||
|
val classPath = System.getProperty("java.class.path")
|
||||||
val argv =
|
val argv =
|
||||||
Vector(
|
Vector(
|
||||||
"java",
|
s"$javaHome/bin/java",
|
||||||
"-Xms100m",
|
"-Xms100m",
|
||||||
"-Xmx100m",
|
"-Xmx100m",
|
||||||
"-classpath",
|
"-classpath",
|
||||||
launcherClassPath,
|
classPath,
|
||||||
"xsbt.boot.Boot",
|
"xsbt.boot.Boot",
|
||||||
"-bsp"
|
"-bsp"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue