Skip to content

Commit 07e161d

Browse files
committed
possibly maybe
1 parent 1cf615b commit 07e161d

File tree

2 files changed

+293
-32
lines changed

2 files changed

+293
-32
lines changed

Sources/PackageGraph/Pubgrub/PubgrubDependencyResolver.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,18 @@ public struct PubgrubDependencyResolver {
132132

133133
/// Execute the resolution algorithm to find a valid assignment of versions.
134134
public func solve(constraints: [Constraint]) -> Result<[DependencyResolver.Binding], Error> {
135-
let root = DependencyResolutionNode.root(package: .root(
136-
identity: .plain("<synthesized-root>"),
137-
path: .root
138-
))
135+
// 👀 is this the right thing to do?
136+
let root: DependencyResolutionNode
137+
if constraints.count == 1, let constraint = constraints.first, constraint.package.kind.isRoot {
138+
// root level package, use it as our resolution root
139+
root = .root(package: constraint.package)
140+
} else {
141+
// more complex setup requires a synthesized root
142+
root = .root(package: .root(
143+
identity: .plain("<synthesized-root>"),
144+
path: .root
145+
))
146+
}
139147

140148
do {
141149
// strips state

0 commit comments

Comments
 (0)