From ef27760e14cd05749af25b9d6891ad9f65644d92 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Sun, 2 Apr 2023 02:18:29 -0700 Subject: [PATCH] Fix Cocoapods for Xcode 14.3.0 (#36759) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36759 On Thursday the 30th, Apple Released Xcode 14.3.0. This Version of Xcode enforce some version checks for which React-Codegen, which supported iOS 11 as minimum supported version, could not be build anymore. This change ensue that React-Codegen is always aligned to the min version supported by React Native. Plus, it moves CircleCI's Xcode to 14.3.0, to keep this problem in Check. While working on this, I figured that, with the monorepo, Ruby tests stopped working because they were in the wrong folder: I moved them in the right one. ## Changelog: [iOS][Fixed] - Make React Native build with Xcode 14.3.0 and fix tests Reviewed By: blakef Differential Revision: D44605617 fbshipit-source-id: 182bad20fff2bc19f900000560152369013bb481 --- .circleci/config.yml | 4 ++-- .../scripts/cocoapods/__tests__/codegen_utils-test.rb | 10 +++++++++- .../react-native/scripts/cocoapods/codegen_utils.rb | 2 +- .../react-native/scripts}/run_ruby_tests.sh | 0 4 files changed, 12 insertions(+), 4 deletions(-) rename {scripts => packages/react-native/scripts}/run_ruby_tests.sh (100%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5a4475b831f637..102d8b5b3f283f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,7 +46,7 @@ references: # Dependency Anchors # ------------------------- dependency_versions: - xcode_version: &xcode_version "14.2.0" + xcode_version: &xcode_version "14.3.0" nodelts_image: &nodelts_image "cimg/node:18.12.1" nodeprevlts_image: &nodeprevlts_image "cimg/node:16.18.1" @@ -620,7 +620,7 @@ jobs: - run: name: Run Ruby Tests command: | - cd scripts + cd packages/react-native/scripts sh run_ruby_tests.sh - run_yarn - *attach_hermes_workspace diff --git a/packages/react-native/scripts/cocoapods/__tests__/codegen_utils-test.rb b/packages/react-native/scripts/cocoapods/__tests__/codegen_utils-test.rb index af1184e1e783ac..725e57c278a148 100644 --- a/packages/react-native/scripts/cocoapods/__tests__/codegen_utils-test.rb +++ b/packages/react-native/scripts/cocoapods/__tests__/codegen_utils-test.rb @@ -15,6 +15,14 @@ require_relative "./test_utils/CodegenScriptPhaseExtractorMock.rb" require_relative "./test_utils/FileUtilsMock.rb" +# mocking the min_ios_version_supported function +# as it is not possible to require the original react_native_pod +# without incurring in circular deps +# TODO: move `min_ios_version_supported` to utils.rb +def min_ios_version_supported + return '12.4' +end + class CodegenUtilsTests < Test::Unit::TestCase :base_path @@ -527,7 +535,7 @@ def get_podspec_no_fabric_no_script 'source' => { :git => '' }, 'header_mappings_dir' => './', 'platforms' => { - 'ios' => '11.0', + 'ios' => '12.4', }, 'source_files' => "**/*.{h,mm,cpp}", 'pod_target_xcconfig' => { diff --git a/packages/react-native/scripts/cocoapods/codegen_utils.rb b/packages/react-native/scripts/cocoapods/codegen_utils.rb index c0db4bbb47425e..a90acc21553b6f 100644 --- a/packages/react-native/scripts/cocoapods/codegen_utils.rb +++ b/packages/react-native/scripts/cocoapods/codegen_utils.rb @@ -111,7 +111,7 @@ def get_react_codegen_spec(package_json_file, folly_version: '2021.07.22.00', fa 'source' => { :git => '' }, 'header_mappings_dir' => './', 'platforms' => { - 'ios' => '11.0', + 'ios' => min_ios_version_supported, }, 'source_files' => "**/*.{h,mm,cpp}", 'pod_target_xcconfig' => { diff --git a/scripts/run_ruby_tests.sh b/packages/react-native/scripts/run_ruby_tests.sh similarity index 100% rename from scripts/run_ruby_tests.sh rename to packages/react-native/scripts/run_ruby_tests.sh