Skip to content

Commit bd53006

Browse files
Jakub Piaseckimeta-codesync[bot]
authored andcommitted
Cover react/utils with Stable API guards
Summary: Classifies `react/utils:utils` as a public target under the C++ stable API three-tier visibility model. Adds `#include <react/cxxstableapi/UmbrellaGuard.h>` to the module's 22 exported headers and introduces the module umbrella `React/Utils.h`, wiring the guard dependency into BUCK, CMake and CocoaPods and the umbrella into BUCK, CocoaPods, the iOS prebuild header config and the Android prefab export. Consumers that opt into `RN_STRICT_API` now get an error if they include the module's headers directly, and should include `<React/Utils.h>` instead; without that flag the guards are inert, so no existing build changes behaviour. Changelog: [Internal] Differential Revision: D117858212
1 parent ff3ea5e commit bd53006

28 files changed

Lines changed: 126 additions & 2 deletions

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ val preparePrefab by
165165
Pair("../ReactCommon/react/renderer/uimanager/", "react/renderer/uimanager/"),
166166
// react_utils
167167
Pair("../ReactCommon/react/utils/", "react/utils/"),
168+
Pair("../ReactCommon/react/utils/platform/android/", ""),
169+
Pair("../ReactCommon/react/utils/React/", "React/"),
168170
// rrc_image
169171
Pair(
170172
"../ReactCommon/react/renderer/components/image/",

packages/react-native/ReactCommon/react/utils/Base64.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 <string>
1113
#include <string_view>
1214

packages/react-native/ReactCommon/react/utils/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ target_include_directories(react_utils
2626
${REACT_COMMON_DIR}
2727
${platform_DIR}
2828
)
29+
target_include_directories(react_utils INTERFACE ${REACT_COMMON_DIR}/react/utils)
2930

3031
target_link_libraries(react_utils
3132
glog
3233
glog_init
3334
jsi
35+
react_cxxstableapi
3436
react_debug)
3537
target_compile_reactnative_options(react_utils PRIVATE)
3638
target_compile_options(react_utils PRIVATE -Wpedantic)

packages/react-native/ReactCommon/react/utils/ContextContainer.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 <memory>
1113
#include <mutex>
1214
#include <optional>

packages/react-native/ReactCommon/react/utils/FloatComparison.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 <cmath>
1113

1214
namespace facebook::react {

packages/react-native/ReactCommon/react/utils/ManagedObjectWrapper.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 <react/debug/react_native_assert.h>
1113

1214
#if defined(__APPLE__)

packages/react-native/ReactCommon/react/utils/MoveWrapper.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 <memory>
1113

1214
namespace facebook::react {

packages/react-native/ReactCommon/react/utils/OnScopeExit.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 <utility>
1113

1214
namespace facebook::react {

packages/react-native/ReactCommon/react/utils/PackTraits.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 <type_traits>
1113

1214
namespace facebook::react::traits {

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Pod::Spec.new do |s|
3232
s.source = source
3333
s.source_files = podspec_sources(source_files, ["*.h", "platform/ios/**/*.h"])
3434
s.header_dir = "react/utils"
35-
s.exclude_files = "tests"
35+
s.exclude_files = ["tests", "React"]
3636

3737
if ENV['USE_FRAMEWORKS']
3838
header_search_paths = header_search_paths + ["\"$(PODS_TARGET_SRCROOT)/platform/ios\""]
@@ -46,6 +46,7 @@ Pod::Spec.new do |s|
4646
"DEFINES_MODULE" => "YES" }
4747

4848
s.dependency "React-jsi", version
49+
s.dependency "React-cxxstableapi"
4950

5051
if use_hermes()
5152
s.dependency "hermes-engine"
@@ -55,5 +56,11 @@ Pod::Spec.new do |s|
5556

5657
add_dependency(s, "React-debug")
5758

59+
s.subspec "utilsUmbrella" do |ss|
60+
ss.source_files = "React/*.h"
61+
ss.header_dir = ""
62+
ss.header_mappings_dir = "."
63+
end
64+
5865
mark_as_react_native_build(s)
5966
end

0 commit comments

Comments
 (0)