Skip to content

Commit 1056a41

Browse files
j-piaseckimeta-codesync[bot]
authored andcommitted
Use umbrellas instead of direct includes in react/runtime module (#58550)
Summary: Pull Request resolved: #58550 Changelog: [Internal] Part of the C++ stable API migration to umbrella includes. Fixes tier reachability violations in the `react/runtime` module. The headers in this module are "for frameworks" tier (they include `<react/cxxstableapi/FrameworksGuard.h>`), but they reached public-tier modules through fine-grained includes: `<ReactCommon/CallInvoker.h>`, `<ReactCommon/SchedulerPriority.h>`, `<ReactCommon/RuntimeExecutor.h>` and `<cxxreact/JSBigString.h>`. Each of these is protected by `<react/cxxstableapi/UmbrellaGuard.h>`. Exported headers are preprocessed in the consumer's translation unit, so a consumer building with `RN_STRICT_API` would hit the guard through these transitive includes. `RN_ALLOW_FRAMEWORKS` does not suppress the guard. This change switches the five affected headers (`BridgelessNativeMethodCallInvoker.h`, `BufferedRuntimeExecutor.h`, `CallInvokerImpl.h`, `ReactInstance.h`, `TimerManager.h`) to the `<React/CallInvoker.h>`, `<React/RuntimeExecutor.h>` and `<React/JSBigString.h>` umbrellas. Each umbrella scopes `RN_UMBRELLA_CONTEXT` around its includes, so the guard accepts them. `<ReactCommon/SchedulerPriority.h>` has no include of its own anymore because `<React/CallInvoker.h>` re-exports it. The umbrellas are supersets of the headers they replace, so every previously visible declaration stays available and there is no functional change. Out of scope: `ReactInstance.cpp` and the module's C++ tests keep the fine-grained includes. They are compiled only within React Native's own build and are never preprocessed by consumers, which matches the umbrellas' documented guidance. Other modules are migrated in separate changes. Reviewed By: cortinico Differential Revision: D120316197
1 parent 0b6b63f commit 1056a41

6 files changed

Lines changed: 9 additions & 10 deletions

File tree

‎packages/react-native/ReactCommon/react/runtime/BridgelessNativeMethodCallInvoker.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include <react/cxxstableapi/FrameworksGuard.h>
1111

12-
#include <ReactCommon/CallInvoker.h>
12+
#include <React/CallInvoker.h>
1313
#include <cxxreact/MessageQueueThread.h>
1414
#include <memory>
1515

‎packages/react-native/ReactCommon/react/runtime/BufferedRuntimeExecutor.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
#include <react/cxxstableapi/FrameworksGuard.h>
1111

12-
#include <ReactCommon/RuntimeExecutor.h>
13-
#include <ReactCommon/SchedulerPriority.h>
12+
#include <React/CallInvoker.h>
13+
#include <React/RuntimeExecutor.h>
1414
#include <jsi/jsi.h>
1515
#include <atomic>
1616
#include <memory>

‎packages/react-native/ReactCommon/react/runtime/CallInvokerImpl.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
#include <react/cxxstableapi/FrameworksGuard.h>
1111

12-
#include <ReactCommon/CallInvoker.h>
13-
#include <ReactCommon/SchedulerPriority.h>
12+
#include <React/CallInvoker.h>
1413
#include <react/renderer/runtimescheduler/RuntimeScheduler.h>
1514
#include <react/runtime/BufferedRuntimeExecutor.h>
1615

‎packages/react-native/ReactCommon/react/runtime/React-RuntimeCore.podspec‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Pod::Spec.new do |s|
3636
resolve_use_frameworks(s, header_mappings_dir: "../..", module_name: "React_RuntimeCore")
3737

3838
s.dependency "React-jsiexecutor"
39-
s.dependency "React-cxxreact"
39+
add_dependency(s, "React-cxxreact")
4040
add_dependency(s, "React-runtimeexecutor", :additional_framework_paths => ["platform/ios"])
4141
s.dependency "React-jsi"
4242
s.dependency "React-jserrorhandler"

‎packages/react-native/ReactCommon/react/runtime/ReactInstance.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
#include <react/cxxstableapi/FrameworksGuard.h>
1111

12-
#include <ReactCommon/CallInvoker.h>
13-
#include <ReactCommon/RuntimeExecutor.h>
14-
#include <cxxreact/JSBigString.h>
12+
#include <React/CallInvoker.h>
13+
#include <React/JSBigString.h>
14+
#include <React/RuntimeExecutor.h>
1515
#include <cxxreact/MessageQueueThread.h>
1616
#include <jserrorhandler/JsErrorHandler.h>
1717
#include <jsi/jsi.h>

‎packages/react-native/ReactCommon/react/runtime/TimerManager.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include <react/cxxstableapi/FrameworksGuard.h>
1111

12-
#include <ReactCommon/RuntimeExecutor.h>
12+
#include <React/RuntimeExecutor.h>
1313
#include <unordered_map>
1414
#include <vector>
1515

0 commit comments

Comments
 (0)