-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[PackageModel] Support swift-testing installed in a toolchain #7840
Conversation
On MacOS toolchain can shadow SDK content. This method is intended to locate and include swift-testing library from a toolchain before sdk content which to sure that builds that use a custom toolchain always get a custom swift-testing library as well.
c9be9b1
to
346b131
Compare
|
||
// The layout of the SDK is as follows: | ||
// | ||
// Library/Developer/Platforms/[PLATFORM].platform/Developer/Library/<Project>-[VERSION]/... |
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.
Do we really use Library/Developer
directory naming on Windows? I thought this was very Darwin-specific
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.
I'd think so since this was the original comment I moved, that's how we discover XCTest today.
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.
LGTM with a minor nit about a Windows-specific layout comment
@swift-ci please test |
@swift-ci please test Windows platform |
@swift-ci please test |
@swift-ci please test Windows |
@swift-ci please test Windows platform |
The library is going to be installed into SDK beside XCTest.
Windows requires that the library with adjacent to the executable or we discoverable via PATH.
bdc42f9
to
47120a0
Compare
Obviously cross repo PR testing from non-swift repo doesn't support changes in |
@swift-ci Please test |
Windows test fails presumably because it fails to decode |
@rintaro maybe it would be prudent to make it optional just in case people would try to run newer swiftpm with older toolchains? |
Yeah, optional sounds reasonable to me. |
@swift-ci please test |
@swift-ci please test Windows platform |
53b192e
to
a116a47
Compare
@swift-ci please test |
@swift-ci please test Windows platform |
…ironment Replace all of the copies of SDKROOT handling with a single property access on Environment type.
This allows us to support older Windows toolchains with newer swift package manager even the project only uses XCTest.
a116a47
to
5b2e5d2
Compare
@swift-ci please test |
@swift-ci please test Windows platform |
I'm going to land this is as a rebase because it has changes for both macOS and Windows and we should be revertible separately if we wanted to. |
return try AbsolutePath(validating: "../../lib/swift/macosx", relativeTo: resolveSymlinks(swiftCompilerPath)) | ||
try Self.toolchainLibDir(swiftCompilerPath: self.swiftCompilerPath).appending( | ||
components: ["swift", "macosx"] | ||
) | ||
} | ||
} | ||
|
||
public var toolchainLibDir: AbsolutePath { | ||
get throws { | ||
// FIXME: Not sure if it's better to base this off of Swift compiler or our own binary. |
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.
// FIXME: Not sure if it's better to base this off of Swift compiler or our own binary. |
extraSwiftCFlags = info.defaults.extraSwiftCFlags ?? [] | ||
} | ||
|
||
return ["-sdk", sdkroot.pathString] + runtime + xctest + extraSwiftCFlags | ||
return ["-sdk", sdkroot.pathString] + runtime + xctest + swiftTesting + extraSwiftCFlags |
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.
Can we limit to the testing framework in use by any chance?
…7856) - Explanation: On macOS SwiftPM should prefer swift-testing installed into a custom toolchain when used. On Windows we need special logic to discover swift-testing location. - Add special swift compiler "extra" flags to favor swift-testing installed in a toolchain. - Inject `-I`, `-L` on Windows that point to where swift-testing is installed in SDKROOT. - Inject a path to testing on `PATH` environment variable on Windows to make sure that the library is always discoverable. - Main Branch PR: #7840 - Resolves: rdar://132828246 - Risk: Medium (Although changes are only viable with toolchains have certain directories in them and test we could do for testing was manual validation). - Reviewed By: @MaxDesiatov @rintaro - Testing: Existing tests and manual validation using new toolchain (which is currently in development) on Windows and a custom toolchain plus CommandLine tools on macOS.
Properly handle swift-testing installations in toolchain/SDK.
Motivation:
On macOS SwiftPM should prefer swift-testing installed into a custom toolchain when used. On Windows we need special logic to discover swift-testing location.
Modifications:
-I
,-L
on Windows that point to where swift-testing is installed in SDKROOT.PATH
environment variable on Windows to make sure that the library is always discoverable.Resolves: rdar://132828246