mirror of https://github.com/sbt/sbt.git
Use java command in BspConnectionDetails
This commit is contained in:
parent
b184be860f
commit
0789fd7be6
|
|
@ -10,6 +10,7 @@ package internal
|
|||
package server
|
||||
|
||||
import java.io.{ File, IOException }
|
||||
import java.lang.management.ManagementFactory
|
||||
import java.net.{ InetAddress, ServerSocket, Socket, SocketTimeoutException }
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.nio.file.attribute.{ AclEntry, AclEntryPermission, AclEntryType, UserPrincipal }
|
||||
|
|
@ -28,6 +29,7 @@ import sbt.internal.util.ErrorHandling
|
|||
import sbt.internal.util.Util.isWindows
|
||||
import org.scalasbt.ipcsocket._
|
||||
import sbt.internal.bsp.BuildServerConnection
|
||||
import xsbti.AppConfiguration
|
||||
|
||||
private[sbt] sealed trait ServerInstance {
|
||||
def shutdown(): Unit
|
||||
|
|
@ -199,7 +201,9 @@ private[sbt] object Server {
|
|||
|
||||
private[this] def writeBspConnectionDetails(): Unit = {
|
||||
import bsp.codec.JsonProtocol._
|
||||
val details = BuildServerConnection.details(sbtVersion)
|
||||
val sbtVersion = appConfiguration.provider.id.version
|
||||
val launcherJar = ManagementFactory.getRuntimeMXBean.getClassPath
|
||||
val details = BuildServerConnection.details(sbtVersion, launcherJar)
|
||||
val json = Converter.toJson(details).get
|
||||
IO.write(bspConnectionFile, CompactPrinter(json), append = false)
|
||||
}
|
||||
|
|
@ -223,7 +227,7 @@ private[sbt] case class ServerConnection(
|
|||
socketfile: File,
|
||||
pipeName: String,
|
||||
bspConnectionFile: File,
|
||||
sbtVersion: String
|
||||
appConfiguration: AppConfiguration
|
||||
) {
|
||||
def shortName: String = {
|
||||
connectionType match {
|
||||
|
|
|
|||
|
|
@ -118,7 +118,6 @@ private[sbt] final class CommandExchange {
|
|||
private[sbt] def runServer(s: State): State = {
|
||||
lazy val port = s.get(serverPort).getOrElse(5001)
|
||||
lazy val host = s.get(serverHost).getOrElse("127.0.0.1")
|
||||
lazy val sbtVersion = s.configuration.provider.id.version
|
||||
lazy val auth: Set[ServerAuthentication] =
|
||||
s.get(serverAuthentication).getOrElse(Set(ServerAuthentication.Token))
|
||||
lazy val connectionType = s.get(serverConnectionType).getOrElse(ConnectionType.Tcp)
|
||||
|
|
@ -159,7 +158,7 @@ private[sbt] final class CommandExchange {
|
|||
socketfile,
|
||||
pipeName,
|
||||
bspConnectionFile,
|
||||
sbtVersion
|
||||
s.configuration
|
||||
)
|
||||
val serverInstance = Server.start(connection, onIncomingSocket, s.log)
|
||||
// don't throw exception when it times out
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@ object BuildServerConnection {
|
|||
final val name = "sbt"
|
||||
final val bspVersion = "2.0.0-M5"
|
||||
final val languages = Vector("scala")
|
||||
final val argv = Vector("sbt", "-bsp")
|
||||
def details(sbtVersion: String): BspConnectionDetails = {
|
||||
|
||||
def details(sbtVersion: String, launcherJar: String): BspConnectionDetails = {
|
||||
val argv = Vector("java", "-Xms100m", "-Xmx100m", "-jar", launcherJar, "-bsp")
|
||||
BspConnectionDetails(name, sbtVersion, bspVersion, languages, argv)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue