forked from zcash/zcash-swift-wallet-sdk
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathPackage.swift
More file actions
115 lines (108 loc) · 3.73 KB
/
Copy pathPackage.swift
File metadata and controls
115 lines (108 loc) · 3.73 KB
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
106
107
108
109
110
111
112
113
114
115
// swift-tools-version:5.6
import PackageDescription
import Foundation
// Automatically detect local FFI development mode.
// When LocalPackages/Package.swift exists (created by Scripts/init-local-ffi.sh),
// the SDK builds against the locally-built FFI instead of the pre-built binary
// from GitHub Releases. Run `rm -rf LocalPackages` to switch back.
let packageDir = URL(fileURLWithPath: #filePath).deletingLastPathComponent().path
let useLocalFFI = FileManager.default.fileExists(atPath: packageDir + "/LocalPackages/Package.swift")
var dependencies: [Package.Dependency] = [
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.24.2"),
.package(url: "https://github.com/stephencelis/SQLite.swift.git", from: "0.15.3")
]
var sdkDependencies: [Target.Dependency] = [
.product(name: "SQLite", package: "SQLite.swift"),
.product(name: "GRPC", package: "grpc-swift"),
]
var targets: [Target] = []
if useLocalFFI {
dependencies.append(.package(name: "libzcashlc", path: "LocalPackages"))
sdkDependencies.append(.product(name: "libzcashlc", package: "libzcashlc"))
} else {
// Binary target for the Rust FFI library
// Updated by Scripts/release.sh during the release process
targets.append(
.binaryTarget(
name: "libzcashlc",
url: "https://github.com/horizontalsystems/ZcashLightClientKit/releases/download/2.6.0-alpha.2-hs.1/libzcashlc.xcframework.zip",
checksum: "48a3df77a904be8519d6af6a0ddc4bc26bf086b29042d5c4a5261dab4cb44d42"
)
)
sdkDependencies.append("libzcashlc")
}
targets.append(contentsOf: [
.target(
name: "ZcashLightClientKit",
dependencies: sdkDependencies,
exclude: [
"Modules/Service/GRPC/ProtoBuf/proto/compact_formats.proto",
"Modules/Service/GRPC/ProtoBuf/proto/proposal.proto",
"Modules/Service/GRPC/ProtoBuf/proto/service.proto",
"Error/Sourcery/"
],
resources: [
.copy("Resources/checkpoints")
]
),
.target(
name: "TestUtils",
dependencies: ["ZcashLightClientKit"],
path: "Tests/TestUtils",
exclude: [
"proto/darkside.proto",
"Sourcery/AutoMockable.stencil",
"Sourcery/generateMocks.sh"
],
resources: [
.copy("Resources/test_data.db"),
.copy("Resources/cache.db"),
.copy("Resources/darkside_caches.db"),
.copy("Resources/darkside_data.db"),
.copy("Resources/sandblasted_mainnet_block.json"),
.copy("Resources/txBase64String.txt"),
.copy("Resources/txFromAndroidSDK.txt"),
.copy("Resources/integerOverflowJSON.json"),
.copy("Resources/sapling-spend.params"),
.copy("Resources/sapling-output.params")
]
),
.testTarget(
name: "OfflineTests",
dependencies: ["ZcashLightClientKit", "TestUtils"]
),
.testTarget(
name: "NetworkTests",
dependencies: ["ZcashLightClientKit", "TestUtils"]
),
.testTarget(
name: "DarksideTests",
dependencies: ["ZcashLightClientKit", "TestUtils"]
),
.testTarget(
name: "AliasDarksideTests",
dependencies: ["ZcashLightClientKit", "TestUtils"],
exclude: [
"scripts/"
]
),
.testTarget(
name: "PerformanceTests",
dependencies: ["ZcashLightClientKit", "TestUtils"]
)
])
let package = Package(
name: "ZcashLightClientKit",
platforms: [
.iOS(.v13),
.macOS(.v12)
],
products: [
.library(
name: "ZcashLightClientKit",
targets: ["ZcashLightClientKit"]
)
],
dependencies: dependencies,
targets: targets
)