Merge branch 'develop' into ControlEvent-Enumeration

This commit is contained in:
eugene yokota 2025-01-05 17:04:57 -05:00 committed by GitHub
commit a09a724b06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 21 additions and 18 deletions

View File

@ -278,7 +278,7 @@ trait Cont:
.asExprOf[BuildWideCacheConfiguration] .asExprOf[BuildWideCacheConfiguration]
if inputs.exists(_.isCacheInput) then if inputs.exists(_.isCacheInput) then
val tags = inputs val tags = inputs
.filter(_.isCacheInput) .withFilter(_.isCacheInput)
.map(_.tags.toSet) .map(_.tags.toSet)
.reduce(_ & _) .reduce(_ & _)
.toList .toList

View File

@ -72,7 +72,7 @@ trait ContextUtil[C <: Quotes & scala.Singleton](val valStart: Int):
override def tupleExpr: Expr[Tuple] = override def tupleExpr: Expr[Tuple] =
exprOfTupleFromSeq(inputs.map(_.term.asExpr)) exprOfTupleFromSeq(inputs.map(_.term.asExpr))
override def cacheInputTupleTypeRepr: TypeRepr = override def cacheInputTupleTypeRepr: TypeRepr =
tupleTypeRepr(inputs.filter(_.isCacheInput).map(_.tpe)) tupleTypeRepr(inputs.withFilter(_.isCacheInput).map(_.tpe))
override def cacheInputExpr(tupleTerm: Term): Expr[Tuple] = override def cacheInputExpr(tupleTerm: Term): Expr[Tuple] =
exprOfTupleFromSeq(inputs.zipWithIndex.flatMap { case (input, idx) => exprOfTupleFromSeq(inputs.zipWithIndex.flatMap { case (input, idx) =>
if input.tags.nonEmpty then if input.tags.nonEmpty then

View File

@ -72,7 +72,7 @@ class FileExamples(base: File, prefix: String = "") extends ExampleSource {
.map(IO.relativize(base, _).get) .map(IO.relativize(base, _).get)
.filter(_.startsWith(prefix)) .filter(_.startsWith(prefix))
val dirsToRecurseInto = childPaths val dirsToRecurseInto = childPaths
.filter(_.isDirectory) .withFilter(_.isDirectory)
.map(IO.relativize(base, _).get) .map(IO.relativize(base, _).get)
.filter(dirStartsWithPrefix) .filter(dirStartsWithPrefix)
prefixedDirectChildPaths ++ dirsToRecurseInto.flatMap(dir => files(new File(base, dir))) prefixedDirectChildPaths ++ dirsToRecurseInto.flatMap(dir => files(new File(base, dir)))

View File

@ -206,7 +206,7 @@ private[internal] object SbtUpdateReport {
dep -> m.getOrElse(dep, Nil).map { case (_, pub, a, f) => (pub, a, f) } dep -> m.getOrElse(dep, Nil).map { case (_, pub, a, f) => (pub, a, f) }
} }
val fromInterProj = interProjectDependencies val fromInterProj = interProjectDependencies
.filter(p => p.module != thisModule._1) .withFilter(p => p.module != thisModule._1)
.map(p => Dependency(p.module, p.version) -> Nil) .map(p => Dependency(p.module, p.version) -> Nil)
fromLib ++ fromInterProj fromLib ++ fromInterProj
} }

View File

@ -393,7 +393,7 @@ class MakePom(val log: Logger) {
MavenRepository(m.getName, m.getRoot) :: Nil MavenRepository(m.getName, m.getRoot) :: Nil
case _ => Nil case _ => Nil
} }
val repositoryElements = mavenRepositories.filter(filterRepositories).map(mavenRepository) val repositoryElements = mavenRepositories.withFilter(filterRepositories).map(mavenRepository)
if (repositoryElements.isEmpty) repositoryElements if (repositoryElements.isEmpty) repositoryElements
else else
<repositories>{ <repositories>{

View File

@ -100,7 +100,7 @@ object PomExtraDependencyAttributes {
/** parses the sequence of dependencies with extra attribute information, with one dependency per line */ /** parses the sequence of dependencies with extra attribute information, with one dependency per line */
def readDependencyExtra(s: String): Seq[ModuleRevisionId] = ArraySeq.unsafeWrapArray( def readDependencyExtra(s: String): Seq[ModuleRevisionId] = ArraySeq.unsafeWrapArray(
LinesP.split(s).map(_.trim).filter(!_.isEmpty).map(ModuleRevisionId.decode) LinesP.split(s).map(_.trim).withFilter(!_.isEmpty).map(ModuleRevisionId.decode)
) )
private val LinesP = Pattern.compile("(?m)^") private val LinesP = Pattern.compile("(?m)^")

View File

@ -1598,7 +1598,7 @@ object Defaults extends BuildCommon {
val xs = products.value val xs = products.value
xs xs
.flatMap(Path.allSubpaths) .flatMap(Path.allSubpaths)
.filter(_._1.isFile()) .withFilter(_._1.isFile())
.map { case (p, path) => .map { case (p, path) =>
val vf = converter.toVirtualFile(p.toPath()) val vf = converter.toVirtualFile(p.toPath())
(vf: HashedVirtualFileRef) -> path (vf: HashedVirtualFileRef) -> path
@ -1612,7 +1612,7 @@ object Defaults extends BuildCommon {
Path Path
.allSubpaths(d) .allSubpaths(d)
.toSeq .toSeq
.filter(_._1.isFile()) .withFilter(_._1.isFile())
.map { case (p, path) => .map { case (p, path) =>
val vf = converter.toVirtualFile(p.toPath()) val vf = converter.toVirtualFile(p.toPath())
(vf: HashedVirtualFileRef) -> path (vf: HashedVirtualFileRef) -> path

View File

@ -75,7 +75,7 @@ private[sbt] abstract class AbstractTaskExecuteProgress extends ExecuteProgress
): Unit = { ): Unit = {
// we need this to infer anonymous task names // we need this to infer anonymous task names
pendingDeps pendingDeps
.filter { .withFilter {
case t: Task[?] => TaskName.transformNode(t).isEmpty case t: Task[?] => TaskName.transformNode(t).isEmpty
case _ => true case _ => true
} }

View File

@ -544,7 +544,7 @@ private[sbt] object DefaultBackgroundJobService {
backgroundJobServices backgroundJobServices
.values() .values()
.forEach(jobService => { .forEach(jobService => {
jobService.jobs.filter(_.isAutoCancel).foreach(jobService.stop) jobService.jobs.withFilter(_.isAutoCancel).foreach(jobService.stop)
}) })
} }

View File

@ -137,7 +137,7 @@ object PluginDiscovery:
.getResources(resourceName) .getResources(resourceName)
.asScala .asScala
.toSeq .toSeq
.filter(onClasspath(classpath, converter)) .withFilter(onClasspath(classpath, converter))
.flatMap { u => .flatMap { u =>
IO.readLinesURL(u).map(_.trim).filter(!_.isEmpty) IO.readLinesURL(u).map(_.trim).filter(!_.isEmpty)
} }

View File

@ -148,7 +148,7 @@ private[sbt] object WatchTransitiveDependencies {
val projects = projectScopes.flatMap(_.project.toOption).distinct.toSet val projects = projectScopes.flatMap(_.project.toOption).distinct.toSet
val scopes: Seq[Either[Scope, Seq[Glob]]] = val scopes: Seq[Either[Scope, Seq[Glob]]] =
data.scopes.toSeq data.scopes.toSeq
.filter(s => s == Scope.Global || s.project.toOption.exists(projects.contains)) .withFilter(s => s == Scope.Global || s.project.toOption.exists(projects.contains))
.flatMap { s => .flatMap { s =>
data.getDirect(ScopedKey(s, Keys.watchSources.key)).map { task => data.getDirect(ScopedKey(s, Keys.watchSources.key)).map { task =>
task.work match task.work match

View File

@ -11,7 +11,7 @@ object Dependencies {
sys.env.get("BUILD_VERSION") orElse sys.props.get("sbt.build.version") sys.env.get("BUILD_VERSION") orElse sys.props.get("sbt.build.version")
// sbt modules // sbt modules
private val ioVersion = nightlyVersion.getOrElse("1.10.1") private val ioVersion = nightlyVersion.getOrElse("1.10.4")
val zincVersion = nightlyVersion.getOrElse("2.0.0-M3") val zincVersion = nightlyVersion.getOrElse("2.0.0-M3")
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion private val sbtIO = "org.scala-sbt" %% "io" % ioVersion

View File

@ -251,6 +251,7 @@ class BuildServerTest extends AbstractServerTest {
) )
} }
/*
test("buildTarget/compile [Java diagnostics] clear stale warnings") { test("buildTarget/compile [Java diagnostics] clear stale warnings") {
val buildTarget = buildTargetUri("javaProj", "Compile") val buildTarget = buildTargetUri("javaProj", "Compile")
val testFile = new File(svr.baseDirectory, s"java-proj/src/main/java/example/Hello.java") val testFile = new File(svr.baseDirectory, s"java-proj/src/main/java/example/Hello.java")
@ -261,7 +262,7 @@ class BuildServerTest extends AbstractServerTest {
IO.write( IO.write(
otherBuildFile, otherBuildFile,
""" """
|def jdk: File = sbt.internal.Util.javaHome.toFile() |def jdk: File = sbt.internal.util.Util.javaHome.toFile()
|lazy val javaProj = project |lazy val javaProj = project
| .in(file("java-proj")) | .in(file("java-proj"))
| .settings( | .settings(
@ -288,7 +289,7 @@ class BuildServerTest extends AbstractServerTest {
"""incompatible types: int cannot be converted""" """incompatible types: int cannot be converted"""
)( )(
message = "should send publishDiagnostics with severity 1 for Hello.java", message = "should send publishDiagnostics with severity 1 for Hello.java",
debug = true debug = false
) )
// Note the messages changed slightly in both cases. That's interesting // Note the messages changed slightly in both cases. That's interesting
@ -317,13 +318,15 @@ class BuildServerTest extends AbstractServerTest {
"\"diagnostics\":[]", "\"diagnostics\":[]",
"\"reset\":true" "\"reset\":true"
)( )(
message = "should send publishDiagnostics with empty diagnostics" message = "should send publishDiagnostics with empty diagnostics",
debug = false
) )
IO.delete(otherBuildFile) IO.delete(otherBuildFile)
reloadWorkspace() reloadWorkspace()
() ()
} }
*/
test("buildTarget/scalacOptions, buildTarget/javacOptions") { test("buildTarget/scalacOptions, buildTarget/javacOptions") {
val buildTargets = Seq( val buildTargets = Seq(

View File

@ -157,7 +157,7 @@ object ActionCache:
val dirPath = conv.toPath(dir) val dirPath = conv.toPath(dir)
val allPaths = FileTreeView.default val allPaths = FileTreeView.default
.list(dirPath.toGlob / ** / "*") .list(dirPath.toGlob / ** / "*")
.filter(!_._2.isDirectory) .withFilter(!_._2.isDirectory)
.map(_._1) .map(_._1)
.sortBy(_.toString()) .sortBy(_.toString())
// create a manifest of files and their hashes here // create a manifest of files and their hashes here

View File

@ -318,7 +318,7 @@ class DiskActionCacheStore(base: Path, converter: FileConverter) extends Abstrac
val allPaths = mutable.Set( val allPaths = mutable.Set(
FileTreeView.default FileTreeView.default
.list(dirPath.toGlob / ** / "*") .list(dirPath.toGlob / ** / "*")
.filter(!_._2.isDirectory) .withFilter(!_._2.isDirectory)
.map(_._1)* .map(_._1)*
) )
def doSync(ref: HashedVirtualFileRef, in: Path): Unit = def doSync(ref: HashedVirtualFileRef, in: Path): Unit =