Skip to content

Commit 2271917

Browse files
j-piaseckifacebook-github-bot
authored andcommitted
POC checkpoint 2
Differential Revision: D107878702
1 parent 95f0742 commit 2271917

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,20 @@ target_link_libraries(react_renderer_runtimescheduler
2727
jsinspector_tracing)
2828
target_compile_reactnative_options(react_renderer_runtimescheduler PRIVATE)
2929
target_compile_options(react_renderer_runtimescheduler PRIVATE -Wpedantic)
30+
31+
# POC (public C++ API surface reduction): this module exposes a single public
32+
# umbrella header, react/renderer/runtimescheduler/RuntimeScheduler.umbrella.h.
33+
# Including any other module header directly is gated by an opt-in guard
34+
# (RuntimeSchedulerUmbrellaGuard.h) that is inert unless
35+
# REACT_RUNTIMESCHEDULER_ENFORCE_UMBRELLA is defined.
36+
#
37+
# Unlike Buck, CMake exposes the whole include directory, so the individual
38+
# headers (and the private RuntimeScheduler_Modern.h / RuntimeScheduler_Legacy.h)
39+
# remain physically includable here. The only way to enforce "umbrella only" in
40+
# the OSS build is the guard macro. To enable it, uncomment the block below.
41+
# NOTE: this breaks any consumer that still includes the individual headers
42+
# directly, so only enable it after migrating consumers to the umbrella.
43+
#
44+
# target_compile_definitions(react_renderer_runtimescheduler
45+
# PRIVATE REACT_RUNTIMESCHEDULER_BUILDING # this library's own .cpp may include the headers directly
46+
# PUBLIC REACT_RUNTIMESCHEDULER_ENFORCE_UMBRELLA) # consumers must go through the umbrella

packages/react-native/ReactCommon/react/renderer/runtimescheduler/React-runtimescheduler.podspec

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,21 @@ Pod::Spec.new do |s|
3434
s.source_files = podspec_sources("**/*.{cpp,h}", "**/*.h")
3535
s.header_dir = "react/renderer/runtimescheduler"
3636
s.exclude_files = "tests"
37+
# POC (public C++ API surface reduction): RuntimeScheduler exposes a single
38+
# public umbrella header (RuntimeScheduler.umbrella.h). Including any other
39+
# module header directly is gated by an opt-in guard that is inert unless
40+
# REACT_RUNTIMESCHEDULER_ENFORCE_UMBRELLA is defined. CocoaPods exposes the
41+
# whole header_dir, so the individual headers remain includable here; the guard
42+
# macro is the only way to enforce "umbrella only" in the pods build.
43+
#
44+
# To enable enforcement: add REACT_RUNTIMESCHEDULER_BUILDING=1 to this pod's own
45+
# compilation via the GCC_PREPROCESSOR_DEFINITIONS line below, and propagate
46+
# REACT_RUNTIMESCHEDULER_ENFORCE_UMBRELLA to consumers. NOTE: enforcing on
47+
# consumers needs `user_target_xcconfig`, which CocoaPods discourages (xcconfig
48+
# collisions), and it breaks consumers that still include the headers directly.
3749
s.pod_target_xcconfig = {
3850
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
51+
# "GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) REACT_RUNTIMESCHEDULER_BUILDING=1",
3952
"HEADER_SEARCH_PATHS" => header_search_paths.join(' ')}
4053

4154
resolve_use_frameworks(s, header_mappings_dir: "../../..", module_name: "React_runtimescheduler")

0 commit comments

Comments
 (0)