Skip to content

Commit a24f1d8

Browse files
chrfalchreact-native-bot
authored andcommitted
fix(hermes-inspector-modern): Apply HERMES_V1_ENABLED define to all build types (#55312)
Summary: The HERMES_V1_ENABLED compile option was incorrectly scoped inside the else() block, meaning it only applied to Release builds. This caused Debug builds to fail with missing header errors: fatal error: 'hermes/inspector/RuntimeAdapter.h' file not found This happens when Expo builds Hermes in release mode but WITH the debugger enabled. Moved the HERMES_V1_ENABLED compile definition into the centralized target_compile_reactnative_options function in react-native-flags.cmake, eliminating duplicate conditional blocks across 7 CMakeLists.txt files. This ensures the define is consistently applied to all targets that use target_compile_reactnative_options when HERMES_V1_ENABLED is set, and makes the codebase easier to maintain. Files cleaned up: - ReactCommon/cmake-utils/react-native-flags.cmake (added centralized logic) - ReactCommon/hermes/inspector-modern/CMakeLists.txt - ReactCommon/hermes/executor/CMakeLists.txt - ReactCommon/react/runtime/CMakeLists.txt - ReactCommon/react/runtime/hermes/CMakeLists.txt - ReactAndroid/.../hermes/reactexecutor/CMakeLists.txt - ReactAndroid/.../runtime/hermes/jni/CMakeLists.txt - ReactAndroid/.../runtime/jni/CMakeLists.txt ## Changelog: [ANDROID] [FIXED] - Fixed so that all build types get the HERMES_V1_ENABLED flag Pull Request resolved: #55312 Test Plan: Build RN Tester with HERMES_V1 Reviewed By: cipolleschi Differential Revision: D91581367 Pulled By: cortinico fbshipit-source-id: fa39158009dadda32438bc04a59579459da2cf7d
1 parent 8d561b0 commit a24f1d8

8 files changed

Lines changed: 3 additions & 28 deletions

File tree

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,4 @@ target_link_libraries(
2727
target_compile_reactnative_options(hermes_executor PRIVATE)
2828
if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
2929
target_compile_options(hermes_executor PRIVATE -DHERMES_ENABLE_DEBUGGER=1)
30-
31-
if (HERMES_V1_ENABLED)
32-
target_compile_options(hermes_executor PRIVATE -DHERMES_V1_ENABLED=1)
33-
endif()
3430
endif()

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,4 @@ target_link_libraries(hermesinstancejni
2929
target_compile_reactnative_options(hermesinstancejni PRIVATE)
3030
if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
3131
target_compile_options(hermesinstancejni PRIVATE -DHERMES_ENABLE_DEBUGGER=1)
32-
33-
if (HERMES_V1_ENABLED)
34-
target_compile_options(hermesinstancejni PRIVATE -DHERMES_V1_ENABLED=1)
35-
endif()
3632
endif ()

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ add_library(rninstance
1919
target_compile_reactnative_options(rninstance PRIVATE)
2020
if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
2121
target_compile_options(rninstance PRIVATE -DHERMES_ENABLE_DEBUGGER=1)
22-
23-
if (HERMES_V1_ENABLED)
24-
target_compile_options(rninstance PRIVATE -DHERMES_V1_ENABLED=1)
25-
endif()
2622
endif ()
2723

2824
target_merge_so(rninstance)

packages/react-native/ReactCommon/cmake-utils/react-native-flags.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@ function(target_compile_reactnative_options target_name scope)
3232
if(ANDROID)
3333
target_compile_definitions(${target_name} ${scope} RN_SERIALIZABLE_STATE)
3434
endif()
35+
if(HERMES_V1_ENABLED)
36+
target_compile_definitions(${target_name} ${scope} HERMES_V1_ENABLED=1)
37+
endif()
3538
endfunction()

packages/react-native/ReactCommon/hermes/executor/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
3232
PRIVATE
3333
-DHERMES_ENABLE_DEBUGGER=1
3434
)
35-
36-
if (HERMES_V1_ENABLED)
37-
target_compile_options(hermes_executor_common PRIVATE -DHERMES_V1_ENABLED=1)
38-
endif()
3935
else()
4036
target_compile_options(
4137
hermes_executor_common

packages/react-native/ReactCommon/hermes/inspector-modern/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
2323
PRIVATE
2424
-DHERMES_ENABLE_DEBUGGER=1
2525
)
26-
27-
if (HERMES_V1_ENABLED)
28-
target_compile_options(hermes_inspector_modern PRIVATE -DHERMES_V1_ENABLED=1)
29-
endif()
3026
endif()
3127

3228
target_include_directories(hermes_inspector_modern PUBLIC ${REACT_COMMON_DIR})

packages/react-native/ReactCommon/react/runtime/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ add_library(bridgeless
1818
target_compile_reactnative_options(bridgeless PRIVATE)
1919
if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
2020
target_compile_options(bridgeless PRIVATE -DHERMES_ENABLE_DEBUGGER=1)
21-
22-
if (HERMES_V1_ENABLED)
23-
target_compile_options(bridgeless PRIVATE -DHERMES_V1_ENABLED=1)
24-
endif()
2521
endif ()
2622
target_include_directories(bridgeless PUBLIC .)
2723

packages/react-native/ReactCommon/react/runtime/hermes/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,4 @@ if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
3535
PRIVATE
3636
-DHERMES_ENABLE_DEBUGGER=1
3737
)
38-
39-
if (HERMES_V1_ENABLED)
40-
target_compile_options(bridgelesshermes PRIVATE -DHERMES_V1_ENABLED=1)
41-
endif()
4238
endif()

0 commit comments

Comments
 (0)