Cleanup, remove the PRODUCTION flag (#37882)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37882

After some progressive changes, we can finally remove the PRODUCTION flag from the codebase.

## Changelog:
[iOS][Removed] - Remove PRODUCTION flag from iOS build logic

Reviewed By: cortinico, dmytrorykun

Differential Revision: D46726208

fbshipit-source-id: 407268779be8de32c5a6c15ba220a60b7cb9ced7
This commit is contained in:
Riccardo Cipolleschi
2023-06-14 10:10:16 -07:00
committed by Facebook GitHub Bot
parent 332be0f0c8
commit daa99fe5e7
6 changed files with 9 additions and 18 deletions
-4
View File
@@ -886,10 +886,6 @@ jobs:
command: |
cd /tmp/$PROJECT_NAME/ios
if [[ << parameters.flavor >> == "Release" ]]; then
export PRODUCTION=1
fi
if [[ << parameters.architecture >> == "NewArch" ]]; then
export RCT_NEW_ARCH_ENABLED=1
fi
@@ -5,8 +5,6 @@
require "json"
# Whether Hermes is built for Release or Debug is determined by the PRODUCTION envvar.
# package.json
package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
version = package['version']
@@ -23,6 +23,7 @@ class FlipperTests < Test::Unit::TestCase
# Assert
assert_equal($podInvocationCount, 1)
assert_equal($podInvocation['React-Core/DevSupport'][:path], "../../" )
assert_equal($podInvocation['React-Core/DevSupport'][:configurations], ["Debug"] )
end
# ======================= #
@@ -19,10 +19,9 @@ $flipper_default_versions = {
# This function installs the `React-Core/DevSupport` subpods
# when the dependencies are installed for a non production app.
#
# @parameter production: a boolean that indicates whether we are in production or not.
# @parameter pathToReactNative: the path to the React Native installation
def install_flipper_dependencies(pathToReactNative)
pod 'React-Core/DevSupport', :path => "#{pathToReactNative}/"
def install_flipper_dependencies(pathToReactNative, configurations: ["Debug"])
pod 'React-Core/DevSupport', :path => "#{pathToReactNative}/", :configurations => configurations
end
@@ -57,7 +57,7 @@ end
# - path: path to react_native installation.
# - fabric_enabled: whether fabric should be enabled or not.
# - new_arch_enabled: whether the new architecture should be enabled or not.
# - production: whether the dependencies must be installed to target a Debug or a Release build.
# - :production [DEPRECATED] whether the dependencies must be installed to target a Debug or a Release build.
# - hermes_enabled: whether Hermes should be enabled or not.
# - flipper_configuration: The configuration to use for flipper.
# - app_path: path to the React Native app. Required by the New Architecture.
@@ -67,7 +67,7 @@ def use_react_native! (
path: "../node_modules/react-native",
fabric_enabled: false,
new_arch_enabled: ENV['RCT_NEW_ARCH_ENABLED'] == '1',
production: ENV['PRODUCTION'] == '1',
production: false, # deprecated
hermes_enabled: ENV['USE_HERMES'] && ENV['USE_HERMES'] == '0' ? false : true,
flipper_configuration: FlipperConfiguration.disabled,
app_path: '..',
@@ -164,12 +164,9 @@ def use_react_native! (
build_codegen!(prefix, relative_installation_root)
end
# CocoaPods `configurations` option ensures that the target is copied only for the specified configurations,
# but those dependencies are still built.
# Flipper doesn't currently compile for release https://github.com/facebook/react-native/issues/33764
# Setting the production flag to true when build for production make sure that we don't install Flipper in the app in the first place.
if flipper_configuration.flipper_enabled && !production
install_flipper_dependencies(prefix)
# Flipper now build in Release mode but it is not linked to the Release binary (as specified by the Configuration option)
if flipper_configuration.flipper_enabled
install_flipper_dependencies(prefix, :configurations => flipper_configuration.configurations)
use_flipper_pods(flipper_configuration.versions, :configurations => flipper_configuration.configurations)
end
+1 -1
View File
@@ -38,7 +38,7 @@ def pods(target_name, options = {}, use_flipper: !IN_CI && !USE_FRAMEWORKS)
flipper_configuration: use_flipper ? FlipperConfiguration.enabled : FlipperConfiguration.disabled,
app_path: "#{Dir.pwd}",
config_file_dir: "#{Dir.pwd}/node_modules",
production: !ENV['PRODUCTION'].nil?,
production: false, #deprecated
ios_folder: '.',
)
pod 'ReactCommon-Samples', :path => "#{@prefix_path}/ReactCommon/react/nativemodule/samples"