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

Turn off bitcode in existing iOS Xcode projects #112828

Merged
merged 2 commits into from
Oct 4, 2022

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Oct 3, 2022

Starting with Xcode 14, bitcode is no longer required for watchOS and tvOS applications, and the App Store no longer accepts bitcode submissions from Xcode 14.

https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes

Ensure Flutter apps have ENABLE_BITCODE set to NO. We never turned bitcode on by default in our template, but it's possible the user turned it on manually. It it is on, then give the user a warning and remove the build setting.

$ flutter build ios --config-only
Building com.example.testCreate for device (ios-release)...
Disabling deprecated bitcode Xcode build setting. See https://github.com/flutter/flutter/issues/107887 for additional details.
Upgrading project.pbxproj
Automatically signing iOS for device deployment using specified development team in Xcode project: S8QB4VV633

Confirmed this worked and removed the build setting in the test project where I manually turned it on:

				DEVELOPMENT_TEAM = S8QB4VV633;
-				ENABLE_BITCODE = YES;
				INFOPLIST_FILE = Runner/Info.plist;

Fixes #111776

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@jmagman jmagman self-assigned this Oct 3, 2022
@flutter-dashboard flutter-dashboard bot added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. labels Oct 3, 2022
@jmagman
Copy link
Member Author

jmagman commented Oct 3, 2022

Actually, instead of removing the build setting, it will be safer to set ENABLE_BITCODE = NO; for all versions of Xcode. On Xcode < 14 the OS default is YES. That will allow us to more confidently remove bitcode from the tool without needing to check Xcode versions.

@jmagman jmagman marked this pull request as draft October 3, 2022 22:32
@jmagman jmagman marked this pull request as ready for review October 3, 2022 23:04
@jmagman jmagman changed the title Remove Xcode build setting in existing projects Turn off bitcode in existing iOS Xcode projects Oct 3, 2022
@jmagman
Copy link
Member Author

jmagman commented Oct 3, 2022

Actually, instead of removing the build setting, it will be safer to set ENABLE_BITCODE = NO; for all versions of Xcode.

Done.

// Only print for the first discovered change found.
logger.printWarning('Disabling deprecated bitcode Xcode build setting. See https://github.com/flutter/flutter/issues/107887 for additional details.');
}
return line.replaceAll('ENABLE_BITCODE = YES', 'ENABLE_BITCODE = NO');
Copy link
Member

Choose a reason for hiding this comment

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

is the spacing here guaranteed to be a single space on both sides of the =?

Copy link
Member Author

Choose a reason for hiding this comment

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

I mean it's totally undocumented but it's been that way for as long as I've been mucking with Xcode projects.

if (_xcodeProjectInfoFile.existsSync()) {
processFileLines(_xcodeProjectInfoFile);
} else {
logger.printTrace('Xcode project not found, skipping removing bitcode migration.');
Copy link
Member

Choose a reason for hiding this comment

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

isn't migrate() supposed to return false if the migration was skipped?

Copy link
Member Author

Choose a reason for hiding this comment

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

At least how it works now is that returning false means something catastrophic happened and the build fails:

if (!migration.run()) {
throwToolExit('Unable to migrate project files');
}

if (!migration.run()) {
return XcodeBuildResult(success: false);
}

etc
if (!migrator.migrate()) {
// Migration failures should be more robust, with transactions and fallbacks.
// See https://github.com/flutter/flutter/issues/12573 and
// https://github.com/flutter/flutter/issues/40460
return false;
}

So this comment is just wrong:

/// Returns whether migration was successful or was skipped.
bool migrate();

Copy link
Member Author

Choose a reason for hiding this comment

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

Will fix in follow-up PR.

Copy link
Member

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

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

two nit questions, otherwise LGTM

auto-submit bot pushed a commit that referenced this pull request May 20, 2024
Flutter deprecated bitcode in 2022 #112828, and introduced a warning in #112900 to let add-to-app devs know.

Apps should be migrated by now, remove the outdated warning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate Flutter projects to remove ENABLE_BITCODE=YES
2 participants