-
Notifications
You must be signed in to change notification settings - Fork 1.4k
PIF: Ensure targets are created #9212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
PIF: Ensure targets are created #9212
Conversation
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
@swift-ci test |
/// documentation for AbsolutePath. | ||
public init(validating pathString: String) throws { | ||
self.underlying = try .init(validating: pathString) | ||
self.underlying = try .init( |
There was a problem hiding this comment.
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 } |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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