-
Notifications
You must be signed in to change notification settings - Fork 6k
Adds a script the generates and bundle the ios artifacts. #35168
Conversation
This is to simplify the migration to engine_v2 recipes and can potentially simplify the existing recipes moving most of the logic to the engine repository. Bug: flutter/flutter#81855
| # TODO(gw280): Remove --simulator-out-dir alias when all recipes are updated | ||
| parser.add_argument( | ||
| '--simulator-x64-out-dir', '--simulator-out-dir', type=str, required=True | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was done as of https://flutter-review.googlesource.com/c/recipes/+/14780, should be safe to remove the TODO and alias.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
| parser.add_argument('--clang-dir', type=str, default='clang_x64') | ||
| parser.add_argument('--x64-out-dir', type=str) | ||
| parser.add_argument('--arm64-out-dir', type=str, required=True) | ||
| parser.add_argument('--armv7-out-dir', type=str, required=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing should be using this arg anymore as of https://flutter-review.googlesource.com/c/recipes/+/29060, all armv7 logic should be removed. I guess we missed that cleanup in
| if args.armv7_out_dir: |
| parser.add_argument('--armv7-out-dir', type=str, required=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argument is still here, are we calling it somewhere?
| framework = os.path.join(dst, 'Flutter.framework') | ||
| simulator_framework = os.path.join(dst, 'sim', 'Flutter.framework') | ||
| arm64_framework = os.path.join(arm64_out_dir, 'Flutter.framework') | ||
| simulator_x64_framework = os.path.join( | ||
| simulator_x64_out_dir, 'Flutter.framework' | ||
| ) | ||
| if args.simulator_arm64_out_dir is not None: | ||
| simulator_arm64_framework = os.path.join( | ||
| args.simulator_arm64_out_dir, 'Flutter.framework' | ||
| ) | ||
| simulator_arm64_dylib = os.path.join(simulator_arm64_framework, 'Flutter') | ||
|
|
||
| arm64_dylib = os.path.join(arm64_framework, 'Flutter') | ||
| simulator_x64_dylib = os.path.join(simulator_x64_framework, 'Flutter') | ||
|
|
||
| if not os.path.isdir(arm64_framework): | ||
| print('Cannot find iOS arm64 Framework at %s' % arm64_framework) | ||
| return 1 | ||
|
|
||
| if not os.path.isdir(simulator_x64_framework): | ||
| print('Cannot find iOS x64 simulator Framework at %s' % simulator_framework) | ||
| return 1 | ||
|
|
||
| if not os.path.isfile(arm64_dylib): | ||
| print('Cannot find iOS arm64 dylib at %s' % arm64_dylib) | ||
| return 1 | ||
|
|
||
| if not os.path.isfile(simulator_x64_dylib): | ||
| print('Cannot find iOS simulator dylib at %s' % simulator_dylib) | ||
| return 1 | ||
|
|
||
| if not os.path.isfile(DSYMUTIL): | ||
| print('Cannot find dsymutil at %s' % DSYMUTIL) | ||
| return 1 | ||
|
|
||
| shutil.rmtree(framework, True) | ||
| shutil.copytree(arm64_framework, framework) | ||
| framework_binary = os.path.join(framework, 'Flutter') | ||
| process_framework(args, framework, framework_binary) | ||
|
|
||
| if args.simulator_arm64_out_dir is not None: | ||
| shutil.rmtree(simulator_framework, True) | ||
| shutil.copytree(simulator_arm64_framework, simulator_framework) | ||
|
|
||
| simulator_framework_binary = os.path.join(simulator_framework, 'Flutter') | ||
|
|
||
| # Create the arm64/x64 simulator fat framework. | ||
| subprocess.check_call([ | ||
| 'lipo', simulator_x64_dylib, simulator_arm64_dylib, '-create', | ||
| '-output', simulator_framework_binary | ||
| ]) | ||
| process_framework(args, simulator_framework, simulator_framework_binary) | ||
| simulator_framework = simulator_framework | ||
| else: | ||
| simulator_framework = simulator_x64_framework | ||
|
|
||
| # Create XCFramework from the arm-only fat framework and the arm64/x64 simulator frameworks, or just the | ||
| # x64 simulator framework if only that one exists. | ||
| xcframeworks = [simulator_framework, framework] | ||
| create_xcframework(location=dst, name='Flutter', frameworks=xcframeworks) | ||
|
|
||
| # Add the x64 simulator into the fat framework | ||
| subprocess.check_call([ | ||
| 'lipo', arm64_dylib, simulator_x64_dylib, '-create', '-output', | ||
| framework_binary | ||
| ]) | ||
|
|
||
| process_framework(args, framework, framework_binary) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you pull this out into a function called create_framework or something similar so it's the same abstraction level as generate_gen_snapshot and zip_archive?
zanderso
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm w/ nit after addressing @jmagman's comments.
| import subprocess | ||
| import shutil | ||
| import sys | ||
| import os |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please alphabetize imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
jmagman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with nit about removing last armv7 reference.
| parser.add_argument('--clang-dir', type=str, default='clang_x64') | ||
| parser.add_argument('--x64-out-dir', type=str) | ||
| parser.add_argument('--arm64-out-dir', type=str, required=True) | ||
| parser.add_argument('--armv7-out-dir', type=str, required=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argument is still here, are we calling it somewhere?
Removed it, I missed it in the last commit. |
This is to simplify the migration to engine_v2 recipes and can potentially simplify the existing recipes moving most of the logic to the engine repository.
Bug: flutter/flutter#81855
Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.