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:
@@ -271,7 +271,7 @@ class AOTSnapshotter {
|
||||
// When the minimum version is updated, remember to update
|
||||
// template MinimumOSVersion.
|
||||
// https://github.com/flutter/flutter/pull/62902
|
||||
'-miphoneos-version-min=11.0',
|
||||
'-miphoneos-version-min=12.0',
|
||||
if (sdkRoot != null) ...<String>[
|
||||
'-isysroot',
|
||||
sdkRoot,
|
||||
|
||||
@@ -684,9 +684,9 @@ Future<void> _createStubAppFramework(File outputFile, Environment environment,
|
||||
'-dynamiclib',
|
||||
// Keep version in sync with AOTSnapshotter flag
|
||||
if (environmentType == EnvironmentType.physical)
|
||||
'-miphoneos-version-min=11.0'
|
||||
'-miphoneos-version-min=12.0'
|
||||
else
|
||||
'-miphonesimulator-version-min=11.0',
|
||||
'-miphonesimulator-version-min=12.0',
|
||||
'-Xlinker', '-rpath', '-Xlinker', '@executable_path/Frameworks',
|
||||
'-Xlinker', '-rpath', '-Xlinker', '@loader_path/Frameworks',
|
||||
'-fapplication-extension',
|
||||
|
||||
@@ -383,7 +383,7 @@ LICENSE
|
||||
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
|
||||
s.source = { :http => '${cache.storageBaseUrl}/flutter_infra_release/flutter/${cache.engineRevision}/$artifactsMode/artifacts.zip' }
|
||||
s.documentation_url = 'https://flutter.dev/docs'
|
||||
s.platform = :ios, '11.0'
|
||||
s.platform = :ios, '12.0'
|
||||
s.vendored_frameworks = 'Flutter.xcframework'
|
||||
end
|
||||
''';
|
||||
|
||||
@@ -774,7 +774,7 @@ Future<void> _writeIOSPluginRegistrant(FlutterProject project, List<Plugin> plug
|
||||
final List<Map<String, Object?>> iosPlugins = _extractPlatformMaps(methodChannelPlugins, IOSPlugin.kConfigKey);
|
||||
final Map<String, Object> context = <String, Object>{
|
||||
'os': 'ios',
|
||||
'deploymentTarget': '11.0',
|
||||
'deploymentTarget': '12.0',
|
||||
'framework': 'Flutter',
|
||||
'methodChannelPlugins': iosPlugins,
|
||||
};
|
||||
|
||||
@@ -50,14 +50,19 @@ class IOSDeploymentTargetMigration extends ProjectMigrator {
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>9.0</string>
|
||||
''';
|
||||
const String minimumOSVersionReplacement = '''
|
||||
const String minimumOSVersionOriginal11 = '''
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>11.0</string>
|
||||
''';
|
||||
const String minimumOSVersionReplacement = '''
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>12.0</string>
|
||||
''';
|
||||
|
||||
return fileContents
|
||||
.replaceAll(minimumOSVersionOriginal8, minimumOSVersionReplacement)
|
||||
.replaceAll(minimumOSVersionOriginal9, minimumOSVersionReplacement);
|
||||
.replaceAll(minimumOSVersionOriginal9, minimumOSVersionReplacement)
|
||||
.replaceAll(minimumOSVersionOriginal11, minimumOSVersionReplacement);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -65,24 +70,30 @@ class IOSDeploymentTargetMigration extends ProjectMigrator {
|
||||
// Xcode project file changes.
|
||||
const String deploymentTargetOriginal8 = 'IPHONEOS_DEPLOYMENT_TARGET = 8.0;';
|
||||
const String deploymentTargetOriginal9 = 'IPHONEOS_DEPLOYMENT_TARGET = 9.0;';
|
||||
const String deploymentTargetOriginal11 = 'IPHONEOS_DEPLOYMENT_TARGET = 11.0;';
|
||||
|
||||
// Podfile changes.
|
||||
const String podfilePlatformVersionOriginal = "platform :ios, '9.0'";
|
||||
const String podfilePlatformVersionOriginal9 = "platform :ios, '9.0'";
|
||||
const String podfilePlatformVersionOriginal11 = "platform :ios, '11.0'";
|
||||
|
||||
if (line.contains(deploymentTargetOriginal8)
|
||||
|| line.contains(deploymentTargetOriginal9)
|
||||
|| line.contains(podfilePlatformVersionOriginal)) {
|
||||
|| line.contains(deploymentTargetOriginal11)
|
||||
|| line.contains(podfilePlatformVersionOriginal9)
|
||||
|| line.contains(podfilePlatformVersionOriginal11)) {
|
||||
if (!migrationRequired) {
|
||||
// Only print for the first discovered change found.
|
||||
logger.printStatus('Updating minimum iOS deployment target to 11.0.');
|
||||
logger.printStatus('Updating minimum iOS deployment target to 12.0.');
|
||||
}
|
||||
|
||||
const String deploymentTargetReplacement = 'IPHONEOS_DEPLOYMENT_TARGET = 11.0;';
|
||||
const String podfilePlatformVersionReplacement = "platform :ios, '11.0'";
|
||||
const String deploymentTargetReplacement = 'IPHONEOS_DEPLOYMENT_TARGET = 12.0;';
|
||||
const String podfilePlatformVersionReplacement = "platform :ios, '12.0'";
|
||||
return line
|
||||
.replaceAll(deploymentTargetOriginal8, deploymentTargetReplacement)
|
||||
.replaceAll(deploymentTargetOriginal9, deploymentTargetReplacement)
|
||||
.replaceAll(podfilePlatformVersionOriginal, podfilePlatformVersionReplacement);
|
||||
.replaceAll(deploymentTargetOriginal11, deploymentTargetReplacement)
|
||||
.replaceAll(podfilePlatformVersionOriginal9, podfilePlatformVersionReplacement)
|
||||
.replaceAll(podfilePlatformVersionOriginal11, podfilePlatformVersionReplacement);
|
||||
}
|
||||
|
||||
return line;
|
||||
|
||||
Reference in New Issue
Block a user