-
Notifications
You must be signed in to change notification settings - Fork 323
/
BUILD.bazel
174 lines (149 loc) · 4.72 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
load("@bazel_skylib//rules:common_settings.bzl", "string_setting")
load("@gazelle//:def.bzl", "gazelle")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
load("//bazel:json.bzl", "jq_dep")
package(default_visibility = ["//visibility:public"])
# WARNING! .git is the directory, not a regular file! only consume it in your rules if you know how exactly bazel works and understand implications!
exports_files([
".git",
".rclone.conf",
".rclone-anon.conf",
"buf.yaml",
"clippy.toml",
"rustfmt.toml",
"WORKSPACE.bazel",
"mainnet-canister-revisions.json",
])
jq_dep(
name = "mainnet_nns_subnet_revision",
json_path = ".subnets.\\\"tdb26-jop6k-aogll-7ltgs-eruif-6kk7m-qpktf-gdiqx-mxtrf-vb5e6-eqe\\\"",
source = "mainnet-subnet-revisions.json",
target = "mainnet_nns_subnet_revision.txt",
)
filegroup(
name = "mainnet_subnet_revisions",
srcs = ["mainnet-subnet-revisions.json"],
)
# bazel/workspace_status.sh will write the current timestamp to this file on every run to provade an input that always changes for some targets.
# The file does not have to and should not be committed, therefore will not exist on the first run on a clean source tree.
# Therefore glob is used to not fail when the file does not exist.
# buildifier: disable=constant-glob
filegroup(
name = "bazel-timestamp",
srcs = glob(["bazel-timestamp.txt"]),
)
alias(
name = "buildifier",
actual = "//bazel:buildifier",
)
alias(
name = "ruff-format",
actual = "//pre-commit:ruff-format",
)
alias(
name = "protobuf-format",
actual = "//pre-commit:protobuf-format",
)
alias(
name = "shfmt-format",
actual = "//pre-commit:shfmt-format",
)
alias(
name = "rustfmt",
actual = "@rules_rust//:rustfmt",
)
alias(
name = "ormolu-format",
actual = "//pre-commit:ormolu-format",
)
alias(
name = "gen_rust_project",
actual = "@rules_rust//tools/rust_analyzer:gen_rust_project",
)
# See https://github.com/bazelbuild/bazel-gazelle#running-gazelle-with-bazel
# gazelle:prefix github.com/dfinity/ic
# gazelle:proto disable
gazelle(
name = "gazelle",
)
gazelle(
name = "gazelle-update-repos",
args = [
"-from_file=go.mod",
"-to_macro=go_deps.bzl%go_dependencies",
"-prune",
],
command = "update-repos",
)
alias(
name = "gobin",
actual = "@rules_go//go",
visibility = ["//visibility:public"],
)
# Builds python dependencies. To update the lockfile:
# $ bazel run //:python-requirements.update
compile_pip_requirements(
name = "python-requirements",
timeout = "moderate",
src = "requirements.in",
requirements_txt = "requirements.txt",
)
test_suite(
name = "single_large_node", # the "_test" postfix is dropped on purpose since this target is meant for interactive use.
tags = ["manual"],
tests = ["//rs/tests/testnets:single_large_node"],
)
### Bitcoind
alias(
name = "bitcoind",
actual = select({
"@bazel_tools//src/conditions:darwin_arm64": "@bitcoin_core_darwin_arm64//:bitcoind",
"@bazel_tools//src/conditions:darwin_x86_64": "@bitcoin_core_darwin_x86//:bitcoind",
"@bazel_tools//src/conditions:linux_x86_64": "@bitcoin_core_linux_x86//:bitcoind",
}),
)
### Pocket IC
# The pocket-ic server binary. Use this as a test dependency if the test
# does not require a specific pocket-ic version (see ":pocket-ic-server-variant"
# for details).
# By default returns the pocket-ic server from the source tree to ensure
# consistency within the source tree. See 'pocket_ic_mainnet_test' for
# overrides.
alias(
name = "pocket-ic-server",
actual = select({
":pocket-ic-server-variant-mainnet": "//:pocket-ic-mainnet",
":pocket-ic-server-variant-head": "//rs/pocket_ic_server:pocket-ic-server",
"//conditions:default": "//rs/pocket_ic_server:pocket-ic-server",
}),
)
# A setting to switch between different variants of pocket-ic. The
# default pocket-ic variant/version (head) is the one as in the
# source tree.
string_setting(
name = "pocket-ic-server-variant",
build_setting_default = "head",
visibility = ["//visibility:public"],
)
config_setting(
name = "pocket-ic-server-variant-head",
flag_values = {
":pocket-ic-server-variant": "head",
},
)
# A "mainnet" variant of the pocket-ic server which represents a
# released version of pocket-ic.
config_setting(
name = "pocket-ic-server-variant-mainnet",
flag_values = {
":pocket-ic-server-variant": "mainnet",
},
)
# The pocket-ic as released; use this for tests that need to ensure consistency
# with a release pocket-ic/replica.
genrule(
name = "pocket-ic-mainnet",
srcs = ["@pocket-ic-mainnet-gz//file"],
outs = ["pocket-ic"],
cmd = "gunzip -c $< > $@",
)