mirror of https://github.com/sbt/sbt.git
Handle DynamicDepsInitialize in settings evaluation (fix actions/multi-scope MatchError)
- Expose inner Initialize on DynamicDepsInitialize (val inner) in Settings.scala - Add DynamicDepsInitialize case in INode.scala transform; delegate to inner init - Include ScopeFilter.scala scalafmt changes
This commit is contained in:
parent
da3b0deb5f
commit
f8b7d61b5a
|
|
@ -101,7 +101,7 @@ object ScopeFilter {
|
|||
sfilter(data).toSeq.map(s => Project.inScope(s, i)).join
|
||||
val dynamicDeps = i match
|
||||
case k: Def.KeyedInitialize[?] => Seq((k.scopedKey.key, sfilter))
|
||||
case _ => Nil
|
||||
case _ => Nil
|
||||
Def.withDynamicDependencies(inner, dynamicDeps)
|
||||
|
||||
final class TaskKeyAll[A] private[sbt] (i: Initialize[Task[A]]):
|
||||
|
|
@ -115,7 +115,7 @@ object ScopeFilter {
|
|||
sfilter(data).toSeq.map(s => Project.inScope(s, i)).join(_.join)
|
||||
val dynamicDeps = i match
|
||||
case k: Def.KeyedInitialize[?] => Seq((k.scopedKey.key, sfilter))
|
||||
case _ => Nil
|
||||
case _ => Nil
|
||||
Def.withDynamicDependencies(inner, dynamicDeps)
|
||||
|
||||
private[sbt] val Make = new Make {}
|
||||
|
|
@ -236,13 +236,18 @@ object ScopeFilter {
|
|||
.groupBy(_.project)
|
||||
.view
|
||||
.mapValues: byProj =>
|
||||
byProj.groupBy(_.config).view.mapValues: byConfig =>
|
||||
byConfig.groupBy(_.task).view.mapValues(_.toSet).toMap
|
||||
.toMap
|
||||
byProj
|
||||
.groupBy(_.config)
|
||||
.view
|
||||
.mapValues: byConfig =>
|
||||
byConfig.groupBy(_.task).view.mapValues(_.toSet).toMap
|
||||
.toMap
|
||||
.toMap
|
||||
new Data(units, resolve, new AllScopes(scopes, grouped))
|
||||
|
||||
def expandDynamicDeps(deps: Seq[Any], structure: BuildStructure): Set[Def.ScopedKey[?]] =
|
||||
def expandDynamicDeps(deps: Seq[Any], structure: BuildStructure): Set[
|
||||
Def.ScopedKey[?]
|
||||
] =
|
||||
if deps.isEmpty then Set.empty
|
||||
else
|
||||
val data = dataFromStructure(structure)
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ class EvaluateSettings[I <: Init](
|
|||
o.a match
|
||||
case None => constant(() => o.f(None))
|
||||
case Some(i) => single[s, A](transform(i), x => o.f(Some(x)))
|
||||
case d: DynamicDepsInitialize[A] => transform(d.inner)
|
||||
case StaticScopes => strictConstant(allScopes)
|
||||
|
||||
private lazy val roots: Seq[INode[?]] = compiledSettings.flatMap { cs =>
|
||||
|
|
|
|||
|
|
@ -1008,7 +1008,7 @@ trait Init:
|
|||
end Apply
|
||||
|
||||
private[sbt] final class DynamicDepsInitialize[A1](
|
||||
inner: Initialize[A1],
|
||||
val inner: Initialize[A1],
|
||||
val dynamicDeps: Seq[Any]
|
||||
) extends Initialize[A1]:
|
||||
override def dependencies: Seq[ScopedKey[?]] = inner.dependencies
|
||||
|
|
|
|||
Loading…
Reference in New Issue