@jacques_gordon/expo-mapbox-navigation 2.2.9 → 2.2.11
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 +44 -21
- package/package.json +1 -1
- package/plugin/src/index.js +44 -21
package/app.plugin.js
CHANGED
|
@@ -172,8 +172,9 @@ def _expo_mapbox_nav_add_spm(installer)
|
|
|
172
172
|
|
|
173
173
|
pkg_class = Xcodeproj::Project::Object::XCRemoteSwiftPackageReference
|
|
174
174
|
ref_class = Xcodeproj::Project::Object::XCSwiftPackageProductDependency
|
|
175
|
+
dep_class = Xcodeproj::Project::Object::PBXTargetDependency
|
|
175
176
|
|
|
176
|
-
# ── Step 1: Add
|
|
177
|
+
# ── Step 1: Add package + products to pods_project ────────────────────────
|
|
177
178
|
pods_project = installer.pods_project
|
|
178
179
|
|
|
179
180
|
pkg = pods_project.root_object.package_references.find { |p|
|
|
@@ -187,42 +188,64 @@ def _expo_mapbox_nav_add_spm(installer)
|
|
|
187
188
|
puts '[ExpoMapboxNavigation] Added mapbox-navigation-ios to pods_project'
|
|
188
189
|
end
|
|
189
190
|
|
|
190
|
-
# ── FIX: Stronger target lookup with fallback ──────────────────────────────
|
|
191
|
-
# CocoaPods normally names the target exactly 'ExpoMapboxNavigation'.
|
|
192
|
-
# Deduplication suffixes (e.g. 'ExpoMapboxNavigation-abc123') only happen
|
|
193
|
-
# when the same pod is included in multiple targets with different specs,
|
|
194
|
-
# which is not our case. We still add an include? fallback to be safe.
|
|
195
191
|
expo_target = pods_project.targets.find { |t| t.name == 'ExpoMapboxNavigation' }
|
|
196
192
|
expo_target ||= pods_project.targets.find { |t| t.name.include?('ExpoMapboxNavigation') }
|
|
197
193
|
if expo_target
|
|
198
194
|
puts "[ExpoMapboxNavigation] Found target: #{expo_target.name}"
|
|
199
195
|
products.each do |product_name|
|
|
200
|
-
|
|
196
|
+
# 1. package_product_dependencies — registers SPM product on target
|
|
197
|
+
prod_ref = expo_target.package_product_dependencies.find { |r|
|
|
201
198
|
r.class == ref_class && r.package == pkg && r.product_name == product_name
|
|
202
199
|
}
|
|
203
|
-
unless
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
expo_target.package_product_dependencies <<
|
|
208
|
-
puts "[ExpoMapboxNavigation]
|
|
200
|
+
unless prod_ref
|
|
201
|
+
prod_ref = pods_project.new(ref_class)
|
|
202
|
+
prod_ref.package = pkg
|
|
203
|
+
prod_ref.product_name = product_name
|
|
204
|
+
expo_target.package_product_dependencies << prod_ref
|
|
205
|
+
puts "[ExpoMapboxNavigation] Added package_product_dependency: #{product_name}"
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# ── SWIFT_INCLUDE_PATHS fix ──────────────────────────────────────────────
|
|
210
|
+
# SPM compiles .swiftmodule into ${PODS_CONFIGURATION_BUILD_DIR}.
|
|
211
|
+
# Without adding this path, Xcode throws "no such module MapboxNavigationCore".
|
|
212
|
+
# Source: https://trinhngocthuyen.com/posts/tech/spm-with-cocoapods/
|
|
213
|
+
expo_target.build_configurations.each do |config|
|
|
214
|
+
existing = config.build_settings['SWIFT_INCLUDE_PATHS'] || '$(inherited)'
|
|
215
|
+
unless existing.include?('PODS_CONFIGURATION_BUILD_DIR')
|
|
216
|
+
config.build_settings['SWIFT_INCLUDE_PATHS'] =
|
|
217
|
+
"#{existing} \"${PODS_CONFIGURATION_BUILD_DIR}\""
|
|
218
|
+
puts "[ExpoMapboxNavigation] Added PODS_CONFIGURATION_BUILD_DIR to SWIFT_INCLUDE_PATHS (#{config.name})"
|
|
209
219
|
end
|
|
210
220
|
end
|
|
211
221
|
else
|
|
212
|
-
# Debug: print all available targets so we can fix the name if needed
|
|
213
222
|
puts '[ExpoMapboxNavigation] WARNING: ExpoMapboxNavigation target not found!'
|
|
214
223
|
puts '[ExpoMapboxNavigation] Available targets:'
|
|
215
224
|
pods_project.targets.each { |t| puts " - #{t.name}" }
|
|
216
225
|
end
|
|
217
226
|
pods_project.save
|
|
218
227
|
|
|
219
|
-
# ──
|
|
220
|
-
#
|
|
221
|
-
#
|
|
222
|
-
#
|
|
223
|
-
#
|
|
224
|
-
#
|
|
225
|
-
#
|
|
228
|
+
# ── Step 2: Register package reference in user_project (persists) ─────────
|
|
229
|
+
# Pods.xcodeproj is rebuilt every pod install — our Step 1 must survive via
|
|
230
|
+
# the workspace SPM graph. Registering the XCRemoteSwiftPackageReference in
|
|
231
|
+
# user_project (Navio.xcodeproj) ensures Xcode resolves the package into
|
|
232
|
+
# the workspace cache, making products available to Pods.xcodeproj targets.
|
|
233
|
+
# We do NOT add product dependencies to the app target — that caused
|
|
234
|
+
# "Multiple commands produce" in v2.2.8 (duplicate embed with @rnmapbox/maps).
|
|
235
|
+
installer.aggregate_targets.each do |agg|
|
|
236
|
+
user_project = agg.user_project
|
|
237
|
+
user_pkg = user_project.root_object.package_references.find { |p|
|
|
238
|
+
p.class == pkg_class && p.repositoryURL == url
|
|
239
|
+
}
|
|
240
|
+
unless user_pkg
|
|
241
|
+
user_pkg = user_project.new(pkg_class)
|
|
242
|
+
user_pkg.repositoryURL = url
|
|
243
|
+
user_pkg.requirement = requirement
|
|
244
|
+
user_project.root_object.package_references << user_pkg
|
|
245
|
+
puts "[ExpoMapboxNavigation] Registered package ref in #{user_project.path.basename}"
|
|
246
|
+
end
|
|
247
|
+
user_project.save
|
|
248
|
+
end
|
|
226
249
|
end
|
|
227
250
|
`;
|
|
228
251
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jacques_gordon/expo-mapbox-navigation",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.11",
|
|
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",
|
package/plugin/src/index.js
CHANGED
|
@@ -172,8 +172,9 @@ def _expo_mapbox_nav_add_spm(installer)
|
|
|
172
172
|
|
|
173
173
|
pkg_class = Xcodeproj::Project::Object::XCRemoteSwiftPackageReference
|
|
174
174
|
ref_class = Xcodeproj::Project::Object::XCSwiftPackageProductDependency
|
|
175
|
+
dep_class = Xcodeproj::Project::Object::PBXTargetDependency
|
|
175
176
|
|
|
176
|
-
# ── Step 1: Add
|
|
177
|
+
# ── Step 1: Add package + products to pods_project ────────────────────────
|
|
177
178
|
pods_project = installer.pods_project
|
|
178
179
|
|
|
179
180
|
pkg = pods_project.root_object.package_references.find { |p|
|
|
@@ -187,42 +188,64 @@ def _expo_mapbox_nav_add_spm(installer)
|
|
|
187
188
|
puts '[ExpoMapboxNavigation] Added mapbox-navigation-ios to pods_project'
|
|
188
189
|
end
|
|
189
190
|
|
|
190
|
-
# ── FIX: Stronger target lookup with fallback ──────────────────────────────
|
|
191
|
-
# CocoaPods normally names the target exactly 'ExpoMapboxNavigation'.
|
|
192
|
-
# Deduplication suffixes (e.g. 'ExpoMapboxNavigation-abc123') only happen
|
|
193
|
-
# when the same pod is included in multiple targets with different specs,
|
|
194
|
-
# which is not our case. We still add an include? fallback to be safe.
|
|
195
191
|
expo_target = pods_project.targets.find { |t| t.name == 'ExpoMapboxNavigation' }
|
|
196
192
|
expo_target ||= pods_project.targets.find { |t| t.name.include?('ExpoMapboxNavigation') }
|
|
197
193
|
if expo_target
|
|
198
194
|
puts "[ExpoMapboxNavigation] Found target: #{expo_target.name}"
|
|
199
195
|
products.each do |product_name|
|
|
200
|
-
|
|
196
|
+
# 1. package_product_dependencies — registers SPM product on target
|
|
197
|
+
prod_ref = expo_target.package_product_dependencies.find { |r|
|
|
201
198
|
r.class == ref_class && r.package == pkg && r.product_name == product_name
|
|
202
199
|
}
|
|
203
|
-
unless
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
expo_target.package_product_dependencies <<
|
|
208
|
-
puts "[ExpoMapboxNavigation]
|
|
200
|
+
unless prod_ref
|
|
201
|
+
prod_ref = pods_project.new(ref_class)
|
|
202
|
+
prod_ref.package = pkg
|
|
203
|
+
prod_ref.product_name = product_name
|
|
204
|
+
expo_target.package_product_dependencies << prod_ref
|
|
205
|
+
puts "[ExpoMapboxNavigation] Added package_product_dependency: #{product_name}"
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# ── SWIFT_INCLUDE_PATHS fix ──────────────────────────────────────────────
|
|
210
|
+
# SPM compiles .swiftmodule into ${PODS_CONFIGURATION_BUILD_DIR}.
|
|
211
|
+
# Without adding this path, Xcode throws "no such module MapboxNavigationCore".
|
|
212
|
+
# Source: https://trinhngocthuyen.com/posts/tech/spm-with-cocoapods/
|
|
213
|
+
expo_target.build_configurations.each do |config|
|
|
214
|
+
existing = config.build_settings['SWIFT_INCLUDE_PATHS'] || '$(inherited)'
|
|
215
|
+
unless existing.include?('PODS_CONFIGURATION_BUILD_DIR')
|
|
216
|
+
config.build_settings['SWIFT_INCLUDE_PATHS'] =
|
|
217
|
+
"#{existing} \"${PODS_CONFIGURATION_BUILD_DIR}\""
|
|
218
|
+
puts "[ExpoMapboxNavigation] Added PODS_CONFIGURATION_BUILD_DIR to SWIFT_INCLUDE_PATHS (#{config.name})"
|
|
209
219
|
end
|
|
210
220
|
end
|
|
211
221
|
else
|
|
212
|
-
# Debug: print all available targets so we can fix the name if needed
|
|
213
222
|
puts '[ExpoMapboxNavigation] WARNING: ExpoMapboxNavigation target not found!'
|
|
214
223
|
puts '[ExpoMapboxNavigation] Available targets:'
|
|
215
224
|
pods_project.targets.each { |t| puts " - #{t.name}" }
|
|
216
225
|
end
|
|
217
226
|
pods_project.save
|
|
218
227
|
|
|
219
|
-
# ──
|
|
220
|
-
#
|
|
221
|
-
#
|
|
222
|
-
#
|
|
223
|
-
#
|
|
224
|
-
#
|
|
225
|
-
#
|
|
228
|
+
# ── Step 2: Register package reference in user_project (persists) ─────────
|
|
229
|
+
# Pods.xcodeproj is rebuilt every pod install — our Step 1 must survive via
|
|
230
|
+
# the workspace SPM graph. Registering the XCRemoteSwiftPackageReference in
|
|
231
|
+
# user_project (Navio.xcodeproj) ensures Xcode resolves the package into
|
|
232
|
+
# the workspace cache, making products available to Pods.xcodeproj targets.
|
|
233
|
+
# We do NOT add product dependencies to the app target — that caused
|
|
234
|
+
# "Multiple commands produce" in v2.2.8 (duplicate embed with @rnmapbox/maps).
|
|
235
|
+
installer.aggregate_targets.each do |agg|
|
|
236
|
+
user_project = agg.user_project
|
|
237
|
+
user_pkg = user_project.root_object.package_references.find { |p|
|
|
238
|
+
p.class == pkg_class && p.repositoryURL == url
|
|
239
|
+
}
|
|
240
|
+
unless user_pkg
|
|
241
|
+
user_pkg = user_project.new(pkg_class)
|
|
242
|
+
user_pkg.repositoryURL = url
|
|
243
|
+
user_pkg.requirement = requirement
|
|
244
|
+
user_project.root_object.package_references << user_pkg
|
|
245
|
+
puts "[ExpoMapboxNavigation] Registered package ref in #{user_project.path.basename}"
|
|
246
|
+
end
|
|
247
|
+
user_project.save
|
|
248
|
+
end
|
|
226
249
|
end
|
|
227
250
|
`;
|
|
228
251
|
|