Skip to content

Support custom platforms in conditionals#6794

Merged
neonichu merged 1 commit into
mainfrom
support-custom-platforms-in-conditionals
Aug 11, 2023
Merged

Support custom platforms in conditionals#6794
neonichu merged 1 commit into
mainfrom
support-custom-platforms-in-conditionals

Conversation

@neonichu

Copy link
Copy Markdown
Contributor

In #3742, support for custom platforms was added and I think everyone understood it as supporting custom deployment targets, but it actually also added API for custom platform conditionals. Those never actually worked, though, because any platform that the platform registry doesn't know about was dropped when going from TargetDescription to Target. This fixes it and adds a unit test.

See also RevenueCat/purchases-ios#2998

rdar://113709387

In #3742, support for custom platforms was added and I think everyone understood it as supporting custom deployment targets, but it actually also added API for custom platform conditionals. Those never actually worked, though, because any platform that the platform registry doesn't know about was dropped when going from `TargetDescription` to `Target`. This fixes it and adds a unit test.

See also RevenueCat/purchases-ios#2998

rdar://113709387
@neonichu neonichu self-assigned this Aug 10, 2023
@neonichu

Copy link
Copy Markdown
Contributor Author

@swift-ci please smoke test

@MaxDesiatov

MaxDesiatov commented Aug 10, 2023

Copy link
Copy Markdown
Contributor

How are these platform names applied when evaluating a condition? Could someone use it to match against an arbitrary target triple? If so, which triple component does it match against?

@neonichu

neonichu commented Aug 10, 2023

Copy link
Copy Markdown
Contributor Author

How are these platform names applied when evaluating a condition? Could someone use it to match against an arbitrary target triple? If so, which triple component does it match against?

It's up to the build system to apply them, SwiftPM's build system doesn't do anything with custom conditions, I think (as in, they should always be false).

@neonichu neonichu enabled auto-merge (squash) August 11, 2023 00:35
@neonichu neonichu merged commit a088168 into main Aug 11, 2023
@neonichu neonichu deleted the support-custom-platforms-in-conditionals branch August 11, 2023 01:55
NachoSoto added a commit to RevenueCat/purchases-ios that referenced this pull request Aug 11, 2023
…sion`

Fixes #2998.
This is now fixed in SPM: swiftlang/swift-package-manager#6794, but we need a workaround for now.

Since `.custom` doesn't work properly, this splits `Package.swift` based on Xcode version.
NachoSoto added a commit to RevenueCat/purchases-ios that referenced this pull request Aug 11, 2023
…3005)

Fixes #2998. See #2989 for why this is needed in the first place.
This is now fixed in SPM:
swiftlang/swift-package-manager#6794, but we need a
workaround for now.

Since `.custom` doesn't work properly (it gets evaluated in Xcode even
outside of that platform), this splits `Package.swift` based on Xcode
version.

Thanks @neonichu for helping with this.
MarkVillacampa pushed a commit to RevenueCat/purchases-ios that referenced this pull request Sep 6, 2023
…3005)

Fixes #2998. See #2989 for why this is needed in the first place.
This is now fixed in SPM:
swiftlang/swift-package-manager#6794, but we need a
workaround for now.

Since `.custom` doesn't work properly (it gets evaluated in Xcode even
outside of that platform), this splits `Package.swift` based on Xcode
version.

Thanks @neonichu for helping with this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants