Migrate Xcode projects last version checks to Xcode 15.1 (#140256)

Change the following in the `flutter create` templates.  I didn't make any auto-migrations for existing apps because none seem that critical:
1. Turn on `ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS` in iOS and macOS.
1. Turn on `BuildIndependentTargetsInParallel` in macOS template.  https://github.com/flutter/flutter/pull/125827/files#r1181817619 
1. Turn on `DEAD_CODE_STRIPPING` in macOS template. 
1. Set `ENABLE_USER_SCRIPT_SANDBOXING=NO` in iOS and macOS template.  `flutter` scripts don't work with this on.  This might require a migration in the future to explicitly turn this one off. However at least for now if the setting isn't present it defaults to `NO`.

Add migration for `LastUpgradeVersion` so users won't see these validation issues in Xcode.

Run migrator on all the example apps.  A few aren't Flutter apps so I edited them in Xcode.

Fixes https://github.com/flutter/flutter/issues/140253
See also https://github.com/flutter/flutter/issues/125817 and https://github.com/flutter/flutter/pull/90304.
This commit is contained in:
Jenn Magder
2024-01-03 15:05:46 -08:00
committed by GitHub
parent d0f3777f2b
commit 076cb8a328
104 changed files with 165 additions and 132 deletions

View File

@@ -1285,7 +1285,7 @@ void main() {
final File xcodeProjectFile = globals.fs.file(globals.fs.path.join(projectDir.path, xcodeProjectPath));
final String xcodeProject = xcodeProjectFile.readAsStringSync();
expect(xcodeProject, contains('PRODUCT_BUNDLE_IDENTIFIER = com.foo.bar.flutterProject'));
expect(xcodeProject, contains('LastUpgradeCheck = 1430;'));
expect(xcodeProject, contains('LastUpgradeCheck = 1510;'));
// Xcode workspace shared data
final Directory workspaceSharedData = globals.fs.directory(globals.fs.path.join('.ios', 'Runner.xcworkspace', 'xcshareddata'));
expectExists(workspaceSharedData.childFile('WorkspaceSettings.xcsettings').path);
@@ -1366,7 +1366,7 @@ void main() {
final File xcodeProjectFile = globals.fs.file(globals.fs.path.join(projectDir.path, xcodeProjectPath));
final String xcodeProject = xcodeProjectFile.readAsStringSync();
expect(xcodeProject, contains('PRODUCT_BUNDLE_IDENTIFIER = com.foo.bar.flutterProject'));
expect(xcodeProject, contains('LastUpgradeCheck = 1430;'));
expect(xcodeProject, contains('LastUpgradeCheck = 1510;'));
// Xcode workspace shared data
final Directory workspaceSharedData = globals.fs.directory(globals.fs.path.join('ios', 'Runner.xcworkspace', 'xcshareddata'));
expectExists(workspaceSharedData.childFile('WorkspaceSettings.xcsettings').path);
@@ -1611,7 +1611,7 @@ void main() {
final File xcodeProjectFile = globals.fs.file(globals.fs.path.join(projectDir.path, xcodeProjectPath));
final String xcodeProject = xcodeProjectFile.readAsStringSync();
expect(xcodeProject, contains('path = "flutter_project.app";'));
expect(xcodeProject, contains('LastUpgradeCheck = 1430;'));
expect(xcodeProject, contains('LastUpgradeCheck = 1510;'));
// Xcode workspace shared data
final Directory workspaceSharedData = globals.fs.directory(globals.fs.path.join('macos', 'Runner.xcworkspace', 'xcshareddata'));

View File

@@ -736,13 +736,13 @@ platform :ios, '12.0'
objectVersion = 54;
objects = {
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
''';
xcodeProjectInfoFile.writeAsStringSync(xcodeProjectInfoFileContents);
const String xcodeProjectSchemeFileContents = '''
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
''';
xcodeProjectSchemeFile.writeAsStringSync(xcodeProjectSchemeFileContents);
@@ -768,13 +768,13 @@ platform :ios, '12.0'
objectVersion = 46;
objects = {
attributes = {
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
''');
xcodeProjectSchemeFile.writeAsStringSync('''
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1430"
version = "1.3">
''');
@@ -790,13 +790,13 @@ platform :ios, '12.0'
objectVersion = 54;
objects = {
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
''');
expect(xcodeProjectSchemeFile.readAsStringSync(), '''
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
''');
// Only print once even though 3 lines were changed.

View File

@@ -1255,7 +1255,7 @@ class FakeProcess extends Fake implements Process {
const String validSchemeXml = '''
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -1298,7 +1298,7 @@ const String validSchemeXml = '''
const String disabledDebugExecutableSchemeXml = '''
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"