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

Add support for conditionally linking dependencies based on platform #1087

Conversation

daltonclaybrook
Copy link
Contributor

@daltonclaybrook daltonclaybrook commented Jun 3, 2021

This PR makes it possible to conditionally link dependencies based on a specified list of platforms. It addresses an issue raised in #951 that the "platform filter" parameter in Xcode is currently not granular enough to prevent a framework from linking against tvOS and watchOS targets.

This is currently implemented as a new field on Dependency called conditionalPlatforms. In all honestly, I would prefer that the existing platform setting be renamed to something like platformFilter to disambiguate from this new setting, but I'm open to suggestions.

(cc: @raptorxcz, @yonaskolb, @jlott1)

@daltonclaybrook
Copy link
Contributor Author

daltonclaybrook commented Jun 3, 2021

Spitballing here: What if we changed the other field to be called platformFilter and this one simply platforms. Possible changes to docs:

  • platformFilter: String - This field is specific to Mac Catalyst. It corresponds to the "Platforms" dropdown in the Frameworks & Libraries section of Target settings in Xcode. Available options are: iOS, macOS and all. Defaults is all
  • platforms: [Platform] - List of platforms this dependency should apply to. Defaults to all applicable platforms.

Copy link
Owner

@yonaskolb yonaskolb left a comment

Choose a reason for hiding this comment

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

Thanks @daltonclaybrook. I agree with the rename of platformFilter, so please proceed. It can be marked as a breaking change in the changelog.

@@ -137,6 +144,7 @@ extension Dependency: JSONEncodable {
"embed": embed,
"codeSign": codeSign,
"link": link,
"conditionalPlatforms": conditionalPlatforms.map(Array.init)?.map(\.rawValue)
Copy link
Owner

Choose a reason for hiding this comment

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

Can we add a sort to make this deterministic. And I also don't think the Array init is required

@daltonclaybrook
Copy link
Contributor Author

@yonaskolb Just pushed up those changes. How do you feel about the name of the new field (currently "conditionalPlatforms")? Should this be changed as well?

@daltonclaybrook
Copy link
Contributor Author

@yonaskolb Please let me know what the next steps are on this. I'd really like to get this landed since my team needs it for an upcoming project.

@yonaskolb
Copy link
Owner

@yonaskolb Just pushed up those changes. How do you feel about the name of the new field (currently "conditionalPlatforms")? Should this be changed as well?

Yes, let's rename this to platforms. Sorry for the delay. Will approve after your change

@daltonclaybrook daltonclaybrook force-pushed the dalton/conditional-platform-dependencies branch from 2ca3e65 to 2d8a7c0 Compare June 18, 2021 15:24
Copy link
Owner

@yonaskolb yonaskolb left a comment

Choose a reason for hiding this comment

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

Great, thanks @daltonclaybrook!

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.

None yet

2 participants