Set template and migrate apps to iOS 11 minimum (#101963)
This commit is contained in:
@@ -258,7 +258,7 @@ class AOTSnapshotter {
|
||||
// When the minimum version is updated, remember to update
|
||||
// template MinimumOSVersion.
|
||||
// https://github.com/flutter/flutter/pull/62902
|
||||
'-miphoneos-version-min=9.0',
|
||||
'-miphoneos-version-min=11.0',
|
||||
if (sdkRoot != null) ...<String>[
|
||||
'-isysroot',
|
||||
sdkRoot,
|
||||
|
||||
@@ -602,9 +602,9 @@ Future<void> _createStubAppFramework(File outputFile, Environment environment,
|
||||
'-fembed-bitcode-marker',
|
||||
// Keep version in sync with AOTSnapshotter flag
|
||||
if (environmentType == EnvironmentType.physical)
|
||||
'-miphoneos-version-min=9.0'
|
||||
'-miphoneos-version-min=11.0'
|
||||
else
|
||||
'-miphonesimulator-version-min=9.0',
|
||||
'-miphonesimulator-version-min=11.0',
|
||||
'-Xlinker', '-rpath', '-Xlinker', '@executable_path/Frameworks',
|
||||
'-Xlinker', '-rpath', '-Xlinker', '@loader_path/Frameworks',
|
||||
'-install_name', '@rpath/App.framework/App',
|
||||
|
||||
@@ -284,7 +284,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, '9.0'
|
||||
s.platform = :ios, '11.0'
|
||||
s.vendored_frameworks = 'Flutter.xcframework'
|
||||
end
|
||||
''';
|
||||
|
||||
@@ -759,7 +759,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': '9.0',
|
||||
'deploymentTarget': '11.0',
|
||||
'framework': 'Flutter',
|
||||
'methodChannelPlugins': iosPlugins,
|
||||
};
|
||||
|
||||
@@ -12,9 +12,11 @@ class DeploymentTargetMigration extends ProjectMigrator {
|
||||
IosProject project,
|
||||
super.logger,
|
||||
) : _xcodeProjectInfoFile = project.xcodeProjectInfoFile,
|
||||
_podfile = project.podfile,
|
||||
_appFrameworkInfoPlist = project.appFrameworkInfoPlist;
|
||||
|
||||
final File _xcodeProjectInfoFile;
|
||||
final File _podfile;
|
||||
final File _appFrameworkInfoPlist;
|
||||
|
||||
@override
|
||||
@@ -31,33 +33,58 @@ class DeploymentTargetMigration extends ProjectMigrator {
|
||||
logger.printTrace('AppFrameworkInfo.plist not found, skipping minimum OS version migration.');
|
||||
}
|
||||
|
||||
if (_podfile.existsSync()) {
|
||||
processFileLines(_podfile);
|
||||
} else {
|
||||
logger.printTrace('Podfile not found, skipping global platform version migration.');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
String migrateFileContents(String fileContents) {
|
||||
const String minimumOSVersionOriginal = '''
|
||||
const String minimumOSVersionOriginal8 = '''
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>8.0</string>
|
||||
''';
|
||||
const String minimumOSVersionReplacement = '''
|
||||
const String minimumOSVersionOriginal9 = '''
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>9.0</string>
|
||||
''';
|
||||
const String minimumOSVersionReplacement = '''
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>11.0</string>
|
||||
''';
|
||||
|
||||
return fileContents.replaceAll(minimumOSVersionOriginal, minimumOSVersionReplacement);
|
||||
return fileContents
|
||||
.replaceAll(minimumOSVersionOriginal8, minimumOSVersionReplacement)
|
||||
.replaceAll(minimumOSVersionOriginal9, minimumOSVersionReplacement);
|
||||
}
|
||||
|
||||
@override
|
||||
String? migrateLine(String line) {
|
||||
const String deploymentTargetOriginal = 'IPHONEOS_DEPLOYMENT_TARGET = 8.0;';
|
||||
const String deploymentTargetReplacement = 'IPHONEOS_DEPLOYMENT_TARGET = 9.0;';
|
||||
if (line.contains(deploymentTargetOriginal)) {
|
||||
// Xcode project file changes.
|
||||
const String deploymentTargetOriginal8 = 'IPHONEOS_DEPLOYMENT_TARGET = 8.0;';
|
||||
const String deploymentTargetOriginal9 = 'IPHONEOS_DEPLOYMENT_TARGET = 9.0;';
|
||||
|
||||
// Podfile changes.
|
||||
const String podfilePlatformVersionOriginal = "platform :ios, '9.0'";
|
||||
|
||||
if (line.contains(deploymentTargetOriginal8)
|
||||
|| line.contains(deploymentTargetOriginal9)
|
||||
|| line.contains(podfilePlatformVersionOriginal)) {
|
||||
if (!migrationRequired) {
|
||||
// Only print for the first discovered change found.
|
||||
logger.printStatus('Updating minimum iOS deployment target from 8.0 to 9.0.');
|
||||
logger.printStatus('Updating minimum iOS deployment target to 11.0.');
|
||||
}
|
||||
return line.replaceAll(deploymentTargetOriginal, deploymentTargetReplacement);
|
||||
|
||||
const String deploymentTargetReplacement = 'IPHONEOS_DEPLOYMENT_TARGET = 11.0;';
|
||||
const String podfilePlatformVersionReplacement = "platform :ios, '11.0'";
|
||||
return line
|
||||
.replaceAll(deploymentTargetOriginal8, deploymentTargetReplacement)
|
||||
.replaceAll(deploymentTargetOriginal9, deploymentTargetReplacement)
|
||||
.replaceAll(podfilePlatformVersionOriginal, podfilePlatformVersionReplacement);
|
||||
}
|
||||
|
||||
return line;
|
||||
|
||||
Reference in New Issue
Block a user