From 1b00290124de321000cc65e082087c0a2b14ae58 Mon Sep 17 00:00:00 2001 From: Christian Falch Date: Fri, 21 Aug 2026 14:42:15 +0200 Subject: [PATCH] Drop the inert publicHeadersPath from spm.modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An app could declare `publicHeadersPath` on an `spm.modules` entry, and the value never reached SwiftPM: every module is emitted through a synth wrapper whose manifest hardcodes `publicHeadersPath: "include"`. Nor does the field have a job to do. That `include/` is a symlink to the module's slice of the header farm, so the wrapper already exposes the whole header tree as the module's public interface. A declared value could only narrow that. The field was vestigial parity with the podspec `s.public_header_files` it was modelled on. Removing it from the config surface only. `SpmTarget.publicHeadersPath` (set from the podspec for npm deps) and `SynthPackageSpec.publicHeadersPath` (which emits the wrapper's value) are both live and unchanged. An app config that still sets the key keeps working — it is an ignored extra key, exactly as it is ignored today. Co-Authored-By: Claude Opus 5 (1M context) --- packages/react-native/scripts/spm/__docs__/spm-scripts.md | 1 - .../react-native/scripts/spm/generate-spm-autolinking.js | 5 +++-- packages/react-native/scripts/spm/spm-types.js | 1 - packages/rn-tester/react-native.config.js | 1 - 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/react-native/scripts/spm/__docs__/spm-scripts.md b/packages/react-native/scripts/spm/__docs__/spm-scripts.md index fcf1ab32821d..a6bb55132864 100644 --- a/packages/react-native/scripts/spm/__docs__/spm-scripts.md +++ b/packages/react-native/scripts/spm/__docs__/spm-scripts.md @@ -342,7 +342,6 @@ module.exports = { name: 'MyNativeModule', path: 'ios/MyNativeModule', // relative to app root exclude: ['*.podspec'], // optional - publicHeadersPath: '.', // optional }, ], }, diff --git a/packages/react-native/scripts/spm/generate-spm-autolinking.js b/packages/react-native/scripts/spm/generate-spm-autolinking.js index 5e933af01443..f1cea3687c7a 100644 --- a/packages/react-native/scripts/spm/generate-spm-autolinking.js +++ b/packages/react-native/scripts/spm/generate-spm-autolinking.js @@ -232,7 +232,6 @@ function readAutolinkingJson( * name: "MyNativeModule", * path: "ios/MyNativeModule", // relative to appRoot * exclude: ["*.js", "*.podspec"], // optional - * publicHeadersPath: ".", // optional * } * ] * } @@ -1334,7 +1333,9 @@ function main(argv /*:: ?: Array */) /*: void */ { name: mod.name, path: relPath, exclude: mod.exclude ?? [], - publicHeadersPath: mod.publicHeadersPath ?? null, + // The synth wrapper owns the module's public interface: it declares + // publicHeadersPath: "include", a symlink to the module's header tree. + publicHeadersPath: null, sources: userSources, }, origin: 'spmModule', diff --git a/packages/react-native/scripts/spm/spm-types.js b/packages/react-native/scripts/spm/spm-types.js index ba290ee05de8..deb956e53b4a 100644 --- a/packages/react-native/scripts/spm/spm-types.js +++ b/packages/react-native/scripts/spm/spm-types.js @@ -168,7 +168,6 @@ export type SpmModuleConfig = { name: string, path: string, exclude?: Array, - publicHeadersPath?: ?string, // Optional CocoaPods-style glob allowlist (analog of s.source_files). // When set, replaces auto source discovery for the module — only files // matching one of these patterns are passed to SPM via `sources:`. diff --git a/packages/rn-tester/react-native.config.js b/packages/rn-tester/react-native.config.js index c63fd9e7127c..7d9058c4686d 100644 --- a/packages/rn-tester/react-native.config.js +++ b/packages/rn-tester/react-native.config.js @@ -36,7 +36,6 @@ module.exports = { { name: 'ReactCommonSamples', path: '../react-native/ReactCommon/react/nativemodule/samples/platform/ios', - publicHeadersPath: '.', }, { name: 'ReactRCTPushNotification',