Skip to content

Commit dc2d4ec

Browse files
coadometa-codesync[bot]
authored andcommitted
Add stable public MapBuffer C++ entry point (#58013)
Summary: Pull Request resolved: #58013 Add `<React/MapBuffer.h>` as the public C++ entry point for MapBuffer and MapBufferBuilder. Guard direct leaf-header inclusion for strict API consumers while preserving existing React Native builds and legacy include paths. Export and stage the umbrella consistently through Buck, CMake, Android Prefab, CocoaPods, and the Apple prebuilt-header inventory. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D116632721 fbshipit-source-id: a44dd7ab1f1fd361ab1609a360667d727c2ccb17
1 parent 83dde23 commit dc2d4ec

7 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
@@ -252,6 +252,7 @@ val preparePrefab by
252252
"react/renderer/leakchecker/",
253253
),
254254
Pair("../ReactCommon/react/renderer/mapbuffer/", "react/renderer/mapbuffer/"),
255+
Pair("../ReactCommon/react/renderer/mapbuffer/React/", "React/"),
255256
Pair("../ReactCommon/react/renderer/mounting/", "react/renderer/mounting/"),
256257
Pair(
257258
"../ReactCommon/react/renderer/runtimescheduler/",

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,21 @@ Pod::Spec.new do |s|
2626
s.platforms = min_supported_versions
2727
s.source = source
2828
s.source_files = podspec_sources("react/renderer/mapbuffer/*.{cpp,h}", "react/renderer/mapbuffer/*.h")
29-
s.exclude_files = "react/renderer/mapbuffer/tests"
29+
s.exclude_files = ["react/renderer/mapbuffer/tests", "react/renderer/mapbuffer/React"]
3030
s.public_header_files = 'react/renderer/mapbuffer/*.h'
3131
s.header_dir = "react/renderer/mapbuffer"
3232
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => ["\"$(PODS_TARGET_SRCROOT)\""], "USE_HEADERMAP" => "YES",
3333
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard() }
3434

35+
s.subspec "MapBufferUmbrella" do |ss|
36+
ss.source_files = "react/renderer/mapbuffer/React/*.h"
37+
ss.header_dir = "React"
38+
ss.header_mappings_dir = "react/renderer/mapbuffer/React"
39+
end
40+
3541
resolve_use_frameworks(s, header_mappings_dir: './', module_name: "React_Mapbuffer")
3642

43+
s.dependency "React-cxxstableapi"
3744
add_dependency(s, "React-debug")
3845
add_rn_third_party_dependencies(s)
3946
add_rncore_dependency(s)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ file(GLOB react_renderer_mapbuffer_SRC CONFIGURE_DEPENDS *.cpp)
1111
add_library(react_renderer_mapbuffer OBJECT ${react_renderer_mapbuffer_SRC})
1212

1313
target_include_directories(react_renderer_mapbuffer PUBLIC ${REACT_COMMON_DIR})
14-
target_link_libraries(react_renderer_mapbuffer glog glog_init react_debug)
14+
target_link_libraries(react_renderer_mapbuffer glog glog_init react_cxxstableapi react_debug)
1515
target_compile_reactnative_options(react_renderer_mapbuffer PRIVATE)
1616
target_compile_options(react_renderer_mapbuffer PRIVATE -Wpedantic)

packages/react-native/ReactCommon/react/renderer/mapbuffer/MapBuffer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#pragma once
99

10+
#include <react/cxxstableapi/UmbrellaGuard.h>
1011
#include <react/debug/react_native_assert.h>
1112

1213
#include <glog/logging.h>

packages/react-native/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#pragma once
99

10+
#include <react/cxxstableapi/UmbrellaGuard.h>
1011
#include <react/debug/react_native_assert.h>
1112
#include <vector>
1213
#include "MapBuffer.h"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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/mapbuffer` module - public entry point.
12+
//
13+
// #include <React/MapBuffer.h>
14+
//
15+
// Re-exports the module's public interface headers. React Native's own code
16+
// should keep using the fine-grained `<react/renderer/mapbuffer/...>` includes;
17+
// only outside consumers use this umbrella.
18+
// =============================================================================
19+
20+
// Marks that the following headers are pulled in through the umbrella, so their
21+
// shared guard (<react/cxxstableapi/UmbrellaGuard.h>) accepts them.
22+
#define RN_UMBRELLA_CONTEXT
23+
24+
#include <react/renderer/mapbuffer/MapBuffer.h>
25+
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
26+
27+
#undef RN_UMBRELLA_CONTEXT

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,22 @@ const PodspecExceptions /*: {[key: string]: PodSpecConfiguration} */ = {
466466
},
467467
],
468468
},
469+
'ReactCommon/React-Mapbuffer.podspec': {
470+
name: 'React-Mapbuffer',
471+
headerPatterns: ['react/renderer/mapbuffer/**/*.h'],
472+
excludePatterns: [
473+
'react/renderer/mapbuffer/tests',
474+
'react/renderer/mapbuffer/React',
475+
],
476+
headerDir: 'react/renderer/mapbuffer',
477+
subSpecs: [
478+
{
479+
name: 'MapBufferUmbrella',
480+
headerPatterns: ['react/renderer/mapbuffer/React/*.h'],
481+
headerDir: 'React',
482+
},
483+
],
484+
},
469485
'ReactCommon/React-FabricImage.podspec': {
470486
name: 'React-FabricImage',
471487
headerPatterns: ['react/renderer/components/image/**/*.h'],

0 commit comments

Comments
 (0)