Skip to content

Commit 27c9f48

Browse files
committed
Don't link plugin dependencies to products
This fixes two issues with plugins and their dependencies: - we were traversing plugin products and including their targets as part of any product - since we are including plugin targets as dependencies as well, we could traverse plugin targets in a similarly incorrect way
1 parent 979dabc commit 27c9f48

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Sources/Build/BuildPlan.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,19 +702,22 @@ public class BuildPlan: SPMBuildCore.BuildPlan {
702702
switch dependency {
703703
// Include all the dependencies of a target.
704704
case .target(let target, _):
705+
if [.macro, .plugin].contains(target.type) {
706+
return []
707+
}
705708
return target.dependencies.filter { $0.satisfies(self.buildEnvironment) }
706709

707710
// For a product dependency, we only include its content only if we
708-
// need to statically link it or if it's a plugin.
711+
// need to statically link it.
709712
case .product(let product, _):
710713
guard dependency.satisfies(self.buildEnvironment) else {
711714
return []
712715
}
713716

714717
switch product.type {
715-
case .library(.automatic), .library(.static), .plugin:
718+
case .library(.automatic), .library(.static):
716719
return product.targets.map { .target($0, conditions: []) }
717-
case .library(.dynamic), .test, .executable, .snippet, .macro:
720+
case .library(.dynamic), .test, .executable, .snippet, .macro, .plugin:
718721
return []
719722
}
720723
}

0 commit comments

Comments
 (0)