-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Relax requirements around local engine, build hello_world with bitcode #39357
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
Conversation
| '-miphoneos-version-min=8.0', | ||
| ]; | ||
|
|
||
| final List<String> bitcodeArgs = <String>['-fembed-bitcode']; |
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.
Re-using this list seems likely to cause errors in the future.
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.
Changed it to a const string and an expanded single use list below.
|
|
||
| import 'dart:async'; | ||
|
|
||
| import 'package:flutter_tools/src/base/common.dart'; |
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.
Nit: relative import
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
| buildSettings = { | ||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| ENABLE_BITCODE = NO; | ||
| ENABLE_BITCODE = YES; |
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.
YES should be the default, remove the setting instead of overriding.
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
| } | ||
|
|
||
| if (bitcode) { | ||
| final String iPhoneSdk = await xcode.iPhoneSdkLocation(); |
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.
How do you know you need the iPhone SDK?
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.
A warning is generated otherwise. It may be harmless but I'd like to avoid it.
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.
Is this codepath is used for iphonesimulator and macosx too?
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.
Or rather, will it be used for macosx in the future since bitcode is only set from xcode_backend. I believe this would need to be iphonesimulator in the Debug simulator case though?
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.
This can't be used for simulator because it's AOT and specific to ARM.
It looks like it's already being used for macOS. I'll move this behind some guards similar to what's used for -miphoneos
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.
We only support x64 desktop, but it is probably better to have semantically named selection
| // gen_snapshot would provide an argument to do this automatically. | ||
| if (platform == TargetPlatform.ios && bitcode) { | ||
| final IOSink sink = fs.file('$assembly.bitcode').openWrite(); | ||
| final IOSink sink = fs.file('$assembly.stripped.S').openWrite(); |
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.
cc will emit a warning if this file doesn't end with .S.
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
Codecov Report
@@ Coverage Diff @@
## master #39357 +/- ##
==========================================
- Coverage 56.76% 55.97% -0.79%
==========================================
Files 195 195
Lines 18430 18413 -17
==========================================
- Hits 10461 10306 -155
- Misses 7969 8107 +138
Continue to review full report at Codecov.
|
jonahwilliams
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
Please ignore patch coverage, it is bad. Someday, I'll figure out how to fix it....
…h bitcode (flutter#39357)" (flutter#39431)" This reverts commit 393106f.
Description
Now that we build the engine with bitcode on CI, we should no longer require local engine builds in the tool to enable bitcode.
It is still not turned on by default - a user would have to update their Xcode project to set
ENABLE_BITCODEtoYES, or explicitly pass--bitcodetoflutter build aot.I've also cleaned up some unnecessary changes around the dsym util - apparently it doesn't make sense to have symbols anyway with bitcode, and it was failing locally without some changes for me.
Unfortunately, this no longer validates that bitcode is present in the binary because the method used doesn't work on FAT binaries. We could still validate them by e.g. running
xcrun bitcode_stripon the binary and validating that the output is different from the input, but it seems excessive and would slow down build times.Related Issues
Fixes #15288 (!)
Filed #39356 to track the remaining work once this has had some time to bake.
Tests
I added the following tests:
Updated existing tests for the new changes/removed code.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?