Skip to content

Commit c27a880

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Bump min Xcode to 16.1 (#51762)
Summary: Pull Request resolved: #51762 Apple requires Xcode 16 or later to submit to the app store. Let's bump the minimum checked for in build logic as well. https://developer.apple.com/news/upcoming-requirements/?id=02212025 GHA is already only testing against 16.2.0 as of D73924819 Changelog: [iOS][Breaking] - Bump min Xcode to 16.1 Reviewed By: cipolleschi Differential Revision: D75835304 fbshipit-source-id: a7ce22f958be3a5448a279439e27b615e9b20a2f
1 parent 5ce99e7 commit c27a880

4 files changed

Lines changed: 1 addition & 225 deletions

File tree

packages/react-native/scripts/cocoapods/__tests__/utils-test.rb

Lines changed: 0 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -452,196 +452,6 @@ def test_applyMacCatalystPatches_correctlyAppliesNecessaryPatches
452452
assert_equal(user_project_mock.save_invocation_count, 1)
453453
end
454454

455-
# ================================= #
456-
# Test - Apply Xcode 15 Patch #
457-
# ================================= #
458-
def test_applyXcode15Patch_whenXcodebuild14_correctlyAppliesNecessaryPatch
459-
# Arrange
460-
XcodebuildMock.set_version = "Xcode 14.3"
461-
first_target = prepare_target("FirstTarget")
462-
second_target = prepare_target("SecondTarget")
463-
third_target = TargetMock.new("ThirdTarget", [
464-
BuildConfigurationMock.new("Debug", {
465-
"GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
466-
}),
467-
BuildConfigurationMock.new("Release", {
468-
"GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
469-
}),
470-
], nil)
471-
472-
user_project_mock = UserProjectMock.new("/a/path", [
473-
prepare_config("Debug"),
474-
prepare_config("Release"),
475-
],
476-
:native_targets => [
477-
first_target,
478-
second_target
479-
]
480-
)
481-
pods_projects_mock = PodsProjectMock.new([], {"hermes-engine" => {}}, :native_targets => [
482-
third_target
483-
])
484-
installer = InstallerMock.new(pods_projects_mock, [
485-
AggregatedProjectMock.new(user_project_mock)
486-
])
487-
488-
# Act
489-
user_project_mock.build_configurations.each do |config|
490-
assert_nil(config.build_settings["OTHER_LDFLAGS"])
491-
end
492-
493-
ReactNativePodsUtils.apply_xcode_15_patch(installer, :xcodebuild_manager => XcodebuildMock)
494-
495-
# Assert
496-
user_project_mock.build_configurations.each do |config|
497-
assert_equal("$(inherited) ", config.build_settings["OTHER_LDFLAGS"])
498-
end
499-
500-
# User project and Pods project
501-
assert_equal(2, XcodebuildMock.version_invocation_count)
502-
end
503-
504-
def test_applyXcode15Patch_whenXcodebuild15_1_does_not_apply_patch
505-
# Arrange
506-
XcodebuildMock.set_version = "Xcode 15.1"
507-
first_target = prepare_target("FirstTarget")
508-
second_target = prepare_target("SecondTarget")
509-
third_target = TargetMock.new("ThirdTarget", [
510-
BuildConfigurationMock.new("Debug", {
511-
"GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
512-
}),
513-
BuildConfigurationMock.new("Release", {
514-
"GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
515-
}),
516-
], nil)
517-
518-
user_project_mock = UserProjectMock.new("/a/path", [
519-
prepare_config("Debug"),
520-
prepare_config("Release"),
521-
],
522-
:native_targets => [
523-
first_target,
524-
second_target
525-
]
526-
)
527-
pods_projects_mock = PodsProjectMock.new([], {"hermes-engine" => {}}, :native_targets => [
528-
third_target
529-
])
530-
installer = InstallerMock.new(pods_projects_mock, [
531-
AggregatedProjectMock.new(user_project_mock)
532-
])
533-
534-
# Act
535-
user_project_mock.build_configurations.each do |config|
536-
assert_nil(config.build_settings["OTHER_LDFLAGS"])
537-
end
538-
539-
ReactNativePodsUtils.apply_xcode_15_patch(installer, :xcodebuild_manager => XcodebuildMock)
540-
541-
# Assert
542-
user_project_mock.build_configurations.each do |config|
543-
assert_equal("$(inherited) ", config.build_settings["OTHER_LDFLAGS"])
544-
end
545-
546-
# User project and Pods project
547-
assert_equal(2, XcodebuildMock.version_invocation_count)
548-
end
549-
550-
def test_applyXcode15Patch_whenXcodebuild15_correctlyAppliesNecessaryPatch
551-
# Arrange
552-
XcodebuildMock.set_version = "Xcode 15.0"
553-
first_target = prepare_target("FirstTarget")
554-
second_target = prepare_target("SecondTarget")
555-
third_target = TargetMock.new("ThirdTarget", [
556-
BuildConfigurationMock.new("Debug", {
557-
"GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
558-
}),
559-
BuildConfigurationMock.new("Release", {
560-
"GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
561-
}),
562-
], nil)
563-
564-
user_project_mock = UserProjectMock.new("/a/path", [
565-
prepare_config("Debug"),
566-
prepare_config("Release"),
567-
],
568-
:native_targets => [
569-
first_target,
570-
second_target
571-
]
572-
)
573-
pods_projects_mock = PodsProjectMock.new([], {"hermes-engine" => {}}, :native_targets => [
574-
third_target
575-
])
576-
installer = InstallerMock.new(pods_projects_mock, [
577-
AggregatedProjectMock.new(user_project_mock)
578-
])
579-
580-
# Act
581-
user_project_mock.build_configurations.each do |config|
582-
assert_nil(config.build_settings["OTHER_LDFLAGS"])
583-
end
584-
585-
ReactNativePodsUtils.apply_xcode_15_patch(installer, :xcodebuild_manager => XcodebuildMock)
586-
587-
# Assert
588-
user_project_mock.build_configurations.each do |config|
589-
assert_equal("$(inherited) -Wl -ld_classic", config.build_settings["OTHER_LDFLAGS"])
590-
end
591-
592-
# User project and Pods project
593-
assert_equal(2, XcodebuildMock.version_invocation_count)
594-
end
595-
596-
def test_applyXcode15Patch_whenXcodebuild14ButProjectHasSettings_correctlyRemovesNecessaryPatch
597-
# Arrange
598-
XcodebuildMock.set_version = "Xcode 14.3"
599-
first_target = prepare_target("FirstTarget")
600-
second_target = prepare_target("SecondTarget")
601-
third_target = TargetMock.new("ThirdTarget", [
602-
BuildConfigurationMock.new("Debug", {
603-
"GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
604-
}),
605-
BuildConfigurationMock.new("Release", {
606-
"GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
607-
}),
608-
], nil)
609-
610-
debug_config = prepare_config("Debug", {"OTHER_LDFLAGS" => "$(inherited) -Wl -ld_classic "})
611-
release_config = prepare_config("Release", {"OTHER_LDFLAGS" => "$(inherited) -Wl -ld_classic "})
612-
613-
user_project_mock = UserProjectMock.new("/a/path", [
614-
debug_config,
615-
release_config,
616-
],
617-
:native_targets => [
618-
first_target,
619-
second_target
620-
]
621-
)
622-
pods_projects_mock = PodsProjectMock.new([debug_config.clone, release_config.clone], {"hermes-engine" => {}}, :native_targets => [
623-
third_target
624-
])
625-
installer = InstallerMock.new(pods_projects_mock, [
626-
AggregatedProjectMock.new(user_project_mock)
627-
])
628-
629-
# Act
630-
user_project_mock.build_configurations.each do |config|
631-
assert_equal("$(inherited) -Wl -ld_classic ", config.build_settings["OTHER_LDFLAGS"])
632-
end
633-
634-
ReactNativePodsUtils.apply_xcode_15_patch(installer, :xcodebuild_manager => XcodebuildMock)
635-
636-
# Assert
637-
user_project_mock.build_configurations.each do |config|
638-
assert_equal("$(inherited)", config.build_settings["OTHER_LDFLAGS"])
639-
end
640-
641-
# User project and Pods project
642-
assert_equal(2, XcodebuildMock.version_invocation_count)
643-
end
644-
645455
# ==================================== #
646456
# Test - Set build setting #
647457
# ==================================== #

packages/react-native/scripts/cocoapods/helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def self.min_ios_version_supported
8585
end
8686

8787
def self.min_xcode_version_supported
88-
return '15.1'
88+
return '16.1'
8989
end
9090

9191
def self.folly_config

packages/react-native/scripts/cocoapods/utils.rb

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -177,27 +177,6 @@ def self.apply_mac_catalyst_patches(installer)
177177
end
178178
end
179179

180-
def self.apply_xcode_15_patch(installer, xcodebuild_manager: Xcodebuild)
181-
projects = self.extract_projects(installer)
182-
183-
other_ld_flags_key = 'OTHER_LDFLAGS'
184-
xcode15_compatibility_flags = '-Wl -ld_classic '
185-
186-
projects.each do |project|
187-
project.build_configurations.each do |config|
188-
# fix for weak linking
189-
self.safe_init(config, other_ld_flags_key)
190-
if self.is_using_xcode15_0(:xcodebuild_manager => xcodebuild_manager)
191-
self.add_value_to_setting_if_missing(config, other_ld_flags_key, xcode15_compatibility_flags)
192-
else
193-
self.remove_value_from_setting_if_present(config, other_ld_flags_key, xcode15_compatibility_flags)
194-
end
195-
end
196-
project.save()
197-
end
198-
199-
end
200-
201180
private
202181

203182
def self.add_build_settings_to_pod(installer, settings_name, settings_value, target_pod_name, configuration_type)
@@ -423,16 +402,6 @@ def self.remove_value_from_setting_if_present(config, setting_name, value)
423402
end
424403
end
425404

426-
def self.is_using_xcode15_0(xcodebuild_manager: Xcodebuild)
427-
xcodebuild_version = xcodebuild_manager.version
428-
429-
if version = self.parse_xcode_version(xcodebuild_version)
430-
return version["major"] == 15 && version["minor"] == 0
431-
end
432-
433-
return false
434-
end
435-
436405
def self.parse_xcode_version(version_string)
437406
# The output of xcodebuild -version is something like
438407
# Xcode 15.0

packages/react-native/scripts/react_native_pods.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,6 @@ def react_native_post_install(
444444
ReactNativePodsUtils.set_build_setting(installer, build_setting: "SWIFT_ACTIVE_COMPILATION_CONDITIONS", value: ['$(inherited)', 'DEBUG'], config_name: "Debug")
445445

446446
ReactNativePodsUtils.set_ccache_compiler_and_linker_build_settings(installer, react_native_path, ccache_enabled)
447-
if Environment.new().ruby_platform().include?('darwin')
448-
ReactNativePodsUtils.apply_xcode_15_patch(installer)
449-
end
450447
ReactNativePodsUtils.updateOSDeploymentTarget(installer)
451448
ReactNativePodsUtils.set_dynamic_frameworks_flags(installer)
452449
ReactNativePodsUtils.add_ndebug_flag_to_pods_in_release(installer)

0 commit comments

Comments
 (0)