Skip to content

fix(rn-tester): use framework-style import for RCTFabricComponentsPlugins.h - #57697

Closed
chrfalch wants to merge 1 commit into
mainfrom
chrfalch/fix-rntester-spm-plugins-header
Closed

fix(rn-tester): use framework-style import for RCTFabricComponentsPlugins.h#57697
chrfalch wants to merge 1 commit into
mainfrom
chrfalch/fix-rntester-spm-plugins-header

Conversation

@chrfalch

Copy link
Copy Markdown
Collaborator

Summary:

rn-tester's MyNativeView example imports RCTFabricComponentsPlugins.h with the quoted form, which only resolves under CocoaPods (header maps re-vend the bare filename via FACADE_REEXPOSED_HEADERS in rncore_facades.rb — see also scripts/ios-prebuild/__docs__/headers-rules.md, which documents the quoted form as CocoaPods-only). Under SwiftPM the header is exposed as an include directory, so only <React/RCTFabricComponentsPlugins.h> resolves — the quoted import makes MyNativeView fail to compile when rn-tester is converted to SwiftPM (surfaced by the new SPM CI lane in #57659).

The angle form resolves under both distributions. One line, no behavior change under CocoaPods.

Changelog:

[INTERNAL] [FIXED] - Fix rn-tester's NativeComponentExample header import so it compiles under SwiftPM

Test Plan:

  • Repro on clean main: converting rn-tester to SwiftPM (spm add --deintegrate) and building fails at RNTMyNativeViewComponentView.mm:16 (fatal error: 'RCTFabricComponentsPlugins.h' file not found) — both against CI-composed prebuilt artifacts and locally-built ones (identical failure; clang search paths verified via the compile response file: the header is reachable only as React/RCTFabricComponentsPlugins.h).
  • With this change applied: same conversion + xcodebuild -configuration Debug -sdk iphonesimulatorBUILD SUCCEEDED, embedded React.framework verified Debug-flavored.
  • Existing CocoaPods CI (test_ios_rntester) covers the unchanged CocoaPods path.

…gins.h
The quoted form resolves only under CocoaPods (header maps re-vend the
bare filename via FACADE_REEXPOSED_HEADERS in rncore_facades.rb).
SwiftPM exposes React headers as an include directory, so the header is
only reachable as <React/RCTFabricComponentsPlugins.h> — the quoted
import makes MyNativeView fail to compile when rn-tester is converted
to SwiftPM. The angle form resolves under both distributions.
Cherry-picked from the SPM stack (ecdd1771019).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@meta-clameta-claBot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 27, 2026
@facebook-github-toolsfacebook-github-toolsBot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Jul 27, 2026
@meta-codesync

Copy link
Copy Markdown

@fabriziocucci has imported this pull request. If you are a Meta employee, you can view this in D113771766.

@cortinicocortinico left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

@meta-codesyncmeta-codesyncBot added the Merged This PR has been merged. label Jul 27, 2026
@meta-codesync

Copy link
Copy Markdown

@fabriziocucci merged this pull request in 6d0612c.

chrfalch added a commit that referenced this pull request Jul 27, 2026
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
chrfalch added a commit that referenced this pull request Jul 28, 2026
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
fabriziocucci pushed a commit that referenced this pull request Aug 3, 2026
…gins.h (#57697)
Summary:
rn-tester's `MyNativeView` example imports `RCTFabricComponentsPlugins.h`. The quoted form resolves under CocoaPods (the bare filename is re-vended via `FACADE_REEXPOSED_HEADERS` in `rncore_facades.rb`) and under the internal Meta build (the per-target header generated by buck's `plugins_header`), but not under SwiftPM. Under SwiftPM the header is exposed as an include directory, so only `<React/RCTFabricComponentsPlugins.h>` resolves. The quoted import makes `MyNativeView` fail to compile when rn-tester is converted to SwiftPM (surfaced by the new SPM CI lane in #57659), and switching to the angle form alone would instead break the internal build.
The fix uses a `__has_include` conditional: the angle form when it is available (SwiftPM and CocoaPods) with the quoted form as a fallback (the internal build). This matches the existing pattern in rn-tester's own `NativeCxxModuleExample.h` and keeps all three build stacks compiling.
## Changelog:
[INTERNAL] [FIXED] - Make rn-tester's NativeComponentExample header import resolve under SwiftPM, CocoaPods and the internal build
Pull Request resolved: #57697
Test Plan:
- Repro on clean `main`: converting rn-tester to SwiftPM (`spm add --deintegrate`) and building fails at `RNTMyNativeViewComponentView.mm` with `fatal error: 'RCTFabricComponentsPlugins.h' file not found`.
- With this change: the same SwiftPM conversion plus `xcodebuild -configuration Debug -sdk iphonesimulator` gives `BUILD SUCCEEDED`.
- Internal build: `buck2 build fbsource//xplat/js/react-native-github/packages/rn-tester:NativeComponentExampleApple` succeeds (it takes the quoted fallback).
- Existing CocoaPods CI (`test_ios_rntester`) covers the CocoaPods path.
Reviewed By: cipolleschi
Differential Revision: D113771766
Pulled By: fabriziocucci
fbshipit-source-id: e4549508f8e56942b45fa128b2391a290499d4a8
(cherry picked from commit 6d0612c)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.MergedThis PR has been merged.p: ExpoPartner: ExpoPartnerShared with MetaApplied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@chrfalch@cortinico