Skip to content

Commit

Permalink
Binary dependencies of C/C++ modules break build planning (#8056)
Browse files Browse the repository at this point in the history
Fix a regression where the build planning phase will early terminate if
SwiftPM packages contain binary targets that C/C++ products refer to,
#8055.

### Motivation:

When running `swift build` on SwiftPM packages with binary targets that
C++ products refer to, they will early terminate during the build
planning phase with the following error:

```swift
error: InternalError(description: "Internal error. Please file a bug at https://github.com/swiftlang/swift-package-manager/issues with this info. unknown module: <ResolvedModule: Python, binary>")
```

### Modifications:

Remove the guard, so we do not fail ~~if the module dependency does not
yet exist in the build plan's target map, which I think is normal~~ on
binary targets that C++ products refer to, since they don't have build
descriptions.

### Result:

When running `swift build` on SwiftPM packages with binary targets that
C++ products refer to, the build planning phase will proceed
successfully without error.

---------

Signed-off-by: furby™ <devs@wabi.foundation>
  • Loading branch information
furby-tm authored Jan 15, 2025
1 parent cc0af87 commit 0c6acf3
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,10 @@ extension LLBuildManifestBuilder {

case .library(.automatic), .library(.static), .plugin:
for module in product.modules {
guard let dependencyDescription = self.plan.description(
let dependencyDescription = self.plan.description(
for: module,
context: product.type == .plugin ? .host : target.destination
) else
{
throw InternalError("unknown module: \(module)")
}
)
addStaticTargetInputs(dependencyDescription)
}
case .test:
Expand Down

0 comments on commit 0c6acf3

Please sign in to comment.