-
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.9.0"
let navNativeVersion: Version = "322.0.0"
let version = "3.6.0"
let binaries = ["MapboxCoreMaps": "5606b8aaba97185c4b5774d63883e05459119199874446791a400a6bce1d171d",
"MapboxDirections": "09fd96b773dea415c84b0599c701a350fe2b37b80b80d51b5bf0b217f8014790",
"MapboxMaps": "28e065c35b37bb93b06be4bc486b2bef480547c36dd7c69d4d3c1b9da25de47c",
"MapboxNavigationCore": "75c694ce30f3fc27252ac8d13e518965384de47dfb6c01df07391e83827460f8",
"MapboxNavigationUIKit": "0c1f578b4c23061b178fb9d47dac54f2ee1e6d7c455fe7dfd62e7b6095a43946",
"_MapboxNavigationHelpers": "335187981b4b9138a9c6a2dbf1c72b703ed463b19de9db40df120ac597f9ee26",
]
let libraries = ["MapboxNavigationCustomRoute": "cca0f3631db548845c7da208f5482dc577f9c6c3eea273afed669301be2a40ea",
]
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"
)
}
}