Merge branch 'develop' into client-launch-jar

This commit is contained in:
Adrien Piquerez
2021-01-11 13:20:49 +01:00
committed by GitHub
272 changed files with 1929 additions and 1163 deletions
@@ -9,10 +9,10 @@ final class CommandSource private (
override def equals(o: Any): Boolean = o match {
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
case x: CommandSource => (this.channelName == x.channelName)
case _ => false
}
})
override def hashCode: Int = {
37 * (37 * (17 + "sbt.CommandSource".##) + channelName.##)
}
+2 -2
View File
@@ -11,10 +11,10 @@ final class Exec private (
private def this(commandLine: String, source: Option[sbt.CommandSource]) = this(commandLine, None, source)
override def equals(o: Any): Boolean = o match {
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
case x: Exec => (this.commandLine == x.commandLine) && (this.execId == x.execId) && (this.source == x.source)
case _ => false
}
})
override def hashCode: Int = {
37 * (37 * (37 * (37 * (17 + "sbt.Exec".##) + commandLine.##) + execId.##) + source.##)
}
@@ -151,7 +151,7 @@ object BasicCommands {
def completionsParser(state: State): Parser[String] = completionsParser
private[this] def completionsParser: Parser[String] = {
val notQuoted = (NotQuoted ~ any.*) map { case (nq, s) => nq ++ s }
val notQuoted = (NotQuoted ~ any.*) map { case (nq, s) => nq + s }
val quotedOrUnquotedSingleArgument = Space ~> (StringVerbatim | StringEscapable | notQuoted)
token(quotedOrUnquotedSingleArgument ?? "" examples ("", " "))
}
@@ -97,6 +97,13 @@ object BasicKeys {
10000
)
val bspEnabled =
AttributeKey[Boolean](
"bspEnabled",
"Enable/Disable BSP for this build, project or configuration",
10000
)
// Unlike other BasicKeys, this is not used directly as a setting key,
// and severLog / logLevel is used instead.
private[sbt] val serverLogLevel =
@@ -179,7 +179,8 @@ private[sbt] class ClassLoaderCache(
}
override def apply(files: List[File]): ClassLoader = {
files match {
case d :: s :: Nil if d.getName.startsWith("dotty-library") =>
case d :: s :: Nil
if d.getName.startsWith("dotty-library") || d.getName.startsWith("scala3-library") =>
apply(files, classOf[org.jline.terminal.Terminal].getClassLoader)
case _ =>
val key = new Key(files)
@@ -217,7 +218,7 @@ private[sbt] class ClassLoaderCache(
}
}
private def clear(lock: Object): Unit = {
delegate.forEach {
delegate.asScala.foreach {
case (_, ClassLoaderReference(_, classLoader)) => close(classLoader)
case (_, r: Reference[ClassLoader]) =>
r.get match {
@@ -1086,7 +1086,15 @@ object NetworkClient {
}
val base = new File("").getCanonicalFile
if (!sbtArguments.contains("-Dsbt.io.virtual=true")) sbtArguments += "-Dsbt.io.virtual=true"
new Arguments(base, sbtArguments, commandArgs, completionArguments, sbtScript, bsp, launchJar)
new Arguments(
base,
sbtArguments.toSeq,
commandArgs.toSeq,
completionArguments.toSeq,
sbtScript,
bsp,
launchJar
)
}
def client(
@@ -98,10 +98,13 @@ private[sbt] object Server {
}
log.info(s"sbt server started at ${connection.shortName}")
writePortfile()
BuildServerConnection.writeConnectionFile(
appConfiguration.provider.id.version,
appConfiguration.baseDirectory
)
if (connection.bspEnabled) {
log.debug("Writing bsp connection file")
BuildServerConnection.writeConnectionFile(
appConfiguration.provider.id.version,
appConfiguration.baseDirectory
)
}
running.set(true)
p.success(())
while (running.get()) {
@@ -241,6 +244,7 @@ private[sbt] case class ServerConnection(
appConfiguration: AppConfiguration,
windowsServerSecurityLevel: Int,
useJni: Boolean,
bspEnabled: Boolean,
) {
def shortName: String = {
connectionType match {