Skip to content

Commit 213a396

Browse files
chrfalchclaude
andcommitted
feat(ios-prebuild): fold Hermes headers into the published ReactNativeHeaders
The core prebuild left <hermes/...> to be folded consumer-side (ensureHeadersLayout), so a SwiftPM consumer of a published ReactNativeHeaders hit "'hermes/hermes.h' file not found". Pass the hermes-ios tarball's staged destroot/include (.build/artifacts/hermes/destroot/include) as the 5th arg to buildReactNativeHeadersXcframework so the PUBLISHED ReactNativeHeaders carries the hermes/ namespace. Null when unstaged (then <hermes/...> stays consumer-composed, as before) — no behavior change for source builds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 5e4e759 commit 213a396

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

packages/react-native/scripts/ios-prebuild/xcframework.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,29 @@ function buildXCFrameworks(
9292
// the ReactNativeDependenciesHeaders sidecar built by the deps prebuild
9393
// (scripts/releases/ios-prebuild), so the core compose no longer needs the
9494
// deps artifact's headers.
95-
// NOTE: Hermes public headers (`<hermes/...>`) are folded into
96-
// ReactNativeHeaders on the consumer side by ensureHeadersLayout. When this
97-
// publish path is productionized, pass the prebuild's hermes destroot/include
98-
// as the 5th arg so the PUBLISHED ReactNativeHeaders carries hermes too.
95+
// Fold the Hermes public headers (`<hermes/...>`) into the PUBLISHED
96+
// ReactNativeHeaders so consumers resolve `<hermes/hermes.h>` out of the box
97+
// (same fold ensureHeadersLayout does consumer-side). The hermes-ios tarball
98+
// is staged at .build/artifacts/hermes/destroot/include by the hermes prebuild
99+
// step; pass it when its `hermes/` namespace is present, else null (then
100+
// `<hermes/...>` stays consumer-composed, as before).
101+
const hermesInclude = path.resolve(
102+
process.cwd(),
103+
'.build',
104+
'artifacts',
105+
'hermes',
106+
'destroot',
107+
'include',
108+
);
109+
const hermesHeaders = fs.existsSync(path.join(hermesInclude, 'hermes'))
110+
? hermesInclude
111+
: null;
99112
const headersXcfw = buildReactNativeHeadersXcframework(
100113
path.dirname(outputPath),
101114
plan,
102115
rootFolder,
103116
true, // include the mac-catalyst slice in the real compose
117+
hermesHeaders,
104118
);
105119

106120
if (identity) {

0 commit comments

Comments
 (0)