-
Notifications
You must be signed in to change notification settings - Fork 196
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
[Explicit Modules] Handle re-mapped platform versions when specifying SDK-aligned -clang-target
on Darwin platforms
#1394
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"Version": "10.15", | ||
"VersionMap": { | ||
"macOS_iOSMac": {}, | ||
"iOSMac_macOS": {} | ||
"macOS_iOSMac": {"10.15":"13.3"}, | ||
"iOSMac_macOS": {"13.3":"10.15"} | ||
}, | ||
"CanonicalName": "macosx10.15" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3747,7 +3747,7 @@ final class SwiftDriverTests: XCTestCase { | |
|
||
func testClangTargetForExplicitModule() throws { | ||
#if os(macOS) | ||
let sdkRoot = testInputsPath.appending(component: "SDKChecks").appending(component: "iPhoneOS.sdk") | ||
let sdkRoot = testInputsPath.appending(component: "SDKChecks").appending(component: "MacOSX10.15.sdk") | ||
|
||
// Check -clang-target is on by default when explicit module is on. | ||
try withTemporaryDirectory { path in | ||
|
@@ -3756,17 +3756,37 @@ final class SwiftDriverTests: XCTestCase { | |
$0 <<< "import Swift" | ||
} | ||
var driver = try Driver(args: ["swiftc", "-explicit-module-build", | ||
"-target", "arm64-apple-ios14.0", | ||
"-target", "arm64-apple-macos10.14", | ||
"-sdk", sdkRoot.pathString, | ||
main.pathString]) | ||
guard driver.isFrontendArgSupported(.clangTarget) else { | ||
throw XCTSkip("Skipping: compiler does not support '-clang-target'") | ||
} | ||
let plannedJobs = try driver.planBuild() | ||
XCTAssertTrue(plannedJobs.contains { job in | ||
job.commandLine.contains(subsequence: [.flag("-clang-target"), .flag("arm64-apple-macos10.15")]) | ||
}) | ||
} | ||
|
||
// Check -clang-target is handled correctly with the MacCatalyst remap. | ||
try withTemporaryDirectory { path in | ||
let main = path.appending(component: "Foo.swift") | ||
try localFileSystem.writeFileContents(main) { | ||
$0 <<< "import Swift" | ||
} | ||
var driver = try Driver(args: ["swiftc", "-explicit-module-build", | ||
"-target", "arm64e-apple-ios13.0-macabi", | ||
"-sdk", sdkRoot.pathString, | ||
main.pathString]) | ||
guard driver.isFrontendArgSupported(.clangTarget) else { | ||
throw XCTSkip("Skipping: compiler does not support '-clang-target'") | ||
} | ||
let plannedJobs = try driver.planBuild() | ||
XCTAssertTrue(plannedJobs.contains { job in | ||
job.commandLine.contains(subsequence: [.flag("-clang-target"), .flag("arm64-apple-ios13.0")]) | ||
job.commandLine.contains(subsequence: [.flag("-clang-target"), .flag("arm64e-apple-ios13.3-macabi")]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly here, are we remapping from the SDK version and not from the driver's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah interesting, thanks for the clarification! |
||
}) | ||
} | ||
|
||
// Check -disable-clang-target works | ||
try withTemporaryDirectory { path in | ||
let main = path.appending(component: "Foo.swift") | ||
|
@@ -3775,7 +3795,7 @@ final class SwiftDriverTests: XCTestCase { | |
} | ||
var driver = try Driver(args: ["swiftc", "-disable-clang-target", | ||
"-explicit-module-build", | ||
"-target", "arm64-apple-ios14.0", | ||
"-target", "arm64-apple-macos10.14", | ||
"-sdk", sdkRoot.pathString, | ||
main.pathString]) | ||
guard driver.isFrontendArgSupported(.clangTarget) else { | ||
|
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.
Where does the
macos10.15
come from here? Does it always pick the SDK 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.
Yes, it comes from the
SDKSettings
's: