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