Skip to content

Commit 7ce9379

Browse files
authored
Resolve traits on top level manifests explicitly (#9300)
If a package is contained in a wrapper project it will have a top level manifest with no root packages. In this case, we weren't resolving default traits on the dependencies within this top level manifest.
1 parent 04b0249 commit 7ce9379

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/Workspace/Workspace+Manifests.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,15 @@ extension Workspace {
594594
// optimization: preload first level dependencies manifest (in parallel)
595595
let firstLevelDependencies = try topLevelManifests.values.map { manifest in
596596
let parentEnabledTraits = self.enabledTraitsMap[manifest.packageIdentity]
597+
598+
// Resolve and flatten the list of traits on top level manifests. This handles
599+
// the case where a package is being loaded in a wrapper project (not package),
600+
// where there are no root packages but there are dependencies.
601+
if root.packages.isEmpty {
602+
let topLevelManifestTraits = try manifest.enabledTraits(using: parentEnabledTraits, nil)
603+
self.enabledTraitsMap[manifest.packageIdentity] = topLevelManifestTraits
604+
}
605+
597606
return try manifest.dependencies.filter { dep in
598607
let explicitlyEnabledTraits = dep.traits?.filter({
599608
guard let condition = $0.condition else { return true }

0 commit comments

Comments
 (0)