Skip to content

Commit 5b680c5

Browse files
j-piaseckimeta-codesync[bot]
authored andcommitted
Cover react/renderer/bridging with Stable API guards (#58086)
Summary: Pull Request resolved: #58086 Classifies `react/renderer/bridging:bridging` as a public target under the C++ stable API three-tier visibility model and introduces the module umbrella `React/RendererBridging.h` as its public entry point. The umbrella is named `RendererBridging` rather than `Bridging` because all umbrellas share a single `React/` include namespace, and `React/Bridging.h` belongs to the separate `react/bridging` module. The guards are inert unless a consumer defines `RN_STRICT_API`, so there is no behavior change. Changelog: [General][Added] - Add `<React/RendererBridging.h>` umbrella header as the public entry point for `react/renderer/bridging` Reviewed By: cortinico Differential Revision: D117179017 fbshipit-source-id: bd64c8c1093c8e50370c354d2c021d80f0046cc1
1 parent a106fdf commit 5b680c5

6 files changed

Lines changed: 55 additions & 2 deletions

File tree

packages/react-native/ReactAndroid/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ val preparePrefab by
127127
),
128128
// react_renderer_bridging
129129
Pair("../ReactCommon/react/renderer/bridging/", "react/renderer/bridging/"),
130+
Pair("../ReactCommon/react/renderer/bridging/React/", "React/"),
130131
// react_renderer_componentregistry
131132
Pair(
132133
"../ReactCommon/react/renderer/componentregistry/",

packages/react-native/ReactCommon/React-Fabric.podspec

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,16 @@ Pod::Spec.new do |s|
8484

8585
s.subspec "bridging" do |ss|
8686
ss.source_files = podspec_sources("react/renderer/bridging/**/*.{m,mm,cpp,h}", "react/renderer/bridging/**/*.{h}")
87-
ss.exclude_files = "react/renderer/bridging/tests"
87+
ss.exclude_files = ["react/renderer/bridging/tests", "react/renderer/bridging/React"]
8888
ss.header_dir = "react/renderer/bridging"
8989
end
9090

91+
s.subspec "bridgingUmbrella" do |ss|
92+
ss.source_files = "react/renderer/bridging/React/*.h"
93+
ss.header_dir = "React"
94+
ss.header_mappings_dir = "react/renderer/bridging/React"
95+
end
96+
9197
s.subspec "core" do |ss|
9298
header_search_path = [
9399
"\"$(PODS_TARGET_SRCROOT)/ReactCommon\"",

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)
1111
add_library(react_renderer_bridging INTERFACE)
1212

1313
target_include_directories(react_renderer_bridging INTERFACE ${REACT_COMMON_DIR})
14+
15+
target_link_libraries(react_renderer_bridging INTERFACE react_cxxstableapi)
1416
target_compile_reactnative_options(react_renderer_bridging INTERFACE)
1517
target_compile_options(react_renderer_bridging INTERFACE -Wpedantic)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 `react/renderer/bridging` module - public entry
12+
// point.
13+
//
14+
// #include <React/RendererBridging.h>
15+
//
16+
// Re-exports the module's public interface headers. React Native's own code
17+
// should keep using the fine-grained `<react/renderer/bridging/...>` includes;
18+
// only outside consumers use this umbrella.
19+
//
20+
// Named `RendererBridging` rather than `Bridging` because all umbrellas share a
21+
// single `React/` include namespace, and `React/Bridging.h` belongs to the
22+
// separate `react/bridging` module.
23+
// =============================================================================
24+
25+
// Marks that the following headers are pulled in through the umbrella, so their
26+
// shared guard (<react/cxxstableapi/UmbrellaGuard.h>) accepts them. Scoped to
27+
// this block so later *direct* includes in the same translation unit are still
28+
// caught.
29+
#define RN_UMBRELLA_CONTEXT
30+
31+
#include <react/renderer/bridging/bridging.h>
32+
33+
#undef RN_UMBRELLA_CONTEXT

packages/react-native/ReactCommon/react/renderer/bridging/bridging.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#pragma once
99

10+
#include <react/cxxstableapi/UmbrellaGuard.h>
11+
1012
#include <jsi/jsi.h>
1113
#include <react/bridging/Base.h>
1214
#include <react/renderer/core/ShadowNode.h>

packages/react-native/scripts/ios-prebuild/headers-config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,19 @@ const PodspecExceptions /*: {[key: string]: PodSpecConfiguration} */ = {
7070
{
7171
name: 'bridging',
7272
headerPatterns: ['react/renderer/bridging/**/*.h'],
73-
excludePatterns: ['react/renderer/bridging/tests'],
73+
excludePatterns: [
74+
'react/renderer/bridging/tests',
75+
'react/renderer/bridging/React',
76+
],
7477
headerDir: 'react/renderer/bridging',
7578
},
7679

80+
{
81+
name: 'bridgingUmbrella',
82+
headerPatterns: ['react/renderer/bridging/React/*.h'],
83+
headerDir: 'React',
84+
},
85+
7786
{
7887
name: 'core',
7988
headerPatterns: ['react/renderer/core/**/*.h'],

0 commit comments

Comments
 (0)