Skip to content

Commit 5fcb69e

Browse files
hoxyqfacebook-github-bot
authored andcommitted
cleanup usage of HERMES_ENABLE_DEBUGGER and define set of build-time flags for Fusebox (#49673)
Summary: Pull Request resolved: #49673 ## Changelog: [General] [Breaking] - Deprecated usage of `HERMES_ENABLE_DEBUGGER` build-time flag for enabling React Native debugger in favour of `REACT_NATIVE_DEBUGGER_ENABLED` and `REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY`. Reviewed By: huntie Differential Revision: D70177232 fbshipit-source-id: 402adea7daa810c92015fd844430b26ae29bbf75
1 parent 4a055f3 commit 5fcb69e

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

packages/react-native/React/Base/RCTDefines.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
* If Fusebox is enabled for release builds, enable the remote profile mode, fall back to RCT_DEV by default.
5353
*/
5454
#ifndef RCT_REMOTE_PROFILE
55-
#ifdef REACT_NATIVE_ENABLE_FUSEBOX_RELEASE
56-
#define RCT_REMOTE_PROFILE REACT_NATIVE_ENABLE_FUSEBOX_RELEASE
55+
#ifdef REACT_NATIVE_DEBUGGER_MODE_PROD
56+
#define RCT_REMOTE_PROFILE REACT_NATIVE_DEBUGGER_MODE_PROD
5757
#else
5858
#define RCT_REMOTE_PROFILE RCT_DEV
5959
#endif

packages/react-native/ReactCommon/jsinspector-modern/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ cmake_minimum_required(VERSION 3.13)
77
set(CMAKE_VERBOSE_MAKEFILE on)
88

99
add_compile_options(
10-
$<$<CONFIG:Debug>:-DHERMES_ENABLE_DEBUGGER=1>
10+
$<$<CONFIG:Debug>:-DREACT_NATIVE_DEBUGGER_ENABLED=1>
11+
$<$<CONFIG:Debug>:-DREACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1>
1112
-fexceptions
1213
-std=c++20)
1314

packages/react-native/ReactCommon/jsinspector-modern/InspectorFlags.cpp

+5-11
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,23 @@ void InspectorFlags::dangerouslyDisableFuseboxForTest() {
4141
fuseboxDisabledForTest_ = true;
4242
}
4343

44-
#if defined(REACT_NATIVE_FORCE_ENABLE_FUSEBOX) && \
45-
defined(REACT_NATIVE_FORCE_DISABLE_FUSEBOX)
44+
#if defined(REACT_NATIVE_DEBUGGER_ENABLED) && \
45+
defined(REACT_NATIVE_DEBUGGER_FORCE_DISABLE)
4646
#error \
47-
"Cannot define both REACT_NATIVE_FORCE_ENABLE_FUSEBOX and REACT_NATIVE_FORCE_DISABLE_FUSEBOX"
47+
"Cannot define both REACT_NATIVE_DEBUGGER_ENABLED and REACT_NATIVE_DEBUGGER_FORCE_DISABLE"
4848
#endif
4949

5050
const InspectorFlags::Values& InspectorFlags::loadFlagsAndAssertUnchanged()
5151
const {
5252
InspectorFlags::Values newValues = {
5353
.fuseboxEnabled =
54-
#if defined(REACT_NATIVE_FORCE_ENABLE_FUSEBOX)
55-
true,
56-
#elif defined(REACT_NATIVE_FORCE_DISABLE_FUSEBOX)
57-
false,
58-
#elif defined(HERMES_ENABLE_DEBUGGER)
59-
true,
60-
#elif defined(REACT_NATIVE_ENABLE_FUSEBOX_RELEASE)
54+
#if defined(REACT_NATIVE_DEBUGGER_ENABLED)
6155
true,
6256
#else
6357
ReactNativeFeatureFlags::fuseboxEnabledRelease(),
6458
#endif
6559
.isProfilingBuild =
66-
#if defined(REACT_NATIVE_ENABLE_FUSEBOX_RELEASE)
60+
#if defined(REACT_NATIVE_DEBUGGER_MODE_PROD)
6761
true,
6862
#else
6963
false,

packages/react-native/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <react/nativemodule/idlecallbacks/NativeIdleCallbacks.h>
1212
#include <react/nativemodule/microtasks/NativeMicrotasks.h>
1313

14-
#ifdef HERMES_ENABLE_DEBUGGER
14+
#ifdef REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY
1515
#include <react/nativemodule/devtoolsruntimesettings/DevToolsRuntimeSettingsModule.h>
1616
#endif
1717

@@ -36,7 +36,7 @@ namespace facebook::react {
3636
return std::make_shared<NativeDOM>(jsInvoker);
3737
}
3838

39-
#ifdef HERMES_ENABLE_DEBUGGER
39+
#ifdef REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY
4040
if (name == DevToolsRuntimeSettingsModule::kModuleName) {
4141
return std::make_shared<DevToolsRuntimeSettingsModule>(jsInvoker);
4242
}

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,15 @@ def self.has_pod(installer, name)
4545

4646
def self.set_gcc_preprocessor_definition_for_React_hermes(installer)
4747
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-hermes", :debug)
48-
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-jsinspector", :debug)
4948
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "hermes-engine", :debug)
5049
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-RuntimeHermes", :debug)
5150
end
5251

52+
def self.set_gcc_preprocessor_definition_for_debugger(installer)
53+
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-jsinspector", :debug)
54+
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-jsinspector", :debug)
55+
end
56+
5357
def self.turn_off_resource_bundle_react_core(installer)
5458
# this is needed for Xcode 14, see more details here https://github.com/facebook/react-native/issues/34673
5559
# we should be able to remove this once CocoaPods catches up to it, see more details here https://github.com/CocoaPods/CocoaPods/issues/11402

packages/react-native/scripts/react_native_pods.rb

+1
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ def react_native_post_install(
414414
if hermes_enabled
415415
ReactNativePodsUtils.set_gcc_preprocessor_definition_for_React_hermes(installer)
416416
end
417+
ReactNativePodsUtils.set_gcc_preprocessor_definition_for_debugger(installer)
417418

418419
ReactNativePodsUtils.fix_library_search_paths(installer)
419420
ReactNativePodsUtils.update_search_paths(installer)

0 commit comments

Comments
 (0)