From b7f0baf8f926e8bf9b41b35f882372b7815c8bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ma=C5=82ecki?= Date: Thu, 13 Aug 2026 08:20:05 -0700 Subject: [PATCH] Emit a real framework for React-cxxstableapi under use_frameworks! (#57936) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../cxxstableapi/React-cxxstableapi.podspec | 2 +- .../react/cxxstableapi/StableApiAnchor.cpp | 18 ++++++++++++++++++ .../react-native-fantom/tester/CMakeLists.txt | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 packages/react-native/ReactCommon/react/cxxstableapi/StableApiAnchor.cpp diff --git a/packages/react-native/ReactCommon/react/cxxstableapi/React-cxxstableapi.podspec b/packages/react-native/ReactCommon/react/cxxstableapi/React-cxxstableapi.podspec index 15524928650..d8d780e7483 100644 --- a/packages/react-native/ReactCommon/react/cxxstableapi/React-cxxstableapi.podspec +++ b/packages/react-native/ReactCommon/react/cxxstableapi/React-cxxstableapi.podspec @@ -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" } diff --git a/packages/react-native/ReactCommon/react/cxxstableapi/StableApiAnchor.cpp b/packages/react-native/ReactCommon/react/cxxstableapi/StableApiAnchor.cpp new file mode 100644 index 00000000000..5d0e7a4459c --- /dev/null +++ b/packages/react-native/ReactCommon/react/cxxstableapi/StableApiAnchor.cpp @@ -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. diff --git a/private/react-native-fantom/tester/CMakeLists.txt b/private/react-native-fantom/tester/CMakeLists.txt index 590cd8261b9..541888f03d7 100644 --- a/private/react-native-fantom/tester/CMakeLists.txt +++ b/private/react-native-fantom/tester/CMakeLists.txt @@ -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)