Skip to content

Commit aea9500

Browse files
[CP-beta]Override deployment target in CocoaPod dependencies when they're less than Xcode's minimum (#190852)
This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request) Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request. ### Issue Link: What is the link to the issue this cherry-pick is addressing? #190676 ### Impact Description: What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping of production apps (the app crashes on launch). This information is for domain experts and release engineers to understand the consequences of saying yes or no to the cherry pick. Flutter iOS or macOS apps may fail to build when using Xcode 27 if they have a CocoaPods dependency that supports deployment targets lower than iOS 15 or macOS 12. ### Changelog Description: Explain this cherry pick: * In one line that is accessible to most Flutter developers. * That describes the state prior to the fix. * That includes which platforms are impacted. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples. < Replace with changelog description here > [flutter/190676] When building for iOS or macOS with Xcode 27, the build may fail due to the Pods.xcodeproj having a minimum deployment target below Xcode's supported range. ### Workaround: Is there a workaround for this issue? No ### Risk: What is the risk level of this cherry-pick? ### Test Coverage: Are you confident that your fix is well-tested by automated tests? ### Validation Steps: What are the steps to validate that this fix works? Using Xcode 27: 1. flutter create my_app && cd my_app 2. flutter config --no-enable-swift-package-manager 3. flutter pub add sentry_flutter 4. flutter build ios Build should succeed.
1 parent 0344099 commit aea9500

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

‎dev/devicelab/lib/tasks/plugin_tests.dart‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@ Pod::Spec.new do |s|
459459
s.source = { :path => '.' }
460460
s.source_files = "Classes", "Classes/**/*.{h,m}"
461461
s.dependency 'plugintest'
462+
s.ios.deployment_target = '12.0'
463+
s.osx.deployment_target = '10.14'
462464
end
463465
''');
464466

‎packages/flutter_tools/bin/podhelper.rb‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ def flutter_additional_ios_build_settings(target)
8282
# ARC code targeting iOS 8 does not build on Xcode 14.3. Force to at least iOS 9.
8383
build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' if force_to_arc_supported_min
8484

85+
# Suppress warning/error when pod supports a version lower than the minimum supported by Xcode.
86+
# Xcode 27+ produces an error while previous versions produced a warning.
87+
# When it's just a warning, it's harmless but confusing--it's not a bad thing for dependencies to support a lower version.
88+
# When deleted, the deployment version will inherit from the higher version derived from the 'Runner' target.
89+
# If the pod only supports a higher version, do not delete to correctly produce an error.
90+
build_configuration.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' if inherit_deployment_target
91+
8592
# Skip other updates if it does not depend on Flutter (including transitive dependency)
8693
next unless depends_on_flutter(target, 'Flutter')
8794

@@ -103,11 +110,6 @@ def flutter_additional_ios_build_settings(target)
103110
build_configuration.build_settings['OTHER_LDFLAGS'] = '$(inherited) -framework Flutter'
104111

105112
build_configuration.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = 'NO'
106-
# Suppress warning when pod supports a version lower than the minimum supported by Xcode (Xcode 12 - iOS 9).
107-
# This warning is harmless but confusing--it's not a bad thing for dependencies to support a lower version.
108-
# When deleted, the deployment version will inherit from the higher version derived from the 'Runner' target.
109-
# If the pod only supports a higher version, do not delete to correctly produce an error.
110-
build_configuration.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' if inherit_deployment_target
111113

112114
# Override legacy Xcode 11 style VALID_ARCHS[sdk=iphonesimulator*]=x86_64 and prefer Xcode 12 EXCLUDED_ARCHS.
113115
build_configuration.build_settings['VALID_ARCHS[sdk=iphonesimulator*]'] = '$(ARCHS_STANDARD)'
@@ -128,8 +130,9 @@ def flutter_additional_macos_build_settings(target)
128130
(deployment_target_major.to_i < 10) ||
129131
(deployment_target_major.to_i == 10 && deployment_target_minor.to_i < 11)
130132

131-
# Suppress warning when pod supports a version lower than the minimum supported by the latest stable version of Xcode (currently 12.0).
132-
# This warning is harmless but confusing--it's not a bad thing for dependencies to support a lower version.
133+
# Suppress warning/error when pod supports a version lower than the minimum supported by the latest stable version of Xcode (currently 12.0).
134+
# Xcode 27+ produces an error while previous versions produced a warning.
135+
# When it's just a warning, it's harmless but confusing--it's not a bad thing for dependencies to support a lower version.
133136
inherit_deployment_target = !target.deployment_target.blank? &&
134137
(deployment_target_major.to_i < 12)
135138

@@ -152,6 +155,10 @@ def flutter_additional_macos_build_settings(target)
152155
# ARC code targeting macOS 10.10 does not build on Xcode 14.3. Force to at least macOS 10.11.
153156
build_configuration.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.11' if force_to_arc_supported_min
154157

158+
# When deleted, the deployment version will inherit from the higher version derived from the 'Runner' target.
159+
# If the pod only supports a higher version, do not delete to correctly produce an error.
160+
build_configuration.build_settings.delete 'MACOSX_DEPLOYMENT_TARGET' if inherit_deployment_target
161+
155162
# Skip other updates if it does not depend on Flutter (including transitive dependency)
156163
next unless depends_on_flutter(target, 'FlutterMacOS')
157164

@@ -167,10 +174,6 @@ def flutter_additional_macos_build_settings(target)
167174
end
168175
end
169176

170-
# When deleted, the deployment version will inherit from the higher version derived from the 'Runner' target.
171-
# If the pod only supports a higher version, do not delete to correctly produce an error.
172-
build_configuration.build_settings.delete 'MACOSX_DEPLOYMENT_TARGET' if inherit_deployment_target
173-
174177
# Avoid error about Pods-Runner not supporting provisioning profiles.
175178
# Framework signing is handled at the app layer, not per framework, so disallow individual signing.
176179
build_configuration.build_settings.delete 'EXPANDED_CODE_SIGN_IDENTITY'

0 commit comments

Comments
 (0)