-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathPackage.swift
134 lines (129 loc) · 7.52 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// swift-tools-version: 6.0
import PackageDescription
let package = Package(
name: "swift-bitcoin",
platforms: [
.macOS(.v15),
.iOS(.v18),
.watchOS(.v11),
.tvOS(.v18),
.visionOS(.v2)
],
products: [
.library(name: "Bitcoin", targets: ["Bitcoin"]),
.library(name: "BitcoinRPC", targets: ["BitcoinRPC"]),
.library(name: "BitcoinTransport", targets: ["BitcoinTransport"]),
.library(name: "BitcoinBlockchain", targets: ["BitcoinBlockchain"]),
.library(name: "BitcoinPSBT", targets: ["BitcoinPSBT"]),
.library(name: "BitcoinWallet", targets: ["BitcoinWallet"]),
.library(name: "BitcoinBase", targets: ["BitcoinBase"]),
.library(name: "BitcoinCrypto", targets: ["BitcoinCrypto"]),
.executable(name: "bcnode", targets: ["BitcoinNode"]),
.executable(name: "bcutil", targets: ["BitcoinUtility"])
],
dependencies: [
.package(url: "https://github.com/swift-bitcoin/secp256k1", from: "0.0.0"),
.package(url: "https://github.com/swiftlang/swift-lmdb", branch: "main"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-system.git", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-collections", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-algorithms", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-async-algorithms", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-crypto.git", from: "3.0.0"),
.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.0.0"),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.0.0"),
.package(url: "https://github.com/apple/swift-nio-extras.git", from: "1.0.0"),
],
targets: [
// Exposed libraries
.target(name: "Bitcoin",
dependencies: ["BitcoinRPC", "BitcoinTransport", "BitcoinBlockchain", "BitcoinPSBT", "BitcoinWallet", "BitcoinBase", "BitcoinCrypto"],
path: "src/bitcoin"),
.target(name: "BitcoinRPC", dependencies: ["BitcoinTransport", "BitcoinBlockchain", "BitcoinPSBT", "BitcoinWallet", "BitcoinBase", "BitcoinCrypto", "JSONRPC"], path: "src/bitcoin-rpc"),
.target(
name: "BitcoinTransport",
dependencies: ["BitcoinBlockchain", "BitcoinBase", "BitcoinCrypto",
.product(name: "AsyncAlgorithms", package: "swift-async-algorithms")],
path: "src/bitcoin-transport"),
.target(
name: "BitcoinBlockchain",
dependencies: ["BitcoinBase", "BitcoinCrypto", "LMDB",
.product(name: "Atomics", package: "swift-atomics"),
.product(name: "Collections", package: "swift-collections"),
.product(name: "Algorithms", package: "swift-algorithms"),
.product(name: "AsyncAlgorithms", package: "swift-async-algorithms"),
.product(name: "Logging", package: "swift-log"),
.product(name: "_NIOFileSystem", package: "swift-nio")],
path: "src/bitcoin-blockchain"),
.target(
name: "BitcoinPSBT",
dependencies: ["BitcoinWallet", "BitcoinBase", "BitcoinCrypto"],
path: "src/bitcoin-psbt"),
.target(name: "BitcoinWallet", dependencies: ["BitcoinBase", "BitcoinCrypto"], path: "src/bitcoin-wallet"),
.target(name: "BitcoinBase", dependencies: ["BitcoinCrypto"], path: "src/bitcoin-base"),
.target(name: "BitcoinCrypto", dependencies: ["ECCHelper",
.product(name: "Crypto", package: "swift-crypto")],
path: "src/bitcoin-crypto"),
// Internal libraries
.target(
name: "NIOJSONRPC",
dependencies: [
"JSONRPC",
.product(name: "NIOCore", package: "swift-nio")],
path: "src/nio-json-rpc"),
.target(name: "JSONRPC", path: "src/json-rpc"),
.target(name: "LMDB", dependencies: [
.product(name: "CLMDB", package: "swift-lmdb"),
.product(name: "SystemPackage", package: "swift-system"),
], path: "src/lmdb"),
.target(name: "ECCHelper", dependencies: [.product(name: "LibSECP256k1", package: "secp256k1")], path: "src/ecc-helper"),
// Tests
.testTarget(name: "BitcoinTests", dependencies: ["Bitcoin"], path: "test/bitcoin"),
.testTarget(name: "BitcoinRPCTests", dependencies: ["BitcoinRPC"], path: "test/bitcoin-rpc"),
.testTarget(name: "BitcoinTransportTests", dependencies: ["BitcoinTransport", "BitcoinWallet"], path: "test/bitcoin-transport"),
.testTarget(name: "BitcoinBlockchainTests", dependencies: ["BitcoinBlockchain"], path: "test/bitcoin-blockchain"),
.testTarget(name: "BitcoinPSBTTests", dependencies: ["BitcoinPSBT", "BitcoinWallet", "BitcoinBase"], path: "test/bitcoin-psbt"),
.testTarget(name: "BitcoinWalletTests", dependencies: ["BitcoinWallet"], path: "test/bitcoin-wallet"),
.testTarget(name: "LMDBTests", dependencies: ["LMDB", "BitcoinCrypto"], path: "test/lmdb"),
.testTarget(name: "BitcoinCryptoTests", dependencies: ["BitcoinCrypto"], path: "test/bitcoin-crypto"),
.testTarget(name: "BitcoinBaseTests", dependencies: ["BitcoinBase"], path: "test/bitcoin-base",
resources: [.copy("data")]),
// Plugins
.plugin(
name: "GenerateContributors",
capability: .command(
intent: .custom(
verb: "generate-contributors",
description: "Generates the CONTRIBUTORS.txt file based on Git logs"),
permissions: [
.writeToPackageDirectory(reason: "This command write the new CONTRIBUTORS.txt to the source root.")
]
),
path: "plugin/generate-contributors"
),
// Executables
.executableTarget(
name: "BitcoinNode", dependencies: [
"BitcoinRPC", "BitcoinTransport", "BitcoinBlockchain", "BitcoinBase", "BitcoinCrypto", "NIOJSONRPC", "JSONRPC",
.product(name: "Logging", package: "swift-log"),
.product(name: "AsyncAlgorithms", package: "swift-async-algorithms"),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "ServiceLifecycle", package: "swift-service-lifecycle"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOPosix", package: "swift-nio"),
.product(name: "NIOFoundationCompat", package: "swift-nio"),
.product(name: "NIOExtras", package: "swift-nio-extras")],
path: "src/bitcoin-node"),
.executableTarget(
name: "BitcoinUtility", dependencies: [
"BitcoinTransport", "BitcoinBlockchain", "BitcoinWallet", "BitcoinBase", "BitcoinCrypto", "NIOJSONRPC", "JSONRPC",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOPosix", package: "swift-nio"),
.product(name: "NIOFoundationCompat", package: "swift-nio")],
path: "src/bitcoin-utility")
]
)