fix(cocoapods) Podfile.lock SPEC CHECKSUMS drift for React XCFrameworks (#56803)

Summary:
Two developers (or one developer on two paths, or CI vs. local) running pod install on the same React Native project at the same commit get different SPEC CHECKSUMS entries for React-Core-prebuilt and ReactNativeDependencies in Podfile.lock. That breaks pod install-deployment style verification and any workflow that expects Podfile.lock to be reproducible.

CocoaPods derives each SPEC CHECKSUMS entry by hashing the in-memory podspec JSON. So anything embedded in source.http, prepare_command, user_target_xcconfig, etc. becomes part of the hash. Two podspec-resolution sites in this repo build their source.http from an absolute on-disk path.

Because project_pods_root is an absolute path, the resulting file://<abs>/... URL differs across machines or working-tree paths, so the hashed JSON differs, so the checksum differs.

### How

The Maven URL for each tarball is already computed inside both functions (stable_tarball_url(...) / nightly_tarball_url(...) / release_tarball_url(...)). Returning that URL — a stable string identical across machines — instead of the local file:// URL makes source.http path-free. CocoaPods downloads from Maven and caches the tarball itself, so functionality is preserved.

The pre-existing local-tarball download is kept untouched (its only remaining consumer is the opt-in  `RCT_SYMBOLICATE_PREBUILT_FRAMEWORKS=1` dSYM-injection path in rncore.rb, which still needs file:// to feed CocoaPods a mutated tarball — gated by unless @download_dsyms so the leak is preserved only for that flag).

**Out of scope: **

hermes-engine.podspec has the same shape of leak in user_target_xcconfig.HERMES_CLI_PATH. Fixing it requires a paired change to ensure hermesc lands at the new ${PODS_ROOT}-relative path; that's a separate PR.

## Changelog:

[IOS] [FIXED] - Fix Pod install checksum drifting

Pull Request resolved: https://github.com/facebook/react-native/pull/56803

Test Plan:
Run `pod install` and verify that none of the following files contains absolute paths:

- Pods/Local Podspecs/React-Core-prebuilt.podspec.json
- Pods/Local Podspecs/ReactNativeDependencies.podspec.json

Reviewed By: christophpurrer

Differential Revision: D104889112

Pulled By: CalixTang

fbshipit-source-id: 97505a8bf78f7df57bda2d87705da5a20c934d2b
This commit is contained in:
Christian Falch authored and React Native Bot committed 2026-05-21 16:14:18 +00:00
1 parent ff2562e6e1
commit 443ac4028d
2 files changed
+6 -5

No files matched your search

@@ -160,6 +160,7 @@ class ReactNativeCoreUtils
rncore_log(" #{Pathname.new(destinationDebug).relative_path_from(Pathname.pwd).to_s}")
rncore_log(" #{Pathname.new(destinationRelease).relative_path_from(Pathname.pwd).to_s}")
return {:http => stable_tarball_url(@@react_native_version, :debug) } unless @@download_dsyms
return {:http => URI::File.build(path: destinationDebug).to_s }
end
@@ -196,6 +197,7 @@ class ReactNativeCoreUtils
rncore_log("Resolved nightly ReactNativeCore-prebuilt version:")
rncore_log(" #{Pathname.new(destinationDebug).relative_path_from(Pathname.pwd).to_s}")
rncore_log(" #{Pathname.new(destinationRelease).relative_path_from(Pathname.pwd).to_s}")
return {:http => nightly_tarball_url(@@react_native_version, :debug) } unless @@download_dsyms
return {:http => URI::File.build(path: destinationDebug).to_s }
end
@@ -158,10 +158,10 @@ class ReactNativeDependenciesUtils
url = release_tarball_url(@@react_native_version, :debug)
rndeps_log("Using tarball from URL: #{url}")
destinationDebug = download_stable_rndeps(@@react_native_path, @@react_native_version, :debug)
download_stable_rndeps(@@react_native_path, @@react_native_version, :debug)
download_stable_rndeps(@@react_native_path, @@react_native_version, :release)
return {:http => URI::File.build(path: destinationDebug).to_s }
return {:http => url }
end
def self.release_tarball_url(version, build_type)
@@ -225,11 +225,10 @@ class ReactNativeDependenciesUtils
url = nightly_tarball_url(version, :debug)
rndeps_log("Using tarball from URL: #{url}")
destinationDebug = download_nightly_rndeps(@@react_native_path, @@react_native_version, :debug)
download_nightly_rndeps(@@react_native_path, @@react_native_version, :debug)
download_nightly_rndeps(@@react_native_path, @@react_native_version, :release)
return {:http => URI::File.build(path: destinationDebug).to_s }
return {:http => url}
return {:http => url }
end
def self.download_rndeps_tarball(react_native_path, tarball_url, version, configuration)