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 capability to specify variable entitlements #6293

Merged
merged 3 commits into from
May 21, 2024
Merged

Conversation

lucasmpaim
Copy link
Contributor

@lucasmpaim lucasmpaim commented May 16, 2024

Currently, Xcode don't have a good support for variables inside an entitlement value, causing an issue in projects with multiple environments and appclip

Resolves #5940

For some reason, Xcode are not solving variables defined in xcconfig on the entitlements file and for appclips the linter are forcing us to provide one file:

An AppClip '[REDACTED]' requires its Parent Application Identifiers Entitlement to be set
Fatal linting issues found
Consider creating an issue using the following link: https://github.com/tuist/tuist/issues/new/choose

Screenshot 2024-05-16 at 09 51 33

So this PR provides a capability to provide this file using a xcconfig settings, changing the CODE_SIGN_ENTITLEMENTS variable in a dynamic way.

Short description πŸ“

Add capability to set CODE_SIGN_ENTITLEMENTS on XCConfig to be able to sign appclip properly in a project with multiple environments

How to test the changes locally 🧐

Create a target with multiple configs one should have a different bundle_id
add a appclip to this target
Add a xcconfig settings on project
Create one entitlements file per config
Set .xcconfig() or a string literal "$()" on appclip entitlement

Contributor checklist βœ…

  • The code has been linted using run mise run lint:fix
  • The change is tested via unit testing or acceptance testing, or both
  • The title of the PR is formulated in a way that is usable as a changelog entry
  • In case the PR introduces changes that affect users, the documentation has been updated

Reviewer checklist βœ…

  • The code architecture and patterns are consistent with the rest of the codebase
  • Reviewer has checked that, if needed, the PR includes the label changelog:added, changelog:fixed, or changelog:changed, and the title is usable as a changelog entry

fix for tuist#5940

Currently, Xcode don't have a good support for variables inside an entitlement value, causing an issue in projects with multiple environments and appclip
Copy link
Collaborator

@kwridan kwridan 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 contributing this @lucasmpaim

Sources/ProjectDescription/Entitlements.swift Outdated Show resolved Hide resolved
@kwridan
Copy link
Collaborator

kwridan commented May 17, 2024

@all-contributors add @lucasmpaim for code

Copy link
Contributor

@kwridan

I've put up a pull request to add @lucasmpaim! πŸŽ‰

@lucasmpaim lucasmpaim requested a review from kwridan May 17, 2024 09:46
also add a new unit test to test variable set by string literal
@kwridan kwridan changed the title Add capability to set CODE_SIGN_ENTITLEMENTS on XCConfig Add capability to specify variable entitlements May 17, 2024
@kwridan kwridan added the changelog:added PR will be listed in the Added section of CHANGELOG label May 17, 2024
Copy link
Collaborator

@kwridan kwridan 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 updates @lucasmpaim

Copy link
Member

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

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

Just two minor comments, afterwards, we can merge πŸ™‚

Sources/TuistGenerator/Generator/ConfigGenerator.swift Outdated Show resolved Hide resolved
Sources/ProjectDescription/Entitlements.swift Outdated Show resolved Hide resolved
@lucasmpaim lucasmpaim requested a review from fortmarek May 20, 2024 11:47
@pepicrft pepicrft merged commit a647f6f into tuist:main May 21, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:added PR will be listed in the Added section of CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for defining code sign entitlements per configuration
4 participants