@baeckerherz/expo-mapbox-navigation 0.1.21 → 0.1.22
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/ios/ExpoMapboxNavigation.podspec +5 -0
- package/package.json +1 -1
- package/plugin/build/index.js +4 -9
- package/plugin/build/withMapboxNavPodfile.d.ts +13 -9
- package/plugin/build/withMapboxNavPodfile.js +36 -10
- package/plugin/src/index.ts +4 -10
- package/plugin/src/withMapboxNavPodfile.ts +45 -10
|
@@ -24,4 +24,9 @@ Pod::Spec.new do |s|
|
|
|
24
24
|
'SWIFT_COMPILATION_MODE' => 'wholemodule',
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
# Mapbox Navigation SDK v3 binary xcframeworks must be linked by the app
|
|
28
|
+
# target (static pods can't link dynamic frameworks).
|
|
29
|
+
s.user_target_xcconfig = {
|
|
30
|
+
'OTHER_LDFLAGS' => '$(inherited) -framework "MapboxNavigationNative" -framework "MapboxCommon" -framework "MapboxCoreMaps"',
|
|
31
|
+
}
|
|
27
32
|
end
|
package/package.json
CHANGED
package/plugin/build/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
4
|
-
const withMapboxNavSPM_1 = require("./withMapboxNavSPM");
|
|
5
4
|
const withMapboxNavPodfile_1 = require("./withMapboxNavPodfile");
|
|
6
5
|
const withMapboxNavGradle_1 = require("./withMapboxNavGradle");
|
|
7
6
|
const withMapboxNavGradleProperties_1 = require("./withMapboxNavGradleProperties");
|
|
@@ -25,14 +24,10 @@ const withMapboxNavigation = (config, { mapboxAccessToken, mapboxSecretToken, na
|
|
|
25
24
|
config.ios.infoPlist.NSLocationAlwaysAndWhenInUseUsageDescription =
|
|
26
25
|
config.ios.infoPlist.NSLocationAlwaysAndWhenInUseUsageDescription ||
|
|
27
26
|
"This app needs your location for turn-by-turn navigation, including in the background.";
|
|
28
|
-
// iOS:
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
config = (0, withMapboxNavSPM_1.withMapboxNavSPM)(config, { navigationSdkVersion });
|
|
33
|
-
// iOS: Set framework search paths on the ExpoMapboxNavigation pod so it
|
|
34
|
-
// can find SPM-built modules (including PackageFrameworks directory).
|
|
35
|
-
config = (0, withMapboxNavPodfile_1.withMapboxNavPodfile)(config);
|
|
27
|
+
// iOS: Adds Mapbox Navigation SPM to the Pods project (single product dep
|
|
28
|
+
// to avoid duplicate xcframework signatures) and sets search paths so the
|
|
29
|
+
// ExpoMapboxNavigation pod can import all Mapbox modules.
|
|
30
|
+
config = (0, withMapboxNavPodfile_1.withMapboxNavPodfile)(config, { navigationSdkVersion });
|
|
36
31
|
// Android: Mapbox Maven repository and optional token for SDK download
|
|
37
32
|
config = (0, withMapboxNavGradle_1.withMapboxNavGradle)(config);
|
|
38
33
|
config = (0, withMapboxNavGradleProperties_1.withMapboxNavGradleProperties)(config, { mapboxSecretToken });
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { ConfigPlugin } from "@expo/config-plugins";
|
|
2
|
+
interface PodfileOptions {
|
|
3
|
+
navigationSdkVersion: string;
|
|
4
|
+
}
|
|
2
5
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* Injects a post_install hook that:
|
|
7
|
+
* 1. Adds Mapbox Navigation SDK as an SPM dependency in the Pods project,
|
|
8
|
+
* linking only MapboxNavigationUIKit to ExpoMapboxNavigation. Using a
|
|
9
|
+
* single top-level product avoids duplicate xcframework signature copies
|
|
10
|
+
* during archiving (MapboxCommon appears in multiple transitive chains).
|
|
11
|
+
* 2. Sets FRAMEWORK_SEARCH_PATHS / SWIFT_INCLUDE_PATHS so the pod can find
|
|
12
|
+
* all SPM-built modules (including transitive deps like MapboxDirections).
|
|
13
|
+
* 3. Enables BUILD_LIBRARY_FOR_DISTRIBUTION on Mapbox/Turf targets.
|
|
11
14
|
*/
|
|
12
|
-
export declare const withMapboxNavPodfile: ConfigPlugin
|
|
15
|
+
export declare const withMapboxNavPodfile: ConfigPlugin<PodfileOptions>;
|
|
16
|
+
export {};
|
|
@@ -37,25 +37,28 @@ exports.withMapboxNavPodfile = void 0;
|
|
|
37
37
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
38
38
|
const fs = __importStar(require("fs"));
|
|
39
39
|
const path = __importStar(require("path"));
|
|
40
|
+
const MAPBOX_NAV_URL = "https://github.com/mapbox/mapbox-navigation-ios.git";
|
|
40
41
|
const PLUGIN_MARKER = "# @baeckerherz/expo-mapbox-navigation:";
|
|
41
42
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
43
|
+
* Injects a post_install hook that:
|
|
44
|
+
* 1. Adds Mapbox Navigation SDK as an SPM dependency in the Pods project,
|
|
45
|
+
* linking only MapboxNavigationUIKit to ExpoMapboxNavigation. Using a
|
|
46
|
+
* single top-level product avoids duplicate xcframework signature copies
|
|
47
|
+
* during archiving (MapboxCommon appears in multiple transitive chains).
|
|
48
|
+
* 2. Sets FRAMEWORK_SEARCH_PATHS / SWIFT_INCLUDE_PATHS so the pod can find
|
|
49
|
+
* all SPM-built modules (including transitive deps like MapboxDirections).
|
|
50
|
+
* 3. Enables BUILD_LIBRARY_FOR_DISTRIBUTION on Mapbox/Turf targets.
|
|
50
51
|
*/
|
|
51
|
-
const withMapboxNavPodfile = (config) => {
|
|
52
|
+
const withMapboxNavPodfile = (config, { navigationSdkVersion }) => {
|
|
52
53
|
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
53
54
|
"ios",
|
|
54
55
|
async (config) => {
|
|
55
56
|
const podfilePath = path.join(config.modRequest.platformProjectRoot, "Podfile");
|
|
56
57
|
let contents = fs.readFileSync(podfilePath, "utf8");
|
|
58
|
+
const versionEscaped = navigationSdkVersion.replace(/'/g, "\\\\'");
|
|
57
59
|
const hook = `
|
|
58
|
-
${PLUGIN_MARKER}
|
|
60
|
+
${PLUGIN_MARKER} SPM in Pods + search paths + BUILD_LIBRARY_FOR_DISTRIBUTION
|
|
61
|
+
mapbox_nav_version = '${versionEscaped}'
|
|
59
62
|
installer.pods_project.targets.each do |target|
|
|
60
63
|
if target.name.start_with?('Mapbox') || target.name == 'Turf'
|
|
61
64
|
target.build_configurations.each do |cfg|
|
|
@@ -69,6 +72,29 @@ const withMapboxNavPodfile = (config) => {
|
|
|
69
72
|
cfg.build_settings['SWIFT_INCLUDE_PATHS'] = paths
|
|
70
73
|
end
|
|
71
74
|
end
|
|
75
|
+
end
|
|
76
|
+
emn_target = installer.pods_project.targets.find { |t| t.name == 'ExpoMapboxNavigation' }
|
|
77
|
+
if emn_target
|
|
78
|
+
project = installer.pods_project
|
|
79
|
+
root = project.root_object
|
|
80
|
+
pkg_ref = root.package_references&.find { |r| r.respond_to?(:repositoryURL) && r.repositoryURL == '${MAPBOX_NAV_URL}' }
|
|
81
|
+
unless pkg_ref
|
|
82
|
+
pkg_ref = project.new(Xcodeproj::Project::Object::XCRemoteSwiftPackageReference)
|
|
83
|
+
pkg_ref.repositoryURL = '${MAPBOX_NAV_URL}'
|
|
84
|
+
pkg_ref.requirement = { 'kind' => 'exactVersion', 'version' => mapbox_nav_version }
|
|
85
|
+
root.package_references << pkg_ref
|
|
86
|
+
end
|
|
87
|
+
unless emn_target.package_product_dependencies.any? { |d| d.product_name == 'MapboxNavigationUIKit' }
|
|
88
|
+
dep = project.new(Xcodeproj::Project::Object::XCSwiftPackageProductDependency)
|
|
89
|
+
dep.package = pkg_ref
|
|
90
|
+
dep.product_name = 'MapboxNavigationUIKit'
|
|
91
|
+
emn_target.package_product_dependencies << dep
|
|
92
|
+
if emn_target.frameworks_build_phases
|
|
93
|
+
bf = project.new(Xcodeproj::Project::Object::PBXBuildFile)
|
|
94
|
+
bf.product_ref = dep
|
|
95
|
+
emn_target.frameworks_build_phases.files << bf
|
|
96
|
+
end
|
|
97
|
+
end
|
|
72
98
|
end`;
|
|
73
99
|
const escapedMarker = PLUGIN_MARKER.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
74
100
|
// Remove any previously injected hook (handles upgrades from older plugin versions)
|
package/plugin/src/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ConfigPlugin, createRunOncePlugin } from "@expo/config-plugins";
|
|
2
|
-
import { withMapboxNavSPM } from "./withMapboxNavSPM";
|
|
3
2
|
import { withMapboxNavPodfile } from "./withMapboxNavPodfile";
|
|
4
3
|
import { withMapboxNavGradle } from "./withMapboxNavGradle";
|
|
5
4
|
import { withMapboxNavGradleProperties } from "./withMapboxNavGradleProperties";
|
|
@@ -44,15 +43,10 @@ const withMapboxNavigation: ConfigPlugin<PluginConfig> = (
|
|
|
44
43
|
config.ios.infoPlist.NSLocationAlwaysAndWhenInUseUsageDescription ||
|
|
45
44
|
"This app needs your location for turn-by-turn navigation, including in the background.";
|
|
46
45
|
|
|
47
|
-
// iOS:
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
config = withMapboxNavSPM(config, { navigationSdkVersion });
|
|
52
|
-
|
|
53
|
-
// iOS: Set framework search paths on the ExpoMapboxNavigation pod so it
|
|
54
|
-
// can find SPM-built modules (including PackageFrameworks directory).
|
|
55
|
-
config = withMapboxNavPodfile(config);
|
|
46
|
+
// iOS: Adds Mapbox Navigation SPM to the Pods project (single product dep
|
|
47
|
+
// to avoid duplicate xcframework signatures) and sets search paths so the
|
|
48
|
+
// ExpoMapboxNavigation pod can import all Mapbox modules.
|
|
49
|
+
config = withMapboxNavPodfile(config, { navigationSdkVersion });
|
|
56
50
|
|
|
57
51
|
// Android: Mapbox Maven repository and optional token for SDK download
|
|
58
52
|
config = withMapboxNavGradle(config);
|
|
@@ -2,19 +2,28 @@ import { withDangerousMod, ConfigPlugin } from "@expo/config-plugins";
|
|
|
2
2
|
import * as fs from "fs";
|
|
3
3
|
import * as path from "path";
|
|
4
4
|
|
|
5
|
+
const MAPBOX_NAV_URL = "https://github.com/mapbox/mapbox-navigation-ios.git";
|
|
6
|
+
|
|
5
7
|
const PLUGIN_MARKER = "# @baeckerherz/expo-mapbox-navigation:";
|
|
6
8
|
|
|
9
|
+
interface PodfileOptions {
|
|
10
|
+
navigationSdkVersion: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
7
13
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* Injects a post_install hook that:
|
|
15
|
+
* 1. Adds Mapbox Navigation SDK as an SPM dependency in the Pods project,
|
|
16
|
+
* linking only MapboxNavigationUIKit to ExpoMapboxNavigation. Using a
|
|
17
|
+
* single top-level product avoids duplicate xcframework signature copies
|
|
18
|
+
* during archiving (MapboxCommon appears in multiple transitive chains).
|
|
19
|
+
* 2. Sets FRAMEWORK_SEARCH_PATHS / SWIFT_INCLUDE_PATHS so the pod can find
|
|
20
|
+
* all SPM-built modules (including transitive deps like MapboxDirections).
|
|
21
|
+
* 3. Enables BUILD_LIBRARY_FOR_DISTRIBUTION on Mapbox/Turf targets.
|
|
16
22
|
*/
|
|
17
|
-
export const withMapboxNavPodfile: ConfigPlugin = (
|
|
23
|
+
export const withMapboxNavPodfile: ConfigPlugin<PodfileOptions> = (
|
|
24
|
+
config,
|
|
25
|
+
{ navigationSdkVersion }
|
|
26
|
+
) => {
|
|
18
27
|
return withDangerousMod(config, [
|
|
19
28
|
"ios",
|
|
20
29
|
async (config) => {
|
|
@@ -24,8 +33,11 @@ export const withMapboxNavPodfile: ConfigPlugin = (config) => {
|
|
|
24
33
|
);
|
|
25
34
|
let contents = fs.readFileSync(podfilePath, "utf8");
|
|
26
35
|
|
|
36
|
+
const versionEscaped = navigationSdkVersion.replace(/'/g, "\\\\'");
|
|
37
|
+
|
|
27
38
|
const hook = `
|
|
28
|
-
${PLUGIN_MARKER}
|
|
39
|
+
${PLUGIN_MARKER} SPM in Pods + search paths + BUILD_LIBRARY_FOR_DISTRIBUTION
|
|
40
|
+
mapbox_nav_version = '${versionEscaped}'
|
|
29
41
|
installer.pods_project.targets.each do |target|
|
|
30
42
|
if target.name.start_with?('Mapbox') || target.name == 'Turf'
|
|
31
43
|
target.build_configurations.each do |cfg|
|
|
@@ -39,6 +51,29 @@ export const withMapboxNavPodfile: ConfigPlugin = (config) => {
|
|
|
39
51
|
cfg.build_settings['SWIFT_INCLUDE_PATHS'] = paths
|
|
40
52
|
end
|
|
41
53
|
end
|
|
54
|
+
end
|
|
55
|
+
emn_target = installer.pods_project.targets.find { |t| t.name == 'ExpoMapboxNavigation' }
|
|
56
|
+
if emn_target
|
|
57
|
+
project = installer.pods_project
|
|
58
|
+
root = project.root_object
|
|
59
|
+
pkg_ref = root.package_references&.find { |r| r.respond_to?(:repositoryURL) && r.repositoryURL == '${MAPBOX_NAV_URL}' }
|
|
60
|
+
unless pkg_ref
|
|
61
|
+
pkg_ref = project.new(Xcodeproj::Project::Object::XCRemoteSwiftPackageReference)
|
|
62
|
+
pkg_ref.repositoryURL = '${MAPBOX_NAV_URL}'
|
|
63
|
+
pkg_ref.requirement = { 'kind' => 'exactVersion', 'version' => mapbox_nav_version }
|
|
64
|
+
root.package_references << pkg_ref
|
|
65
|
+
end
|
|
66
|
+
unless emn_target.package_product_dependencies.any? { |d| d.product_name == 'MapboxNavigationUIKit' }
|
|
67
|
+
dep = project.new(Xcodeproj::Project::Object::XCSwiftPackageProductDependency)
|
|
68
|
+
dep.package = pkg_ref
|
|
69
|
+
dep.product_name = 'MapboxNavigationUIKit'
|
|
70
|
+
emn_target.package_product_dependencies << dep
|
|
71
|
+
if emn_target.frameworks_build_phases
|
|
72
|
+
bf = project.new(Xcodeproj::Project::Object::PBXBuildFile)
|
|
73
|
+
bf.product_ref = dep
|
|
74
|
+
emn_target.frameworks_build_phases.files << bf
|
|
75
|
+
end
|
|
76
|
+
end
|
|
42
77
|
end`;
|
|
43
78
|
|
|
44
79
|
const escapedMarker = PLUGIN_MARKER.replace(
|