forked from firka/flutter
Set template and migrate apps to iOS 12 minimum (#140823)
Reland https://github.com/flutter/flutter/pull/140478 with `ios_content_validation_test` test fix. ``` [ios_content_validation_test] Process terminated with exit code 0. Task result: { "success": true, "data": null, "detailFiles": [], "benchmarkScoreKeys": [], "reason": "success" } ``` __________ 1. Change templates to `IPHONEOS_DEPLOYMENT_TARGET`, `MinimumOSVersion`, and Podfile `platform :ios` to 12.0. 2. Add migrator for Podfile part to migrate `platform :ios, '11.0'` -> `platform :ios, '12.0'` 3. Compile with `-miphoneos-version-min=12.0` 4. Run the migrator on all example apps and integration tests. See also https://github.com/flutter/flutter/pull/62902 and https://github.com/flutter/flutter/pull/85174 and https://github.com/flutter/flutter/pull/101963 Fixes https://github.com/flutter/flutter/issues/136060
This commit is contained in:
@@ -807,7 +807,7 @@ void main() {
|
||||
expect(logger.errorText, contains("Use of undeclared identifier 'asdas'"));
|
||||
expect(logger.errorText, contains('/Users/m/Projects/test_create/ios/Runner/AppDelegate.m:7:56'));
|
||||
expect(logger.errorText, isNot(contains('Command PhaseScriptExecution failed with a nonzero exit code')));
|
||||
expect(logger.warningText, isNot(contains("The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99.")));
|
||||
expect(logger.warningText, isNot(contains('but the range of supported deployment target versions is')));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
Logger: () => logger,
|
||||
@@ -1357,7 +1357,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
expect(logger.errorText, contains("Use of undeclared identifier 'asdas'"));
|
||||
expect(logger.errorText, contains('/Users/m/Projects/test_create/ios/Runner/AppDelegate.m:7:56'));
|
||||
expect(logger.errorText, isNot(contains('Command PhaseScriptExecution failed with a nonzero exit code')));
|
||||
expect(logger.warningText, isNot(contains("The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99.")));
|
||||
expect(logger.warningText, isNot(contains('but the range of supported deployment target versions is')));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
Logger: () => logger,
|
||||
|
||||
@@ -1020,7 +1020,7 @@ void main() {
|
||||
expect(logger.errorText, contains("Use of undeclared identifier 'asdas'"));
|
||||
expect(logger.errorText, contains('/Users/m/Projects/test_create/ios/Runner/AppDelegate.m:7:56'));
|
||||
expect(logger.errorText, isNot(contains('Command PhaseScriptExecution failed with a nonzero exit code')));
|
||||
expect(logger.warningText, isNot(contains("The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99.")));
|
||||
expect(logger.warningText, isNot(contains('but the range of supported deployment target versions')));
|
||||
expect(fakeProcessManager, hasNoRemainingExpectations);
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
@@ -1172,7 +1172,7 @@ void main() {
|
||||
'CFBundleDisplayName': 'Awesome Gallery',
|
||||
// Will not use CFBundleName since CFBundleDisplayName is present.
|
||||
'CFBundleName': 'Awesome Gallery 2',
|
||||
'MinimumOSVersion': '11.0',
|
||||
'MinimumOSVersion': '17.0',
|
||||
'CFBundleVersion': '666',
|
||||
'CFBundleShortVersionString': '12.34.56',
|
||||
};
|
||||
@@ -1196,7 +1196,7 @@ void main() {
|
||||
' • Version Number: 12.34.56\n'
|
||||
' • Build Number: 666\n'
|
||||
' • Display Name: Awesome Gallery\n'
|
||||
' • Deployment Target: 11.0\n'
|
||||
' • Deployment Target: 17.0\n'
|
||||
' • Bundle Identifier: io.flutter.someProject\n'
|
||||
)
|
||||
);
|
||||
@@ -1230,7 +1230,7 @@ void main() {
|
||||
'CFBundleIdentifier': 'io.flutter.someProject',
|
||||
// Will use CFBundleName since CFBundleDisplayName is absent.
|
||||
'CFBundleName': 'Awesome Gallery',
|
||||
'MinimumOSVersion': '11.0',
|
||||
'MinimumOSVersion': '17.0',
|
||||
'CFBundleVersion': '666',
|
||||
'CFBundleShortVersionString': '12.34.56',
|
||||
};
|
||||
@@ -1254,7 +1254,7 @@ void main() {
|
||||
' • Version Number: 12.34.56\n'
|
||||
' • Build Number: 666\n'
|
||||
' • Display Name: Awesome Gallery\n'
|
||||
' • Deployment Target: 11.0\n'
|
||||
' • Deployment Target: 17.0\n'
|
||||
' • Bundle Identifier: io.flutter.someProject\n'
|
||||
),
|
||||
);
|
||||
|
||||
@@ -28,7 +28,7 @@ const FakeCommand kARMCheckCommand = FakeCommand(
|
||||
);
|
||||
|
||||
const List<String> kDefaultClang = <String>[
|
||||
'-miphoneos-version-min=11.0',
|
||||
'-miphoneos-version-min=12.0',
|
||||
'-isysroot',
|
||||
'path/to/sdk',
|
||||
'-dynamiclib',
|
||||
@@ -221,7 +221,7 @@ void main() {
|
||||
'cc',
|
||||
'-arch',
|
||||
'arm64',
|
||||
'-miphoneos-version-min=11.0',
|
||||
'-miphoneos-version-min=12.0',
|
||||
'-isysroot',
|
||||
'path/to/sdk',
|
||||
'-c',
|
||||
@@ -292,7 +292,7 @@ void main() {
|
||||
'cc',
|
||||
'-arch',
|
||||
'arm64',
|
||||
'-miphoneos-version-min=11.0',
|
||||
'-miphoneos-version-min=12.0',
|
||||
'-isysroot',
|
||||
'path/to/sdk',
|
||||
'-c',
|
||||
@@ -360,7 +360,7 @@ void main() {
|
||||
'cc',
|
||||
'-arch',
|
||||
'arm64',
|
||||
'-miphoneos-version-min=11.0',
|
||||
'-miphoneos-version-min=12.0',
|
||||
'-isysroot',
|
||||
'path/to/sdk',
|
||||
'-c',
|
||||
|
||||
@@ -584,7 +584,7 @@ native-assets: {}
|
||||
'cc',
|
||||
'-arch',
|
||||
'arm64',
|
||||
'-miphoneos-version-min=11.0',
|
||||
'-miphoneos-version-min=12.0',
|
||||
'-isysroot',
|
||||
'path/to/iPhoneOS.sdk',
|
||||
'-c',
|
||||
@@ -597,7 +597,7 @@ native-assets: {}
|
||||
'clang',
|
||||
'-arch',
|
||||
'arm64',
|
||||
'-miphoneos-version-min=11.0',
|
||||
'-miphoneos-version-min=12.0',
|
||||
'-isysroot',
|
||||
'path/to/iPhoneOS.sdk',
|
||||
'-dynamiclib',
|
||||
|
||||
@@ -24,7 +24,7 @@ final Platform macPlatform = FakePlatform(operatingSystem: 'macos', environment:
|
||||
|
||||
const List<String> _kSharedConfig = <String>[
|
||||
'-dynamiclib',
|
||||
'-miphoneos-version-min=11.0',
|
||||
'-miphoneos-version-min=12.0',
|
||||
'-Xlinker',
|
||||
'-rpath',
|
||||
'-Xlinker',
|
||||
@@ -95,7 +95,7 @@ void main() {
|
||||
fileSystem.path.absolute(fileSystem.path.join(
|
||||
'.tmp_rand0', 'flutter_tools_stub_source.rand0', 'debug_app.cc')),
|
||||
'-dynamiclib',
|
||||
'-miphonesimulator-version-min=11.0',
|
||||
'-miphonesimulator-version-min=12.0',
|
||||
'-Xlinker',
|
||||
'-rpath',
|
||||
'-Xlinker',
|
||||
|
||||
@@ -586,18 +586,18 @@ keep this 3
|
||||
});
|
||||
|
||||
testWithoutContext('skipped if nothing to upgrade', () {
|
||||
const String xcodeProjectInfoFileContents = 'IPHONEOS_DEPLOYMENT_TARGET = 11.0;';
|
||||
const String xcodeProjectInfoFileContents = 'IPHONEOS_DEPLOYMENT_TARGET = 12.0;';
|
||||
xcodeProjectInfoFile.writeAsStringSync(xcodeProjectInfoFileContents);
|
||||
|
||||
const String appFrameworkInfoPlistContents = '''
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>11.0</string>
|
||||
<string>12.0</string>
|
||||
''';
|
||||
appFrameworkInfoPlist.writeAsStringSync(appFrameworkInfoPlistContents);
|
||||
|
||||
final DateTime projectLastModified = xcodeProjectInfoFile.lastModifiedSync();
|
||||
|
||||
const String podfileFileContents = "# platform :ios, '11.0'";
|
||||
const String podfileFileContents = "# platform :ios, '12.0'";
|
||||
podfile.writeAsStringSync(podfileFileContents);
|
||||
final DateTime podfileLastModified = podfile.lastModifiedSync();
|
||||
|
||||
@@ -616,7 +616,7 @@ keep this 3
|
||||
expect(testLogger.statusText, isEmpty);
|
||||
});
|
||||
|
||||
testWithoutContext('Xcode project is migrated to 11', () {
|
||||
testWithoutContext('Xcode project is migrated to 12', () {
|
||||
xcodeProjectInfoFile.writeAsStringSync('''
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
@@ -625,6 +625,7 @@ keep this 3
|
||||
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
''');
|
||||
|
||||
appFrameworkInfoPlist.writeAsStringSync('''
|
||||
@@ -638,6 +639,8 @@ keep this 3
|
||||
<string>8.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>11.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>12.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
''');
|
||||
@@ -645,6 +648,8 @@ keep this 3
|
||||
podfile.writeAsStringSync('''
|
||||
# platform :ios, '9.0'
|
||||
platform :ios, '9.0'
|
||||
# platform :ios, '11.0'
|
||||
platform :ios, '11.0'
|
||||
''');
|
||||
|
||||
final IOSDeploymentTargetMigration iosProjectMigration = IOSDeploymentTargetMigration(
|
||||
@@ -655,12 +660,13 @@ platform :ios, '9.0'
|
||||
|
||||
expect(xcodeProjectInfoFile.readAsStringSync(), '''
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
''');
|
||||
|
||||
expect(appFrameworkInfoPlist.readAsStringSync(), '''
|
||||
@@ -671,19 +677,23 @@ platform :ios, '9.0'
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>11.0</string>
|
||||
<string>12.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>11.0</string>
|
||||
<string>12.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>12.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
''');
|
||||
|
||||
expect(podfile.readAsStringSync(), '''
|
||||
# platform :ios, '11.0'
|
||||
platform :ios, '11.0'
|
||||
# platform :ios, '12.0'
|
||||
platform :ios, '12.0'
|
||||
# platform :ios, '12.0'
|
||||
platform :ios, '12.0'
|
||||
''');
|
||||
// Only print once even though 2 lines were changed.
|
||||
expect('Updating minimum iOS deployment target to 11.0'.allMatches(testLogger.statusText).length, 1);
|
||||
expect('Updating minimum iOS deployment target to 12.0'.allMatches(testLogger.statusText).length, 1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -904,7 +914,7 @@ platform :ios, '11.0'
|
||||
});
|
||||
|
||||
testWithoutContext('skipped if nothing to upgrade', () {
|
||||
const String xcodeProjectInfoFileContents = 'IPHONEOS_DEPLOYMENT_TARGET = 11.0;';
|
||||
const String xcodeProjectInfoFileContents = 'IPHONEOS_DEPLOYMENT_TARGET = 12.0;';
|
||||
xcodeProjectInfoFile.writeAsStringSync(xcodeProjectInfoFileContents);
|
||||
final DateTime projectLastModified = xcodeProjectInfoFile.lastModifiedSync();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user