forked from dfinity/ic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WORKSPACE.bazel
251 lines (191 loc) · 8.17 KB
/
WORKSPACE.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
workspace(
name = "ic",
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//bazel:mainnet-canisters.bzl", "canisters")
load("//third_party/jemalloc:repository.bzl", "jemalloc_repository")
load("//third_party/lmdb:repository.bzl", "lmdb_repository")
# We cannot derive the Bazel repository names (e.g. @mainnet_nns_registry_canister) directly
# from the canister names because we use inconsistent repo names. Same goes for filenames.
# For each new canister defined in the source JSON file (see `path`) a mapping can be added
# from canister name (as per JSON) to filename (and to repo name, resp.).
canisters(
name = "canisters",
filenames = {
"registry": "registry-canister.wasm.gz",
"governance": "governance-canister.wasm.gz",
"ledger": "ledger-canister_notify-method.wasm.gz",
"archive": "ledger-archive-node-canister.wasm.gz",
"index": "ic-icp-index-canister.wasm.gz",
"root": "root-canister.wasm.gz",
"lifeline": "lifeline_canister.wasm.gz",
"genesis-token": "genesis-token-canister.wasm.gz",
"cycles-minting": "cycles-minting-canister.wasm.gz",
"sns-wasm": "sns-wasm-canister.wasm.gz",
"ck_btc_archive": "ic-icrc1-archive.wasm.gz",
"ck_btc_ledger": "ic-icrc1-ledger.wasm.gz",
"ck_btc_index": "ic-icrc1-index-ng.wasm.gz",
"ck_eth_archive": "ic-icrc1-archive-u256.wasm.gz",
"ck_eth_ledger": "ic-icrc1-ledger-u256.wasm.gz",
"ck_eth_index": "ic-icrc1-index-ng-u256.wasm.gz",
"sns_root": "sns-root-canister.wasm.gz",
"sns_governance": "sns-governance-canister.wasm.gz",
"swap": "sns-swap-canister.wasm.gz",
"sns_ledger": "ic-icrc1-ledger.wasm.gz",
"sns_archive": "ic-icrc1-archive.wasm.gz",
"sns_index": "ic-icrc1-index-ng.wasm.gz",
},
path = "//:mainnet-canisters.json",
reponames = {
"registry": "mainnet_nns_registry_canister",
"governance": "mainnet_nns_governance_canister",
"ledger": "mainnet_icp_ledger_canister",
"archive": "mainnet_icp_ledger-archive-node-canister",
"index": "mainnet_icp_index_canister",
"root": "mainnet_nns_root-canister",
"lifeline": "mainnet_nns_lifeline_canister",
"genesis-token": "mainnet_nns_genesis-token-canister",
"cycles-minting": "mainnet_nns_cycles-minting-canister",
"sns-wasm": "mainnet_nns_sns-wasm-canister",
"ck_btc_archive": "mainnet_ckbtc_ic-icrc1-archive",
"ck_btc_ledger": "mainnet_ckbtc_ic-icrc1-ledger",
"ck_btc_index": "mainnet_ckbtc-index-ng",
"ck_eth_archive": "mainnet_cketh_ic-icrc1-archive-u256",
"ck_eth_ledger": "mainnet_cketh_ic-icrc1-ledger-u256",
"ck_eth_index": "mainnet_cketh-index-ng",
"sns_root": "mainnet_sns-root-canister",
"sns_governance": "mainnet_sns-governance-canister",
"swap": "mainnet_sns-swap-canister",
"sns_ledger": "mainnet_ic-icrc1-ledger",
"sns_archive": "mainnet_ic-icrc1-archive",
"sns_index": "mainnet_ic-icrc1-index-ng",
},
)
load("@canisters//:defs.bzl", "canister_deps")
canister_deps()
http_archive(
name = "aspect_rules_sol",
sha256 = "4e98a4572cd2c5f9e0a4118be3b8d2f0be148c80779ea9da646d0afabe2d609c",
strip_prefix = "rules_sol-0.1.0",
url = "https://github.com/aspect-build/rules_sol/releases/download/v0.1.0/rules_sol-v0.1.0.tar.gz",
)
load("@aspect_rules_sol//sol:repositories.bzl", "rules_sol_dependencies", "sol_register_toolchains")
rules_sol_dependencies()
sol_register_toolchains(
name = "solc",
sol_version = "0.8.18",
)
http_archive(
name = "rules_rust",
# Back-ported fix: https://github.com/bazelbuild/rules_rust/pull/2981
patch_args = ["-p1"],
patches = ["//bazel:rules_rust.patch"],
sha256 = "85e2013727ab26fb22abdffe4b2ac0c27a2d5b6296167ba63d8f6e13140f51f9",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.53.0/rules_rust-v0.53.0.tar.gz"],
)
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
load("@rules_rust//tools/rust_analyzer:deps.bzl", "rust_analyzer_dependencies")
rules_rust_dependencies()
rust_analyzer_dependencies()
rust_register_toolchains(
edition = "2021",
# The nightly version is required to compile fuzz tests from Bazel.
# The version below is chosen so that it is in sync with the non-nightly version.
versions = [
"1.82.0",
# Use the nightly version from the day before the branch.
# -
# NB! Due to a regression in the compiler https://github.com/rust-lang/rust/issues/128895, that's
# only back-ported to stable, we use a more recent version.
"nightly/2024-09-23",
],
)
load("//bazel:external_crates.bzl", "external_crates_repository")
load("//bazel/sanitizers_enabled_env:defs.bzl", "sanitizers_enabled_env")
sanitizers_enabled_env(name = "sanitizers_enabled_env")
load("@sanitizers_enabled_env//:defs.bzl", "SANITIZERS_ENABLED")
external_crates_repository(
name = "crate_index",
cargo_lockfile = "//:Cargo.Bazel.Fuzzing.toml.lock" if SANITIZERS_ENABLED else "//:Cargo.Bazel.toml.lock",
lockfile = "//:Cargo.Bazel.Fuzzing.json.lock" if SANITIZERS_ENABLED else "//:Cargo.Bazel.json.lock",
sanitizers_enabled = SANITIZERS_ENABLED,
)
load("@crate_index//:defs.bzl", "crate_repositories")
crate_repositories()
# Motoko support
http_archive(
name = "rules_motoko",
sha256 = "f7cb0a906c8efe9d2ad8d27f0f6ac11f6409a771d74874f7e47d45959063dfe3",
strip_prefix = "rules_motoko-0.2.1",
urls = ["https://github.com/dfinity/rules_motoko/archive/refs/tags/v0.2.1.tar.gz"],
)
load("@rules_motoko//motoko:repositories.bzl", "rules_motoko_dependencies")
rules_motoko_dependencies()
# Third party dependencies that require special treatment
lmdb_repository()
jemalloc_repository()
http_archive(
name = "buildifier_prebuilt",
sha256 = "72b5bb0853aac597cce6482ee6c62513318e7f2c0050bc7c319d75d03d8a3875",
strip_prefix = "buildifier-prebuilt-6.3.3",
urls = [
"http://github.com/keith/buildifier-prebuilt/archive/6.3.3.tar.gz",
],
)
load("@buildifier_prebuilt//:deps.bzl", "buildifier_prebuilt_deps")
buildifier_prebuilt_deps()
load("@buildifier_prebuilt//:defs.bzl", "buildifier_prebuilt_register_toolchains")
buildifier_prebuilt_register_toolchains()
# Rosetta CLI
load("//bazel:rosetta_cli.bzl", "rosetta_cli_repository")
rosetta_cli_repository(name = "rosetta-cli")
# Closure compiler for JavaScript
http_archive(
name = "io_bazel_rules_closure",
sha256 = "a3bef45d4d052adfd7b0146efdfe55989753adbb66e1f4fa4fa8c4f9df4f8196",
strip_prefix = "rules_closure-4326045ee6c941f12518a2ad5ad990504cf3df9d",
urls = [
"https://github.com/bazelbuild/rules_closure/archive/4326045ee6c941f12518a2ad5ad990504cf3df9d.zip",
],
)
load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_dependencies", "rules_closure_toolchains")
# we instruct rules_closure to omit some dependencies that we already
# pull via MODULE.bazel
rules_closure_dependencies(
omit_com_google_protobuf = True,
omit_rules_java = True,
omit_rules_proto = True,
)
rules_closure_toolchains()
# rclone binary for upload_artifacts
load("//bazel:rclone.bzl", "rclone_repository")
rclone_repository(name = "rclone")
# trivy binary for upload_artifacts
load("//bazel:trivy.bzl", "trivy_scan")
trivy_scan(name = "trivy")
# shfmt binary for fast shell formatting
load("//bazel:shfmt.bzl", "shfmt")
shfmt(name = "shfmt")
# ruff binary for fast python linting
load("//pre-commit:ruff.bzl", "ruff")
ruff(name = "ruff")
# ormolu binary for haskell linting
load("//pre-commit:ormolu.bzl", "ormolu")
ormolu(name = "ormolu")
# buf binary for protobuf linting
load("//pre-commit:buf.bzl", "buf")
buf(name = "buf")
# candid binary
load("//pre-commit:candid.bzl", "candid")
candid(name = "candid")
# dfx binary for haskell linting
load("//bazel:dfx.bzl", "dfx")
dfx(name = "dfx")
# sns-quill for SNS testing
load("//bazel:sns_quill.bzl", "sns_quill")
sns_quill(name = "sns_quill")
# idl2json for SNS testing
load("//bazel:idl2json.bzl", "idl_to_json")
idl_to_json(name = "idl2json")
load("//bazel:jq.bzl", "jq_repository")
jq_repository(name = "jq")