Hive
SwiftPM lowering omits sibling path-package dependencies
GitHub issue · Open
Summary
When a Swift package depends on a sibling package through .package(path:), Once loads the root package but omits the sibling package’s products from the derived dependency edges. The graph validates successfully, then compilation fails when source files import the missing module.
Reproduction
Given this layout:
repo/
PackageA/
Package.swift
Sources/
PackageB/
Package.swift
Sources/
PackageA declares:
.package(path: "../PackageB")
A macro target in PackageA depends on a product from PackageB:
.product(name: "PackageBMacroSupport", package: "PackageB")
From PackageA:
once query target SwiftPackage_PackageA_PackageAMacros
once query validate-workspace
once build SwiftPackage_PackageA_PackageA
The target record does not include PackageBMacroSupport in deps, and workspace validation reports no diagnostics. Compilation later fails with:
error: no such module 'PackageBMacroSupport'
The same omission affects ordinary library products from sibling path packages, not only macro support targets.
Expected behavior
Once should follow declared local path dependencies and include their selected products in the graph. If dependencies outside the selected workspace root are intentionally unsupported, graph loading should report that boundary instead of returning a valid but incomplete graph.
Tested with Once 0.57.0 on macOS.
Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.
Start a Flight and preserve its objective, outcome, and session here.
No GitHub comments yet.