Emit a real framework for React-cxxstableapi under use_frameworks! (#57936)

Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57936

`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]

Reviewed By: cortinico

Differential Revision: D115859623

fbshipit-source-id: 47e63560e1478ad507d1f28f053b925438232ea4
This commit is contained in:
Dawid Małecki authored and meta-codesync[bot] committed 2026-08-13 08:20:05 -07:00
1 parent a9df3d5408
commit b7f0baf8f9
3 files changed
+20 -1

No files matched your search

@@ -25,7 +25,7 @@ Pod::Spec.new do |s|
s.author = "Meta Platforms, Inc. and its affiliates"
s.platforms = min_supported_versions
s.source = source
s.source_files = podspec_sources("*.h", "*.h")
s.source_files = podspec_sources("*.{cpp,h}", "*.h")
s.header_dir = "react/cxxstableapi"
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
"DEFINES_MODULE" => "YES" }
@@ -0,0 +1,18 @@
/*
* 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.
*/
// Anchor translation unit for the `react/cxxstableapi` pod.
//
// The guards in this module are pure preprocessor headers, so the pod would
// otherwise ship no compilable source. CocoaPods emits a PBXAggregateTarget for
// a pod with no compilable sources, and an aggregate target produces no
// `.framework` under `use_frameworks!` — dependents are then unable to resolve
// the guard headers. Giving the pod a single source file forces CocoaPods to
// emit a real framework target instead.
//
// This file intentionally declares nothing: `react/cxxstableapi` has no runtime
// API, only preprocessor guards. Do not add code here.
@@ -58,6 +58,7 @@ add_react_common_subdir(jsitooling)
add_react_common_subdir(logger)
add_react_common_subdir(oscompat)
add_react_common_subdir(react/bridging)
add_react_common_subdir(react/cxxstableapi)
add_react_common_subdir(react/debug)
add_react_common_subdir(react/featureflags)
add_react_common_subdir(react/nativemodule/core)