Skip to content

Commit

Permalink
Cleanup, remove the PRODUCTION flag (#37882)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Jun 14, 2023
1 parent 332be0f commit daa99fe
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 18 deletions.
4 changes: 0 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions packages/react-native/ReactCommon/hermes/React-hermes.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def test_installFlipperDependencies_installDependencies
# Assert
assert_equal($podInvocationCount, 1)
assert_equal($podInvocation['React-Core/DevSupport'][:path], "../../" )
assert_equal($podInvocation['React-Core/DevSupport'][:configurations], ["Debug"] )
end

# ======================= #
Expand Down
5 changes: 2 additions & 3 deletions packages/react-native/scripts/cocoapods/flipper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
# 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


Expand Down
13 changes: 5 additions & 8 deletions packages/react-native/scripts/react_native_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def prepare_react_native_project!
# - 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.
Expand All @@ -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: '..',
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion packages/rn-tester/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit daa99fe

Please sign in to comment.