Skip to content

Commit bec7cc5

Browse files
j-piaseckifacebook-github-bot
authored andcommitted
Add a RawValue umbrella to the renderer core module
Summary: Changelog: [Internal] Add a `React/RawValue.h` umbrella for the `rawValue` target, the slice of `react/renderer/core` that exists so core and `react/renderer/graphics` do not form a dependency cycle. `React/RendererCore.h` re-exports it instead of listing the two headers directly. Differential Revision: D121388426
1 parent 576c60b commit bec7cc5

2 files changed

Lines changed: 51 additions & 5 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
#pragma once
9+
10+
// =============================================================================
11+
// Umbrella header for the `rawValue` module - public entry point.
12+
//
13+
// #include <React/RawValue.h>
14+
//
15+
// `rawValue` is the slice of `react/renderer/core` that `react/renderer/graphics`
16+
// depends on. It is built as its own target so the two modules do not form a
17+
// dependency cycle; <React/RendererCore.h> re-exports it, so consumers that want
18+
// the whole renderer core still only need that one umbrella.
19+
//
20+
// Re-exports the module's public interface headers. React Native's own code
21+
// should keep using the fine-grained `<react/renderer/core/...>` includes,
22+
// except in headers it exports to consumers: those are preprocessed in the
23+
// consumer's translation unit, where the fine-grained include hits this
24+
// module's <react/cxxstableapi/UmbrellaGuard.h>. `RN_ALLOW_FRAMEWORKS` does not
25+
// suppress that guard, so a "for frameworks" header must reach this module
26+
// through the umbrella.
27+
// =============================================================================
28+
29+
// Marks that the following headers are pulled in through the umbrella, so their
30+
// shared guard (<react/cxxstableapi/UmbrellaGuard.h>) accepts them. The marker
31+
// is saved and restored rather than defined and undefined: the scope ends at
32+
// this block, so a later *direct* include of a guarded header the umbrella did
33+
// not already pull in is still caught, and it nests inside an enclosing
34+
// umbrella rather than disarming it. The headers below are `#pragma once`, so
35+
// re-including one of them directly is a silent no-op, not a guard hit.
36+
#pragma push_macro("RN_UMBRELLA_CONTEXT")
37+
#undef RN_UMBRELLA_CONTEXT
38+
#define RN_UMBRELLA_CONTEXT 1
39+
40+
#include <react/renderer/core/RawPropsPrimitives.h>
41+
#include <react/renderer/core/RawValue.h>
42+
43+
#undef RN_UMBRELLA_CONTEXT
44+
#pragma pop_macro("RN_UMBRELLA_CONTEXT")

‎packages/react-native/ReactCommon/react/renderer/core/React/RendererCore.h‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
//
1313
// #include <React/RendererCore.h>
1414
//
15-
// Re-exports the module's public interface headers. React Native's own code
15+
// Re-exports the module's public interface headers, including those of the
16+
// `rawValue` target via <React/RawValue.h>. React Native's own code
1617
// should keep using the fine-grained `<react/renderer/core/...>` includes,
1718
// except in headers it exports to consumers: those are preprocessed in the
1819
// consumer's translation unit, where the fine-grained include hits this
@@ -24,12 +25,15 @@
2425
// Marks that the following headers are pulled in through the umbrella, so their
2526
// shared guard (<react/cxxstableapi/UmbrellaGuard.h>) accepts them. The marker
2627
// is saved and restored rather than defined and undefined: the scope ends at
27-
// this block, so later *direct* includes in the same TU are still caught, and
28-
// it nests inside an enclosing umbrella rather than disarming it.
28+
// this block, so a later *direct* include of a guarded header the umbrella did
29+
// not already pull in is still caught, and it nests inside an enclosing
30+
// umbrella rather than disarming it. The headers below are `#pragma once`, so
31+
// re-including one of them directly is a silent no-op, not a guard hit.
2932
#pragma push_macro("RN_UMBRELLA_CONTEXT")
3033
#undef RN_UMBRELLA_CONTEXT
3134
#define RN_UMBRELLA_CONTEXT 1
3235

36+
#include <React/RawValue.h>
3337
#include <react/renderer/core/ComponentDescriptor.h>
3438
#include <react/renderer/core/ConcreteComponentDescriptor.h>
3539
#include <react/renderer/core/ConcreteShadowNode.h>
@@ -61,8 +65,6 @@
6165
#include <react/renderer/core/RawProps.h>
6266
#include <react/renderer/core/RawPropsKeyMap.h>
6367
#include <react/renderer/core/RawPropsParser.h>
64-
#include <react/renderer/core/RawPropsPrimitives.h>
65-
#include <react/renderer/core/RawValue.h>
6668
#include <react/renderer/core/ReactEventPriority.h>
6769
#include <react/renderer/core/ReactPrimitives.h>
6870
#include <react/renderer/core/ReactRootViewTagGenerator.h>

0 commit comments

Comments
 (0)