-
Notifications
You must be signed in to change notification settings - Fork 336
/
Copy pathBUILD.bazel
159 lines (147 loc) · 4.66 KB
/
BUILD.bazel
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
load("@rules_motoko//motoko:defs.bzl", "motoko_binary", "motoko_library")
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
load("//bazel:candid.bzl", "did_git_test")
load("//bazel:canisters.bzl", "rust_canister")
load("//bazel:prost.bzl", "generated_files_check")
package(default_visibility = ["//visibility:public"])
exports_files([
"ledger.did",
"ledger_archive.did",
])
filegroup(
name = "protos",
srcs = glob(["proto/**"]),
)
rust_library(
name = "icp_ledger",
srcs = glob([
"src/**",
"gen/**",
]),
crate_name = "icp_ledger",
proc_macro_deps = [
"@crate_index//:prost-derive",
"@crate_index//:strum_macros",
],
version = "0.8.0",
deps = [
"//packages/ic-ledger-hash-of:ic_ledger_hash_of",
"//packages/icrc-ledger-types:icrc_ledger_types",
"//rs/crypto/sha2",
"//rs/rosetta-api/ledger_canister_core",
"//rs/rosetta-api/ledger_core",
"//rs/rust_canisters/dfn_core",
"//rs/rust_canisters/dfn_protobuf",
"//rs/rust_canisters/on_wire",
"//rs/types/base_types",
"@crate_index//:candid",
"@crate_index//:comparable",
"@crate_index//:crc32fast",
"@crate_index//:hex",
"@crate_index//:num-traits",
"@crate_index//:prost",
"@crate_index//:serde",
"@crate_index//:serde_bytes",
"@crate_index//:serde_cbor",
"@crate_index//:strum",
],
)
rust_test(
name = "icp_ledger_test",
crate = ":icp_ledger",
)
motoko_library(
name = "ledger_mo_lib",
srcs = ["wasm/Ledger.mo"],
)
motoko_binary(
name = "ledger_proxy",
entry = "wasm/Proxy.mo",
wasm_out = "ledger_proxy.wasm",
deps = [":ledger_mo_lib"],
)
rust_canister(
name = "test_notified_canister",
srcs = ["test/notified.rs"],
service_file = ":test/notified.did",
deps = [
":icp_ledger",
"//rs/rust_canisters/dfn_candid",
"//rs/rust_canisters/dfn_core",
"//rs/rust_canisters/dfn_protobuf",
"//rs/types/base_types",
"@crate_index//:lazy_static",
],
)
rust_test(
name = "ledger_canister_integration_test",
srcs = ["test/test.rs"],
data = [
"ledger.did",
"ledger_archive.did",
":ledger_proxy.wasm",
":test_notified_canister",
"//rs/canister_sandbox",
"//rs/canister_sandbox/sandbox_launcher",
"//rs/rosetta-api/icp_ledger/ledger:ledger-canister-wasm",
"//rs/rosetta-api/icp_ledger/ledger:ledger-canister-wasm-notify-method",
],
env = {
"CARGO_MANIFEST_DIR": "rs/rosetta-api/icp_ledger",
"LEDGER_CANISTER_WASM_PATH": "$(rootpath //rs/rosetta-api/icp_ledger/ledger:ledger-canister-wasm)",
"LEDGER_PROXY_WASM_PATH": "$(rootpath :ledger_proxy.wasm)",
"LEDGER_CANISTER_NOTIFY_METHOD_WASM_PATH": "$(rootpath //rs/rosetta-api/icp_ledger/ledger:ledger-canister-wasm-notify-method)",
"TEST_NOTIFIED_WASM_PATH": "$(rootpath :test_notified_canister)",
"LAUNCHER_BINARY": "$(rootpath //rs/canister_sandbox/sandbox_launcher)",
"SANDBOX_BINARY": "$(rootpath //rs/canister_sandbox)",
},
deps = [
":icp_ledger",
"//packages/ic-ledger-hash-of:ic_ledger_hash_of",
"//packages/icrc-ledger-types:icrc_ledger_types",
"//rs/canister_client/sender",
"//rs/rosetta-api/ledger_canister_core",
"//rs/rosetta-api/ledger_core",
"//rs/rust_canisters/canister_test",
"//rs/rust_canisters/dfn_candid",
"//rs/rust_canisters/dfn_protobuf",
"//rs/rust_canisters/http_types",
"//rs/rust_canisters/on_wire",
"//rs/types/base_types",
"@crate_index//:candid",
"@crate_index//:rand_0_8_4",
"@crate_index//:rand_chacha_0_3_1",
"@crate_index//:serde",
"@crate_index//:serde_bytes",
],
)
rust_test(
name = "protobuf_encoding_test",
srcs = ["test/protobuf_encoding.rs"],
deps = [
":icp_ledger",
"//packages/ic-ledger-hash-of:ic_ledger_hash_of",
"//rs/rosetta-api/ledger_core",
"//rs/rust_canisters/dfn_protobuf",
"@crate_index//:proptest",
"@crate_index//:serde_bytes",
],
)
did_git_test(
name = "ledger_did_git_test",
did = ":ledger.did",
)
generated_files_check(
name = "check_generated_files",
srcs = ["test/check_generated_files.rs"],
data = [
":protos",
"//rs/types/base_types:protos",
] + glob(["src/gen/**"]),
manifest_dir = "rs/rosetta-api/icp_ledger",
deps = [
"//rs/rosetta-api/icp_ledger/protobuf_generator:lib",
"//rs/test_utilities/compare_dirs",
"@crate_index//:tempfile",
],
)