@jacques_gordon/expo-mapbox-navigation 2.2.18 → 2.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app.plugin.js CHANGED
@@ -275,6 +275,39 @@ def _expo_mapbox_nav_add_spm(installer)
275
275
  puts "[ExpoMapboxNavigation] Added PODS_CONFIGURATION_BUILD_DIR to SWIFT_INCLUDE_PATHS (#{config.name})"
276
276
  end
277
277
  end
278
+
279
+ # ── FRAMEWORK_SEARCH_PATHS / OTHER_LDFLAGS fix for MapboxNavigationNative ───
280
+ # React Native's own SPM manager (react-native/scripts/cocoapods/spm.rb,
281
+ # SPMManager#apply_on_post_install) unconditionally deletes ALL
282
+ # XCRemoteSwiftPackageReference/XCLocalSwiftPackageReference entries not
283
+ # registered through its own official spm_dependency() API, then only
284
+ # re-adds the ones it knows about. Since we don't use that API (to avoid
285
+ # the static-linking duplicate-symbol issues it's known to cause with
286
+ # Expo modules), our manually-added package_product_dependency for
287
+ # MapboxNavigationNative keeps getting wiped. Running this whole hook
288
+ # from post_integrate (see bottom of file) works around the *timing* of
289
+ # that wipe, but as a second, independent line of defense that doesn't
290
+ # depend on hook ordering at all, we also force-link the actual compiled
291
+ # MapboxNavigationNativeWrapper.framework directly via raw build
292
+ # settings. clean_spm_dependencies_from_target only ever touches
293
+ # package_references - it never touches FRAMEWORK_SEARCH_PATHS or
294
+ # OTHER_LDFLAGS, so this survives regardless of what wipes the package
295
+ # graph entries.
296
+ expo_target.build_configurations.each do |config|
297
+ existing_fsp = config.build_settings['FRAMEWORK_SEARCH_PATHS'] || '$(inherited)'
298
+ unless existing_fsp.to_s.include?('PackageFrameworks')
299
+ config.build_settings['FRAMEWORK_SEARCH_PATHS'] =
300
+ "#{existing_fsp} \\"${podsBuildDir}/PackageFrameworks\\""
301
+ puts "[ExpoMapboxNavigation] Added PackageFrameworks to FRAMEWORK_SEARCH_PATHS (#{config.name})"
302
+ end
303
+
304
+ existing_ldflags = config.build_settings['OTHER_LDFLAGS'] || '$(inherited)'
305
+ unless existing_ldflags.to_s.include?('MapboxNavigationNativeWrapper')
306
+ config.build_settings['OTHER_LDFLAGS'] =
307
+ "#{existing_ldflags} -framework MapboxNavigationNativeWrapper"
308
+ puts "[ExpoMapboxNavigation] Added -framework MapboxNavigationNativeWrapper to OTHER_LDFLAGS (#{config.name})"
309
+ end
310
+ end
278
311
  else
279
312
  puts '[ExpoMapboxNavigation] WARNING: ExpoMapboxNavigation target not found!'
280
313
  puts '[ExpoMapboxNavigation] Available targets:'
@@ -318,19 +351,34 @@ def _expo_mapbox_nav_add_spm(installer)
318
351
  end
319
352
  `;
320
353
 
321
- // Find the last post_install block and add our call inside it,
322
- // or add a new post_install block if none exists.
323
- if (podfile.includes('post_install do |installer|')) {
324
- // Add our helper def before the first post_install
325
- // and our call inside the existing post_install
354
+ // Find the last post_integrate block and add our call inside it,
355
+ // or add a new post_integrate block if none exists.
356
+ //
357
+ // WHY post_integrate INSTEAD OF post_install:
358
+ // React Native/Expo's own CocoaPods post_install logic runs a step
359
+ // that re-derives and regenerates each pod target's SPM package
360
+ // product dependencies (visible in the pod install log as
361
+ // "[SPM] Cleaning old SPM dependencies from Pods project" / "[SPM]
362
+ // Adding SPM dependencies to Pods project"). Since our hook was
363
+ // previously injected at the START of the existing post_install
364
+ // block, it ran BEFORE that RN/Expo step — which then silently
365
+ // dropped our manually-added MapboxNavigationNative product
366
+ // dependency (while, by chance, preserving MapboxNavigationCore and
367
+ // MapboxNavigationUIKit, since something in RN/Expo's own derivation
368
+ // logic happens to recognize those two but not a product that's
369
+ // needed only transitively). CocoaPods' post_integrate hook is
370
+ // documented to run strictly after all post_install hooks AND after
371
+ // the Pods project has already been saved to disk, specifically so
372
+ // that later hooks can alter it after the fact. Injecting here
373
+ // guarantees our changes are applied last and are not overwritten.
374
+ if (podfile.includes('post_integrate do |installer|')) {
326
375
  podfile = spmHook + podfile.replace(
327
- 'post_install do |installer|',
328
- 'post_install do |installer|\n _expo_mapbox_nav_add_spm(installer)'
376
+ 'post_integrate do |installer|',
377
+ 'post_integrate do |installer|\n _expo_mapbox_nav_add_spm(installer)'
329
378
  );
330
379
  } else {
331
- // No post_install block — add both the helper and a new block
332
380
  podfile = podfile + spmHook + `
333
- post_install do |installer|
381
+ post_integrate do |installer|
334
382
  _expo_mapbox_nav_add_spm(installer)
335
383
  end
