-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPackage.swift
105 lines (94 loc) · 3.73 KB
/
Package.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let commonVersion: Version = "24.10.1"
let navNativeVersion: Version = "323.0.2"
let version = "3.7.1"
let binaries = ["MapboxCoreMaps": "531907f630e72c0f2be6e03ea40bf5ce5f65368832c59669865637b20e7009e0",
"MapboxDirections": "88fa1f463f76eb9e23ec42047ce180e1860a18c46c71e6d06c7ad7ee235e1c94",
"MapboxMaps": "8628bd7bdc788bd43c4352c40c02cf13e1452cd5b6e9351dbbfdc1990798a9a6",
"MapboxNavigationCore": "8ad31577bf8a4c9adaff1d912e75a58cc55749016fb6a06f216cc8fd27fb8e71",
"MapboxNavigationUIKit": "ee3ec2f87189120463bdf63dde6d73596be83a3791313c26b4c17ec8376a4f23",
"_MapboxNavigationHelpers": "44084743dc1e612231648ee67ffd140b3b10156b207605928847ce0ea3b0f435",
]
let libraries = ["MapboxNavigationCustomRoute": "ea95b13a54623b2bfb210a4d144f9b8cdb5317f71f685d1fa6adce06de50fa78",
]
enum FrameworkType {
case release
case staging
case local
}
let frameworkType: FrameworkType = .release
let package = Package(
name: "MapboxNavigation",
platforms: [.iOS(.v14)],
products: [
.library(
name: "MapboxNavigationCore",
targets: ["MapboxNavigationCoreWrapper"]
),
.library(
name: "MapboxNavigationUIKit",
targets: ["MapboxNavigationUIKitWrapper"]
),
.library(
name: "MapboxNavigationCustomRoute",
targets: ["MapboxNavigationCustomRouteWrapper"]
),
],
dependencies: [
.package(url: "https://github.com/mapbox/mapbox-common-ios.git", exact: commonVersion),
.package(url: "https://github.com/mapbox/mapbox-navigation-native-ios.git", exact: navNativeVersion),
],
targets: binaryTargets() + libraryTargets() + [
.target(
name: "MapboxNavigationCoreWrapper",
dependencies: binaries.keys.map { .byName(name: $0) } + [
.product(name: "MapboxCommon", package: "mapbox-common-ios"),
.product(name: "MapboxNavigationNative", package: "mapbox-navigation-native-ios"),
],
path: "Sources/.empty/MapboxNavigationCoreWrapper"
),
.target(
name: "MapboxNavigationUIKitWrapper",
dependencies: [
"MapboxNavigationCoreWrapper",
],
path: "Sources/.empty/MapboxNavigationUIKitWrapper"
),
.target(
name: "MapboxNavigationCustomRouteWrapper",
dependencies: libraries.keys.map { .byName(name: $0) } + [
"MapboxNavigationCoreWrapper",
],
path: "Sources/.empty/MapboxNavigationCustomRouteWrapper"
),
]
)
func binaryTargets() -> [Target] {
binaries.map { binaryName, checksum in
binaryTarget(binaryName: binaryName, checksum: checksum, packageName: "navsdk-v3-ios")
}
}
func libraryTargets() -> [Target] {
libraries.map { binaryName, checksum in
binaryTarget(binaryName: binaryName, checksum: checksum, packageName: "mapbox-navigation-custom-route-ios")
}
}
func binaryTarget(binaryName: String, checksum: String, packageName: String) -> Target {
switch frameworkType {
case .release, .staging:
let host = frameworkType == .release ? "api.mapbox.com" : "cloudfront-staging.tilestream.net"
return Target.binaryTarget(
name: binaryName,
url: "https://\(host)/downloads/v2/\(packageName)" +
"/releases/ios/packages/\(version)/\(binaryName).xcframework.zip",
checksum: checksum
)
case .local:
return Target.binaryTarget(
name: binaryName,
path: "XCFrameworks/\(binaryName).xcframework"
)
}
}