From 66f3a1db1216782012a4c928d75c0cd6f412fb79 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Wed, 9 Sep 2026 03:04:09 -0700 Subject: [PATCH 1/7] 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 ` 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 `` instead; without that flag the guards are inert, so no existing build changes behaviour. Changelog: [Internal] Differential Revision: D117858212 --- .../ReactAndroid/build.gradle.kts | 2 + .../ReactCommon/react/utils/Base64.h | 2 + .../ReactCommon/react/utils/CMakeLists.txt | 2 + .../react/utils/ContextContainer.h | 2 + .../ReactCommon/react/utils/FloatComparison.h | 2 + .../react/utils/ManagedObjectWrapper.h | 2 + .../ReactCommon/react/utils/MoveWrapper.h | 2 + .../ReactCommon/react/utils/OnScopeExit.h | 2 + .../ReactCommon/react/utils/PackTraits.h | 2 + .../react/utils/React-utils.podspec | 9 +++- .../ReactCommon/react/utils/React/Utils.h | 51 +++++++++++++++++++ .../ReactCommon/react/utils/RunLoopObserver.h | 2 + .../ReactCommon/react/utils/SharedFunction.h | 2 + .../react/utils/SimpleThreadSafeCache.h | 2 + .../ReactCommon/react/utils/Telemetry.h | 2 + .../react/utils/TemplateStringLiteral.h | 2 + .../ReactCommon/react/utils/Uuid.h | 2 + .../ReactCommon/react/utils/fnv1a.h | 2 + .../ReactCommon/react/utils/hash_combine.h | 2 + .../ReactCommon/react/utils/iequals.h | 2 + .../ReactCommon/react/utils/jsi-utils.h | 2 + .../android/react/utils/LowPriorityExecutor.h | 4 ++ .../cxx/react/utils/LowPriorityExecutor.h | 2 + .../ios/react/utils/LowPriorityExecutor.h | 2 + .../ReactCommon/react/utils/toLower.h | 2 + .../ReactCommon/react/utils/to_underlying.h | 2 + .../scripts/cocoapods/new_architecture.rb | 2 +- .../scripts/ios-prebuild/headers-config.js | 18 +++++++ 28 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 packages/react-native/ReactCommon/react/utils/React/Utils.h diff --git a/packages/react-native/ReactAndroid/build.gradle.kts b/packages/react-native/ReactAndroid/build.gradle.kts index 5a6fe3f7530e..e80e41416ef7 100644 --- a/packages/react-native/ReactAndroid/build.gradle.kts +++ b/packages/react-native/ReactAndroid/build.gradle.kts @@ -165,6 +165,8 @@ val preparePrefab by Pair("../ReactCommon/react/renderer/uimanager/", "react/renderer/uimanager/"), // react_utils Pair("../ReactCommon/react/utils/", "react/utils/"), + Pair("../ReactCommon/react/utils/platform/android/", ""), + Pair("../ReactCommon/react/utils/React/", "React/"), // rrc_image Pair( "../ReactCommon/react/renderer/components/image/", diff --git a/packages/react-native/ReactCommon/react/utils/Base64.h b/packages/react-native/ReactCommon/react/utils/Base64.h index ec879c2b62b3..ee44506a807e 100644 --- a/packages/react-native/ReactCommon/react/utils/Base64.h +++ b/packages/react-native/ReactCommon/react/utils/Base64.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include diff --git a/packages/react-native/ReactCommon/react/utils/CMakeLists.txt b/packages/react-native/ReactCommon/react/utils/CMakeLists.txt index 89111c32fbed..5dbfdf013b05 100644 --- a/packages/react-native/ReactCommon/react/utils/CMakeLists.txt +++ b/packages/react-native/ReactCommon/react/utils/CMakeLists.txt @@ -26,11 +26,13 @@ target_include_directories(react_utils ${REACT_COMMON_DIR} ${platform_DIR} ) +target_include_directories(react_utils INTERFACE ${REACT_COMMON_DIR}/react/utils) target_link_libraries(react_utils glog glog_init jsi + react_cxxstableapi react_debug) target_compile_reactnative_options(react_utils PRIVATE) target_compile_options(react_utils PRIVATE -Wpedantic) diff --git a/packages/react-native/ReactCommon/react/utils/ContextContainer.h b/packages/react-native/ReactCommon/react/utils/ContextContainer.h index 890cff25ca73..ffc243c4f819 100644 --- a/packages/react-native/ReactCommon/react/utils/ContextContainer.h +++ b/packages/react-native/ReactCommon/react/utils/ContextContainer.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/react/utils/FloatComparison.h b/packages/react-native/ReactCommon/react/utils/FloatComparison.h index f53ada84bc2f..9b15f8164521 100644 --- a/packages/react-native/ReactCommon/react/utils/FloatComparison.h +++ b/packages/react-native/ReactCommon/react/utils/FloatComparison.h @@ -7,6 +7,8 @@ #pragma once +#include + #include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/utils/ManagedObjectWrapper.h b/packages/react-native/ReactCommon/react/utils/ManagedObjectWrapper.h index 6d4f7e7d1c6b..7a12bf3a6aac 100644 --- a/packages/react-native/ReactCommon/react/utils/ManagedObjectWrapper.h +++ b/packages/react-native/ReactCommon/react/utils/ManagedObjectWrapper.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #if defined(__APPLE__) diff --git a/packages/react-native/ReactCommon/react/utils/MoveWrapper.h b/packages/react-native/ReactCommon/react/utils/MoveWrapper.h index 22a9a0f238f4..4488c160986a 100644 --- a/packages/react-native/ReactCommon/react/utils/MoveWrapper.h +++ b/packages/react-native/ReactCommon/react/utils/MoveWrapper.h @@ -7,6 +7,8 @@ #pragma once +#include + #include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/utils/OnScopeExit.h b/packages/react-native/ReactCommon/react/utils/OnScopeExit.h index 633471daf826..ce680fe3904d 100644 --- a/packages/react-native/ReactCommon/react/utils/OnScopeExit.h +++ b/packages/react-native/ReactCommon/react/utils/OnScopeExit.h @@ -7,6 +7,8 @@ #pragma once +#include + #include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/utils/PackTraits.h b/packages/react-native/ReactCommon/react/utils/PackTraits.h index 675cdc06ed9f..099756681b4b 100644 --- a/packages/react-native/ReactCommon/react/utils/PackTraits.h +++ b/packages/react-native/ReactCommon/react/utils/PackTraits.h @@ -7,6 +7,8 @@ #pragma once +#include + #include namespace facebook::react::traits { diff --git a/packages/react-native/ReactCommon/react/utils/React-utils.podspec b/packages/react-native/ReactCommon/react/utils/React-utils.podspec index 430fe08f0f37..18e66533db2c 100644 --- a/packages/react-native/ReactCommon/react/utils/React-utils.podspec +++ b/packages/react-native/ReactCommon/react/utils/React-utils.podspec @@ -32,7 +32,7 @@ Pod::Spec.new do |s| s.source = source s.source_files = podspec_sources(source_files, ["*.h", "platform/ios/**/*.h"]) s.header_dir = "react/utils" - s.exclude_files = "tests" + s.exclude_files = ["tests", "React"] if ENV['USE_FRAMEWORKS'] header_search_paths = header_search_paths + ["\"$(PODS_TARGET_SRCROOT)/platform/ios\""] @@ -46,6 +46,7 @@ Pod::Spec.new do |s| "DEFINES_MODULE" => "YES" } s.dependency "React-jsi", version + s.dependency "React-cxxstableapi" if use_hermes() s.dependency "hermes-engine" @@ -55,5 +56,11 @@ Pod::Spec.new do |s| add_dependency(s, "React-debug") + s.subspec "utilsUmbrella" do |ss| + ss.source_files = "React/*.h" + ss.header_dir = "" + ss.header_mappings_dir = "." + end + mark_as_react_native_build(s) end diff --git a/packages/react-native/ReactCommon/react/utils/React/Utils.h b/packages/react-native/ReactCommon/react/utils/React/Utils.h new file mode 100644 index 000000000000..40f4515aafa7 --- /dev/null +++ b/packages/react-native/ReactCommon/react/utils/React/Utils.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +// ============================================================================= +// Umbrella header for the `react/utils` module - public entry point. +// +// #include +// +// Re-exports the module's public interface headers. React Native's own code +// should keep using the fine-grained `` includes; only outside +// consumers use this umbrella. +// ============================================================================= + +// Marks that the following headers are pulled in through the umbrella, so their +// shared guard () accepts them. The marker +// is saved and restored rather than defined and undefined: the scope ends at +// this block, so later *direct* includes in the same TU are still caught, and +// it nests inside an enclosing umbrella rather than disarming it. +#pragma push_macro("RN_UMBRELLA_CONTEXT") +#undef RN_UMBRELLA_CONTEXT +#define RN_UMBRELLA_CONTEXT 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#undef RN_UMBRELLA_CONTEXT +#pragma pop_macro("RN_UMBRELLA_CONTEXT") diff --git a/packages/react-native/ReactCommon/react/utils/RunLoopObserver.h b/packages/react-native/ReactCommon/react/utils/RunLoopObserver.h index d226bcb5ccb1..cb7a78e0cb6e 100644 --- a/packages/react-native/ReactCommon/react/utils/RunLoopObserver.h +++ b/packages/react-native/ReactCommon/react/utils/RunLoopObserver.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/react/utils/SharedFunction.h b/packages/react-native/ReactCommon/react/utils/SharedFunction.h index 04ea9e7f05ab..9f24022dcd2a 100644 --- a/packages/react-native/ReactCommon/react/utils/SharedFunction.h +++ b/packages/react-native/ReactCommon/react/utils/SharedFunction.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/react/utils/SimpleThreadSafeCache.h b/packages/react-native/ReactCommon/react/utils/SimpleThreadSafeCache.h index e5c8994b1b87..87e7cd701529 100644 --- a/packages/react-native/ReactCommon/react/utils/SimpleThreadSafeCache.h +++ b/packages/react-native/ReactCommon/react/utils/SimpleThreadSafeCache.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/react/utils/Telemetry.h b/packages/react-native/ReactCommon/react/utils/Telemetry.h index d7ebf2b0e82c..4168fed247e4 100644 --- a/packages/react-native/ReactCommon/react/utils/Telemetry.h +++ b/packages/react-native/ReactCommon/react/utils/Telemetry.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include diff --git a/packages/react-native/ReactCommon/react/utils/TemplateStringLiteral.h b/packages/react-native/ReactCommon/react/utils/TemplateStringLiteral.h index 94508ae7ed41..4dc7162ee2d6 100644 --- a/packages/react-native/ReactCommon/react/utils/TemplateStringLiteral.h +++ b/packages/react-native/ReactCommon/react/utils/TemplateStringLiteral.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/react/utils/Uuid.h b/packages/react-native/ReactCommon/react/utils/Uuid.h index 2ae20de419b4..07a427162cea 100644 --- a/packages/react-native/ReactCommon/react/utils/Uuid.h +++ b/packages/react-native/ReactCommon/react/utils/Uuid.h @@ -7,6 +7,8 @@ #pragma once +#include + #include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/utils/fnv1a.h b/packages/react-native/ReactCommon/react/utils/fnv1a.h index 6b5a5efbfd12..8abcb1d78848 100644 --- a/packages/react-native/ReactCommon/react/utils/fnv1a.h +++ b/packages/react-native/ReactCommon/react/utils/fnv1a.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/react/utils/hash_combine.h b/packages/react-native/ReactCommon/react/utils/hash_combine.h index 779d084d80c1..2c2912c2c8a9 100644 --- a/packages/react-native/ReactCommon/react/utils/hash_combine.h +++ b/packages/react-native/ReactCommon/react/utils/hash_combine.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/react/utils/iequals.h b/packages/react-native/ReactCommon/react/utils/iequals.h index ff1ea60733e7..54e0fcb1f091 100644 --- a/packages/react-native/ReactCommon/react/utils/iequals.h +++ b/packages/react-native/ReactCommon/react/utils/iequals.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include diff --git a/packages/react-native/ReactCommon/react/utils/jsi-utils.h b/packages/react-native/ReactCommon/react/utils/jsi-utils.h index d907339b42b0..22478df77613 100644 --- a/packages/react-native/ReactCommon/react/utils/jsi-utils.h +++ b/packages/react-native/ReactCommon/react/utils/jsi-utils.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include diff --git a/packages/react-native/ReactCommon/react/utils/platform/android/react/utils/LowPriorityExecutor.h b/packages/react-native/ReactCommon/react/utils/platform/android/react/utils/LowPriorityExecutor.h index 160efadb16a7..4a61e63267ac 100644 --- a/packages/react-native/ReactCommon/react/utils/platform/android/react/utils/LowPriorityExecutor.h +++ b/packages/react-native/ReactCommon/react/utils/platform/android/react/utils/LowPriorityExecutor.h @@ -7,6 +7,10 @@ #pragma once +#include + +#include + namespace facebook::react::LowPriorityExecutor { void execute(std::function &&workItem); diff --git a/packages/react-native/ReactCommon/react/utils/platform/cxx/react/utils/LowPriorityExecutor.h b/packages/react-native/ReactCommon/react/utils/platform/cxx/react/utils/LowPriorityExecutor.h index d70ae6edca2e..5766b8350c73 100644 --- a/packages/react-native/ReactCommon/react/utils/platform/cxx/react/utils/LowPriorityExecutor.h +++ b/packages/react-native/ReactCommon/react/utils/platform/cxx/react/utils/LowPriorityExecutor.h @@ -7,6 +7,8 @@ #pragma once +#include + #include namespace facebook::react::LowPriorityExecutor { diff --git a/packages/react-native/ReactCommon/react/utils/platform/ios/react/utils/LowPriorityExecutor.h b/packages/react-native/ReactCommon/react/utils/platform/ios/react/utils/LowPriorityExecutor.h index 3517cac75101..4a61e63267ac 100644 --- a/packages/react-native/ReactCommon/react/utils/platform/ios/react/utils/LowPriorityExecutor.h +++ b/packages/react-native/ReactCommon/react/utils/platform/ios/react/utils/LowPriorityExecutor.h @@ -7,6 +7,8 @@ #pragma once +#include + #include namespace facebook::react::LowPriorityExecutor { diff --git a/packages/react-native/ReactCommon/react/utils/toLower.h b/packages/react-native/ReactCommon/react/utils/toLower.h index 766d8d8791ea..0a1a033d2ed2 100644 --- a/packages/react-native/ReactCommon/react/utils/toLower.h +++ b/packages/react-native/ReactCommon/react/utils/toLower.h @@ -7,6 +7,8 @@ #pragma once +#include + namespace facebook::react { /** diff --git a/packages/react-native/ReactCommon/react/utils/to_underlying.h b/packages/react-native/ReactCommon/react/utils/to_underlying.h index 2b68a2377c9f..d86eac25ae85 100644 --- a/packages/react-native/ReactCommon/react/utils/to_underlying.h +++ b/packages/react-native/ReactCommon/react/utils/to_underlying.h @@ -7,6 +7,8 @@ #pragma once +#include + #include namespace facebook::react { diff --git a/packages/react-native/scripts/cocoapods/new_architecture.rb b/packages/react-native/scripts/cocoapods/new_architecture.rb index 98f9c743cf94..e9a79945fb5d 100644 --- a/packages/react-native/scripts/cocoapods/new_architecture.rb +++ b/packages/react-native/scripts/cocoapods/new_architecture.rb @@ -93,7 +93,7 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version = He .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-runtimeexecutor", "React_runtimeexecutor", ["platform/ios"])) .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-NativeModulesApple", "React_NativeModulesApple", [])) .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-RCTFabric", "RCTFabric", [])) - .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-utils", "React_utils", [])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-utils", "React_utils", ["react/utils/platform/ios"])) .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-featureflags", "React_featureflags", [])) .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-debug", "React_debug", [])) .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-ImageManager", "React_ImageManager", [])) diff --git a/packages/react-native/scripts/ios-prebuild/headers-config.js b/packages/react-native/scripts/ios-prebuild/headers-config.js index 2de57378cc11..a0fbd60d0b86 100644 --- a/packages/react-native/scripts/ios-prebuild/headers-config.js +++ b/packages/react-native/scripts/ios-prebuild/headers-config.js @@ -602,6 +602,24 @@ const PodspecExceptions /*: {[key: string]: PodSpecConfiguration} */ = { }, ], }, + 'ReactCommon/react/utils/React-utils.podspec': { + name: 'React-utils', + headerPatterns: [], + headerDir: '', + subSpecs: [ + { + name: 'utils', + headerPatterns: ['*.h', 'platform/ios/**/*.h'], + excludePatterns: ['tests', 'React'], + headerDir: 'react/utils', + }, + { + name: 'utilsUmbrella', + headerPatterns: ['React/*.h'], + headerDir: 'React', + }, + ], + }, }; module.exports = {PodspecExceptions}; From b6e67a599dce48c92e3233ef6d67aeabb404d54f Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Wed, 9 Sep 2026 03:04:09 -0700 Subject: [PATCH 2/7] Cover `cxxreact:jsbigstring` with Stable API guards Summary: Classifies `cxxreact:jsbigstring` as a public target under the C++ stable API three-tier visibility model. Adds `#include ` to the target's 2 exported C++ headers and introduces the module umbrella `React/JSBigString.h`, wiring the guard dependency into BUCK, CMake and CocoaPods and the umbrella into BUCK, CMake, 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 target's headers directly, and should include `` instead; without that flag the guards are inert, so no existing build changes behaviour. Under `USE_FRAMEWORKS` the pod now maps its headers relative to `ReactCommon`, so they install under `cxxreact/` inside the built framework rather than at its root. Pods that pick up the framework's `Headers` directory through `install_modules_dependencies` are unaffected. `React-RCTFabric`, `ReactCommon` and `React-NativeModulesApple` pin their own search paths instead and are updated here; pods outside the repository that do the same have to make the equivalent change. Changelog: [iOS][Breaking] - Install `React-cxxreact` headers under `cxxreact/` inside its framework when `USE_FRAMEWORKS` is enabled. Pods that include `` without calling `install_modules_dependencies` must add `React_cxxreact.framework/Headers` to `HEADER_SEARCH_PATHS`. Differential Revision: D119144023 --- .../React/React-RCTFabric.podspec | 1 + .../ReactAndroid/build.gradle.kts | 1 + .../ReactCommon/ReactCommon.podspec | 2 +- .../ReactCommon/cxxreact/CMakeLists.txt | 2 ++ .../ReactCommon/cxxreact/JSBigString.h | 2 ++ .../ReactCommon/cxxreact/JSBundleType.h | 2 ++ .../cxxreact/React-cxxreact.podspec | 9 +++++ .../ReactCommon/cxxreact/React/JSBigString.h | 33 +++++++++++++++++++ .../ios/React-NativeModulesApple.podspec | 2 +- .../scripts/cocoapods/new_architecture.rb | 1 + .../scripts/ios-prebuild/headers-config.js | 17 ++++++++++ 11 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 packages/react-native/ReactCommon/cxxreact/React/JSBigString.h diff --git a/packages/react-native/React/React-RCTFabric.podspec b/packages/react-native/React/React-RCTFabric.podspec index 9fc412b31e05..121669d1fa0e 100644 --- a/packages/react-native/React/React-RCTFabric.podspec +++ b/packages/react-native/React/React-RCTFabric.podspec @@ -66,6 +66,7 @@ Pod::Spec.new do |s| s.dependency "RCTSwiftUIWrapper" add_dependency(s, "React-FabricImage") + add_dependency(s, "React-cxxreact") add_dependency(s, "React-Fabric", :additional_framework_paths => [ "react/renderer/components/scrollview/platform/cxx", "react/renderer/components/scrollview/platform/ios", diff --git a/packages/react-native/ReactAndroid/build.gradle.kts b/packages/react-native/ReactAndroid/build.gradle.kts index e80e41416ef7..f792d51a8567 100644 --- a/packages/react-native/ReactAndroid/build.gradle.kts +++ b/packages/react-native/ReactAndroid/build.gradle.kts @@ -113,6 +113,7 @@ val preparePrefab by // reactnativejni Pair("src/main/jni/react/jni", "react/jni/"), Pair("../ReactCommon/cxxreact/", "cxxreact/"), + Pair("../ReactCommon/cxxreact/React/", "React/"), // react_featureflags Pair("../ReactCommon/react/featureflags/", "react/featureflags/"), Pair("../ReactCommon/react/featureflags/React/", "React/"), diff --git a/packages/react-native/ReactCommon/ReactCommon.podspec b/packages/react-native/ReactCommon/ReactCommon.podspec index 4e3896458af2..11ef835aaf9e 100644 --- a/packages/react-native/ReactCommon/ReactCommon.podspec +++ b/packages/react-native/ReactCommon/ReactCommon.podspec @@ -51,7 +51,7 @@ Pod::Spec.new do |s| ss.subspec "core" do |sss| sss.source_files = podspec_sources("react/nativemodule/core/ReactCommon/**/*.{cpp,h}", "react/nativemodule/core/ReactCommon/**/*.h") - sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_debug.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_featureflags.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-utils/React_utils.framework/Headers\"" } + sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_debug.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_featureflags.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-utils/React_utils.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-cxxreact/React_cxxreact.framework/Headers\"" } sss.dependency "React-bridging" sss.dependency "React-cxxreact", version sss.dependency "React-debug", version diff --git a/packages/react-native/ReactCommon/cxxreact/CMakeLists.txt b/packages/react-native/ReactCommon/cxxreact/CMakeLists.txt index 2a5e973e95b1..8dc5a4d11016 100644 --- a/packages/react-native/ReactCommon/cxxreact/CMakeLists.txt +++ b/packages/react-native/ReactCommon/cxxreact/CMakeLists.txt @@ -12,6 +12,7 @@ file(GLOB react_cxxreact_SRC CONFIGURE_DEPENDS *.cpp) add_library(react_cxxreact OBJECT ${react_cxxreact_SRC}) target_include_directories(react_cxxreact PUBLIC ${REACT_COMMON_DIR}) +target_include_directories(react_cxxreact INTERFACE ${REACT_COMMON_DIR}/cxxreact) target_link_libraries(react_cxxreact boost @@ -22,6 +23,7 @@ target_link_libraries(react_cxxreact jsi jsinspector logger + react_cxxstableapi reactperflogger runtimeexecutor react_debug) diff --git a/packages/react-native/ReactCommon/cxxreact/JSBigString.h b/packages/react-native/ReactCommon/cxxreact/JSBigString.h index a2365dee8962..c1316edb388c 100644 --- a/packages/react-native/ReactCommon/cxxreact/JSBigString.h +++ b/packages/react-native/ReactCommon/cxxreact/JSBigString.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include diff --git a/packages/react-native/ReactCommon/cxxreact/JSBundleType.h b/packages/react-native/ReactCommon/cxxreact/JSBundleType.h index 08cb4d4974fe..e31f20a5f9c0 100644 --- a/packages/react-native/ReactCommon/cxxreact/JSBundleType.h +++ b/packages/react-native/ReactCommon/cxxreact/JSBundleType.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/cxxreact/React-cxxreact.podspec b/packages/react-native/ReactCommon/cxxreact/React-cxxreact.podspec index 13b99d6fe617..bf2042bff773 100644 --- a/packages/react-native/ReactCommon/cxxreact/React-cxxreact.podspec +++ b/packages/react-native/ReactCommon/cxxreact/React-cxxreact.podspec @@ -34,6 +34,8 @@ Pod::Spec.new do |s| } s.header_dir = "cxxreact" + resolve_use_frameworks(s, header_mappings_dir: "..", module_name: "React_cxxreact") + add_dependency(s, "React-jsinspector", :framework_name => 'jsinspector_modern') add_dependency(s, "React-jsinspectorcdp", :framework_name => 'jsinspector_moderncdp') add_dependency(s, "React-jsinspectortracing", :framework_name => 'jsinspector_moderntracing') @@ -45,6 +47,7 @@ Pod::Spec.new do |s| s.dependency "React-logger", version s.dependency "React-debug", version s.dependency "React-timing", version + s.dependency "React-cxxstableapi" add_dependency(s, "React-utils", :additional_framework_paths => ["react/utils/platform/ios"]) s.resource_bundles = {'React-cxxreact_privacy' => 'PrivacyInfo.xcprivacy'} @@ -56,5 +59,11 @@ Pod::Spec.new do |s| add_rn_third_party_dependencies(s) add_rncore_dependency(s) + s.subspec "cxxreactUmbrella" do |ss| + ss.source_files = "React/*.h" + ss.header_dir = "" + ss.header_mappings_dir = "." + end + mark_as_react_native_build(s) end diff --git a/packages/react-native/ReactCommon/cxxreact/React/JSBigString.h b/packages/react-native/ReactCommon/cxxreact/React/JSBigString.h new file mode 100644 index 000000000000..d1dbafbbcd06 --- /dev/null +++ b/packages/react-native/ReactCommon/cxxreact/React/JSBigString.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +// ============================================================================= +// Umbrella header for the `cxxreact` module - public entry point. +// +// #include +// +// Re-exports the module's public interface headers. React Native's own code +// should keep using the fine-grained `` includes; only outside +// consumers use this umbrella. +// ============================================================================= + +// Marks that the following headers are pulled in through the umbrella, so their +// shared guard () accepts them. The marker +// is saved and restored rather than defined and undefined: the scope ends at +// this block, so later *direct* includes in the same TU are still caught, and +// it nests inside an enclosing umbrella rather than disarming it. +#pragma push_macro("RN_UMBRELLA_CONTEXT") +#undef RN_UMBRELLA_CONTEXT +#define RN_UMBRELLA_CONTEXT 1 + +#include +#include + +#undef RN_UMBRELLA_CONTEXT +#pragma pop_macro("RN_UMBRELLA_CONTEXT") diff --git a/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec b/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec index 3a9bde9b2591..4e637f576029 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec +++ b/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec @@ -40,7 +40,7 @@ Pod::Spec.new do |s| s.dependency "React-bridging" s.dependency "React-callinvoker" s.dependency "React-Core" - s.dependency "React-cxxreact" + add_dependency(s, "React-cxxreact") s.dependency "React-jsi" s.dependency "React-featureflags" add_dependency(s, "React-debug") diff --git a/packages/react-native/scripts/cocoapods/new_architecture.rb b/packages/react-native/scripts/cocoapods/new_architecture.rb index e9a79945fb5d..6ce3f92fc15b 100644 --- a/packages/react-native/scripts/cocoapods/new_architecture.rb +++ b/packages/react-native/scripts/cocoapods/new_architecture.rb @@ -100,6 +100,7 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version = He .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-rendererdebug", "React_rendererdebug", [])) .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-renderercss", "React_renderercss", [])) .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-cxxstableapi", "React_cxxstableapi", [])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-cxxreact", "React_cxxreact", [])) .each { |search_path| header_search_paths << "\"#{search_path}\"" } diff --git a/packages/react-native/scripts/ios-prebuild/headers-config.js b/packages/react-native/scripts/ios-prebuild/headers-config.js index a0fbd60d0b86..ea01832d3122 100644 --- a/packages/react-native/scripts/ios-prebuild/headers-config.js +++ b/packages/react-native/scripts/ios-prebuild/headers-config.js @@ -620,6 +620,23 @@ const PodspecExceptions /*: {[key: string]: PodSpecConfiguration} */ = { }, ], }, + 'ReactCommon/cxxreact/React-cxxreact.podspec': { + name: 'React-cxxreact', + headerPatterns: [], + headerDir: '', + subSpecs: [ + { + name: 'cxxreact', + headerPatterns: ['*.h'], + headerDir: 'cxxreact', + }, + { + name: 'cxxreactUmbrella', + headerPatterns: ['React/*.h'], + headerDir: 'React', + }, + ], + }, }; module.exports = {PodspecExceptions}; From 5d58848bc9e8497e85e7272338fb952be529579f Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Wed, 9 Sep 2026 03:04:09 -0700 Subject: [PATCH 3/7] Cover cxxreact:messagequeuethread with Stable API guards Summary: Classifies `cxxreact:messagequeuethread` as a "for frameworks" target under the three-tier C++ stable API visibility model. Consumers that opt into `RN_STRICT_API` now get a warning if they include its headers directly, which they can acknowledge with `RN_ALLOW_FRAMEWORKS`; without that flag the guards are inert, so no existing build changes behaviour. Changelog: [Internal] Differential Revision: D119163883 --- packages/react-native/ReactCommon/cxxreact/MessageQueueThread.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/react-native/ReactCommon/cxxreact/MessageQueueThread.h b/packages/react-native/ReactCommon/cxxreact/MessageQueueThread.h index 724f7f7516de..0ab2fc159416 100644 --- a/packages/react-native/ReactCommon/cxxreact/MessageQueueThread.h +++ b/packages/react-native/ReactCommon/cxxreact/MessageQueueThread.h @@ -7,6 +7,8 @@ #pragma once +#include + #include namespace facebook::react { From e959fc74b7955919aa4ac998692f532082ee518e Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Wed, 9 Sep 2026 03:04:09 -0700 Subject: [PATCH 4/7] Cover cxxreact:tracesection with Stable API guards Summary: Classifies `cxxreact:tracesection` as a "for frameworks" target under the three-tier C++ stable API visibility model. Consumers that opt into `RN_STRICT_API` now get a warning if they include its headers directly, which they can acknowledge with `RN_ALLOW_FRAMEWORKS`; without that flag the guards are inert, so no existing build changes behaviour. Changelog: [Internal] Differential Revision: D119163904 --- packages/react-native/ReactCommon/cxxreact/ReactMarker.h | 2 ++ packages/react-native/ReactCommon/cxxreact/SystraceSection.h | 2 ++ packages/react-native/ReactCommon/cxxreact/TraceSection.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/packages/react-native/ReactCommon/cxxreact/ReactMarker.h b/packages/react-native/ReactCommon/cxxreact/ReactMarker.h index 94af5f9ddf42..f3d8a631e866 100644 --- a/packages/react-native/ReactCommon/cxxreact/ReactMarker.h +++ b/packages/react-native/ReactCommon/cxxreact/ReactMarker.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/cxxreact/SystraceSection.h b/packages/react-native/ReactCommon/cxxreact/SystraceSection.h index b32518823b67..7a6fe63cd223 100644 --- a/packages/react-native/ReactCommon/cxxreact/SystraceSection.h +++ b/packages/react-native/ReactCommon/cxxreact/SystraceSection.h @@ -7,6 +7,8 @@ #pragma once +#include + #include "TraceSection.h" // NOTE: This is here for a backwards compatibility and should be removed once diff --git a/packages/react-native/ReactCommon/cxxreact/TraceSection.h b/packages/react-native/ReactCommon/cxxreact/TraceSection.h index c18442d1b943..c0d7fba280b6 100644 --- a/packages/react-native/ReactCommon/cxxreact/TraceSection.h +++ b/packages/react-native/ReactCommon/cxxreact/TraceSection.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifdef WITH_FBSYSTRACE #include #endif From 579e9ddade14eed812bd07af2939cc729428aed2 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Wed, 9 Sep 2026 03:04:09 -0700 Subject: [PATCH 5/7] Cover cxxreact:module with Stable API guards Summary: Classifies `cxxreact:module` as a private target under the three-tier C++ stable API visibility model. Consumers that opt into `RN_STRICT_API` now get an error if they include its headers directly; without that flag the guards are inert, so no existing build changes behaviour. Changelog: [Internal] Differential Revision: D119163922 --- packages/react-native/ReactCommon/cxxreact/CxxModule.h | 2 ++ .../react-native/ReactCommon/cxxreact/JsArgumentHelpers-inl.h | 2 ++ packages/react-native/ReactCommon/cxxreact/JsArgumentHelpers.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/packages/react-native/ReactCommon/cxxreact/CxxModule.h b/packages/react-native/ReactCommon/cxxreact/CxxModule.h index 6582fd40dd84..07dd2bdf5641 100644 --- a/packages/react-native/ReactCommon/cxxreact/CxxModule.h +++ b/packages/react-native/ReactCommon/cxxreact/CxxModule.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/cxxreact/JsArgumentHelpers-inl.h b/packages/react-native/ReactCommon/cxxreact/JsArgumentHelpers-inl.h index 6795c3335d85..4c2480f322d0 100644 --- a/packages/react-native/ReactCommon/cxxreact/JsArgumentHelpers-inl.h +++ b/packages/react-native/ReactCommon/cxxreact/JsArgumentHelpers-inl.h @@ -7,6 +7,8 @@ #pragma once +#include + #include namespace facebook { diff --git a/packages/react-native/ReactCommon/cxxreact/JsArgumentHelpers.h b/packages/react-native/ReactCommon/cxxreact/JsArgumentHelpers.h index 9f6c1963de42..ff3ebb8b3884 100644 --- a/packages/react-native/ReactCommon/cxxreact/JsArgumentHelpers.h +++ b/packages/react-native/ReactCommon/cxxreact/JsArgumentHelpers.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include From 1f204457fd142ac10cd8cf202f77e62ea0b3287f Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Wed, 9 Sep 2026 03:04:09 -0700 Subject: [PATCH 6/7] Cover cxxreact:bridge with Stable API guards Summary: Classifies `cxxreact:bridge` as a private target under the three-tier C++ stable API visibility model. Consumers that opt into `RN_STRICT_API` now get an error if they include its headers directly; without that flag the guards are inert, so no existing build changes behaviour. `ReactNativeVersion.h` is a generated file, so its guard also goes into `scripts/releases/templates/ReactNativeVersion.h-template.js`; without that the next version stamp would rewrite the header and silently drop the guard from every release and nightly artifact. Changelog: [Internal] Differential Revision: D119163927 --- packages/react-native/ReactCommon/cxxreact/CxxNativeModule.h | 2 ++ packages/react-native/ReactCommon/cxxreact/Instance.h | 2 ++ packages/react-native/ReactCommon/cxxreact/JSExecutor.h | 2 ++ .../react-native/ReactCommon/cxxreact/JSModulesUnbundle.h | 2 ++ packages/react-native/ReactCommon/cxxreact/MethodCall.h | 2 ++ packages/react-native/ReactCommon/cxxreact/ModuleRegistry.h | 2 ++ packages/react-native/ReactCommon/cxxreact/NativeModule.h | 2 ++ packages/react-native/ReactCommon/cxxreact/NativeToJsBridge.h | 2 ++ .../react-native/ReactCommon/cxxreact/RAMBundleRegistry.h | 2 ++ .../react-native/ReactCommon/cxxreact/ReactNativeVersion.h | 2 ++ packages/react-native/ReactCommon/cxxreact/RecoverableError.h | 2 ++ .../__snapshots__/set-rn-artifacts-version-test.js.snap | 4 ++++ scripts/releases/templates/ReactNativeVersion.h-template.js | 2 ++ 13 files changed, 28 insertions(+) diff --git a/packages/react-native/ReactCommon/cxxreact/CxxNativeModule.h b/packages/react-native/ReactCommon/cxxreact/CxxNativeModule.h index 7b42f6d9f892..22d2f7493023 100644 --- a/packages/react-native/ReactCommon/cxxreact/CxxNativeModule.h +++ b/packages/react-native/ReactCommon/cxxreact/CxxNativeModule.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifndef RCT_REMOVE_LEGACY_ARCH #include diff --git a/packages/react-native/ReactCommon/cxxreact/Instance.h b/packages/react-native/ReactCommon/cxxreact/Instance.h index a8026d0aaec7..7748abbcd32f 100644 --- a/packages/react-native/ReactCommon/cxxreact/Instance.h +++ b/packages/react-native/ReactCommon/cxxreact/Instance.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifndef RCT_REMOVE_LEGACY_ARCH #include diff --git a/packages/react-native/ReactCommon/cxxreact/JSExecutor.h b/packages/react-native/ReactCommon/cxxreact/JSExecutor.h index e69594168347..b27600b84fb0 100644 --- a/packages/react-native/ReactCommon/cxxreact/JSExecutor.h +++ b/packages/react-native/ReactCommon/cxxreact/JSExecutor.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include diff --git a/packages/react-native/ReactCommon/cxxreact/JSModulesUnbundle.h b/packages/react-native/ReactCommon/cxxreact/JSModulesUnbundle.h index 7abea636d56c..a839ca69328d 100644 --- a/packages/react-native/ReactCommon/cxxreact/JSModulesUnbundle.h +++ b/packages/react-native/ReactCommon/cxxreact/JSModulesUnbundle.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifndef RCT_REMOVE_LEGACY_ARCH #include diff --git a/packages/react-native/ReactCommon/cxxreact/MethodCall.h b/packages/react-native/ReactCommon/cxxreact/MethodCall.h index bf2aa8eb5561..8804b40821d7 100644 --- a/packages/react-native/ReactCommon/cxxreact/MethodCall.h +++ b/packages/react-native/ReactCommon/cxxreact/MethodCall.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifndef RCT_REMOVE_LEGACY_ARCH #include diff --git a/packages/react-native/ReactCommon/cxxreact/ModuleRegistry.h b/packages/react-native/ReactCommon/cxxreact/ModuleRegistry.h index 831a69e62bb2..4bb2fabe7d98 100644 --- a/packages/react-native/ReactCommon/cxxreact/ModuleRegistry.h +++ b/packages/react-native/ReactCommon/cxxreact/ModuleRegistry.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifndef RCT_REMOVE_LEGACY_ARCH #include diff --git a/packages/react-native/ReactCommon/cxxreact/NativeModule.h b/packages/react-native/ReactCommon/cxxreact/NativeModule.h index d8f49eabd0c3..dc9fa55beb45 100644 --- a/packages/react-native/ReactCommon/cxxreact/NativeModule.h +++ b/packages/react-native/ReactCommon/cxxreact/NativeModule.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include diff --git a/packages/react-native/ReactCommon/cxxreact/NativeToJsBridge.h b/packages/react-native/ReactCommon/cxxreact/NativeToJsBridge.h index ac0d3a0c05bf..28d0623e0288 100644 --- a/packages/react-native/ReactCommon/cxxreact/NativeToJsBridge.h +++ b/packages/react-native/ReactCommon/cxxreact/NativeToJsBridge.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifndef RCT_REMOVE_LEGACY_ARCH #include diff --git a/packages/react-native/ReactCommon/cxxreact/RAMBundleRegistry.h b/packages/react-native/ReactCommon/cxxreact/RAMBundleRegistry.h index 16ce66943ed8..45c8e502b310 100644 --- a/packages/react-native/ReactCommon/cxxreact/RAMBundleRegistry.h +++ b/packages/react-native/ReactCommon/cxxreact/RAMBundleRegistry.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifndef RCT_REMOVE_LEGACY_ARCH #include diff --git a/packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h b/packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h index 25468f63f050..c428a7827fc3 100644 --- a/packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h +++ b/packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h @@ -9,6 +9,8 @@ #pragma once +#include + #include #include diff --git a/packages/react-native/ReactCommon/cxxreact/RecoverableError.h b/packages/react-native/ReactCommon/cxxreact/RecoverableError.h index 980f6ce76f00..f8c74ec57334 100644 --- a/packages/react-native/ReactCommon/cxxreact/RecoverableError.h +++ b/packages/react-native/ReactCommon/cxxreact/RecoverableError.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/scripts/releases/__tests__/__snapshots__/set-rn-artifacts-version-test.js.snap b/scripts/releases/__tests__/__snapshots__/set-rn-artifacts-version-test.js.snap index bd30713aa4a7..d190036c2ef3 100644 --- a/scripts/releases/__tests__/__snapshots__/set-rn-artifacts-version-test.js.snap +++ b/scripts/releases/__tests__/__snapshots__/set-rn-artifacts-version-test.js.snap @@ -129,6 +129,8 @@ exports[`updateReactNativeArtifacts should set nightly version: packages/react-n #pragma once +#include + #include #include @@ -286,6 +288,8 @@ exports[`updateReactNativeArtifacts should set release version: packages/react-n #pragma once +#include + #include #include diff --git a/scripts/releases/templates/ReactNativeVersion.h-template.js b/scripts/releases/templates/ReactNativeVersion.h-template.js index f100ddd15f99..51febd41af14 100644 --- a/scripts/releases/templates/ReactNativeVersion.h-template.js +++ b/scripts/releases/templates/ReactNativeVersion.h-template.js @@ -23,6 +23,8 @@ module.exports = ({version} /*: {version: Version} */) /*: string */ => `/** #pragma once +#include + #include #include From dc1089ac6bd7c29fa6f157cde11610eb86ebe16f Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Wed, 9 Sep 2026 06:55:22 -0700 Subject: [PATCH 7/7] Add ReactNativeVersion.h to react/utils (#58403) Summary: Pull Request resolved: https://github.com/react/react-native/pull/58403 Changelog: [General][Added] - Added `ReactNativeVersion.h` to public `react/utils` module. Existing one inside private `cxxreact/bridge` module is now deprecated and still accessible when not opted in to `RN_STRICT_API`. Reviewed By: javache Differential Revision: D119163947 --- .../ReactCommon/cxxreact/CMakeLists.txt | 1 + .../ReactCommon/cxxreact/ReactNativeVersion.h | 27 +++++----------- .../ReactCommon/react/utils/React/Utils.h | 1 + .../react/utils/ReactNativeVersion.h | 32 +++++++++++++++++++ .../set-rn-artifacts-version-test.js.snap | 8 ++--- .../__snapshots__/set-version-test.js.snap | 6 ++-- scripts/releases/set-rn-artifacts-version.js | 2 +- .../ReactNativeVersion.h-template.js | 2 +- 8 files changed, 51 insertions(+), 28 deletions(-) create mode 100644 packages/react-native/ReactCommon/react/utils/ReactNativeVersion.h diff --git a/packages/react-native/ReactCommon/cxxreact/CMakeLists.txt b/packages/react-native/ReactCommon/cxxreact/CMakeLists.txt index 8dc5a4d11016..1cff672278e7 100644 --- a/packages/react-native/ReactCommon/cxxreact/CMakeLists.txt +++ b/packages/react-native/ReactCommon/cxxreact/CMakeLists.txt @@ -24,6 +24,7 @@ target_link_libraries(react_cxxreact jsinspector logger react_cxxstableapi + react_utils reactperflogger runtimeexecutor react_debug) diff --git a/packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h b/packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h index c428a7827fc3..cac510eae6d4 100644 --- a/packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h +++ b/packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h @@ -1,32 +1,21 @@ -/** +/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * - * @generated by scripts/releases/set-version.js */ #pragma once #include -#include -#include - -#define REACT_NATIVE_VERSION_MAJOR 1000 -#define REACT_NATIVE_VERSION_MINOR 0 -#define REACT_NATIVE_VERSION_PATCH 0 - -namespace facebook::react { +#warning "Deprecated: use instead." -struct ReactNativeVersionType { - int32_t Major = 1000; - int32_t Minor = 0; - int32_t Patch = 0; - std::string_view Prerelease = ""; -}; +#pragma push_macro("RN_UMBRELLA_CONTEXT") +#undef RN_UMBRELLA_CONTEXT +#define RN_UMBRELLA_CONTEXT 1 -constexpr ReactNativeVersionType ReactNativeVersion; +#include -} // namespace facebook::react +#undef RN_UMBRELLA_CONTEXT +#pragma pop_macro("RN_UMBRELLA_CONTEXT") diff --git a/packages/react-native/ReactCommon/react/utils/React/Utils.h b/packages/react-native/ReactCommon/react/utils/React/Utils.h index 40f4515aafa7..83eed1d75d36 100644 --- a/packages/react-native/ReactCommon/react/utils/React/Utils.h +++ b/packages/react-native/ReactCommon/react/utils/React/Utils.h @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/packages/react-native/ReactCommon/react/utils/ReactNativeVersion.h b/packages/react-native/ReactCommon/react/utils/ReactNativeVersion.h new file mode 100644 index 000000000000..80883fbcc5eb --- /dev/null +++ b/packages/react-native/ReactCommon/react/utils/ReactNativeVersion.h @@ -0,0 +1,32 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @generated by scripts/releases/set-version.js + */ + +#pragma once + +#include + +#include +#include + +#define REACT_NATIVE_VERSION_MAJOR 1000 +#define REACT_NATIVE_VERSION_MINOR 0 +#define REACT_NATIVE_VERSION_PATCH 0 + +namespace facebook::react { + +struct ReactNativeVersionType { + int32_t Major = 1000; + int32_t Minor = 0; + int32_t Patch = 0; + std::string_view Prerelease = ""; +}; + +constexpr ReactNativeVersionType ReactNativeVersion; + +} // namespace facebook::react diff --git a/scripts/releases/__tests__/__snapshots__/set-rn-artifacts-version-test.js.snap b/scripts/releases/__tests__/__snapshots__/set-rn-artifacts-version-test.js.snap index d190036c2ef3..266a162a62da 100644 --- a/scripts/releases/__tests__/__snapshots__/set-rn-artifacts-version-test.js.snap +++ b/scripts/releases/__tests__/__snapshots__/set-rn-artifacts-version-test.js.snap @@ -117,7 +117,7 @@ public object ReactNativeVersion { " `; -exports[`updateReactNativeArtifacts should set nightly version: packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h 1`] = ` +exports[`updateReactNativeArtifacts should set nightly version: packages/react-native/ReactCommon/react/utils/ReactNativeVersion.h 1`] = ` "/** * Copyright (c) Meta Platforms, Inc. and affiliates. * @@ -129,7 +129,7 @@ exports[`updateReactNativeArtifacts should set nightly version: packages/react-n #pragma once -#include +#include #include #include @@ -276,7 +276,7 @@ public object ReactNativeVersion { " `; -exports[`updateReactNativeArtifacts should set release version: packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h 1`] = ` +exports[`updateReactNativeArtifacts should set release version: packages/react-native/ReactCommon/react/utils/ReactNativeVersion.h 1`] = ` "/** * Copyright (c) Meta Platforms, Inc. and affiliates. * @@ -288,7 +288,7 @@ exports[`updateReactNativeArtifacts should set release version: packages/react-n #pragma once -#include +#include #include #include diff --git a/scripts/releases/__tests__/__snapshots__/set-version-test.js.snap b/scripts/releases/__tests__/__snapshots__/set-version-test.js.snap index ee516002ff8c..085fccf2bc71 100644 --- a/scripts/releases/__tests__/__snapshots__/set-version-test.js.snap +++ b/scripts/releases/__tests__/__snapshots__/set-version-test.js.snap @@ -65,7 +65,7 @@ exports[`setVersion updates monorepo for nightly: set-version/packages/react-nat exports[`setVersion updates monorepo for nightly: set-version/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt 1`] = `"[omitted]"`; -exports[`setVersion updates monorepo for nightly: set-version/packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h 1`] = `"[omitted]"`; +exports[`setVersion updates monorepo for nightly: set-version/packages/react-native/ReactCommon/react/utils/ReactNativeVersion.h 1`] = `"[omitted]"`; exports[`setVersion updates monorepo for nightly: set-version/packages/react-native/package.json 1`] = ` "{ @@ -148,7 +148,7 @@ exports[`setVersion updates monorepo for release-candidate: set-version/packages exports[`setVersion updates monorepo for release-candidate: set-version/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt 1`] = `"[omitted]"`; -exports[`setVersion updates monorepo for release-candidate: set-version/packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h 1`] = `"[omitted]"`; +exports[`setVersion updates monorepo for release-candidate: set-version/packages/react-native/ReactCommon/react/utils/ReactNativeVersion.h 1`] = `"[omitted]"`; exports[`setVersion updates monorepo for release-candidate: set-version/packages/react-native/package.json 1`] = ` "{ @@ -231,7 +231,7 @@ exports[`setVersion updates monorepo for stable version: set-version/packages/re exports[`setVersion updates monorepo for stable version: set-version/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt 1`] = `"[omitted]"`; -exports[`setVersion updates monorepo for stable version: set-version/packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h 1`] = `"[omitted]"`; +exports[`setVersion updates monorepo for stable version: set-version/packages/react-native/ReactCommon/react/utils/ReactNativeVersion.h 1`] = `"[omitted]"`; exports[`setVersion updates monorepo for stable version: set-version/packages/react-native/package.json 1`] = ` "{ diff --git a/scripts/releases/set-rn-artifacts-version.js b/scripts/releases/set-rn-artifacts-version.js index a2bdbf1e9983..a0f0b85cab1d 100755 --- a/scripts/releases/set-rn-artifacts-version.js +++ b/scripts/releases/set-rn-artifacts-version.js @@ -104,7 +104,7 @@ function updateSourceFiles( fs.writeFile( path.join( REPO_ROOT, - 'packages/react-native/ReactCommon/cxxreact/ReactNativeVersion.h', + 'packages/react-native/ReactCommon/react/utils/ReactNativeVersion.h', ), require('./templates/ReactNativeVersion.h-template')(templateData), ), diff --git a/scripts/releases/templates/ReactNativeVersion.h-template.js b/scripts/releases/templates/ReactNativeVersion.h-template.js index 51febd41af14..f4ac85bfb363 100644 --- a/scripts/releases/templates/ReactNativeVersion.h-template.js +++ b/scripts/releases/templates/ReactNativeVersion.h-template.js @@ -23,7 +23,7 @@ module.exports = ({version} /*: {version: Version} */) /*: string */ => `/** #pragma once -#include +#include #include #include