Skip to content

Commit 5aa6b72

Browse files
authored
Enable hermes debugger on all build variants (expo#33)
1 parent 99d6929 commit 5aa6b72

File tree

10 files changed

+22
-7
lines changed

10 files changed

+22
-7
lines changed

packages/react-native/ReactAndroid/hermes-engine/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ android {
228228
cmake {
229229
arguments "-DCMAKE_BUILD_TYPE=MinSizeRel"
230230
// For release builds, we don't want to enable the Hermes Debugger.
231-
arguments "-DHERMES_ENABLE_DEBUGGER=False"
231+
// For Expo Go, we have to enable debugging even on release builds.
232+
arguments "-DHERMES_ENABLE_DEBUGGER=True"
232233
}
233234
}
234235
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ add_library(hermes_executor
1515
target_compile_options(
1616
hermes_executor
1717
PRIVATE
18-
$<$<CONFIG:Debug>:-DHERMES_ENABLE_DEBUGGER=1>
18+
-DHERMES_ENABLE_DEBUGGER=1
1919
-std=c++20
2020
-fexceptions
2121
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ add_library(hermesinstancejni
1515
target_compile_options(
1616
hermesinstancejni
1717
PRIVATE
18-
$<$<CONFIG:Debug>:-DHERMES_ENABLE_DEBUGGER=1>
18+
-DHERMES_ENABLE_DEBUGGER=1
1919
-std=c++20
2020
-fexceptions
2121
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ add_library(rninstance
1515
target_compile_options(
1616
rninstance
1717
PRIVATE
18-
$<$<CONFIG:Debug>:-DHERMES_ENABLE_DEBUGGER=1>
18+
-DHERMES_ENABLE_DEBUGGER=1
1919
-std=c++20
2020
-fexceptions
2121
)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ else()
3333
hermes_executor_common
3434
PRIVATE
3535
-DNDEBUG
36+
-DHERMES_ENABLE_DEBUGGER=1
3637
)
3738
endif()

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ if(${CMAKE_BUILD_TYPE} MATCHES Debug)
2626
PRIVATE
2727
-DHERMES_ENABLE_DEBUGGER=1
2828
)
29+
else()
30+
# Expo Go requires debugging on release builds
31+
target_compile_options(
32+
hermes_inspector_modern
33+
PRIVATE
34+
# Expo Go requires debugging on release builds
35+
-DHERMES_ENABLE_DEBUGGER=1
36+
)
2937
endif()
3038

3139
target_include_directories(hermes_inspector_modern PUBLIC ${REACT_COMMON_DIR})

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ add_library(bridgeless
1515
target_compile_options(
1616
bridgeless
1717
PRIVATE
18-
$<$<CONFIG:Debug>:-DHERMES_ENABLE_DEBUGGER=1>
18+
-DHERMES_ENABLE_DEBUGGER=1
1919
-std=c++20
2020
-fexceptions
2121
)

packages/react-native/sdks/hermes-engine/hermes-engine.podspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ react_native_path = File.join(__dir__, "..", "..")
1212
package = JSON.parse(File.read(File.join(react_native_path, "package.json")))
1313
version = package['version']
1414

15+
# Force building Hermes from source because Expo Go requires customized Hermes build
16+
ENV['BUILD_FROM_SOURCE'] = 'true'
17+
1518
source_type = hermes_source_type(version, react_native_path)
1619
source = podspec_source(source_type, version, react_native_path)
1720

packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ function configure_apple_framework {
5757
if [[ $BUILD_TYPE == "Debug" ]]; then
5858
enable_debugger="true"
5959
else
60-
enable_debugger="false"
60+
# Expo Go requires debugging on release build
61+
enable_debugger="true"
6162
fi
6263
if [[ $BUILD_TYPE == "Debug" ]]; then
6364
# JS developers aren't VM developers.

packages/react-native/sdks/hermes-engine/utils/build-hermes-xcode.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ release_version="$1"; shift
1010
hermesc_path="$1"; shift
1111
jsi_path="$1"; shift
1212

13-
enable_debugger="false"
13+
# Expo Go requires debugging on release build
14+
enable_debugger="true"
1415
if [[ "$CONFIGURATION" == "Debug" ]]; then
1516
enable_debugger="true"
1617
fi

0 commit comments

Comments
 (0)