Increase minimum supported macOS version from 10.13 to 10.14 (#114713)

Increases the minimum macOS deployment target from macOS 10.13 (High Sierra) to 10.14 (Mojave) in the macOS app templates.

Includes:
* Update migration for macOS 10.11 apps to upgrade to 10.14
* Adds migration for macOS 10.13 apps to upgrade to 10.14
* Apply migration to all examples, and integration tests

This does not increase version in the plugin templates since those will need to wait until the 10.14 framework rolls to stable channel, so new plugins can build with apps created with `flutter create` on stable channel.

Issue: https://github.com/flutter/flutter/issues/114445
See RFC: http://flutter.dev/go/flutter-drop-macOS-10.13-2022-q4
See previous patch: https://github.com/flutter/flutter/pull/107689
This commit is contained in:
Chris Bracken
2022-11-07 02:32:42 -08:00
committed by GitHub
parent a54a46df40
commit 3c9288c6d3
24 changed files with 103 additions and 64 deletions

View File

@@ -105,11 +105,11 @@ def flutter_additional_macos_build_settings(target)
# [target.deployment_target] is a [String] formatted as "10.8".
deployment_target_major, deployment_target_minor = target.deployment_target.match(/(\d+).?(\d*)/).captures
# Suppress warning when pod supports a version lower than the minimum supported by the latest stable version of Xcode (currently 10.13).
# Suppress warning when pod supports a version lower than the minimum supported by the latest stable version of Xcode (currently 10.14).
# This warning is harmless but confusing--it's not a bad thing for dependencies to support a lower version.
inherit_deployment_target = !target.deployment_target.blank? &&
(deployment_target_major.to_i < 10) ||
(deployment_target_major.to_i == 10 && deployment_target_minor.to_i < 13)
(deployment_target_major.to_i == 10 && deployment_target_minor.to_i < 14)
# This podhelper script is at $FLUTTER_ROOT/packages/flutter_tools/bin.
# Add search paths from $FLUTTER_ROOT/bin/cache/artifacts/engine.
@@ -230,7 +230,7 @@ def flutter_install_macos_engine_pod(mac_application_path = nil)
s.license = { :type => 'BSD' }
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
s.osx.deployment_target = '10.13'
s.osx.deployment_target = '10.14'
# Framework linking is handled by Flutter tooling, not CocoaPods.
# Add a placeholder to satisfy `s.dependency 'FlutterMacOS'` plugin podspecs.
s.vendored_frameworks = 'path/to/nothing'

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.13'
s.osx.deployment_target = '10.14'
s.vendored_frameworks = 'FlutterMacOS.framework'
s.prepare_command = 'unzip FlutterMacOS.framework -d FlutterMacOS.framework'
end

View File

@@ -35,22 +35,29 @@ class MacOSDeploymentTargetMigration extends ProjectMigrator {
@override
String? migrateLine(String line) {
// Xcode project file changes.
const String deploymentTargetOriginal = 'MACOSX_DEPLOYMENT_TARGET = 10.11;';
const String deploymentTargetOriginal1011 = 'MACOSX_DEPLOYMENT_TARGET = 10.11;';
const String deploymentTargetOriginal1013 = 'MACOSX_DEPLOYMENT_TARGET = 10.13;';
// Podfile changes.
const String podfilePlatformVersionOriginal = "platform :osx, '10.11'";
const String podfilePlatformVersionOriginal1011 = "platform :osx, '10.11'";
const String podfilePlatformVersionOriginal1013 = "platform :osx, '10.13'";
if (line.contains(deploymentTargetOriginal) || line.contains(podfilePlatformVersionOriginal)) {
if (line.contains(deploymentTargetOriginal1011)
|| line.contains(deploymentTargetOriginal1013)
|| line.contains(podfilePlatformVersionOriginal1011)
|| line.contains(podfilePlatformVersionOriginal1013)) {
if (!migrationRequired) {
// Only print for the first discovered change found.
logger.printStatus('Updating minimum macOS deployment target to 10.13.');
logger.printStatus('Updating minimum macOS deployment target to 10.14.');
}
const String deploymentTargetReplacement = 'MACOSX_DEPLOYMENT_TARGET = 10.13;';
const String podfilePlatformVersionReplacement = "platform :osx, '10.13'";
const String deploymentTargetReplacement = 'MACOSX_DEPLOYMENT_TARGET = 10.14;';
const String podfilePlatformVersionReplacement = "platform :osx, '10.14'";
return line
.replaceAll(deploymentTargetOriginal, deploymentTargetReplacement)
.replaceAll(podfilePlatformVersionOriginal, podfilePlatformVersionReplacement);
.replaceAll(deploymentTargetOriginal1011, deploymentTargetReplacement)
.replaceAll(deploymentTargetOriginal1013, deploymentTargetReplacement)
.replaceAll(podfilePlatformVersionOriginal1011, podfilePlatformVersionReplacement)
.replaceAll(podfilePlatformVersionOriginal1013, podfilePlatformVersionReplacement);
}
return line;

View File

@@ -345,7 +345,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
@@ -424,7 +424,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
@@ -471,7 +471,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;

View File

@@ -1,4 +1,4 @@
platform :osx, '10.13'
platform :osx, '10.14'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

View File

@@ -188,12 +188,12 @@ keep this 2
});
testWithoutContext('skipped if nothing to upgrade', () {
const String xcodeProjectInfoFileContents = 'MACOSX_DEPLOYMENT_TARGET = 10.13;';
const String xcodeProjectInfoFileContents = 'MACOSX_DEPLOYMENT_TARGET = 10.14;';
xcodeProjectInfoFile.writeAsStringSync(xcodeProjectInfoFileContents);
final DateTime projectLastModified = xcodeProjectInfoFile.lastModifiedSync();
const String podfileFileContents = "# platform :osx, '10.13'";
const String podfileFileContents = "# platform :osx, '10.14'";
podfile.writeAsStringSync(podfileFileContents);
final DateTime podfileLastModified = podfile.lastModifiedSync();
@@ -211,7 +211,7 @@ keep this 2
expect(testLogger.statusText, isEmpty);
});
testWithoutContext('Xcode project is migrated to 10.13', () {
testWithoutContext('Xcode project is migrated from 10.11 to 10.14', () {
xcodeProjectInfoFile.writeAsStringSync('''
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
@@ -231,16 +231,48 @@ platform :osx, '10.11'
expect(xcodeProjectInfoFile.readAsStringSync(), '''
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = YES;
''');
expect(podfile.readAsStringSync(), '''
# platform :osx, '10.14'
platform :osx, '10.14'
''');
// Only print once even though 2 lines were changed.
expect('Updating minimum macOS deployment target to 10.14'.allMatches(testLogger.statusText).length, 1);
});
testWithoutContext('Xcode project is migrated from 10.13 to 10.14', () {
xcodeProjectInfoFile.writeAsStringSync('''
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = YES;
''');
podfile.writeAsStringSync('''
# platform :osx, '10.13'
platform :osx, '10.13'
''');
final MacOSDeploymentTargetMigration macOSProjectMigration = MacOSDeploymentTargetMigration(
project,
testLogger,
);
macOSProjectMigration.migrate();
expect(xcodeProjectInfoFile.readAsStringSync(), '''
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = YES;
''');
expect(podfile.readAsStringSync(), '''
# platform :osx, '10.14'
platform :osx, '10.14'
''');
// Only print once even though 2 lines were changed.
expect('Updating minimum macOS deployment target to 10.13'.allMatches(testLogger.statusText).length, 1);
expect('Updating minimum macOS deployment target to 10.14'.allMatches(testLogger.statusText).length, 1);
});
});
}