@baeckerherz/expo-mapbox-navigation 0.1.20 → 0.1.21
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/package.json
CHANGED
package/plugin/build/index.js
CHANGED
|
@@ -25,14 +25,14 @@ const withMapboxNavigation = (config, { mapboxAccessToken, mapboxSecretToken, na
|
|
|
25
25
|
config.ios.infoPlist.NSLocationAlwaysAndWhenInUseUsageDescription =
|
|
26
26
|
config.ios.infoPlist.NSLocationAlwaysAndWhenInUseUsageDescription ||
|
|
27
27
|
"This app needs your location for turn-by-turn navigation, including in the background.";
|
|
28
|
-
// iOS: Add Mapbox Navigation SPM to the app project
|
|
29
|
-
//
|
|
30
|
-
//
|
|
28
|
+
// iOS: Add Mapbox Navigation SPM to the app Xcode project. This is the
|
|
29
|
+
// single source of truth for SPM — handles resolution, linking, and
|
|
30
|
+
// embedding of all binary xcframeworks. Keeping SPM out of the Pods
|
|
31
|
+
// project avoids duplicate xcframework signatures during archiving.
|
|
31
32
|
config = (0, withMapboxNavSPM_1.withMapboxNavSPM)(config, { navigationSdkVersion });
|
|
32
|
-
// iOS:
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
config = (0, withMapboxNavPodfile_1.withMapboxNavPodfile)(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);
|
|
36
36
|
// Android: Mapbox Maven repository and optional token for SDK download
|
|
37
37
|
config = (0, withMapboxNavGradle_1.withMapboxNavGradle)(config);
|
|
38
38
|
config = (0, withMapboxNavGradleProperties_1.withMapboxNavGradleProperties)(config, { mapboxSecretToken });
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { ConfigPlugin } from "@expo/config-plugins";
|
|
2
|
-
interface PodfileOptions {
|
|
3
|
-
navigationSdkVersion: string;
|
|
4
|
-
}
|
|
5
2
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* 3. Enables BUILD_LIBRARY_FOR_DISTRIBUTION on Mapbox/Turf targets.
|
|
3
|
+
* Patches the Podfile post_install so ExpoMapboxNavigation can find
|
|
4
|
+
* SPM-built Mapbox frameworks (added to the app .xcodeproj by withMapboxNavSPM).
|
|
5
|
+
*
|
|
6
|
+
* Search paths cover all locations where SPM places built modules:
|
|
7
|
+
* - PackageFrameworks (SPM framework products)
|
|
8
|
+
* - BUILT_PRODUCTS_DIR and parent (loose modules and shared products)
|
|
9
|
+
*
|
|
10
|
+
* Also enables BUILD_LIBRARY_FOR_DISTRIBUTION on Mapbox/Turf pod targets.
|
|
15
11
|
*/
|
|
16
|
-
export declare const withMapboxNavPodfile: ConfigPlugin
|
|
17
|
-
export {};
|
|
12
|
+
export declare const withMapboxNavPodfile: ConfigPlugin;
|
|
@@ -37,33 +37,25 @@ 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";
|
|
41
|
-
const MAPBOX_NAV_PRODUCTS = [
|
|
42
|
-
"MapboxNavigationUIKit",
|
|
43
|
-
"MapboxNavigationCore",
|
|
44
|
-
];
|
|
45
40
|
const PLUGIN_MARKER = "# @baeckerherz/expo-mapbox-navigation:";
|
|
46
41
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* 3. Enables BUILD_LIBRARY_FOR_DISTRIBUTION on Mapbox/Turf targets.
|
|
42
|
+
* Patches the Podfile post_install so ExpoMapboxNavigation can find
|
|
43
|
+
* SPM-built Mapbox frameworks (added to the app .xcodeproj by withMapboxNavSPM).
|
|
44
|
+
*
|
|
45
|
+
* Search paths cover all locations where SPM places built modules:
|
|
46
|
+
* - PackageFrameworks (SPM framework products)
|
|
47
|
+
* - BUILT_PRODUCTS_DIR and parent (loose modules and shared products)
|
|
48
|
+
*
|
|
49
|
+
* Also enables BUILD_LIBRARY_FOR_DISTRIBUTION on Mapbox/Turf pod targets.
|
|
56
50
|
*/
|
|
57
|
-
const withMapboxNavPodfile = (config
|
|
51
|
+
const withMapboxNavPodfile = (config) => {
|
|
58
52
|
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
59
53
|
"ios",
|
|
60
54
|
async (config) => {
|
|
61
55
|
const podfilePath = path.join(config.modRequest.platformProjectRoot, "Podfile");
|
|
62
56
|
let contents = fs.readFileSync(podfilePath, "utf8");
|
|
63
|
-
const versionEscaped = navigationSdkVersion.replace(/'/g, "\\\\'");
|
|
64
57
|
const hook = `
|
|
65
|
-
${PLUGIN_MARKER}
|
|
66
|
-
mapbox_nav_version = '${versionEscaped}'
|
|
58
|
+
${PLUGIN_MARKER} framework search paths + BUILD_LIBRARY_FOR_DISTRIBUTION
|
|
67
59
|
installer.pods_project.targets.each do |target|
|
|
68
60
|
if target.name.start_with?('Mapbox') || target.name == 'Turf'
|
|
69
61
|
target.build_configurations.each do |cfg|
|
|
@@ -72,33 +64,11 @@ const withMapboxNavPodfile = (config, { navigationSdkVersion }) => {
|
|
|
72
64
|
end
|
|
73
65
|
if target.name == 'ExpoMapboxNavigation'
|
|
74
66
|
target.build_configurations.each do |cfg|
|
|
75
|
-
|
|
76
|
-
cfg.build_settings['FRAMEWORK_SEARCH_PATHS']
|
|
77
|
-
cfg.build_settings['
|
|
78
|
-
cfg.build_settings['SWIFT_INCLUDE_PATHS'] ||= ['$(inherited)']
|
|
79
|
-
cfg.build_settings['SWIFT_INCLUDE_PATHS'] << '$(BUILT_PRODUCTS_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)'
|
|
80
|
-
cfg.build_settings['SWIFT_INCLUDE_PATHS'] << '$(BUILT_PRODUCTS_DIR)/..'
|
|
67
|
+
paths = ['$(inherited)', '$(BUILT_PRODUCTS_DIR)/PackageFrameworks', '$(BUILT_PRODUCTS_DIR)/..', '$(BUILT_PRODUCTS_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)']
|
|
68
|
+
cfg.build_settings['FRAMEWORK_SEARCH_PATHS'] = paths
|
|
69
|
+
cfg.build_settings['SWIFT_INCLUDE_PATHS'] = paths
|
|
81
70
|
end
|
|
82
71
|
end
|
|
83
|
-
end
|
|
84
|
-
emn_target = installer.pods_project.targets.find { |t| t.name == 'ExpoMapboxNavigation' }
|
|
85
|
-
if emn_target
|
|
86
|
-
project = installer.pods_project
|
|
87
|
-
root = project.root_object
|
|
88
|
-
pkg_ref = root.package_references&.find { |r| r.respond_to?(:repositoryURL) && r.repositoryURL == '${MAPBOX_NAV_URL}' }
|
|
89
|
-
unless pkg_ref
|
|
90
|
-
pkg_ref = project.new(Xcodeproj::Project::Object::XCRemoteSwiftPackageReference)
|
|
91
|
-
pkg_ref.repositoryURL = '${MAPBOX_NAV_URL}'
|
|
92
|
-
pkg_ref.requirement = { 'kind' => 'exactVersion', 'version' => mapbox_nav_version }
|
|
93
|
-
root.package_references << pkg_ref
|
|
94
|
-
end
|
|
95
|
-
${MAPBOX_NAV_PRODUCTS.map((name) => `
|
|
96
|
-
unless emn_target.package_product_dependencies.any? { |d| d.product_name == '${name}' }
|
|
97
|
-
dep = project.new(Xcodeproj::Project::Object::XCSwiftPackageProductDependency)
|
|
98
|
-
dep.package = pkg_ref
|
|
99
|
-
dep.product_name = '${name}'
|
|
100
|
-
emn_target.package_product_dependencies << dep
|
|
101
|
-
end`).join("")}
|
|
102
72
|
end`;
|
|
103
73
|
const escapedMarker = PLUGIN_MARKER.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
104
74
|
// Remove any previously injected hook (handles upgrades from older plugin versions)
|
package/plugin/src/index.ts
CHANGED
|
@@ -44,15 +44,15 @@ const withMapboxNavigation: ConfigPlugin<PluginConfig> = (
|
|
|
44
44
|
config.ios.infoPlist.NSLocationAlwaysAndWhenInUseUsageDescription ||
|
|
45
45
|
"This app needs your location for turn-by-turn navigation, including in the background.";
|
|
46
46
|
|
|
47
|
-
// iOS: Add Mapbox Navigation SPM to the app project
|
|
48
|
-
//
|
|
49
|
-
//
|
|
47
|
+
// iOS: Add Mapbox Navigation SPM to the app Xcode project. This is the
|
|
48
|
+
// single source of truth for SPM — handles resolution, linking, and
|
|
49
|
+
// embedding of all binary xcframeworks. Keeping SPM out of the Pods
|
|
50
|
+
// project avoids duplicate xcframework signatures during archiving.
|
|
50
51
|
config = withMapboxNavSPM(config, { navigationSdkVersion });
|
|
51
52
|
|
|
52
|
-
// iOS:
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
config = withMapboxNavPodfile(config, { navigationSdkVersion });
|
|
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);
|
|
56
56
|
|
|
57
57
|
// Android: Mapbox Maven repository and optional token for SDK download
|
|
58
58
|
config = withMapboxNavGradle(config);
|
|
@@ -2,33 +2,19 @@ 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
|
-
const MAPBOX_NAV_PRODUCTS = [
|
|
7
|
-
"MapboxNavigationUIKit",
|
|
8
|
-
"MapboxNavigationCore",
|
|
9
|
-
];
|
|
10
|
-
|
|
11
5
|
const PLUGIN_MARKER = "# @baeckerherz/expo-mapbox-navigation:";
|
|
12
6
|
|
|
13
|
-
interface PodfileOptions {
|
|
14
|
-
navigationSdkVersion: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
7
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* 3. Enables BUILD_LIBRARY_FOR_DISTRIBUTION on Mapbox/Turf targets.
|
|
8
|
+
* Patches the Podfile post_install so ExpoMapboxNavigation can find
|
|
9
|
+
* SPM-built Mapbox frameworks (added to the app .xcodeproj by withMapboxNavSPM).
|
|
10
|
+
*
|
|
11
|
+
* Search paths cover all locations where SPM places built modules:
|
|
12
|
+
* - PackageFrameworks (SPM framework products)
|
|
13
|
+
* - BUILT_PRODUCTS_DIR and parent (loose modules and shared products)
|
|
14
|
+
*
|
|
15
|
+
* Also enables BUILD_LIBRARY_FOR_DISTRIBUTION on Mapbox/Turf pod targets.
|
|
27
16
|
*/
|
|
28
|
-
export const withMapboxNavPodfile: ConfigPlugin
|
|
29
|
-
config,
|
|
30
|
-
{ navigationSdkVersion }
|
|
31
|
-
) => {
|
|
17
|
+
export const withMapboxNavPodfile: ConfigPlugin = (config) => {
|
|
32
18
|
return withDangerousMod(config, [
|
|
33
19
|
"ios",
|
|
34
20
|
async (config) => {
|
|
@@ -38,11 +24,8 @@ export const withMapboxNavPodfile: ConfigPlugin<PodfileOptions> = (
|
|
|
38
24
|
);
|
|
39
25
|
let contents = fs.readFileSync(podfilePath, "utf8");
|
|
40
26
|
|
|
41
|
-
const versionEscaped = navigationSdkVersion.replace(/'/g, "\\\\'");
|
|
42
|
-
|
|
43
27
|
const hook = `
|
|
44
|
-
${PLUGIN_MARKER}
|
|
45
|
-
mapbox_nav_version = '${versionEscaped}'
|
|
28
|
+
${PLUGIN_MARKER} framework search paths + BUILD_LIBRARY_FOR_DISTRIBUTION
|
|
46
29
|
installer.pods_project.targets.each do |target|
|
|
47
30
|
if target.name.start_with?('Mapbox') || target.name == 'Turf'
|
|
48
31
|
target.build_configurations.each do |cfg|
|
|
@@ -51,35 +34,11 @@ export const withMapboxNavPodfile: ConfigPlugin<PodfileOptions> = (
|
|
|
51
34
|
end
|
|
52
35
|
if target.name == 'ExpoMapboxNavigation'
|
|
53
36
|
target.build_configurations.each do |cfg|
|
|
54
|
-
|
|
55
|
-
cfg.build_settings['FRAMEWORK_SEARCH_PATHS']
|
|
56
|
-
cfg.build_settings['
|
|
57
|
-
cfg.build_settings['SWIFT_INCLUDE_PATHS'] ||= ['$(inherited)']
|
|
58
|
-
cfg.build_settings['SWIFT_INCLUDE_PATHS'] << '$(BUILT_PRODUCTS_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)'
|
|
59
|
-
cfg.build_settings['SWIFT_INCLUDE_PATHS'] << '$(BUILT_PRODUCTS_DIR)/..'
|
|
37
|
+
paths = ['$(inherited)', '$(BUILT_PRODUCTS_DIR)/PackageFrameworks', '$(BUILT_PRODUCTS_DIR)/..', '$(BUILT_PRODUCTS_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)']
|
|
38
|
+
cfg.build_settings['FRAMEWORK_SEARCH_PATHS'] = paths
|
|
39
|
+
cfg.build_settings['SWIFT_INCLUDE_PATHS'] = paths
|
|
60
40
|
end
|
|
61
41
|
end
|
|
62
|
-
end
|
|
63
|
-
emn_target = installer.pods_project.targets.find { |t| t.name == 'ExpoMapboxNavigation' }
|
|
64
|
-
if emn_target
|
|
65
|
-
project = installer.pods_project
|
|
66
|
-
root = project.root_object
|
|
67
|
-
pkg_ref = root.package_references&.find { |r| r.respond_to?(:repositoryURL) && r.repositoryURL == '${MAPBOX_NAV_URL}' }
|
|
68
|
-
unless pkg_ref
|
|
69
|
-
pkg_ref = project.new(Xcodeproj::Project::Object::XCRemoteSwiftPackageReference)
|
|
70
|
-
pkg_ref.repositoryURL = '${MAPBOX_NAV_URL}'
|
|
71
|
-
pkg_ref.requirement = { 'kind' => 'exactVersion', 'version' => mapbox_nav_version }
|
|
72
|
-
root.package_references << pkg_ref
|
|
73
|
-
end
|
|
74
|
-
${MAPBOX_NAV_PRODUCTS.map(
|
|
75
|
-
(name) => `
|
|
76
|
-
unless emn_target.package_product_dependencies.any? { |d| d.product_name == '${name}' }
|
|
77
|
-
dep = project.new(Xcodeproj::Project::Object::XCSwiftPackageProductDependency)
|
|
78
|
-
dep.package = pkg_ref
|
|
79
|
-
dep.product_name = '${name}'
|
|
80
|
-
emn_target.package_product_dependencies << dep
|
|
81
|
-
end`
|
|
82
|
-
).join("")}
|
|
83
42
|
end`;
|
|
84
43
|
|
|
85
44
|
const escapedMarker = PLUGIN_MARKER.replace(
|