Emit a real framework for React-cxxstableapi under use_frameworks! (#57936) - #57936
Open
coado wants to merge 2 commits into
Open
Emit a real framework for React-cxxstableapi under use_frameworks! (#57936)#57936coado wants to merge 2 commits into
coado wants to merge 2 commits into
Conversation
|
@coado has exported this pull request. If you are a Meta employee, you can view the originating Diff in D115859623. |
…rgets (react#57861) Summary: React Native's public C++ headers are gaining guards from `react/cxxstableapi`, which turn a direct include of a fine-grained header into an error for consumers that opt into the strict API by defining `RN_STRICT_API`. React Native's own sources keep including those headers directly, so they are exempted via `RN_BUILDING`. Unlike CocoaPods, these three build systems each have a single chokepoint: - CMake: one `add_compile_definitions(RN_BUILDING)` in the ReactAndroid JNI project, a directory property inherited by every `add_react_common_subdir` below it. It is declared *after* the third-party NDK subdirectories so glog/boost/folly/fmt never see it, and this project never compiles app or third-party module code. - SwiftPM: one `.define` in the shared `Target.reactNativeTarget` factory that every React Native target is created through. `cxxSettings` are per-target and are not inherited by packages that depend on React. - Buck: a `_set_rn_building_flag` helper called from the four macros React Native's own targets use. It is `preprocessor_flags`, deliberately not `exported_preprocessor_flags`, so dependents are not exempted either. This change is inert on its own: nothing behaves differently unless a consumer defines `RN_STRICT_API`. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D115051088
…eact#57936) Summary: `react/cxxstableapi` is a header-only module — the stable API guards are pure preprocessor headers with no compilable source. Under `use_frameworks!`, CocoaPods emits a `PBXAggregateTarget` for a pod with no compilable sources, and an aggregate target produces no `.framework`, so pods depending on `React-cxxstableapi` cannot resolve the guard headers. Add an anchor translation unit so the pod has one source and CocoaPods emits a real framework target instead, and widen the podspec's build-from-source glob to pick it up. The prebuilt glob stays headers-only, since prebuilt pods do not generate frameworks. This mirrors the existing `CSSDummy.cpp` anchor for the header-only `React-renderercss` pod. Also register `react/cxxstableapi` as a subdirectory of the Fantom tester CMake build so the guard headers resolve there. Changelog: [Internal] Differential Revision: D115859623
coado
force-pushed
the
export-D115859623
branch
from
August 13, 2026 11:36
eba13b8 to
c00ab53
Compare
cortinico
approved these changes
Aug 13, 2026
cortinico
left a comment
Contributor
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
react/cxxstableapiis a header-only module — the stable API guards are purepreprocessor headers with no compilable source. Under
use_frameworks!,CocoaPods emits a
PBXAggregateTargetfor a pod with no compilable sources, andan aggregate target produces no
.framework, so pods depending onReact-cxxstableapicannot resolve the guard headers.Add an anchor translation unit so the pod has one source and CocoaPods emits a
real framework target instead, and widen the podspec's build-from-source glob to
pick it up. The prebuilt glob stays headers-only, since prebuilt pods do not
generate frameworks. This mirrors the existing
CSSDummy.cppanchor for theheader-only
React-renderercsspod.Also register
react/cxxstableapias a subdirectory of the Fantom tester CMakebuild so the guard headers resolve there.
Changelog: [Internal]
Differential Revision: D115859623