Repository navigation
Commit 87c3e8f
fix(iOS): use the module name when rewriting module map paths of spm_dependency pods (#59182)
Summary:
Since #57602, a static pod that declares `spm_dependency` is built into the shared products dir, and `rewrite_aggregate_modulemap_references` rewrites the aggregate `-fmodule-map-file` flags from `<Pod>/<Pod>.modulemap` to `<Pod>.modulemap`. CocoaPods names the module map after the pod's module, though (`${PODS_CONFIGURATION_BUILD_DIR}/<label>/<product_module_name>.modulemap`), and the module name differs from the pod name whenever the pod name isn't a C identifier. For `rnmapbox/maps` (pod `rnmapbox-maps`, module `rnmapbox_maps`) the flag keeps pointing at `rnmapbox-maps/rnmapbox_maps.modulemap`, which no longer exists, and the app fails to build on 0.87, 0.88 and current nightlies:
```
error: module map file '${PODS_CONFIGURATION_BUILD_DIR}/rnmapbox-maps/rnmapbox_maps.modulemap' not found
```
This takes the module name from the aggregate target's pod targets instead of assuming it equals the pod name.
## Changelog:
[IOS] [FIXED] - Fix "module map file not found" for `spm_dependency` pods whose module name differs from the pod name
Pull Request resolved: #59182
Test Plan:
1. Added `test_module_map_references_use_the_module_name_of_pods_built_into_the_shared_products_dir` to `scripts/cocoapods/__tests__/spm-test.rb`. It fails before the change (the `rnmapbox-maps/rnmapbox_maps.modulemap` reference is left as is) and passes after; `ruby spm-test.rb`: 9 tests, 25 assertions, 0 failures.
2. Created an app with `react-native@0.89.0-nightly-20261018-27e77216e` and `rnmapbox/maps` with its Swift Package Manager opt-in (`$RNMapboxMapsSwiftPackageManager = true`). Before: `pod install` writes `-fmodule-map-file="${PODS_CONFIGURATION_BUILD_DIR}/rnmapbox-maps/rnmapbox_maps.modulemap"` into `Pods-App.debug.xcconfig` and the build fails with the error above. After applying this patch to the app's `node_modules/react-native`: the flag is `${PODS_CONFIGURATION_BUILD_DIR}/rnmapbox_maps.modulemap` and the Debug build succeeds. With the equivalent path rewrite applied on the library side, the app also launches on the simulator and shows the map, and a Release archive succeeds.
Reviewed By: christophpurrer
Differential Revision: D126299058
Pulled By: cipolleschi
fbshipit-source-id: a727094c290c9f70a9aa25f4fd6d3ec37a91f64a1 parent c7429b0 commit 87c3e8f
2 files changed
Lines changed: 47 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
202 | 206 | | |
203 | 207 | | |
204 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
205 | 237 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
149 | 151 | | |
150 | 152 | | |
| 153 | + | |
151 | 154 | | |
152 | 155 | | |
153 | 156 | | |
154 | 157 | | |
155 | 158 | | |
156 | | - | |
| 159 | + | |
| 160 | + | |
157 | 161 | | |
158 | | - | |
159 | | - | |
| 162 | + | |
| 163 | + | |
160 | 164 | | |
161 | 165 | | |
162 | 166 | | |
| |||
0 commit comments