Skip to content

Commit 726328c

Browse files
andrewdacenkofacebook-github-bot
authored andcommitted
enable render debug strings to opt mode
Summary: Changelog: [Internal] This helps us test with opt mode enabled as its the only one available for coverage. Differential Revision: D87346884
1 parent 4bf8204 commit 726328c

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

packages/react-native/Libraries/Components/View/__tests__/View-itest.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*
77
* @flow strict-local
8+
* @fantom_mode opt
89
* @fantom_flags enableNativeCSSParsing:*
910
* @format
1011
*/

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 REACT_NATIVE_ENABLE_DEBUG_STRING_CONVERTIBLE=ON to enable for Release builds
22+
if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_ENABLE_DEBUG_STRING_CONVERTIBLE)
23+
target_compile_definitions(react_renderer_debug PUBLIC RN_DEBUG_STRING_CONVERTIBLE=1)
24+
endif()

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@
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.
32+
// Enable if `REACT_NATIVE_DEBUG` is enabled. Define RN_DEBUG_STRING_CONVERTIBLE
33+
// if you want to override this behavior.
34+
#ifndef RN_DEBUG_STRING_CONVERTIBLE
3335
#ifdef REACT_NATIVE_DEBUG
3436
#define RN_DEBUG_STRING_CONVERTIBLE 1
3537
#else
3638
#define RN_DEBUG_STRING_CONVERTIBLE 0
3739
#endif
40+
#endif
3841

3942
// Enables *very* verbose, noisy logs in the differ. Useful for debugging
4043
// specifically the differ, but not much else.

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+
"-DREACT_NATIVE_ENABLE_DEBUG_STRING_CONVERTIBLE=ON",
191192
)
192193
commandLine(cmdArgs)
193194
standardOutputFile.set(project.file("$buildDir/reports/configure-fantom_tester.log"))

private/react-native-fantom/runner/utils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ export function getBuckModesForPlatform(
101101
throw new Error(`Unsupported platform: ${os.platform()}`);
102102
}
103103

104-
return ['@//xplat/mode/react-native/granite', osPlatform];
104+
return [
105+
'@//xplat/mode/react-native/granite',
106+
'@//xplat/mode/react-native/enable_debug_string_convertible',
107+
osPlatform,
108+
];
105109
}
106110

107111
// TODO: T240293839 Remove when we get rid of RN_USE_ANIMATION_BACKEND preprocessor flag

0 commit comments

Comments
 (0)