Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions packages/react-native/scripts/cocoapods/__tests__/utils-test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,40 @@ def test_turnOffResourceBundleReactCore_correctlyAppliesPatch
assert_equal("YES", assets_release_config.build_settings["CODE_SIGNING_ALLOWED"])
end

def test_updateOSDeploymentTarget_updatesNativeAndResourceBundleTargets
minimum = Helpers::Constants.min_ios_version_supported
higher_version = (minimum.to_f + 1).to_s
native_target = TargetMock.new('ExamplePod', [
BuildConfigurationMock.new('Debug', {'IPHONEOS_DEPLOYMENT_TARGET' => '9.0'}),
BuildConfigurationMock.new('Release', {'IPHONEOS_DEPLOYMENT_TARGET' => higher_version}),
])
resource_bundle = TargetMock.new('ExampleResources', [
BuildConfigurationMock.new('Debug', {'IPHONEOS_DEPLOYMENT_TARGET' => '9.0'}),
BuildConfigurationMock.new('Release', {'IPHONEOS_DEPLOYMENT_TARGET' => '12.4'}),
])
other_resource_bundle = TargetMock.new('OtherResources', [
BuildConfigurationMock.new('Debug'),
BuildConfigurationMock.new('Release', {'IPHONEOS_DEPLOYMENT_TARGET' => higher_version}),
])
installer = InstallerMock.new(pod_target_installation_results: {
'ExamplePod' => TargetInstallationResultMock.new(
native_target, native_target, [resource_bundle, other_resource_bundle]
),
})

ReactNativePodsUtils.updateOSDeploymentTarget(installer)

[
[native_target, [minimum, higher_version]],
[resource_bundle, [minimum, minimum]],
[other_resource_bundle, [minimum, higher_version]],
].each do |target, expected_versions|
assert_equal(expected_versions, target.build_configurations.map do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
end, target.name)
end
end

# ================================= #
# Test - Apply Mac Catalyst Patches #
# ================================= #
Expand Down
13 changes: 8 additions & 5 deletions packages/react-native/scripts/cocoapods/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,14 @@ def self.update_search_paths(installer)
def self.updateOSDeploymentTarget(installer)
installer.target_installation_results.pod_target_installation_results
.each do |pod_name, target_installation_result|
target_installation_result.native_target.build_configurations.each do |config|
old_iphone_deploy_target = config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] ?
config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] :
Helpers::Constants.min_ios_version_supported
config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = [Helpers::Constants.min_ios_version_supported.to_f, old_iphone_deploy_target.to_f].max.to_s
targets = [target_installation_result.native_target] + target_installation_result.resource_bundle_targets
targets.each do |target|
target.build_configurations.each do |config|
old_iphone_deploy_target = config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] ?
config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] :
Helpers::Constants.min_ios_version_supported
config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = [Helpers::Constants.min_ios_version_supported.to_f, old_iphone_deploy_target.to_f].max.to_s
end
end
end
end
Expand Down
Loading