336
384
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jacques_gordon/expo-mapbox-navigation",
3
- "version": "2.2.18",
3
+ "version": "2.2.20",
4
4
  "description": "Expo module for Mapbox Navigation SDK with 16KB page size support, NDK27, and Mapbox Maps v11.11.0+",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -275,6 +275,39 @@ def _expo_mapbox_nav_add_spm(installer)
275
275
  puts "[ExpoMapboxNavigation] Added PODS_CONFIGURATION_BUILD_DIR to SWIFT_INCLUDE_PATHS (#{config.name})"
276
276
  end
277
277
  end
278
+
279
+ # ── FRAMEWORK_SEARCH_PATHS / OTHER_LDFLAGS fix for MapboxNavigationNative ───
280
+ # React Native's own SPM manager (react-native/scripts/cocoapods/spm.rb,
281
+ # SPMManager#apply_on_post_install) unconditionally deletes ALL
282
+ # XCRemoteSwiftPackageReference/XCLocalSwiftPackageReference entries not
283
+ # registered through its own official spm_dependency() API, then only
284
+ # re-adds the ones it knows about. Since we don't use that API (to avoid
285
+ # the static-linking duplicate-symbol issues it's known to cause with
286
+ # Expo modules), our manually-added package_product_dependency for
287
+ # MapboxNavigationNative keeps getting wiped. Running this whole hook
288
+ # from post_integrate (see bottom of file) works around the *timing* of
289
+ # that wipe, but as a second, independent line of defense that doesn't
290
+ # depend on hook ordering at all, we also force-link the actual compiled
291
+ # MapboxNavigationNativeWrapper.framework directly via raw build
292
+ # settings. clean_spm_dependencies_from_target only ever touches
293
+ # package_references - it never touches FRAMEWORK_SEARCH_PATHS or
294
+ # OTHER_LDFLAGS, so this survives regardless of what wipes the package
295
+ # graph entries.
296
+ expo_target.build_configurations.each do |config|
297
+ existing_fsp = config.build_settings['FRAMEWORK_SEARCH_PATHS'] || '$(inherited)'
298
+ unless existing_fsp.to_s.include?('PackageFrameworks')
299
+ config.build_settings['FRAMEWORK_SEARCH_PATHS'] =
300
+ "#{existing_fsp} \\"${podsBuildDir}/PackageFrameworks\\""
301
+ puts "[ExpoMapboxNavigation] Added PackageFrameworks to FRAMEWORK_SEARCH_PATHS (#{config.name})"
302
+ end
303
+
304
+ existing_ldflags = config.build_settings['OTHER_LDFLAGS'] || '$(inherited)'
305
+ unless existing_ldflags.to_s.include?('MapboxNavigationNativeWrapper')
306
+ config.build_settings['OTHER_LDFLAGS'] =
307
+ "#{existing_ldflags} -framework MapboxNavigationNativeWrapper"
308
+ puts "[ExpoMapboxNavigation] Added -framework MapboxNavigationNativeWrapper to OTHER_LDFLAGS (#{config.name})"
309
+ end
310
+ end
278
311
  else
279
312
  puts '[ExpoMapboxNavigation] WARNING: ExpoMapboxNavigation target not found!'
280
313
  puts '[ExpoMapboxNavigation] Available targets:'
@@ -318,19 +351,34 @@ def _expo_mapbox_nav_add_spm(installer)
318
351
  end
319
352
  `;
320
353
 
321
- // Find the last post_install block and add our call inside it,
322
- // or add a new post_install block if none exists.
323
- if (podfile.includes('post_install do |installer|')) {
324
- // Add our helper def before the first post_install
325
- // and our call inside the existing post_install
354
+ // Find the last post_integrate block and add our call inside it,
355
+ // or add a new post_integrate block if none exists.
356
+ //
357
+ // WHY post_integrate INSTEAD OF post_install:
358
+ // React Native/Expo's own CocoaPods post_install logic runs a step
359
+ // that re-derives and regenerates each pod target's SPM package
360
+ // product dependencies (visible in the pod install log as
361
+ // "[SPM] Cleaning old SPM dependencies from Pods project" / "[SPM]
362
+ // Adding SPM dependencies to Pods project"). Since our hook was
363
+ // previously injected at the START of the existing post_install
364
+ // block, it ran BEFORE that RN/Expo step — which then silently
365
+ // dropped our manually-added MapboxNavigationNative product
366
+ // dependency (while, by chance, preserving MapboxNavigationCore and
367
+ // MapboxNavigationUIKit, since something in RN/Expo's own derivation
368
+ // logic happens to recognize those two but not a product that's
369
+ // needed only transitively). CocoaPods' post_integrate hook is
370
+ // documented to run strictly after all post_install hooks AND after
371
+ // the Pods project has already been saved to disk, specifically so
372
+ // that later hooks can alter it after the fact. Injecting here
373
+ // guarantees our changes are applied last and are not overwritten.
374
+ if (podfile.includes('post_integrate do |installer|')) {
326
375
  podfile = spmHook + podfile.replace(
327
- 'post_install do |installer|',
328
- 'post_install do |installer|\n _expo_mapbox_nav_add_spm(installer)'
376
+ 'post_integrate do |installer|',
377
+ 'post_integrate do |installer|\n _expo_mapbox_nav_add_spm(installer)'
329
378
  );
330
379
  } else {
331
- // No post_install block — add both the helper and a new block
332
380
  podfile = podfile + spmHook + `
333
- post_install do |installer|
381
+ post_integrate do |installer|
334
382
  _expo_mapbox_nav_add_spm(installer)
335
383
  end
336
384
  `;