planner: skip macro targets (#208)
- Commit
491fe2fc2a39cedb56013a3c3dc2b1c1f2940bf7- Author
- Alex Pawlowski <[email protected]>
- When
- 2026-10-06 03:14 UTC (2 months ago)
- Parents
6f87f8f
Currently, when using a package with macros like TCA the build fails with the following message. ``` Error: Could not find package containing product 'SwiftSyntaxMacros' ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Package planning now skips macro targets when collecting resources and resolving dependencies. This prevents dependencies belonging to macro targets from being traversed as part of planning, while leaving dependency handling for other target types unchanged. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Kabir Oberai <[email protected]>
Diff
Sources/PackLib/Planner.swift
diff --git a/Sources/PackLib/Planner.swift b/Sources/PackLib/Planner.swiftindex f718769..df2f012 100644--- a/Sources/PackLib/Planner.swift+++ b/Sources/PackLib/Planner.swift@@ -137,6 +137,10 @@ public struct Planner: Sendable { throw StringError("Could not find target '\(targetName)' in package '\(targetPackage.name)'") } guard visited.insert(targetName).inserted else { continue }+ // Macro targets are compiler plugins that run on the host, not code+ // linked into the iOS app. Skip them to avoid resolving their+ // host-only dependencies (e.g. SwiftSyntaxMacros).+ if target.type == "macro" { continue } if target.moduleType == "BinaryTarget" { resources.append(.binaryTarget(name: targetName)) }@@ -408,6 +412,7 @@ private struct PackageDump: Decodable { struct Target: Decodable { let name: String let moduleType: String+ let type: String? let productDependencies: [String]? let targetDependencies: [String]? let resources: [Resource]?