Skip to content

Commit eb13eba

Browse files
andrewdacenkometa-codesync[bot]
authored andcommitted
enable render debug strings to opt mode (facebook#54581)
Summary: Pull Request resolved: facebook#54581 Changelog: [Internal] This helps us test with opt mode enabled as its the only one available for coverage. Reviewed By: javache Differential Revision: D87346884 fbshipit-source-id: 76dcb0848c3d4019739120339dd5b16dd25ef02d
1 parent 55a5b6b commit eb13eba

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

packages/react-native/ReactCommon/react/renderer/debug/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@ target_include_directories(react_renderer_debug PUBLIC ${REACT_COMMON_DIR})
1515
target_link_libraries(react_renderer_debug folly_runtime react_debug)
1616
target_compile_reactnative_options(react_renderer_debug PRIVATE)
1717
target_compile_options(react_renderer_debug PRIVATE -Wpedantic)
18+
19+
# Enable debug string convertible for Debug builds or when explicitly requested
20+
# This allows getRenderedOutput() to include props in tests
21+
# Set RN_ENABLE_DEBUG_STRING_CONVERTIBLE=ON to enable for Release builds
22+
if(${CMAKE_BUILD_TYPE} MATCHES Debug OR RN_ENABLE_DEBUG_STRING_CONVERTIBLE)
23+
target_compile_definitions(react_renderer_debug PUBLIC RN_ENABLE_DEBUG_STRING_CONVERTIBLE)
24+
endif()

packages/react-native/ReactCommon/react/renderer/debug/flags.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
// #define RN_SHADOW_TREE_INTROSPECTION 1
3030

3131
// This enables certain object-to-string debug conversions to be compiled.
32-
// Enable if `REACT_NATIVE_DEBUG` is enabled.
33-
#ifdef REACT_NATIVE_DEBUG
32+
// Enable if either `REACT_NATIVE_DEBUG` or `RN_ENABLE_DEBUG_STRING_CONVERTIBLE`
33+
// is defined
34+
#if defined(REACT_NATIVE_DEBUG) || defined(RN_ENABLE_DEBUG_STRING_CONVERTIBLE)
3435
#define RN_DEBUG_STRING_CONVERTIBLE 1
3536
#else
3637
#define RN_DEBUG_STRING_CONVERTIBLE 0

private/react-native-fantom/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ val configureFantomTester by
188188
"-DREACT_COMMON_DIR=$reactNativeDir/ReactCommon",
189189
"-DREACT_CXX_PLATFORM_DIR=$reactNativeDir/ReactCxxPlatform",
190190
"-DREACT_THIRD_PARTY_NDK_DIR=$reactAndroidBuildDir/third-party-ndk",
191+
"-DRN_ENABLE_DEBUG_STRING_CONVERTIBLE=ON",
191192
)
192193
commandLine(cmdArgs)
193194
standardOutputFile.set(project.file("$buildDir/reports/configure-fantom_tester.log"))

0 commit comments

Comments
 (0)