From 671520943fba80b9c8ce4a5279520c7d4a7b14a9 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Mon, 13 Jan 2025 07:00:12 -0800 Subject: [PATCH] Remove build codegen from Cocoapods (#48631) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48631 This step is already carried out by [generate-artifact-executor](https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/codegen/generate-artifacts-executor.js#L385) if needed. We can remove it from cocoapods and this will make it easier to migrate away from them. For 3rd party apps that uses a specific version of React Native, codegen is shipped in NPM as already built in the react-native/codegen package. This change really affects only the React Native monorepo. ## Changelog [Internal] - Remove build codegen step from cocoapods Reviewed By: cortinico Differential Revision: D68019743 fbshipit-source-id: 7aaf9275886ba8b86d38d943d2b26bd8eed11aa8 --- .../react-native/scripts/cocoapods/codegen.rb | 15 --------------- .../react-native/scripts/react_native_pods.rb | 2 -- 2 files changed, 17 deletions(-) diff --git a/packages/react-native/scripts/cocoapods/codegen.rb b/packages/react-native/scripts/cocoapods/codegen.rb index d1c2c58d26a8b5..cd76a0a7540cab 100644 --- a/packages/react-native/scripts/cocoapods/codegen.rb +++ b/packages/react-native/scripts/cocoapods/codegen.rb @@ -5,21 +5,6 @@ require_relative './helpers.rb' -# It builds the codegen CLI if it is not present -# -# Parameters: -# - react_native_path: the path to the react native installation -# - relative_installation_root: the path to the relative installation root of the pods -# - dir_manager: a class that implements the `Dir` interface. Defaults to `Dir`, the Dependency can be injected for testing purposes. -# @throws an error if it could not find the codegen folder. -def build_codegen!(react_native_path, relative_installation_root, dir_manager: Dir) - codegen_repo_path = "#{basePath(react_native_path, relative_installation_root)}/../react-native-codegen" - return unless dir_manager.exist?(codegen_repo_path) && !dir_manager.exist?("#{codegen_repo_path}/lib") - - Pod::UI.puts "[Codegen] building #{codegen_repo_path}" - system("#{codegen_repo_path}/scripts/oss/build.sh") -end - # keeping the run_codegen! method for testing purposes def run_codegen!( app_path, diff --git a/packages/react-native/scripts/react_native_pods.rb b/packages/react-native/scripts/react_native_pods.rb index 4115944b2e9ce2..74c4c23cd4fb51 100644 --- a/packages/react-native/scripts/react_native_pods.rb +++ b/packages/react-native/scripts/react_native_pods.rb @@ -96,8 +96,6 @@ def use_react_native! ( ReactNativePodsUtils.warn_if_not_on_arm64() - build_codegen!(prefix, relative_path_from_current) - # The Pods which should be included in all projects pod 'FBLazyVector', :path => "#{prefix}/Libraries/FBLazyVector" pod 'RCTRequired', :path => "#{prefix}/Libraries/Required"