mirror of https://github.com/sbt/sbt.git
use withFilter instead of filter
This commit is contained in:
parent
43ceda68b6
commit
da26f3078b
|
|
@ -278,7 +278,7 @@ trait Cont:
|
|||
.asExprOf[BuildWideCacheConfiguration]
|
||||
if inputs.exists(_.isCacheInput) then
|
||||
val tags = inputs
|
||||
.filter(_.isCacheInput)
|
||||
.withFilter(_.isCacheInput)
|
||||
.map(_.tags.toSet)
|
||||
.reduce(_ & _)
|
||||
.toList
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ trait ContextUtil[C <: Quotes & scala.Singleton](val valStart: Int):
|
|||
override def tupleExpr: Expr[Tuple] =
|
||||
exprOfTupleFromSeq(inputs.map(_.term.asExpr))
|
||||
override def cacheInputTupleTypeRepr: TypeRepr =
|
||||
tupleTypeRepr(inputs.filter(_.isCacheInput).map(_.tpe))
|
||||
tupleTypeRepr(inputs.withFilter(_.isCacheInput).map(_.tpe))
|
||||
override def cacheInputExpr(tupleTerm: Term): Expr[Tuple] =
|
||||
exprOfTupleFromSeq(inputs.zipWithIndex.flatMap { case (input, idx) =>
|
||||
if input.tags.nonEmpty then
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class FileExamples(base: File, prefix: String = "") extends ExampleSource {
|
|||
.map(IO.relativize(base, _).get)
|
||||
.filter(_.startsWith(prefix))
|
||||
val dirsToRecurseInto = childPaths
|
||||
.filter(_.isDirectory)
|
||||
.withFilter(_.isDirectory)
|
||||
.map(IO.relativize(base, _).get)
|
||||
.filter(dirStartsWithPrefix)
|
||||
prefixedDirectChildPaths ++ dirsToRecurseInto.flatMap(dir => files(new File(base, dir)))
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ private[internal] object SbtUpdateReport {
|
|||
dep -> m.getOrElse(dep, Nil).map { case (_, pub, a, f) => (pub, a, f) }
|
||||
}
|
||||
val fromInterProj = interProjectDependencies
|
||||
.filter(p => p.module != thisModule._1)
|
||||
.withFilter(p => p.module != thisModule._1)
|
||||
.map(p => Dependency(p.module, p.version) -> Nil)
|
||||
fromLib ++ fromInterProj
|
||||
}
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ class MakePom(val log: Logger) {
|
|||
MavenRepository(m.getName, m.getRoot) :: Nil
|
||||
case _ => Nil
|
||||
}
|
||||
val repositoryElements = mavenRepositories.filter(filterRepositories).map(mavenRepository)
|
||||
val repositoryElements = mavenRepositories.withFilter(filterRepositories).map(mavenRepository)
|
||||
if (repositoryElements.isEmpty) repositoryElements
|
||||
else
|
||||
<repositories>{
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ object PomExtraDependencyAttributes {
|
|||
|
||||
/** parses the sequence of dependencies with extra attribute information, with one dependency per line */
|
||||
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)^")
|
||||
|
|
|
|||
|
|
@ -1598,7 +1598,7 @@ object Defaults extends BuildCommon {
|
|||
val xs = products.value
|
||||
xs
|
||||
.flatMap(Path.allSubpaths)
|
||||
.filter(_._1.isFile())
|
||||
.withFilter(_._1.isFile())
|
||||
.map { case (p, path) =>
|
||||
val vf = converter.toVirtualFile(p.toPath())
|
||||
(vf: HashedVirtualFileRef) -> path
|
||||
|
|
@ -1612,7 +1612,7 @@ object Defaults extends BuildCommon {
|
|||
Path
|
||||
.allSubpaths(d)
|
||||
.toSeq
|
||||
.filter(_._1.isFile())
|
||||
.withFilter(_._1.isFile())
|
||||
.map { case (p, path) =>
|
||||
val vf = converter.toVirtualFile(p.toPath())
|
||||
(vf: HashedVirtualFileRef) -> path
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ private[sbt] abstract class AbstractTaskExecuteProgress extends ExecuteProgress
|
|||
): Unit = {
|
||||
// we need this to infer anonymous task names
|
||||
pendingDeps
|
||||
.filter {
|
||||
.withFilter {
|
||||
case t: Task[?] => TaskName.transformNode(t).isEmpty
|
||||
case _ => true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -544,7 +544,7 @@ private[sbt] object DefaultBackgroundJobService {
|
|||
backgroundJobServices
|
||||
.values()
|
||||
.forEach(jobService => {
|
||||
jobService.jobs.filter(_.isAutoCancel).foreach(jobService.stop)
|
||||
jobService.jobs.withFilter(_.isAutoCancel).foreach(jobService.stop)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ object PluginDiscovery:
|
|||
.getResources(resourceName)
|
||||
.asScala
|
||||
.toSeq
|
||||
.filter(onClasspath(classpath, converter))
|
||||
.withFilter(onClasspath(classpath, converter))
|
||||
.flatMap { u =>
|
||||
IO.readLinesURL(u).map(_.trim).filter(!_.isEmpty)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ private[sbt] object WatchTransitiveDependencies {
|
|||
val projects = projectScopes.flatMap(_.project.toOption).distinct.toSet
|
||||
val scopes: Seq[Either[Scope, Seq[Glob]]] =
|
||||
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 =>
|
||||
data.getDirect(ScopedKey(s, Keys.watchSources.key)).map { task =>
|
||||
task.work match
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ object ActionCache:
|
|||
val dirPath = conv.toPath(dir)
|
||||
val allPaths = FileTreeView.default
|
||||
.list(dirPath.toGlob / ** / "*")
|
||||
.filter(!_._2.isDirectory)
|
||||
.withFilter(!_._2.isDirectory)
|
||||
.map(_._1)
|
||||
.sortBy(_.toString())
|
||||
// create a manifest of files and their hashes here
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ class DiskActionCacheStore(base: Path, converter: FileConverter) extends Abstrac
|
|||
val allPaths = mutable.Set(
|
||||
FileTreeView.default
|
||||
.list(dirPath.toGlob / ** / "*")
|
||||
.filter(!_._2.isDirectory)
|
||||
.withFilter(!_._2.isDirectory)
|
||||
.map(_._1)*
|
||||
)
|
||||
def doSync(ref: HashedVirtualFileRef, in: Path): Unit =
|
||||
|
|
|
|||
Loading…
Reference in New Issue