Skip to content

Conversation

bkhouri
Copy link
Contributor

@bkhouri bkhouri commented Oct 2, 2025

Some PIF target creation were guarded behind a tool version. Remove this guard to ensure modules can be build using --target with the Swift Build build system.

Fixes: #9138
Issue: rdar://160638539
Depends on: #9162

Ensure the SwiftBuild build systam has feature parity with the Native
build system as it relates to coverage.

Fixes: swiftlang#9077
Fixes: swiftlang#9197
Issue: rdar://159461439
Some PIF target creation were guarded behind a tool versioin.  Remove
this guard to ensure modules can be build using `--target` with the Swift
Build build system.

Fixes: swiftlang#9138
Issue: rdar://160638539
@bkhouri bkhouri requested a review from pmattos October 2, 2025 18:13
@bkhouri
Copy link
Contributor Author

bkhouri commented Oct 2, 2025

@swift-ci test

/// documentation for AbsolutePath.
public init(validating pathString: String) throws {
self.underlying = try .init(validating: pathString)
self.underlying = try .init(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I would favor TSCAbsolutePath(...) instead of the harder to read .init(...).

/// we also construct a testable version of said executable.
mutating func makeTestableExecutableSourceModule(_ executableModule: PackageGraph.ResolvedModule) throws {
precondition(executableModule.type == .executable)
guard self.package.manifest.toolsVersion >= .v5_5 else { return }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: For reference, this is the comment on the original PIF builder (which I preserved in the func doc comment above):

// If we're building an executable and the tools version is new enough, 
// we also construct a testable version of the executable.
if manifest.toolsVersion >= .v5_5 { ... }

So maybe Swift 5.5 somehow made this possible? Have you tested this in toolchains older than 5.5?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SwiftBuild integration in SwiftPM is occurring on branch main, and I don't expect we will support swift 5.x

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Packages below tools version 5.5 shouldn't generate this target representing the testable version of an executable since that feature isn't available. The tools version of a package is independent of the version of the tools themselves. I think the underlying issue here is likely that --target is not discovering the regular variant of the target, which is created in all tools versions. My best guess is that maybe that target got subsumed by a product target at the PIF layer, and the lookup code doesn't account for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parity: Could not find target named 'exec2' failure when building sample package (SwiftBuild)
3 participants