mirror of https://github.com/sbt/sbt.git
fix: Resolve ThisProject to empty to avoid cycle in aggregate/deps DAG
Resolving ThisProject to ProjectRef(uri, p.id) created a self-reference in the aggregate (and dependency) list. BuildUtil.checkCycles runs topological sort on this relation and throws Cyclic when it sees the self-loop. Treat ThisProject as no-op: resolve to Vector.empty so the build loads without error. aggregate(ThisProject) / dependsOn(ThisProject) is effectively a no-op (self is already included).
This commit is contained in:
parent
1a6039c17a
commit
4dfe68a681
|
|
@ -715,7 +715,7 @@ private[sbt] object Load {
|
|||
val resolve: Project => ResolvedProject = (p: Project) =>
|
||||
p.resolve:
|
||||
case LocalAggregate => resolveAutoAggregate(uri, p, ps)
|
||||
case ThisProject => Vector(ProjectRef(uri, p.id))
|
||||
case ThisProject => Vector.empty // self-reference; treat as no-op to avoid cycle
|
||||
case ref => Vector(Scope.resolveProjectRef(uri, rootProject, ref))
|
||||
LoadedBuildUnit(
|
||||
unit.unit,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
# Verify that ThisProject in aggregate doesn't cause runtime error
|
||||
# This tests the fix for https://github.com/sbt/sbt/issues/3616
|
||||
> check
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue