-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPackage.swift
52 lines (47 loc) · 1.5 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
// swift-tools-version: 5.5
import Foundation
import PackageDescription
let package = Package(
name: "ConcordiumWalletCrypto",
platforms: [
.iOS(.v13),
.macOS(.v10_15),
],
products: [
.library(
name: "ConcordiumWalletCrypto",
targets: ["ConcordiumWalletCrypto"]
),
],
targets: [
overridableFrameworkTarget(
name: "ConcordiumWalletCryptoUniffi",
url: "https://github.com/Concordium/concordium-wallet-crypto-swift/releases/download/build%2F5.0.0-0/ConcordiumWalletCryptoUniffi.xcframework.zip",
checksum: "98325c562e7e39499125c189052d4287b2b4d24d9d1401fd6f108ad2a128f306"
),
.target(
name: "ConcordiumWalletCrypto",
dependencies: [
.target(name: "ConcordiumWalletCryptoUniffi"),
]
),
]
)
func overridableFrameworkTarget(name: String, url: String, checksum: String) -> Target {
if let p = providedFrameworkPath(), !p.isEmpty {
return .binaryTarget(name: name, path: p)
}
return .binaryTarget(name: name, url: url, checksum: checksum)
}
func providedFrameworkPath() -> String? {
if let p = getEnv("CONCORDIUM_WALLET_CRYPTO_FRAMEWORK_PATH") {
return p
}
if let _ = getEnv("CONCORDIUM_WALLET_CRYPTO_PATH") {
return "./generated/ConcordiumWalletCryptoUniffi.xcframework"
}
return nil
}
func getEnv(_ key: String) -> String? {
ProcessInfo.processInfo.environment[key]
}