Increase app minimum supported macOS version from 10.11 to 10.13 (#107689)

This commit is contained in:
Jenn Magder
2022-07-15 11:12:43 -07:00
committed by GitHub
parent 89f8e5f6ed
commit c4975d9be0
21 changed files with 303 additions and 147 deletions

View File

@@ -162,7 +162,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.osx.deployment_target = '10.11'
s.osx.deployment_target = '10.13'
s.vendored_frameworks = 'FlutterMacOS.framework'
s.prepare_command = 'unzip FlutterMacOS.framework -d FlutterMacOS.framework'
end

View File

@@ -25,8 +25,8 @@ import '../reporting/reporting.dart';
import 'application_package.dart';
import 'code_signing.dart';
import 'iproxy.dart';
import 'migrations/deployment_target_migration.dart';
import 'migrations/host_app_info_plist_migration.dart';
import 'migrations/ios_deployment_target_migration.dart';
import 'migrations/project_base_configuration_migration.dart';
import 'migrations/project_build_location_migration.dart';
import 'migrations/project_object_version_migration.dart';
@@ -123,7 +123,7 @@ Future<XcodeBuildResult> buildXcodeProject({
XcodeBuildSystemMigration(app.project, globals.logger),
ProjectBaseConfigurationMigration(app.project, globals.logger),
ProjectBuildLocationMigration(app.project, globals.logger),
DeploymentTargetMigration(app.project, globals.logger),
IOSDeploymentTargetMigration(app.project, globals.logger),
ProjectObjectVersionMigration(app.project, globals.logger),
HostAppInfoPlistMigration(app.project, globals.logger),
];

View File

@@ -7,8 +7,8 @@ import '../../base/project_migrator.dart';
import '../../xcode_project.dart';
/// Update the minimum iOS deployment version to the minimum allowed by Xcode without causing a warning.
class DeploymentTargetMigration extends ProjectMigrator {
DeploymentTargetMigration(
class IOSDeploymentTargetMigration extends ProjectMigrator {
IOSDeploymentTargetMigration(
IosProject project,
super.logger,
) : _xcodeProjectInfoFile = project.xcodeProjectInfoFile,
@@ -36,7 +36,7 @@ class DeploymentTargetMigration extends ProjectMigrator {
if (_podfile.existsSync()) {
processFileLines(_podfile);
} else {
logger.printTrace('Podfile not found, skipping global platform version migration.');
logger.printTrace('Podfile not found, skipping global platform iOS version migration.');
}
return true;

View File

@@ -14,6 +14,7 @@ import '../ios/xcode_build_settings.dart';
import '../ios/xcodeproj.dart';
import '../project.dart';
import 'cocoapod_utils.dart';
import 'migrations/macos_deployment_target_migration.dart';
import 'migrations/remove_macos_framework_link_and_embedding_migration.dart';
/// When run in -quiet mode, Xcode should only print from the underlying tasks to stdout.
@@ -45,6 +46,7 @@ Future<void> buildMacOS({
globals.logger,
globals.flutterUsage,
),
MacOSDeploymentTargetMigration(flutterProject.macos, globals.logger),
];
final ProjectMigration migration = ProjectMigration(migrators);

View File

@@ -0,0 +1,60 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import '../../base/file_system.dart';
import '../../base/project_migrator.dart';
import '../../xcode_project.dart';
/// Update the minimum macOS deployment version to the minimum allowed by Xcode without causing a warning.
class MacOSDeploymentTargetMigration extends ProjectMigrator {
MacOSDeploymentTargetMigration(
MacOSProject project,
super.logger,
) : _xcodeProjectInfoFile = project.xcodeProjectInfoFile,
_podfile = project.podfile;
final File _xcodeProjectInfoFile;
final File _podfile;
@override
bool migrate() {
if (_xcodeProjectInfoFile.existsSync()) {
processFileLines(_xcodeProjectInfoFile);
} else {
logger.printTrace('Xcode project not found, skipping macOS deployment target version migration.');
}
if (_podfile.existsSync()) {
processFileLines(_podfile);
} else {
logger.printTrace('Podfile not found, skipping global platform macOS version migration.');
}
return true;
}
@override
String? migrateLine(String line) {
// Xcode project file changes.
const String deploymentTargetOriginal = 'MACOSX_DEPLOYMENT_TARGET = 10.11;';
// Podfile changes.
const String podfilePlatformVersionOriginal = "platform :osx, '10.11'";
if (line.contains(deploymentTargetOriginal) || line.contains(podfilePlatformVersionOriginal)) {
if (!migrationRequired) {
// Only print for the first discovered change found.
logger.printStatus('Updating minimum macOS deployment target to 10.13.');
}
const String deploymentTargetReplacement = 'MACOSX_DEPLOYMENT_TARGET = 10.13;';
const String podfilePlatformVersionReplacement = "platform :osx, '10.13'";
return line
.replaceAll(deploymentTargetOriginal, deploymentTargetReplacement)
.replaceAll(podfilePlatformVersionOriginal, podfilePlatformVersionReplacement);
}
return line;
}
}