Skip to content

Commit 75f4c83

Browse files
authored
Fix remaining missing debugger build flags for open source builds (#54770)
1 parent 30cbe97 commit 75f4c83

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

packages/react-native/Package.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,11 @@ let reactRCTBlob = RNTarget(
594594
let reactRCTNetwork = RNTarget(
595595
name: .reactRCTNetwork,
596596
path: "Libraries/Network",
597-
dependencies: [.yoga, .jsi, .reactTurboModuleCore]
597+
dependencies: [.yoga, .jsi, .reactTurboModuleCore],
598+
defines: [
599+
CXXSetting.define("REACT_NATIVE_DEBUGGER_ENABLED", to: "1", .when(configuration: BuildConfiguration.debug)),
600+
CXXSetting.define("REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY", to: "1", .when(configuration: BuildConfiguration.debug)),
601+
]
598602
)
599603

600604
/// React-RCTVibration.podspec

packages/react-native/ReactAndroid/src/main/jni/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,3 +338,10 @@ target_include_directories(reactnative
338338
$<TARGET_PROPERTY:uimanagerjni,INTERFACE_INCLUDE_DIRECTORIES>
339339
$<TARGET_PROPERTY:yoga,INTERFACE_INCLUDE_DIRECTORIES>
340340
)
341+
342+
if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
343+
target_compile_options(reactnative PRIVATE
344+
-DREACT_NATIVE_DEBUGGER_ENABLED=1
345+
-DREACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1
346+
)
347+
endif ()

packages/react-native/ReactAndroid/src/main/jni/react/devsupport/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,10 @@ target_link_libraries(react_devsupportjni
2323
react_networking)
2424

2525
target_compile_reactnative_options(react_devsupportjni PRIVATE)
26+
27+
if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
28+
target_compile_options(react_devsupportjni PRIVATE
29+
-DREACT_NATIVE_DEBUGGER_ENABLED=1
30+
-DREACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1
31+
)
32+
endif ()

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ def self.set_gcc_preprocessor_definition_for_React_hermes(installer)
5858

5959
def self.set_gcc_preprocessor_definition_for_debugger(installer)
6060
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-jsinspector", :debug)
61+
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-jsinspectornetwork", :debug)
6162
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-RCTNetwork", :debug)
6263
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-networking", :debug)
6364
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-jsinspector", :debug)
65+
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-jsinspectornetwork", :debug)
6466
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-RCTNetwork", :debug)
6567
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-networking", :debug)
6668
end

0 commit comments

Comments
 (0)