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

[gn + codesign] mac code sign configuration for FlutterMacOS.framework.zip #35707

Merged
merged 12 commits into from
Feb 17, 2023
29 changes: 29 additions & 0 deletions sky/tools/create_macos_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ def regenerate_symlinks(fat_framework):
)


def embed_codesign_configuration(config_path, content):
with open(config_path, 'w') as f:
f.write(content)


def process_framework(dst, args, fat_framework, fat_framework_binary):
if args.dsym:
dsym_out = os.path.splitext(fat_framework)[0] + '.dSYM'
Expand All @@ -152,6 +157,30 @@ def process_framework(dst, args, fat_framework, fat_framework_binary):
],
cwd=dst)

macos_filepath_with_entitlements = ''
Copy link
Contributor

Choose a reason for hiding this comment

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

Should lines 160 to 170 be moved to line 151 and remove the zipping subprocess? as it is we are zipping twice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, updated to zip only once. Yeah I remember this artifact was historically unzipped twice (https://github.com/christopherfujino/codesign.py/blob/master/codesign.py#L151) for some reasons, but verified just now and it looks there we can do a single zip/unzip.

Also it's interesting that if i double click to extract the artifact, the symlinks are not preserved. But if i use the subprocess command "unzip.. -d .." then the symlinks are preserved in the extracted file.

macos_filepath_without_entitlements = 'FlutterMacOS.framework/Versions/A/FlutterMacOS'

embed_codesign_configuration(
os.path.join(dst, 'entitlements.txt'), macos_filepath_with_entitlements
)

embed_codesign_configuration(
os.path.join(dst, 'without_entitlements.txt'),
macos_filepath_without_entitlements
)

# Zip FlutterMacOS.framework.
subprocess.check_call([
Copy link
Member

Choose a reason for hiding this comment

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

Is this the resolution for #35623 that was reverted here #35680, because it was expected to not have entitlements? I'm not sure how these without_entitlements files work.

https://github.com/flutter/flutter/blob/fefb2b00bab8548e66aa09849dbd51c4b9c357d1/dev/conductor/core/lib/src/codesign.dart#L188

@christopherfujino

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry didn't realize there is an engine PR review on Thursday. These without_entiltements and 'entitlements.txt` are just text files embedded in the zip artifacts, not going to affect the correctness of anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Inspecting locally, looks like the symlinks are dropped in the build process. Current assumption is based on #35673.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this ready for review?

'zip',
'-r',
godofredoc marked this conversation as resolved.
Show resolved Hide resolved
'-y',
'FlutterMacOS.framework.zip',
'FlutterMacOS.framework',
'entitlements.txt',
'without_entitlements.txt',
],
cwd=dst)


if __name__ == '__main__':
sys.exit(main())