Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/react-native/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,10 @@ let reactCoreModules = RNTarget(
path: "React/CoreModules",
linkedFrameworks: ["Accessibility"],
excludedPaths: ["PlatformStubs/RCTStatusBarManager.mm"],
dependencies: [.reactNativeDependencies, .jsi, .yoga, .reactTurboModuleCore, .reactFeatureFlags]
dependencies: [.reactNativeDependencies, .jsi, .yoga, .reactTurboModuleCore, .reactFeatureFlags],
defines: [
CXXSetting.define("REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY", to: "1", .when(configuration: BuildConfiguration.debug))
]
)

/// React-runtimeCore.podspec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#import "CoreModulesPlugins.h"

#ifdef REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY

struct Config {
bool shouldReloadAndProfile = false;
bool recordChangeDescriptions = false;
Expand Down Expand Up @@ -51,7 +53,13 @@ - (void)setReloadAndProfileConfig:(JS::NativeReactDevToolsRuntimeSettingsModule:

@end

#endif // REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY

Class RCTDevToolsRuntimeSettingsCls(void)
{
#ifdef REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY
return RCTDevToolsRuntimeSettingsModule.class;
#else
return nil;
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ target_include_directories(devtoolsruntimesettings PUBLIC .)

target_link_libraries(devtoolsruntimesettings jsi react_codegen_rncore react_cxxstableapi)
target_compile_reactnative_options(devtoolsruntimesettings PRIVATE)

if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
target_compile_options(devtoolsruntimesettings PRIVATE
-DREACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1
)
endif ()
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include "DevToolsRuntimeSettings.h"

#ifdef REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY

namespace facebook::react {

void DevToolsRuntimeSettings::setReloadAndProfileConfig(
Expand All @@ -25,3 +27,5 @@ DevToolsRuntimeSettings::getReloadAndProfileConfig() const {
};

} // namespace facebook::react

#endif // REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ target_link_libraries(react_nativemodule_devtoolsruntimesettings
)
target_compile_reactnative_options(react_nativemodule_devtoolsruntimesettings PRIVATE)
target_compile_options(react_nativemodule_devtoolsruntimesettings PRIVATE -Wpedantic)

if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
target_compile_options(react_nativemodule_devtoolsruntimesettings PRIVATE
-DREACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1
)
endif ()
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@

std::shared_ptr<facebook::react::TurboModule>
ReactDevToolsRuntimeSettingsModuleProvider(
std::shared_ptr<facebook::react::CallInvoker> jsInvoker) {
[[maybe_unused]] std::shared_ptr<facebook::react::CallInvoker> jsInvoker) {
#ifdef REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY
return std::make_shared<facebook::react::DevToolsRuntimeSettingsModule>(
std::move(jsInvoker));
#else
return nullptr;
#endif
}

#ifdef REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY

namespace facebook::react {

DevToolsRuntimeSettingsModule::DevToolsRuntimeSettingsModule(
Expand All @@ -35,3 +41,5 @@ DevToolsRuntimeSettingsModule::getReloadAndProfileConfig(jsi::Runtime& /*rt*/) {
};

} // namespace facebook::react

#endif // REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY
1 change: 1 addition & 0 deletions packages/react-native/scripts/cocoapods/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def self.set_gcc_preprocessor_definition_for_debugger(installer)
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-jsinspectornetwork", :debug)
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-RCTNetwork", :debug)
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-networking", :debug)
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-CoreModules", :debug)
end

# The react/cxxstableapi guards turn a direct include of a fine-grained React Native
Expand Down
Loading