Repository navigation
Conversation
Every SwiftPM sync read the podspec of each npm dependency to collect its HEADER_SEARCH_PATHS. The read can start a `pod ipc spec` process. Its result never reached a generated manifest: each npm dependency either ships its own Package.swift or fails as a missing manifest before the wrapper is generated, and app-local modules never carry header search paths. Remove the read, the SpmTarget and SynthPackageSpec fields, and the wrapper code that emitted them.
cipolleschi
left a comment
There was a problem hiding this comment.
Thanks @chrfalch, this looks good to me.
I checked main() to make sure the field really was dead. Every npm dependency that goes through autolinkingDepToSpmTarget either has its own Package.swift, so the generated-manifest step is skipped, or ends up in missingManifests, which throws before any manifest is written. The only targets that still get a generated manifest are app-local spm.modules. Those never had headerSearchPaths set and don't read podspecs. So this removes a podspec read (and possibly a pod ipc spec process) per dependency on every sync, with no change to the output.
The case the old comment cared about (<react/renderer/components/safeareacontext/...> includes) is still covered: scaffold-package-swift.js writes the podspec's header search paths into the Package.swift it scaffolds.
I left one small inline nit; it's not blocking.
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D126936104. |
Summary:
In the SwiftPM pipeline, every sync reads the podspec of each npm dependency to collect its
HEADER_SEARCH_PATHS. (That can even start apod ipc specprocess for each dependency), and the result is never used.This change removes the read and the code that carried its result:
extractPodspecHeaderSearchPathsand its call inautolinkingDepToSpmTarget(generate-spm-autolinking.js)headerSearchPathsfield onSpmTargetandSynthPackageSpec(spm-types.js)root/prefix step inmain()and the.headerSearchPath(...)output ingenerateSynthPackageSwiftThe podspec reader (
read-podspec.js) and the scaffolder (scaffold-package-swift.js) still use header search paths. They do not change.This PR does not depend on other open PRs.
Changelog:
[INTERNAL] [REMOVED] - Stop reading unused podspec header search paths during SwiftPM sync
Test Plan:
generate-spm-autolinking-test.js: an npm dependency whose podspec setsHEADER_SEARCH_PATHSmust not cause a call to the podspec reader. Before the change it failed withExpected number of calls: 0, Received number of calls: 1. After the change it passes.node_modules/.bin/jest --no-cache -i packages/react-native/scripts/spm: 23 of 23 suites and 1129 of 1129 tests pass.node packages/react-native/scripts/spm/generate-spm-autolinking.js --app-root packages/rn-tester --react-native-root packages/react-native --autolinking-json <file> --output <dir>:Package.swiftfiles.diff -rfinds no differences.yarn flow-check, because it fails locally on unrelated vendored files.