From 0cd2ea960b4820f95e871b192dc5d1de6180fea0 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Thu, 14 Dec 2023 21:04:33 -0800 Subject: [PATCH] Set compile test iOS app target version to not embed Swift runtime (#140188) ObjC->Swift plugin migration caused a size regression in the gallery app because the Swift runtime was also pulled in. The gallery app minimum target version is iOS 11.0, which predates Swift ABI compatibility. Pre iOS 12.2 apps embedded the Swift runtime since there wasn't one available to use in the OS. Add `FLUTTER_XCODE_IPHONEOS_DEPLOYMENT_TARGET` to the compile perf test environment, which gets translated by the tool to an Xcode build setting: ``` [2023-12-14 15:52:14.797318] [STDOUT] stdout: IPHONEOS_DEPLOYMENT_TARGET = 12.2 ``` On my machine on main ``` "release_size_bytes": 43717389, ``` becomes ``` "release_size_bytes": 40679432, ``` Fixes https://github.com/flutter/flutter/issues/139605 --- dev/devicelab/lib/tasks/perf_tests.dart | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dev/devicelab/lib/tasks/perf_tests.dart b/dev/devicelab/lib/tasks/perf_tests.dart index bdb15e519e..85078dd97e 100644 --- a/dev/devicelab/lib/tasks/perf_tests.dart +++ b/dev/devicelab/lib/tasks/perf_tests.dart @@ -1687,7 +1687,17 @@ class CompileTest { options.add('--tree-shake-icons'); options.add('--split-debug-info=infos/'); watch.start(); - await flutter('build', options: options); + await flutter( + 'build', + options: options, + environment: { + // iOS 12.1 and lower did not have Swift ABI compatibility so Swift apps embedded the Swift runtime. + // https://developer.apple.com/documentation/xcode-release-notes/swift-5-release-notes-for-xcode-10_2#App-Thinning + // The gallery pulls in Swift plugins. Set lowest version to 12.2 to avoid benchmark noise. + // This should be removed when when Flutter's minimum supported version is >12.2. + 'FLUTTER_XCODE_IPHONEOS_DEPLOYMENT_TARGET': '12.2', + }, + ); watch.stop(); final Directory buildDirectory = dir(path.join( cwd,