mirror of https://github.com/sbt/sbt.git
Merge pull request #7508 from adpi2/sbt2-fatal-warnings
[2.x] Fix or mute warnings and other minor changes
This commit is contained in:
commit
5e5610355f
|
|
@ -77,7 +77,7 @@ jobs:
|
|||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: sbt/zinc
|
||||
ref: develop
|
||||
ref: wip/sbt-2.x
|
||||
path: zinc
|
||||
- name: Setup JDK
|
||||
uses: actions/setup-java@v3
|
||||
|
|
@ -104,6 +104,12 @@ jobs:
|
|||
rm -rf "$HOME/.sbt/scripted/" || true
|
||||
rm -rf "$HOME/.ivy2/local" || true
|
||||
rm -r $(find $HOME/.sbt/boot -name "*-SNAPSHOT") || true
|
||||
- name: Publish local Zinc
|
||||
shell: bash
|
||||
run: |
|
||||
./sbt -v lowerUtils/publishLocal
|
||||
cd zinc/
|
||||
sbt publishLocal
|
||||
- name: Build and test (1)
|
||||
if: ${{ matrix.jobtype == 1 }}
|
||||
shell: bash
|
||||
|
|
|
|||
46
build.sbt
46
build.sbt
|
|
@ -55,7 +55,7 @@ Global / excludeLint += scriptedBufferLog
|
|||
Global / excludeLint += checkPluginCross
|
||||
ThisBuild / evictionErrorLevel := Level.Info
|
||||
|
||||
def commonBaseSettings: Seq[Setting[_]] = Def.settings(
|
||||
def commonSettings: Seq[Setting[_]] = Def.settings(
|
||||
headerLicense := Some(
|
||||
HeaderLicense.Custom(
|
||||
"""|sbt
|
||||
|
|
@ -68,7 +68,7 @@ def commonBaseSettings: Seq[Setting[_]] = Def.settings(
|
|||
scalaVersion := baseScalaVersion,
|
||||
componentID := None,
|
||||
resolvers += Resolver.typesafeIvyRepo("releases").withName("typesafe-sbt-build-ivy-releases"),
|
||||
resolvers += Resolver.sonatypeRepo("snapshots"),
|
||||
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
|
||||
testFrameworks += TestFramework("hedgehog.sbt.Framework"),
|
||||
testFrameworks += TestFramework("verify.runner.Framework"),
|
||||
Global / concurrentRestrictions += Util.testExclusiveRestriction,
|
||||
|
|
@ -101,20 +101,15 @@ def commonBaseSettings: Seq[Setting[_]] = Def.settings(
|
|||
Test / publishArtifact := false,
|
||||
run / fork := true,
|
||||
)
|
||||
def commonSettings: Seq[Setting[_]] =
|
||||
commonBaseSettings :+ {
|
||||
libraryDependencies ++= {
|
||||
if (scalaBinaryVersion.value == "3") {
|
||||
Nil
|
||||
} else {
|
||||
Seq(compilerPlugin(kindProjector))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def utilCommonSettings: Seq[Setting[_]] = Def.settings(
|
||||
baseSettings,
|
||||
crossScalaVersions := Seq(scala212, scala213, scala3)
|
||||
crossScalaVersions := Seq(scala212, scala213, scala3),
|
||||
libraryDependencies += Dependencies.scalaCollectionCompat,
|
||||
libraryDependencies ++= {
|
||||
if (scalaBinaryVersion.value == "3") Nil
|
||||
else Seq(compilerPlugin(kindProjector))
|
||||
}
|
||||
)
|
||||
|
||||
def minimalSettings: Seq[Setting[_]] =
|
||||
|
|
@ -258,12 +253,12 @@ lazy val bundledLauncherProj =
|
|||
|
||||
/* ** subproject declarations ** */
|
||||
|
||||
val collectionProj = (project in file("util-collection"))
|
||||
val collectionProj = project
|
||||
.in(file("util-collection"))
|
||||
.dependsOn(utilPosition, utilCore)
|
||||
.settings(
|
||||
name := "Collections",
|
||||
testedBaseSettings,
|
||||
baseSettings,
|
||||
libraryDependencies ++= Seq(sjsonNewScalaJson.value),
|
||||
libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match {
|
||||
case Some((2, major)) if major <= 12 => Seq()
|
||||
|
|
@ -349,7 +344,8 @@ lazy val utilCore = project
|
|||
utilMimaSettings
|
||||
)
|
||||
|
||||
lazy val utilLogging = (project in file("internal") / "util-logging")
|
||||
lazy val utilLogging = project
|
||||
.in(file("internal") / "util-logging")
|
||||
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
|
||||
.dependsOn(utilInterface, utilCore)
|
||||
.settings(
|
||||
|
|
@ -368,10 +364,6 @@ lazy val utilLogging = (project in file("internal") / "util-logging")
|
|||
),
|
||||
libraryDependencies ++= Seq(scalacheck % "test", scalatest % "test"),
|
||||
Compile / generateContrabands / contrabandCodecsDependencies := List(sjsonNewCore.value),
|
||||
Compile / scalacOptions ++= (scalaVersion.value match {
|
||||
case v if v.startsWith("2.12.") => List("-Ywarn-unused:-locals,-explicits,-privates")
|
||||
case _ => List()
|
||||
}),
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
|
|
@ -424,9 +416,9 @@ lazy val utilRelation = (project in file("internal") / "util-relation")
|
|||
)
|
||||
|
||||
// Persisted caching based on sjson-new
|
||||
lazy val utilCache = (project in file("util-cache"))
|
||||
lazy val utilCache = project
|
||||
.in(file("util-cache"))
|
||||
.settings(
|
||||
utilCommonSettings,
|
||||
testedBaseSettings,
|
||||
name := "Util Cache",
|
||||
libraryDependencies ++=
|
||||
|
|
@ -479,7 +471,6 @@ lazy val testingProj = (project in file("testing"))
|
|||
sjsonNewScalaJson.value,
|
||||
sjsonNewCore.value,
|
||||
),
|
||||
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
|
|
@ -576,7 +567,6 @@ lazy val runProj = (project in file("run"))
|
|||
.settings(
|
||||
testedBaseSettings,
|
||||
name := "Run",
|
||||
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
|
|
@ -699,7 +689,6 @@ lazy val protocolProj = (project in file("protocol"))
|
|||
testedBaseSettings,
|
||||
name := "Protocol",
|
||||
libraryDependencies ++= Seq(sjsonNewScalaJson.value, sjsonNewCore.value, ipcSocket),
|
||||
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
|
|
@ -746,7 +735,6 @@ lazy val commandProj = (project in file("main-command"))
|
|||
sjsonNewScalaJson.value,
|
||||
templateResolverApi
|
||||
),
|
||||
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
|
|
@ -908,7 +896,7 @@ lazy val buildFileProj = (project in file("buildfile"))
|
|||
addSbtLmCore,
|
||||
addSbtLmIvy,
|
||||
addSbtCompilerInterface,
|
||||
addSbtZincCompile
|
||||
addSbtZincCompileCore
|
||||
)
|
||||
|
||||
// The main integration project for sbt. It brings all of the projects together, configures them, and provides for overriding conventions.
|
||||
|
|
@ -964,7 +952,7 @@ lazy val mainProj = (project in file("main"))
|
|||
addSbtLmCore,
|
||||
addSbtLmIvy,
|
||||
addSbtCompilerInterface,
|
||||
addSbtZincCompile
|
||||
addSbtZincCompileCore
|
||||
)
|
||||
|
||||
// Strictly for bringing implicits and aliases from subsystems into the top-level sbt namespace through a single package object
|
||||
|
|
@ -1047,7 +1035,7 @@ lazy val sbtClientProj = (project in file("client"))
|
|||
.enablePlugins(NativeImagePlugin)
|
||||
.dependsOn(commandProj)
|
||||
.settings(
|
||||
commonBaseSettings,
|
||||
commonSettings,
|
||||
publish / skip := true,
|
||||
name := "sbt-client",
|
||||
mimaPreviousArtifacts := Set.empty,
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@ package sbt
|
|||
package internal
|
||||
|
||||
import dotty.tools.dotc.ast
|
||||
import dotty.tools.dotc.ast.{ tpd, untpd }
|
||||
import dotty.tools.dotc.ast.tpd
|
||||
import dotty.tools.dotc.CompilationUnit
|
||||
import dotty.tools.dotc.config.ScalaSettings
|
||||
import dotty.tools.dotc.core.Contexts.{ atPhase, Context }
|
||||
import dotty.tools.dotc.core.{ Flags, Names, Phases, Symbols, Types }
|
||||
import dotty.tools.dotc.Driver
|
||||
import dotty.tools.dotc.parsing.Parsers.Parser
|
||||
import dotty.tools.dotc.reporting.Reporter
|
||||
import dotty.tools.dotc.Run
|
||||
import dotty.tools.dotc.util.SourceFile
|
||||
|
|
@ -19,7 +17,7 @@ import java.net.URLClassLoader
|
|||
import java.nio.charset.StandardCharsets
|
||||
import java.nio.file.{ Files, Path, Paths, StandardOpenOption }
|
||||
import java.security.MessageDigest
|
||||
import scala.collection.JavaConverters.*
|
||||
import scala.jdk.CollectionConverters.*
|
||||
import scala.quoted.*
|
||||
import sbt.io.Hash
|
||||
|
||||
|
|
@ -53,7 +51,6 @@ class Eval(
|
|||
case None => EvalReporter.store
|
||||
|
||||
final class EvalDriver extends Driver:
|
||||
import dotty.tools.dotc.config.Settings.Setting._
|
||||
val compileCtx0 = initCtx.fresh
|
||||
val options = nonCpOptions ++ Seq("-classpath", classpathString, "dummy.scala")
|
||||
val compileCtx1 = setup(options.toArray, compileCtx0) match
|
||||
|
|
@ -255,13 +252,13 @@ class Eval(
|
|||
private[this] def getGeneratedFiles(moduleName: String): Seq[Path] =
|
||||
backingDir match
|
||||
case Some(dir) =>
|
||||
asScala(
|
||||
Files
|
||||
.list(dir)
|
||||
.filter(!Files.isDirectory(_))
|
||||
.filter(_.getFileName.toString.contains(moduleName))
|
||||
.iterator
|
||||
).toList
|
||||
Files
|
||||
.list(dir)
|
||||
.filter(!Files.isDirectory(_))
|
||||
.filter(_.getFileName.toString.contains(moduleName))
|
||||
.iterator
|
||||
.asScala
|
||||
.toList
|
||||
case None => Nil
|
||||
|
||||
private[this] def makeModuleName(hash: String): String = "$Wrap" + hash.take(10)
|
||||
|
|
|
|||
|
|
@ -173,24 +173,15 @@ private[sbt] object EvaluateConfigurations {
|
|||
val allGeneratedFiles: Seq[Path] = (definitions.generated ++ dslEntries.flatMap(_.generated))
|
||||
loader => {
|
||||
val projects = {
|
||||
val compositeProjects = definitions.values(loader).collect { case p: CompositeProject =>
|
||||
p
|
||||
}
|
||||
val compositeProjects = definitions
|
||||
.values(loader)
|
||||
.collect { case p: CompositeProject => p }
|
||||
// todo: resolveBase?
|
||||
CompositeProject.expand(compositeProjects) // .map(resolveBase(file.getParentFile, _))
|
||||
}
|
||||
val (settingsRaw, manipulationsRaw) =
|
||||
dslEntries map (_.result apply loader) partition {
|
||||
case DslEntry.ProjectSettings(_) => true
|
||||
case _ => false
|
||||
}
|
||||
val settings = settingsRaw flatMap {
|
||||
case DslEntry.ProjectSettings(settings) => settings
|
||||
case _ => Nil
|
||||
}
|
||||
val manipulations = manipulationsRaw map { case DslEntry.ProjectManipulation(f) =>
|
||||
f
|
||||
}
|
||||
val loadedDslEntries = dslEntries.map(_.result.apply(loader))
|
||||
val settings = loadedDslEntries.collect { case DslEntry.ProjectSettings(s) => s }.flatten
|
||||
val manipulations = loadedDslEntries.collect { case DslEntry.ProjectManipulation(f) => f }
|
||||
// TODO -get project manipulations.
|
||||
new LoadedSbtFile(
|
||||
settings,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ package sbt
|
|||
package internal
|
||||
|
||||
import Def.Setting
|
||||
import java.io.File
|
||||
import java.nio.file.Path
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,12 +16,9 @@ import java.util.concurrent.ConcurrentHashMap
|
|||
import sbt.internal.parser.SbtParser._
|
||||
import dotty.tools.dotc.ast.Trees.Lazy
|
||||
import dotty.tools.dotc.ast.untpd.*
|
||||
import dotty.tools.dotc.CompilationUnit
|
||||
import dotty.tools.dotc.core.Contexts.*
|
||||
import dotty.tools.dotc.Driver
|
||||
import dotty.tools.dotc.util.NoSourcePosition
|
||||
import dotty.tools.dotc.util.SourceFile
|
||||
import dotty.tools.dotc.util.SourcePosition
|
||||
import dotty.tools.io.VirtualDirectory
|
||||
import dotty.tools.io.VirtualFile
|
||||
import dotty.tools.dotc.parsing.*
|
||||
|
|
@ -30,10 +27,7 @@ import dotty.tools.dotc.reporting.Diagnostic
|
|||
import dotty.tools.dotc.reporting.Reporter
|
||||
import dotty.tools.dotc.reporting.StoreReporter
|
||||
import scala.util.Random
|
||||
import scala.util.{ Failure, Success }
|
||||
import xsbti.VirtualFileRef
|
||||
import dotty.tools.dotc.printing.Printer
|
||||
import dotty.tools.dotc.config.Printers
|
||||
|
||||
private[sbt] object SbtParser:
|
||||
val END_OF_LINE_CHAR = '\n'
|
||||
|
|
@ -54,7 +48,7 @@ private[sbt] object SbtParser:
|
|||
""".stripMargin
|
||||
|
||||
private final val defaultClasspath =
|
||||
sbt.io.Path.makeString(sbt.io.IO.classLocationPath[Product].toFile :: Nil)
|
||||
sbt.io.Path.makeString(sbt.io.IO.classLocationPath(classOf[Product]).toFile :: Nil)
|
||||
|
||||
def isIdentifier(ident: String): Boolean =
|
||||
val code = s"val $ident = 0; val ${ident}${ident} = $ident"
|
||||
|
|
@ -164,7 +158,6 @@ private[sbt] object SbtParser:
|
|||
* @return the parsed trees
|
||||
*/
|
||||
private def parse(filePath: String, reporterId: String)(using Context): List[Tree] =
|
||||
import defaultGlobalForParser.*
|
||||
val reporter = globalReporter.getOrCreateReporter(reporterId)
|
||||
reporter.removeBufferedMessages
|
||||
val parser = Parsers.Parser(ctx.source)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ package sbt
|
|||
package internal
|
||||
package parser
|
||||
|
||||
import java.io.File
|
||||
import dotty.tools.dotc.ast.untpd
|
||||
import dotty.tools.dotc.core.Contexts.Context
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ package sbt.internal.parser
|
|||
|
||||
import sbt.internal.util.MessageOnlyException
|
||||
|
||||
/*
|
||||
object EmbeddedXmlSpec extends CheckIfParsedSpec {
|
||||
|
||||
test("File with xml content should Handle last xml part") {
|
||||
|
|
@ -36,7 +35,7 @@ object EmbeddedXmlSpec extends CheckIfParsedSpec {
|
|||
|""".stripMargin
|
||||
|
||||
try {
|
||||
split(buildSbt)
|
||||
splitter(buildSbt)
|
||||
sys.error("expected MessageOnlyException")
|
||||
} catch {
|
||||
case exception: MessageOnlyException =>
|
||||
|
|
@ -163,8 +162,6 @@ object EmbeddedXmlSpec extends CheckIfParsedSpec {
|
|||
|
|
||||
|</aaa>
|
||||
|
|
||||
|
|
||||
|
|
||||
""".stripMargin,
|
||||
"xml with blank line",
|
||||
false,
|
||||
|
|
@ -173,4 +170,3 @@ object EmbeddedXmlSpec extends CheckIfParsedSpec {
|
|||
)
|
||||
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -12,12 +12,9 @@ package parser
|
|||
import sbt.internal.inc.PlainVirtualFileConverter
|
||||
import sbt.internal.parser.SbtRefactorings.SessionSetting
|
||||
|
||||
import java.io.File
|
||||
import java.io.FilenameFilter
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
import scala.io.Source
|
||||
import scala.jdk.CollectionConverters.*
|
||||
|
||||
abstract class AbstractSessionSettingsSpec(folder: String) extends AbstractSpec {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ package sbt
|
|||
package internal
|
||||
package parser
|
||||
|
||||
import java.io.File
|
||||
|
||||
import sbt.internal.util.LineRange
|
||||
import xsbti.VirtualFileRef
|
||||
|
||||
|
|
|
|||
|
|
@ -4,21 +4,18 @@ package util
|
|||
package appmacro
|
||||
|
||||
import scala.collection.mutable.ListBuffer
|
||||
import scala.reflect.{ ClassTag, TypeTest }
|
||||
import scala.reflect.ClassTag
|
||||
import scala.quoted.*
|
||||
import sjsonnew.{ BasicJsonProtocol, HashWriter, JsonFormat }
|
||||
import sbt.util.{
|
||||
ActionCache,
|
||||
ActionCacheStore,
|
||||
Applicative,
|
||||
BuildWideCacheConfiguration,
|
||||
Cache,
|
||||
CacheLevelTag,
|
||||
Digest,
|
||||
Monad,
|
||||
}
|
||||
import xsbti.VirtualFile
|
||||
import Types.Id
|
||||
|
||||
/**
|
||||
* Implementation of a macro that provides a direct syntax for applicative functors and monads. It
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
package sbt.internal.util.appmacro
|
||||
|
||||
import sbt.internal.util.Types.Id
|
||||
import scala.compiletime.summonInline
|
||||
import scala.quoted.*
|
||||
import scala.reflect.TypeTest
|
||||
import scala.collection.mutable
|
||||
import sbt.util.cacheLevel
|
||||
import sbt.util.CacheLevelTag
|
||||
|
||||
trait ContextUtil[C <: Quotes & scala.Singleton](val qctx: C, val valStart: Int):
|
||||
trait ContextUtil[C <: Quotes & scala.Singleton](val valStart: Int):
|
||||
val qctx: C
|
||||
import qctx.reflect.*
|
||||
given qctx.type = qctx
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import scala.quoted.*
|
|||
* code matched using `appTransformer`, which is a generic function with a single type param and a
|
||||
* single term param like `X.wrapInit[A](...)`.
|
||||
*/
|
||||
trait Convert[C <: Quotes & Singleton](override val qctx: C) extends ContextUtil[C]:
|
||||
trait Convert[C <: Quotes & Singleton] extends ContextUtil[C]:
|
||||
import qctx.reflect.*
|
||||
|
||||
def convert[A: Type](nme: String, in: Term): Converted
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import sbt.internal.util.appmacro.*
|
|||
import verify.*
|
||||
import ContTestMacro.*
|
||||
import sbt.util.Applicative
|
||||
import sjsonnew.BasicJsonProtocol
|
||||
|
||||
object ContTest extends BasicTestSuite:
|
||||
test("pure") {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package sbt.internal
|
|||
import sbt.internal.util.Types.Id
|
||||
import sbt.internal.util.appmacro.*
|
||||
import sbt.util.Applicative
|
||||
import sbt.util.{ ActionCacheStore, InMemoryActionCacheStore }
|
||||
import scala.quoted.*
|
||||
import ConvertTestMacro.InputInitConvert
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package sbt.internal
|
||||
|
||||
import sbt.internal.util.appmacro.*
|
||||
import verify.*
|
||||
import ConvertTestMacro._
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ object ConvertTestMacro:
|
|||
convert1.transformWrappers(expr.asTerm, substitute, Symbol.spliceOwner).asExprOf[Boolean]
|
||||
|
||||
class InputInitConvert[C <: Quotes & scala.Singleton](override val qctx: C)
|
||||
extends Convert[C](qctx)
|
||||
with ContextUtil[C](qctx, 0):
|
||||
extends Convert[C]
|
||||
with ContextUtil[C](0):
|
||||
// with TupleBuilder[C](qctx)
|
||||
// with TupleNBuilder[C](qctx):
|
||||
import qctx.reflect.*
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ import org.jline.utils.ClosedException
|
|||
import sbt.internal.util.complete.Parser
|
||||
import sbt.io.syntax._
|
||||
|
||||
import scala.annotation.tailrec
|
||||
import scala.concurrent.duration._
|
||||
import scala.util.control.NonFatal
|
||||
import java.nio.channels.ClosedByInterruptException
|
||||
import java.net.MalformedURLException
|
||||
|
|
|
|||
|
|
@ -60,22 +60,21 @@ sealed case class FixedSetExamples(examples: Iterable[String]) extends ExampleSo
|
|||
* the part of the path already written by the user.
|
||||
*/
|
||||
class FileExamples(base: File, prefix: String = "") extends ExampleSource {
|
||||
override def apply(): Stream[String] = files(base).map(_ substring prefix.length)
|
||||
override def apply(): LazyList[String] = files(base).map(_.substring(prefix.length))
|
||||
|
||||
override def withAddedPrefix(addedPrefix: String): FileExamples =
|
||||
new FileExamples(base, prefix + addedPrefix)
|
||||
|
||||
protected def files(directory: File): Stream[String] = {
|
||||
val childPaths = IO.listFiles(directory).toStream
|
||||
val prefixedDirectChildPaths = childPaths map { IO.relativize(base, _).get } filter {
|
||||
_ startsWith prefix
|
||||
}
|
||||
val dirsToRecurseInto = childPaths filter { _.isDirectory } map {
|
||||
IO.relativize(base, _).get
|
||||
} filter {
|
||||
dirStartsWithPrefix
|
||||
}
|
||||
prefixedDirectChildPaths append dirsToRecurseInto.flatMap(dir => files(new File(base, dir)))
|
||||
protected def files(directory: File): LazyList[String] = {
|
||||
val childPaths = LazyList(IO.listFiles(directory)*)
|
||||
val prefixedDirectChildPaths = childPaths
|
||||
.map(IO.relativize(base, _).get)
|
||||
.filter(_.startsWith(prefix))
|
||||
val dirsToRecurseInto = childPaths
|
||||
.filter(_.isDirectory)
|
||||
.map(IO.relativize(base, _).get)
|
||||
.filter(dirStartsWithPrefix)
|
||||
prefixedDirectChildPaths ++ dirsToRecurseInto.flatMap(dir => files(new File(base, dir)))
|
||||
}
|
||||
|
||||
private def dirStartsWithPrefix(relativizedPath: String): Boolean =
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ object HistoryCommands {
|
|||
val lines = h.lines.toArray
|
||||
command.foreach(lines(lines.length - 1) = _)
|
||||
h.path foreach { h =>
|
||||
IO.writeLines(h, lines)
|
||||
IO.writeLines(h, lines.toSeq)
|
||||
}
|
||||
command.toList.some
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ package complete
|
|||
import jline.console.ConsoleReader
|
||||
import jline.console.completer.{ Completer, CompletionHandler }
|
||||
import scala.annotation.tailrec
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters.*
|
||||
|
||||
object JLineCompletion {
|
||||
def installCustomCompletor(reader: ConsoleReader, parser: Parser[_]): Unit =
|
||||
|
|
@ -57,7 +57,7 @@ object JLineCompletion {
|
|||
// always provides dummy completions so that the custom completion handler gets called
|
||||
// (ConsoleReader doesn't call the handler if there aren't any completions)
|
||||
// the custom handler will then throw away the candidates and call the custom function
|
||||
private[this] final object DummyCompletor extends Completer {
|
||||
private[this] object DummyCompletor extends Completer {
|
||||
override def complete(
|
||||
buffer: String,
|
||||
cursor: Int,
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ object Parser extends ParserMain:
|
|||
case Some(av) => success(f(av))
|
||||
case None =>
|
||||
a match {
|
||||
case m: MapParser[_, A] => m.map(f)
|
||||
case m: MapParser[?, ?] => m.map(f)
|
||||
case _ => new MapParser(a, f)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -373,8 +373,6 @@ object ConsoleAppender {
|
|||
}
|
||||
|
||||
private[sbt] def generateName(): String = "out-" + generateId.incrementAndGet
|
||||
|
||||
private[this] def ansiSupported: Boolean = Terminal.console.isAnsiSupported
|
||||
}
|
||||
|
||||
// See http://stackoverflow.com/questions/24205093/how-to-create-a-custom-appender-in-log4j2
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ object ConsoleOut {
|
|||
def systemOutOverwrite(f: (String, String) => Boolean): ConsoleOut = new ConsoleOut {
|
||||
val lockObject: PrintStream = System.out
|
||||
private[this] var last: Option[String] = None
|
||||
private[this] var current = new java.lang.StringBuffer
|
||||
private[this] val current = new java.lang.StringBuffer
|
||||
def print(s: String): Unit = synchronized { current.append(s); () }
|
||||
def println(s: String): Unit = synchronized { current.append(s); println() }
|
||||
def println(): Unit = synchronized {
|
||||
|
|
@ -128,7 +128,7 @@ object ConsoleOut {
|
|||
case c => c
|
||||
}
|
||||
def printStreamOut(out: PrintStream): ConsoleOut = new ConsoleOut {
|
||||
val lockObject = out
|
||||
val lockObject: AnyRef = out
|
||||
def print(s: String) = out.print(s)
|
||||
def println(s: String) = out.println(s)
|
||||
def println() = out.println()
|
||||
|
|
@ -136,7 +136,7 @@ object ConsoleOut {
|
|||
override def toString: String = s"PrintStreamConsoleOut($out)"
|
||||
}
|
||||
def printWriterOut(out: PrintWriter): ConsoleOut = new ConsoleOut {
|
||||
val lockObject = out
|
||||
val lockObject: AnyRef = out
|
||||
def print(s: String) = out.print(s)
|
||||
def println(s: String) = { out.println(s); flush() }
|
||||
def println() = { out.println(); flush() }
|
||||
|
|
@ -144,7 +144,7 @@ object ConsoleOut {
|
|||
override def toString: String = s"PrintWriterConsoleOut($out)"
|
||||
}
|
||||
def bufferedWriterOut(out: BufferedWriter): ConsoleOut = new ConsoleOut {
|
||||
val lockObject = out
|
||||
val lockObject: AnyRef = out
|
||||
def print(s: String) = out.write(s)
|
||||
def println(s: String) = { out.write(s); println() }
|
||||
def println() = { out.newLine(); flush() }
|
||||
|
|
|
|||
|
|
@ -143,7 +143,6 @@ object EscHelpers {
|
|||
*/
|
||||
def strip(bytes: Array[Byte], stripAnsi: Boolean, stripColor: Boolean): (Array[Byte], Int) = {
|
||||
val res = Array.fill[Byte](bytes.length)(0)
|
||||
var i = 0
|
||||
var index = 0
|
||||
var state = 0
|
||||
var limit = 0
|
||||
|
|
@ -205,7 +204,6 @@ object EscHelpers {
|
|||
def stripColorsAndMoves(s: String): String = {
|
||||
val bytes = s.getBytes
|
||||
val res = Array.fill[Byte](bytes.length)(0)
|
||||
var i = 0
|
||||
var index = 0
|
||||
var state = 0
|
||||
var limit = 0
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import org.jline.terminal.impl.{ AbstractTerminal, DumbTerminal }
|
|||
import org.jline.terminal.impl.jansi.JansiSupportImpl
|
||||
import org.jline.terminal.impl.jansi.win.JansiWinSysTerminal
|
||||
import org.jline.utils.OSUtils
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters.*
|
||||
import scala.util.Try
|
||||
import java.util.concurrent.LinkedBlockingQueue
|
||||
|
||||
|
|
@ -31,8 +31,6 @@ private[sbt] object JLine3 {
|
|||
private[this] val forceWindowsJansiHolder = new AtomicBoolean(false)
|
||||
private[sbt] def forceWindowsJansi(): Unit = forceWindowsJansiHolder.set(true)
|
||||
private[this] def windowsJansi(): org.jline.terminal.Terminal = {
|
||||
val support = new JansiSupportImpl
|
||||
val winConsole = support.isWindowsConsole();
|
||||
val termType = sys.props.get("org.jline.terminal.type").orElse(sys.env.get("TERM")).orNull
|
||||
val term = JansiWinSysTerminal.createTerminal(
|
||||
"console",
|
||||
|
|
@ -220,14 +218,6 @@ private[sbt] object JLine3 {
|
|||
}
|
||||
}
|
||||
}
|
||||
private def enterRawModeImpl(term: JTerminal): Attributes = {
|
||||
val prvAttr = term.getAttributes()
|
||||
val newAttr = new Attributes(prvAttr)
|
||||
newAttr.setLocalFlags(EnumSet.of(LocalFlag.ICANON, LocalFlag.ECHO, LocalFlag.IEXTEN), false)
|
||||
newAttr.setInputFlags(EnumSet.of(InputFlag.IXON, InputFlag.ICRNL, InputFlag.INLCR), false)
|
||||
term.setAttributes(newAttr)
|
||||
prvAttr
|
||||
}
|
||||
// We need to set the ENABLE_PROCESS_INPUT flag for ctrl+c to be treated as a signal in windows
|
||||
// https://docs.microsoft.com/en-us/windows/console/setconsolemode
|
||||
private[this] val ENABLE_PROCESS_INPUT = 1
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import sbt.internal.util.ConsoleAppender.{
|
|||
}
|
||||
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters.*
|
||||
|
||||
private[sbt] final class ProgressState(
|
||||
val progressLines: AtomicReference[Seq[String]],
|
||||
|
|
@ -96,7 +96,7 @@ private[sbt] final class ProgressState(
|
|||
): Unit = {
|
||||
if (hasProgress) {
|
||||
val canClearPrompt = currentLineBytes.get.isEmpty
|
||||
addBytes(terminal, bytes)
|
||||
addBytes(terminal, bytes.toSeq)
|
||||
val toWrite = new ArrayBuffer[Byte]
|
||||
terminal.prompt match {
|
||||
case a: Prompt.AskUser if a.render().nonEmpty && canClearPrompt => toWrite ++= cleanPrompt
|
||||
|
|
@ -107,7 +107,7 @@ private[sbt] final class ProgressState(
|
|||
val parts = new String(bytes, "UTF-8").split(System.lineSeparator)
|
||||
def appendLine(l: String, appendNewline: Boolean): Unit = {
|
||||
toWrite ++= l.getBytes("UTF-8")
|
||||
if (!l.getBytes("UTF-8").endsWith("\r")) toWrite ++= clearScreenBytes
|
||||
if (!l.getBytes("UTF-8").endsWith("\r".getBytes)) toWrite ++= clearScreenBytes
|
||||
if (appendNewline) toWrite ++= lineSeparatorBytes
|
||||
}
|
||||
parts.dropRight(1).foreach(appendLine(_, true))
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
package sbt.internal.util
|
||||
|
||||
import java.util.concurrent.LinkedBlockingQueue
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters.*
|
||||
|
||||
private[sbt] sealed trait Prompt {
|
||||
def mkPrompt: () => String
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ object InterfaceUtil {
|
|||
val get2: A2 = a2
|
||||
override def toString: String = s"ConcreteT2($a1, $a2)"
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case o: ConcreteT2[A1, A2] =>
|
||||
case o: ConcreteT2[?, ?] =>
|
||||
this.get1 == o.get1 &&
|
||||
this.get2 == o.get2
|
||||
case _ => false
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import sbt.internal.util._
|
|||
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters.*
|
||||
|
||||
/**
|
||||
* Provides a context for generating loggers during task evaluation. The logger context can be
|
||||
|
|
|
|||
|
|
@ -13,11 +13,9 @@ import sbt.util._
|
|||
import sbt.internal.util.appmacro.StringTypeTag
|
||||
import java.io.{ File, PrintWriter }
|
||||
import sbt.io.Using
|
||||
import scala.annotation.nowarn
|
||||
|
||||
class ManagedLoggerSpec extends AnyFlatSpec with Matchers {
|
||||
val context = LoggerContext()
|
||||
@nowarn
|
||||
// TODO create a new appender for testing purposes - 3/12/21
|
||||
val asyncStdout = ConsoleAppender()
|
||||
def newLogger(name: String): ManagedLogger = context.logger(name, None, None)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
package sbt.internal.util
|
||||
package logic
|
||||
|
||||
import scala.annotation.{ nowarn, tailrec }
|
||||
import scala.annotation.tailrec
|
||||
import Formula.{ And, True }
|
||||
|
||||
/*
|
||||
|
|
@ -151,7 +151,6 @@ object Logic {
|
|||
if (contradictions.nonEmpty) Some(new InitialContradictions(contradictions)) else None
|
||||
}
|
||||
|
||||
@nowarn
|
||||
private[this] def checkAcyclic(clauses: Clauses): Option[CyclicNegation] = {
|
||||
val deps = dependencyMap(clauses)
|
||||
// println(s"deps = $deps")
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
package sbt.internal.util
|
||||
|
||||
import scala.language.experimental.macros
|
||||
import scala.annotation.tailrec
|
||||
import scala.reflect.macros.blackbox
|
||||
import scala.reflect.internal.util.UndefinedPosition
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
package sbt.internal.util
|
||||
|
||||
import Relation._
|
||||
import scala.collection.compat.*
|
||||
|
||||
object Relation {
|
||||
|
||||
|
|
@ -34,7 +35,7 @@ object Relation {
|
|||
make(forward filter { case (a, bs) => bs.nonEmpty }, reverse)
|
||||
}
|
||||
|
||||
def merge[A, B](rels: Traversable[Relation[A, B]]): Relation[A, B] =
|
||||
def merge[A, B](rels: Iterable[Relation[A, B]]): Relation[A, B] =
|
||||
rels.foldLeft(Relation.empty[A, B])(_ ++ _)
|
||||
|
||||
private[sbt] def remove[X, Y](map: M[X, Y], from: X, to: Y): M[X, Y] =
|
||||
|
|
@ -48,7 +49,7 @@ object Relation {
|
|||
private[sbt] def combine[X, Y](a: M[X, Y], b: M[X, Y]): M[X, Y] =
|
||||
b.foldLeft(a)((map, mapping) => add(map, mapping._1, mapping._2))
|
||||
|
||||
private[sbt] def add[X, Y](map: M[X, Y], from: X, to: Traversable[Y]): M[X, Y] =
|
||||
private[sbt] def add[X, Y](map: M[X, Y], from: X, to: Iterable[Y]): M[X, Y] =
|
||||
map.updated(from, get(map, from) ++ to)
|
||||
|
||||
private[sbt] def get[X, Y](map: M[X, Y], t: X): Set[Y] = map.getOrElse(t, Set.empty[Y])
|
||||
|
|
@ -83,19 +84,19 @@ trait Relation[A, B] {
|
|||
def +(a: A, b: B): Relation[A, B]
|
||||
|
||||
/** Includes in the relation `(a, b)` for all `b` in `bs`. */
|
||||
def +(a: A, bs: Traversable[B]): Relation[A, B]
|
||||
def +(a: A, bs: Iterable[B]): Relation[A, B]
|
||||
|
||||
/** Returns the union of the relation `r` with this relation. */
|
||||
def ++(r: Relation[A, B]): Relation[A, B]
|
||||
|
||||
/** Includes the given pairs in this relation. */
|
||||
def ++(rs: Traversable[(A, B)]): Relation[A, B]
|
||||
def ++(rs: Iterable[(A, B)]): Relation[A, B]
|
||||
|
||||
/** Removes all elements `(_1, _2)` for all `_1` in `_1s` from this relation. */
|
||||
def --(_1s: Traversable[A]): Relation[A, B]
|
||||
def --(_1s: Iterable[A]): Relation[A, B]
|
||||
|
||||
/** Removes all `pairs` from this relation. */
|
||||
def --(pairs: TraversableOnce[(A, B)]): Relation[A, B]
|
||||
def --(pairs: IterableOnce[(A, B)]): Relation[A, B]
|
||||
|
||||
/** Removes all `relations` from this relation. */
|
||||
def --(relations: Relation[A, B]): Relation[A, B]
|
||||
|
|
@ -107,10 +108,10 @@ trait Relation[A, B] {
|
|||
def -(pair: (A, B)): Relation[A, B]
|
||||
|
||||
/** Returns the set of all `_1`s such that `(_1, _2)` is in this relation. */
|
||||
def _1s: collection.Set[A]
|
||||
def _1s: Set[A]
|
||||
|
||||
/** Returns the set of all `_2`s such that `(_1, _2)` is in this relation. */
|
||||
def _2s: collection.Set[B]
|
||||
def _2s: Set[B]
|
||||
|
||||
/** Returns the number of pairs in this relation */
|
||||
def size: Int
|
||||
|
|
@ -131,7 +132,7 @@ trait Relation[A, B] {
|
|||
def groupBy[K](discriminator: ((A, B)) => K): Map[K, Relation[A, B]]
|
||||
|
||||
/** Returns all pairs in this relation. */
|
||||
def all: Traversable[(A, B)]
|
||||
def all: Iterable[(A, B)]
|
||||
|
||||
/**
|
||||
* Represents this relation as a `Map` from a `_1` to the set of `_2`s such that `(_1, _2)` is in
|
||||
|
|
@ -168,22 +169,22 @@ 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: Traversable[(A, B)] =
|
||||
fwd.iterator.flatMap { case (a, bs) => bs.iterator.map(b => (a, b)) }.toTraversable
|
||||
def all: Iterable[(A, B)] =
|
||||
fwd.iterator.flatMap { case (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)
|
||||
def +(from: A, to: Traversable[B]) =
|
||||
def +(from: A, to: Iterable[B]) =
|
||||
if (to.isEmpty) this
|
||||
else new MRelation(add(fwd, from, to), to.foldLeft(rev)((map, t) => add(map, t, from :: Nil)))
|
||||
|
||||
def ++(rs: Traversable[(A, B)]) = rs.foldLeft(this: Relation[A, B]) { _ + _ }
|
||||
def ++(other: Relation[A, B]) =
|
||||
def ++(rs: Iterable[(A, B)]) = rs.foldLeft(this: Relation[A, B]) { _ + _ }
|
||||
def ++(other: Relation[A, B]): Relation[A, B] =
|
||||
new MRelation[A, B](combine(fwd, other.forwardMap), combine(rev, other.reverseMap))
|
||||
|
||||
def --(ts: Traversable[A]): Relation[A, B] = ts.foldLeft(this: Relation[A, B]) { _ - _ }
|
||||
def --(pairs: TraversableOnce[(A, B)]): Relation[A, B] =
|
||||
pairs.foldLeft(this: Relation[A, B])(_ - _)
|
||||
def --(ts: Iterable[A]): Relation[A, B] = ts.foldLeft(this: Relation[A, B]) { _ - _ }
|
||||
def --(pairs: IterableOnce[(A, B)]): Relation[A, B] =
|
||||
pairs.iterator.foldLeft(this: Relation[A, B])(_ - _)
|
||||
def --(relations: Relation[A, B]): Relation[A, B] = --(relations.all)
|
||||
|
||||
def -(pair: (A, B)): Relation[A, B] =
|
||||
|
|
@ -205,14 +206,14 @@ private final class MRelation[A, B](fwd: Map[A, Set[B]], rev: Map[B, Set[A]])
|
|||
}
|
||||
|
||||
def groupBy[K](discriminator: ((A, B)) => K): Map[K, Relation[A, B]] =
|
||||
(all.groupBy(discriminator) mapValues { Relation.empty[A, B] ++ _ }).toMap
|
||||
all.groupBy(discriminator).view.mapValues { Relation.empty[A, B] ++ _ }.toMap
|
||||
|
||||
def contains(a: A, b: B): Boolean = forward(a)(b)
|
||||
|
||||
override def equals(other: Any) = other match {
|
||||
// We assume that the forward and reverse maps are consistent, so we only use the forward map
|
||||
// for equality. Note that key -> Empty is semantically the same as key not existing.
|
||||
case o: MRelation[A, B] =>
|
||||
case o: MRelation[?, ?] =>
|
||||
forwardMap.filterNot(_._2.isEmpty) == o.forwardMap.filterNot(_._2.isEmpty)
|
||||
case _ => false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ package sbt
|
|||
package internal
|
||||
package scripted
|
||||
|
||||
import java.{ util => ju }
|
||||
import java.net.URL
|
||||
|
||||
final class FilteredLoader(parent: ClassLoader) extends ClassLoader(parent) {
|
||||
@throws(classOf[ClassNotFoundException])
|
||||
override final def loadClass(className: String, resolve: Boolean): Class[_] = {
|
||||
|
|
@ -17,6 +20,6 @@ final class FilteredLoader(parent: ClassLoader) extends ClassLoader(parent) {
|
|||
else
|
||||
throw new ClassNotFoundException(className)
|
||||
}
|
||||
override def getResources(name: String) = null
|
||||
override def getResource(name: String) = null
|
||||
override def getResources(name: String): ju.Enumeration[URL] = null
|
||||
override def getResource(name: String): URL = null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ object ScriptedRunnerImpl {
|
|||
val context = LoggerContext()
|
||||
val runner = new ScriptedTests(resourceBaseDirectory, bufferLog, handlersProvider)
|
||||
val logger = newLogger(context)
|
||||
val allTests = get(tests, resourceBaseDirectory, logger) flatMap {
|
||||
val allTests = get(tests.toSeq, resourceBaseDirectory, logger) flatMap {
|
||||
case ScriptedTest(group, name) =>
|
||||
runner.scriptedTest(group, name, logger, context)
|
||||
}
|
||||
|
|
@ -197,7 +197,8 @@ final case class ScriptedTest(group: String, name: String) {
|
|||
}
|
||||
|
||||
object ListTests {
|
||||
def list(directory: File, filter: java.io.FileFilter) = wrapNull(directory.listFiles(filter))
|
||||
def list(directory: File, filter: java.io.FileFilter): Seq[File] =
|
||||
wrapNull(directory.listFiles(filter)).toSeq
|
||||
}
|
||||
import ListTests._
|
||||
final class ListTests(baseDirectory: File, accept: ScriptedTest => Boolean, log: Logger) {
|
||||
|
|
|
|||
|
|
@ -29,5 +29,5 @@ trait BasicStatementHandler extends StatementHandler {
|
|||
|
||||
/** Use when a stack trace is not useful */
|
||||
final class TestFailed(msg: String) extends RuntimeException(msg) {
|
||||
override def fillInStackTrace = this
|
||||
override def fillInStackTrace: Throwable = this
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,8 +157,8 @@ private[sbt] object ForkTests {
|
|||
acceptorThread.start()
|
||||
val cpFiles = classpath.map(converter.toPath).map(_.toFile())
|
||||
val fullCp = cpFiles ++ Seq(
|
||||
IO.classLocationPath[ForkMain].toFile,
|
||||
IO.classLocationPath[Framework].toFile
|
||||
IO.classLocationPath(classOf[ForkMain]).toFile,
|
||||
IO.classLocationPath(classOf[Framework]).toFile,
|
||||
)
|
||||
val options = Seq(
|
||||
"-classpath",
|
||||
|
|
@ -220,10 +220,11 @@ private final class React(
|
|||
case t: Throwable =>
|
||||
log.trace(t); react()
|
||||
case Array(group: String, tEvents: Array[Event]) =>
|
||||
val events = tEvents.toSeq
|
||||
listeners.foreach(_ startGroup group)
|
||||
val event = TestEvent(tEvents)
|
||||
val event = TestEvent(events)
|
||||
listeners.foreach(_ testEvent event)
|
||||
val suiteResult = SuiteResult(tEvents)
|
||||
val suiteResult = SuiteResult(events)
|
||||
results += group -> suiteResult
|
||||
listeners.foreach(_.endGroup(group, suiteResult.result))
|
||||
react()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ package sbt
|
|||
import java.io.File
|
||||
import java.time.OffsetDateTime
|
||||
import java.util.jar.{ Attributes, Manifest }
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters.*
|
||||
import sbt.io.IO
|
||||
|
||||
import sjsonnew.{
|
||||
|
|
@ -26,10 +26,7 @@ import sjsonnew.{
|
|||
}
|
||||
|
||||
import sbt.util.Logger
|
||||
import sbt.util.{ CacheStoreFactory, FilesInfo, ModifiedFileInfo, PlainFileInfo }
|
||||
import sbt.util.FileInfo.{ exists, lastModified }
|
||||
import sbt.util.CacheImplicits._
|
||||
import sbt.util.Tracked.{ inputChanged, outputChanged }
|
||||
import scala.sys.process.Process
|
||||
import xsbti.{ FileConverter, HashedVirtualFileRef, VirtualFile, VirtualFileRef }
|
||||
|
||||
|
|
@ -115,14 +112,13 @@ object Pkg:
|
|||
Vector[(HashedVirtualFileRef, String)] :*: VirtualFileRef :*: Seq[PackageOption] :*: LNil
|
||||
] =
|
||||
import sbt.util.CacheImplicits.given
|
||||
import sbt.util.PathHashWriters.given
|
||||
LList.iso(
|
||||
(c: Configuration) =>
|
||||
("sources", c.sources.toVector) :*: ("jar", c.jar) :*: ("options", c.options) :*: LNil,
|
||||
(in: Vector[(HashedVirtualFileRef, String)] :*: VirtualFileRef :*: Seq[PackageOption] :*:
|
||||
LNil) => Configuration(in.head, in.tail.head, in.tail.tail.head),
|
||||
)
|
||||
given JsonFormat[Configuration] = summon[JsonFormat[Configuration]]
|
||||
given JsonFormat[Configuration] = isolistFormat
|
||||
end Configuration
|
||||
|
||||
/**
|
||||
|
|
@ -158,12 +154,11 @@ object Pkg:
|
|||
val main = manifest.getMainAttributes
|
||||
for option <- conf.options do
|
||||
option match
|
||||
case PackageOption.JarManifest(mergeManifest) => mergeManifests(manifest, mergeManifest); ()
|
||||
case PackageOption.JarManifest(mergeManifest) => mergeManifests(manifest, mergeManifest)
|
||||
case PackageOption.MainClass(mainClassName) =>
|
||||
main.put(Attributes.Name.MAIN_CLASS, mainClassName); ()
|
||||
case PackageOption.ManifestAttributes(attributes @ _*) => main.asScala ++= attributes; ()
|
||||
main.put(Attributes.Name.MAIN_CLASS, mainClassName)
|
||||
case PackageOption.ManifestAttributes(attributes @ _*) => main.asScala ++= attributes
|
||||
case PackageOption.FixedTimestamp(value) => ()
|
||||
case _ => log.warn("Ignored unknown package option " + option)
|
||||
setVersion(main)
|
||||
manifest
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import sbt.internal.io.TranslatedException
|
|||
import sbt.util.CacheImplicits._
|
||||
import sbt.util.{ CacheStore, FileInfo }
|
||||
import sbt.io.IO
|
||||
import sbt.librarymanagement.LibraryManagementCodec
|
||||
import sjsonnew.{
|
||||
Builder,
|
||||
IsoString,
|
||||
|
|
@ -46,19 +45,19 @@ object Sync {
|
|||
store: CacheStore,
|
||||
inStyle: FileInfo.Style = FileInfo.lastModified,
|
||||
outStyle: FileInfo.Style = FileInfo.exists
|
||||
): Traversable[(File, File)] => Relation[File, File] =
|
||||
): Iterable[(File, File)] => Relation[File, File] =
|
||||
sync(store, inStyle)
|
||||
|
||||
def sync(
|
||||
store: CacheStore,
|
||||
fileConverter: FileConverter
|
||||
): Traversable[(File, File)] => Relation[File, File] =
|
||||
): Iterable[(File, File)] => Relation[File, File] =
|
||||
sync(store, FileInfo.lastModified, fileConverter)
|
||||
|
||||
def sync(
|
||||
store: CacheStore,
|
||||
inStyle: FileInfo.Style = FileInfo.lastModified,
|
||||
): Traversable[(File, File)] => Relation[File, File] =
|
||||
): Iterable[(File, File)] => Relation[File, File] =
|
||||
sync(store, inStyle, MappedFileConverter.empty)
|
||||
|
||||
/** this function ensures that the latest files in /src are also in /target, so that they are synchronised */
|
||||
|
|
@ -66,7 +65,7 @@ object Sync {
|
|||
store: CacheStore,
|
||||
inStyle: FileInfo.Style,
|
||||
fileConverter: FileConverter
|
||||
): Traversable[(File, File)] => Relation[File, File] =
|
||||
): Iterable[(File, File)] => Relation[File, File] =
|
||||
mappings => {
|
||||
val relation = Relation.empty ++ mappings
|
||||
noDuplicateTargets(relation)
|
||||
|
|
|
|||
|
|
@ -415,10 +415,8 @@ object Tests {
|
|||
tasks.join.map(_.foldLeft(Map.empty[String, SuiteResult]) { case (sum, e) =>
|
||||
val merged = sum.toSeq ++ e.toSeq
|
||||
val grouped = merged.groupBy(_._1)
|
||||
grouped
|
||||
.mapValues(_.map(_._2).foldLeft(SuiteResult.Empty) { case (resultSum, result) =>
|
||||
resultSum + result
|
||||
})
|
||||
grouped.view
|
||||
.mapValues(_.map(_._2).foldLeft(SuiteResult.Empty)(_ + _))
|
||||
.toMap
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import sbt.internal.inc.ModuleUtilities
|
|||
import sbt.internal.client.NetworkClient
|
||||
import DefaultParsers._
|
||||
|
||||
import Function.tupled
|
||||
import Command.applyEffect
|
||||
import BasicCommandStrings._
|
||||
import CommandUtil._
|
||||
|
|
@ -35,7 +34,6 @@ import BasicKeys._
|
|||
import java.io.File
|
||||
|
||||
import sbt.io.IO
|
||||
import sbt.util.Level
|
||||
|
||||
import scala.Function.tupled
|
||||
import scala.collection.mutable.ListBuffer
|
||||
|
|
@ -491,12 +489,10 @@ object BasicCommands {
|
|||
|
||||
def runAlias(s: State, args: Option[(String, Option[Option[String]])]): State =
|
||||
args match {
|
||||
case None =>
|
||||
printAliases(s); s
|
||||
case Some(x ~ None) if !x.isEmpty =>
|
||||
printAlias(s, x.trim); s
|
||||
case Some(x ~ None) if !x.isEmpty => printAlias(s, x.trim); s
|
||||
case Some(name ~ Some(None)) => removeAlias(s, name.trim)
|
||||
case Some(name ~ Some(Some(value))) => addAlias(s, name.trim, value.trim)
|
||||
case _ => printAliases(s); s
|
||||
}
|
||||
def addAlias(s: State, name: String, value: String): State =
|
||||
if (Command validID name) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import sbt.util.{ ActionCacheStore, Level }
|
|||
import scala.annotation.nowarn
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
import xsbti.VirtualFile
|
||||
import sbt.librarymanagement.Configuration
|
||||
|
||||
object BasicKeys {
|
||||
val historyPath = AttributeKey[Option[File]](
|
||||
|
|
|
|||
|
|
@ -293,6 +293,6 @@ object Help {
|
|||
}
|
||||
|
||||
trait CommandDefinitions extends (State => State) {
|
||||
def commands: Seq[Command] = ReflectUtilities.allVals[Command](this).values.toSeq
|
||||
def commands: Seq[Command] = ReflectUtilities.allValsC(this, classOf[Command]).values.toSeq
|
||||
def apply(s: State): State = s ++ commands
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ object ApplicationID {
|
|||
delegate.name,
|
||||
delegate.version,
|
||||
delegate.mainClass,
|
||||
delegate.mainComponents,
|
||||
delegate.mainComponents.toSeq,
|
||||
delegate.crossVersionedValue,
|
||||
delegate.classpathExtra
|
||||
delegate.classpathExtra.toSeq
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,10 +233,10 @@ object State {
|
|||
final class Return(val result: xsbti.MainResult) extends Next
|
||||
|
||||
/** Indicates that global logging should be rotated. */
|
||||
final object ClearGlobalLog extends Next
|
||||
object ClearGlobalLog extends Next
|
||||
|
||||
/** Indicates that the previous log file should be preserved instead of discarded. */
|
||||
final object KeepLastLog extends Next
|
||||
object KeepLastLog extends Next
|
||||
|
||||
/**
|
||||
* Provides a list of recently executed commands. The commands are stored as processed instead of as entered by the user.
|
||||
|
|
@ -424,7 +424,7 @@ object State {
|
|||
.sameElements(rest.map(_.toURI.toURL)) =>
|
||||
cache.cachedCustomClassloader(
|
||||
jars.toList,
|
||||
() => new UncloseableURLLoader(jars, fullScalaLoader)
|
||||
() => new UncloseableURLLoader(jars.toSeq, fullScalaLoader)
|
||||
)
|
||||
()
|
||||
case _ =>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import sbt.io._
|
|||
|
||||
import scala.concurrent.duration._
|
||||
import scala.util.Properties
|
||||
import scala.annotation.nowarn
|
||||
|
||||
@deprecated("Watched is no longer used to implement continuous execution", "1.3.0")
|
||||
trait Watched {
|
||||
|
|
@ -52,6 +53,8 @@ trait Watched {
|
|||
object Watched {
|
||||
|
||||
type WatchSource = Source
|
||||
|
||||
@nowarn
|
||||
def terminateWatch(key: Int): Boolean = Watched.isEnter(key)
|
||||
|
||||
private def waitMessage(project: String): String =
|
||||
|
|
@ -82,6 +85,7 @@ object Watched {
|
|||
|
||||
}
|
||||
|
||||
@nowarn
|
||||
private[sbt] val newWatchService: () => WatchService =
|
||||
(() => createWatchService()).label("Watched.newWatchService")
|
||||
def createWatchService(pollDelay: FiniteDuration): WatchService = {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import sbt.internal.util.Terminal
|
|||
import sbt.protocol.EventMessage
|
||||
import sbt.util.Level
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters.*
|
||||
|
||||
/**
|
||||
* A command channel represents an IO device such as network socket or human
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import xsbti.ScalaProvider
|
|||
import xsbti.compile.{ ClasspathOptions, ScalaInstance }
|
||||
|
||||
import scala.annotation.tailrec
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters.*
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
private object ClassLoaderCache {
|
||||
|
|
@ -227,7 +227,6 @@ private[sbt] class ClassLoaderCache(
|
|||
case null =>
|
||||
case classLoader => close(classLoader)
|
||||
}
|
||||
case (_, _) =>
|
||||
}
|
||||
delegate.clear()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import java.util.concurrent.atomic.{ AtomicBoolean, AtomicReference }
|
|||
import java.util.concurrent.{ ConcurrentHashMap, LinkedBlockingQueue, TimeUnit }
|
||||
|
||||
import sbt.BasicCommandStrings.{ DashDashDetachStdio, DashDashServer, Shutdown, TerminateAction }
|
||||
import sbt.internal.client.NetworkClient.Arguments
|
||||
import sbt.internal.langserver.{ LogMessageParams, MessageType, PublishDiagnosticsParams }
|
||||
import sbt.internal.protocol._
|
||||
import sbt.internal.util.{ ConsoleAppender, ConsoleOut, Signals, Terminal, Util }
|
||||
|
|
|
|||
|
|
@ -7,11 +7,9 @@
|
|||
|
||||
package sbt
|
||||
|
||||
import java.io.File
|
||||
import java.nio.file.Path
|
||||
import java.net.URI
|
||||
|
||||
import scala.annotation.compileTimeOnly
|
||||
import scala.annotation.tailrec
|
||||
import scala.annotation.targetName
|
||||
import sbt.KeyRanks.{ DTask, Invisible }
|
||||
|
|
@ -19,11 +17,12 @@ import sbt.Scope.{ GlobalScope, ThisScope }
|
|||
import sbt.internal.util.Types.const
|
||||
import sbt.internal.util.complete.Parser
|
||||
import sbt.internal.util.{ Terminal => ITerminal, * }
|
||||
import sbt.util.{ ActionCacheStore, AggregateActionCacheStore, BuildWideCacheConfiguration, InMemoryActionCacheStore }
|
||||
import sbt.util.{ ActionCacheStore, BuildWideCacheConfiguration, InMemoryActionCacheStore }
|
||||
import Util._
|
||||
import sbt.util.Show
|
||||
import xsbti.{ HashedVirtualFileRef, VirtualFile }
|
||||
import sjsonnew.JsonFormat
|
||||
import scala.reflect.ClassTag
|
||||
|
||||
/** A concrete settings system that uses `sbt.Scope` for the scope type. */
|
||||
object Def extends Init[Scope] with TaskMacroExtra with InitializeImplicits:
|
||||
|
|
@ -269,7 +268,7 @@ object Def extends Init[Scope] with TaskMacroExtra with InitializeImplicits:
|
|||
): Initialize[Task[A2]] =
|
||||
fab.zipWith(fin)((ab, in) => TaskExtra.select(ab, in))
|
||||
|
||||
import Scoped.syntax.{ *, given } // { Def => _, DTask => _, Invisible => _, * }
|
||||
import Scoped.syntax.*
|
||||
|
||||
// derived from select
|
||||
private[sbt] def branchS[A, B, C](
|
||||
|
|
@ -396,7 +395,7 @@ object Def extends Init[Scope] with TaskMacroExtra with InitializeImplicits:
|
|||
*/
|
||||
def unit(a: Any): Unit = ()
|
||||
|
||||
private[sbt] def dummy[A: Manifest](name: String, description: String): (TaskKey[A], Task[A]) =
|
||||
private[sbt] def dummy[A: ClassTag](name: String, description: String): (TaskKey[A], Task[A]) =
|
||||
(TaskKey[A](name, description, DTask), dummyTask(name))
|
||||
|
||||
private[sbt] def dummyTask[T](name: String): Task[T] = {
|
||||
|
|
@ -420,11 +419,8 @@ object Def extends Init[Scope] with TaskMacroExtra with InitializeImplicits:
|
|||
private[sbt] val (stateKey: TaskKey[State], dummyState: Task[State]) =
|
||||
dummy[State]("state", "Current build state.")
|
||||
|
||||
private[sbt] val (
|
||||
streamsManagerKey: TaskKey[std.Streams[ScopedKey[_]]],
|
||||
dummyStreamsManager: Task[std.Streams[ScopedKey[_]]]
|
||||
) =
|
||||
Def.dummy[std.Streams[ScopedKey[_]]](
|
||||
private[sbt] val (streamsManagerKey, dummyStreamsManager) =
|
||||
Def.dummy[std.Streams[ScopedKey[?]]](
|
||||
"streams-manager",
|
||||
"Streams manager, which provides streams for different contexts."
|
||||
)
|
||||
|
|
|
|||
|
|
@ -8,11 +8,10 @@
|
|||
package sbt
|
||||
|
||||
import sbt.internal.util.complete.Parser
|
||||
import Def.{ Initialize, ScopedKey }
|
||||
import Def.Initialize
|
||||
import std.TaskExtra._
|
||||
import sbt.internal.util.{ AttributeKey, Types }
|
||||
import sbt.internal.util.Types
|
||||
import sbt.internal.util.Types._
|
||||
import sbt.internal.util.Util._
|
||||
import sbt.util.Applicative
|
||||
|
||||
/** Parses input and produces a task to run. Constructed using the companion object. */
|
||||
|
|
|
|||
|
|
@ -123,10 +123,12 @@ object Previous {
|
|||
|
||||
// We first collect all of the successful tasks and write their scoped key into a map
|
||||
// along with their values.
|
||||
val successfulTaskResults = (for
|
||||
results.TPair(task: Task[?], Result.Value(v)) <- results.toTypedSeq
|
||||
key <- task.info.attributes.get(Def.taskDefinitionKey).asInstanceOf[Option[AnyTaskKey]]
|
||||
yield key -> v).toMap
|
||||
val successfulTaskResults = (
|
||||
for
|
||||
case results.TPair(task: Task[?], Result.Value(v)) <- results.toTypedSeq
|
||||
key <- task.info.attributes.get(Def.taskDefinitionKey).asInstanceOf[Option[AnyTaskKey]]
|
||||
yield key -> v
|
||||
).toMap
|
||||
// We then traverse the successful results and look up all of the referenced values for
|
||||
// each of these tasks. This can be a many to one relationship if multiple tasks refer
|
||||
// the previous value of another task. For each reference we find, we check if the task has
|
||||
|
|
@ -168,8 +170,8 @@ object Previous {
|
|||
.zip(Def.validated(skey, selfRefOk = true))
|
||||
.zip(Global / references)
|
||||
.zip(Def.resolvedScoped)
|
||||
inputs { case (((prevTask, resolved), refs), inTask: ScopedKey[Task[_]] @unchecked) =>
|
||||
val key = Key(resolved, inTask)
|
||||
inputs { case (((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)) // evaluated if this task is evaluated
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ package sbt
|
|||
import java.io.File
|
||||
import java.util.Locale
|
||||
import sbt.librarymanagement.Configuration
|
||||
import sbt.Def.{ Flattened, Initialize, ScopedKey, Setting }
|
||||
import sbt.Def.{ Initialize, ScopedKey, Setting }
|
||||
import sbt.internal.util.Dag
|
||||
import sbt.internal.util.complete.Parser
|
||||
import sbt.internal.util.complete.DefaultParsers
|
||||
import Scope.{ Global, ThisScope }
|
||||
import Scope.ThisScope
|
||||
|
||||
sealed trait ProjectDefinition[PR <: ProjectReference] {
|
||||
|
||||
|
|
|
|||
|
|
@ -32,11 +32,9 @@ sealed trait Reference:
|
|||
def /(c: Configuration): RichConfiguration = RichConfiguration(asScope in c)
|
||||
|
||||
// This is for handling `Zero / Zero / name`.
|
||||
@nowarn
|
||||
def /(configAxis: ScopeAxis[ConfigKey]): RichConfiguration =
|
||||
new RichConfiguration(asScope.copy(config = configAxis))
|
||||
|
||||
@nowarn
|
||||
final def /[K](key: Scoped.ScopingSetting[K]): K = key.in(asScope)
|
||||
|
||||
@nowarn
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ object SlashSyntax {
|
|||
|
||||
sealed trait HasSlashKey {
|
||||
protected def scope: Scope
|
||||
@nowarn
|
||||
final def /[K](key: Scoped.ScopingSetting[K]): K = key.in(scope)
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +83,6 @@ object SlashSyntax {
|
|||
def /(c: Configuration): RichConfiguration = new RichConfiguration(scope in c)
|
||||
|
||||
// This is for handling `Zero / Zero / name`.
|
||||
@nowarn
|
||||
def /(configAxis: ScopeAxis[ConfigKey]): RichConfiguration =
|
||||
new RichConfiguration(scope.copy(config = configAxis))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import sbt.ConcurrentRestrictions.Tag
|
|||
import sbt.Def.{ Initialize, ScopedKey, Setting, setting }
|
||||
import std.TaskMacro
|
||||
import std.TaskExtra.{ task => mktask, _ }
|
||||
import scala.reflect.{ ClassTag, ManifestFactory }
|
||||
import scala.reflect.ClassTag
|
||||
|
||||
/** An abstraction on top of Settings for build configuration and task definition. */
|
||||
sealed trait Scoped extends Equals:
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import sbt.util.Applicative
|
|||
import scala.quoted.*
|
||||
|
||||
class InputInitConvert[C <: Quotes & scala.Singleton](override val qctx: C, valStart: Int)
|
||||
extends Convert[C](qctx)
|
||||
with ContextUtil[C](qctx, valStart):
|
||||
extends Convert[C]
|
||||
with ContextUtil[C](valStart):
|
||||
import qctx.reflect.*
|
||||
|
||||
override def convert[A: Type](nme: String, in: Term): Converted =
|
||||
|
|
@ -33,8 +33,8 @@ end InputInitConvert
|
|||
|
||||
/** Converts an input `Term` of type `Parser[A]` or `State => Parser[A]` into a `Term` of type `State => Parser[A]`. */
|
||||
class ParserConvert[C <: Quotes & scala.Singleton](override val qctx: C, valStart: Int)
|
||||
extends Convert[C](qctx)
|
||||
with ContextUtil[C](qctx, valStart):
|
||||
extends Convert[C]
|
||||
with ContextUtil[C](valStart):
|
||||
import qctx.reflect.*
|
||||
|
||||
override def convert[A: Type](nme: String, in: Term): Converted =
|
||||
|
|
@ -51,8 +51,8 @@ end ParserConvert
|
|||
|
||||
/** Convert instance for plain `Task`s not within the settings system. */
|
||||
class TaskConvert[C <: Quotes & scala.Singleton](override val qctx: C, valStart: Int)
|
||||
extends Convert[C](qctx)
|
||||
with ContextUtil[C](qctx, valStart):
|
||||
extends Convert[C]
|
||||
with ContextUtil[C](valStart):
|
||||
import qctx.reflect.*
|
||||
override def convert[A: Type](nme: String, in: Term): Converted =
|
||||
if nme == InputWrapper.WrapTaskName then Converted.success(in)
|
||||
|
|
@ -67,8 +67,8 @@ end TaskConvert
|
|||
* a `Term` of type `Initialize[Task[A]]`.
|
||||
*/
|
||||
class FullConvert[C <: Quotes & scala.Singleton](override val qctx: C, valStart: Int)
|
||||
extends Convert[C](qctx)
|
||||
with ContextUtil[C](qctx, valStart):
|
||||
extends Convert[C]
|
||||
with ContextUtil[C](valStart):
|
||||
import qctx.reflect.*
|
||||
|
||||
override def convert[A: Type](nme: String, in: Term): Converted =
|
||||
|
|
@ -103,8 +103,8 @@ end FullConvert
|
|||
* into a `Term` of type `Initialize[State => Parser[A]]`.
|
||||
*/
|
||||
class InitParserConvert[C <: Quotes & scala.Singleton](override val qctx: C, valStart: Int)
|
||||
extends Convert[C](qctx)
|
||||
with ContextUtil[C](qctx, valStart):
|
||||
extends Convert[C]
|
||||
with ContextUtil[C](valStart):
|
||||
import qctx.reflect.*
|
||||
|
||||
override def convert[A: Type](nme: String, in: Term): Converted =
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ object InputTaskMacro:
|
|||
private[this] def inputTaskMacro0[A1: Type](tree: Expr[A1])(using
|
||||
qctx: Quotes
|
||||
): Expr[Def.Initialize[InputTask[A1]]] =
|
||||
import qctx.reflect.*
|
||||
// println(s"tree = ${tree.show}")
|
||||
iInitializeMacro(tree) { et =>
|
||||
val pt: Expr[State => Parser[Task[A1]]] = iParserMacro(et) { pt =>
|
||||
|
|
@ -109,7 +108,6 @@ object InputTaskMacro:
|
|||
convert1.contMapN[A1, ParserInstance.F1, F1](tree, convert1.appExpr, None, inner)
|
||||
|
||||
private[this] def iTaskMacro[A1: Type](tree: Expr[A1])(using qctx: Quotes): Expr[Task[A1]] =
|
||||
import qctx.reflect.*
|
||||
val convert1 = new TaskConvert(qctx, 2000)
|
||||
convert1.contMapN[A1, Task, Id](tree, convert1.appExpr, None)
|
||||
/*
|
||||
|
|
@ -218,7 +216,6 @@ object InputTaskMacro:
|
|||
): Expr[Def.Initialize[InputTask[A2]]] =
|
||||
import qctx.reflect.*
|
||||
val convert1 = new FullConvert(qctx, 1000)
|
||||
import convert1.Converted
|
||||
def mkInputTask(params: List[ValDef], body: Term): Expr[Def.Initialize[InputTask[A2]]] =
|
||||
val lambdaTpe =
|
||||
MethodType(params.map(_.name))(
|
||||
|
|
|
|||
|
|
@ -11,12 +11,6 @@ package std
|
|||
import scala.language.experimental.macros
|
||||
|
||||
import scala.annotation.compileTimeOnly
|
||||
import scala.quoted.*
|
||||
// import scala.reflect.macros._
|
||||
|
||||
import Def.Initialize
|
||||
import sbt.internal.util.appmacro.ContextUtil
|
||||
import sbt.internal.util.complete.Parser
|
||||
|
||||
/** Implementation detail. The wrap methods temporarily hold inputs (as a Tree, at compile time) until a task or setting macro processes it. */
|
||||
object InputWrapper:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ package sbt
|
|||
package std
|
||||
|
||||
import java.io.File
|
||||
import scala.annotation.tailrec
|
||||
import scala.quoted.*
|
||||
import scala.reflect.ClassTag
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ import scala.quoted.*
|
|||
import sbt.internal.util.complete.Parser
|
||||
|
||||
class InitializeConvert[C <: Quotes & scala.Singleton](override val qctx: C, valStart: Int)
|
||||
extends Convert[C](qctx)
|
||||
with ContextUtil[C](qctx, valStart):
|
||||
extends Convert[C]
|
||||
with ContextUtil[C](valStart):
|
||||
import qctx.reflect.*
|
||||
|
||||
override def convert[A: Type](nme: String, in: Term): Converted =
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
/*
|
||||
package sbt.std
|
||||
|
||||
import sbt.SettingKey
|
||||
|
|
@ -16,7 +17,6 @@ import sbt.internal.util.Terminal
|
|||
import scala.io.AnsiColor
|
||||
import scala.reflect.macros.blackbox
|
||||
|
||||
/*
|
||||
abstract class BaseTaskLinterDSL extends LinterDSL {
|
||||
def isDynamicTask: Boolean
|
||||
def convert: Convert
|
||||
|
|
|
|||
|
|
@ -9,12 +9,9 @@ package sbt
|
|||
package std
|
||||
|
||||
import Def.{ Initialize, Setting }
|
||||
import sbt.util.{ ActionCacheStore, Applicative, Monad }
|
||||
import sbt.internal.util.Types.Id
|
||||
import sbt.internal.util.appmacro.{
|
||||
Cont,
|
||||
ContextUtil,
|
||||
Convert,
|
||||
// Instance,
|
||||
// LinterDSL,
|
||||
// MixedBuilder,
|
||||
|
|
@ -24,10 +21,8 @@ import sbt.internal.util.appmacro.{
|
|||
import sbt.internal.util.{ LinePosition, NoPosition, SourcePosition }
|
||||
|
||||
import language.experimental.macros
|
||||
import scala.annotation.tailrec
|
||||
import scala.reflect.internal.util.UndefinedPosition
|
||||
import scala.quoted.*
|
||||
import sjsonnew.{ BasicJsonProtocol, JsonFormat }
|
||||
import sjsonnew.JsonFormat
|
||||
|
||||
object TaskMacro:
|
||||
final val AssignInitName = "set"
|
||||
|
|
@ -104,7 +99,6 @@ object TaskMacro:
|
|||
def settingAssignMacroImpl[A1: Type](rec: Expr[Scoped.DefinableSetting[A1]], v: Expr[A1])(using
|
||||
qctx: Quotes
|
||||
): Expr[Setting[A1]] =
|
||||
import qctx.reflect.*
|
||||
val init = SettingMacro.settingMacroImpl[A1](v)
|
||||
'{
|
||||
$rec.set0($init, $sourcePosition)
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@
|
|||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
/*
|
||||
package sbt
|
||||
|
||||
/*
|
||||
object AppendSpec {
|
||||
val onLoad = SettingKey[State => State]("onLoad")
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@
|
|||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
/*
|
||||
package sbt.test
|
||||
|
||||
/*
|
||||
import org.scalacheck.{ Test => _, _ }, Arbitrary.arbitrary, Gen._
|
||||
|
||||
import java.io.File
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@
|
|||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
/*
|
||||
package sbt
|
||||
|
||||
/*
|
||||
import org.scalatest.flatspec.AnyFlatSpec
|
||||
import sbt.internal.util.{ AttributeKey, AttributeMap }
|
||||
import sbt.io.syntax.file
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@
|
|||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
/*
|
||||
package sbt.test
|
||||
|
||||
/*
|
||||
import org.scalacheck._, Prop._, util.Pretty
|
||||
|
||||
import sbt.internal.util.AttributeKey
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@
|
|||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
/*
|
||||
package sbt.test
|
||||
|
||||
/*
|
||||
import org.scalacheck.{ Test => _, _ }, Prop._
|
||||
|
||||
import sbt.SlashSyntax
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@
|
|||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
/*
|
||||
package sbt.test
|
||||
|
||||
/*
|
||||
import java.io.File
|
||||
import sjsonnew._, BasicJsonProtocol._
|
||||
import sbt.Def.{ Setting, inputKey, settingKey, taskKey }
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ package sbt.test
|
|||
|
||||
import sbt._
|
||||
import sbt.Def.Initialize
|
||||
import sbt.internal.util.Types.Id
|
||||
|
||||
object TupleSyntaxTest:
|
||||
def t1[A](a: SettingKey[A], b: TaskKey[A], c: Def.Initialize[A], d: Def.Initialize[Task[A]]) = {
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@
|
|||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
/*
|
||||
package sbt.std
|
||||
|
||||
/*
|
||||
import org.scalatest.{ TestData, fixture, funsuite }
|
||||
import sbt.std.TestUtil._
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@
|
|||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
/*
|
||||
package sbt.std
|
||||
|
||||
/*
|
||||
class TaskPosSpec {
|
||||
// Starting sbt 1.4.0, Def.task can have task value lookups inside
|
||||
// if branches since tasks with single if-expressions are automatically
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@
|
|||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
/*
|
||||
package sbt.std
|
||||
|
||||
/*
|
||||
import org.scalatest.TestData
|
||||
|
||||
import scala.tools.reflect.ToolBox
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@
|
|||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
/*
|
||||
package sbt.std.neg
|
||||
|
||||
/*
|
||||
import scala.tools.reflect.ToolBoxError
|
||||
import org.scalatest.{ TestData, fixture, funsuite }
|
||||
import sbt.std.{ TaskLinterDSLFeedback, TestUtil }
|
||||
|
|
|
|||
|
|
@ -179,6 +179,7 @@ object Cross {
|
|||
project(k).toSeq.flatMap(crossVersions(extracted, _).map(v => v -> k))
|
||||
}
|
||||
.groupBy(_._1)
|
||||
.view
|
||||
.mapValues(_.map(_._2).toSet)
|
||||
val commandsByVersion = keysByVersion.toSeq
|
||||
.flatMap { case (v, keys) =>
|
||||
|
|
@ -188,7 +189,7 @@ object Cross {
|
|||
if (p == extracted.currentRef || !projects.contains(extracted.currentRef)) {
|
||||
val parts =
|
||||
project(k).map(_.project) ++ k.scope.config.toOption.map { case ConfigKey(n) =>
|
||||
n.head.toUpper + n.tail
|
||||
s"${n.head.toUpper}${n.tail}"
|
||||
} ++ k.scope.task.toOption.map(_.label) ++ Some(k.key.label)
|
||||
Some(v -> parts.mkString("", "/", fullArgs))
|
||||
} else None
|
||||
|
|
@ -196,6 +197,7 @@ object Cross {
|
|||
}
|
||||
}
|
||||
.groupBy(_._1)
|
||||
.view
|
||||
.mapValues(_.map(_._2))
|
||||
.toSeq
|
||||
.sortBy(_._1)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import sbt.Project.{
|
|||
// richTaskSessionVar,
|
||||
// sbtRichTaskPromise
|
||||
}
|
||||
import sbt.ProjectExtra.{ *, given }
|
||||
import sbt.ProjectExtra.*
|
||||
import sbt.Scope.{ GlobalScope, ThisScope, fillTaskAxis }
|
||||
import sbt.State.StateOpsImpl
|
||||
import sbt.coursierint._
|
||||
|
|
@ -88,7 +88,6 @@ import sbt.util.CacheImplicits.given
|
|||
import sbt.util.InterfaceUtil.{ t2, toJavaFunction => f1 }
|
||||
import sbt.util._
|
||||
import sjsonnew._
|
||||
import sjsonnew.support.scalajson.unsafe.Converter
|
||||
import xsbti.compile.TastyFiles
|
||||
import xsbti.{ FileConverter, Position }
|
||||
|
||||
|
|
@ -899,7 +898,7 @@ object Defaults extends BuildCommon {
|
|||
) ++
|
||||
configGlobal ++ defaultCompileSettings ++ compileAnalysisSettings ++ Seq(
|
||||
compileOutputs := {
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters.*
|
||||
val c = fileConverter.value
|
||||
val classFiles =
|
||||
manipulateBytecode.value.analysis.readStamps.getAllProductStamps.keySet.asScala
|
||||
|
|
@ -1068,15 +1067,15 @@ object Defaults extends BuildCommon {
|
|||
private def watchTransitiveSourcesTaskImpl(
|
||||
key: TaskKey[Seq[Source]]
|
||||
): Initialize[Task[Seq[Source]]] = {
|
||||
import ScopeFilter.Make.{ inDependencies => inDeps, _ }
|
||||
val selectDeps = ScopeFilter(inAggregates(ThisProject) || inDeps(ThisProject))
|
||||
import ScopeFilter.Make.*
|
||||
val selectDeps = ScopeFilter(inAggregates(ThisProject) || inDependencies(ThisProject))
|
||||
val allWatched = (key ?? Nil).all(selectDeps)
|
||||
Def.task { allWatched.value.flatten }
|
||||
}
|
||||
|
||||
def transitiveUpdateTask: Initialize[Task[Seq[UpdateReport]]] = {
|
||||
import ScopeFilter.Make.{ inDependencies => inDeps, _ }
|
||||
val selectDeps = ScopeFilter(inDeps(ThisProject, includeRoot = false))
|
||||
import ScopeFilter.Make.*
|
||||
val selectDeps = ScopeFilter(inDependencies(ThisProject, includeRoot = false))
|
||||
val allUpdates = update.?.all(selectDeps)
|
||||
// If I am a "build" (a project inside project/) then I have a globalPluginUpdate.
|
||||
Def.task { allUpdates.value.flatten ++ globalPluginUpdate.?.value }
|
||||
|
|
@ -1236,8 +1235,8 @@ object Defaults extends BuildCommon {
|
|||
makeScalaInstance(
|
||||
dummy.version,
|
||||
dummy.libraryJars,
|
||||
dummy.compilerJars,
|
||||
dummy.allJars,
|
||||
dummy.compilerJars.toSeq,
|
||||
dummy.allJars.toSeq,
|
||||
state.value,
|
||||
scalaInstanceTopLoader.value,
|
||||
)
|
||||
|
|
@ -1264,7 +1263,7 @@ object Defaults extends BuildCommon {
|
|||
loadedTestFrameworks := {
|
||||
val loader = testLoader.value
|
||||
val log = streams.value.log
|
||||
testFrameworks.value.flatMap(f => f.create(loader, log).map(x => (f, x)).toIterable).toMap
|
||||
testFrameworks.value.flatMap(f => f.create(loader, log).map(x => (f, x))).toMap
|
||||
},
|
||||
definedTests := detectTests.value,
|
||||
definedTestNames := (definedTests map (_.map(
|
||||
|
|
@ -1440,10 +1439,10 @@ object Defaults extends BuildCommon {
|
|||
stamps.getOrElse(
|
||||
c, {
|
||||
val x = {
|
||||
import analysis.{ apis, relations => rel }
|
||||
rel.internalClassDeps(c).map(intlStamp(_, analysis, s + c)) ++
|
||||
rel.externalDeps(c).map(stamp) ++
|
||||
rel.productClassName.reverse(c).flatMap { pc =>
|
||||
import analysis.{ apis, relations }
|
||||
relations.internalClassDeps(c).map(intlStamp(_, analysis, s + c)) ++
|
||||
relations.externalDeps(c).map(stamp) ++
|
||||
relations.productClassName.reverse(c).flatMap { pc =>
|
||||
apis.internal.get(pc).map(_.compilationTimestamp)
|
||||
} + Long.MinValue
|
||||
}.max
|
||||
|
|
@ -2449,7 +2448,7 @@ object Defaults extends BuildCommon {
|
|||
}
|
||||
val map = managedFileStampCache.value
|
||||
val analysis = analysisResult.analysis
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters.*
|
||||
analysis.readStamps.getAllProductStamps.asScala.foreach { case (f: VirtualFileRef, s) =>
|
||||
map.put(c.toPath(f), sbt.nio.FileStamp.fromZincStamp(s))
|
||||
}
|
||||
|
|
@ -3046,7 +3045,6 @@ object Classpaths {
|
|||
case (a, true) => a
|
||||
})
|
||||
|
||||
@nowarn
|
||||
def forallIn[T](
|
||||
key: Scoped.ScopingSetting[SettingKey[T]], // should be just SettingKey[T] (mea culpa)
|
||||
pkgTasks: Seq[TaskKey[_]],
|
||||
|
|
@ -3509,7 +3507,7 @@ object Classpaths {
|
|||
) ++ Seq(
|
||||
csrProject := CoursierInputsTasks.coursierProjectTask.value,
|
||||
csrConfiguration := LMCoursier.coursierConfigurationTask.value,
|
||||
csrResolvers := CoursierRepositoriesTasks.coursierResolversTask.value,
|
||||
csrResolvers := CoursierRepositoriesTasks.coursierResolversTask(fullResolvers).value,
|
||||
csrRecursiveResolvers := CoursierRepositoriesTasks.coursierRecursiveResolversTask.value,
|
||||
csrSbtResolvers := CoursierRepositoriesTasks.coursierSbtResolversTask.value,
|
||||
csrInterProjectDependencies := CoursierInputsTasks.coursierInterProjectDependenciesTask.value,
|
||||
|
|
@ -3746,7 +3744,8 @@ object Classpaths {
|
|||
Seq(
|
||||
dependencyResolution := dependencyResolutionTask.value,
|
||||
csrConfiguration := LMCoursier.scalaCompilerBridgeConfigurationTask.value,
|
||||
csrResolvers := CoursierRepositoriesTasks.coursierResolversTask.value,
|
||||
csrResolvers :=
|
||||
CoursierRepositoriesTasks.coursierResolversTask(scalaCompilerBridgeResolvers).value,
|
||||
externalResolvers := scalaCompilerBridgeResolvers.value,
|
||||
ivyConfiguration := InlineIvyConfiguration(
|
||||
lock = Option(lock(appConfiguration.value)),
|
||||
|
|
@ -4046,7 +4045,7 @@ object Classpaths {
|
|||
includeDetails = includeDetails,
|
||||
log = s.log
|
||||
)
|
||||
}
|
||||
}: @nowarn
|
||||
|
||||
private[sbt] def dependencyPositionsTask: Initialize[Task[Map[ModuleID, SourcePosition]]] =
|
||||
Def.task {
|
||||
|
|
@ -4064,7 +4063,7 @@ object Classpaths {
|
|||
(s.key.key == libraryDependencies.key) &&
|
||||
(s.key.scope.project == Select(projRef))
|
||||
}
|
||||
Map(settings flatMap { case s: Setting[Seq[ModuleID]] @unchecked =>
|
||||
Map(settings.asInstanceOf[Seq[Setting[Seq[ModuleID]]]].flatMap { s =>
|
||||
s.init.evaluate(empty) map { _ -> s.pos }
|
||||
}: _*)
|
||||
} catch {
|
||||
|
|
@ -4217,7 +4216,6 @@ object Classpaths {
|
|||
depMap(bd.classpathTransitiveRefs(thisProj), data, s.log)
|
||||
}
|
||||
|
||||
@nowarn
|
||||
private[sbt] def depMap(
|
||||
projects: Seq[ProjectRef],
|
||||
data: Settings[Scope],
|
||||
|
|
@ -4394,11 +4392,11 @@ object Classpaths {
|
|||
if cond then
|
||||
Def.task {
|
||||
val converter = fileConverter.value
|
||||
(scalaInstance.value.libraryJars: Seq[File])
|
||||
scalaInstance.value.libraryJars.toSeq
|
||||
.map(_.toPath)
|
||||
.map(converter.toVirtualFile)
|
||||
}
|
||||
else Def.task { (Nil: Seq[HashedVirtualFileRef]) }
|
||||
else Def.task { Seq.empty[HashedVirtualFileRef] }
|
||||
}
|
||||
|
||||
import DependencyFilter._
|
||||
|
|
|
|||
|
|
@ -475,7 +475,7 @@ object EvaluateTask {
|
|||
triggers: Triggers,
|
||||
config: EvaluateTaskConfig
|
||||
)(using taskToNode: NodeView): (State, Result[T]) = {
|
||||
import ConcurrentRestrictions.{ cancellableCompletionService, tagged, tagsKey }
|
||||
import ConcurrentRestrictions.{ cancellableCompletionService, tagged }
|
||||
|
||||
val log = state.log
|
||||
log.debug(
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ final case class Extracted(
|
|||
show = Aggregation.defaultShow(state, false),
|
||||
)
|
||||
|
||||
@nowarn
|
||||
private[this] def resolve[K <: Scoped.ScopingSetting[K] with Scoped](key: K): K =
|
||||
key in Scope.resolveScope(GlobalScope, currentRef.build, rootProject)(key.scope)
|
||||
|
||||
|
|
@ -149,7 +148,6 @@ final case class Extracted(
|
|||
state: State,
|
||||
sessionSettings: Seq[Setting[_]],
|
||||
): State = {
|
||||
import sbt.ProjectExtra.extract
|
||||
val appendSettings =
|
||||
Load.transformSettings(Load.projectScope(currentRef), currentRef.build, rootProject, settings)
|
||||
val newStructure = Load.reapply(sessionSettings ++ appendSettings, structure)
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import scala.concurrent.ExecutionContext
|
|||
import scala.concurrent.duration.Duration
|
||||
import scala.reflect.ClassTag
|
||||
import scala.util.control.NonFatal
|
||||
import scala.util.boundary
|
||||
|
||||
/** This class is the entry point for sbt. */
|
||||
final class xMain extends xsbti.AppMain:
|
||||
|
|
@ -59,7 +60,7 @@ private[sbt] object xMain:
|
|||
override def provider: AppProvider = config.provider()
|
||||
}
|
||||
|
||||
private[sbt] def run(configuration: xsbti.AppConfiguration): xsbti.MainResult = {
|
||||
private[sbt] def run(configuration: xsbti.AppConfiguration): xsbti.MainResult = boundary {
|
||||
try {
|
||||
import BasicCommandStrings.{ DashDashClient, DashDashServer, runEarly }
|
||||
import BasicCommands.early
|
||||
|
|
@ -79,7 +80,7 @@ private[sbt] object xMain:
|
|||
lazy val isServer = !userCommands.exists(c => isBsp(c) || isClient(c))
|
||||
// keep this lazy to prevent project directory created prematurely
|
||||
lazy val bootServerSocket = if (isServer) getSocketOrExit(configuration) match {
|
||||
case (_, Some(e)) => return e
|
||||
case (_, Some(e)) => boundary.break(e)
|
||||
case (s, _) => s
|
||||
}
|
||||
else None
|
||||
|
|
@ -131,9 +132,8 @@ private[sbt] object xMain:
|
|||
)
|
||||
.put(BasicKeys.detachStdio, detachStdio)
|
||||
val state = bootServerSocket match {
|
||||
// todo: fix this
|
||||
// case Some(l) => state0.put(Keys.bootServerSocket, l)
|
||||
case _ => state0
|
||||
case Some(l) => state0.put(Keys.bootServerSocket, l)
|
||||
case _ => state0
|
||||
}
|
||||
try StandardMain.runManaged(state)
|
||||
finally bootServerSocket.foreach(_.close())
|
||||
|
|
@ -571,7 +571,7 @@ object BuiltinCommands {
|
|||
val app = s.configuration.provider
|
||||
val classpath = app.mainClasspath ++ app.scalaProvider.jars
|
||||
val result = Load
|
||||
.mkEval(classpath.map(_.toPath()), s.baseDir, Nil)
|
||||
.mkEval(classpath.map(_.toPath()).toSeq, s.baseDir, Nil)
|
||||
.evalInfer(expression = arg, imports = EvalImports(Nil))
|
||||
s.log.info(s"ans: ${result.tpe} = ${result.getValue(app.loader)}")
|
||||
}
|
||||
|
|
@ -823,9 +823,9 @@ object BuiltinCommands {
|
|||
def showProjects(s: State): Unit = {
|
||||
val extracted = Project extract s
|
||||
import extracted._
|
||||
import currentRef.{ build => curi, project => cid }
|
||||
listBuild(curi, structure.units(curi), true, cid, s.log)
|
||||
for ((uri, build) <- structure.units if curi != uri) listBuild(uri, build, false, cid, s.log)
|
||||
listBuild(currentRef.build, structure.units(currentRef.build), true, currentRef.project, s.log)
|
||||
for ((uri, build) <- structure.units if currentRef.build != uri)
|
||||
listBuild(uri, build, false, currentRef.project, s.log)
|
||||
}
|
||||
|
||||
def transformExtraBuilds(s: State, f: List[URI] => List[URI]): State = {
|
||||
|
|
@ -1147,7 +1147,7 @@ object BuiltinCommands {
|
|||
if (SysProp.allowRootDir) ()
|
||||
else {
|
||||
val baseDir = state.baseDir
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters.*
|
||||
// this should return / on Unix and C:\ for Windows.
|
||||
val rootOpt = FileSystems.getDefault.getRootDirectories.asScala.toList.headOption
|
||||
rootOpt foreach { root =>
|
||||
|
|
|
|||
|
|
@ -18,14 +18,12 @@ import sbt.internal.CommandStrings._
|
|||
import Cross.{ spacedFirst, requireSession }
|
||||
import sbt.librarymanagement.VersionNumber
|
||||
import Project.inScope
|
||||
import ProjectExtra.{ extract, getProject, setProject }
|
||||
import scala.annotation.nowarn
|
||||
import ProjectExtra.{ extract, setProject }
|
||||
|
||||
/**
|
||||
* Module responsible for plugin cross building.
|
||||
*/
|
||||
private[sbt] object PluginCross {
|
||||
@nowarn
|
||||
lazy val pluginSwitch: Command = {
|
||||
def switchParser(state: State): Parser[(String, String)] = {
|
||||
lazy val switchArgs = token(NotSpace.examples()) ~ (token(
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ package sbt
|
|||
import java.io.File
|
||||
import java.nio.file.{ Path => NioPath }
|
||||
import java.net.URI
|
||||
import java.util.Locale
|
||||
// import Project._
|
||||
import Keys.{
|
||||
stateBuildStructure,
|
||||
|
|
@ -46,12 +45,10 @@ import sbt.internal.{
|
|||
LoadedBuild,
|
||||
LoadedBuildUnit,
|
||||
SettingGraph,
|
||||
SettingCompletions,
|
||||
SessionSettings
|
||||
}
|
||||
import sbt.internal.util.{ AttributeKey, AttributeMap, Dag, Relation, Settings }
|
||||
import sbt.internal.util.{ AttributeKey, AttributeMap, Relation, Settings }
|
||||
import sbt.internal.util.Types.const
|
||||
import sbt.internal.util.complete.DefaultParsers
|
||||
import sbt.internal.server.ServerHandler
|
||||
import sbt.librarymanagement.Configuration
|
||||
import sbt.util.{ ActionCacheStore, Show, Level }
|
||||
|
|
@ -373,7 +370,7 @@ trait ProjectExtra extends Scoped.Syntax:
|
|||
private[this] def overlappingTargets(
|
||||
targets: Seq[(ProjectRef, File)]
|
||||
): Map[File, Seq[ProjectRef]] =
|
||||
targets.groupBy(_._2).filter(_._2.size > 1).mapValues(_.map(_._1)).toMap
|
||||
targets.groupBy(_._2).view.filter(_._2.size > 1).mapValues(_.map(_._1)).toMap
|
||||
|
||||
private[this] def allTargets(data: Settings[Scope]): Seq[(ProjectRef, File)] = {
|
||||
import ScopeFilter._
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ package sbt
|
|||
package internal
|
||||
|
||||
import java.io.File
|
||||
import java.nio.file.{ Files, Path }
|
||||
import java.nio.file.Path
|
||||
|
||||
import org.apache.ivy.core.module.descriptor.{ DefaultArtifact, Artifact => IArtifact }
|
||||
import org.apache.ivy.core.report.DownloadStatus
|
||||
|
|
@ -46,14 +46,12 @@ import sbt.util.{
|
|||
AggregateActionCacheStore,
|
||||
CacheImplicits,
|
||||
DiskActionCacheStore,
|
||||
InMemoryActionCacheStore,
|
||||
Logger
|
||||
}
|
||||
import sjsonnew.JsonFormat
|
||||
import xsbti.{ HashedVirtualFileRef, VirtualFileRef }
|
||||
import xsbti.compile.{ AnalysisContents, CompileAnalysis, MiniSetup, MiniOptions }
|
||||
|
||||
import scala.annotation.nowarn
|
||||
import scala.collection.mutable
|
||||
|
||||
object RemoteCache {
|
||||
|
|
@ -266,7 +264,6 @@ object RemoteCache {
|
|||
file
|
||||
}
|
||||
|
||||
@nowarn
|
||||
def configCacheSettings[A <: RemoteCacheArtifact](
|
||||
cacheArtifactTask: Def.Initialize[Task[A]]
|
||||
): Seq[Def.Setting[_]] =
|
||||
|
|
@ -367,7 +364,7 @@ object RemoteCache {
|
|||
List((packageCache / remoteCacheArtifact).value)
|
||||
},
|
||||
pullRemoteCache := {
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters.*
|
||||
val log = streams.value.log
|
||||
val r = remoteCacheResolvers.value.head
|
||||
val p = remoteCacheProjectId.value
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import Def.ScopedKey
|
|||
import sbt.internal.util.KeyTag
|
||||
|
||||
final case class ScopedKeyData[A](scoped: ScopedKey[A], value: Any) {
|
||||
import sbt.internal.util.Types.const
|
||||
val key = scoped.key
|
||||
val scope = scoped.scope
|
||||
def typeName: String = key.tag.toString
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ object ScriptedPlugin extends AutoPlugin {
|
|||
val p = f.getParentFile
|
||||
(p.getParentFile.getName, p.getName)
|
||||
}
|
||||
val pairMap = pairs.groupBy(_._1).mapValues(_.map(_._2).toSet)
|
||||
val pairMap = pairs.groupBy(_._1).view.mapValues(_.map(_._2).toSet)
|
||||
|
||||
val id = charClass(c => !c.isWhitespace && c != '/', "not whitespace and not '/'").+.string
|
||||
val groupP = token(id.examples(pairMap.keySet.toSet)) <~ token('/')
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import sbt.librarymanagement.ivy.{
|
|||
}
|
||||
import sbt.ProjectExtra.transitiveInterDependencies
|
||||
import sbt.ScopeFilter.Make._
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters.*
|
||||
|
||||
object CoursierInputsTasks {
|
||||
private def coursierProject0(
|
||||
|
|
@ -186,7 +186,7 @@ object CoursierInputsTasks {
|
|||
CProject(
|
||||
module,
|
||||
v.getModuleRevisionId.getRevision,
|
||||
deps,
|
||||
deps.toSeq,
|
||||
configurations,
|
||||
Nil,
|
||||
None,
|
||||
|
|
|
|||
|
|
@ -56,8 +56,10 @@ object CoursierRepositoriesTasks {
|
|||
// https://github.com/sbt/sbt/issues/4661
|
||||
private final val keepPreloaded = false // coursierKeepPreloaded.value
|
||||
|
||||
def coursierResolversTask: Def.Initialize[sbt.Task[Seq[Resolver]]] = Def.task {
|
||||
val result0 = fullResolvers.value.filterNot(_ == projectResolver.value)
|
||||
def coursierResolversTask(
|
||||
resolversKey: TaskKey[Seq[Resolver]]
|
||||
): Def.Initialize[sbt.Task[Seq[Resolver]]] = Def.task {
|
||||
val result0 = resolversKey.value.filterNot(_ == projectResolver.value)
|
||||
val reorderResolvers = true // coursierReorderResolvers.value
|
||||
|
||||
val paths = ivyPaths.value
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import lmcoursier.definitions.{
|
|||
import lmcoursier.*
|
||||
import lmcoursier.syntax.*
|
||||
import lmcoursier.credentials.Credentials
|
||||
import lmcoursier.syntax.*
|
||||
import Keys._
|
||||
import sbt.internal.util.Util
|
||||
import sbt.librarymanagement._
|
||||
|
|
@ -34,7 +33,6 @@ import sbt.librarymanagement.ivy.{
|
|||
import sbt.util.Logger
|
||||
import sbt.io.syntax._
|
||||
import xsbti.AppConfiguration
|
||||
import sbt.SlashSyntax0._
|
||||
|
||||
object LMCoursier {
|
||||
private[this] val credentialRegistry: ConcurrentHashMap[(String, String), IvyCredentials] =
|
||||
|
|
@ -340,7 +338,7 @@ object LMCoursier {
|
|||
()
|
||||
}
|
||||
}
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters.*
|
||||
(ThisBuild / Keys.credentials).value foreach registerCredentials
|
||||
(LocalRootProject / Keys.credentials).value foreach registerCredentials
|
||||
Keys.credentials.value foreach registerCredentials
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
package sbt
|
||||
package internal
|
||||
|
||||
import java.io.File
|
||||
import java.net.{ MalformedURLException, URI, URL }
|
||||
|
||||
import sbt.internal.librarymanagement.mavenint.SbtPomExtraProperties
|
||||
|
|
|
|||
|
|
@ -601,9 +601,9 @@ object Act {
|
|||
sealed trait ParsedAxis[+T] {
|
||||
final def isExplicit = this != Omitted
|
||||
}
|
||||
final object ParsedGlobal extends ParsedAxis[Nothing]
|
||||
final object ParsedZero extends ParsedAxis[Nothing]
|
||||
final object Omitted extends ParsedAxis[Nothing]
|
||||
object ParsedGlobal extends ParsedAxis[Nothing]
|
||||
object ParsedZero extends ParsedAxis[Nothing]
|
||||
object Omitted extends ParsedAxis[Nothing]
|
||||
final class ParsedValue[T](val value: T) extends ParsedAxis[T]
|
||||
def value[T](t: Parser[T]): Parser[ParsedAxis[T]] = t map { v =>
|
||||
new ParsedValue(v)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ package sbt
|
|||
package internal
|
||||
|
||||
import sbt.internal.util.Types.const
|
||||
import java.io.File
|
||||
import xsbti.VirtualFile
|
||||
|
||||
/**
|
||||
|
|
@ -22,13 +21,13 @@ object AddSettings {
|
|||
private[sbt] final class Sequence(val sequence: Seq[AddSettings]) extends AddSettings {
|
||||
override def toString: String = s"Sequence($sequence)"
|
||||
}
|
||||
private[sbt] final object User extends AddSettings
|
||||
private[sbt] object User extends AddSettings
|
||||
private[sbt] final class AutoPlugins(val include: AutoPlugin => Boolean) extends AddSettings
|
||||
private[sbt] final class DefaultSbtFiles(val include: VirtualFile => Boolean) extends AddSettings
|
||||
// private[sbt] final class SbtFiles(val files: Seq[File]) extends AddSettings {
|
||||
// override def toString: String = s"SbtFiles($files)"
|
||||
// }
|
||||
private[sbt] final object BuildScalaFiles extends AddSettings
|
||||
private[sbt] object BuildScalaFiles extends AddSettings
|
||||
|
||||
/** Adds all settings from autoplugins. */
|
||||
val autoPlugins: AddSettings =
|
||||
|
|
|
|||
|
|
@ -12,14 +12,12 @@ import java.text.DateFormat
|
|||
|
||||
import sbt.Def.ScopedKey
|
||||
import sbt.Keys.{ showSuccess, showTiming, timingFormat }
|
||||
import sbt.SlashSyntax0._
|
||||
import sbt.ProjectExtra.*
|
||||
import sbt.internal.util.complete.Parser
|
||||
import sbt.internal.util.complete.Parser.{ failure, seq, success }
|
||||
import sbt.internal.util._
|
||||
import sbt.std.Transform.DummyTaskMap
|
||||
import sbt.util.{ Logger, Show }
|
||||
import scala.annotation.nowarn
|
||||
|
||||
sealed trait Aggregation
|
||||
object Aggregation {
|
||||
|
|
@ -79,7 +77,7 @@ object Aggregation {
|
|||
val success = results match
|
||||
case Result.Value(_) => true
|
||||
case Result.Inc(_) => false
|
||||
results.toEither.right.foreach { r =>
|
||||
results.toEither.foreach { r =>
|
||||
if (show.taskValues) printSettings(r, show.print)
|
||||
}
|
||||
if (show.success && !state.get(suppressShow).getOrElse(false))
|
||||
|
|
@ -297,7 +295,6 @@ object Aggregation {
|
|||
ScopedKey(resolved, key.key)
|
||||
}
|
||||
|
||||
@nowarn
|
||||
def aggregationEnabled(key: ScopedKey[_], data: Settings[Scope]): Boolean =
|
||||
Keys.aggregate in Scope.fillTaskAxis(key.scope, key.key) get data getOrElse true
|
||||
private[sbt] val suppressShow =
|
||||
|
|
|
|||
|
|
@ -15,12 +15,11 @@ import Def.Setting
|
|||
import sbt.io.Hash
|
||||
import sbt.internal.util.Attributed
|
||||
import sbt.internal.inc.ReflectUtilities
|
||||
import xsbti.HashedVirtualFileRef
|
||||
|
||||
trait BuildDef {
|
||||
def projectDefinitions(@deprecated("unused", "") baseDirectory: File): Seq[Project] = projects
|
||||
def projects: Seq[Project] =
|
||||
CompositeProject.expand(ReflectUtilities.allVals[CompositeProject](this).values.toSeq)
|
||||
CompositeProject.expand(ReflectUtilities.allValsC(this, classOf[CompositeProject]).values.toSeq)
|
||||
// TODO: Should we grab the build core settings here or in a plugin?
|
||||
def settings: Seq[Setting[_]] = Defaults.buildCore
|
||||
def buildLoaders: Seq[BuildLoader.Components] = Nil
|
||||
|
|
|
|||
|
|
@ -16,13 +16,11 @@ import Def.{ ScopeLocal, ScopedKey, Setting, displayFull }
|
|||
import BuildPaths.outputDirectory
|
||||
import Scope.GlobalScope
|
||||
import BuildStreams.Streams
|
||||
import sbt.LocalRootProject
|
||||
import sbt.io.syntax._
|
||||
import sbt.internal.inc.MappedFileConverter
|
||||
import sbt.internal.util.{ AttributeEntry, AttributeKey, AttributeMap, Attributed, Settings }
|
||||
import sbt.internal.util.Attributed.data
|
||||
import sbt.util.Logger
|
||||
import scala.annotation.nowarn
|
||||
import xsbti.FileConverter
|
||||
|
||||
final class BuildStructure(
|
||||
|
|
@ -293,7 +291,7 @@ final class PartBuildUnit(
|
|||
) extends BuildUnitBase {
|
||||
|
||||
def resolve(f: Project => ResolvedProject): LoadedBuildUnit =
|
||||
new LoadedBuildUnit(unit, defined.mapValues(f).toMap, rootProjects, buildSettings)
|
||||
new LoadedBuildUnit(unit, defined.view.mapValues(f).toMap, rootProjects, buildSettings)
|
||||
|
||||
def resolveRefs(f: ProjectReference => ProjectRef): LoadedBuildUnit = resolve(_ resolve f)
|
||||
}
|
||||
|
|
@ -371,7 +369,8 @@ object BuildStreams {
|
|||
case _ => Nil
|
||||
}
|
||||
def showAMap(a: AttributeMap): String =
|
||||
a.entries.toStream
|
||||
a.entries
|
||||
.to(LazyList)
|
||||
.sortBy(_.key.label)
|
||||
.flatMap {
|
||||
// The Previous.scopedKeyAttribute is an implementation detail that allows us to get a
|
||||
|
|
@ -399,7 +398,6 @@ object BuildStreams {
|
|||
def refTarget(ref: ResolvedReference, fallbackBase: File, data: Settings[Scope]): File =
|
||||
refTarget(GlobalScope.copy(project = Select(ref)), fallbackBase, data)
|
||||
|
||||
@nowarn
|
||||
def refTarget(scope: Scope, fallbackBase: File, data: Settings[Scope]): File =
|
||||
(Keys.target in scope get data getOrElse outputDirectory(fallbackBase)) / StreamsDirectory
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import sbt.librarymanagement.{ Configuration, TrackLevel }
|
|||
import sbt.librarymanagement.Configurations.names
|
||||
import sbt.std.TaskExtra._
|
||||
import sbt.util._
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters.*
|
||||
import xsbti.{ HashedVirtualFileRef, VirtualFileRef }
|
||||
import xsbti.compile.CompileAnalysis
|
||||
|
||||
|
|
@ -411,7 +411,7 @@ private[sbt] object ClasspathImpl {
|
|||
depConfs: Seq[String],
|
||||
default: String => Seq[String]
|
||||
): String => Seq[String] =
|
||||
union(confString.split(";") map parseSingleMapping(masterConfs, depConfs, default))
|
||||
union(confString.split(";").map(parseSingleMapping(masterConfs, depConfs, default)).toSeq)
|
||||
|
||||
def parseSingleMapping(
|
||||
masterConfs: Seq[String],
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import java.nio.file.{ DirectoryNotEmptyException, Files, Path }
|
|||
import sbt.Def._
|
||||
import sbt.Keys._
|
||||
// import sbt.Project.richInitializeTask
|
||||
import sbt.ProjectExtra.{ *, given }
|
||||
import sbt.ProjectExtra.*
|
||||
import sbt.SlashSyntax0._
|
||||
import sbt.io.syntax._
|
||||
import sbt.nio.Keys._
|
||||
|
|
|
|||
|
|
@ -34,5 +34,4 @@ object CompileInputs2:
|
|||
CompileInputs2(in.head, in.tail.head, in.tail.tail.head, in.tail.tail.tail.head)
|
||||
}
|
||||
)
|
||||
given JsonFormat[CompileInputs2] = summon
|
||||
end CompileInputs2
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import scala.concurrent.duration.FiniteDuration.FiniteDurationIsOrdered
|
|||
import scala.concurrent.duration._
|
||||
import scala.util.{ Failure, Success, Try }
|
||||
import scala.util.control.NonFatal
|
||||
import scala.annotation.nowarn
|
||||
|
||||
/**
|
||||
* Provides the implementation of the `~` command and `watch` task. The implementation is quite
|
||||
|
|
@ -236,7 +237,6 @@ private[sbt] object Continuous extends DeprecatedContinuous {
|
|||
throw new IllegalStateException(msg)
|
||||
}
|
||||
}
|
||||
case _ => Nil: Seq[ScopedKey[_]]
|
||||
}
|
||||
}
|
||||
impl(command)
|
||||
|
|
@ -397,6 +397,7 @@ private[sbt] object Continuous extends DeprecatedContinuous {
|
|||
}
|
||||
}
|
||||
|
||||
@nowarn
|
||||
private def getOnStart(
|
||||
project: ProjectRef,
|
||||
commands: Seq[String],
|
||||
|
|
@ -432,6 +433,7 @@ private[sbt] object Continuous extends DeprecatedContinuous {
|
|||
}
|
||||
}
|
||||
|
||||
@nowarn
|
||||
private def getFileEvents(
|
||||
configs: Seq[Config],
|
||||
logger: Logger,
|
||||
|
|
@ -985,11 +987,13 @@ private[sbt] object Continuous extends DeprecatedContinuous {
|
|||
def arguments(logger: Logger): Arguments = new Arguments(logger, inputs())
|
||||
end Config
|
||||
|
||||
@nowarn
|
||||
private def getStartMessage(key: ScopedKey[_])(implicit e: Extracted): StartMessage = Some {
|
||||
lazy val default = key.get(watchStartMessage).getOrElse(Watch.defaultStartWatch)
|
||||
key.get(deprecatedWatchingMessage).map(Left(_)).getOrElse(Right(default))
|
||||
}
|
||||
|
||||
@nowarn
|
||||
private def getTriggerMessage(
|
||||
key: ScopedKey[_]
|
||||
)(implicit e: Extracted): TriggerMessage = {
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ private[sbt] object CrossJava {
|
|||
// We have a key, we're likely to be able to cross build this using the per project behaviour.
|
||||
|
||||
// Group all the projects by scala version
|
||||
projVersions.groupBy(_._2).mapValues(_.map(_._1)).toSeq.flatMap {
|
||||
projVersions.groupBy(_._2).view.mapValues(_.map(_._1)).toSeq.flatMap {
|
||||
case (version, Seq(project)) =>
|
||||
// If only one project for a version, issue it directly
|
||||
Seq(s"$JavaSwitchCommand $verbose $version", s"$project/$aggCommand")
|
||||
|
|
|
|||
|
|
@ -183,14 +183,12 @@ private[sbt] abstract class AbstractBackgroundJobService extends BackgroundJobSe
|
|||
override def shutdown(): Unit = {
|
||||
val deadline = 10.seconds.fromNow
|
||||
while (jobSet.nonEmpty && !deadline.isOverdue) {
|
||||
jobSet.headOption.foreach {
|
||||
case handle: ThreadJobHandle @unchecked =>
|
||||
if (handle.job.isRunning()) {
|
||||
handle.job.shutdown()
|
||||
handle.job.awaitTerminationTry(10.seconds)
|
||||
}
|
||||
jobSet = jobSet - handle
|
||||
case _ => //
|
||||
jobSet.headOption.foreach { case handle: ThreadJobHandle @unchecked =>
|
||||
if (handle.job.isRunning()) {
|
||||
handle.job.shutdown()
|
||||
handle.job.awaitTerminationTry(10.seconds)
|
||||
}
|
||||
jobSet = jobSet - handle
|
||||
}
|
||||
}
|
||||
pool.close()
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue