diff --git a/packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts b/packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts index 7fa719f08e60d2..e57329789b0057 100644 --- a/packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts +++ b/packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts @@ -252,8 +252,8 @@ android { cmake { arguments( "-DCMAKE_BUILD_TYPE=MinSizeRel", - // For release builds, we don't want to enable the Hermes Debugger. - "-DHERMES_ENABLE_DEBUGGER=False") + // For Expo Go, we have to enable debugging even on release builds. + "-DHERMES_ENABLE_DEBUGGER=True") } } } diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/hermes/reactexecutor/CMakeLists.txt b/packages/react-native/ReactAndroid/src/main/jni/react/hermes/reactexecutor/CMakeLists.txt index 0a7f253f63ce56..60a5a09449394c 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/hermes/reactexecutor/CMakeLists.txt +++ b/packages/react-native/ReactAndroid/src/main/jni/react/hermes/reactexecutor/CMakeLists.txt @@ -15,7 +15,7 @@ add_library(hermes_executor target_compile_options( hermes_executor PRIVATE - $<$:-DHERMES_ENABLE_DEBUGGER=1> + -DHERMES_ENABLE_DEBUGGER=1 -std=c++20 -fexceptions ) diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/runtime/hermes/jni/CMakeLists.txt b/packages/react-native/ReactAndroid/src/main/jni/react/runtime/hermes/jni/CMakeLists.txt index 1848f355fb6fa9..50f027dd8a45a3 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/runtime/hermes/jni/CMakeLists.txt +++ b/packages/react-native/ReactAndroid/src/main/jni/react/runtime/hermes/jni/CMakeLists.txt @@ -15,7 +15,7 @@ add_library(hermesinstancejni target_compile_options( hermesinstancejni PRIVATE - $<$:-DHERMES_ENABLE_DEBUGGER=1> + -DHERMES_ENABLE_DEBUGGER=1 -std=c++20 -fexceptions ) diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/runtime/jni/CMakeLists.txt b/packages/react-native/ReactAndroid/src/main/jni/react/runtime/jni/CMakeLists.txt index f61819764c0248..a6ebd6fa1afce6 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/runtime/jni/CMakeLists.txt +++ b/packages/react-native/ReactAndroid/src/main/jni/react/runtime/jni/CMakeLists.txt @@ -15,7 +15,7 @@ add_library(rninstance target_compile_options( rninstance PRIVATE - $<$:-DHERMES_ENABLE_DEBUGGER=1> + -DHERMES_ENABLE_DEBUGGER=1 -std=c++20 -fexceptions ) diff --git a/packages/react-native/ReactCommon/hermes/executor/CMakeLists.txt b/packages/react-native/ReactCommon/hermes/executor/CMakeLists.txt index 6c72e5d1b90ac2..6ed337abb5f598 100644 --- a/packages/react-native/ReactCommon/hermes/executor/CMakeLists.txt +++ b/packages/react-native/ReactCommon/hermes/executor/CMakeLists.txt @@ -33,5 +33,6 @@ else() hermes_executor_common PRIVATE -DNDEBUG + -DHERMES_ENABLE_DEBUGGER=1 ) endif() diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/CMakeLists.txt b/packages/react-native/ReactCommon/hermes/inspector-modern/CMakeLists.txt index bb820dabe1fad7..0d99a0a02b2ce2 100644 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/CMakeLists.txt +++ b/packages/react-native/ReactCommon/hermes/inspector-modern/CMakeLists.txt @@ -25,6 +25,14 @@ if(${CMAKE_BUILD_TYPE} MATCHES Debug) PRIVATE -DHERMES_ENABLE_DEBUGGER=1 ) +else() + # Expo Go requires debugging on release builds + target_compile_options( + hermes_inspector_modern + PRIVATE + # Expo Go requires debugging on release builds + -DHERMES_ENABLE_DEBUGGER=1 + ) endif() target_include_directories(hermes_inspector_modern PUBLIC ${REACT_COMMON_DIR}) diff --git a/packages/react-native/ReactCommon/react/runtime/CMakeLists.txt b/packages/react-native/ReactCommon/react/runtime/CMakeLists.txt index 3a440e009b0c7a..f6dcee55da38aa 100644 --- a/packages/react-native/ReactCommon/react/runtime/CMakeLists.txt +++ b/packages/react-native/ReactCommon/react/runtime/CMakeLists.txt @@ -15,7 +15,7 @@ add_library(bridgeless target_compile_options( bridgeless PRIVATE - $<$:-DHERMES_ENABLE_DEBUGGER=1> + -DHERMES_ENABLE_DEBUGGER=1 -std=c++20 -fexceptions ) diff --git a/packages/react-native/sdks/hermes-engine/hermes-engine.podspec b/packages/react-native/sdks/hermes-engine/hermes-engine.podspec index 335004f1e87e3d..08e0c155d6af68 100644 --- a/packages/react-native/sdks/hermes-engine/hermes-engine.podspec +++ b/packages/react-native/sdks/hermes-engine/hermes-engine.podspec @@ -12,6 +12,9 @@ react_native_path = File.join(__dir__, "..", "..") package = JSON.parse(File.read(File.join(react_native_path, "package.json"))) version = package['version'] +# Force building Hermes from source because Expo Go requires customized Hermes build +ENV['BUILD_FROM_SOURCE'] = 'true' + source_type = hermes_source_type(version, react_native_path) source = podspec_source(source_type, version, react_native_path) diff --git a/packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh b/packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh index a4fe7d79024cb4..ebb1a402dc6d6b 100755 --- a/packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh +++ b/packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh @@ -57,7 +57,8 @@ function configure_apple_framework { if [[ $BUILD_TYPE == "Debug" ]]; then enable_debugger="true" else - enable_debugger="false" + # Expo Go requires debugging on release build + enable_debugger="true" fi if [[ $BUILD_TYPE == "Debug" ]]; then # JS developers aren't VM developers. diff --git a/packages/react-native/sdks/hermes-engine/utils/build-hermes-xcode.sh b/packages/react-native/sdks/hermes-engine/utils/build-hermes-xcode.sh index 7d44c4cccb40b6..bcfc6e90278a50 100755 --- a/packages/react-native/sdks/hermes-engine/utils/build-hermes-xcode.sh +++ b/packages/react-native/sdks/hermes-engine/utils/build-hermes-xcode.sh @@ -30,7 +30,8 @@ function get_deployment_target { echo ${IPHONEOS_DEPLOYMENT_TARGET} } -enable_debugger="false" +# Expo Go requires debugging on release build +enable_debugger="true" if [[ "$CONFIGURATION" == "Debug" ]]; then enable_debugger="true" fi