Commit 64c9663
fix(ios): make Podfile.lock SPEC CHECKSUMS deterministic across machines (#56994)
Summary:
Two sources of non-determinism cause `Podfile.lock` SPEC CHECKSUMS to differ between machines, breaking `pod install --deployment` in CI and creating unnecessary churn in PRs.
### Fix 1: Sort `Dir.glob` results in `Yoga.podspec`
`Dir.glob` returns files in filesystem-dependent order (varies across macOS APFS volumes, case sensitivity settings, and Linux ext4/xfs). Since CocoaPods evaluates the podspec at install time, the resulting array order differs between machines, producing different spec checksums.
```ruby
# Before
spec.private_header_files = Dir.glob(all_header_files) - Dir.glob(public_header_files)
# After
spec.private_header_files = Dir.glob(all_header_files).sort - Dir.glob(public_header_files).sort
```
### Fix 2: Use a Pods-relative path in `hermes-engine.podspec`
`require.resolve` with `__dir__` resolves to an absolute path containing the developer's home directory (e.g., `/Users/alice/project/node_modules/...`). This absolute path gets baked into `user_target_xcconfig`, which differs per machine.
Instead of hardcoding a relative path (which assumes a specific project layout), we dynamically compute the relative path from `Pod::Config.instance.sandbox.root` to the resolved `hermes-compiler` location. This supports any project layout (standard apps, monorepos, RNTester, etc.) while keeping the xcconfig deterministic.
```ruby
# Before — absolute path baked in
spec.user_target_xcconfig = {
'HERMES_CLI_PATH' => "#{hermes_compiler_path}/hermesc/osx-bin/hermesc"
}
# After — dynamic relative path via $(PODS_ROOT)
pods_root = Pod::Config.instance.sandbox.root
relative_hermesc = Pathname.new(hermesc_path).relative_path_from(pods_root)
spec.user_target_xcconfig = {
'HERMES_CLI_PATH' => "$(PODS_ROOT)/#{relative_hermesc}"
}
```
bypass-github-export-checks
## Changelog:
[IOS] [FIXED] - Make Podfile.lock SPEC CHECKSUMS deterministic across machines by sorting Dir.glob results in Yoga.podspec and using a dynamically computed Pods-relative path in hermes-engine.podspec
Pull Request resolved: #56994
Test Plan:
1. Run `pod install` on machine A, record `Podfile.lock`
2. Run `pod install` on machine B (different username/home directory)
3. Verify SPEC CHECKSUMS are identical between both runs
We have verified this fix in our production app — after patching, running `pod install` consecutively produces zero diff in `Podfile.lock`.
Supersedes #56977 (closed due to force-push history issue).
Fixes #56975
Made with [Cursor](https://cursor.com)
Reviewed By: cortinico
Differential Revision: D107362027
Pulled By: cipolleschi
fbshipit-source-id: 8330b99bcd17098f0bcc337ef44372ee9a3e68be1 parent d30aeeb commit 64c9663
2 files changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
73 | 78 | | |
74 | 79 | | |
75 | | - | |
| 80 | + | |
76 | 81 | | |
77 | 82 | | |
78 | 83 | | |
| |||
0 commit comments