Skip to content
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

Preserve environment in tripleString(forPlatformVersion:) #6834

Merged
merged 1 commit into from Aug 25, 2023

Conversation

kabiroberai
Copy link
Contributor

@kabiroberai kabiroberai commented Aug 21, 2023

Preserve the environmentName part of triples when altering the OS version with Triple.tripleString(forPlatformVersion:)

Motivation:

Building for the iOS simulator (and presumably anything other triple with a fourth component) would fail because we would generate the wrong swiftc/clang -target, incorrectly excluding the Triple.environmentName.

Modifications:

  • Modify tripleString(forPlatformVersion:) to include self.environmentName if it is non-empty.

Result:

You can now build for the iOS simulator with

swift build --triple arm64-apple-ios-simulator --sdk "$(xcrun --sdk iphonesimulator --show-sdk-path)"

or if you also pull #6828, just

swift build --triple arm64-apple-ios-simulator

return """
\(self.archName)-\
\(self.vendorName)-\
\(self.osNameUnversioned)\(version)
\(self.osNameUnversioned)\(version)\
\(self.environmentName.isEmpty ? "" : "-\(self.environmentName)")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rauhul could you please confirm whether this is correct? Not sure if I'm missing anything else here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm currently on vacation and not critically thinking, however until im back (aug 28th) @artemcm may be able to provide some feedback.

@MaxDesiatov MaxDesiatov changed the title Preserve env in tripleString(forPlatformVersion:) Preserve environment in tripleString(forPlatformVersion:) Aug 21, 2023
Copy link
Contributor

@artemcm artemcm left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! Looks good.

@MaxDesiatov
Copy link
Member

@swift-ci smoke test

@tomerd
Copy link
Member

tomerd commented Aug 25, 2023

@swift-ci smoke test windows

@tomerd
Copy link
Member

tomerd commented Aug 25, 2023

@MaxDesiatov this is ready to be merged?

@MaxDesiatov MaxDesiatov enabled auto-merge (squash) August 25, 2023 17:00
@MaxDesiatov MaxDesiatov merged commit 28489b3 into apple:main Aug 25, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants