mirror of https://github.com/sbt/sbt.git
remove unnecessary `case`
- 3ca3633505/rules/src/main/scala/fix/RemoveParameterUntuplingCase.scala
- https://docs.scala-lang.org/scala3/reference/other-new-features/parameter-untupling.html
- https://docs.scala-lang.org/scala3/reference/other-new-features/parameter-untupling-spec.html
This commit is contained in:
parent
b3ca3a415a
commit
5d660ab8b5
|
|
@ -158,7 +158,7 @@ private[sbt] object EvaluateConfigurations {
|
|||
(imp, DefinedSbtValues(definitions))
|
||||
}
|
||||
val allImports = importDefs.map(s => (s, -1)) ++ parsed.imports
|
||||
val dslEntries = parsed.settings map { case (dslExpression, range) =>
|
||||
val dslEntries = parsed.settings map { (dslExpression, range) =>
|
||||
evaluateDslEntry(eval, name, allImports, dslExpression, range)
|
||||
}
|
||||
|
||||
|
|
@ -195,10 +195,10 @@ private[sbt] object EvaluateConfigurations {
|
|||
p.copy(base = IO.resolve(f, p.base))
|
||||
|
||||
def addOffset(offset: Int, lines: Seq[(String, Int)]): Seq[(String, Int)] =
|
||||
lines.map { case (s, i) => (s, i + offset) }
|
||||
lines.map { (s, i) => (s, i + offset) }
|
||||
|
||||
def addOffsetToRange(offset: Int, ranges: Seq[(String, LineRange)]): Seq[(String, LineRange)] =
|
||||
ranges.map { case (s, r) => (s, r.shift(offset)) }
|
||||
ranges.map { (s, r) => (s, r.shift(offset)) }
|
||||
|
||||
/**
|
||||
* The name of the class we cast DSL "setting" (vs. definition) lines to.
|
||||
|
|
@ -317,7 +317,7 @@ private[sbt] object EvaluateConfigurations {
|
|||
definitions: Seq[(String, LineRange)],
|
||||
file: Option[VirtualFileRef],
|
||||
): EvalDefinitions = {
|
||||
val convertedRanges = definitions.map { case (s, r) => (s, r.start to r.end) }
|
||||
val convertedRanges = definitions.map { (s, r) => (s, r.start to r.end) }
|
||||
eval.evalDefinitions(
|
||||
convertedRanges,
|
||||
new EvalImports(imports.map(_._1)), // name
|
||||
|
|
@ -367,7 +367,7 @@ object Index {
|
|||
if duplicates.isEmpty then multiMap.collect { case (k, v) if validID(k) => (k, v.head) }.toMap
|
||||
else
|
||||
val duplicateStr = duplicates
|
||||
.map { case (k, tps) => s"'$k' (${tps.mkString(", ")})" }
|
||||
.map { (k, tps) => s"'$k' (${tps.mkString(", ")})" }
|
||||
.mkString(",")
|
||||
sys.error(s"Some keys were defined with the same name but different types: $duplicateStr")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ private[sbt] object SbtRefactorings:
|
|||
private def toTreeStringMap(command: Seq[String]) = {
|
||||
val split = SbtParser(FAKE_FILE, command)
|
||||
val trees = split.settingsTrees
|
||||
val seq = trees.map { case (statement, tree) =>
|
||||
val seq = trees.map { (statement, tree) =>
|
||||
(extractSettingName(tree), statement)
|
||||
}
|
||||
seq.toMap
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ abstract class CheckIfParsedSpec(
|
|||
) extends AbstractSpec {
|
||||
|
||||
test(s"${this.getClass.getName} should parse sbt file") {
|
||||
files foreach { case (content, description, nonEmptyImports, nonEmptyStatements) =>
|
||||
files foreach { (content, description, nonEmptyImports, nonEmptyStatements) =>
|
||||
println(s"""${getClass.getSimpleName}: "$description" """)
|
||||
val (imports, statements) = splitter(content)
|
||||
assert(
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ abstract class AbstractSessionSettingsSpec(folder: String) extends AbstractSpec
|
|||
allFiles.foreach { file =>
|
||||
val originalLines = readLines(file)
|
||||
val virtualFile = converter.toVirtualFile(file)
|
||||
expectedResultAndMap(file).foreach { case (expectedResultList, commands) =>
|
||||
expectedResultAndMap(file).foreach { (expectedResultList, commands) =>
|
||||
val resultList = SbtRefactorings.applySessionSettings(originalLines, commands)
|
||||
val expected = SbtParser(virtualFile, expectedResultList)
|
||||
val result = SbtParser(virtualFile, resultList)
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ trait ContextUtil[C <: Quotes & scala.Singleton](val valStart: Int):
|
|||
override def cacheInputTupleTypeRepr: TypeRepr =
|
||||
tupleTypeRepr(inputs.withFilter(_.isCacheInput).map(_.tpe))
|
||||
override def cacheInputExpr(tupleTerm: Term): Expr[Tuple] =
|
||||
exprOfTupleFromSeq(inputs.zipWithIndex.flatMap { case (input, idx) =>
|
||||
exprOfTupleFromSeq(inputs.zipWithIndex.flatMap { (input, idx) =>
|
||||
if input.tags.nonEmpty then
|
||||
input.tpe.asType match
|
||||
case '[a] =>
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ final class History private (val lines: IndexedSeq[String], val path: Option[Fil
|
|||
lines.toList
|
||||
.drop(scala.math.max(0, lines.size - historySize))
|
||||
.zipWithIndex
|
||||
.map { case (line, number) => " " + number + " " + line }
|
||||
.map { (line, number) => " " + number + " " + line }
|
||||
.takeRight(show max 1)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ object HistoryCommands {
|
|||
|
||||
def helpString =
|
||||
"History commands:\n " + (descriptions
|
||||
.map { case (c, d) => c + " " + d })
|
||||
.map { (c, d) => c + " " + d })
|
||||
.mkString("\n ")
|
||||
|
||||
def printHelp(): Unit = println(helpString)
|
||||
|
|
@ -62,11 +62,11 @@ object HistoryCommands {
|
|||
{ printHistory(h, MaxLines, show); nil[String].some }
|
||||
}
|
||||
|
||||
lazy val execStr = flag('?') ~ token(any.+.string, "<string>") map { case (contains, str) =>
|
||||
lazy val execStr = flag('?') ~ token(any.+.string, "<string>") map { (contains, str) =>
|
||||
execute(h => if (contains) h !? str else h ! str)
|
||||
}
|
||||
|
||||
lazy val execInt = flag('-') ~ num map { case (neg, value) =>
|
||||
lazy val execInt = flag('-') ~ num map { (neg, value) =>
|
||||
execute(h => if (neg) h !- value else h ! value)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ trait Parsers {
|
|||
(open ~ (notDelim ~ close).?).flatMap {
|
||||
case (l, Some((content, r))) => Parser.success(s"$l$content$r")
|
||||
case (l, None) =>
|
||||
((notDelim ~ impl()).map { case (leftPrefix, nestedBraces) =>
|
||||
((notDelim ~ impl()).map { (leftPrefix, nestedBraces) =>
|
||||
leftPrefix + nestedBraces
|
||||
}.+ ~ notDelim ~ close).map { case ((nested, suffix), r) =>
|
||||
s"$l${nested.mkString}$suffix$r"
|
||||
|
|
@ -314,10 +314,10 @@ trait Parsers {
|
|||
* Parses an unquoted, non-empty String value that cannot start with a double quote and cannot
|
||||
* contain whitespace.
|
||||
*/
|
||||
lazy val NotQuoted = (NotDQuoteSpaceClass ~ OptNotSpace) map { case (c, s) => c.toString + s }
|
||||
lazy val NotQuoted = (NotDQuoteSpaceClass ~ OptNotSpace) map { (c, s) => c.toString + s }
|
||||
|
||||
/** Parses a non-empty String value that cannot start with a double quote, but includes double quotes. */
|
||||
lazy val NotQuotedThenQuoted = (NotQuoted ~ StringEscapable) map { case (s1, s2) =>
|
||||
lazy val NotQuotedThenQuoted = (NotQuoted ~ StringEscapable) map { (s1, s2) =>
|
||||
s"""$s1\"$s2\""""
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ private[sbt] object SizeParser {
|
|||
((numberParser <~ SpaceClass
|
||||
.examples(" ", "b", "B", "g", "G", "k", "K", "m", "M")
|
||||
.*) ~ unitParser.?)
|
||||
.map { case (number, unit) =>
|
||||
.map { (number, unit) =>
|
||||
unit match {
|
||||
case None | Some(SizeUnit.Bytes) => multiply(number, right = 1L)
|
||||
case Some(SizeUnit.KiloBytes) => multiply(number, right = 1024L)
|
||||
|
|
|
|||
|
|
@ -39,14 +39,14 @@ object LoggerContext {
|
|||
private val consoleAppenders: AtomicReference[Vector[(Appender, Level.Value)]] =
|
||||
new AtomicReference(Vector.empty)
|
||||
def log(level: Level.Value, message: => String): Unit = {
|
||||
val toAppend = consoleAppenders.get.filter { case (a, l) => level.compare(l) >= 0 }
|
||||
val toAppend = consoleAppenders.get.filter { (a, l) => level.compare(l) >= 0 }
|
||||
if (toAppend.nonEmpty) {
|
||||
val m = message
|
||||
toAppend.foreach { case (a, l) => a.appendLog(level, m) }
|
||||
toAppend.foreach { (a, l) => a.appendLog(level, m) }
|
||||
}
|
||||
}
|
||||
def log[T](level: Level.Value, message: ObjectEvent[T]): Unit = {
|
||||
consoleAppenders.get.foreach { case (a, l) =>
|
||||
consoleAppenders.get.foreach { (a, l) =>
|
||||
if (level.compare(l) >= 0) a.appendObjectEvent(level, message)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ object Relation {
|
|||
val reverse = reversePairs.foldLeft(Map.empty[B, Set[A]]) { case (m, (b, a)) =>
|
||||
add(m, b, a :: Nil)
|
||||
}
|
||||
make(forward filter { case (a, bs) => bs.nonEmpty }, reverse)
|
||||
make(forward filter { (a, bs) => bs.nonEmpty }, reverse)
|
||||
}
|
||||
|
||||
def merge[A, B](rels: Iterable[Relation[A, B]]): Relation[A, B] =
|
||||
|
|
@ -58,10 +58,10 @@ object Relation {
|
|||
|
||||
/** when both parameters taken by relation are the same type, switch calls a function on them. */
|
||||
private[sbt] def switch[X, Y](relation: Relation[X, X], f: X => Y): Relation[Y, Y] = {
|
||||
val forward = relation.forwardMap.map { case (first, second) =>
|
||||
val forward = relation.forwardMap.map { (first, second) =>
|
||||
f(first) -> second.map(f)
|
||||
}
|
||||
val reverse = relation.reverseMap.map { case (first, second) =>
|
||||
val reverse = relation.reverseMap.map { (first, second) =>
|
||||
f(first) -> second.map(f)
|
||||
}
|
||||
make(forward, reverse)
|
||||
|
|
@ -170,7 +170,7 @@ private final class MRelation[A, B](fwd: Map[A, Set[B]], rev: Map[B, Set[A]])
|
|||
def size = (fwd.valuesIterator map (_.size)).sum
|
||||
|
||||
def all: Iterable[(A, B)] =
|
||||
fwd.iterator.flatMap { case (a, bs) => bs.iterator.map(b => (a, b)) }.to(Iterable)
|
||||
fwd.iterator.flatMap { (a, bs) => bs.iterator.map(b => (a, b)) }.to(Iterable)
|
||||
|
||||
def +(pair: (A, B)) = this + (pair._1, Set(pair._2))
|
||||
def +(from: A, to: B) = this + (from, to :: Nil)
|
||||
|
|
@ -221,5 +221,5 @@ private final class MRelation[A, B](fwd: Map[A, Set[B]], rev: Map[B, Set[A]])
|
|||
override def hashCode = fwd.filterNot(_._2.isEmpty).hashCode()
|
||||
|
||||
override def toString =
|
||||
all.map { case (a, b) => s"$a -> $b" }.mkString("Relation [", ", ", "]")
|
||||
all.map { (a, b) => s"$a -> $b" }.mkString("Relation [", ", ", "]")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ object RelationTest extends Properties("Relation") {
|
|||
|
||||
r._1s == _1s && r.forwardMap.keySet == _1s &&
|
||||
r._2s == _2s && r.reverseMap.keySet == _2s &&
|
||||
pairs.forall { case (a, b) =>
|
||||
pairs.forall { (a, b) =>
|
||||
(r.forward(a) contains b) &&
|
||||
(r.reverse(b) contains a) &&
|
||||
(r.forwardMap(a) contains b) &&
|
||||
|
|
@ -31,7 +31,7 @@ object RelationTest extends Properties("Relation") {
|
|||
}
|
||||
|
||||
property("Does not contain removed entries") = forAll { (pairs: List[(Int, Double, Boolean)]) =>
|
||||
val add = pairs.map { case (a, b, c) => (a, b) }
|
||||
val add = pairs.map { (a, b, c) => (a, b) }
|
||||
val added = Relation.empty[Int, Double] ++ add
|
||||
|
||||
val removeFine = pairs.collect { case (a, b, true) => (a, b) }
|
||||
|
|
@ -46,7 +46,7 @@ object RelationTest extends Properties("Relation") {
|
|||
("Forward map does not contain removed" |: !r.forwardMap.contains(rem)) &&
|
||||
("Removed is not a value in reverse map" |: !r.reverseMap.values.toSet.contains(rem))
|
||||
} &&
|
||||
all(removeFine) { case (a, b) =>
|
||||
all(removeFine) { (a, b) =>
|
||||
("Forward does not contain removed" |: (!r.forward(a).contains(b))) &&
|
||||
("Reverse does not contain removed" |: (!r.reverse(b).contains(a))) &&
|
||||
("Forward map does not contain removed" |: (notIn(r.forwardMap, a, b))) &&
|
||||
|
|
@ -58,7 +58,7 @@ object RelationTest extends Properties("Relation") {
|
|||
val splitInto = math.abs(randomInt) % 10 + 1 // Split into 1-10 groups.
|
||||
val rel = Relation.empty[Int, Double] ++ entries
|
||||
val grouped = rel.groupBy(_._1 % splitInto)
|
||||
all(grouped.toSeq) { case (k, rel_k) =>
|
||||
all(grouped.toSeq) { (k, rel_k) =>
|
||||
rel_k._1s forall { _ % splitInto == k }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class FileCommands(baseDirectory: File) extends BasicStatementHandler {
|
|||
case Nil => sys.error("unexpected Nil")
|
||||
case g :: Nil => g
|
||||
case g :: gs =>
|
||||
gs.foldLeft(g) { case (acc, g) =>
|
||||
gs.foldLeft(g) { (acc, g) =>
|
||||
acc || g
|
||||
}
|
||||
List(combined)
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ class DependencyResolution private[sbt] (lmEngine: DependencyResolutionInterface
|
|||
restrictedCopy(m, true)
|
||||
}
|
||||
// Adding list of explicit artifacts here.
|
||||
val exls = Map(config.excludes map { case (k, v) => (k, v.toSet) }*)
|
||||
val exls = Map(config.excludes map { (k, v) => (k, v.toSet) }*)
|
||||
val deps = baseModules.distinct flatMap classifiedArtifacts(classifiers, exls, artifacts)
|
||||
val base = restrictedCopy(id, true).withName(id.name + classifiers.mkString("$", "_", ""))
|
||||
val moduleSetting = ModuleDescriptorConfiguration(base, ModuleInfo(base.name))
|
||||
|
|
@ -187,7 +187,7 @@ class DependencyResolution private[sbt] (lmEngine: DependencyResolutionInterface
|
|||
((config.sourceArtifactTypes.toSeq map (_ -> Artifact.SourceClassifier))
|
||||
:: (config.docArtifactTypes.toSeq map (_ -> Artifact.DocClassifier)) :: Nil).flatten.toMap
|
||||
Right(r.substitute { (conf, mid, artFileSeq) =>
|
||||
artFileSeq map { case (art, f) =>
|
||||
artFileSeq map { (art, f) =>
|
||||
// Deduce the classifier from the type if no classifier is present already
|
||||
art.withClassifier(art.classifier orElse typeClassifierMap.get(art.`type`)) -> f
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ final class EvictionError private[sbt] (
|
|||
val out: mutable.ListBuffer[String] = mutable.ListBuffer()
|
||||
out += "found version conflict(s) in library dependencies; some are suspected to be binary incompatible:"
|
||||
out += ""
|
||||
evictions.foreach({ case (a, scheme) =>
|
||||
evictions.foreach({ (a, scheme) =>
|
||||
val seen: mutable.Set[ModuleID] = mutable.Set()
|
||||
val callers: List[String] = (a.evicteds.toList ::: a.winner.toList) flatMap { r =>
|
||||
val rev = r.module.revision
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ private[librarymanagement] abstract class ModuleIDExtra {
|
|||
|
||||
/** String representation of the extra attributes, excluding any information only attributes. */
|
||||
def extraString: String =
|
||||
extraDependencyAttributes.map { case (k, v) => k + "=" + v }.mkString("(", ", ", ")")
|
||||
extraDependencyAttributes.map { (k, v) => k + "=" + v }.mkString("(", ", ", ")")
|
||||
|
||||
/** Returns the extra attributes except for ones marked as information only (ones that typically would not be used for dependency resolution). */
|
||||
def extraDependencyAttributes: Map[String, String] =
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ object UnresolvedWarning {
|
|||
if (path.nonEmpty) {
|
||||
val head = path.head
|
||||
buffer += "\t\t" + head._1.toString + sourcePosStr(head._2)
|
||||
path.tail foreach { case (m, pos) =>
|
||||
path.tail foreach { (m, pos) =>
|
||||
buffer += "\t\t +- " + m.toString + sourcePosStr(pos)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ private[librarymanagement] abstract class ModuleReportExtra {
|
|||
}
|
||||
|
||||
def retrieve(f: (ModuleID, Artifact, File) => File): ModuleReport =
|
||||
withArtifacts(artifacts.map { case (art, file) => (art, f(module, art, file)) })
|
||||
withArtifacts(artifacts.map { (art, file) => (art, f(module, art, file)) })
|
||||
}
|
||||
|
||||
private[librarymanagement] abstract class UpdateReportExtra {
|
||||
|
|
|
|||
|
|
@ -220,13 +220,13 @@ class CoursierDependencyResolution(
|
|||
// (e.g. sbt-dotty 0.13.0-RC1)
|
||||
FromSbt.dependencies(d, sv, sbv, optionalCrossVer = true)
|
||||
}
|
||||
.map { case (config, dep) =>
|
||||
.map { (config, dep) =>
|
||||
(ToCoursier.configuration(config), ToCoursier.dependency(dep))
|
||||
}
|
||||
|
||||
val orderedConfigs = Inputs
|
||||
.orderedConfigurations(Inputs.configExtendsSeq(module0.configurations))
|
||||
.map { case (config, extends0) =>
|
||||
.map { (config, extends0) =>
|
||||
(ToCoursier.configuration(config), extends0.map(ToCoursier.configuration))
|
||||
}
|
||||
|
||||
|
|
@ -241,7 +241,7 @@ class CoursierDependencyResolution(
|
|||
.withCredentials(conf.credentials.map(ToCoursier.credentials))
|
||||
.withFollowHttpToHttpsRedirections(conf.followHttpToHttpsRedirections.getOrElse(true))
|
||||
|
||||
val excludeDependencies = conf.excludeDependencies.map { case (strOrg, strName) =>
|
||||
val excludeDependencies = conf.excludeDependencies.map { (strOrg, strName) =>
|
||||
(coursier.Organization(strOrg), coursier.ModuleName(strName))
|
||||
}.toSet
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ class CoursierDependencyResolution(
|
|||
.ResolutionParams()
|
||||
.withMaxIterations(conf.maxIterations)
|
||||
.withProfiles(conf.mavenProfiles.toSet)
|
||||
.withForceVersion(conf.forceVersions.map { case (k, v) => (ToCoursier.module(k), v) }.toMap)
|
||||
.withForceVersion(conf.forceVersions.map { (k, v) => (ToCoursier.module(k), v) }.toMap)
|
||||
.withTypelevel(typelevel)
|
||||
.withReconciliation(ToCoursier.reconciliation(conf.reconciliation))
|
||||
.withExclusions(excludeDependencies)
|
||||
|
|
@ -293,7 +293,7 @@ class CoursierDependencyResolution(
|
|||
conf.sbtScalaJars
|
||||
)
|
||||
|
||||
val configs = Inputs.coursierConfigurationsMap(module0.configurations).map { case (k, l) =>
|
||||
val configs = Inputs.coursierConfigurationsMap(module0.configurations).map { (k, l) =>
|
||||
ToCoursier.configuration(k) -> l.map(ToCoursier.configuration)
|
||||
}
|
||||
|
||||
|
|
@ -304,11 +304,11 @@ class CoursierDependencyResolution(
|
|||
UpdateParams(
|
||||
thisModule = (ToCoursier.module(mod), ver),
|
||||
artifacts = artifacts.collect { case (d, p, a, Some(f)) => a -> f }.toMap,
|
||||
fullArtifacts = Some(artifacts.map { case (d, p, a, f) => (d, p, a) -> f }.toMap),
|
||||
fullArtifacts = Some(artifacts.map { (d, p, a, f) => (d, p, a) -> f }.toMap),
|
||||
classifiers = classifiers,
|
||||
configs = configs,
|
||||
dependencies = dependencies,
|
||||
forceVersions = conf.forceVersions.map { case (m, v) => (ToCoursier.module(m), v) }.toMap,
|
||||
forceVersions = conf.forceVersions.map { (m, v) => (ToCoursier.module(m), v) }.toMap,
|
||||
interProjectDependencies = interProjectDependencies,
|
||||
res = resolutions,
|
||||
includeSignatures = false,
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ object FromSbt {
|
|||
|
||||
private def attributes(attr: Map[String, String]): Map[String, String] =
|
||||
attr
|
||||
.map { case (k, v) =>
|
||||
.map { (k, v) =>
|
||||
k.stripPrefix("e:") -> v
|
||||
}
|
||||
.filter { case (k, _) =>
|
||||
|
|
@ -131,7 +131,7 @@ object FromSbt {
|
|||
)
|
||||
|
||||
val mapping = module.configurations.getOrElse("compile")
|
||||
val allMappings = ivyXmlMappings(mapping).map { case (from, to) =>
|
||||
val allMappings = ivyXmlMappings(mapping).map { (from, to) =>
|
||||
(Configuration(from.value), Configuration(to.value))
|
||||
}
|
||||
|
||||
|
|
@ -191,7 +191,7 @@ object FromSbt {
|
|||
val properties = projectID.extraAttributes.view
|
||||
.filterKeys(_.startsWith(prefix))
|
||||
.toSeq
|
||||
.map { case (k, v) => (k.stripPrefix("e:"), v) }
|
||||
.map { (k, v) => (k.stripPrefix("e:"), v) }
|
||||
.sortBy(_._1)
|
||||
|
||||
Project(
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import scala.collection.mutable
|
|||
object Inputs {
|
||||
|
||||
def ivyXmlMappings(mapping: String): Seq[(Configuration, Configuration)] =
|
||||
initialIvyXmlMappings(mapping).map { case (from, to) =>
|
||||
initialIvyXmlMappings(mapping).map { (from, to) =>
|
||||
Configuration(from.value) -> Configuration(to.value)
|
||||
}
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ object Inputs {
|
|||
}
|
||||
|
||||
val sets =
|
||||
new mutable.HashMap[Configuration, Wrapper] ++= configurations.map { case (k, l) =>
|
||||
new mutable.HashMap[Configuration, Wrapper] ++= configurations.map { (k, l) =>
|
||||
val s = new mutable.HashSet[Configuration]
|
||||
s ++= l
|
||||
s += k
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ object IvyXml {
|
|||
new PrefixedAttribute("e", k, v, acc)
|
||||
}
|
||||
|
||||
val licenseElems = project.info.licenses.map { case (name, urlOpt) =>
|
||||
val licenseElems = project.info.licenses.map { (name, urlOpt) =>
|
||||
val n = <license name={name} />
|
||||
|
||||
urlOpt.fold(n) { url =>
|
||||
|
|
@ -62,7 +62,7 @@ object IvyXml {
|
|||
</info>
|
||||
} % infoAttrs
|
||||
|
||||
val confElems = project.configurations.toVector.collect { case (name, extends0) =>
|
||||
val confElems = project.configurations.toVector.collect { (name, extends0) =>
|
||||
val n = <conf name={name.value} visibility="public" description="" />
|
||||
if (extends0.nonEmpty)
|
||||
n % <x extends={extends0.map(_.value).mkString(",")} />.attributes
|
||||
|
|
@ -73,7 +73,7 @@ object IvyXml {
|
|||
val publications = project.publications
|
||||
.groupMap((_, p) => p)((cfg, _) => cfg)
|
||||
|
||||
val publicationElems = publications.map { case (pub, configs) =>
|
||||
val publicationElems = publications.map { (pub, configs) =>
|
||||
val n = <artifact name={pub.name} type={pub.`type`.value} ext={pub.ext.value} conf={
|
||||
configs.map(_.value).mkString(",")
|
||||
} />
|
||||
|
|
@ -84,8 +84,8 @@ object IvyXml {
|
|||
n
|
||||
}
|
||||
|
||||
val dependencyElems = project.dependencies.toVector.map { case (conf, dep) =>
|
||||
val excludes = dep.exclusions.toSeq.map { case (org, name) =>
|
||||
val dependencyElems = project.dependencies.toVector.map { (conf, dep) =>
|
||||
val excludes = dep.exclusions.toSeq.map { (org, name) =>
|
||||
<exclude org={org.value} module={
|
||||
name.value
|
||||
} name="*" type="*" ext="*" conf="" matcher="exact"/>
|
||||
|
|
@ -105,11 +105,11 @@ object IvyXml {
|
|||
n % moduleAttrs
|
||||
}
|
||||
|
||||
val excludeElems = exclusions.toVector.map { case (org, name) =>
|
||||
val excludeElems = exclusions.toVector.map { (org, name) =>
|
||||
<exclude org={org} module={name} artifact="*" type="*" ext="*" matcher="exact"/>
|
||||
}
|
||||
|
||||
val overrideElems = overrides.toVector.map { case (org, name, ver) =>
|
||||
val overrideElems = overrides.toVector.map { (org, name, ver) =>
|
||||
<override org={org} module={name} rev={ver} matcher="exact"/>
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ object ToCoursier {
|
|||
def reconciliation(
|
||||
rs: Vector[(ModuleMatchers, Reconciliation)]
|
||||
): Vector[(coursier.util.ModuleMatchers, coursier.core.Reconciliation)] =
|
||||
rs map { case (m, r) => (moduleMatchers(m), reconciliation(r)) }
|
||||
rs map { (m, r) => (moduleMatchers(m), reconciliation(r)) }
|
||||
|
||||
def sameVersions(
|
||||
sv: Seq[Set[InclExclRule]]
|
||||
|
|
@ -79,7 +79,7 @@ object ToCoursier {
|
|||
module(dependency.module),
|
||||
dependency.version,
|
||||
configuration(dependency.configuration),
|
||||
dependency.exclusions.map { case (org, name) =>
|
||||
dependency.exclusions.map { (org, name) =>
|
||||
(coursier.core.Organization(org.value), coursier.core.ModuleName(name.value))
|
||||
},
|
||||
publication(dependency.publication),
|
||||
|
|
@ -91,10 +91,10 @@ object ToCoursier {
|
|||
coursier.core.Project(
|
||||
module(project.module),
|
||||
project.version,
|
||||
project.dependencies.map { case (conf, dep) =>
|
||||
project.dependencies.map { (conf, dep) =>
|
||||
configuration(conf) -> dependency(dep)
|
||||
},
|
||||
project.configurations.map { case (k, l) =>
|
||||
project.configurations.map { (k, l) =>
|
||||
configuration(k) -> l.map(configuration)
|
||||
},
|
||||
None,
|
||||
|
|
@ -106,7 +106,7 @@ object ToCoursier {
|
|||
project.packagingOpt.map(t => coursier.core.Type(t.value)),
|
||||
relocated = false,
|
||||
None,
|
||||
project.publications.map { case (conf, pub) =>
|
||||
project.publications.map { (conf, pub) =>
|
||||
configuration(conf) -> publication(pub)
|
||||
},
|
||||
coursier.core.Info(
|
||||
|
|
@ -192,12 +192,12 @@ object ToCoursier {
|
|||
def strict(strict: Strict): coursier.params.rule.Strict =
|
||||
coursier.params.rule
|
||||
.Strict()
|
||||
.withInclude(strict.include.map { case (o, n) =>
|
||||
.withInclude(strict.include.map { (o, n) =>
|
||||
coursier.util.ModuleMatcher(
|
||||
coursier.Module(coursier.Organization(o), coursier.ModuleName(n))
|
||||
)
|
||||
})
|
||||
.withExclude(strict.exclude.map { case (o, n) =>
|
||||
.withExclude(strict.exclude.map { (o, n) =>
|
||||
coursier.util.ModuleMatcher(
|
||||
coursier.Module(coursier.Organization(o), coursier.ModuleName(n))
|
||||
)
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ object ArtifactsRun {
|
|||
}
|
||||
.addTransformArtifacts { artifacts =>
|
||||
if (params.missingOk)
|
||||
artifacts.map { case (dependency, publication, artifact) =>
|
||||
artifacts.map { (dependency, publication, artifact) =>
|
||||
(dependency, publication, artifact.withOptional(true))
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ object ResolutionRun {
|
|||
|
||||
def depsRepr(deps: Seq[(Configuration, Dependency)]) =
|
||||
deps
|
||||
.map { case (config, dep) =>
|
||||
.map { (config, dep) =>
|
||||
s"${dep.module}:${dep.version}:${config.value}->${dep.configuration.value}"
|
||||
}
|
||||
.sorted
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ private[internal] object SbtUpdateReport {
|
|||
project.properties.filter(_._1.startsWith("info."))
|
||||
|
||||
private val moduleId = caching[(Dependency, String, Map[String, String]), ModuleID] {
|
||||
case (dependency, version, extraProperties) =>
|
||||
(dependency, version, extraProperties) =>
|
||||
val mod = sbt.librarymanagement.ModuleID(
|
||||
dependency.module.organization.value,
|
||||
dependency.module.name.value,
|
||||
|
|
@ -48,7 +48,7 @@ private[internal] object SbtUpdateReport {
|
|||
.withExtraAttributes(dependency.module.attributes ++ extraProperties)
|
||||
.withExclusions(
|
||||
dependency.minimizedExclusions.toVector
|
||||
.map { case (org, name) =>
|
||||
.map { (org, name) =>
|
||||
sbt.librarymanagement
|
||||
.InclExclRule()
|
||||
.withOrganization(org.value)
|
||||
|
|
@ -61,7 +61,7 @@ private[internal] object SbtUpdateReport {
|
|||
private val artifact = caching[
|
||||
(Module, Map[String, String], Publication, Artifact, Seq[ClassLoader]),
|
||||
sbt.librarymanagement.Artifact
|
||||
] { case (module, extraProperties, pub, artifact, classLoaders) =>
|
||||
] { (module, extraProperties, pub, artifact, classLoaders) =>
|
||||
sbt.librarymanagement
|
||||
.Artifact(pub.name)
|
||||
.withType(pub.`type`.value)
|
||||
|
|
@ -85,7 +85,7 @@ private[internal] object SbtUpdateReport {
|
|||
Seq[ClassLoader]
|
||||
),
|
||||
ModuleReport
|
||||
] { case (dependency, dependees, project, artifacts, classLoaders) =>
|
||||
] { (dependency, dependees, project, artifacts, classLoaders) =>
|
||||
val sbtArtifacts = artifacts.collect { case (pub, artifact0, Some(file)) =>
|
||||
(
|
||||
artifact((dependency.module, infoProperties(project).toMap, pub, artifact0, classLoaders)),
|
||||
|
|
@ -100,7 +100,7 @@ private[internal] object SbtUpdateReport {
|
|||
new GregorianCalendar(dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second)
|
||||
}
|
||||
|
||||
val callers = dependees.distinct.map { case (dependee, dependeeProj) =>
|
||||
val callers = dependees.distinct.map { (dependee, dependeeProj) =>
|
||||
Caller(
|
||||
moduleId((dependee, dependeeProj.version, Map.empty)),
|
||||
// FIXME Shouldn't we only keep the configurations pulling dependency?
|
||||
|
|
@ -162,14 +162,14 @@ private[internal] object SbtUpdateReport {
|
|||
|
||||
val depArtifacts1 = fullArtifactsOpt match {
|
||||
case Some(map) =>
|
||||
deps.map { case (d, p, a) =>
|
||||
deps.map { (d, p, a) =>
|
||||
val d0 = d.withAttributes(d.attributes.withClassifier(p.classifier))
|
||||
val a0 = if (missingOk) a.withOptional(true) else a
|
||||
val f = map.get((d0, p, a0)).flatten
|
||||
(d, p, a0, f) // not d0
|
||||
}
|
||||
case None =>
|
||||
deps.map { case (d, p, a) =>
|
||||
deps.map { (d, p, a) =>
|
||||
(d, p, a, None)
|
||||
}
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ private[internal] object SbtUpdateReport {
|
|||
val notFound = depArtifacts0.filter(!_._3.extra.contains("sig"))
|
||||
|
||||
if (notFound.isEmpty)
|
||||
depArtifacts0.flatMap { case (dep, pub, a, f) =>
|
||||
depArtifacts0.flatMap { (dep, pub, a, f) =>
|
||||
val sigPub = pub
|
||||
// not too sure about those
|
||||
.withExt(Extension(pub.ext.value))
|
||||
|
|
@ -259,14 +259,14 @@ private[internal] object SbtUpdateReport {
|
|||
|
||||
val reverseDependencies = {
|
||||
val transitiveReverseDependencies = res.reverseDependencies.toVector
|
||||
.map { case (k, v) => clean(k) -> v.map(clean) }
|
||||
.map { (k, v) => clean(k) -> v.map(clean) }
|
||||
.groupMapReduce(_._1)((_, deps) => deps)(_ ++ _)
|
||||
|
||||
(transitiveReverseDependencies.toVector ++ directReverseDependencies.toVector)
|
||||
.groupMapReduce(_._1)((_, deps) => deps)(_ ++ _)
|
||||
}
|
||||
|
||||
groupedDepArtifacts.toVector.map { case (dep, artifacts) =>
|
||||
groupedDepArtifacts.toVector.map { (dep, artifacts) =>
|
||||
val proj = lookupProject(dep.moduleVersion).get
|
||||
val assembledProject = assemble(proj)
|
||||
|
||||
|
|
@ -292,7 +292,7 @@ private[internal] object SbtUpdateReport {
|
|||
Vector.empty
|
||||
}
|
||||
}
|
||||
val filesOpt = artifacts.map { case (pub, a, fileOpt) =>
|
||||
val filesOpt = artifacts.map { (pub, a, fileOpt) =>
|
||||
val fileOpt0 = fileOpt.orElse {
|
||||
if (fullArtifactsOpt.isEmpty)
|
||||
artifactFileOpt(proj.module, proj.version, pub.attributes, a)
|
||||
|
|
@ -328,7 +328,7 @@ private[internal] object SbtUpdateReport {
|
|||
classLoaders: Seq[ClassLoader],
|
||||
): UpdateReport = {
|
||||
|
||||
val configReports = resolutions.map { case (config, subRes) =>
|
||||
val configReports = resolutions.map { (config, subRes) =>
|
||||
val reports = moduleReports(
|
||||
thisModule,
|
||||
subRes,
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ final class TemporaryInMemoryRepository private (
|
|||
fallbacks
|
||||
.get(dependency.moduleVersion)
|
||||
.toSeq
|
||||
.map { case (url, changing) =>
|
||||
.map { (url, changing) =>
|
||||
val url0 = url.toString
|
||||
val ext = url0.substring(url0.lastIndexOf('.') + 1)
|
||||
val pub = Publication(
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@ object UpdateRun {
|
|||
configs: Map[Configuration, Set[Configuration]]
|
||||
): Map[Configuration, Set[Dependency]] = {
|
||||
|
||||
val allDepsByConfig = depsByConfig.map { case (config, deps) =>
|
||||
val allDepsByConfig = depsByConfig.map { (config, deps) =>
|
||||
config -> res(config).subset(deps).minDependencies
|
||||
}
|
||||
|
||||
val filteredAllDepsByConfig = allDepsByConfig.map { case (config, allDeps) =>
|
||||
val filteredAllDepsByConfig = allDepsByConfig.map { (config, allDeps) =>
|
||||
val allExtendedConfigs = configs.getOrElse(config, Set.empty) - config
|
||||
val inherited = allExtendedConfigs
|
||||
.flatMap(allDepsByConfig.getOrElse(_, Set.empty))
|
||||
|
|
@ -39,11 +39,11 @@ object UpdateRun {
|
|||
configs: Map[Configuration, Set[Configuration]]
|
||||
): Set[Dependency] =
|
||||
allDependenciesByConfig(res, depsByConfig, configs)
|
||||
.flatMap { case (config, deps) =>
|
||||
.flatMap { (config, deps) =>
|
||||
deps.map(dep => dep.withConfiguration(config --> dep.configuration))
|
||||
}
|
||||
.groupBy(_.withConfiguration(Configuration.empty))
|
||||
.map { case (dep, l) =>
|
||||
.map { (dep, l) =>
|
||||
dep.withConfiguration(Configuration.join(l.map(_.configuration).toSeq*))
|
||||
}
|
||||
.toSet
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ private[sbt] object ConvertResolver {
|
|||
(updateOptions.resolverConverter orElse defaultConvert)((r, settings, log))
|
||||
|
||||
/** The default implementation of converter. */
|
||||
lazy val defaultConvert: ResolverConverter = { case (r, settings, log) =>
|
||||
lazy val defaultConvert: ResolverConverter = { (r, settings, log) =>
|
||||
val managedChecksums = Option(settings.getVariable(ManagedChecksums)) match {
|
||||
case Some(x) => x.toBoolean
|
||||
case _ => false
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ object CustomPomParser {
|
|||
.toMap
|
||||
}
|
||||
private[sbt] def toUnqualify(propertyAttributes: Map[String, String]): Map[String, String] =
|
||||
(propertyAttributes - ExtraAttributesKey) map { case (k, v) => ("e:" + k, v) }
|
||||
(propertyAttributes - ExtraAttributesKey) map { (k, v) => ("e:" + k, v) }
|
||||
|
||||
private def shouldBeUnqualified(m: Map[String, String]): Map[String, String] =
|
||||
m.view.filterKeys(unqualifiedKeys).toMap
|
||||
|
|
|
|||
|
|
@ -808,7 +808,7 @@ private[sbt] object IvySbt {
|
|||
}
|
||||
private[sbt] def javaMap(m: Map[String, String], unqualify: Boolean = false) = {
|
||||
import scala.jdk.CollectionConverters.*
|
||||
val map = if (unqualify) m map { case (k, v) => (k.stripPrefix("e:"), v) }
|
||||
val map = if (unqualify) m map { (k, v) => (k.stripPrefix("e:"), v) }
|
||||
else m
|
||||
if (map.isEmpty) null else map.asJava
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ object IvyActions {
|
|||
val rawa = artifacts.keys.toVector
|
||||
val seqa = CrossVersion.substituteCross(rawa, cross)
|
||||
val zipped = rawa zip IvySbt.mapArtifacts(module, seqa)
|
||||
zipped map { case (a, ivyA) => (ivyA, artifacts(a)) }
|
||||
zipped map { (a, ivyA) => (ivyA, artifacts(a)) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -255,7 +255,7 @@ object IvyActions {
|
|||
art.classifier.map { c =>
|
||||
(restrictedCopy(mod, false), c)
|
||||
}
|
||||
} groupBy (_._1) map { case (mod, pairs) => (mod, pairs.map(_._2).toSet) }
|
||||
} groupBy (_._1) map { (mod, pairs) => (mod, pairs.map(_._2).toSet) }
|
||||
|
||||
/**
|
||||
* Represents the inputs to pass in to [[resolveAndRetrieve]] and [[cachedResolveAndRetrieve]].
|
||||
|
|
@ -497,7 +497,7 @@ object IvyActions {
|
|||
checkFilesPresent(artifacts)
|
||||
try {
|
||||
resolver.beginPublishTransaction(module.getModuleRevisionId(), overwrite);
|
||||
artifacts.foreach { case (artifact, file) =>
|
||||
artifacts.foreach { (artifact, file) =>
|
||||
IvyUtil.retryWithBackoff(
|
||||
resolver.publish(artifact, file, overwrite),
|
||||
TransientNetworkException.apply,
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
val (internal, external) = mds.partition { case (_, _, dd) =>
|
||||
cache.internalDependency(dd, projectResolver).isDefined
|
||||
}
|
||||
val internalResults = internal map { case (md, changing, dd) =>
|
||||
val internalResults = internal map { (md, changing, dd) =>
|
||||
cache.getOrElseUpdateMiniGraph(
|
||||
md,
|
||||
changing,
|
||||
|
|
@ -432,7 +432,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
doWork(md, dd)
|
||||
}
|
||||
}
|
||||
val externalResults = external map { case (md0, changing, dd) =>
|
||||
val externalResults = external map { (md0, changing, dd) =>
|
||||
val configurationsInInternal = internalResults flatMap {
|
||||
case Right(ur) =>
|
||||
ur.allModules.flatMap { case md =>
|
||||
|
|
@ -498,7 +498,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
val messages = errors flatMap { _.messages }
|
||||
val failed = errors flatMap { _.failed }
|
||||
val failedPaths = errors flatMap {
|
||||
_.failedPaths.toList map { case (failed, paths) =>
|
||||
_.failedPaths.toList map { (failed, paths) =>
|
||||
if (paths.isEmpty) (failed, paths)
|
||||
else
|
||||
(
|
||||
|
|
@ -584,7 +584,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
// this might take up some memory, but it's limited to a single
|
||||
val reports1 = reports0 flatMap { filterReports }
|
||||
val allModules0: Map[(String, String), Vector[OrganizationArtifactReport]] =
|
||||
Map(orgNamePairs map { case (organization, name) =>
|
||||
Map(orgNamePairs map { (organization, name) =>
|
||||
val xs = reports1 filter { oar =>
|
||||
oar.organization == organization && oar.name == name
|
||||
}
|
||||
|
|
@ -613,7 +613,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
if (!loopSets(loop.toSet)) {
|
||||
loopSets += loop.toSet
|
||||
loopLists += loop
|
||||
val loopStr = (loop map { case (o, n) => s"$o:$n" }).mkString("->")
|
||||
val loopStr = (loop map { (o, n) => s"$o:$n" }).mkString("->")
|
||||
log.warn(s"""avoid circular dependency while using cached resolution: $loopStr""")
|
||||
}
|
||||
} else testLoop(m, c, c :: history)
|
||||
|
|
@ -745,7 +745,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
}
|
||||
val guard0 = (orgNamePairs.size * orgNamePairs.size) + 1
|
||||
val sorted: Vector[(String, String)] = sortModules(orgNamePairs, Vector(), Vector(), 0, guard0)
|
||||
val sortedStr = (sorted map { case (o, n) => s"$o:$n" }).mkString(", ")
|
||||
val sortedStr = (sorted map { (o, n) => s"$o:$n" }).mkString(", ")
|
||||
log.debug(s":: sort result: $sortedStr")
|
||||
val result = resolveConflicts(sorted.toList, allModules0)
|
||||
result.toVector
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ private[sbt] case class SbtChainResolver(
|
|||
data: ResolveData
|
||||
): Option[ResolvedModuleRevision] = {
|
||||
|
||||
val sortedRevisions = foundRevisions.sortBy { case (rmr, resolver) =>
|
||||
val sortedRevisions = foundRevisions.sortBy { (rmr, resolver) =>
|
||||
val publicationDate = rmr.getPublicationDate
|
||||
val descriptorDate = rmr.getDescriptor.getPublicationDate
|
||||
Message.warn(s"Sorting results from $rmr, using $publicationDate and $descriptorDate.")
|
||||
|
|
@ -278,7 +278,7 @@ private[sbt] case class SbtChainResolver(
|
|||
}
|
||||
|
||||
/** Cleans unnecessary module id information not provided by [[IvyRetrieve.toModuleID()]]. */
|
||||
private final val moduleResolvers = updateOptions.moduleResolvers.map { case (key, value) =>
|
||||
private final val moduleResolvers = updateOptions.moduleResolvers.map { (key, value) =>
|
||||
val cleanKey = ModuleID(key.organization, key.name, key.revision)
|
||||
.withExtraAttributes(key.extraAttributes)
|
||||
.withBranchName(key.branchName)
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ object Credentials {
|
|||
private def read(from: File): Map[String, String] = {
|
||||
val properties = new java.util.Properties
|
||||
IO.load(properties, from)
|
||||
properties.asScala.map { case (k, v) => (k.toString, v.toString.trim) }.toMap
|
||||
properties.asScala.map { (k, v) => (k.toString, v.toString.trim) }.toMap
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ object Mapper:
|
|||
Option(baseDirectory.getParentFile)
|
||||
.map(parent => PathFinder(baseDirectory).allPaths pair relativeTo(parent))
|
||||
.getOrElse(PathFinder(baseDirectory).allPaths pair basic)
|
||||
.map { case (f, s) => conv.toVirtualFile(f.toPath) -> s }
|
||||
.map { (f, s) => conv.toVirtualFile(f.toPath) -> s }
|
||||
|
||||
/**
|
||||
* return a Seq of mappings excluding the directory itself.
|
||||
|
|
@ -82,5 +82,5 @@ object Mapper:
|
|||
def contentOf(baseDirectory: File)(using conv: FileConverter): Seq[(VirtualFile, String)] =
|
||||
(PathFinder(baseDirectory).allPaths --- PathFinder(baseDirectory))
|
||||
.pair(relativeTo(baseDirectory))
|
||||
.map { case (f, s) => conv.toVirtualFile(f.toPath) -> s }
|
||||
.map { (f, s) => conv.toVirtualFile(f.toPath) -> s }
|
||||
end Mapper
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ object Pkg:
|
|||
import sbt.util.CacheImplicits.hashedVirtualFileRefToStr
|
||||
private def sourcesStr: String =
|
||||
sources
|
||||
.map { case (k, v) =>
|
||||
.map { (k, v) =>
|
||||
s"${hashedVirtualFileRefToStr(k)}=$v"
|
||||
}
|
||||
.mkString(",\n ")
|
||||
|
|
@ -153,7 +153,7 @@ object Pkg:
|
|||
): VirtualFile =
|
||||
val manifest = toManifest(conf, log)
|
||||
val out = converter.toPath(conf.jar).toFile()
|
||||
val sources = conf.sources.map { case (vf, path) =>
|
||||
val sources = conf.sources.map { (vf, path) =>
|
||||
converter.toPath(vf).toFile() -> path
|
||||
}
|
||||
makeJar(sources, out, manifest, log, time)
|
||||
|
|
@ -235,7 +235,7 @@ object Pkg:
|
|||
log.debug("Done packaging.")
|
||||
}
|
||||
def sourcesDebugString(sources: Seq[(File, String)]): String =
|
||||
"Input file mappings:\n\t" + (sources map { case (f, s) => s + "\n\t " + f } mkString ("\n\t"))
|
||||
"Input file mappings:\n\t" + (sources map { (f, s) => s + "\n\t " + f } mkString ("\n\t"))
|
||||
|
||||
given manifestFormat: JsonFormat[Manifest] = projectFormat[Manifest, Array[Byte]](
|
||||
m => {
|
||||
|
|
@ -303,7 +303,7 @@ object PackageOption:
|
|||
unbuilder.beginObject(js)
|
||||
val attributes = unbuilder.readField[Vector[(String, String)]]("attributes")
|
||||
unbuilder.endObject()
|
||||
PackageOption.ManifestAttributes(attributes.map { case (k, v) =>
|
||||
PackageOption.ManifestAttributes(attributes.map { (k, v) =>
|
||||
Attributes.Name(k) -> v
|
||||
}*)
|
||||
case None => deserializationError("Expected JsObject but found None")
|
||||
|
|
@ -311,7 +311,7 @@ object PackageOption:
|
|||
builder.beginObject()
|
||||
builder.addField(
|
||||
"attributes",
|
||||
obj.attributes.toVector.map { case (k, v) => k.toString -> v }
|
||||
obj.attributes.toVector.map { (k, v) => k.toString -> v }
|
||||
)
|
||||
builder.endObject()
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ object Sync {
|
|||
def noDuplicateTargets(relation: Relation[File, File]): Unit = {
|
||||
val dups = relation.reverseMap
|
||||
.withFilter { case (_, srcs) => srcs.size >= 2 && srcs.exists(!_.isDirectory) }
|
||||
.map { case (target, srcs) => "\n\t" + target + "\nfrom\n\t" + srcs.mkString("\n\t\t") }
|
||||
.map { (target, srcs) => "\n\t" + target + "\nfrom\n\t" + srcs.mkString("\n\t\t") }
|
||||
if (dups.nonEmpty)
|
||||
sys.error("Duplicate mappings:" + dups.mkString)
|
||||
}
|
||||
|
|
@ -159,7 +159,7 @@ object Sync {
|
|||
)(using infoFormat: JsonFormat[F]): Unit = {
|
||||
val virtualRelation: Relation[VirtualFileRef, VirtualFileRef] =
|
||||
Relation.switch(relation, (f: File) => fileConverter.toVirtualFile(f.toPath))
|
||||
val virtualInfo: Map[VirtualFileRef, F] = info.map { case (file, fileInfo) =>
|
||||
val virtualInfo: Map[VirtualFileRef, F] = info.map { (file, fileInfo) =>
|
||||
fileConverter.toVirtualFile(file.toPath) -> fileInfo
|
||||
}
|
||||
|
||||
|
|
@ -188,7 +188,7 @@ object Sync {
|
|||
fileConverter: FileConverter
|
||||
): RelationInfo[F] = {
|
||||
val firstPart = Relation.switch(info._1, (r: VirtualFileRef) => fileConverter.toPath(r).toFile)
|
||||
val secondPart = info._2.map { case (file, fileInfo) =>
|
||||
val secondPart = info._2.map { (file, fileInfo) =>
|
||||
fileConverter.toPath(file).toFile -> fileInfo
|
||||
}
|
||||
firstPart -> secondPart
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ object TestResultLogger {
|
|||
"Canceled" -> canceledCount,
|
||||
"Pending" -> pendingCount
|
||||
)
|
||||
val extra = otherCounts.withFilter(_._2 > 0).map { case (label, count) => s", $label $count" }
|
||||
val extra = otherCounts.withFilter(_._2 > 0).map { (label, count) => s", $label $count" }
|
||||
|
||||
val postfix = base + extra.mkString
|
||||
results.overall match {
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@ object Tests {
|
|||
testFun: TestFunction,
|
||||
nestedTasks: Seq[TestTask]
|
||||
): Seq[(String, TestFunction)] =
|
||||
(nestedTasks.view.zipWithIndex map { case (nt, idx) =>
|
||||
(nestedTasks.view.zipWithIndex map { (nt, idx) =>
|
||||
val testFunDef = testFun.taskDef
|
||||
(
|
||||
testFunDef.fullyQualifiedName,
|
||||
|
|
@ -447,8 +447,8 @@ object Tests {
|
|||
runnables: Seq[TestRunnable],
|
||||
tags: Seq[(Tag, Int)]
|
||||
): Task[Map[String, SuiteResult]] = {
|
||||
val tasks = runnables.map { case (name, test) => toTask(loader, name, test, tags) }
|
||||
tasks.join.map(_.foldLeft(Map.empty[String, SuiteResult]) { case (sum, e) =>
|
||||
val tasks = runnables.map { (name, test) => toTask(loader, name, test, tags) }
|
||||
tasks.join.map(_.foldLeft(Map.empty[String, SuiteResult]) { (sum, e) =>
|
||||
val merged = sum.toSeq ++ e.toSeq
|
||||
val grouped = merged.groupBy(_._1)
|
||||
grouped.view
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ object MapperTest extends verify.BasicTestSuite:
|
|||
|
||||
val mappings = Mapper
|
||||
.directory(tempDirectory)
|
||||
.map { case (h, p) =>
|
||||
.map { (h, p) =>
|
||||
(h.toString, p)
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ object MapperTest extends verify.BasicTestSuite:
|
|||
given FileConverter = MappedFileConverter(Map("BASE" -> tempDirectory.toPath()), true)
|
||||
val mappings = Mapper
|
||||
.directory(tempDirectory)
|
||||
.map { case (h, p) =>
|
||||
.map { (h, p) =>
|
||||
(h.toString, p)
|
||||
}
|
||||
Predef.assert(
|
||||
|
|
@ -77,7 +77,7 @@ object MapperTest extends verify.BasicTestSuite:
|
|||
given FileConverter = conv0
|
||||
val file = tempDirectory / "file"
|
||||
IO.touch(file)
|
||||
val mappings = Mapper.directory(file).map { case (h, p) =>
|
||||
val mappings = Mapper.directory(file).map { (h, p) =>
|
||||
(h.toString, p)
|
||||
}
|
||||
Predef.assert(
|
||||
|
|
@ -99,7 +99,7 @@ object MapperTest extends verify.BasicTestSuite:
|
|||
IO.createDirectory(nestedDir)
|
||||
IO.touch(nestedDirFile)
|
||||
|
||||
val mappings = Mapper.contentOf(tempDirectory).map { case (h, p) =>
|
||||
val mappings = Mapper.contentOf(tempDirectory).map { (h, p) =>
|
||||
(h.toString, p)
|
||||
}
|
||||
Predef.assert(
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ object BasicCommands {
|
|||
def completionsParser(state: State): Parser[String] = completionsParser
|
||||
|
||||
private def completionsParser: Parser[String] = {
|
||||
val notQuoted = (NotQuoted ~ any.*) map { case (nq, s) => nq + s }
|
||||
val notQuoted = (NotQuoted ~ any.*) map { (nq, s) => nq + s }
|
||||
val quotedOrUnquotedSingleArgument = Space ~> (StringVerbatim | StringEscapable | notQuoted)
|
||||
token((quotedOrUnquotedSingleArgument ?? "").examples("", " "))
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ object BasicCommands {
|
|||
state.map(s => (matched(s.nonMultiParser) & cmdPart) | cmdPart)
|
||||
val cmdParser = {
|
||||
val parser = completionParser.getOrElse(cmdPart).map(_.trim)
|
||||
exclude.foldLeft(parser) { case (p, e) => p & not(OptSpace ~ s"$e ", s"!$e").examples() }
|
||||
exclude.foldLeft(parser) { (p, e) => p & not(OptSpace ~ s"$e ", s"!$e").examples() }
|
||||
}
|
||||
val multiCmdParser: Parser[String] = token(';') ~> OptSpace ~> cmdParser
|
||||
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ object Command {
|
|||
def spacedAny(name: String): Parser[String] = spacedC(name, any)
|
||||
|
||||
def spacedC(name: String, c: Parser[Char]): Parser[String] =
|
||||
((c & opOrIDSpaced(name)) ~ c.+) map { case (f, rem) => (f +: rem).mkString }
|
||||
((c & opOrIDSpaced(name)) ~ c.+) map { (f, rem) => (f +: rem).mkString }
|
||||
}
|
||||
|
||||
// format: on
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ object CommandUtil {
|
|||
}
|
||||
|
||||
def singleArgument(exampleStrings: Set[String]): Parser[String] = {
|
||||
val arg = (NotSpaceClass ~ any.*) map { case (ns, s) => (ns +: s).mkString }
|
||||
val arg = (NotSpaceClass ~ any.*) map { (ns, s) => (ns +: s).mkString }
|
||||
token(Space) ~> token(arg.examples(exampleStrings))
|
||||
}
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ object CommandUtil {
|
|||
|
||||
def searchHelp(selected: String, detailMap: Map[String, String]): Map[String, String] = {
|
||||
val pattern = Pattern.compile(selected, HelpPatternFlags)
|
||||
detailMap flatMap { case (k, v) =>
|
||||
detailMap flatMap { (k, v) =>
|
||||
val contentMatches = Highlight.showMatches(pattern)(v)
|
||||
val keyMatches = Highlight.showMatches(pattern)(k)
|
||||
val keyString = Highlight.bold(keyMatches getOrElse k)
|
||||
|
|
@ -88,7 +88,7 @@ object CommandUtil {
|
|||
}
|
||||
|
||||
def layoutDetails(details: Map[String, String]): String =
|
||||
details.map { case (k, v) => k + "\n\n " + v }.mkString("\n", "\n\n", "\n")
|
||||
details.map { (k, v) => k + "\n\n " + v }.mkString("\n", "\n\n", "\n")
|
||||
|
||||
final val HelpPatternFlags = Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ private[sbt] class ClassLoaderCache(
|
|||
}
|
||||
}
|
||||
)
|
||||
private val scalaProviderKey = miniProvider.map { case (f, cl) =>
|
||||
private val scalaProviderKey = miniProvider.map { (f, cl) =>
|
||||
new Key((f -> IO.getModifiedTimeOrZero(f)) :: Nil, commonParent) {
|
||||
override def toClassLoader: ClassLoader = cl
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ private[sbt] class ClassLoaderCache(
|
|||
delegate.asScala.groupBy { case (k, _) => k.parent -> k.files.toSet }.foreach {
|
||||
case (_, pairs) if pairs.size > 1 =>
|
||||
val max = pairs.map(_._1.maxStamp).max
|
||||
pairs.foreach { case (k, v) => if (k.maxStamp != max) clear(k, v) }
|
||||
pairs.foreach { (k, v) => if (k.maxStamp != max) clear(k, v) }
|
||||
case _ =>
|
||||
}
|
||||
delegate.forEach((k, v) => if (isInvalidated(k.parent)) clear(k, v))
|
||||
|
|
|
|||
|
|
@ -570,7 +570,7 @@ class NetworkClient(
|
|||
completions(msg.result match {
|
||||
case Some(o: JObject) =>
|
||||
o.value
|
||||
.foldLeft(CompletionResponse(Vector.empty[String])) { case (resp, i) =>
|
||||
.foldLeft(CompletionResponse(Vector.empty[String])) { (resp, i) =>
|
||||
if (i.field == "items")
|
||||
resp.withItems(
|
||||
Converter
|
||||
|
|
@ -651,7 +651,7 @@ class NetworkClient(
|
|||
)
|
||||
)
|
||||
}
|
||||
splitToMessage foreach { case (level, msg) =>
|
||||
splitToMessage foreach { (level, msg) =>
|
||||
console.appendLog(level, msg)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ private[sbt] object ReadJsonFromInputStream {
|
|||
var headerBuffer = new Array[Byte](128)
|
||||
def expandHeaderBuffer(): Unit = {
|
||||
val newHeaderBuffer = new Array[Byte](headerBuffer.length * 2)
|
||||
headerBuffer.view.zipWithIndex.foreach { case (b, i) => newHeaderBuffer(i) = b }
|
||||
headerBuffer.view.zipWithIndex.foreach { (b, i) => newHeaderBuffer(i) = b }
|
||||
headerBuffer = newHeaderBuffer
|
||||
}
|
||||
def getLine(): String = {
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ object InputTask:
|
|||
override def pure[A1](a: () => A1): InputTask[A1] = InputTask.createFreeFromAction(a)
|
||||
override def ap[A1, A2](ff: InputTask[A1 => A2])(in: InputTask[A1]): InputTask[A2] =
|
||||
InputTask[A2]((s: State) =>
|
||||
(in.parser(s) ~ ff.parser(s)).map { case (ta1, tf) =>
|
||||
(in.parser(s) ~ ff.parser(s)).map { (ta1, tf) =>
|
||||
Task.taskMonad.ap(tf)(ta1)
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ object Plugins extends PluginsFunctions {
|
|||
lits map { case Atom(l) => l; case Negated(Atom(l)) => l } mkString (", ")
|
||||
|
||||
private def duplicateProvidesError(byAtom: Seq[(Atom, AutoPlugin)]): Unit = {
|
||||
val dupsByAtom = Map(byAtom.groupBy(_._1).toSeq.map { case (k, v) =>
|
||||
val dupsByAtom = Map(byAtom.groupBy(_._1).toSeq.map { (k, v) =>
|
||||
k -> v.map(_._2)
|
||||
}*)
|
||||
val dupStrings =
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ object Previous {
|
|||
def runtime[T](skey: TaskKey[T])(using format: JsonFormat[T]): Initialize[Task[Option[T]]] = {
|
||||
type Inputs = (Task[Previous], ScopedKey[Task[T]], References)
|
||||
val inputs = (Global / cache, Def.validated(skey, selfRefOk = true), Global / references)
|
||||
Def.app[Inputs, Task[Option[T]]](inputs) { case (prevTask, resolved, refs) =>
|
||||
Def.app[Inputs, Task[Option[T]]](inputs) { (prevTask, resolved, refs) =>
|
||||
val key = Key(resolved, resolved)
|
||||
refs.recordReference(key, format) // always evaluated on project load
|
||||
prevTask.map(_.get(key)) // evaluated if this task is evaluated
|
||||
|
|
@ -174,7 +174,7 @@ object Previous {
|
|||
Global / references,
|
||||
Def.resolvedScoped
|
||||
)
|
||||
Def.app[Inputs, Task[Option[T]]](inputs) { case (prevTask, resolved, refs, inTask) =>
|
||||
Def.app[Inputs, Task[Option[T]]](inputs) { (prevTask, resolved, refs, inTask) =>
|
||||
val key = Key(resolved, inTask.asInstanceOf[ScopedKey[Task[Any]]])
|
||||
refs.recordReference(key, format) // always evaluated on project load
|
||||
prevTask.map(_.get(key))
|
||||
|
|
|
|||
|
|
@ -385,9 +385,8 @@ object Scope:
|
|||
configInherit: (ResolvedReference, ConfigKey) => Seq[ConfigKey]
|
||||
): DelegateIndex = {
|
||||
val pDelegates = refs
|
||||
.map:
|
||||
case (ref, project) =>
|
||||
(ref, delegateIndex(ref, configurations(project))(projectInherit, configInherit))
|
||||
.map: (ref, project) =>
|
||||
(ref, delegateIndex(ref, configurations(project))(projectInherit, configInherit))
|
||||
.toMap
|
||||
new DelegateIndex0(pDelegates)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ object ParserInstance:
|
|||
type F[x] = State => Parser[x]
|
||||
override def pure[A1](a: () => A1): State => Parser[A1] = const(DefaultParsers.success(a()))
|
||||
override def ap[A1, A2](ff: F[A1 => A2])(fa: F[A1]): F[A2] =
|
||||
(s: State) => (ff(s) ~ fa(s)).map { case (f, a) => f(a) }
|
||||
(s: State) => (ff(s) ~ fa(s)).map { (f, a) => f(a) }
|
||||
override def map[A1, A2](fa: F[A1])(f: A1 => A2) =
|
||||
(s: State) => fa(s).map(f)
|
||||
end ParserInstance
|
||||
|
|
@ -87,7 +87,7 @@ object FullInstance:
|
|||
type Tup = (Task[Initialize[Task[A1]]], Task[SS], [a] => Initialize[a] => Initialize[a])
|
||||
Def.app[Tup, Task[A1]]((in, settingsData, Def.capturedTransformations)) {
|
||||
case (a: Task[Initialize[Task[A1]]], data: Task[SS], f) =>
|
||||
TaskExtra.multT2Task((a, data)).flatMapN { case (a, d) => f(a).evaluate(d) }
|
||||
TaskExtra.multT2Task((a, data)).flatMapN { (a, d) => f(a).evaluate(d) }
|
||||
}
|
||||
|
||||
def flattenFun[A1, A2](
|
||||
|
|
@ -96,7 +96,7 @@ object FullInstance:
|
|||
type Tup = (Task[A1 => Initialize[Task[A2]]], Task[SS], [a] => Initialize[a] => Initialize[a])
|
||||
Def.app[Tup, A1 => Task[A2]]((in, settingsData, Def.capturedTransformations)) {
|
||||
case (a: Task[A1 => Initialize[Task[A2]]] @unchecked, data: Task[SS] @unchecked, f) =>
|
||||
(s: A1) => TaskExtra.multT2Task((a, data)).flatMapN { case (af, d) => f(af(s)).evaluate(d) }
|
||||
(s: A1) => TaskExtra.multT2Task((a, data)).flatMapN { (af, d) => f(af(s)).evaluate(d) }
|
||||
}
|
||||
|
||||
end FullInstance
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ object Cross {
|
|||
private def crossParser(state: State): Parser[CrossArgs] =
|
||||
token(CrossCommand <~ OptSpace) flatMap { _ =>
|
||||
(token(Parser.opt("-v" <~ Space)) ~ token(matched(state.combinedParser))).map {
|
||||
case (verbose, command) => CrossArgs(command, verbose.isDefined)
|
||||
(verbose, command) => CrossArgs(command, verbose.isDefined)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -161,7 +161,7 @@ object Cross {
|
|||
"that are configured."
|
||||
)
|
||||
state.log.debug("Scala versions configuration is:")
|
||||
projCrossVersions.foreach { case (project, versions) =>
|
||||
projCrossVersions.foreach { (project, versions) =>
|
||||
state.log.debug(s"$project: $versions")
|
||||
}
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ object Cross {
|
|||
.view
|
||||
.mapValues(_.map(_._2).toSet)
|
||||
val commandsByVersion = keysByVersion.toSeq
|
||||
.flatMap { case (v, keys) =>
|
||||
.flatMap { (v, keys) =>
|
||||
val projects = keys.flatMap(project)
|
||||
keys.toSeq.flatMap { k =>
|
||||
project(k).withFilter(projects.contains).flatMap { p =>
|
||||
|
|
@ -205,7 +205,7 @@ object Cross {
|
|||
.mapValues(_.map(_._2))
|
||||
.toSeq
|
||||
.sortBy(_._1)
|
||||
commandsByVersion.flatMap { case (v, commands) =>
|
||||
commandsByVersion.flatMap { (v, commands) =>
|
||||
commands match {
|
||||
case Seq(c) => Seq(s"$SwitchCommand $verbose $v $c")
|
||||
case Seq() => Nil // should be unreachable
|
||||
|
|
@ -294,7 +294,7 @@ object Cross {
|
|||
excluded: Seq[(ResolvedReference, Seq[ScalaVersion])]
|
||||
) = {
|
||||
|
||||
instance.foreach { case (home, instance) =>
|
||||
instance.foreach { (home, instance) =>
|
||||
state.log.info(s"Using Scala home $home with actual version ${instance.actualVersion}")
|
||||
}
|
||||
if (switch.version.force) {
|
||||
|
|
@ -302,7 +302,7 @@ object Cross {
|
|||
} else {
|
||||
included
|
||||
.groupBy(_._2)
|
||||
.foreach { case (selectedVersion, projects) =>
|
||||
.foreach { (selectedVersion, projects) =>
|
||||
state.log.info(
|
||||
s"Setting Scala version to $selectedVersion on ${projects.size} projects."
|
||||
)
|
||||
|
|
@ -333,13 +333,13 @@ object Cross {
|
|||
val projectScalaVersions =
|
||||
structure.allProjectRefs.map(proj => proj -> crossVersions(extracted, proj))
|
||||
if (switch.version.force) {
|
||||
projectScalaVersions.map { case (ref, options) =>
|
||||
projectScalaVersions.map { (ref, options) =>
|
||||
(ref, Some(version), options)
|
||||
} ++ structure.units.keys
|
||||
.map(BuildRef.apply)
|
||||
.map(proj => (proj, Some(version), crossVersions(extracted, proj)))
|
||||
} else {
|
||||
projectScalaVersions.map { case (project, scalaVersions) =>
|
||||
projectScalaVersions.map { (project, scalaVersions) =>
|
||||
val selector = SemanticSelector(version)
|
||||
scalaVersions.filter(v => selector.matches(VersionNumber(v))) match {
|
||||
case Nil => (project, None, scalaVersions)
|
||||
|
|
@ -395,7 +395,7 @@ object Cross {
|
|||
): State = {
|
||||
import extracted.*
|
||||
|
||||
val newSettings = projects.flatMap { case (project, version, scalaVersions) =>
|
||||
val newSettings = projects.flatMap { (project, version, scalaVersions) =>
|
||||
val scope = Scope(Select(project), Zero, Zero, Zero)
|
||||
|
||||
instance match {
|
||||
|
|
|
|||
|
|
@ -648,7 +648,7 @@ object Defaults extends BuildCommon {
|
|||
resourceDigests := {
|
||||
val uifs = (unmanagedResources / inputFileStamps).value
|
||||
val mifs = (managedResources / inputFileStamps).value
|
||||
(uifs ++ mifs).sortBy(_._1.toString()).map { case (p, fileStamp) =>
|
||||
(uifs ++ mifs).sortBy(_._1.toString()).map { (p, fileStamp) =>
|
||||
FileStamp.toDigest(p, fileStamp)
|
||||
}
|
||||
},
|
||||
|
|
@ -1175,7 +1175,7 @@ object Defaults extends BuildCommon {
|
|||
(classLoaderLayeringStrategy),
|
||||
thisProject,
|
||||
fileConverter,
|
||||
).flatMapN { case (s, lt, tl, gp, ex, cp, fp, jo, clls, thisProj, c) =>
|
||||
).flatMapN { (s, lt, tl, gp, ex, cp, fp, jo, clls, thisProj, c) =>
|
||||
allTestGroupsTask(
|
||||
s,
|
||||
lt,
|
||||
|
|
@ -1330,7 +1330,7 @@ object Defaults extends BuildCommon {
|
|||
|
||||
private lazy val inputTests0: Initialize[InputTask[Unit]] = {
|
||||
val parser = loadForParser(definedTestNames)((s, i) => testOnlyParser(s, i getOrElse Nil))
|
||||
ParserGen(parser).flatMapTask { case ((selected, frameworkOptions)) =>
|
||||
ParserGen(parser).flatMapTask { (selected, frameworkOptions) =>
|
||||
val s = streams.value
|
||||
val filter = testFilter.value
|
||||
val config = testExecution.value
|
||||
|
|
@ -1367,7 +1367,7 @@ object Defaults extends BuildCommon {
|
|||
): Map[TestFramework, Runner] = {
|
||||
import Tests.Argument
|
||||
val opts = config.options.toList
|
||||
frameworks.map { case (tf, f) =>
|
||||
frameworks.map { (tf, f) =>
|
||||
val args = opts.flatMap {
|
||||
case Argument(None | Some(`tf`), args) => args
|
||||
case _ => Nil
|
||||
|
|
@ -1489,7 +1489,7 @@ object Defaults extends BuildCommon {
|
|||
}
|
||||
val output = Tests.foldTasks(groupTasks, config.parallel)
|
||||
val result = output map { out =>
|
||||
out.events.foreach { case (suite, e) =>
|
||||
out.events.foreach { (suite, e) =>
|
||||
if (
|
||||
strategy != ClassLoaderLayeringStrategy.Flat ||
|
||||
strategy != ClassLoaderLayeringStrategy.ScalaLibrary
|
||||
|
|
@ -1531,7 +1531,7 @@ object Defaults extends BuildCommon {
|
|||
}
|
||||
}
|
||||
val summaries =
|
||||
runners map { case (tf, r) =>
|
||||
runners map { (tf, r) =>
|
||||
Tests.Summary(frameworks(tf).name, r.done())
|
||||
}
|
||||
out.copy(summaries = summaries)
|
||||
|
|
@ -1607,7 +1607,7 @@ object Defaults extends BuildCommon {
|
|||
xs
|
||||
.flatMap(Path.allSubpaths)
|
||||
.withFilter(_._1.isFile())
|
||||
.map { case (p, path) =>
|
||||
.map { (p, path) =>
|
||||
val vf = converter.toVirtualFile(p.toPath())
|
||||
(vf: HashedVirtualFileRef) -> path
|
||||
}
|
||||
|
|
@ -1621,7 +1621,7 @@ object Defaults extends BuildCommon {
|
|||
.allSubpaths(d)
|
||||
.toSeq
|
||||
.withFilter(_._1.isFile())
|
||||
.map { case (p, path) =>
|
||||
.map { (p, path) =>
|
||||
val vf = converter.toVirtualFile(p.toPath())
|
||||
(vf: HashedVirtualFileRef) -> path
|
||||
}
|
||||
|
|
@ -1659,7 +1659,7 @@ object Defaults extends BuildCommon {
|
|||
case s if !exclude(s) => relative(s).map(s -> _)
|
||||
case _ => None
|
||||
}
|
||||
.map { case (p, path) =>
|
||||
.map { (p, path) =>
|
||||
val vf = converter.toVirtualFile(p.toPath())
|
||||
(vf: HashedVirtualFileRef) -> path
|
||||
}
|
||||
|
|
@ -1681,7 +1681,7 @@ object Defaults extends BuildCommon {
|
|||
case r if !rdirs(r) => relative(r).map(r -> _)
|
||||
case _ => None
|
||||
}
|
||||
.map { case (p, path) =>
|
||||
.map { (p, path) =>
|
||||
val vf = converter.toVirtualFile(p.toPath())
|
||||
(vf: HashedVirtualFileRef) -> path
|
||||
}
|
||||
|
|
@ -2126,7 +2126,7 @@ object Defaults extends BuildCommon {
|
|||
val allDeps = allDependencies.value
|
||||
(hasScala, hasJava) match {
|
||||
case (true, _) =>
|
||||
val xapisFiles = xapis.map { case (k, v) =>
|
||||
val xapisFiles = xapis.map { (k, v) =>
|
||||
converter.toPath(k).toFile() -> v
|
||||
}
|
||||
val options = sOpts ++ Opts.doc.externalAPI(xapisFiles)
|
||||
|
|
@ -2979,7 +2979,7 @@ object Classpaths {
|
|||
IO.copyFile(file, targetFile)
|
||||
artifact.withName(nameWithSuffix) -> converter.toVirtualFile(targetFile.toPath)
|
||||
}
|
||||
legacyPackages.map { case (artifact, file) =>
|
||||
legacyPackages.map { (artifact, file) =>
|
||||
copyArtifact(artifact, file);
|
||||
}
|
||||
|
||||
|
|
@ -3887,36 +3887,36 @@ object Classpaths {
|
|||
publishMavenStyle.toTaskable,
|
||||
compatibilityWarningOptions.toTaskable,
|
||||
).mapN {
|
||||
case (
|
||||
lm,
|
||||
s,
|
||||
conf,
|
||||
maybeUpdateLevel,
|
||||
ucn,
|
||||
state0,
|
||||
sv,
|
||||
ac,
|
||||
usiOnly,
|
||||
dcd,
|
||||
ct,
|
||||
er,
|
||||
rs,
|
||||
fup,
|
||||
isPlugin,
|
||||
thisRef,
|
||||
im,
|
||||
so,
|
||||
sk,
|
||||
tu,
|
||||
uwConfig,
|
||||
eel,
|
||||
lds,
|
||||
aeel,
|
||||
avs,
|
||||
avsj,
|
||||
mavenStyle,
|
||||
cwo,
|
||||
) =>
|
||||
(
|
||||
lm,
|
||||
s,
|
||||
conf,
|
||||
maybeUpdateLevel,
|
||||
ucn,
|
||||
state0,
|
||||
sv,
|
||||
ac,
|
||||
usiOnly,
|
||||
dcd,
|
||||
ct,
|
||||
er,
|
||||
rs,
|
||||
fup,
|
||||
isPlugin,
|
||||
thisRef,
|
||||
im,
|
||||
so,
|
||||
sk,
|
||||
tu,
|
||||
uwConfig,
|
||||
eel,
|
||||
lds,
|
||||
aeel,
|
||||
avs,
|
||||
avsj,
|
||||
mavenStyle,
|
||||
cwo,
|
||||
) =>
|
||||
val cacheDirectory = ct / cacheLabel / ucn
|
||||
val cacheStoreFactory: CacheStoreFactory = {
|
||||
val factory =
|
||||
|
|
@ -4159,7 +4159,7 @@ object Classpaths {
|
|||
private[sbt] def depMap: Initialize[Task[Map[ModuleRevisionId, ModuleDescriptor]]] =
|
||||
import sbt.TupleSyntax.*
|
||||
(buildDependencies.toTaskable, thisProjectRef.toTaskable, settingsData, streams).flatMapN {
|
||||
case (bd, thisProj, data, s) =>
|
||||
(bd, thisProj, data, s) =>
|
||||
depMap(bd.classpathTransitiveRefs(thisProj), data, s.log)
|
||||
}
|
||||
|
||||
|
|
@ -4252,7 +4252,7 @@ object Classpaths {
|
|||
data: Def.Settings,
|
||||
deps: BuildDependencies
|
||||
): Seq[(ProjectRef, ConfigRef)] =
|
||||
interSort(projectRef, conf, data, deps).map { case (projectRef, configName) =>
|
||||
interSort(projectRef, conf, data, deps).map { (projectRef, configName) =>
|
||||
(projectRef, ConfigRef(configName))
|
||||
}
|
||||
|
||||
|
|
@ -4396,7 +4396,7 @@ object Classpaths {
|
|||
private lazy val internalCompilerPluginClasspath: Initialize[Task[Classpath]] =
|
||||
(Def
|
||||
.task { (thisProjectRef.value, settingsData.value, buildDependencies.value, streams.value) })
|
||||
.flatMapTask { case (ref, data, deps, s) =>
|
||||
.flatMapTask { (ref, data, deps, s) =>
|
||||
ClasspathImpl.internalDependenciesImplTask(
|
||||
ref,
|
||||
CompilerPlugin,
|
||||
|
|
@ -4737,7 +4737,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
|
|||
scoped.scopedKey,
|
||||
ClassLoaders.runner.mapReferenced(Project.mapScope(_.rescope(config))),
|
||||
).zipWith(Def.task { ((config / fullClasspath).value, streams.value, fileConverter.value) }) {
|
||||
case (rTask, t) =>
|
||||
(rTask, t) =>
|
||||
(t, rTask).mapN { case ((cp, s, converter), r) =>
|
||||
given FileConverter = converter
|
||||
r.run(mainClass, cp.files, arguments, s.log).get
|
||||
|
|
|
|||
|
|
@ -633,7 +633,7 @@ object BuiltinCommands {
|
|||
SettingCompletions.setThis(extracted, settings, arg)
|
||||
|
||||
def inspect: Command = Command(InspectCommand, inspectBrief, inspectDetailed)(Inspect.parser) {
|
||||
case (s, f) =>
|
||||
(s, f) =>
|
||||
s.log.info(f())
|
||||
s
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ object Opts {
|
|||
if (mappings.isEmpty) Nil
|
||||
else
|
||||
mappings
|
||||
.map { case (f, u) => s"${f.getAbsolutePath}#${u.toURL().toExternalForm}" }
|
||||
.map { (f, u) => s"${f.getAbsolutePath}#${u.toURL().toExternalForm}" }
|
||||
.mkString("-doc-external-doc:", ",", "") :: Nil
|
||||
}
|
||||
object resolver {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ private[sbt] object PluginCross {
|
|||
.getOrElse(Nil)
|
||||
.toList
|
||||
}
|
||||
Command.arb(requireSession(crossParser), pluginCrossHelp) { case (state, command) =>
|
||||
Command.arb(requireSession(crossParser), pluginCrossHelp) { (state, command) =>
|
||||
val x = Project.extract(state)
|
||||
import x.*
|
||||
val versions = crossVersions(state)
|
||||
|
|
|
|||
|
|
@ -516,7 +516,7 @@ trait ProjectExtra extends Scoped.Syntax:
|
|||
private[sbt] def usedBy(structure: BuildStructure, actual: Boolean, key: AttributeKey[?])(using
|
||||
display: Show[ScopedKey[?]]
|
||||
): Seq[ScopedKey[?]] =
|
||||
relation(structure, actual)(using display).all.toSeq flatMap { case (a, b) =>
|
||||
relation(structure, actual)(using display).all.toSeq flatMap { (a, b) =>
|
||||
if (b.key == key) List[ScopedKey[?]](a) else Nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -655,7 +655,7 @@ object ProjectMatrix {
|
|||
new AxisBaseProjectFinder(axisValues.toSeq)
|
||||
|
||||
override def allProjects(): Seq[(Project, Seq[VirtualAxis])] =
|
||||
resolvedMappings.map { case (row, project) =>
|
||||
resolvedMappings.map { (row, project) =>
|
||||
project -> row.axisValues
|
||||
}.toSeq
|
||||
|
||||
|
|
|
|||
|
|
@ -268,17 +268,17 @@ object RemoteCache {
|
|||
remoteCacheId := {
|
||||
val inputs = (unmanagedSources / inputFileStamps).value
|
||||
val cp = (externalDependencyClasspath / outputFileStamps).?.value.getOrElse(Nil)
|
||||
val extraInc = (extraIncOptions.value) flatMap { case (k, v) =>
|
||||
val extraInc = (extraIncOptions.value) flatMap { (k, v) =>
|
||||
Vector(k, v)
|
||||
}
|
||||
combineHash(extractHash(inputs) ++ extractHash(cp) ++ extraInc)
|
||||
},
|
||||
pushRemoteCacheConfiguration := {
|
||||
val converter = fileConverter.value
|
||||
val artifacts = (pushRemoteCacheConfiguration / packagedArtifacts).value.toVector.map {
|
||||
case (a, vf) =>
|
||||
val artifacts =
|
||||
(pushRemoteCacheConfiguration / packagedArtifacts).value.toVector.map { (a, vf) =>
|
||||
a -> converter.toPath(vf).toFile
|
||||
}
|
||||
}
|
||||
Classpaths.publishConfig(
|
||||
(pushRemoteCacheConfiguration / publishMavenStyle).value,
|
||||
Classpaths.deliverPattern(crossTarget.value),
|
||||
|
|
|
|||
|
|
@ -223,8 +223,8 @@ object ScopeFilter {
|
|||
val grouped: ScopeMap =
|
||||
scopes
|
||||
.groupBy(_.project)
|
||||
.map { case (k, v) =>
|
||||
k -> v.groupBy(_.config).map { case (k, v) => k -> v.groupBy(_.task) }
|
||||
.map { (k, v) =>
|
||||
k -> v.groupBy(_.config).map { (k, v) => k -> v.groupBy(_.task) }
|
||||
}
|
||||
new AllScopes(scopes, grouped)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ private[sbt] object TemplateCommandUtil {
|
|||
else
|
||||
ITerminal.withStreams(true, false) {
|
||||
assert(templates.size <= 20, "template list cannot have more than 20 items")
|
||||
val mappingList = templates.zipWithIndex.map { case (v, idx) =>
|
||||
val mappingList = templates.zipWithIndex.map { (v, idx) =>
|
||||
toLetter(idx) -> v
|
||||
}
|
||||
val out = term.printStream
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ object CoursierInputsTasks {
|
|||
CModule(
|
||||
COrganization(id.getOrganisation),
|
||||
CModuleName(id.getName),
|
||||
id.getExtraAttributes.asScala.map { case (k0, v0) =>
|
||||
id.getExtraAttributes.asScala.map { (k0, v0) =>
|
||||
k0.asInstanceOf[String] -> v0.asInstanceOf[String]
|
||||
}.toMap
|
||||
)
|
||||
|
|
@ -155,7 +155,7 @@ object CoursierInputsTasks {
|
|||
c => m.getOrElse(c, CPublication("", CType(""), CExtension(""), CClassifier("")))
|
||||
}
|
||||
|
||||
configurations.map { case (from, to) =>
|
||||
configurations.map { (from, to) =>
|
||||
from -> dependency(to, publications(to))
|
||||
}
|
||||
}
|
||||
|
|
@ -181,14 +181,14 @@ object CoursierInputsTasks {
|
|||
|
||||
// this includes org.scala-sbt:global-plugins referenced from meta-builds in particular
|
||||
sbt.Keys.projectDescriptors.value
|
||||
.map { case (k, v) =>
|
||||
.map { (k, v) =>
|
||||
moduleFromIvy(k) -> v
|
||||
}
|
||||
.filter { case (module, _) =>
|
||||
!projectModules(module)
|
||||
}
|
||||
.toVector
|
||||
.map { case (module, v) =>
|
||||
.map { (module, v) =>
|
||||
val configurations = v.getConfigurations.map { c =>
|
||||
CConfiguration(c.getName) -> c.getExtends.map(CConfiguration(_)).toSeq
|
||||
}.toMap
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ object CoursierRepositoriesTasks {
|
|||
val dependencyRefs = Project.transitiveInterDependencies(s, projectRef)
|
||||
(ScopeFilter(inProjects(projectRef)), ScopeFilter(inProjects(dependencyRefs*)))
|
||||
})
|
||||
.flatMapTask { case (filter1, filter2) =>
|
||||
.flatMapTask { (filter1, filter2) =>
|
||||
Def.task {
|
||||
val resolvers = csrResolvers.all(filter1).value ++ csrResolvers.all(filter2).value
|
||||
resolvers.flatten
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ object LMCoursier {
|
|||
log
|
||||
)
|
||||
.toVector
|
||||
.map { case (o, n) =>
|
||||
.map { (o, n) =>
|
||||
(o.value, n.value)
|
||||
}
|
||||
.sorted
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ final class MultiHandler[S, T](
|
|||
def setRoot(resolver: S => Option[T]) =
|
||||
new MultiHandler(builtIn, Some(resolver), nonRoots, getURI, log)
|
||||
def applyNonRoots(info: S): List[(URI, T)] =
|
||||
nonRoots flatMap { case (definingURI, loader) =>
|
||||
nonRoots flatMap { (definingURI, loader) =>
|
||||
loader(info) map { unit =>
|
||||
(definingURI, unit)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ final class BuildStructure(
|
|||
|
||||
/** Foreach project in each build apply the specified function. */
|
||||
private def eachBuild[A](f: (URI, ResolvedProject) => A): Seq[A] =
|
||||
units.iterator.flatMap { case (build, unit) => unit.projects.map(f(build, _)) }.toIndexedSeq
|
||||
units.iterator.flatMap { (build, unit) => unit.projects.map(f(build, _)) }.toIndexedSeq
|
||||
|
||||
/** Foreach project in the specified build apply the specified function. */
|
||||
private def eachProject[A](build: URI, f: ResolvedProject => A): Seq[A] =
|
||||
|
|
@ -266,7 +266,7 @@ final class LoadedBuild(val root: URI, val units: Map[URI, LoadedBuildUnit]) {
|
|||
BuildUtil.checkCycles(units)
|
||||
|
||||
def allProjectRefs: Seq[(ProjectRef, ResolvedProject)] =
|
||||
units.iterator.flatMap { case (build, unit) =>
|
||||
units.iterator.flatMap { (build, unit) =>
|
||||
unit.projects.map(p => ProjectRef(build, p.id) -> p)
|
||||
}.toIndexedSeq
|
||||
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ private[sbt] object ClasspathImpl {
|
|||
trackIfMissing: TaskKey[Seq[A]],
|
||||
trackAlways: TaskKey[Seq[A]]
|
||||
): Task[Seq[A]] = {
|
||||
val interDepConfigs = interSort(projectRef, conf, data, deps) filter { case (dep, c) =>
|
||||
val interDepConfigs = interSort(projectRef, conf, data, deps) filter { (dep, c) =>
|
||||
includeSelf || (dep != projectRef) || (conf.name != c && self.name != c)
|
||||
}
|
||||
val tasks = (new LinkedHashSet[Task[Seq[A]]]).asScala
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ private[sbt] object Clean {
|
|||
val manager = streamsManager.value
|
||||
(state, extracted, view, manager)
|
||||
})
|
||||
.flatMapTask { case (state, extracted, view, manager) =>
|
||||
.flatMapTask { (state, extracted, view, manager) =>
|
||||
Def.task {
|
||||
val excludeFilter = cleanFilter(scope).value
|
||||
val delete = cleanDelete(scope).value
|
||||
|
|
|
|||
|
|
@ -356,9 +356,8 @@ private[sbt] object Continuous extends DeprecatedContinuous {
|
|||
): (Watch.Action, String, Int, State) => State = {
|
||||
configs.flatMap(_.watchSettings.onTermination).distinct match {
|
||||
case Seq(head, tail*) =>
|
||||
tail.foldLeft(head) { case (onTermination, configOnTermination) =>
|
||||
(action, cmd, count, state) =>
|
||||
configOnTermination(action, cmd, count, onTermination(action, cmd, count, state))
|
||||
tail.foldLeft(head) { (onTermination, configOnTermination) => (action, cmd, count, state) =>
|
||||
configOnTermination(action, cmd, count, onTermination(action, cmd, count, state))
|
||||
}
|
||||
case _ =>
|
||||
if (isCommand) Watch.defaultCommandOnTermination else Watch.defaultTaskOnTermination
|
||||
|
|
@ -636,7 +635,7 @@ private[sbt] object Continuous extends DeprecatedContinuous {
|
|||
val actions = events.flatMap(onEvent(count, _))
|
||||
if (actions.exists(_._2 != Watch.Ignore)) {
|
||||
val builder = new StringBuilder
|
||||
val min = actions.minBy { case (e, a) =>
|
||||
val min = actions.minBy { (e, a) =>
|
||||
if (builder.nonEmpty) builder.append(", ")
|
||||
val path = e.path
|
||||
builder.append(path)
|
||||
|
|
@ -777,7 +776,7 @@ private[sbt] object Continuous extends DeprecatedContinuous {
|
|||
val default: String => Watch.Action =
|
||||
string => parse(inputStream(string), systemInBuilder, fullParser)
|
||||
val alt = alternative
|
||||
.map { case (key, handler) =>
|
||||
.map { (key, handler) =>
|
||||
val is = extracted.runTask(key, state)._2
|
||||
() => handler(is)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ private[sbt] object CrossJava {
|
|||
}
|
||||
|
||||
def lookupJavaHome(jv: String, mappings: Map[String, File]): File = {
|
||||
val ms = mappings map { case (k, v) => (JavaVersion(k), v) }
|
||||
val ms = mappings map { (k, v) => (JavaVersion(k), v) }
|
||||
lookupJavaHome(JavaVersion(jv), ms)
|
||||
}
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ private[sbt] object CrossJava {
|
|||
|
||||
// when looking for "10" it should match "openjdk@10"
|
||||
case None if jv.vendor.isEmpty =>
|
||||
val noVendors: Map[JavaVersion, File] = mappings map { case (k, v) =>
|
||||
val noVendors: Map[JavaVersion, File] = mappings map { (k, v) =>
|
||||
k.withVendor(None) -> v
|
||||
}
|
||||
noVendors.get(jv).getOrElse(javaHomeNotFound(jv, mappings))
|
||||
|
|
@ -178,7 +178,7 @@ private[sbt] object CrossJava {
|
|||
extracted: Extracted,
|
||||
proj: ResolvedReference
|
||||
): Map[JavaVersion, File] = {
|
||||
getJavaHomes(extracted, proj) map { case (k, v) => (JavaVersion(k), v) }
|
||||
getJavaHomes(extracted, proj) map { (k, v) => (JavaVersion(k), v) }
|
||||
}
|
||||
|
||||
private def getCrossJavaVersions(
|
||||
|
|
@ -217,7 +217,7 @@ private[sbt] object CrossJava {
|
|||
switch.target.version match {
|
||||
case None => projectJavaVersions
|
||||
case Some(v) =>
|
||||
projectJavaVersions flatMap { case (proj, versions) =>
|
||||
projectJavaVersions flatMap { (proj, versions) =>
|
||||
if (versions.isEmpty || versions.contains[String](v.toString))
|
||||
Vector(proj -> versions)
|
||||
else Vector()
|
||||
|
|
@ -226,7 +226,7 @@ private[sbt] object CrossJava {
|
|||
}
|
||||
|
||||
def setJavaHomeForProjects: State = {
|
||||
val newSettings = projects.flatMap { case (proj, javaVersions) =>
|
||||
val newSettings = projects.flatMap { (proj, javaVersions) =>
|
||||
val fjh = getJavaHomesTyped(extracted, proj)
|
||||
val home = switch.target match {
|
||||
case SwitchTarget(Some(v), _, _) => lookupJavaHome(v, fjh)
|
||||
|
|
@ -273,7 +273,7 @@ private[sbt] object CrossJava {
|
|||
private def crossParser(state: State): Parser[CrossArgs] =
|
||||
token(JavaCrossCommand <~ OptSpace) flatMap { _ =>
|
||||
(token(Parser.opt("-v" <~ Space)) ~ token(matched(state.combinedParser))).map {
|
||||
case (verbose, command) => CrossArgs(command, verbose.isDefined)
|
||||
(verbose, command) => CrossArgs(command, verbose.isDefined)
|
||||
} & spacedFirst(JavaCrossCommand)
|
||||
}
|
||||
|
||||
|
|
@ -286,7 +286,7 @@ private[sbt] object CrossJava {
|
|||
}
|
||||
// if we support javaHome, projVersions should be cached somewhere since
|
||||
// running ++2.11.1 is at the root level is going to mess with the scalaVersion for the aggregated subproj
|
||||
val projVersions = (projCrossVersions flatMap { case (proj, versions) =>
|
||||
val projVersions = (projCrossVersions flatMap { (proj, versions) =>
|
||||
versions map { proj.project -> _ }
|
||||
}).toList
|
||||
|
||||
|
|
@ -313,7 +313,7 @@ private[sbt] object CrossJava {
|
|||
"that are configured."
|
||||
)
|
||||
state.log.debug("Java versions configuration is:")
|
||||
projCrossVersions.foreach { case (project, versions) =>
|
||||
projCrossVersions.foreach { (project, versions) =>
|
||||
state.log.debug(s"$project: $versions")
|
||||
}
|
||||
}
|
||||
|
|
@ -515,15 +515,15 @@ private[sbt] object CrossJava {
|
|||
else s
|
||||
|
||||
def expandJavaHomes(hs: Map[String, File]): Map[String, File] = {
|
||||
val parsed = hs map { case (k, v) =>
|
||||
val parsed = hs map { (k, v) =>
|
||||
JavaVersion(k) -> v
|
||||
}
|
||||
// first ignore vnd
|
||||
val withAndWithoutVnd = parsed flatMap { case (k, v) =>
|
||||
val withAndWithoutVnd = parsed flatMap { (k, v) =>
|
||||
if (k.vendor.isDefined) Vector(k -> v, k.withVendor(None) -> v)
|
||||
else Vector(k -> v)
|
||||
}
|
||||
val normalizeNumbers = withAndWithoutVnd flatMap { case (k, v) =>
|
||||
val normalizeNumbers = withAndWithoutVnd flatMap { (k, v) =>
|
||||
k.numbers match {
|
||||
case Vector(1L, minor, _*) =>
|
||||
Vector(k -> v, k.withNumbers(Vector(minor)) -> v)
|
||||
|
|
@ -535,7 +535,7 @@ private[sbt] object CrossJava {
|
|||
Vector(k -> v)
|
||||
}
|
||||
}
|
||||
val result: Map[String, File] = normalizeNumbers map { case (k, v) =>
|
||||
val result: Map[String, File] = normalizeNumbers map { (k, v) =>
|
||||
(k.toString -> v)
|
||||
}
|
||||
result
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ private[sbt] object FastTrackCommands {
|
|||
case l => None
|
||||
}
|
||||
private val commands = Map[String, (State, String) => Option[State]](
|
||||
FailureWall -> { case (s, c) => if (c == FailureWall) Some(s) else None },
|
||||
FailureWall -> { (s, c) => if (c == FailureWall) Some(s) else None },
|
||||
StashOnFailure -> fromCommand(StashOnFailure, stashOnFailure, arguments = false),
|
||||
PopOnFailure -> fromCommand(PopOnFailure, popOnFailure, arguments = false),
|
||||
Shell -> fromCommand(Shell, shell),
|
||||
|
|
|
|||
|
|
@ -126,14 +126,14 @@ private[sbt] object TestStatus:
|
|||
val props = Properties()
|
||||
IO.load(props, f)
|
||||
val result = ConcurrentHashMap[String, Digest]()
|
||||
props.asScala.iterator.foreach { case (k, v) => result.put(k, Digest(v)) }
|
||||
props.asScala.iterator.foreach { (k, v) => result.put(k, Digest(v)) }
|
||||
result.asScala
|
||||
|
||||
def write(map: collection.Map[String, Digest], label: String, f: File): Unit =
|
||||
IO.writeLines(
|
||||
f,
|
||||
s"# $label" ::
|
||||
map.toList.sortBy(_._1).map { case (k, v) =>
|
||||
map.toList.sortBy(_._1).map { (k, v) =>
|
||||
s"$k=$v"
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ object Inspect {
|
|||
}
|
||||
|
||||
def commandHandler(s: State, mode: Mode): Parser[() => String] = {
|
||||
Space ~> commandParser(s).flatMap { case (name, cmd) =>
|
||||
Space ~> commandParser(s).flatMap { (name, cmd) =>
|
||||
cmd.tags.get(BasicCommands.CommandAliasKey) match {
|
||||
case Some((_, aliasFor)) =>
|
||||
def header = s"Alias for: $aliasFor"
|
||||
|
|
|
|||
|
|
@ -51,6 +51,6 @@ private[internal] final class JarClassPath(val jars: Seq[File]) {
|
|||
* This is a stricter equality requirement than equals that we can use for cache invalidation.
|
||||
*/
|
||||
private[internal] def strictEquals(that: JarClassPath): Boolean = {
|
||||
this.equals(that) && !this.snapshots.view.zip(that.snapshots).exists { case (l, r) => l != r }
|
||||
this.equals(that) && !this.snapshots.view.zip(that.snapshots).exists { (l, r) => l != r }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -302,30 +302,30 @@ private[sbt] object LibraryManagement {
|
|||
Keys.sourceArtifactTypes.toTaskable,
|
||||
Keys.docArtifactTypes.toTaskable,
|
||||
).mapN {
|
||||
case (
|
||||
lm,
|
||||
state0,
|
||||
s,
|
||||
conf,
|
||||
maybeUpdateLevel,
|
||||
er,
|
||||
rs,
|
||||
fup,
|
||||
im,
|
||||
ucn,
|
||||
thisRef,
|
||||
sk,
|
||||
tu,
|
||||
uwConfig,
|
||||
mavenStyle,
|
||||
cwo,
|
||||
ivySbt0,
|
||||
mod,
|
||||
dcd,
|
||||
app,
|
||||
srcTypes,
|
||||
docTypes,
|
||||
) =>
|
||||
(
|
||||
lm,
|
||||
state0,
|
||||
s,
|
||||
conf,
|
||||
maybeUpdateLevel,
|
||||
er,
|
||||
rs,
|
||||
fup,
|
||||
im,
|
||||
ucn,
|
||||
thisRef,
|
||||
sk,
|
||||
tu,
|
||||
uwConfig,
|
||||
mavenStyle,
|
||||
cwo,
|
||||
ivySbt0,
|
||||
mod,
|
||||
dcd,
|
||||
app,
|
||||
srcTypes,
|
||||
docTypes,
|
||||
) =>
|
||||
import Keys.*
|
||||
val cacheDirectory = s.cacheDirectory
|
||||
val isRoot = er.contains(rs)
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ private[sbt] object Load {
|
|||
val dups = overlappingTargets(allTargets(data))
|
||||
if (dups.isEmpty) None
|
||||
else {
|
||||
val dupStr = dups.map { case (dir, scopes) =>
|
||||
val dupStr = dups.map { (dir, scopes) =>
|
||||
s"${dir.getAbsolutePath}:\n\t${scopes.mkString("\n\t")}"
|
||||
}.mkString
|
||||
Some(s"Overlapping output directories:$dupStr")
|
||||
|
|
@ -380,7 +380,7 @@ private[sbt] object Load {
|
|||
val scopedKeys = keys ++ data.keys
|
||||
val projectsMap = projects.view.mapValues(_.defined.keySet).toMap
|
||||
val configsMap: Map[String, Seq[Configuration]] =
|
||||
projects.values.flatMap(bu => bu.defined map { case (k, v) => (k, v.configurations) }).toMap
|
||||
projects.values.flatMap(bu => bu.defined map { (k, v) => (k, v.configurations) }).toMap
|
||||
val keyIndex = KeyIndex(scopedKeys, projectsMap, configsMap)
|
||||
val aggIndex = KeyIndex.aggregate(scopedKeys, extra(keyIndex), projectsMap, configsMap)
|
||||
new StructureIndex(
|
||||
|
|
@ -432,9 +432,9 @@ private[sbt] object Load {
|
|||
(((GlobalScope / loadedBuild) :== loaded) +:
|
||||
transformProjectOnly(loaded.root, rootProject, injectSettings.global)) ++
|
||||
inScope(GlobalScope)(loaded.autos.globalSettings) ++
|
||||
loaded.units.toSeq.flatMap { case (uri, build) =>
|
||||
loaded.units.toSeq.flatMap { (uri, build) =>
|
||||
val pluginBuildSettings = loaded.autos.buildSettings(uri)
|
||||
val projectSettings = build.defined flatMap { case (id, project) =>
|
||||
val projectSettings = build.defined flatMap { (id, project) =>
|
||||
val ref = ProjectRef(uri, id)
|
||||
val defineConfig: Seq[Setting[?]] =
|
||||
for (c <- project.configurations)
|
||||
|
|
@ -667,7 +667,7 @@ private[sbt] object Load {
|
|||
|
||||
def resolveAll(builds: Map[URI, PartBuildUnit]): Map[URI, LoadedBuildUnit] = {
|
||||
val rootProject = getRootProject(builds)
|
||||
builds map { case (uri, unit) =>
|
||||
builds map { (uri, unit) =>
|
||||
(uri, unit.resolveRefs(ref => Scope.resolveProjectRef(uri, rootProject, ref)))
|
||||
}
|
||||
}
|
||||
|
|
@ -706,7 +706,7 @@ private[sbt] object Load {
|
|||
|
||||
def resolveProjects(loaded: PartBuild): LoadedBuild = {
|
||||
val rootProject = getRootProject(loaded.units)
|
||||
val units = loaded.units map { case (uri, unit) =>
|
||||
val units = loaded.units map { (uri, unit) =>
|
||||
IO.assertAbsolute(uri)
|
||||
(uri, resolveProjects(uri, unit, rootProject))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,9 +56,8 @@ object PluginDiscovery:
|
|||
"sbt.plugins.MiniDependencyTreePlugin" -> sbt.plugins.MiniDependencyTreePlugin,
|
||||
)
|
||||
val detectedAutoPlugins = discover[AutoPlugin](AutoPlugins)
|
||||
val allAutoPlugins = (defaultAutoPlugins ++ detectedAutoPlugins.modules) map {
|
||||
case (name, value) =>
|
||||
DetectedAutoPlugin(name, value, sbt.Plugins.hasAutoImportGetter(value, loader))
|
||||
val allAutoPlugins = (defaultAutoPlugins ++ detectedAutoPlugins.modules) map { (name, value) =>
|
||||
DetectedAutoPlugin(name, value, sbt.Plugins.hasAutoImportGetter(value, loader))
|
||||
}
|
||||
new DetectedPlugins(allAutoPlugins, discover[BuildDef](Builds))
|
||||
}
|
||||
|
|
@ -186,7 +185,7 @@ object PluginDiscovery:
|
|||
val evictedModules = evicted.map { id =>
|
||||
(id.organization, id.name)
|
||||
}.distinct
|
||||
val evictedStrings = evictedModules map { case (o, n) => o + ":" + n }
|
||||
val evictedStrings = evictedModules map { (o, n) => o + ":" + n }
|
||||
val msgBase = "Binary incompatibility in plugins detected."
|
||||
val msgExtra =
|
||||
if (evictedStrings.isEmpty) ""
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ private[sbt] class PluginsDebug(
|
|||
val possibleString =
|
||||
if (explained.lengthCompare(1) > 0)
|
||||
explained.zipWithIndex
|
||||
.map { case (s, i) => s"$i. $s" }
|
||||
.map { (s, i) => s"$i. $s" }
|
||||
.mkString(s"Multiple plugins are available that can provide $notFoundKey:\n", "\n", "")
|
||||
else
|
||||
s"$notFoundKey is provided by an available (but not activated) plugin:\n${explained.mkString}"
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ object ProjectQuery:
|
|||
token("@scalaBinaryVersion=" ~> StringBasic.map((scalaBinaryVersion.key, _)))
|
||||
.examples("@scalaBinaryVersion=3")
|
||||
.?)
|
||||
.map { case (proj, params) =>
|
||||
.map { (proj, params) =>
|
||||
ProjectQuery(proj, params.toMap)
|
||||
}
|
||||
.filter(
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ object SessionSettings:
|
|||
|
||||
def removeRanges[T](in: Seq[T], ranges: Seq[(Int, Int)]): Seq[T] = {
|
||||
val asSet = ranges.foldLeft(Set.empty[Int]) { case (s, (hi, lo)) => s ++ (hi to lo) }
|
||||
in.zipWithIndex.flatMap { case (t, index) => if (asSet(index + 1)) Nil else t :: Nil }
|
||||
in.zipWithIndex.flatMap { (t, index) => if (asSet(index + 1)) Nil else t :: Nil }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ private[sbt] object SettingCompletions {
|
|||
context: ResolvedProject,
|
||||
): Parser[String] = {
|
||||
val keyMap: Map[String, AttributeKey[?]] =
|
||||
rawKeyMap.map { case (k, v) => (keyScalaID(k), v) }.toMap
|
||||
rawKeyMap.map { (k, v) => (keyScalaID(k), v) }.toMap
|
||||
val full = for {
|
||||
defineKey <- scopedKeyParser(keyMap, settings, context)
|
||||
a <- assign(defineKey)
|
||||
|
|
@ -239,7 +239,7 @@ private[sbt] object SettingCompletions {
|
|||
)
|
||||
val taskParser =
|
||||
axisParser[AttributeKey[?]](_.task, k => keyScalaID(k.label), _.description, "task")
|
||||
val nonGlobal = (configParser ~ taskParser) map { case (c, t) => Scope(This, c, t, Zero) }
|
||||
val nonGlobal = (configParser ~ taskParser) map { (c, t) => Scope(This, c, t, Zero) }
|
||||
val global = inParser ~> token((Space ~ GlobalID) ^^^ Global)
|
||||
global | nonGlobal
|
||||
}
|
||||
|
|
@ -272,7 +272,7 @@ private[sbt] object SettingCompletions {
|
|||
|
||||
/** Produce a new parser that allows the input accepted by `p` to be quoted in backticks. */
|
||||
def optionallyQuoted[T](p: Parser[T]): Parser[T] =
|
||||
(Backtick.? ~ p) flatMap { case (quote, id) =>
|
||||
(Backtick.? ~ p) flatMap { (quote, id) =>
|
||||
if (quote.isDefined) Backtick.? ^^^ id else success(id)
|
||||
}
|
||||
|
||||
|
|
@ -316,7 +316,7 @@ private[sbt] object SettingCompletions {
|
|||
description: T => Option[String]
|
||||
)(prominent: (String, T) => Boolean): Seq[Completion] = {
|
||||
val applicable = all.toSeq.filter { case (k, _) => k.startsWith(seen) }
|
||||
val prominentOnly = applicable filter { case (k, v) => prominent(k, v) }
|
||||
val prominentOnly = applicable filter { (k, v) => prominent(k, v) }
|
||||
|
||||
val showAll = (level >= 3) || (level == 2 && prominentOnly.lengthCompare(
|
||||
detailLimit
|
||||
|
|
@ -331,7 +331,7 @@ private[sbt] object SettingCompletions {
|
|||
def appendString(id: String): String = id.stripPrefix(seen) + " "
|
||||
if (in.isEmpty) Nil
|
||||
else if (showDescriptions) {
|
||||
val withDescriptions = in map { case (id, key) => (id, description(key)) }
|
||||
val withDescriptions = in map { (id, key) => (id, description(key)) }
|
||||
val padded = CommandUtil.aligned("", " ", withDescriptions)
|
||||
padded.lazyZip(in).map { case (line, (id, _)) =>
|
||||
Completion.tokenDisplay(append = appendString(id), display = line + "\n")
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ private[sbt] class TaskProgress(
|
|||
if (tasks.nonEmpty) nextReport.set(Deadline.now + sleepDuration)
|
||||
val toWrite = tasks.sortBy(_._2)
|
||||
val distinct = new java.util.LinkedHashMap[String, ProgressItem]
|
||||
toWrite.foreach { case (task, elapsed) =>
|
||||
toWrite.foreach { (task, elapsed) =>
|
||||
val name = taskName(task)
|
||||
distinct.put(name, ProgressItem(name, elapsed))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,14 +68,14 @@ private[sbt] final class TaskTimings(reportOnShutdown: Boolean, logger: Logger)
|
|||
val times = timingsByName.toSeq
|
||||
.sortBy(_._2.get)
|
||||
.reverse
|
||||
.map { case (name, time) =>
|
||||
.map { (name, time) =>
|
||||
(if (omitPaths) reFilePath.replaceFirstIn(name, "") else name, divide(time.get))
|
||||
}
|
||||
.filter { _._2 > threshold }
|
||||
if (times.size > 0) {
|
||||
val maxTaskNameLength = times.map { _._1.length }.max
|
||||
val maxTime = times.map { _._2 }.max.toString.length
|
||||
times.foreach { case (taskName, time) =>
|
||||
times.foreach { (taskName, time) =>
|
||||
logger.info(s" ${taskName.padTo(maxTaskNameLength, ' ')}: ${""
|
||||
.padTo(maxTime - time.toString.length, ' ')}$time $unit")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ private[sbt] object WatchTransitiveDependencies {
|
|||
}).toTaskable,
|
||||
(scopedKey.scope / internalDependencyConfigurations).toTaskable,
|
||||
state,
|
||||
).mapN { case (log, configs, st) =>
|
||||
).mapN { (log, configs, st) =>
|
||||
new Arguments(
|
||||
scopedKey,
|
||||
extracted,
|
||||
|
|
@ -90,7 +90,7 @@ private[sbt] object WatchTransitiveDependencies {
|
|||
val rs = Keys.resolvedScoped.value
|
||||
(extracted, compiledMap, st, rs)
|
||||
}
|
||||
.flatMapTask { case (extracted, compiledMap, st, rs) =>
|
||||
.flatMapTask { (extracted, compiledMap, st, rs) =>
|
||||
st.currentCommand.get.commandLine match
|
||||
case ShowTransitive(key) =>
|
||||
Parser.parse(key.trim, Act.scopedKeyParser(st)) match
|
||||
|
|
@ -202,7 +202,7 @@ private[sbt] object WatchTransitiveDependencies {
|
|||
.map { task =>
|
||||
val zeroedTaskScope = key.scope.copy(task = Zero)
|
||||
val transitiveKeys = arguments.dependencyConfigurations.flatMap {
|
||||
case (p, configs) =>
|
||||
(p, configs) =>
|
||||
configs.map(c =>
|
||||
ScopedKey(zeroedTaskScope.rescope(p).rescope(ConfigKey(c)), task)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ private[sbt] case class ModuleGraph(nodes: Seq[Module], edges: Seq[Edge]) {
|
|||
createMap(identity)
|
||||
|
||||
lazy val reverseDependencyMap: Map[GraphModuleId, Seq[Module]] =
|
||||
createMap { case (a, b) => (b, a) }
|
||||
createMap { (a, b) => (b, a) }
|
||||
|
||||
def createMap(
|
||||
bindingFor: ((GraphModuleId, GraphModuleId)) => (GraphModuleId, GraphModuleId)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ object LicenseInfo {
|
|||
.groupBy(_.license)
|
||||
.toSeq
|
||||
.sortBy(_._1)
|
||||
.map { case (license, modules) =>
|
||||
.map { (license, modules) =>
|
||||
license.getOrElse("No license specified") + "\n" +
|
||||
modules.map(m => s"\t ${m.id.idString}").mkString("\n")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ object IvyXml {
|
|||
new PrefixedAttribute("e", k, v, acc)
|
||||
}
|
||||
|
||||
val licenseElems = project.info.licenses.map { case (name, urlOpt) =>
|
||||
val licenseElems = project.info.licenses.map { (name, urlOpt) =>
|
||||
val n = <license name={name} />
|
||||
|
||||
urlOpt.fold(n) { url =>
|
||||
|
|
@ -133,7 +133,7 @@ object IvyXml {
|
|||
.view
|
||||
.mapValues { _.map { case (cfg, _) => cfg } }
|
||||
|
||||
val publicationElems = publications.map { case (pub, configs) =>
|
||||
val publicationElems = publications.map { (pub, configs) =>
|
||||
val n =
|
||||
<artifact name={pub.name} type={pub.`type`.value} ext={pub.ext.value} conf={
|
||||
configs.map(_.value).mkString(",")
|
||||
|
|
@ -145,7 +145,7 @@ object IvyXml {
|
|||
n
|
||||
}
|
||||
|
||||
val dependencyElems = project.dependencies.toVector.map { case (conf, dep) =>
|
||||
val dependencyElems = project.dependencies.toVector.map { (conf, dep) =>
|
||||
val classifier = {
|
||||
val pub = dep.publication
|
||||
if (pub.classifier.value.nonEmpty)
|
||||
|
|
@ -160,7 +160,7 @@ object IvyXml {
|
|||
Seq.empty
|
||||
}
|
||||
|
||||
val excludes = dep.exclusions.toSeq.map { case (org, name) =>
|
||||
val excludes = dep.exclusions.toSeq.map { (org, name) =>
|
||||
<exclude org={org.value} module={
|
||||
name.value
|
||||
} name="*" type="*" ext="*" conf="" matcher="exact"/>
|
||||
|
|
|
|||
|
|
@ -106,13 +106,13 @@ object BuildServerProtocol {
|
|||
val workspace = Keys.bspFullWorkspace.value
|
||||
val state = Keys.state.value
|
||||
val allTargets = ScopeFilter.in(workspace.scopes.values.toSeq)
|
||||
val sbtTargets = workspace.builds.map { case (buildTargetIdentifier, loadedBuildUnit) =>
|
||||
val sbtTargets = workspace.builds.map { (buildTargetIdentifier, loadedBuildUnit) =>
|
||||
val buildFor = workspace.buildToScope.getOrElse(buildTargetIdentifier, Nil)
|
||||
sbtBuildTarget(loadedBuildUnit, buildTargetIdentifier, buildFor).result
|
||||
}.toList
|
||||
(workspace, state, allTargets, sbtTargets)
|
||||
}
|
||||
.flatMapTask { case (workspace, state, allTargets, sbtTargets) =>
|
||||
.flatMapTask { (workspace, state, allTargets, sbtTargets) =>
|
||||
Def.task {
|
||||
val buildTargets = Keys.bspBuildTarget.result.all(allTargets).value
|
||||
val successfulBuildTargets = anyOrThrow(buildTargets ++ sbtTargets.join.value)
|
||||
|
|
@ -124,7 +124,7 @@ object BuildServerProtocol {
|
|||
// https://github.com/build-server-protocol/build-server-protocol/blob/master/docs/specification.md#build-target-sources-request
|
||||
bspBuildTargetSources := bspInputTask { (workspace, filter) =>
|
||||
val items = bspBuildTargetSourcesItem.result.all(filter).value
|
||||
val buildItems = workspace.builds.map { case (id, loadedBuildUnit) =>
|
||||
val buildItems = workspace.builds.map { (id, loadedBuildUnit) =>
|
||||
val base = loadedBuildUnit.localBase
|
||||
val sbtFiles = configurationSources(base)
|
||||
val pluginData = loadedBuildUnit.unit.plugins.pluginData
|
||||
|
|
@ -223,7 +223,7 @@ object BuildServerProtocol {
|
|||
val items = bspBuildTargetJavacOptionsItem.result.all(filter).value
|
||||
val appProvider = appConfiguration.value.provider()
|
||||
val sbtJars = appProvider.mainClasspath()
|
||||
val buildItems = workspace.builds.map { case (targetId, build) =>
|
||||
val buildItems = workspace.builds.map { (targetId, build) =>
|
||||
Result.Value(javacOptionsBuildItem(sbtJars, targetId, build))
|
||||
}
|
||||
val successfulItems = anyOrThrow(items ++ buildItems)
|
||||
|
|
@ -669,15 +669,15 @@ object BuildServerProtocol {
|
|||
)
|
||||
}
|
||||
.flatMapTask {
|
||||
case (
|
||||
buildTargetIdentifier,
|
||||
displayName,
|
||||
baseDirectory,
|
||||
tags,
|
||||
capabilities,
|
||||
projectDependencies,
|
||||
compileData
|
||||
) =>
|
||||
(
|
||||
buildTargetIdentifier,
|
||||
displayName,
|
||||
baseDirectory,
|
||||
tags,
|
||||
capabilities,
|
||||
projectDependencies,
|
||||
compileData
|
||||
) =>
|
||||
Def.task {
|
||||
BuildTarget(
|
||||
buildTargetIdentifier,
|
||||
|
|
@ -806,13 +806,13 @@ object BuildServerProtocol {
|
|||
)
|
||||
}
|
||||
.flatMapTask {
|
||||
case (
|
||||
target,
|
||||
scalacOptions,
|
||||
classDirectory,
|
||||
externalDependencyClasspath,
|
||||
internalDependencyClasspath
|
||||
) =>
|
||||
(
|
||||
target,
|
||||
scalacOptions,
|
||||
classDirectory,
|
||||
externalDependencyClasspath,
|
||||
internalDependencyClasspath
|
||||
) =>
|
||||
Def.task {
|
||||
val converter = fileConverter.value
|
||||
val cp0 = internalDependencyClasspath.join.value.distinct ++
|
||||
|
|
@ -893,7 +893,7 @@ object BuildServerProtocol {
|
|||
)
|
||||
case Success(value) =>
|
||||
value.withEnvironmentVariables(
|
||||
envVars.value.map { case (k, v) => s"$k=$v" }.toVector ++ value.environmentVariables
|
||||
envVars.value.map { (k, v) => s"$k=$v" }.toVector ++ value.environmentVariables
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -913,7 +913,7 @@ object BuildServerProtocol {
|
|||
),
|
||||
runParams.arguments,
|
||||
defaultJvmOptions.toVector,
|
||||
envVars.value.map { case (k, v) => s"$k=$v" }.toVector
|
||||
envVars.value.map { (k, v) => s"$k=$v" }.toVector
|
||||
)
|
||||
}
|
||||
runMainClassTask(mainClass, runParams.originId)
|
||||
|
|
@ -1000,7 +1000,7 @@ object BuildServerProtocol {
|
|||
private def internalDependencyConfigurationsSetting = Def.settingDyn {
|
||||
val allScopes = bspFullWorkspace.value.scopes.map { case (_, scope) => scope }.toSet
|
||||
val directDependencies = Keys.internalDependencyConfigurations.value
|
||||
.map { case (project, rawConfigs) =>
|
||||
.map { (project, rawConfigs) =>
|
||||
val configs = rawConfigs
|
||||
.flatMap(_.split(","))
|
||||
.map(name => ConfigKey(name.trim))
|
||||
|
|
@ -1042,7 +1042,7 @@ object BuildServerProtocol {
|
|||
|
||||
val grouped = TestFramework.testMap(frameworks, definitions)
|
||||
|
||||
grouped.map { case (framework, definitions) =>
|
||||
grouped.map { (framework, definitions) =>
|
||||
ScalaTestClassesItem(
|
||||
bspTargetIdentifier.value,
|
||||
definitions.map(_.name).toVector,
|
||||
|
|
@ -1059,7 +1059,7 @@ object BuildServerProtocol {
|
|||
_,
|
||||
Vector(),
|
||||
jvmOptions,
|
||||
envVars.value.map { case (k, v) => s"$k=$v" }.toVector
|
||||
envVars.value.map { (k, v) => s"$k=$v" }.toVector
|
||||
)
|
||||
)
|
||||
ScalaMainClassesItem(
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ private[sbt] object Definition {
|
|||
val whiteSpaceReg = "(\\s|\\.)+".r
|
||||
|
||||
val (zero, end) = fold(Seq.empty)(whiteSpaceReg.findAllIn(line))
|
||||
.collect { case (white, ind) =>
|
||||
.collect { (white, ind) =>
|
||||
(ind, ind + white.length)
|
||||
}
|
||||
.fold((0, line.length)) { case ((left, right), (from, to)) =>
|
||||
|
|
@ -85,7 +85,7 @@ private[sbt] object Definition {
|
|||
} yield (from -> to)
|
||||
|
||||
ranges
|
||||
.sortBy { case (from, to) => -(to - from) }
|
||||
.sortBy { (from, to) => -(to - from) }
|
||||
.foldLeft(List.empty[String]) { case (z, (from, to)) =>
|
||||
val fragment = line.slice(from, to).trim
|
||||
if (isIdentifier(fragment))
|
||||
|
|
@ -134,7 +134,7 @@ private[sbt] object Definition {
|
|||
.flatMap { reg =>
|
||||
fold(Seq.empty)(reg.findAllIn(line))
|
||||
}
|
||||
.collect { case (name, pos) =>
|
||||
.collect { (name, pos) =>
|
||||
(if (name.endsWith("[")) name.init.trim else name.trim) -> pos
|
||||
}
|
||||
}
|
||||
|
|
@ -146,9 +146,9 @@ private[sbt] object Definition {
|
|||
.iterator
|
||||
.asScala
|
||||
.zipWithIndex
|
||||
.flatMap { case (line, lineNumber) =>
|
||||
.flatMap { (line, lineNumber) =>
|
||||
findInLine(line)
|
||||
.collect { case (sym, from) =>
|
||||
.collect { (sym, from) =>
|
||||
(file.toUri, lineNumber.toLong, from.toLong, from.toLong + sym.length)
|
||||
}
|
||||
}
|
||||
|
|
@ -294,7 +294,7 @@ private[sbt] object Definition {
|
|||
}
|
||||
.flatMap { (classFile: VirtualFileRef) =>
|
||||
val x = converter.toPath(classFile)
|
||||
textProcessor.markPosition(x, sym).collect { case (uri, line, from, to) =>
|
||||
textProcessor.markPosition(x, sym).collect { (uri, line, from, to) =>
|
||||
Location(
|
||||
uri.toString,
|
||||
Range(Position(line, from), Position(line, to)),
|
||||
|
|
|
|||
|
|
@ -200,16 +200,16 @@ final class NetworkChannel(
|
|||
}
|
||||
|
||||
lazy val onRequestMessage: PartialFunction[JsonRpcRequestMessage, Unit] =
|
||||
intents.foldLeft(PartialFunction.empty[JsonRpcRequestMessage, Unit]) { case (f, i) =>
|
||||
intents.foldLeft(PartialFunction.empty[JsonRpcRequestMessage, Unit]) { (f, i) =>
|
||||
f orElse i.onRequest
|
||||
}
|
||||
lazy val onResponseMessage: PartialFunction[JsonRpcResponseMessage, Unit] =
|
||||
intents.foldLeft(PartialFunction.empty[JsonRpcResponseMessage, Unit]) { case (f, i) =>
|
||||
intents.foldLeft(PartialFunction.empty[JsonRpcResponseMessage, Unit]) { (f, i) =>
|
||||
f orElse i.onResponse
|
||||
}
|
||||
|
||||
lazy val onNotification: PartialFunction[JsonRpcNotificationMessage, Unit] =
|
||||
intents.foldLeft(PartialFunction.empty[JsonRpcNotificationMessage, Unit]) { case (f, i) =>
|
||||
intents.foldLeft(PartialFunction.empty[JsonRpcNotificationMessage, Unit]) { (f, i) =>
|
||||
f orElse i.onNotification
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ object FileStamp {
|
|||
new JsonFormat[Seq[(Path, Hash)]] {
|
||||
override def write[J](obj: Seq[(Path, Hash)], builder: Builder[J]): Unit = {
|
||||
builder.beginArray()
|
||||
obj.foreach { case (p, h) =>
|
||||
obj.foreach { (p, h) =>
|
||||
builder.beginArray()
|
||||
builder.writeString(p.toString)
|
||||
builder.writeString(h.hex)
|
||||
|
|
@ -215,7 +215,7 @@ object FileStamp {
|
|||
new JsonFormat[Seq[(Path, LastModified)]] {
|
||||
override def write[J](obj: Seq[(Path, LastModified)], builder: Builder[J]): Unit = {
|
||||
builder.beginArray()
|
||||
obj.foreach { case (p, lm) =>
|
||||
obj.foreach { (p, lm) =>
|
||||
builder.beginArray()
|
||||
builder.writeString(p.toString)
|
||||
builder.writeLong(lm.time)
|
||||
|
|
|
|||
|
|
@ -232,8 +232,10 @@ private[sbt] object Settings {
|
|||
val unmodifiedBuilder = new VectorBuilder[Path]
|
||||
val seen = ConcurrentHashMap.newKeySet[Path]
|
||||
val prevMap = new ConcurrentHashMap[Path, FileStamp]()
|
||||
previous.foreach { case (k, v) => prevMap.put(k, v); () }
|
||||
current.foreach { case (path, currentStamp) =>
|
||||
previous.foreach { (k, v) =>
|
||||
prevMap.put(k, v); ()
|
||||
}
|
||||
current.foreach { (path, currentStamp) =>
|
||||
if (seen.add(path)) {
|
||||
prevMap.remove(path) match {
|
||||
case null => createdBuilder += path
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ object DependencyTreeSettings {
|
|||
output
|
||||
},
|
||||
) ++
|
||||
renderingAlternatives.flatMap { case (key, renderer) => renderingTaskSettings(key, renderer) }
|
||||
renderingAlternatives.flatMap { (key, renderer) => renderingTaskSettings(key, renderer) }
|
||||
|
||||
def renderingAlternatives: Seq[(TaskKey[Unit], ModuleGraph => String)] =
|
||||
Seq(
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ abstract class TestBuild {
|
|||
)
|
||||
lazy val allFullScopes: Seq[Scope] =
|
||||
for {
|
||||
(ref, p) <- (Zero, root.root) +: allProjects.map { case (ref, p) => (Select(ref), p) }
|
||||
(ref, p) <- (Zero, root.root) +: allProjects.map { (ref, p) => (Select(ref), p) }
|
||||
t <- Zero +: tasks.map(t => Select(t.key))
|
||||
c <- Zero +: p.configurations.map(c => Select(ConfigKey(c.name)))
|
||||
} yield Scope(project = ref, config = c, task = t, extra = Zero)
|
||||
|
|
@ -353,7 +353,7 @@ abstract class TestBuild {
|
|||
make: T => Gen[Vector[A] => A]
|
||||
): Gen[Vector[A]] =
|
||||
genAcyclic(maxDeps, keys, Vector()) flatMap { pairs =>
|
||||
sequence(pairs.map { case (key, deps) => mapMake(key, deps, make) }.toList) map { inputs =>
|
||||
sequence(pairs.map { (key, deps) => mapMake(key, deps, make) }.toList) map { inputs =>
|
||||
val made = new collection.mutable.HashMap[T, A]
|
||||
for ((key, deps, mk) <- inputs)
|
||||
made(key) = mk(deps map made)
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ final class Fork(val commandName: String, val runnerClass: Option[String]) {
|
|||
else
|
||||
new JProcessBuilder(command*)
|
||||
workingDirectory.foreach(jpb.directory(_))
|
||||
environment.foreach { case (k, v) => jpb.environment.put(k, v) }
|
||||
environment.foreach { (k, v) => jpb.environment.put(k, v) }
|
||||
if (connectInput) {
|
||||
jpb.redirectInput(Redirect.INHERIT)
|
||||
()
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ object SelectMainClass {
|
|||
@tailrec def loop(): Option[String] = {
|
||||
val header = "\nMultiple main classes detected. Select one to run:\n"
|
||||
val classes = multiple.zipWithIndex
|
||||
.map { case (className, index) => s" [${index + 1}] $className" }
|
||||
.map { (className, index) => s" [${index + 1}] $className" }
|
||||
.mkString("\n")
|
||||
println(ClearScreenAfterCursor + header + classes + "\n")
|
||||
val line = trim(prompt("Enter number: "))
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ object GrpcActionCacheStore:
|
|||
executor.execute: () =>
|
||||
try
|
||||
val headers = Metadata()
|
||||
pairs.foreach { case (k, v) =>
|
||||
pairs.foreach { (k, v) =>
|
||||
headers.put(k, v)
|
||||
}
|
||||
applier.apply(headers)
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ final class ScriptedTests(
|
|||
|
||||
type TestInfo = ((String, String), File)
|
||||
|
||||
val labelsAndDirs = groupAndNameDirs.filterNot(_._2.isFile).map { case (groupDir, nameDir) =>
|
||||
val labelsAndDirs = groupAndNameDirs.filterNot(_._2.isFile).map { (groupDir, nameDir) =>
|
||||
val groupName = groupDir.getName
|
||||
val testName = nameDir.getName
|
||||
val testDirectory = testResources.readOnlyResourceDirectory(groupName, testName)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ object Task:
|
|||
override def pure[A1](a: () => A1): Task[A1] = toTask(a)
|
||||
|
||||
override def ap[A1, A2](ff: Task[A1 => A2])(in: Task[A1]): Task[A2] =
|
||||
multT2Task((in, ff)).mapN { case (x, f) =>
|
||||
multT2Task((in, ff)).mapN { (x, f) =>
|
||||
f(x)
|
||||
}
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue