-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPackage.swift
105 lines (94 loc) · 3.74 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.11.0-rc.2"
let navNativeVersion: Version = "324.0.0-rc.2"
let version = "3.8.0-rc.1"
let binaries = ["MapboxCoreMaps": "443e69cf31445392cab6d2dd342b1a6282cb80a2cae375f8182035eae201c6ec",
"MapboxDirections": "ddb8c649c822f618b5ab744e17271973381ce0c693e92ae909a3ddbb4b0660c2",
"MapboxMaps": "905c81d8b3ce7e312c5615481a925ecf379d6cd691c6e08f6361bfabaf0e1dcd",
"MapboxNavigationCore": "a7ae43d9db497f0f71fb639c93bf99ff312a800a519eac1c60bf3794df066181",
"MapboxNavigationUIKit": "e92c2b0b1daf3e3c222231dc510d2dd60271e6e1ff231b23f2b7b565139df479",
"_MapboxNavigationHelpers": "23ff8059976e47e5c55679ab633850ec428a4fe20091a07000d0e056c72b42e6",
]
let libraries = ["MapboxNavigationCustomRoute": "716370d95f9743c6d40fff61c6906066e6e127a8c57c61439615fae984147150",
]
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"
)
}
}