mirror of https://github.com/sbt/sbt.git
Merge branch 'develop' into client-launch-jar
This commit is contained in:
commit
fdcfe87dbf
|
|
@ -6,6 +6,7 @@ on:
|
|||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
|
|
@ -21,8 +22,11 @@ jobs:
|
|||
java: 11
|
||||
jobtype: 4
|
||||
- os: ubuntu-latest
|
||||
java: 8
|
||||
java: 11
|
||||
jobtype: 5
|
||||
- os: ubuntu-latest
|
||||
java: 8
|
||||
jobtype: 6
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
JAVA_OPTS: -Xms800M -Xmx2G -Xss6M -XX:ReservedCodeCacheSize=128M -server -Dsbt.io.virtual=false -Dfile.encoding=UTF-8
|
||||
|
|
@ -78,6 +82,9 @@ jobs:
|
|||
sbt -v "repoOverrideTest:scripted dependency-management/*; scripted source-dependencies/* project/*"
|
||||
;;
|
||||
5)
|
||||
sbt -v "++$SCALA_213!; test;"
|
||||
;;
|
||||
6)
|
||||
# build from fresh IO, LM, and Zinc
|
||||
BUILD_VERSION="1.5.0-SNAPSHOT"
|
||||
cd io
|
||||
|
|
|
|||
37
build.sbt
37
build.sbt
|
|
@ -11,12 +11,14 @@ ThisBuild / version := {
|
|||
val v = "1.5.0-SNAPSHOT"
|
||||
nightlyVersion.getOrElse(v)
|
||||
}
|
||||
ThisBuild / version2_13 := "2.0.0-SNAPSHOT"
|
||||
ThisBuild / versionScheme := Some("early-semver")
|
||||
ThisBuild / scalafmtOnCompile := !(Global / insideCI).value
|
||||
ThisBuild / Test / scalafmtOnCompile := !(Global / insideCI).value
|
||||
ThisBuild / turbo := true
|
||||
ThisBuild / usePipelining := false // !(Global / insideCI).value
|
||||
|
||||
Global / semanticdbEnabled := !(Global / insideCI).value
|
||||
val excludeLint = SettingKey[Set[Def.KeyedInitialize[_]]]("excludeLintKeys")
|
||||
Global / excludeLint := (Global / excludeLint).?.value.getOrElse(Set.empty)
|
||||
Global / excludeLint += componentID
|
||||
|
|
@ -101,9 +103,13 @@ def commonBaseSettings: Seq[Setting[_]] = Def.settings(
|
|||
(Compile / unmanagedSources / inputFileStamps).dependsOn(Compile / javafmtOnCompile).value,
|
||||
Test / unmanagedSources / inputFileStamps :=
|
||||
(Test / unmanagedSources / inputFileStamps).dependsOn(Test / javafmtOnCompile).value,
|
||||
crossScalaVersions := Seq(baseScalaVersion),
|
||||
crossScalaVersions := List(scala212, scala213),
|
||||
publishArtifact in Test := false,
|
||||
fork in run := true,
|
||||
libraryDependencies ++= {
|
||||
if (autoScalaLibrary.value) List(silencerLib)
|
||||
else Nil
|
||||
},
|
||||
)
|
||||
def commonSettings: Seq[Setting[_]] =
|
||||
commonBaseSettings :+
|
||||
|
|
@ -167,7 +173,7 @@ def mimaSettingsSince(versions: Seq[String]): Seq[Def.Setting[_]] = Def settings
|
|||
val scriptedSbtReduxMimaSettings = Def.settings(mimaPreviousArtifacts := Set())
|
||||
|
||||
lazy val sbtRoot: Project = (project in file("."))
|
||||
.enablePlugins(ScriptedPlugin) // , SiteScaladocPlugin, GhpagesPlugin)
|
||||
// .enablePlugins(ScriptedPlugin)
|
||||
.aggregate(nonRoots: _*)
|
||||
.settings(
|
||||
buildLevelSettings,
|
||||
|
|
@ -323,6 +329,10 @@ val logicProj = (project in file("internal") / "util-logic")
|
|||
testedBaseSettings,
|
||||
name := "Logic",
|
||||
mimaSettings,
|
||||
libraryDependencies ++= (scalaVersion.value match {
|
||||
case v if v.startsWith("2.12.") => List(compilerPlugin(silencerPlugin))
|
||||
case _ => List()
|
||||
}),
|
||||
)
|
||||
|
||||
// defines Java structures used across Scala versions, such as the API structures and relationships extracted by
|
||||
|
|
@ -612,6 +622,10 @@ lazy val scriptedSbtReduxProj = (project in file("scripted-sbt-redux"))
|
|||
baseSettings,
|
||||
name := "Scripted sbt Redux",
|
||||
libraryDependencies ++= Seq(launcherInterface % "provided"),
|
||||
libraryDependencies ++= (scalaVersion.value match {
|
||||
case v if v.startsWith("2.12.") => List(compilerPlugin(silencerPlugin))
|
||||
case _ => List()
|
||||
}),
|
||||
mimaSettings,
|
||||
scriptedSbtReduxMimaSettings,
|
||||
)
|
||||
|
|
@ -908,11 +922,16 @@ lazy val mainProj = (project in file("main"))
|
|||
checkPluginCross := {
|
||||
val sv = scalaVersion.value
|
||||
val f = baseDirectory.value / "src" / "main" / "scala" / "sbt" / "PluginCross.scala"
|
||||
if (!IO.readLines(f).exists(_.contains(s""""$sv"""")))
|
||||
if (sv.startsWith("2.12") && !IO.readLines(f).exists(_.contains(s""""$sv""""))) {
|
||||
sys.error(s"PluginCross.scala does not match up with the scalaVersion $sv")
|
||||
}
|
||||
},
|
||||
libraryDependencies ++=
|
||||
(Seq(scalaXml, launcherInterface, caffeine, lmCoursierShaded) ++ log4jModules),
|
||||
libraryDependencies ++= (scalaVersion.value match {
|
||||
case v if v.startsWith("2.12.") => List()
|
||||
case _ => List(scalaPar)
|
||||
}),
|
||||
libraryDependencies ++= (scalaVersion.value match {
|
||||
case v if v.startsWith("2.12.") => List(compilerPlugin(silencerPlugin))
|
||||
case _ => List()
|
||||
|
|
@ -1029,7 +1048,11 @@ lazy val mainProj = (project in file("main"))
|
|||
// internal logging apis,
|
||||
exclude[IncompatibleSignatureProblem]("sbt.internal.LogManager*"),
|
||||
exclude[MissingTypesProblem]("sbt.internal.RelayAppender"),
|
||||
exclude[MissingClassProblem]("sbt.internal.TaskProgress$ProgressThread")
|
||||
exclude[MissingClassProblem]("sbt.internal.TaskProgress$ProgressThread"),
|
||||
// internal implementation
|
||||
exclude[MissingClassProblem](
|
||||
"sbt.internal.XMainConfiguration$ModifiedConfiguration$ModifiedAppProvider$ModifiedScalaProvider$"
|
||||
),
|
||||
)
|
||||
)
|
||||
.configure(
|
||||
|
|
@ -1049,8 +1072,13 @@ lazy val sbtProj = (project in file("sbt"))
|
|||
testedBaseSettings,
|
||||
name := "sbt",
|
||||
normalizedName := "sbt",
|
||||
version := {
|
||||
if (scalaVersion.value == baseScalaVersion) version.value
|
||||
else version2_13.value
|
||||
},
|
||||
crossScalaVersions := Seq(baseScalaVersion),
|
||||
crossPaths := false,
|
||||
crossTarget := { target.value / scalaVersion.value },
|
||||
javaOptions ++= Seq("-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"),
|
||||
mimaSettings,
|
||||
mimaBinaryIssueFilters ++= sbtIgnoredProblems,
|
||||
|
|
@ -1317,6 +1345,7 @@ def runNpm(command: String, base: File, log: sbt.internal.util.ManagedLogger) =
|
|||
|
||||
lazy val vscodePlugin = (project in file("vscode-sbt-scala"))
|
||||
.settings(
|
||||
bspEnabled := false,
|
||||
crossPaths := false,
|
||||
crossScalaVersions := Seq(baseScalaVersion),
|
||||
skip in publish := true,
|
||||
|
|
|
|||
|
|
@ -63,14 +63,11 @@ object LineReader {
|
|||
* `testOnly testOnly\ com.foo.FooSpec` instead of `testOnly com.foo.FooSpec`.
|
||||
*/
|
||||
if (c.append.nonEmpty) {
|
||||
val comp =
|
||||
if (!pl.line().endsWith(" ")) pl.line().split(" ").last + c.append else c.append
|
||||
// tell jline to append a " " if the completion would be valid with a " " appended
|
||||
// which can be the case for input tasks and some commands. We need to exclude
|
||||
// the empty string and ";" which always seem to be present.
|
||||
val complete = (Parser.completions(parser, comp + " ", 10).get.map(_.display) --
|
||||
Set(";", "")).nonEmpty
|
||||
candidates.add(new Candidate(comp, comp, null, null, null, null, complete))
|
||||
if (!pl.line().endsWith(" ")) {
|
||||
candidates.add(new Candidate(pl.line().split(" ").last + c.append))
|
||||
} else {
|
||||
candidates.add(new Candidate(c.append))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ abstract class AbstractEntry(
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: AbstractEntry => (this.channelName == x.channelName) && (this.execId == x.execId)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.util.AbstractEntry".##) + channelName.##) + execId.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ final class ProgressEvent private (
|
|||
|
||||
private def this(level: String, items: Vector[sbt.internal.util.ProgressItem], lastTaskCount: Option[Int], channelName: Option[String], execId: Option[String]) = this(level, items, lastTaskCount, channelName, execId, None, None)
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: ProgressEvent => (this.level == x.level) && (this.items == x.items) && (this.lastTaskCount == x.lastTaskCount) && (this.channelName == x.channelName) && (this.execId == x.execId) && (this.command == x.command) && (this.skipIfActive == x.skipIfActive)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.util.ProgressEvent".##) + level.##) + items.##) + lastTaskCount.##) + channelName.##) + execId.##) + command.##) + skipIfActive.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ final class ProgressItem private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: ProgressItem => (this.name == x.name) && (this.elapsedMicros == x.elapsedMicros)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.util.ProgressItem".##) + name.##) + elapsedMicros.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ final class StringEvent private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: StringEvent => (this.level == x.level) && (this.message == x.message) && (this.channelName == x.channelName) && (this.execId == x.execId)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.util.StringEvent".##) + level.##) + message.##) + channelName.##) + execId.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ final class SuccessEvent private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: SuccessEvent => (this.message == x.message)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.util.SuccessEvent".##) + message.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ final class TraceEvent private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: TraceEvent => (this.level == x.level) && (this.message == x.message) && (this.channelName == x.channelName) && (this.execId == x.execId)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.util.TraceEvent".##) + level.##) + message.##) + channelName.##) + execId.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ as is this:
|
|||
/** Disjunction (or) of the list of clauses. */
|
||||
final case class Clauses(clauses: List[Clause]) {
|
||||
assert(clauses.nonEmpty, "At least one clause is required.")
|
||||
override def toString: String =
|
||||
s"Clauses(${clauses.mkString("\n")})"
|
||||
}
|
||||
|
||||
/** When the `body` Formula succeeds, atoms in `head` are true. */
|
||||
|
|
@ -119,9 +121,9 @@ object Logic {
|
|||
|
||||
val problem =
|
||||
(checkContradictions(pos, neg): Option[LogicException]) orElse
|
||||
(checkOverlap(clauses, pos): Option[LogicException]) orElse
|
||||
(checkAcyclic(clauses): Option[LogicException])
|
||||
|
||||
(checkOverlap(clauses, pos): Option[LogicException])
|
||||
// orElse
|
||||
// (checkAcyclic(clauses): Option[LogicException])
|
||||
problem.toLeft(
|
||||
reduce0(clauses, initialFacts, Matched.empty)
|
||||
)
|
||||
|
|
@ -150,8 +152,11 @@ object Logic {
|
|||
if (contradictions.nonEmpty) Some(new InitialContradictions(contradictions)) else None
|
||||
}
|
||||
|
||||
@com.github.ghik.silencer.silent
|
||||
private[this] def checkAcyclic(clauses: Clauses): Option[CyclicNegation] = {
|
||||
val deps = dependencyMap(clauses)
|
||||
// println(s"deps = $deps")
|
||||
// println(s"graph(deps) = ${graph(deps)}")
|
||||
val cycle = Dag.findNegativeCycle(graph(deps))
|
||||
if (cycle.nonEmpty) Some(new CyclicNegation(cycle)) else None
|
||||
}
|
||||
|
|
@ -167,6 +172,10 @@ object Logic {
|
|||
}
|
||||
|
||||
def head(b: Literal) = b.atom
|
||||
override def toString(): String =
|
||||
nodes
|
||||
.flatMap(n => List(n) ++ dependencies(n).map(d => s"$n -> $d"))
|
||||
.mkString("{\n", "\n", "\n}")
|
||||
}
|
||||
|
||||
private[this] def dependencyMap(clauses: Clauses): Map[Atom, Set[Literal]] =
|
||||
|
|
@ -201,7 +210,7 @@ object Logic {
|
|||
|
||||
def add(atoms: List[Atom]): Matched = {
|
||||
val newOnly = atoms.filterNot(provenSet)
|
||||
new Matched(provenSet ++ newOnly, newOnly ::: reverseOrdered)
|
||||
new Matched(provenSet ++ newOnly.toSet, newOnly ::: reverseOrdered)
|
||||
}
|
||||
|
||||
def ordered: List[Atom] = reverseOrdered.reverse
|
||||
|
|
@ -308,7 +317,7 @@ object Logic {
|
|||
val (pos, neg) = directDeps(formula)
|
||||
val (newPos, newNeg) = head.foldLeft((posDeps, negDeps)) {
|
||||
case ((pdeps, ndeps), d) =>
|
||||
(pdeps + (d, pos), ndeps + (d, neg))
|
||||
(pdeps.+(d, pos), ndeps.+(d, neg))
|
||||
}
|
||||
hasNegatedDependency(tail, newPos, newNeg)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ object LogicTest extends Properties("Logic") {
|
|||
property("Handles exclusion of head proved by negation.") = secure(expect(excludedNeg, Set()))
|
||||
// TODO: actually check ordering, probably as part of a check that dependencies are satisfied
|
||||
property("Properly orders results.") = secure(expect(ordering, Set(B, A, C, E, F)))
|
||||
|
||||
/*
|
||||
property("Detects cyclic negation") = secure(
|
||||
Logic.reduceAll(badClauses, Set()) match {
|
||||
case Right(_) => false
|
||||
|
|
@ -29,6 +31,7 @@ object LogicTest extends Properties("Logic") {
|
|||
case Left(err) => sys.error(s"Expected cyclic error, got: $err")
|
||||
}
|
||||
)
|
||||
*/
|
||||
|
||||
def expect(result: Either[LogicException, Matched], expected: Set[Atom]) = result match {
|
||||
case Left(_) => false
|
||||
|
|
|
|||
|
|
@ -65,15 +65,17 @@ final class Console(compiler: AnalyzingCompiler) {
|
|||
)
|
||||
} catch { case _: InterruptedException | _: ClosedChannelException => }
|
||||
val previous = sys.props.get("scala.color").getOrElse("auto")
|
||||
val jline3term = sbt.internal.util.JLine3(terminal)
|
||||
try {
|
||||
sys.props("scala.color") = if (terminal.isColorEnabled) "true" else "false"
|
||||
terminal.withRawOutput {
|
||||
jline.TerminalFactory.set(terminal.toJLine)
|
||||
DeprecatedJLine.setTerminalOverride(sbt.internal.util.JLine3(terminal))
|
||||
DeprecatedJLine.setTerminalOverride(jline3term)
|
||||
terminal.withRawInput(Run.executeTrapExit(console0, log))
|
||||
}
|
||||
} finally {
|
||||
sys.props("scala.color") = previous
|
||||
jline3term.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
package sbt
|
||||
|
||||
import scala.collection.mutable
|
||||
import testing.{ Logger => _, _ }
|
||||
import testing.{ Logger => _, Task => _, _ }
|
||||
import scala.util.control.NonFatal
|
||||
import java.net.ServerSocket
|
||||
import java.io._
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ object Tests {
|
|||
testFun: TestFunction,
|
||||
nestedTasks: Seq[TestTask]
|
||||
): Seq[(String, TestFunction)] =
|
||||
nestedTasks.view.zipWithIndex map {
|
||||
(nestedTasks.view.zipWithIndex map {
|
||||
case (nt, idx) =>
|
||||
val testFunDef = testFun.taskDef
|
||||
(
|
||||
|
|
@ -385,7 +385,7 @@ object Tests {
|
|||
nt
|
||||
)
|
||||
)
|
||||
}
|
||||
}).toSeq
|
||||
|
||||
def makeParallel(
|
||||
loader: ClassLoader,
|
||||
|
|
@ -405,9 +405,11 @@ object Tests {
|
|||
case (sum, e) =>
|
||||
val merged = sum.toSeq ++ e.toSeq
|
||||
val grouped = merged.groupBy(_._1)
|
||||
grouped.mapValues(_.map(_._2).foldLeft(SuiteResult.Empty) {
|
||||
case (resultSum, result) => resultSum + result
|
||||
})
|
||||
grouped
|
||||
.mapValues(_.map(_._2).foldLeft(SuiteResult.Empty) {
|
||||
case (resultSum, result) => resultSum + result
|
||||
})
|
||||
.toMap
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -33,32 +33,32 @@ object InputWrapper {
|
|||
@compileTimeOnly(
|
||||
"`value` can only be called on a task within a task definition macro, such as :=, +=, ++=, or Def.task."
|
||||
)
|
||||
def wrapTask_\u2603\u2603[T](@deprecated("unused", "") in: Any): T = implDetailError
|
||||
def `wrapTask_\u2603\u2603`[T](@deprecated("unused", "") in: Any): T = implDetailError
|
||||
|
||||
@compileTimeOnly(
|
||||
"`value` can only be used within a task or setting macro, such as :=, +=, ++=, Def.task, or Def.setting."
|
||||
)
|
||||
def wrapInit_\u2603\u2603[T](@deprecated("unused", "") in: Any): T = implDetailError
|
||||
def `wrapInit_\u2603\u2603`[T](@deprecated("unused", "") in: Any): T = implDetailError
|
||||
|
||||
@compileTimeOnly(
|
||||
"`value` can only be called on a task within a task definition macro, such as :=, +=, ++=, or Def.task."
|
||||
)
|
||||
def wrapInitTask_\u2603\u2603[T](@deprecated("unused", "") in: Any): T = implDetailError
|
||||
def `wrapInitTask_\u2603\u2603`[T](@deprecated("unused", "") in: Any): T = implDetailError
|
||||
|
||||
@compileTimeOnly(
|
||||
"`value` can only be called on an input task within a task definition macro, such as := or Def.inputTask."
|
||||
)
|
||||
def wrapInputTask_\u2603\u2603[T](@deprecated("unused", "") in: Any): T = implDetailError
|
||||
def `wrapInputTask_\u2603\u2603`[T](@deprecated("unused", "") in: Any): T = implDetailError
|
||||
|
||||
@compileTimeOnly(
|
||||
"`value` can only be called on an input task within a task definition macro, such as := or Def.inputTask."
|
||||
)
|
||||
def wrapInitInputTask_\u2603\u2603[T](@deprecated("unused", "") in: Any): T = implDetailError
|
||||
def `wrapInitInputTask_\u2603\u2603`[T](@deprecated("unused", "") in: Any): T = implDetailError
|
||||
|
||||
@compileTimeOnly(
|
||||
"`previous` can only be called on a task within a task or input task definition macro, such as :=, +=, ++=, Def.task, or Def.inputTask."
|
||||
)
|
||||
def wrapPrevious_\u2603\u2603[T](@deprecated("unused", "") in: Any): T = implDetailError
|
||||
def `wrapPrevious_\u2603\u2603`[T](@deprecated("unused", "") in: Any): T = implDetailError
|
||||
|
||||
private[this] def implDetailError =
|
||||
sys.error("This method is an implementation detail and should not be referenced.")
|
||||
|
|
@ -240,13 +240,13 @@ object ParserInput {
|
|||
@compileTimeOnly(
|
||||
"`parsed` can only be used within an input task macro, such as := or Def.inputTask."
|
||||
)
|
||||
def parser_\u2603\u2603[T](@deprecated("unused", "") i: Any): T =
|
||||
def `parser_\u2603\u2603`[T](@deprecated("unused", "") i: Any): T =
|
||||
sys.error("This method is an implementation detail and should not be referenced.")
|
||||
|
||||
@compileTimeOnly(
|
||||
"`parsed` can only be used within an input task macro, such as := or Def.inputTask."
|
||||
)
|
||||
def initParser_\u2603\u2603[T](@deprecated("unused", "") i: Any): T =
|
||||
def `initParser_\u2603\u2603`[T](@deprecated("unused", "") i: Any): T =
|
||||
sys.error("This method is an implementation detail and should not be referenced.")
|
||||
|
||||
private[std] def wrap[T: c.WeakTypeTag](
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class TaskConfigSpec extends fixture.FunSuite with fixture.TestDataFixture {
|
|||
private[this] var _infos: List[FrontEnd#Info] = Nil
|
||||
private[this] val frontEnd = new FrontEnd {
|
||||
override def display(info: Info): Unit = _infos ::= info
|
||||
override def interactive(): Unit = {}
|
||||
def interactive(): Unit = {}
|
||||
}
|
||||
|
||||
import scala.tools.reflect.ToolBox
|
||||
|
|
|
|||
|
|
@ -265,6 +265,7 @@ class TaskNegSpec extends fixture.FunSuite with fixture.TestDataFixture {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
test("Detect a missing `.value` inside a val definition of a task") { implicit td =>
|
||||
expectError(TaskLinterDSLFeedback.missingValueForKey("fooNeg2")) {
|
||||
"""
|
||||
|
|
@ -304,6 +305,7 @@ class TaskNegSpec extends fixture.FunSuite with fixture.TestDataFixture {
|
|||
""".stripMargin
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
test("Detect a missing `.value` inside an inner method of a task") { implicit td =>
|
||||
expectError(TaskLinterDSLFeedback.missingValueForKey("fooNeg3")) {
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ final class JavaVersion private (
|
|||
private def this() = this(Vector(), Vector(), None)
|
||||
private def this(numbers: Vector[Long], vendor: Option[String]) = this(numbers, Vector(), vendor)
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: JavaVersion => (this.numbers == x.numbers) && (this.tags == x.tags) && (this.vendor == x.vendor)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (17 + "sbt.JavaVersion".##) + numbers.##) + tags.##) + vendor.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ final class CompileRemoteCacheArtifact private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: CompileRemoteCacheArtifact => (this.artifact == x.artifact) && (this.packaged == x.packaged) && (this.extractDirectory == x.extractDirectory) && (this.analysisFile == x.analysisFile)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.remotecache.CompileRemoteCacheArtifact".##) + artifact.##) + packaged.##) + extractDirectory.##) + analysisFile.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ final class CustomRemoteCacheArtifact private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: CustomRemoteCacheArtifact => (this.artifact == x.artifact) && (this.packaged == x.packaged) && (this.extractDirectory == x.extractDirectory) && (this.preserveLastModified == x.preserveLastModified)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.remotecache.CustomRemoteCacheArtifact".##) + artifact.##) + packaged.##) + extractDirectory.##) + preserveLastModified.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ final class PomRemoteCacheArtifact private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: PomRemoteCacheArtifact => (this.artifact == x.artifact) && (this.packaged == x.packaged)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.remotecache.PomRemoteCacheArtifact".##) + artifact.##) + packaged.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ abstract class RemoteCacheArtifact(
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: RemoteCacheArtifact => (this.artifact == x.artifact) && (this.packaged == x.packaged)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.remotecache.RemoteCacheArtifact".##) + artifact.##) + packaged.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ final class TestRemoteCacheArtifact private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: TestRemoteCacheArtifact => (this.artifact == x.artifact) && (this.packaged == x.packaged) && (this.extractDirectory == x.extractDirectory) && (this.analysisFile == x.analysisFile) && (this.testResult == x.testResult)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.remotecache.TestRemoteCacheArtifact".##) + artifact.##) + packaged.##) + extractDirectory.##) + analysisFile.##) + testResult.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,11 +65,17 @@ public final class MetaBuildLoader extends URLClassLoader {
|
|||
*/
|
||||
public static MetaBuildLoader makeLoader(final AppProvider appProvider) throws IOException {
|
||||
final String jlineJars = "jline-?[0-9.]+-sbt-.*|jline-terminal(-(jna|jansi))?-[0-9.]+";
|
||||
final String testInterfaceJars = "test-interface-[0-9.]+";
|
||||
final String compilerInterfaceJars = "compiler-interface(-.*)?";
|
||||
final String jansiJars = "jansi-[0-9.]+";
|
||||
final String jnaJars = "jna-(platform-)?[0-9.]+";
|
||||
final String fullPattern =
|
||||
"^(test-interface-[0-9.]+|" + jlineJars + "|jansi-[0-9.]+|jna-(platform-)?[0-9.]+)\\.jar";
|
||||
String.format(
|
||||
"^(%s|%s|%s|%s|%s)\\.jar",
|
||||
jlineJars, testInterfaceJars, compilerInterfaceJars, jansiJars, jnaJars);
|
||||
final Pattern pattern = Pattern.compile(fullPattern);
|
||||
final File[] cp = appProvider.mainClasspath();
|
||||
final URL[] interfaceURLs = new URL[1];
|
||||
final URL[] interfaceURLs = new URL[2];
|
||||
final URL[] jlineURLs = new URL[7];
|
||||
final File[] extra =
|
||||
appProvider.id().classpathExtra() == null ? new File[0] : appProvider.id().classpathExtra();
|
||||
|
|
@ -80,7 +86,8 @@ public final class MetaBuildLoader extends URLClassLoader {
|
|||
int jlineIndex = 0;
|
||||
for (final File file : cp) {
|
||||
final String name = file.getName();
|
||||
if (name.contains("test-interface") && pattern.matcher(name).find()) {
|
||||
if ((name.contains("test-interface") || name.contains("compiler-interface"))
|
||||
&& pattern.matcher(name).find()) {
|
||||
interfaceURLs[interfaceIndex] = file.toURI().toURL();
|
||||
interfaceIndex += 1;
|
||||
} else if (pattern.matcher(name).find()) {
|
||||
|
|
@ -133,7 +140,7 @@ public final class MetaBuildLoader extends URLClassLoader {
|
|||
}
|
||||
};
|
||||
|
||||
final TestInterfaceLoader interfaceLoader = new TestInterfaceLoader(interfaceURLs, topLoader);
|
||||
final SbtInterfaceLoader interfaceLoader = new SbtInterfaceLoader(interfaceURLs, topLoader);
|
||||
final JLineLoader jlineLoader = new JLineLoader(jlineURLs, interfaceLoader);
|
||||
final File[] siJars = scalaProvider.jars();
|
||||
final URL[] lib = new URL[1];
|
||||
|
|
|
|||
|
|
@ -10,14 +10,15 @@ package sbt.internal;
|
|||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
class TestInterfaceLoader extends URLClassLoader {
|
||||
TestInterfaceLoader(final URL[] urls, final ClassLoader parent) {
|
||||
// This ClassLoader must contain pure sbt java interfaces
|
||||
class SbtInterfaceLoader extends URLClassLoader {
|
||||
SbtInterfaceLoader(final URL[] urls, final ClassLoader parent) {
|
||||
super(urls, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SbtTestInterfaceClassLoader(" + getURLs()[0] + ")";
|
||||
return "SbtInterfaceClassLoader(" + getURLs()[0] + ")";
|
||||
}
|
||||
|
||||
static {
|
||||
|
|
@ -0,0 +1,299 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import xsbti.*;
|
||||
|
||||
/**
|
||||
* Generates a new app configuration and invokes xMainImpl.run. For AppConfigurations generated by
|
||||
* recent launchers, it is unnecessary to modify the original configuration, but configurations
|
||||
* generated by older launchers need to be modified to place the test interface jar higher in the
|
||||
* class hierarchy. The methods this object are implemented without using the scala library so that
|
||||
* we can avoid loading any classes from the old scala provider.
|
||||
*/
|
||||
public class XMainConfiguration {
|
||||
public xsbti.MainResult run(String moduleName, xsbti.AppConfiguration configuration) {
|
||||
try {
|
||||
ClassLoader topLoader = configuration.provider().scalaProvider().launcher().topLoader();
|
||||
xsbti.AppConfiguration updatedConfiguration = null;
|
||||
try {
|
||||
Method method = topLoader.getClass().getMethod("getJLineJars");
|
||||
URL[] jars = (URL[]) method.invoke(topLoader);
|
||||
boolean canReuseConfiguration = jars.length == 3;
|
||||
int j = 0;
|
||||
while (j < jars.length && canReuseConfiguration) {
|
||||
String s = jars[j].toString();
|
||||
canReuseConfiguration = s.contains("jline") || s.contains("jansi");
|
||||
j += 1;
|
||||
}
|
||||
if (canReuseConfiguration && j == 3) {
|
||||
updatedConfiguration = configuration;
|
||||
} else {
|
||||
updatedConfiguration = makeConfiguration(configuration);
|
||||
}
|
||||
} catch (NoSuchMethodException e) {
|
||||
updatedConfiguration = makeConfiguration(configuration);
|
||||
}
|
||||
|
||||
ClassLoader loader = updatedConfiguration.provider().loader();
|
||||
Thread.currentThread().setContextClassLoader(loader);
|
||||
Class<?> clazz = loader.loadClass("sbt." + moduleName + "$");
|
||||
Object instance = clazz.getField("MODULE$").get(null);
|
||||
Method runMethod = clazz.getMethod("run", xsbti.AppConfiguration.class);
|
||||
try {
|
||||
Class<?> clw = loader.loadClass("sbt.internal.ClassLoaderWarmup$");
|
||||
clw.getMethod("warmup").invoke(clw.getField("MODULE$").get(null));
|
||||
return (xsbti.MainResult) runMethod.invoke(instance, updatedConfiguration);
|
||||
} catch (InvocationTargetException e) {
|
||||
// This propogates xsbti.FullReload to the launcher
|
||||
throw (xsbti.FullReload) e.getCause();
|
||||
}
|
||||
} catch (ReflectiveOperationException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private xsbti.AppConfiguration makeConfiguration(xsbti.AppConfiguration configuration) {
|
||||
try {
|
||||
ClassLoader baseLoader = XMainConfiguration.class.getClassLoader();
|
||||
String className = "sbt/internal/XMainConfiguration.class";
|
||||
URL url = baseLoader.getResource(className);
|
||||
String path = url.toString().replaceAll(className.concat("$"), "");
|
||||
URL[] urlArray = new URL[1];
|
||||
urlArray[0] = new URL(path);
|
||||
ClassLoader topLoader = configuration.provider().scalaProvider().launcher().topLoader();
|
||||
// This loader doesn't have the scala library in it so it's critical that none of the code
|
||||
// in this file use the scala library.
|
||||
ClassLoader modifiedLoader = new XMainClassLoader(urlArray, topLoader);
|
||||
Class<?> xMainConfigurationClass =
|
||||
modifiedLoader.loadClass("sbt.internal.XMainConfiguration");
|
||||
Object instance = (Object) xMainConfigurationClass.getConstructor().newInstance();
|
||||
Class<?> metaBuildLoaderClass = modifiedLoader.loadClass("sbt.internal.MetaBuildLoader");
|
||||
Method method = metaBuildLoaderClass.getMethod("makeLoader", AppProvider.class);
|
||||
|
||||
ClassLoader loader = (ClassLoader) method.invoke(null, configuration.provider());
|
||||
|
||||
Thread.currentThread().setContextClassLoader(loader);
|
||||
Class<?> modifiedConfigurationClass =
|
||||
modifiedLoader.loadClass("sbt.internal.XMainConfiguration$ModifiedConfiguration");
|
||||
Constructor<?> cons = modifiedConfigurationClass.getConstructors()[0];
|
||||
ClassLoaderClose.close(configuration.provider().loader());
|
||||
ScalaProvider scalaProvider = configuration.provider().scalaProvider();
|
||||
Class<? extends ScalaProvider> providerClass = scalaProvider.getClass();
|
||||
try {
|
||||
Method method2 = providerClass.getMethod("loaderLibraryOnly");
|
||||
ClassLoaderClose.close((ClassLoader) method2.invoke(scalaProvider));
|
||||
} catch (NoSuchMethodException e) {
|
||||
}
|
||||
ClassLoaderClose.close(scalaProvider.loader());
|
||||
ClassLoaderClose.close(configuration.provider().loader());
|
||||
return (xsbti.AppConfiguration) cons.newInstance(instance, configuration, loader);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Replaces the AppProvider.loader method with a new loader that puts the sbt test interface
|
||||
* jar ahead of the rest of the sbt classpath in the classloading hierarchy.
|
||||
*/
|
||||
public class ModifiedConfiguration implements xsbti.AppConfiguration {
|
||||
private xsbti.AppConfiguration configuration;
|
||||
private ClassLoader metaLoader;
|
||||
|
||||
public ModifiedConfiguration(xsbti.AppConfiguration configuration, ClassLoader metaLoader) {
|
||||
this.configuration = configuration;
|
||||
this.metaLoader = metaLoader;
|
||||
}
|
||||
|
||||
public class ModifiedAppProvider implements AppProvider {
|
||||
private AppProvider appProvider;
|
||||
private ScalaProvider instance;
|
||||
|
||||
public ModifiedAppProvider(AppProvider appProvider) throws ClassNotFoundException {
|
||||
this.appProvider = appProvider;
|
||||
ScalaProvider delegate = configuration.provider().scalaProvider();
|
||||
this.instance =
|
||||
new ScalaProvider() {
|
||||
public Launcher _launcher =
|
||||
new Launcher() {
|
||||
private Launcher delegateLauncher = delegate.launcher();
|
||||
private ClassLoader interfaceLoader =
|
||||
metaLoader.loadClass("sbt.testing.Framework").getClassLoader();
|
||||
|
||||
@Override
|
||||
public ScalaProvider getScala(String version) {
|
||||
return getScala(version, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScalaProvider getScala(String version, String reason) {
|
||||
return getScala(version, reason, "org.scala-lang");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScalaProvider getScala(String version, String reason, String scalaOrg) {
|
||||
return delegateLauncher.getScala(version, reason, scalaOrg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppProvider app(xsbti.ApplicationID id, String version) {
|
||||
return delegateLauncher.app(id, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader topLoader() {
|
||||
return interfaceLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GlobalLock globalLock() {
|
||||
return delegateLauncher.globalLock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File bootDirectory() {
|
||||
return delegateLauncher.bootDirectory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public xsbti.Repository[] ivyRepositories() {
|
||||
return delegateLauncher.ivyRepositories();
|
||||
}
|
||||
|
||||
@Override
|
||||
public xsbti.Repository[] appRepositories() {
|
||||
return delegateLauncher.appRepositories();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverrideRepositories() {
|
||||
return delegateLauncher.isOverrideRepositories();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File ivyHome() {
|
||||
return delegateLauncher.ivyHome();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] checksums() {
|
||||
return delegateLauncher.checksums();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public Launcher launcher() {
|
||||
return this._launcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String version() {
|
||||
return delegate.version();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader loader() {
|
||||
return metaLoader.getParent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File[] jars() {
|
||||
return delegate.jars();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated()
|
||||
public File libraryJar() {
|
||||
return delegate.libraryJar();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated()
|
||||
public File compilerJar() {
|
||||
return delegate.compilerJar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppProvider app(xsbti.ApplicationID id) {
|
||||
return delegate.app(id);
|
||||
}
|
||||
|
||||
private ClassLoader loaderLibraryOnly() {
|
||||
return metaLoader.getParent().getParent();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScalaProvider scalaProvider() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public xsbti.ApplicationID id() {
|
||||
return appProvider.id();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader loader() {
|
||||
return metaLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated()
|
||||
public Class<? extends AppMain> mainClass() {
|
||||
return appProvider.mainClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> entryPoint() {
|
||||
return appProvider.entryPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppMain newMain() {
|
||||
return appProvider.newMain();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File[] mainClasspath() {
|
||||
return appProvider.mainClasspath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComponentProvider components() {
|
||||
return appProvider.components();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] arguments() {
|
||||
return configuration.arguments();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File baseDirectory() {
|
||||
return configuration.baseDirectory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppProvider provider() {
|
||||
try {
|
||||
return new ModifiedAppProvider(configuration.provider());
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -88,6 +88,7 @@ import sbt.util.InterfaceUtil.{ t2, toJavaFunction => f1 }
|
|||
import sbt.util._
|
||||
import sjsonnew._
|
||||
import sjsonnew.support.scalajson.unsafe.Converter
|
||||
import xsbti.compile.TastyFiles
|
||||
import xsbti.{ FileConverter, Position }
|
||||
|
||||
import scala.collection.immutable.ListMap
|
||||
|
|
@ -332,8 +333,10 @@ object Defaults extends BuildCommon {
|
|||
exportPipelining := usePipelining.value,
|
||||
useScalaReplJLine :== false,
|
||||
scalaInstanceTopLoader := {
|
||||
if (!useScalaReplJLine.value) classOf[org.jline.terminal.Terminal].getClassLoader
|
||||
else appConfiguration.value.provider.scalaProvider.launcher.topLoader.getParent
|
||||
// the JLineLoader contains the SbtInterfaceClassLoader
|
||||
if (!useScalaReplJLine.value)
|
||||
classOf[org.jline.terminal.Terminal].getClassLoader // the JLineLoader
|
||||
else classOf[Compilers].getClassLoader // the SbtInterfaceClassLoader
|
||||
},
|
||||
useSuperShell := { if (insideCI.value) false else ITerminal.console.isSupershellEnabled },
|
||||
superShellThreshold :== SysProp.supershellThreshold,
|
||||
|
|
@ -666,15 +669,21 @@ object Defaults extends BuildCommon {
|
|||
),
|
||||
cleanIvy := IvyActions.cleanCachedResolutionCache(ivyModule.value, streams.value.log),
|
||||
clean := clean.dependsOn(cleanIvy).value,
|
||||
scalaCompilerBridgeBinaryJar := None,
|
||||
scalaCompilerBridgeSource := ZincLmUtil.getDefaultBridgeModule(scalaVersion.value),
|
||||
consoleProject / scalaCompilerBridgeSource := ZincLmUtil.getDefaultBridgeModule(
|
||||
scalaCompilerBridgeBinaryJar := Def.settingDyn {
|
||||
val sv = scalaVersion.value
|
||||
if (ScalaArtifacts.isScala3(sv)) fetchBridgeBinaryJarTask(sv)
|
||||
else Def.task[Option[File]](None)
|
||||
}.value,
|
||||
scalaCompilerBridgeSource := ZincLmUtil.getDefaultBridgeSourceModule(scalaVersion.value),
|
||||
consoleProject / scalaCompilerBridgeBinaryJar := None,
|
||||
consoleProject / scalaCompilerBridgeSource := ZincLmUtil.getDefaultBridgeSourceModule(
|
||||
appConfiguration.value.provider.scalaProvider.version
|
||||
),
|
||||
)
|
||||
// must be a val: duplication detected by object identity
|
||||
private[this] lazy val compileBaseGlobal: Seq[Setting[_]] = globalDefaults(
|
||||
Seq(
|
||||
auxiliaryClassFiles := Nil,
|
||||
incOptions := IncOptions.of(),
|
||||
classpathOptions :== ClasspathOptionsUtil.boot,
|
||||
classpathOptions in console :== ClasspathOptionsUtil.repl,
|
||||
|
|
@ -734,6 +743,18 @@ object Defaults extends BuildCommon {
|
|||
if (plugin) scalaBase / ("sbt-" + sbtv) else scalaBase
|
||||
}
|
||||
|
||||
private def fetchBridgeBinaryJarTask(scalaVersion: String): Initialize[Task[Option[File]]] =
|
||||
Def.task {
|
||||
val bridgeJar = ZincLmUtil.fetchDefaultBridgeModule(
|
||||
scalaVersion,
|
||||
dependencyResolution.value,
|
||||
updateConfiguration.value,
|
||||
(update / unresolvedWarningConfiguration).value,
|
||||
streams.value.log
|
||||
)
|
||||
Some(bridgeJar)
|
||||
}
|
||||
|
||||
def compilersSetting = {
|
||||
compilers := {
|
||||
val st = state.value
|
||||
|
|
@ -814,6 +835,13 @@ object Defaults extends BuildCommon {
|
|||
}) :+ compileAnalysisFile.value.toPath
|
||||
},
|
||||
compileOutputs := compileOutputs.triggeredBy(compile).value,
|
||||
tastyFiles := Def.taskIf {
|
||||
if (ScalaArtifacts.isScala3(scalaVersion.value)) {
|
||||
val _ = compile.value
|
||||
val tastyFiles = classDirectory.value.**("*.tasty").get
|
||||
tastyFiles.map(_.getAbsoluteFile)
|
||||
} else Nil
|
||||
}.value,
|
||||
clean := (compileOutputs / clean).value,
|
||||
earlyOutputPing := Def.promise[Boolean],
|
||||
compileProgress := {
|
||||
|
|
@ -858,9 +886,14 @@ object Defaults extends BuildCommon {
|
|||
compileAnalysisTargetRoot.value / compileAnalysisFilename.value
|
||||
},
|
||||
externalHooks := IncOptions.defaultExternal,
|
||||
auxiliaryClassFiles ++= {
|
||||
if (ScalaArtifacts.isScala3(scalaVersion.value)) List(TastyFiles.instance)
|
||||
else Nil
|
||||
},
|
||||
incOptions := {
|
||||
val old = incOptions.value
|
||||
old
|
||||
.withAuxiliaryClassFiles(auxiliaryClassFiles.value.toArray)
|
||||
.withExternalHooks(externalHooks.value)
|
||||
.withClassfileManagerType(
|
||||
Option(
|
||||
|
|
@ -1001,9 +1034,9 @@ object Defaults extends BuildCommon {
|
|||
val cache = state.value.extendedClassLoaderCache
|
||||
mkScalaInstance(
|
||||
version,
|
||||
allJars,
|
||||
libraryJars,
|
||||
compilerJar,
|
||||
allJars,
|
||||
Seq.empty,
|
||||
cache,
|
||||
scalaInstanceTopLoader.value
|
||||
)
|
||||
|
|
@ -1032,31 +1065,44 @@ object Defaults extends BuildCommon {
|
|||
}
|
||||
|
||||
def scalaInstanceFromUpdate: Initialize[Task[ScalaInstance]] = Def.task {
|
||||
val toolReport = update.value.configuration(Configurations.ScalaTool) getOrElse
|
||||
sys.error(noToolConfiguration(managedScalaInstance.value))
|
||||
def files(id: String) =
|
||||
for {
|
||||
m <- toolReport.modules if m.module.name == id;
|
||||
val sv = scalaVersion.value
|
||||
val fullReport = update.value
|
||||
|
||||
val toolReport = fullReport
|
||||
.configuration(Configurations.ScalaTool)
|
||||
.getOrElse(sys.error(noToolConfiguration(managedScalaInstance.value)))
|
||||
|
||||
def file(id: String): File = {
|
||||
val files = for {
|
||||
m <- toolReport.modules if m.module.name.startsWith(id)
|
||||
(art, file) <- m.artifacts if art.`type` == Artifact.DefaultType
|
||||
} yield file
|
||||
def file(id: String) = files(id).headOption getOrElse sys.error(s"Missing ${id}.jar")
|
||||
val allJars = toolReport.modules.flatMap(_.artifacts.map(_._2))
|
||||
val libraryJar = file(ScalaArtifacts.LibraryID)
|
||||
val compilerJar = file(ScalaArtifacts.CompilerID)
|
||||
files.headOption getOrElse sys.error(s"Missing $id jar file")
|
||||
}
|
||||
|
||||
val allCompilerJars = toolReport.modules.flatMap(_.artifacts.map(_._2))
|
||||
val allDocJars =
|
||||
fullReport
|
||||
.configuration(Configurations.ScalaDocTool)
|
||||
.toSeq
|
||||
.flatMap(_.modules)
|
||||
.flatMap(_.artifacts.map(_._2))
|
||||
val libraryJars = ScalaArtifacts.libraryIds(sv).map(file)
|
||||
|
||||
mkScalaInstance(
|
||||
scalaVersion.value,
|
||||
allJars,
|
||||
Array(libraryJar),
|
||||
compilerJar,
|
||||
sv,
|
||||
libraryJars,
|
||||
allCompilerJars,
|
||||
allDocJars,
|
||||
state.value.extendedClassLoaderCache,
|
||||
scalaInstanceTopLoader.value,
|
||||
)
|
||||
}
|
||||
private[this] def mkScalaInstance(
|
||||
version: String,
|
||||
allJars: Seq[File],
|
||||
libraryJars: Array[File],
|
||||
compilerJar: File,
|
||||
allCompilerJars: Seq[File],
|
||||
allDocJars: Seq[File],
|
||||
classLoaderCache: ClassLoaderCache,
|
||||
topLoader: ClassLoader,
|
||||
): ScalaInstance = {
|
||||
|
|
@ -1069,17 +1115,33 @@ object Defaults extends BuildCommon {
|
|||
}
|
||||
}
|
||||
else topLoader
|
||||
val allJarsDistinct = allJars.distinct
|
||||
|
||||
val compilerJars = allCompilerJars.filterNot(libraryJars.contains).distinct.toArray
|
||||
val docJars = allDocJars
|
||||
.filterNot(jar => libraryJars.contains(jar) || compilerJars.contains(jar))
|
||||
.distinct
|
||||
.toArray
|
||||
val allJars = libraryJars ++ compilerJars ++ docJars
|
||||
|
||||
val libraryLoader = classLoaderCache(libraryJars.toList, jansiExclusionLoader)
|
||||
val fullLoader = classLoaderCache(allJarsDistinct.toList, libraryLoader)
|
||||
val compilerLoader = classLoaderCache(
|
||||
// It should be `compilerJars` but it would break on `3.0.0-M2` because of
|
||||
// https://github.com/lampepfl/dotty/blob/d932af954ef187d7bdb87500d49ed0ff530bd1e7/sbt-bridge/src/xsbt/CompilerClassLoader.java#L108-L117
|
||||
allCompilerJars.toList,
|
||||
libraryLoader
|
||||
)
|
||||
val fullLoader =
|
||||
if (docJars.isEmpty) compilerLoader
|
||||
else classLoaderCache(docJars.distinct.toList, compilerLoader)
|
||||
new ScalaInstance(
|
||||
version,
|
||||
fullLoader,
|
||||
libraryLoader,
|
||||
libraryJars,
|
||||
compilerJar,
|
||||
allJarsDistinct.toArray,
|
||||
Some(version)
|
||||
version = version,
|
||||
loader = fullLoader,
|
||||
loaderCompilerOnly = compilerLoader,
|
||||
loaderLibraryOnly = libraryLoader,
|
||||
libraryJars = libraryJars,
|
||||
compilerJars = compilerJars,
|
||||
allJars = allJars,
|
||||
explicitActual = Some(version)
|
||||
)
|
||||
}
|
||||
def scalaInstanceFromHome(dir: File): Initialize[Task[ScalaInstance]] = Def.task {
|
||||
|
|
@ -1090,9 +1152,9 @@ object Defaults extends BuildCommon {
|
|||
}
|
||||
mkScalaInstance(
|
||||
dummy.version,
|
||||
dummy.allJars,
|
||||
dummy.libraryJars,
|
||||
dummy.compilerJar,
|
||||
dummy.compilerJars,
|
||||
dummy.allJars,
|
||||
state.value.extendedClassLoaderCache,
|
||||
scalaInstanceTopLoader.value,
|
||||
)
|
||||
|
|
@ -1964,6 +2026,16 @@ object Defaults extends BuildCommon {
|
|||
else Map.empty[File, URL]
|
||||
},
|
||||
fileInputOptions := Seq("-doc-root-content", "-diagrams-dot-path"),
|
||||
scalacOptions := {
|
||||
val compileOptions = scalacOptions.value
|
||||
val sv = scalaVersion.value
|
||||
val config = configuration.value
|
||||
val projectName = name.value
|
||||
if (ScalaArtifacts.isScala3(sv)) {
|
||||
val project = if (config == Compile) projectName else s"$projectName-$config"
|
||||
Seq("-project", project)
|
||||
} else compileOptions
|
||||
},
|
||||
key in TaskZero := {
|
||||
val s = streams.value
|
||||
val cs: Compilers = compilers.value
|
||||
|
|
@ -1978,13 +2050,16 @@ object Defaults extends BuildCommon {
|
|||
val fiOpts = fileInputOptions.value
|
||||
val reporter = (compile / bspReporter).value
|
||||
val converter = fileConverter.value
|
||||
val tFiles = tastyFiles.value
|
||||
val sv = scalaVersion.value
|
||||
(hasScala, hasJava) match {
|
||||
case (true, _) =>
|
||||
val options = sOpts ++ Opts.doc.externalAPI(xapis)
|
||||
val runDoc = Doc.scaladoc(label, s.cacheStoreFactory sub "scala", cs.scalac match {
|
||||
case ac: AnalyzingCompiler => ac.onArgs(exported(s, "scaladoc"))
|
||||
}, fiOpts)
|
||||
runDoc(srcs, cp, out, options, maxErrors.value, s.log)
|
||||
val docSrcs = if (ScalaArtifacts.isScala3(sv)) tFiles else srcs
|
||||
runDoc(docSrcs, cp, out, options, maxErrors.value, s.log)
|
||||
case (_, true) =>
|
||||
val javadoc =
|
||||
sbt.inc.Doc.cachedJavadoc(label, s.cacheStoreFactory sub "java", cs.javaTools)
|
||||
|
|
@ -1992,7 +2067,7 @@ object Defaults extends BuildCommon {
|
|||
srcs.toList map { x =>
|
||||
converter.toVirtualFile(x.toPath)
|
||||
},
|
||||
cp.toList map { x =>
|
||||
cp map { x =>
|
||||
converter.toVirtualFile(x.toPath)
|
||||
},
|
||||
converter,
|
||||
|
|
@ -2687,6 +2762,8 @@ object Classpaths {
|
|||
defaultConfiguration :== Some(Configurations.Compile),
|
||||
dependencyOverrides :== Vector.empty,
|
||||
libraryDependencies :== Nil,
|
||||
libraryDependencySchemes :== Nil,
|
||||
evictionErrorLevel :== Level.Error,
|
||||
excludeDependencies :== Nil,
|
||||
ivyLoggingLevel := (// This will suppress "Resolving..." logs on Jenkins and Travis.
|
||||
if (insideCI.value)
|
||||
|
|
@ -2884,7 +2961,8 @@ object Classpaths {
|
|||
},
|
||||
ivyConfigurations ++= Configurations.auxiliary,
|
||||
ivyConfigurations ++= {
|
||||
if (managedScalaInstance.value && scalaHome.value.isEmpty) Configurations.ScalaTool :: Nil
|
||||
if (managedScalaInstance.value && scalaHome.value.isEmpty)
|
||||
Configurations.ScalaTool :: Configurations.ScalaDocTool :: Nil
|
||||
else Nil
|
||||
},
|
||||
// Coursier needs these
|
||||
|
|
@ -3074,12 +3152,15 @@ object Classpaths {
|
|||
else base
|
||||
val sbtOrg = scalaOrganization.value
|
||||
val version = scalaVersion.value
|
||||
if (scalaHome.value.isDefined || scalaModuleInfo.value.isEmpty || !managedScalaInstance.value)
|
||||
pluginAdjust
|
||||
else {
|
||||
val isDotty = ScalaInstance.isDotty(version)
|
||||
ScalaArtifacts.toolDependencies(sbtOrg, version, isDotty) ++ pluginAdjust
|
||||
}
|
||||
val extResolvers = externalResolvers.value
|
||||
val allToolDeps =
|
||||
if (scalaHome.value.isDefined || scalaModuleInfo.value.isEmpty || !managedScalaInstance.value)
|
||||
Nil
|
||||
else if (extResolvers.contains(Resolver.JCenterRepository)) {
|
||||
ScalaArtifacts.toolDependencies(sbtOrg, version) ++
|
||||
ScalaArtifacts.docToolDependencies(sbtOrg, version)
|
||||
} else ScalaArtifacts.toolDependencies(sbtOrg, version)
|
||||
allToolDeps ++ pluginAdjust
|
||||
},
|
||||
// in case of meta build, exclude all sbt modules from the dependency graph, so we can use the sbt resolved by the launcher
|
||||
allExcludeDependencies := {
|
||||
|
|
@ -3460,13 +3541,7 @@ object Classpaths {
|
|||
.withMetadataDirectory(dependencyCacheDirectory.value)
|
||||
}
|
||||
|
||||
val evictionOptions = Def.taskDyn {
|
||||
if (executionRoots.value.exists(_.key == evicted.key))
|
||||
Def.task(EvictionWarningOptions.empty)
|
||||
else Def.task((evictionWarningOptions in update).value)
|
||||
}.value
|
||||
|
||||
val extracted = (Project extract state0)
|
||||
val extracted = Project.extract(state0)
|
||||
val isPlugin = sbtPlugin.value
|
||||
val thisRef = thisProjectRef.value
|
||||
val label =
|
||||
|
|
@ -3486,7 +3561,8 @@ object Classpaths {
|
|||
force = shouldForce,
|
||||
depsUpdated = transitiveUpdate.value.exists(!_.stats.cached),
|
||||
uwConfig = (unresolvedWarningConfiguration in update).value,
|
||||
ewo = evictionOptions,
|
||||
evictionLevel = evictionErrorLevel.value,
|
||||
versionSchemeOverrides = libraryDependencySchemes.value,
|
||||
mavenStyle = publishMavenStyle.value,
|
||||
compatWarning = compatibilityWarningOptions.value,
|
||||
includeCallers = includeCallers,
|
||||
|
|
@ -3823,7 +3899,7 @@ object Classpaths {
|
|||
version: String
|
||||
): Seq[ModuleID] =
|
||||
if (auto)
|
||||
modifyForPlugin(plugin, ModuleID(org, ScalaArtifacts.LibraryID, version)) :: Nil
|
||||
modifyForPlugin(plugin, ScalaArtifacts.libraryDependency(org, version)) :: Nil
|
||||
else
|
||||
Nil
|
||||
|
||||
|
|
|
|||
|
|
@ -223,6 +223,7 @@ object Keys {
|
|||
val manipulateBytecode = taskKey[CompileResult]("Manipulates generated bytecode").withRank(BTask)
|
||||
val compileIncremental = taskKey[CompileResult]("Actually runs the incremental compilation").withRank(DTask)
|
||||
val previousCompile = taskKey[PreviousResult]("Read the incremental compiler analysis from disk").withRank(DTask)
|
||||
val tastyFiles = taskKey[Seq[File]]("Returns the TASTy files produced by compilation").withRank(DTask)
|
||||
private[sbt] val compileScalaBackend = taskKey[CompileResult]("Compiles only Scala sources if pipelining is enabled. Compiles both Scala and Java sources otherwise").withRank(Invisible)
|
||||
private[sbt] val compileEarly = taskKey[CompileAnalysis]("Compiles only Scala sources if pipelining is enabled, and produce an early output (pickle JAR)").withRank(Invisible)
|
||||
private[sbt] val earlyOutputPing = taskKey[PromiseWrap[Boolean]]("When pipelining is enabled, this returns true when early output (pickle JAR) is created; false otherwise").withRank(Invisible)
|
||||
|
|
@ -248,6 +249,7 @@ object Keys {
|
|||
val aggregate = settingKey[Boolean]("Configures task aggregation.").withRank(BMinusSetting)
|
||||
val sourcePositionMappers = taskKey[Seq[xsbti.Position => Option[xsbti.Position]]]("Maps positions in generated source files to the original source it was generated from").withRank(DTask)
|
||||
private[sbt] val externalHooks = taskKey[ExternalHooks]("The external hooks used by zinc.")
|
||||
val auxiliaryClassFiles = taskKey[Seq[AuxiliaryClassFiles]]("The auxiliary class files that must be managed by Zinc (for instance the TASTy files)")
|
||||
val fileConverter = settingKey[FileConverter]("The file converter used to convert between Path and VirtualFile")
|
||||
val allowMachinePath = settingKey[Boolean]("Allow machine-specific paths during conversion.")
|
||||
val reportAbsolutePath = settingKey[Boolean]("Report absolute paths during compilation.")
|
||||
|
|
@ -394,7 +396,7 @@ object Keys {
|
|||
val exportPipelining = settingKey[Boolean]("Product early output so downstream subprojects can do pipelining.").withRank(BSetting)
|
||||
|
||||
val bspConfig = taskKey[Unit]("Create or update the BSP connection files").withRank(DSetting)
|
||||
val bspEnabled = settingKey[Boolean]("Enable/Disable BSP for this build, project or configuration")
|
||||
val bspEnabled = SettingKey[Boolean](BasicKeys.bspEnabled)
|
||||
val bspTargetIdentifier = settingKey[BuildTargetIdentifier]("Build target identifier of a project and configuration.").withRank(DSetting)
|
||||
val bspWorkspace = settingKey[Map[BuildTargetIdentifier, Scope]]("Mapping of BSP build targets to sbt scopes").withRank(DSetting)
|
||||
val bspInternalDependencyConfigurations = settingKey[Seq[(ProjectRef, Set[ConfigKey])]]("The project configurations that this configuration depends on, possibly transitivly").withRank(DSetting)
|
||||
|
|
@ -455,6 +457,7 @@ object Keys {
|
|||
val updateFull = taskKey[UpdateReport]("Resolves and optionally retrieves dependencies, producing a full report with callers.").withRank(CTask)
|
||||
val evicted = taskKey[EvictionWarning]("Display detailed eviction warnings.").withRank(CTask)
|
||||
val evictionWarningOptions = settingKey[EvictionWarningOptions]("Options on eviction warnings after resolving managed dependencies.").withRank(DSetting)
|
||||
val evictionErrorLevel = settingKey[Level.Value]("The log level for detected eviction errors. Level.Error will throw an error.")
|
||||
val transitiveUpdate = taskKey[Seq[UpdateReport]]("UpdateReports for the internal dependencies of this project.").withRank(DTask)
|
||||
val updateClassifiers = TaskKey[UpdateReport]("updateClassifiers", "Resolves and optionally retrieves classified artifacts, such as javadocs and sources, for dependency definitions, transitively.", BPlusTask, update)
|
||||
val transitiveClassifiers = settingKey[Seq[String]]("List of classifiers used for transitively obtaining extra artifacts for sbt or declared dependencies.").withRank(BSetting)
|
||||
|
|
@ -533,6 +536,7 @@ object Keys {
|
|||
val checksums = settingKey[Seq[String]]("The list of checksums to generate and to verify for dependencies.").withRank(BSetting)
|
||||
val forceUpdatePeriod = settingKey[Option[FiniteDuration]]("Duration after which to force a full update to occur").withRank(CSetting)
|
||||
val versionScheme = settingKey[Option[String]]("""Version scheme used for the subproject: Supported values are Some("early-semver"), Some("pvp"), and Some("semver-spec")""").withRank(BSetting)
|
||||
val libraryDependencySchemes = settingKey[Seq[ModuleID]]("""Version scheme to use for specific modules set as "org" %% "name" % "<scheme>": Supported values are "early-semver", "pvp", "semver-spec", "always", and "strict".""").withRank(BSetting)
|
||||
|
||||
val classifiersModule = taskKey[GetClassifiersModule]("classifiers-module").withRank(CTask)
|
||||
val compatibilityWarningOptions = settingKey[CompatibilityWarningOptions]("Configures warnings around Maven incompatibility.").withRank(CSetting)
|
||||
|
|
|
|||
|
|
@ -939,13 +939,17 @@ object BuiltinCommands {
|
|||
|
||||
val session = Load.initialSession(structure, eval, s0)
|
||||
SessionSettings.checkSession(session, s2)
|
||||
val s3 = addCacheStoreFactoryFactory(Project.setProject(session, structure, s2))
|
||||
val s3 = Project.setProject(
|
||||
session,
|
||||
structure,
|
||||
s2,
|
||||
st => setupGlobalFileTreeRepository(addCacheStoreFactoryFactory(st))
|
||||
)
|
||||
val s4 = s3.put(Keys.useLog4J.key, Project.extract(s3).get(Keys.useLog4J))
|
||||
val s5 = setupGlobalFileTreeRepository(s4)
|
||||
// This is a workaround for the console task in dotty which uses the classloader cache.
|
||||
// We need to override the top loader in that case so that it gets the forked jline.
|
||||
s5.extendedClassLoaderCache.setParent(Project.extract(s5).get(Keys.scalaInstanceTopLoader))
|
||||
addSuperShellParams(CheckBuildSources.init(LintUnused.lintUnusedFunc(s5)))
|
||||
s4.extendedClassLoaderCache.setParent(Project.extract(s4).get(Keys.scalaInstanceTopLoader))
|
||||
addSuperShellParams(CheckBuildSources.init(LintUnused.lintUnusedFunc(s4)))
|
||||
}
|
||||
|
||||
private val setupGlobalFileTreeRepository: State => State = { state =>
|
||||
|
|
@ -1078,7 +1082,7 @@ object BuiltinCommands {
|
|||
}
|
||||
|
||||
private val sbtVersionRegex = """sbt\.version\s*=.*""".r
|
||||
private def isSbtVersionLine(s: String) = sbtVersionRegex.pattern matcher s matches ()
|
||||
private def isSbtVersionLine(s: String) = sbtVersionRegex.pattern.matcher(s).matches()
|
||||
|
||||
private def writeSbtVersionUnconditionally(state: State) = {
|
||||
val baseDir = state.baseDir
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
package sbt
|
||||
|
||||
import java.io.PrintWriter
|
||||
import java.util.concurrent.RejectedExecutionException
|
||||
import java.util.Properties
|
||||
|
||||
import sbt.BasicCommandStrings.{ StashOnFailure, networkExecPrefix }
|
||||
|
|
@ -240,6 +241,13 @@ object MainLoop {
|
|||
FastTrackCommands
|
||||
.evaluate(termState, exec.commandLine)
|
||||
.getOrElse(Command.process(exec.commandLine, termState))
|
||||
} catch {
|
||||
case _: RejectedExecutionException =>
|
||||
// No stack trace since this is just to notify the user which command they cancelled
|
||||
object Cancelled extends Throwable(exec.commandLine, null, true, false) {
|
||||
override def toString: String = s"Cancelled: ${exec.commandLine}"
|
||||
}
|
||||
throw Cancelled
|
||||
} finally {
|
||||
// Flush the terminal output after command evaluation to ensure that all output
|
||||
// is displayed in the thin client before we report the command status. Also
|
||||
|
|
@ -328,5 +336,4 @@ object MainLoop {
|
|||
if (prevState.onFailure.isDefined && state.onFailure.isEmpty &&
|
||||
state.currentCommand.fold(true)(_ != StashOnFailure)) ExitCode(ErrorCodes.UnknownError)
|
||||
else ExitCode.Success
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,6 +200,10 @@ object Plugins extends PluginsFunctions {
|
|||
val clauses = Clauses((allRequirementsClause ::: allEnabledByClause) filterNot {
|
||||
_.head subsetOf knowledge0
|
||||
})
|
||||
// println(s"allRequirementsClause = $allRequirementsClause")
|
||||
// println(s"allEnabledByClause = $allEnabledByClause")
|
||||
// println(s"clauses = $clauses")
|
||||
// println("")
|
||||
log.debug(
|
||||
s"deducing auto plugins based on known facts ${knowledge0.toString} and clauses ${clauses.toString}"
|
||||
)
|
||||
|
|
@ -266,7 +270,10 @@ object Plugins extends PluginsFunctions {
|
|||
lits map { case Atom(l) => l; case Negated(Atom(l)) => l } mkString (", ")
|
||||
|
||||
private[this] def duplicateProvidesError(byAtom: Seq[(Atom, AutoPlugin)]): Unit = {
|
||||
val dupsByAtom = byAtom.groupBy(_._1).mapValues(_.map(_._2))
|
||||
val dupsByAtom = Map(byAtom.groupBy(_._1).toSeq.map {
|
||||
case (k, v) =>
|
||||
k -> v.map(_._2)
|
||||
}: _*)
|
||||
val dupStrings =
|
||||
for ((atom, dups) <- dupsByAtom if dups.size > 1)
|
||||
yield s"${atom.label} by ${dups.mkString(", ")}"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import Project._
|
|||
import BasicKeys.serverLogLevel
|
||||
import Keys.{
|
||||
stateBuildStructure,
|
||||
bspEnabled,
|
||||
colorShellPrompt,
|
||||
commands,
|
||||
configuration,
|
||||
|
|
@ -478,7 +479,15 @@ object Project extends ProjectExtra {
|
|||
previousOnUnload(s.runExitHooks())
|
||||
}
|
||||
|
||||
def setProject(session: SessionSettings, structure: BuildStructure, s: State): State = {
|
||||
def setProject(session: SessionSettings, structure: BuildStructure, s: State): State =
|
||||
setProject(session, structure, s, identity)
|
||||
|
||||
def setProject(
|
||||
session: SessionSettings,
|
||||
structure: BuildStructure,
|
||||
s: State,
|
||||
preOnLoad: State => State
|
||||
): State = {
|
||||
val unloaded = runUnloadHooks(s)
|
||||
val (onLoad, onUnload) = getHooks(structure.data)
|
||||
val newAttrs = unloaded.attributes
|
||||
|
|
@ -488,7 +497,7 @@ object Project extends ProjectExtra {
|
|||
val newState = unloaded.copy(attributes = newAttrs)
|
||||
// TODO: Fix this
|
||||
onLoad(
|
||||
updateCurrent(newState) /*LogManager.setGlobalLogLevels(updateCurrent(newState), structure.data)*/
|
||||
preOnLoad(updateCurrent(newState)) /*LogManager.setGlobalLogLevels(updateCurrent(newState), structure.data)*/
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -519,6 +528,7 @@ object Project extends ProjectExtra {
|
|||
val startSvr: Option[Boolean] = get(autoStartServer)
|
||||
val host: Option[String] = get(serverHost)
|
||||
val port: Option[Int] = get(serverPort)
|
||||
val enabledBsp: Option[Boolean] = get(bspEnabled)
|
||||
val timeout: Option[Option[FiniteDuration]] = get(serverIdleTimeout)
|
||||
val authentication: Option[Set[ServerAuthentication]] = get(serverAuthentication)
|
||||
val connectionType: Option[ConnectionType] = get(serverConnectionType)
|
||||
|
|
@ -536,6 +546,7 @@ object Project extends ProjectExtra {
|
|||
.put(historyPath.key, history)
|
||||
.put(windowsServerSecurityLevel.key, winSecurityLevel)
|
||||
.put(serverUseJni.key, useJni)
|
||||
.setCond(bspEnabled.key, enabledBsp)
|
||||
.setCond(autoStartServer.key, startSvr)
|
||||
.setCond(serverPort.key, port)
|
||||
.setCond(serverHost.key, host)
|
||||
|
|
@ -572,7 +583,7 @@ object Project extends ProjectExtra {
|
|||
private[this] def overlappingTargets(
|
||||
targets: Seq[(ProjectRef, File)]
|
||||
): Map[File, Seq[ProjectRef]] =
|
||||
targets.groupBy(_._2).filter(_._2.size > 1).mapValues(_.map(_._1))
|
||||
targets.groupBy(_._2).filter(_._2.size > 1).mapValues(_.map(_._1)).toMap
|
||||
|
||||
private[this] def allTargets(data: Settings[Scope]): Seq[(ProjectRef, File)] = {
|
||||
import ScopeFilter._
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ object ScriptedPlugin extends AutoPlugin {
|
|||
val pairMap = pairs.groupBy(_._1).mapValues(_.map(_._2).toSet)
|
||||
|
||||
val id = charClass(c => !c.isWhitespace && c != '/', "not whitespace and not '/'").+.string
|
||||
val groupP = token(id.examples(pairMap.keySet)) <~ token('/')
|
||||
val groupP = token(id.examples(pairMap.keySet.toSet)) <~ token('/')
|
||||
|
||||
// A parser for page definitions
|
||||
val pageNumber = (NatBasic & not('0', "zero page number")).flatMap { i =>
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ object LMCoursier {
|
|||
}
|
||||
|
||||
def coursierConfigurationTask: Def.Initialize[Task[CoursierConfiguration]] = Def.task {
|
||||
val sv = scalaVersion.value
|
||||
coursierConfiguration(
|
||||
csrRecursiveResolvers.value,
|
||||
csrInterProjectDependencies.value.toVector,
|
||||
|
|
@ -182,9 +183,9 @@ object LMCoursier {
|
|||
None,
|
||||
csrMavenProfiles.value,
|
||||
scalaOrganization.value,
|
||||
scalaVersion.value,
|
||||
sv,
|
||||
scalaBinaryVersion.value,
|
||||
autoScalaLibrary.value,
|
||||
autoScalaLibrary.value && !ScalaArtifacts.isScala3(sv),
|
||||
scalaModuleInfo.value,
|
||||
allExcludeDependencies.value,
|
||||
CoursierInputsTasks.credentialsTask.value,
|
||||
|
|
@ -200,6 +201,7 @@ object LMCoursier {
|
|||
}
|
||||
|
||||
def updateClassifierConfigurationTask: Def.Initialize[Task[CoursierConfiguration]] = Def.task {
|
||||
val sv = scalaVersion.value
|
||||
coursierConfiguration(
|
||||
csrRecursiveResolvers.value,
|
||||
csrInterProjectDependencies.value.toVector,
|
||||
|
|
@ -209,9 +211,9 @@ object LMCoursier {
|
|||
Some(transitiveClassifiers.value.map(Classifier(_))),
|
||||
csrMavenProfiles.value,
|
||||
scalaOrganization.value,
|
||||
scalaVersion.value,
|
||||
sv,
|
||||
scalaBinaryVersion.value,
|
||||
autoScalaLibrary.value,
|
||||
autoScalaLibrary.value && !ScalaArtifacts.isScala3(sv),
|
||||
scalaModuleInfo.value,
|
||||
allExcludeDependencies.value,
|
||||
CoursierInputsTasks.credentialsTask.value,
|
||||
|
|
@ -227,6 +229,7 @@ object LMCoursier {
|
|||
}
|
||||
|
||||
def updateSbtClassifierConfigurationTask: Def.Initialize[Task[CoursierConfiguration]] = Def.task {
|
||||
val sv = scalaVersion.value
|
||||
coursierConfiguration(
|
||||
csrSbtResolvers.value,
|
||||
Vector(),
|
||||
|
|
@ -236,9 +239,9 @@ object LMCoursier {
|
|||
None,
|
||||
csrMavenProfiles.value,
|
||||
scalaOrganization.value,
|
||||
scalaVersion.value,
|
||||
sv,
|
||||
scalaBinaryVersion.value,
|
||||
autoScalaLibrary.value,
|
||||
autoScalaLibrary.value && !ScalaArtifacts.isScala3(sv),
|
||||
scalaModuleInfo.value,
|
||||
allExcludeDependencies.value,
|
||||
CoursierInputsTasks.credentialsTask.value,
|
||||
|
|
@ -254,6 +257,7 @@ object LMCoursier {
|
|||
}
|
||||
|
||||
def scalaCompilerBridgeConfigurationTask: Def.Initialize[Task[CoursierConfiguration]] = Def.task {
|
||||
val sv = scalaVersion.value
|
||||
coursierConfiguration(
|
||||
csrResolvers.value,
|
||||
Vector(),
|
||||
|
|
@ -263,9 +267,9 @@ object LMCoursier {
|
|||
None,
|
||||
csrMavenProfiles.value,
|
||||
scalaOrganization.value,
|
||||
scalaVersion.value,
|
||||
sv,
|
||||
scalaBinaryVersion.value,
|
||||
autoScalaLibrary.value,
|
||||
autoScalaLibrary.value && !ScalaArtifacts.isScala3(sv),
|
||||
scalaModuleInfo.value,
|
||||
allExcludeDependencies.value,
|
||||
CoursierInputsTasks.credentialsTask.value,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt.internal
|
||||
|
||||
import java.util.concurrent.{ ExecutorService, Executors }
|
||||
import sbt.plugins.{ CorePlugin, IvyPlugin, JvmPlugin }
|
||||
|
||||
private[internal] object ClassLoaderWarmup {
|
||||
def warmup(): Unit = {
|
||||
if (Runtime.getRuntime.availableProcessors > 1) {
|
||||
val executorService: ExecutorService =
|
||||
Executors.newFixedThreadPool(Runtime.getRuntime.availableProcessors - 1)
|
||||
def submit[R](f: => R): Unit = {
|
||||
executorService.submit(new Runnable {
|
||||
override def run(): Unit = { f; () }
|
||||
})
|
||||
()
|
||||
}
|
||||
|
||||
submit(Class.forName("sbt.internal.parser.SbtParserInit").getConstructor().newInstance())
|
||||
submit(CorePlugin.projectSettings)
|
||||
submit(IvyPlugin.projectSettings)
|
||||
submit(JvmPlugin.projectSettings)
|
||||
submit(() => {
|
||||
try {
|
||||
val clazz = Class.forName("scala.reflect.runtime.package$")
|
||||
clazz.getMethod("universe").invoke(clazz.getField("MODULE$").get(null))
|
||||
} catch {
|
||||
case _: Exception =>
|
||||
}
|
||||
executorService.shutdown()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -190,6 +190,7 @@ private[sbt] final class CommandExchange {
|
|||
lazy val handlers = s.get(fullServerHandlers).getOrElse(Nil)
|
||||
lazy val win32Level = s.get(windowsServerSecurityLevel).getOrElse(2)
|
||||
lazy val useJni = s.get(serverUseJni).getOrElse(false)
|
||||
lazy val enableBsp = s.get(bspEnabled).getOrElse(true)
|
||||
lazy val portfile = s.baseDir / "project" / "target" / "active.json"
|
||||
|
||||
def onIncomingSocket(socket: Socket, instance: ServerInstance): Unit = {
|
||||
|
|
@ -225,6 +226,7 @@ private[sbt] final class CommandExchange {
|
|||
s.configuration,
|
||||
win32Level,
|
||||
useJni,
|
||||
enableBsp,
|
||||
)
|
||||
val serverInstance = Server.start(connection, onIncomingSocket, s.log)
|
||||
// don't throw exception when it times out
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt.internal
|
||||
|
||||
// https://github.com/scala/scala-parallel-collections/issues/22
|
||||
private[sbt] object CompatParColls {
|
||||
@com.github.ghik.silencer.silent
|
||||
val Converters = {
|
||||
import Compat._
|
||||
{
|
||||
import scala.collection.parallel._
|
||||
CollectionConverters
|
||||
}
|
||||
}
|
||||
object Compat {
|
||||
object CollectionConverters
|
||||
}
|
||||
}
|
||||
|
|
@ -17,12 +17,16 @@ import sbt.librarymanagement.Configuration
|
|||
|
||||
object KeyIndex {
|
||||
def empty: ExtendableKeyIndex = new KeyIndex0(emptyBuildIndex)
|
||||
@com.github.ghik.silencer.silent
|
||||
def apply(
|
||||
known: Iterable[ScopedKey[_]],
|
||||
projects: Map[URI, Set[String]],
|
||||
configurations: Map[String, Seq[Configuration]]
|
||||
): ExtendableKeyIndex =
|
||||
): ExtendableKeyIndex = {
|
||||
import sbt.internal.CompatParColls.Converters._
|
||||
known.par.foldLeft(base(projects, configurations)) { _ add _ }
|
||||
}
|
||||
@com.github.ghik.silencer.silent
|
||||
def aggregate(
|
||||
known: Iterable[ScopedKey[_]],
|
||||
extra: BuildUtil[_],
|
||||
|
|
@ -37,6 +41,7 @@ object KeyIndex {
|
|||
* This was a significant serial bottleneck during project loading that we can work around by
|
||||
* computing the aggregations in parallel and then bulk adding them to the index.
|
||||
*/
|
||||
import sbt.internal.CompatParColls.Converters._
|
||||
val toAggregate = known.par.map {
|
||||
case key if validID(key.key.label) =>
|
||||
Aggregation.aggregate(key, ScopeMask(), extra, reverse = true)
|
||||
|
|
@ -92,6 +97,7 @@ object KeyIndex {
|
|||
private[sbt] val emptyConfigIndex = new ConfigIndex(Map.empty, Map.empty, emptyAKeyIndex)
|
||||
private[sbt] val emptyProjectIndex = new ProjectIndex(Map.empty)
|
||||
private[sbt] val emptyBuildIndex = new BuildIndex(Map.empty)
|
||||
|
||||
}
|
||||
import KeyIndex._
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import sbt.io.IO
|
|||
import sbt.io.syntax._
|
||||
import sbt.Project.richInitializeTask
|
||||
import sjsonnew.JsonFormat
|
||||
import scala.compat.Platform.EOL
|
||||
|
||||
private[sbt] object LibraryManagement {
|
||||
implicit val linter: sbt.dsl.LinterLevel.Ignore.type = sbt.dsl.LinterLevel.Ignore
|
||||
|
|
@ -36,7 +37,8 @@ private[sbt] object LibraryManagement {
|
|||
force: Boolean,
|
||||
depsUpdated: Boolean,
|
||||
uwConfig: UnresolvedWarningConfiguration,
|
||||
ewo: EvictionWarningOptions,
|
||||
evictionLevel: Level.Value,
|
||||
versionSchemeOverrides: Seq[ModuleID],
|
||||
mavenStyle: Boolean,
|
||||
compatWarning: CompatibilityWarningOptions,
|
||||
includeCallers: Boolean,
|
||||
|
|
@ -61,9 +63,19 @@ private[sbt] object LibraryManagement {
|
|||
val report1 = transform(report)
|
||||
|
||||
// Warn of any eviction and compatibility warnings
|
||||
val ew = EvictionWarning(module, ewo, report1)
|
||||
ew.lines.foreach(log.warn(_))
|
||||
ew.infoAllTheThings.foreach(log.info(_))
|
||||
val evictionError = EvictionError(report1, module, versionSchemeOverrides)
|
||||
if (evictionError.incompatibleEvictions.isEmpty) ()
|
||||
else
|
||||
evictionLevel match {
|
||||
case Level.Error =>
|
||||
val msgs = List(
|
||||
"",
|
||||
"this can be overridden using libraryDependencySchemes or evictionErrorLevel"
|
||||
)
|
||||
sys.error((evictionError.lines ++ msgs).mkString(EOL))
|
||||
case _ =>
|
||||
evictionError.lines.foreach(log.log(evictionLevel, _: String))
|
||||
}
|
||||
CompatibilityWarning.run(compatWarning, module, mavenStyle, log)
|
||||
val report2 = transformDetails(report1, includeCallers, includeDetails)
|
||||
report2
|
||||
|
|
@ -245,11 +257,6 @@ private[sbt] object LibraryManagement {
|
|||
// logical clock is folded into UpdateConfiguration
|
||||
conf1.withLogicalClock(LogicalClock(state0.hashCode))
|
||||
}
|
||||
val evictionOptions = Def.taskDyn {
|
||||
if (executionRoots.value.exists(_.key == evicted.key))
|
||||
Def.task(EvictionWarningOptions.empty)
|
||||
else Def.task((evictionWarningOptions in update).value)
|
||||
}.value
|
||||
cachedUpdate(
|
||||
// LM API
|
||||
lm = lm,
|
||||
|
|
@ -263,7 +270,8 @@ private[sbt] object LibraryManagement {
|
|||
force = shouldForce,
|
||||
depsUpdated = transitiveUpdate.value.exists(!_.stats.cached),
|
||||
uwConfig = (unresolvedWarningConfiguration in update).value,
|
||||
ewo = evictionOptions,
|
||||
evictionLevel = Level.Debug,
|
||||
versionSchemeOverrides = Nil,
|
||||
mavenStyle = publishMavenStyle.value,
|
||||
compatWarning = compatibilityWarningOptions.value,
|
||||
includeCallers = false,
|
||||
|
|
@ -328,7 +336,11 @@ private[sbt] object LibraryManagement {
|
|||
.mapValues(cs => cs.map(c => ConfigRef(c)).toVector)
|
||||
store.write(allExcludes)
|
||||
IvyActions
|
||||
.addExcluded(report, classifiers.toVector, allExcludes.mapValues(_.map(_.name).toSet))
|
||||
.addExcluded(
|
||||
report,
|
||||
classifiers.toVector,
|
||||
allExcludes.mapValues(_.map(_.name).toSet).toMap
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ private[sbt] object Load {
|
|||
componentProvider = app.provider.components,
|
||||
secondaryCacheDir = Option(zincDir),
|
||||
dependencyResolution = dependencyResolution,
|
||||
compilerBridgeSource = ZincLmUtil.getDefaultBridgeModule(scalaProvider.version),
|
||||
compilerBridgeSource = ZincLmUtil.getDefaultBridgeSourceModule(scalaProvider.version),
|
||||
scalaJarsTarget = zincDir,
|
||||
state.get(BasicKeys.classLoaderCache),
|
||||
log = log
|
||||
|
|
@ -324,7 +324,7 @@ private[sbt] object Load {
|
|||
val keys = Index.allKeys(settings)
|
||||
val attributeKeys = Index.attributeKeys(data) ++ keys.map(_.key)
|
||||
val scopedKeys = keys ++ data.allKeys((s, k) => ScopedKey(s, k)).toVector
|
||||
val projectsMap = projects.mapValues(_.defined.keySet)
|
||||
val projectsMap = projects.mapValues(_.defined.keySet).toMap
|
||||
val configsMap: Map[String, Seq[Configuration]] =
|
||||
projects.values.flatMap(bu => bu.defined map { case (k, v) => (k, v.configurations) }).toMap
|
||||
val keyIndex = KeyIndex(scopedKeys.toVector, projectsMap, configsMap)
|
||||
|
|
@ -638,7 +638,7 @@ private[sbt] object Load {
|
|||
val resolve = (_: Project).resolve(ref => Scope.resolveProjectRef(uri, rootProject, ref))
|
||||
new LoadedBuildUnit(
|
||||
unit.unit,
|
||||
unit.defined mapValues resolve,
|
||||
unit.defined.mapValues(resolve).toMap,
|
||||
unit.rootProjects,
|
||||
unit.buildSettings
|
||||
)
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ private[sbt] object PluginsDebug {
|
|||
def definesPlugin(p: ResolvedProject): Boolean = p.autoPlugins.contains(plugin)
|
||||
def projectForRef(ref: ProjectRef): ResolvedProject = get(Keys.thisProject in ref)
|
||||
val perBuild: Map[URI, Set[AutoPlugin]] =
|
||||
structure.units.mapValues(unit => availableAutoPlugins(unit).toSet)
|
||||
structure.units.mapValues(unit => availableAutoPlugins(unit).toSet).toMap
|
||||
val pluginsThisBuild = perBuild.getOrElse(currentRef.build, Set.empty).toList
|
||||
lazy val context = Context(
|
||||
currentProject.plugins,
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ object RemoteCache {
|
|||
val app = appConfiguration.value
|
||||
val base = app.baseDirectory.getCanonicalFile
|
||||
// base is used only to resolve relative paths, which should never happen
|
||||
IvyPaths(base, localCacheDirectory.value),
|
||||
IvyPaths(base, localCacheDirectory.value)
|
||||
},
|
||||
)
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ object RemoteCache {
|
|||
ivySbt := {
|
||||
Credentials.register(credentials.value, streams.value.log)
|
||||
val config0 = ivyConfiguration.value
|
||||
new IvySbt(config0, CustomHttp.okhttpClient.value)
|
||||
new IvySbt(config0, sbt.internal.CustomHttp.okhttpClient.value)
|
||||
},
|
||||
)
|
||||
) ++ inTask(pullRemoteCache)(
|
||||
|
|
|
|||
|
|
@ -1,186 +0,0 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt.internal
|
||||
|
||||
import java.io.File
|
||||
import java.lang.reflect.InvocationTargetException
|
||||
import java.net.URL
|
||||
import java.util.concurrent.{ ExecutorService, Executors }
|
||||
import ClassLoaderClose.close
|
||||
|
||||
import sbt.plugins.{ CorePlugin, IvyPlugin, JvmPlugin }
|
||||
import xsbti._
|
||||
|
||||
private[internal] object ClassLoaderWarmup {
|
||||
def warmup(): Unit = {
|
||||
if (Runtime.getRuntime.availableProcessors > 1) {
|
||||
val executorService: ExecutorService =
|
||||
Executors.newFixedThreadPool(Runtime.getRuntime.availableProcessors - 1)
|
||||
def submit[R](f: => R): Unit = {
|
||||
executorService.submit(new Runnable {
|
||||
override def run(): Unit = { f; () }
|
||||
})
|
||||
()
|
||||
}
|
||||
|
||||
submit(Class.forName("sbt.internal.parser.SbtParserInit").getConstructor().newInstance())
|
||||
submit(CorePlugin.projectSettings)
|
||||
submit(IvyPlugin.projectSettings)
|
||||
submit(JvmPlugin.projectSettings)
|
||||
submit(() => {
|
||||
try {
|
||||
val clazz = Class.forName("scala.reflect.runtime.package$")
|
||||
clazz.getMethod("universe").invoke(clazz.getField("MODULE$").get(null))
|
||||
} catch {
|
||||
case _: Exception =>
|
||||
}
|
||||
executorService.shutdown()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a new app configuration and invokes xMainImpl.run. For AppConfigurations generated
|
||||
* by recent launchers, it is unnecessary to modify the original configuration, but configurations
|
||||
* generated by older launchers need to be modified to place the test interface jar higher in
|
||||
* the class hierarchy. The methods this object are implemented without using the scala library
|
||||
* so that we can avoid loading any classes from the old scala provider. Verified as of
|
||||
* sbt 1.3.0 that there are no references to the scala standard library in any of the methods
|
||||
* in this file.
|
||||
*/
|
||||
private[sbt] class XMainConfiguration {
|
||||
def run(moduleName: String, configuration: xsbti.AppConfiguration): xsbti.MainResult = {
|
||||
val topLoader = configuration.provider.scalaProvider.launcher.topLoader
|
||||
val updatedConfiguration =
|
||||
try {
|
||||
val method = topLoader.getClass.getMethod("getJLineJars")
|
||||
val jars = method.invoke(topLoader).asInstanceOf[Array[URL]]
|
||||
var canReuseConfiguration = jars.length == 3
|
||||
var j = 0
|
||||
while (j < jars.length && canReuseConfiguration) {
|
||||
val s = jars(j).toString
|
||||
canReuseConfiguration = s.contains("jline") || s.contains("jansi")
|
||||
j += 1
|
||||
}
|
||||
if (canReuseConfiguration && j == 3) configuration else makeConfiguration(configuration)
|
||||
} catch {
|
||||
case _: NoSuchMethodException => makeConfiguration(configuration)
|
||||
}
|
||||
val loader = updatedConfiguration.provider.loader
|
||||
Thread.currentThread.setContextClassLoader(loader)
|
||||
val clazz = loader.loadClass(s"sbt.$moduleName$$")
|
||||
val instance = clazz.getField("MODULE$").get(null)
|
||||
val runMethod = clazz.getMethod("run", classOf[xsbti.AppConfiguration])
|
||||
try {
|
||||
val clw = loader.loadClass("sbt.internal.ClassLoaderWarmup$")
|
||||
clw.getMethod("warmup").invoke(clw.getField("MODULE$").get(null))
|
||||
runMethod.invoke(instance, updatedConfiguration).asInstanceOf[xsbti.MainResult]
|
||||
} catch {
|
||||
case e: InvocationTargetException =>
|
||||
// This propogates xsbti.FullReload to the launcher
|
||||
throw e.getCause
|
||||
}
|
||||
}
|
||||
|
||||
private def makeConfiguration(configuration: xsbti.AppConfiguration): xsbti.AppConfiguration = {
|
||||
val baseLoader = classOf[XMainConfiguration].getClassLoader
|
||||
val className = "sbt/internal/XMainConfiguration.class"
|
||||
val url = baseLoader.getResource(className)
|
||||
val path = url.toString.replaceAll(s"$className$$", "")
|
||||
val urlArray = new Array[URL](1)
|
||||
urlArray(0) = new URL(path)
|
||||
val topLoader = configuration.provider.scalaProvider.launcher.topLoader
|
||||
// This loader doesn't have the scala library in it so it's critical that none of the code
|
||||
// in this file use the scala library.
|
||||
val modifiedLoader = new XMainClassLoader(urlArray, topLoader)
|
||||
val xMainConfigurationClass = modifiedLoader.loadClass("sbt.internal.XMainConfiguration")
|
||||
val instance: AnyRef =
|
||||
xMainConfigurationClass.getConstructor().newInstance().asInstanceOf[AnyRef]
|
||||
|
||||
val metaBuildLoaderClass = modifiedLoader.loadClass("sbt.internal.MetaBuildLoader")
|
||||
val method = metaBuildLoaderClass.getMethod("makeLoader", classOf[AppProvider])
|
||||
|
||||
val loader = method.invoke(null, configuration.provider).asInstanceOf[ClassLoader]
|
||||
|
||||
Thread.currentThread.setContextClassLoader(loader)
|
||||
val modifiedConfigurationClass =
|
||||
modifiedLoader.loadClass("sbt.internal.XMainConfiguration$ModifiedConfiguration")
|
||||
val cons = modifiedConfigurationClass.getConstructors()(0)
|
||||
close(configuration.provider.loader)
|
||||
val scalaProvider = configuration.provider.scalaProvider
|
||||
val providerClass = scalaProvider.getClass
|
||||
val _ = try {
|
||||
val method = providerClass.getMethod("loaderLibraryOnly")
|
||||
close(method.invoke(scalaProvider).asInstanceOf[ClassLoader])
|
||||
1
|
||||
} catch { case _: NoSuchMethodException => 1 }
|
||||
close(scalaProvider.loader)
|
||||
close(configuration.provider.loader)
|
||||
cons.newInstance(instance, configuration, loader).asInstanceOf[xsbti.AppConfiguration]
|
||||
}
|
||||
|
||||
/*
|
||||
* Replaces the AppProvider.loader method with a new loader that puts the sbt test interface
|
||||
* jar ahead of the rest of the sbt classpath in the classloading hierarchy.
|
||||
*/
|
||||
private[sbt] class ModifiedConfiguration(
|
||||
val configuration: xsbti.AppConfiguration,
|
||||
val metaLoader: ClassLoader
|
||||
) extends xsbti.AppConfiguration {
|
||||
|
||||
private class ModifiedAppProvider(val appProvider: AppProvider) extends AppProvider {
|
||||
private val delegate = configuration.provider.scalaProvider
|
||||
object ModifiedScalaProvider extends ScalaProvider {
|
||||
override def launcher(): Launcher = new Launcher {
|
||||
private val delegateLauncher = delegate.launcher
|
||||
private val interfaceLoader = metaLoader.loadClass("sbt.testing.Framework").getClassLoader
|
||||
override def getScala(version: String): ScalaProvider = getScala(version, "")
|
||||
override def getScala(version: String, reason: String): ScalaProvider =
|
||||
getScala(version, reason, "org.scala-lang")
|
||||
override def getScala(version: String, reason: String, scalaOrg: String): ScalaProvider =
|
||||
delegateLauncher.getScala(version, reason, scalaOrg)
|
||||
override def app(id: xsbti.ApplicationID, version: String): AppProvider =
|
||||
delegateLauncher.app(id, version)
|
||||
override def topLoader(): ClassLoader = interfaceLoader
|
||||
override def globalLock(): GlobalLock = delegateLauncher.globalLock()
|
||||
override def bootDirectory(): File = delegateLauncher.bootDirectory()
|
||||
override def ivyRepositories(): Array[xsbti.Repository] =
|
||||
delegateLauncher.ivyRepositories()
|
||||
override def appRepositories(): Array[xsbti.Repository] =
|
||||
delegateLauncher.appRepositories()
|
||||
override def isOverrideRepositories: Boolean = delegateLauncher.isOverrideRepositories
|
||||
override def ivyHome(): File = delegateLauncher.ivyHome()
|
||||
override def checksums(): Array[String] = delegateLauncher.checksums()
|
||||
}
|
||||
override def version(): String = delegate.version
|
||||
override def loader(): ClassLoader = metaLoader.getParent
|
||||
override def jars(): Array[File] = delegate.jars
|
||||
@deprecated("Implements deprecated api", "1.3.0")
|
||||
override def libraryJar(): File = delegate.libraryJar
|
||||
@deprecated("Implements deprecated api", "1.3.0")
|
||||
override def compilerJar(): File = delegate.compilerJar
|
||||
override def app(id: xsbti.ApplicationID): AppProvider = delegate.app(id)
|
||||
def loaderLibraryOnly(): ClassLoader = metaLoader.getParent.getParent
|
||||
}
|
||||
override def scalaProvider(): ModifiedScalaProvider.type = ModifiedScalaProvider
|
||||
override def id(): xsbti.ApplicationID = appProvider.id()
|
||||
override def loader(): ClassLoader = metaLoader
|
||||
@deprecated("Implements deprecated api", "1.3.0")
|
||||
override def mainClass(): Class[_ <: AppMain] = appProvider.mainClass()
|
||||
override def entryPoint(): Class[_] = appProvider.entryPoint()
|
||||
override def newMain(): AppMain = appProvider.newMain()
|
||||
override def mainClasspath(): Array[File] = appProvider.mainClasspath()
|
||||
override def components(): ComponentProvider = appProvider.components()
|
||||
}
|
||||
override def arguments(): Array[String] = configuration.arguments
|
||||
override def baseDirectory(): File = configuration.baseDirectory
|
||||
override def provider(): AppProvider = new ModifiedAppProvider(configuration.provider)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -20,13 +20,13 @@ object IvyReport {
|
|||
def fromReportXML(doc: Document): ModuleGraph = {
|
||||
def edgesForModule(id: GraphModuleId, revision: NodeSeq): Seq[Edge] =
|
||||
for {
|
||||
caller ← revision \ "caller"
|
||||
caller <- revision \ "caller"
|
||||
callerModule = moduleIdFromElement(caller, caller.attribute("callerrev").get.text)
|
||||
} yield (moduleIdFromElement(caller, caller.attribute("callerrev").get.text), id)
|
||||
|
||||
val moduleEdges: Seq[(Module, Seq[Edge])] = for {
|
||||
mod ← doc \ "dependencies" \ "module"
|
||||
revision ← mod \ "revision"
|
||||
mod <- doc \ "dependencies" \ "module"
|
||||
revision <- mod \ "revision"
|
||||
rev = revision.attribute("name").get.text
|
||||
moduleId = moduleIdFromElement(mod, rev)
|
||||
module = Module(
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ private[sbt] case class ModuleGraph(nodes: Seq[Module], edges: Seq[Edge]) {
|
|||
val (f, t) = bindingFor(entry)
|
||||
m.addBinding(f, module(t))
|
||||
}
|
||||
m.toMap.mapValues(_.toSeq.sortBy(_.id.idString)).withDefaultValue(Nil)
|
||||
m.toMap.mapValues(_.toSeq.sortBy(_.id.idString)).toMap.withDefaultValue(Nil)
|
||||
}
|
||||
|
||||
def roots: Seq[Module] =
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ object DOT {
|
|||
labelRendering: HTMLLabelRendering
|
||||
): String = {
|
||||
val nodes = {
|
||||
for (n ← graph.nodes) yield {
|
||||
for (n <- graph.nodes) yield {
|
||||
val style = if (n.isEvicted) EvictedStyle else ""
|
||||
val label = nodeFormation(n.id.organization, n.id.name, n.id.version)
|
||||
""" "%s"[%s style="%s"]""".format(
|
||||
|
|
@ -56,7 +56,7 @@ object DOT {
|
|||
.filterNot(e => originWasEvicted(e) || evictionTargetEdges(e)) ++ evictedByEdges
|
||||
|
||||
val edges = {
|
||||
for (e ← filteredEdges) yield {
|
||||
for (e <- filteredEdges) yield {
|
||||
val extra =
|
||||
if (graph.module(e._1).isEvicted)
|
||||
s""" [label="Evicted By" style="$EvictedStyle"]"""
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import scala.xml.XML
|
|||
object GraphML {
|
||||
def saveAsGraphML(graph: ModuleGraph, outputFile: String): Unit = {
|
||||
val nodesXml =
|
||||
for (n ← graph.nodes)
|
||||
for (n <- graph.nodes)
|
||||
yield <node id={n.id.idString}><data key="d0">
|
||||
<y:ShapeNode>
|
||||
<y:NodeLabel>{n.id.idString}</y:NodeLabel>
|
||||
|
|
@ -23,7 +23,7 @@ object GraphML {
|
|||
</data></node>
|
||||
|
||||
val edgesXml =
|
||||
for (e ← graph.edges)
|
||||
for (e <- graph.edges)
|
||||
yield <edge source={e._1.idString} target={e._2.idString}/>
|
||||
|
||||
val xml =
|
||||
|
|
|
|||
|
|
@ -78,10 +78,18 @@ object BuildServerProtocol {
|
|||
)
|
||||
|
||||
lazy val globalSettings: Seq[Def.Setting[_]] = Seq(
|
||||
bspConfig := BuildServerConnection.writeConnectionFile(
|
||||
sbtVersion.value,
|
||||
(ThisBuild / baseDirectory).value
|
||||
),
|
||||
bspConfig := {
|
||||
if (bspEnabled.value) {
|
||||
BuildServerConnection.writeConnectionFile(
|
||||
sbtVersion.value,
|
||||
(ThisBuild / baseDirectory).value
|
||||
)
|
||||
} else {
|
||||
val logger = streams.value.log
|
||||
logger.warn("BSP is disabled for this build")
|
||||
logger.info("add 'Global / bspEnabled := true' to enable BSP")
|
||||
}
|
||||
},
|
||||
bspEnabled := true,
|
||||
bspWorkspace := bspWorkspaceSetting.value,
|
||||
bspWorkspaceBuildTargets := Def.taskDyn {
|
||||
|
|
@ -459,7 +467,7 @@ object BuildServerProtocol {
|
|||
(artifact, file) <- module.artifacts
|
||||
classifier <- artifact.classifier if classifier == "sources"
|
||||
} yield file.toURI
|
||||
DependencySourcesItem(targetId, sources.distinct.toVector)
|
||||
DependencySourcesItem(targetId, sources.toVector.distinct)
|
||||
}
|
||||
|
||||
private def bspCompileTask: Def.Initialize[Task[Int]] = Def.task {
|
||||
|
|
|
|||
|
|
@ -259,6 +259,7 @@ private[sbt] object Definition {
|
|||
result.future
|
||||
}
|
||||
|
||||
@com.github.ghik.silencer.silent
|
||||
def lspDefinition(
|
||||
jsonDefinition: JValue,
|
||||
requestId: String,
|
||||
|
|
@ -287,6 +288,7 @@ private[sbt] object Definition {
|
|||
log.debug(s"symbol $sym")
|
||||
analyses
|
||||
.map { analyses =>
|
||||
import sbt.internal.CompatParColls.Converters._
|
||||
val locations = analyses.par.flatMap { analysis =>
|
||||
val selectPotentials = textProcessor.potentialClsOrTraitOrObj(sym)
|
||||
val classes =
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ final class NetworkChannel(
|
|||
import sbt.protocol.codec.JsonProtocol._
|
||||
StandardMain.exchange.withState { s =>
|
||||
val structure = Project.extract(s).structure
|
||||
SettingQuery.handleSettingQueryEither(req, structure) match {
|
||||
sbt.internal.server.SettingQuery.handleSettingQueryEither(req, structure) match {
|
||||
case Right(x) => respondResult(x, execId)
|
||||
case Left(s) => respondError(ErrorCodes.InvalidParams, s, execId)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,13 +85,14 @@ object VirtualTerminal {
|
|||
queue
|
||||
}
|
||||
private[sbt] def cancelRequests(name: String): Unit = {
|
||||
pendingTerminalCapabilities.forEach {
|
||||
import scala.collection.JavaConverters._
|
||||
pendingTerminalCapabilities.asScala.foreach {
|
||||
case (k @ (`name`, _), q) =>
|
||||
pendingTerminalCapabilities.remove(k)
|
||||
q.put(TerminalCapabilitiesResponse(None, None, None))
|
||||
case _ =>
|
||||
}
|
||||
pendingTerminalProperties.forEach {
|
||||
pendingTerminalProperties.asScala.foreach {
|
||||
case (k @ (`name`, _), q) =>
|
||||
pendingTerminalProperties.remove(k)
|
||||
q.put(TerminalPropertiesResponse(0, 0, false, false, false, false))
|
||||
|
|
|
|||
|
|
@ -269,7 +269,9 @@ private[sbt] object Settings {
|
|||
* @return a task definition that retrieves the input files and their file stamps scoped to the
|
||||
* input key.
|
||||
*/
|
||||
@com.github.ghik.silencer.silent
|
||||
private[sbt] def fileStamps(scopedKey: Def.ScopedKey[_]): Def.Setting[_] = {
|
||||
import sbt.internal.CompatParColls.Converters._
|
||||
val scope = scopedKey.scope
|
||||
addTaskDefinition(Keys.inputFileStamps in scope := {
|
||||
val cache = (unmanagedFileStampCache in scope).value
|
||||
|
|
|
|||
|
|
@ -516,7 +516,7 @@ object Watch {
|
|||
}).reverse.foreach { o =>
|
||||
if (distinctOpts.add(o.input)) opts += o
|
||||
}
|
||||
opts.reverse
|
||||
opts.toSeq.reverse
|
||||
}
|
||||
private def waitMessage(project: ProjectRef, commands: Seq[String]): Seq[String] = {
|
||||
val cmds = commands.map(project.project + "/" + _.trim).mkString("; ")
|
||||
|
|
|
|||
|
|
@ -43,7 +43,9 @@ object SemanticdbPlugin extends AutoPlugin {
|
|||
},
|
||||
semanticdbOptions += {
|
||||
val sv = scalaVersion.value
|
||||
if (ScalaInstance.isDotty(sv)) "-Ysemanticdb"
|
||||
if (sv.startsWith("0.") || sv.startsWith("3.0.0-M1") || sv.startsWith("3.0.0-M2"))
|
||||
"-Ysemanticdb"
|
||||
else if (sv.startsWith("3.")) "-Xsemanticdb"
|
||||
else "-Yrangepos"
|
||||
}
|
||||
) ++
|
||||
|
|
|
|||
|
|
@ -7,52 +7,66 @@
|
|||
|
||||
package sbt
|
||||
|
||||
import org.specs2._
|
||||
import mutable.Specification
|
||||
import sbt.util.Logger
|
||||
|
||||
object PluginsTest extends Specification {
|
||||
object PluginsTest extends verify.BasicTestSuite {
|
||||
import AI._
|
||||
|
||||
"Auto plugin" should {
|
||||
"enable plugins with trigger=allRequirements AND requirements met" in {
|
||||
deducePlugin(A && B, log) must contain(Q)
|
||||
test("Auto plugin should enable plugins with trigger=allRequirements AND requirements met") {
|
||||
assert(deducePlugin(A && B, log).contains(Q))
|
||||
}
|
||||
|
||||
test("it should enable transitive plugins with trigger=allRequirements AND requirements met") {
|
||||
assert(deducePlugin(A && B, log) contains (R))
|
||||
}
|
||||
|
||||
test("it should order enable plugins after required plugins") {
|
||||
val ns = deducePlugin(A && B, log)
|
||||
assert((ns indexOf Q) > (ns indexOf A))
|
||||
assert((ns indexOf Q) > (ns indexOf B))
|
||||
assert((ns indexOf R) > (ns indexOf A))
|
||||
assert((ns indexOf R) > (ns indexOf B))
|
||||
assert((ns indexOf R) > (ns indexOf Q))
|
||||
}
|
||||
|
||||
test("it should not enable plugins with trigger=allRequirements but conflicting requirements") {
|
||||
assert(!deducePlugin(A && B, log).contains(S))
|
||||
}
|
||||
|
||||
test("it should enable plugins that are required by the requested plugins") {
|
||||
val ns = deducePlugin(Q, log)
|
||||
assert(ns.contains(A))
|
||||
assert(ns.contains(B))
|
||||
}
|
||||
|
||||
test("it should throw an AutoPluginException on conflicting requirements") {
|
||||
try {
|
||||
deducePlugin(S, log)
|
||||
} catch {
|
||||
case e: AutoPluginException =>
|
||||
assertEquals(
|
||||
s"""Contradiction in enabled plugins:
|
||||
- requested: sbt.AI$$S
|
||||
- enabled: sbt.AI$$S, sbt.AI$$Q, sbt.AI$$R, sbt.AI$$B, sbt.AI$$A
|
||||
- conflict: sbt.AI$$R is enabled by sbt.AI$$Q; excluded by sbt.AI$$S""",
|
||||
e.message
|
||||
)
|
||||
}
|
||||
"enable transitive plugins with trigger=allRequirements AND requirements met" in {
|
||||
deducePlugin(A && B, log) must contain(R)
|
||||
}
|
||||
"order enable plugins after required plugins" in {
|
||||
val ns = deducePlugin(A && B, log)
|
||||
((ns indexOf Q) must beGreaterThan(ns indexOf A)) and
|
||||
((ns indexOf Q) must beGreaterThan(ns indexOf B)) and
|
||||
((ns indexOf R) must beGreaterThan(ns indexOf A)) and
|
||||
((ns indexOf R) must beGreaterThan(ns indexOf B)) and
|
||||
((ns indexOf R) must beGreaterThan(ns indexOf Q))
|
||||
}
|
||||
"not enable plugins with trigger=allRequirements but conflicting requirements" in {
|
||||
deducePlugin(A && B, log) must not contain (S)
|
||||
}
|
||||
"enable plugins that are required by the requested plugins" in {
|
||||
val ns = deducePlugin(Q, log)
|
||||
(ns must contain(A)) and
|
||||
(ns must contain(B))
|
||||
}
|
||||
"throw an AutoPluginException on conflicting requirements" in {
|
||||
deducePlugin(S, log) must throwAn[AutoPluginException](
|
||||
message = s"""Contradiction in enabled plugins:
|
||||
- requested: sbt.AI\\$$S
|
||||
- enabled: sbt.AI\\$$S, sbt.AI\\$$Q, sbt.AI\\$$R, sbt.AI\\$$B, sbt.AI\\$$A
|
||||
- conflict: sbt.AI\\$$R is enabled by sbt.AI\\$$Q; excluded by sbt.AI\\$$S"""
|
||||
)
|
||||
}
|
||||
"generates a detailed report on conflicting requirements" in {
|
||||
deducePlugin(T && U, log) must throwAn[AutoPluginException](
|
||||
message = s"""Contradiction in enabled plugins:
|
||||
- requested: sbt.AI\\$$T && sbt.AI\\$$U
|
||||
- enabled: sbt.AI\\$$U, sbt.AI\\$$T, sbt.AI\\$$A, sbt.AI\\$$Q, sbt.AI\\$$R, sbt.AI\\$$B
|
||||
- conflict: sbt.AI\\$$Q is enabled by sbt.AI\\$$A && sbt.AI\\$$B; required by sbt.AI\\$$T, sbt.AI\\$$R; excluded by sbt.AI\\$$U
|
||||
- conflict: sbt.AI\\$$R is enabled by sbt.AI\\$$Q; excluded by sbt.AI\\$$T"""
|
||||
)
|
||||
}
|
||||
|
||||
test("it should generate a detailed report on conflicting requirements") {
|
||||
try {
|
||||
deducePlugin(T && U, log)
|
||||
} catch {
|
||||
case e: AutoPluginException =>
|
||||
assertEquals(
|
||||
s"""Contradiction in enabled plugins:
|
||||
- requested: sbt.AI$$T && sbt.AI$$U
|
||||
- enabled: sbt.AI$$U, sbt.AI$$T, sbt.AI$$A, sbt.AI$$Q, sbt.AI$$R, sbt.AI$$B
|
||||
- conflict: sbt.AI$$Q is enabled by sbt.AI$$A && sbt.AI$$B; required by sbt.AI$$T, sbt.AI$$R; excluded by sbt.AI$$U
|
||||
- conflict: sbt.AI$$R is enabled by sbt.AI$$Q; excluded by sbt.AI$$T""",
|
||||
e.message
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,15 +213,31 @@ object SettingQueryTest extends org.specs2.mutable.Specification {
|
|||
// "t/pollInterval" in qok("500", "Int")
|
||||
"t/sourcesInBase" in qok("true", "Boolean")
|
||||
"t/startYear" in qok("null", "scala.Option[Int]")
|
||||
"t/scalaArtifacts" in qok(
|
||||
"""["scala-library","scala-compiler","scala-reflect","scala-actors","scalap"]""",
|
||||
"scala.collection.Seq[java.lang.String]"
|
||||
)
|
||||
"t/scalaArtifacts" in {
|
||||
if (scala.util.Properties.versionNumberString.startsWith("2.12"))
|
||||
qok(
|
||||
"""["scala-library","scala-compiler","scala-reflect","scala-actors","scalap"]""",
|
||||
"scala.collection.Seq[java.lang.String]"
|
||||
)
|
||||
else
|
||||
qok(
|
||||
"""["scala-library","scala-compiler","scala-reflect","scala-actors","scalap"]""",
|
||||
"scala.collection.immutable.Seq[java.lang.String]"
|
||||
)
|
||||
}
|
||||
|
||||
"t/libraryDependencies" in qok(
|
||||
"""[{"organization":"org.scala-lang","name":"scala-library","revision":"2.12.1","isChanging":false,"isTransitive":true,"isForce":false,"explicitArtifacts":[],"inclusions":[],"exclusions":[],"extraAttributes":{},"crossVersion":{"type":"Disabled"}}]""",
|
||||
"scala.collection.Seq[sbt.librarymanagement.ModuleID]"
|
||||
)
|
||||
"t/libraryDependencies" in {
|
||||
if (scala.util.Properties.versionNumberString.startsWith("2.12"))
|
||||
qok(
|
||||
"""[{"organization":"org.scala-lang","name":"scala-library","revision":"2.12.1","isChanging":false,"isTransitive":true,"isForce":false,"explicitArtifacts":[],"inclusions":[],"exclusions":[],"extraAttributes":{},"crossVersion":{"type":"Disabled"}}]""",
|
||||
"scala.collection.Seq[sbt.librarymanagement.ModuleID]"
|
||||
)
|
||||
else
|
||||
qok(
|
||||
"""[{"organization":"org.scala-lang","name":"scala-library","revision":"2.12.1","isChanging":false,"isTransitive":true,"isForce":false,"explicitArtifacts":[],"inclusions":[],"exclusions":[],"extraAttributes":{},"crossVersion":{"type":"Disabled"}}]""",
|
||||
"scala.collection.immutable.Seq[sbt.librarymanagement.ModuleID]"
|
||||
)
|
||||
}
|
||||
|
||||
"scalaVersion" in qko("Not a valid project ID: scalaVersion\\nscalaVersion\\n ^")
|
||||
"t/scalacOptions" in qko(
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@ object Dependencies {
|
|||
// sbt modules
|
||||
private val ioVersion = nightlyVersion.getOrElse("1.4.0")
|
||||
private val lmVersion =
|
||||
sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.4.0")
|
||||
val zincVersion = nightlyVersion.getOrElse("1.4.3")
|
||||
sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.5.0-M3")
|
||||
val zincVersion = nightlyVersion.getOrElse("1.5.0-M2")
|
||||
|
||||
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
||||
|
||||
private val libraryManagementCore = "org.scala-sbt" %% "librarymanagement-core" % lmVersion
|
||||
private val libraryManagementIvy = "org.scala-sbt" %% "librarymanagement-ivy" % lmVersion
|
||||
|
||||
val launcherVersion = "1.1.5"
|
||||
val launcherVersion = "1.1.6"
|
||||
val launcherInterface = "org.scala-sbt" % "launcher-interface" % launcherVersion
|
||||
val rawLauncher = "org.scala-sbt" % "launcher" % launcherVersion
|
||||
val testInterface = "org.scala-sbt" % "test-interface" % "1.0"
|
||||
|
|
@ -77,7 +77,7 @@ object Dependencies {
|
|||
def addSbtZincCompile = addSbtModule(sbtZincPath, "zincCompileJVM2_12", zincCompile)
|
||||
def addSbtZincCompileCore = addSbtModule(sbtZincPath, "zincCompileCoreJVM2_12", zincCompileCore)
|
||||
|
||||
val lmCoursierShaded = "io.get-coursier" %% "lm-coursier-shaded" % "2.0.4"
|
||||
val lmCoursierShaded = "io.get-coursier" %% "lm-coursier-shaded" % "2.0.5"
|
||||
|
||||
def sjsonNew(n: String) =
|
||||
Def.setting("com.eed3si9n" %% n % "0.9.1") // contrabandSjsonNewVersion.value
|
||||
|
|
@ -102,6 +102,7 @@ object Dependencies {
|
|||
val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.3.0"
|
||||
val scalaParsers = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
|
||||
val scalaReflect = Def.setting("org.scala-lang" % "scala-reflect" % scalaVersion.value)
|
||||
val scalaPar = "org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.0"
|
||||
|
||||
// specify all of log4j modules to prevent misalignment
|
||||
def log4jModule = (n: String) => "org.apache.logging.log4j" % n % "2.11.2"
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import Keys._
|
|||
import sbt.internal.inc.Analysis
|
||||
|
||||
object Util {
|
||||
val version2_13 = settingKey[String]("version number")
|
||||
val ExclusiveTest: Tags.Tag = Tags.Tag("exclusive-test")
|
||||
|
||||
val componentID: SettingKey[Option[String]] = settingKey[Option[String]]("")
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
sbt.version=1.4.4
|
||||
sbt.version=1.4.6
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.0.0")
|
|||
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.6")
|
||||
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0")
|
||||
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.0")
|
||||
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.5.0")
|
||||
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.5.1")
|
||||
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "3.0.2")
|
||||
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.14")
|
||||
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9")
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ final class BspCompileResult private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: BspCompileResult => (this.originId == x.originId) && (this.statusCode == x.statusCode)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.BspCompileResult".##) + originId.##) + statusCode.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ final class BspConnectionDetails private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: BspConnectionDetails => (this.name == x.name) && (this.version == x.version) && (this.bspVersion == x.bspVersion) && (this.languages == x.languages) && (this.argv == x.argv)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.BspConnectionDetails".##) + name.##) + version.##) + bspVersion.##) + languages.##) + argv.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ final class BuildClientCapabilities private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: BuildClientCapabilities => (this.languageIds == x.languageIds)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.BuildClientCapabilities".##) + languageIds.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ final class BuildServerCapabilities private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: BuildServerCapabilities => (this.compileProvider == x.compileProvider) && (this.testProvider == x.testProvider) && (this.runProvider == x.runProvider) && (this.dependencySourcesProvider == x.dependencySourcesProvider) && (this.canReload == x.canReload)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.BuildServerCapabilities".##) + compileProvider.##) + testProvider.##) + runProvider.##) + dependencySourcesProvider.##) + canReload.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@ final class BuildTarget private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: BuildTarget => (this.id == x.id) && (this.displayName == x.displayName) && (this.baseDirectory == x.baseDirectory) && (this.tags == x.tags) && (this.capabilities == x.capabilities) && (this.languageIds == x.languageIds) && (this.dependencies == x.dependencies) && (this.dataKind == x.dataKind) && (this.data == x.data)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.BuildTarget".##) + id.##) + displayName.##) + baseDirectory.##) + tags.##) + capabilities.##) + languageIds.##) + dependencies.##) + dataKind.##) + data.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ final class BuildTargetCapabilities private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: BuildTargetCapabilities => (this.canCompile == x.canCompile) && (this.canTest == x.canTest) && (this.canRun == x.canRun)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.BuildTargetCapabilities".##) + canCompile.##) + canTest.##) + canRun.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ final class BuildTargetIdentifier private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: BuildTargetIdentifier => (this.uri == x.uri)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.BuildTargetIdentifier".##) + uri.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ final class CompileParams private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: CompileParams => (this.targets == x.targets) && (this.originId == x.originId) && (this.arguments == x.arguments)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.CompileParams".##) + targets.##) + originId.##) + arguments.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ final class CompileProvider private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: CompileProvider => (this.languageIds == x.languageIds)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.CompileProvider".##) + languageIds.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ final class CompileReport private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: CompileReport => (this.target == x.target) && (this.originId == x.originId) && (this.errors == x.errors) && (this.warnings == x.warnings) && (this.time == x.time)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.CompileReport".##) + target.##) + originId.##) + errors.##) + warnings.##) + time.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ final class CompileTask private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: CompileTask => (this.target == x.target)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.CompileTask".##) + target.##)
|
||||
}
|
||||
|
|
|
|||
33
protocol/src/main/contraband-scala/sbt/internal/bsp/DebugSessionAddress.scala
generated
Normal file
33
protocol/src/main/contraband-scala/sbt/internal/bsp/DebugSessionAddress.scala
generated
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/** @param uri The target's Uri */
|
||||
final class DebugSessionAddress private (
|
||||
val uri: java.net.URI) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: DebugSessionAddress => (this.uri == x.uri)
|
||||
case _ => false
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.DebugSessionAddress".##) + uri.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"DebugSessionAddress(" + uri + ")"
|
||||
}
|
||||
private[this] def copy(uri: java.net.URI = uri): DebugSessionAddress = {
|
||||
new DebugSessionAddress(uri)
|
||||
}
|
||||
def withUri(uri: java.net.URI): DebugSessionAddress = {
|
||||
copy(uri = uri)
|
||||
}
|
||||
}
|
||||
object DebugSessionAddress {
|
||||
|
||||
def apply(uri: java.net.URI): DebugSessionAddress = new DebugSessionAddress(uri)
|
||||
}
|
||||
52
protocol/src/main/contraband-scala/sbt/internal/bsp/DebugSessionParams.scala
generated
Normal file
52
protocol/src/main/contraband-scala/sbt/internal/bsp/DebugSessionParams.scala
generated
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* @param targets A sequence of build targets affected by the debugging action.
|
||||
* @param dataKind The kind of data to expect in the `data` field.
|
||||
* @param data A language-agnostic JSON object interpreted by the server.
|
||||
*/
|
||||
final class DebugSessionParams private (
|
||||
val targets: Vector[sbt.internal.bsp.BuildTargetIdentifier],
|
||||
val dataKind: Option[String],
|
||||
val data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: DebugSessionParams => (this.targets == x.targets) && (this.dataKind == x.dataKind) && (this.data == x.data)
|
||||
case _ => false
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.DebugSessionParams".##) + targets.##) + dataKind.##) + data.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"DebugSessionParams(" + targets + ", " + dataKind + ", " + data + ")"
|
||||
}
|
||||
private[this] def copy(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier] = targets, dataKind: Option[String] = dataKind, data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue] = data): DebugSessionParams = {
|
||||
new DebugSessionParams(targets, dataKind, data)
|
||||
}
|
||||
def withTargets(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): DebugSessionParams = {
|
||||
copy(targets = targets)
|
||||
}
|
||||
def withDataKind(dataKind: Option[String]): DebugSessionParams = {
|
||||
copy(dataKind = dataKind)
|
||||
}
|
||||
def withDataKind(dataKind: String): DebugSessionParams = {
|
||||
copy(dataKind = Option(dataKind))
|
||||
}
|
||||
def withData(data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]): DebugSessionParams = {
|
||||
copy(data = data)
|
||||
}
|
||||
def withData(data: sjsonnew.shaded.scalajson.ast.unsafe.JValue): DebugSessionParams = {
|
||||
copy(data = Option(data))
|
||||
}
|
||||
}
|
||||
object DebugSessionParams {
|
||||
|
||||
def apply(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier], dataKind: Option[String], data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]): DebugSessionParams = new DebugSessionParams(targets, dataKind, data)
|
||||
def apply(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier], dataKind: String, data: sjsonnew.shaded.scalajson.ast.unsafe.JValue): DebugSessionParams = new DebugSessionParams(targets, Option(dataKind), Option(data))
|
||||
}
|
||||
|
|
@ -12,10 +12,10 @@ final class DependencySourcesItem private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: DependencySourcesItem => (this.target == x.target) && (this.sources == x.sources)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.DependencySourcesItem".##) + target.##) + sources.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ final class DependencySourcesParams private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: DependencySourcesParams => (this.targets == x.targets)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.DependencySourcesParams".##) + targets.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ final class DependencySourcesResult private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: DependencySourcesResult => (this.items == x.items)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.DependencySourcesResult".##) + items.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ final class Diagnostic private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: Diagnostic => (this.range == x.range) && (this.severity == x.severity) && (this.code == x.code) && (this.source == x.source) && (this.message == x.message)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.Diagnostic".##) + range.##) + severity.##) + code.##) + source.##) + message.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ final class InitializeBuildParams private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: InitializeBuildParams => (this.displayName == x.displayName) && (this.version == x.version) && (this.bspVersion == x.bspVersion) && (this.rootUri == x.rootUri) && (this.capabilities == x.capabilities) && (this.data == x.data)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.InitializeBuildParams".##) + displayName.##) + version.##) + bspVersion.##) + rootUri.##) + capabilities.##) + data.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ final class InitializeBuildResult private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: InitializeBuildResult => (this.displayName == x.displayName) && (this.version == x.version) && (this.bspVersion == x.bspVersion) && (this.capabilities == x.capabilities) && (this.data == x.data)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.InitializeBuildResult".##) + displayName.##) + version.##) + bspVersion.##) + capabilities.##) + data.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ final class MetalsMetadata private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: MetalsMetadata => (this.semanticdbVersion == x.semanticdbVersion) && (this.supportedScalaVersions == x.supportedScalaVersions)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.MetalsMetadata".##) + semanticdbVersion.##) + supportedScalaVersions.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ final class Position private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: Position => (this.line == x.line) && (this.character == x.character)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.Position".##) + line.##) + character.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ final class PublishDiagnosticsParams private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: PublishDiagnosticsParams => (this.textDocument == x.textDocument) && (this.buildTarget == x.buildTarget) && (this.originId == x.originId) && (this.diagnostics == x.diagnostics) && (this.reset == x.reset)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.PublishDiagnosticsParams".##) + textDocument.##) + buildTarget.##) + originId.##) + diagnostics.##) + reset.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ final class Range private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: Range => (this.start == x.start) && (this.end == x.end)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.Range".##) + start.##) + end.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ final class RunParams private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: RunParams => (this.target == x.target) && (this.originId == x.originId) && (this.arguments == x.arguments) && (this.dataKind == x.dataKind) && (this.data == x.data)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.RunParams".##) + target.##) + originId.##) + arguments.##) + dataKind.##) + data.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ final class RunProvider private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: RunProvider => (this.languageIds == x.languageIds)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.RunProvider".##) + languageIds.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ final class RunResult private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: RunResult => (this.originId == x.originId) && (this.statusCode == x.statusCode)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.RunResult".##) + originId.##) + statusCode.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ final class SbtBuildTarget private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: SbtBuildTarget => (this.sbtVersion == x.sbtVersion) && (this.autoImports == x.autoImports) && (this.scalaBuildTarget == x.scalaBuildTarget) && (this.parent == x.parent) && (this.children == x.children)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.SbtBuildTarget".##) + sbtVersion.##) + autoImports.##) + scalaBuildTarget.##) + parent.##) + children.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ final class ScalaBuildTarget private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: ScalaBuildTarget => (this.scalaOrganization == x.scalaOrganization) && (this.scalaVersion == x.scalaVersion) && (this.scalaBinaryVersion == x.scalaBinaryVersion) && (this.platform == x.platform) && (this.jars == x.jars)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.ScalaBuildTarget".##) + scalaOrganization.##) + scalaVersion.##) + scalaBinaryVersion.##) + platform.##) + jars.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ final class ScalaMainClass private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: ScalaMainClass => (this.`class` == x.`class`) && (this.arguments == x.arguments) && (this.jvmOptions == x.jvmOptions)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.ScalaMainClass".##) + `class`.##) + arguments.##) + jvmOptions.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ final class ScalaMainClassesItem private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: ScalaMainClassesItem => (this.target == x.target) && (this.classes == x.classes)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.ScalaMainClassesItem".##) + target.##) + classes.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ final class ScalaMainClassesParams private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: ScalaMainClassesParams => (this.targets == x.targets) && (this.originId == x.originId)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.ScalaMainClassesParams".##) + targets.##) + originId.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ final class ScalaMainClassesResult private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: ScalaMainClassesResult => (this.items == x.items) && (this.originId == x.originId)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.ScalaMainClassesResult".##) + items.##) + originId.##)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ final class ScalaTestClassesItem private (
|
|||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: ScalaTestClassesItem => (this.target == x.target) && (this.classes == x.classes)
|
||||
case _ => false
|
||||
}
|
||||
})
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.ScalaTestClassesItem".##) + target.##) + classes.##)
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue