Skip to content

Fix parsed name of the newly-added SDKPlatformKind to use raw toolchain name #1598

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

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/SwiftDriver/Toolchains/DarwinToolchain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ public final class DarwinToolchain: Toolchain {
case watchsimulator
case appletvos
case appletvsimulator
case visionos
case visionsimulator
case visionos = "xros"
case visionsimulator = "xrsimulator"
case unknown
}

Expand Down
21 changes: 21 additions & 0 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4466,6 +4466,27 @@ final class SwiftDriverTests: XCTestCase {
}
}

func testDarwinSDKToolchainName() throws {
var envVars = ProcessEnv.vars
envVars["SWIFT_DRIVER_LD_EXEC"] = ld.nativePathString(escaped: false)

try withTemporaryDirectory { tmpDir in
let sdk = tmpDir.appending(component: "XROS1.0.sdk")
try localFileSystem.createDirectory(sdk, recursive: true)
try localFileSystem.writeFileContents(sdk.appending(component: "SDKSettings.json"), bytes:
"""
{
"Version":"1.0",
"CanonicalName": "xros1.0"
}
"""
)

let sdkInfo = DarwinToolchain.readSDKInfo(localFileSystem, VirtualPath.absolute(sdk).intern())
XCTAssertEqual(sdkInfo?.platformKind, .visionos)
}
}

// Test cases ported from Driver/macabi-environment.swift
func testDarwinSDKVersioning() throws {
var envVars = ProcessEnv.vars
Expand Down