Skip to content

Commit 59f7781

Browse files
j-piaseckifacebook-github-bot
authored andcommitted
Cover runtimeexecutor with Stable API guards
Summary: Classifies `runtimeexecutor:runtimeexecutor` as a public target under the C++ stable API three-tier visibility model. Adds `#include <react/cxxstableapi/UmbrellaGuard.h>` to the module's 3 exported headers and introduces the module umbrella `React/RuntimeExecutor.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/RuntimeExecutor.h>` instead; without that flag the guards are inert, so no existing build changes behaviour. Changelog: [Internal] Differential Revision: D118792973
1 parent d9ad3f0 commit 59f7781

8 files changed

Lines changed: 71 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
@@ -186,6 +186,7 @@ val preparePrefab by
186186
),
187187
// runtimeexecutor
188188
Pair("../ReactCommon/runtimeexecutor/", ""),
189+
Pair("../ReactCommon/runtimeexecutor/platform/cxx/", ""),
189190
// react_renderer_textlayoutmanager
190191
Pair(
191192
"../ReactCommon/react/renderer/textlayoutmanager/",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ add_library(runtimeexecutor OBJECT ${runtimeexecutor_SRC})
1414

1515
target_include_directories(runtimeexecutor PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/platform/cxx)
1616

17-
target_link_libraries(runtimeexecutor jsi)
17+
target_link_libraries(runtimeexecutor jsi react_cxxstableapi)
1818
target_compile_reactnative_options(runtimeexecutor PRIVATE)
1919
target_compile_options(runtimeexecutor PRIVATE -Wpedantic)

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,14 @@ Pod::Spec.new do |s|
3131
s.platforms = min_supported_versions
3232
s.source = source
3333
s.source_files = podspec_sources(["ReactCommon/*.{m,mm,cpp,h}", "platform/ios/**/*.{m,mm,cpp,h}"], ["ReactCommon/*.h", "platform/ios/**/*.h"])
34+
s.exclude_files = ["React"]
3435
s.header_dir = "ReactCommon"
3536

3637
if ENV['USE_FRAMEWORKS']
37-
header_search_paths = header_search_paths + ["\"$(PODS_TARGET_SRCROOT)/platform/ios\""]
38+
header_search_paths = header_search_paths + [
39+
"\"$(PODS_TARGET_SRCROOT)/platform/ios\"",
40+
"\"$(PODS_TARGET_SRCROOT)/..\"", # ReactCommon, for <react/cxxstableapi/...>
41+
]
3842
end
3943

4044
resolve_use_frameworks(s, header_mappings_dir: ".")
@@ -48,10 +52,17 @@ Pod::Spec.new do |s|
4852
add_rncore_dependency(s)
4953

5054
s.dependency "React-jsi", version
55+
s.dependency "React-cxxstableapi"
5156
add_dependency(s, "React-featureflags")
5257
add_dependency(s, "React-debug")
5358
add_dependency(s, "React-utils", :additional_framework_paths => ["react/utils/platform/ios"])
5459

5560

61+
s.subspec "runtimeexecutorUmbrella" do |ss|
62+
ss.source_files = "React/*.h"
63+
ss.header_dir = ""
64+
ss.header_mappings_dir = "."
65+
end
66+
5667
mark_as_react_native_build(s)
5768
end
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 `runtimeexecutor` module - public entry point.
12+
//
13+
// #include <React/RuntimeExecutor.h>
14+
//
15+
// Re-exports the module's public interface headers. React Native's own code
16+
// should keep using the fine-grained `<ReactCommon/...>` includes; only outside
17+
// 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. The marker
22+
// is saved and restored rather than defined and undefined: the scope ends at
23+
// this block, so later *direct* includes in the same TU are still caught, and
24+
// it nests inside an enclosing umbrella rather than disarming it.
25+
#pragma push_macro("RN_UMBRELLA_CONTEXT")
26+
#undef RN_UMBRELLA_CONTEXT
27+
#define RN_UMBRELLA_CONTEXT 1
28+
29+
#include <ReactCommon/RuntimeExecutor.h>
30+
#include <ReactCommon/RuntimeExecutorSyncUIThreadUtils.h>
31+
32+
#undef RN_UMBRELLA_CONTEXT
33+
#pragma pop_macro("RN_UMBRELLA_CONTEXT")

packages/react-native/ReactCommon/runtimeexecutor/ReactCommon/RuntimeExecutor.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

1214
namespace facebook::react {

packages/react-native/ReactCommon/runtimeexecutor/platform/cxx/ReactCommon/RuntimeExecutorSyncUIThreadUtils.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 <ReactCommon/RuntimeExecutor.h>
1113

1214
#include <jsi/jsi.h>

packages/react-native/ReactCommon/runtimeexecutor/platform/ios/ReactCommon/RuntimeExecutorSyncUIThreadUtils.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 <ReactCommon/RuntimeExecutor.h>
1113

1214
#include <jsi/jsi.h>

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,24 @@ const PodspecExceptions /*: {[key: string]: PodSpecConfiguration} */ = {
585585
'Libraries/PushNotificationIOS/React-RCTPushNotification.podspec': {
586586
disabled: true,
587587
},
588+
'ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec': {
589+
name: 'React-runtimeexecutor',
590+
headerPatterns: [],
591+
headerDir: '',
592+
subSpecs: [
593+
{
594+
name: 'runtimeexecutor',
595+
headerPatterns: ['ReactCommon/*.h', 'platform/ios/**/*.h'],
596+
excludePatterns: ['React'],
597+
headerDir: 'ReactCommon',
598+
},
599+
{
600+
name: 'runtimeexecutorUmbrella',
601+
headerPatterns: ['React/*.h'],
602+
headerDir: 'React',
603+
},
604+
],
605+
},
588606
};
589607

590608
module.exports = {PodspecExceptions};

0 commit comments

Comments
 (0)