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

Rewrite Entitlements.plist to avoid newline issues. #57

Merged
merged 2 commits into from
May 22, 2024

Conversation

alcarithemad
Copy link
Contributor

@alcarithemad alcarithemad commented May 22, 2024

The macOS utility codesign fails with obscure, difficult to debug errors when presented with CRLF newlines in an XML format Entitlements.plist.

Git can be configured globally to mangle newlines to CRLF (via core.autocrlf=true).

Cookiecutter manages the git clone of the template, so there's no easy way for us to set the configuration at the repository level during the template instantiation process.

To prevent a build failure that bit someone during the PyCon US 2024 sprints, the post_gen_projecct hook now reads the Entitlements.plist file and writes it back with the LF newlines that codesign expects.

I tested this by generating a new project locally after running git config --global core.autocrlf true and verifying that the build fails during signing (and confirmed that the templated file has CRLF newlines). Then, I configured the project to use this branch and successfully built and signed the template app, despite still having the Git option enabled.

Fixes beeware/briefcase#1831

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

Git can be configured globally to mangle newlines to CRLF.
Cookiecutter manages the git clone, so there's no easy way for us to
set the configuration at the repository level during the templating
process.

The macOS utility `codesign` fails with obscure, hard to debug errors
when presented with CRLF newlines in Entitlements.plist.
Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

Looks good; it might be worth doing the same thing to the Info.plist file. There's no evidence that this is actually causing problems, but given it's also a plist and some tooling has a problem, it would be worth fixing pre-emptively.

@alcarithemad
Copy link
Contributor Author

Added Info.plist rewrite.

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

Awesome - thanks for the fix!

@freakboy3742 freakboy3742 merged commit c8d3fef into beeware:main May 22, 2024
21 checks passed
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.

briefcase build not working even after checking XCode and iCloud Drive
2 participants