Expose preprocessor flag/Buck constraint for Fusebox opt in (#45203)

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

Configures a `REACT_NATIVE_ENABLE_FUSEBOX_DEBUG` flag, and exposes this flag in the Buck target via a [constraint setting](https://www.internalfb.com/intern/wiki/Buck-users/select-and-friends/#constraint-setting-and-c). This is an additional hook to enable the new debugger stack (codename Fusebox) as part of our internal rollout.

NOTE: This approach replaces D59014161 (reverted).

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D59109110

fbshipit-source-id: 7d23d9d402569b00d8dd17b9c8f3bcc108f0365f
This commit is contained in:
Alex Hunt
2024-06-27 09:44:15 -07:00
committed by Facebook GitHub Bot
parent eb9c388492
commit bfc51f97da
2 changed files with 7 additions and 4 deletions
@@ -18,7 +18,7 @@ InspectorFlags& InspectorFlags::getInstance() {
}
bool InspectorFlags::getFuseboxEnabled() const {
return loadFlagsAndAssertUnchanged().fuseboxEnabledDebug;
return loadFlagsAndAssertUnchanged().fuseboxEnabled;
}
void InspectorFlags::dangerouslyResetFlags() {
@@ -28,8 +28,11 @@ void InspectorFlags::dangerouslyResetFlags() {
const InspectorFlags::Values& InspectorFlags::loadFlagsAndAssertUnchanged()
const {
InspectorFlags::Values newValues = {
.fuseboxEnabledDebug =
#ifdef REACT_NATIVE_FORCE_ENABLE_FUSEBOX
.fuseboxEnabled =
#if defined(REACT_NATIVE_FORCE_ENABLE_FUSEBOX)
true,
#elif defined(HERMES_ENABLE_DEBUGGER) && \
defined(REACT_NATIVE_ENABLE_FUSEBOX_DEBUG)
true,
#elif defined(HERMES_ENABLE_DEBUGGER)
ReactNativeFeatureFlags::fuseboxEnabledDebug(),
@@ -32,7 +32,7 @@ class InspectorFlags {
private:
struct Values {
bool fuseboxEnabledDebug;
bool fuseboxEnabled;
bool operator==(const Values&) const = default;
};