Skip to content

Commit c00ab53

Browse files
coadofacebook-github-bot
authored andcommitted
Emit a real framework for React-cxxstableapi under use_frameworks! (#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
1 parent c29dedb commit c00ab53

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Pod::Spec.new do |s|
2525
s.author = "Meta Platforms, Inc. and its affiliates"
2626
s.platforms = min_supported_versions
2727
s.source = source
28-
s.source_files = podspec_sources("*.h", "*.h")
28+
s.source_files = podspec_sources("*.{cpp,h}", "*.h")
2929
s.header_dir = "react/cxxstableapi"
3030
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
3131
"DEFINES_MODULE" => "YES" }
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
// Anchor translation unit for the `react/cxxstableapi` pod.
9+
//
10+
// The guards in this module are pure preprocessor headers, so the pod would
11+
// otherwise ship no compilable source. CocoaPods emits a PBXAggregateTarget for
12+
// a pod with no compilable sources, and an aggregate target produces no
13+
// `.framework` under `use_frameworks!` — dependents are then unable to resolve
14+
// the guard headers. Giving the pod a single source file forces CocoaPods to
15+
// emit a real framework target instead.
16+
//
17+
// This file intentionally declares nothing: `react/cxxstableapi` has no runtime
18+
// API, only preprocessor guards. Do not add code here.

private/react-native-fantom/tester/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ add_react_common_subdir(jsitooling)
5858
add_react_common_subdir(logger)
5959
add_react_common_subdir(oscompat)
6060
add_react_common_subdir(react/bridging)
61+
add_react_common_subdir(react/cxxstableapi)
6162
add_react_common_subdir(react/debug)
6263
add_react_common_subdir(react/featureflags)
6364
add_react_common_subdir(react/nativemodule/core)

0 commit comments

Comments
 (0)