-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMODULE.bazel
More file actions
287 lines (260 loc) · 10.7 KB
/
Copy pathMODULE.bazel
File metadata and controls
287 lines (260 loc) · 10.7 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
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# Copyright 2023 Aalyria Technologies, Inc., and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
module(name = "aalyria_api")
bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "protobuf", version = "31.1")
bazel_dep(name = "gazelle", version = "0.46.0")
bazel_dep(name = "googleapis", version = "0.0.0-20241220-5e258e33.bcr.1")
bazel_dep(name = "googleapis-python", version = "1.0.0")
bazel_dep(name = "googleapis-java", version = "1.0.0")
bazel_dep(name = "googleapis-cc", version = "1.0.0")
bazel_dep(name = "rules_cc", version = "0.2.16")
bazel_dep(name = "rules_go", version = "0.58.3")
bazel_dep(name = "rules_java", version = "8.15.1")
bazel_dep(name = "rules_jvm_external", version = "6.8")
bazel_dep(name = "rules_img", version = "0.3.4")
bazel_dep(name = "rules_pkg", version = "1.1.0")
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
bazel_dep(name = "rules_proto_grpc_cpp", version = "5.6.0")
bazel_dep(name = "rules_proto_grpc_doc", version = "5.6.0")
bazel_dep(name = "rules_proto_grpc_java", version = "5.6.0")
bazel_dep(name = "rules_proto_grpc_python", version = "5.6.0")
bazel_dep(name = "rules_python", version = "1.6.3")
bazel_dep(name = "rules_rs", version = "0.0.94")
bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "aspect_rules_py", version = "1.8.4")
bazel_dep(name = "toolchains_protoc", version = "0.4.3")
bazel_dep(name = "toolchains_llvm", version = "1.4.0")
# Patch protobuf v31.1 to fix constinit issue with zig-based hermetic toolchain.
# The issue: protobuf's GlobalEmptyStringConstexpr uses constinit with heap allocation,
# which is incompatible with zig's libc++ (similar to MSVC). This patch restores the
# MSVC guard that was present in earlier versions and extends it to cover zig toolchains.
# See: https://github.com/protocolbuffers/protobuf/issues/22065
single_version_override(
module_name = "protobuf",
patch_strip = 1,
patches = ["//patches:protobuf_v31_1_zig_constinit_fix.patch"],
version = "31.1",
)
# Patch c-ares v1.19.1 to fix RBE build with strict header checking.
# The issue: c-ares BUILD.bazel is missing include/ares_build.h in hdrs list,
# which causes undeclared inclusion errors when building with RBE without
# --remote_download_minimal flag.
single_version_override(
module_name = "c-ares",
patch_strip = 0,
patches = ["//patches:c-ares_1_19_1_rbe_headers.patch"],
version = "1.19.1",
)
# grpc is pulled in transitively by rules_proto_grpc_*. Pin and patch it to match
# the monorepo. The upb-gen include-shadowing patch drops grpc's committed
# upb-gen include dirs, which otherwise shadow protobuf's generated upb headers
# and cause "undeclared inclusion" failures under strict header checking (e.g.
# when compiling cygrpc). The rbe_xds patch supplies header deps needed for
# RBE + xDS builds.
single_version_override(
module_name = "grpc",
patch_strip = 0,
patches = [
"//patches:grpc_1_74_1_rbe_xds_headers.patch",
"//patches:grpc_1_74_1_upb_gen_include_shadowing.patch",
],
version = "1.74.1",
)
# Configure the protoc toolchain used by rules_proto_grpc to use protoc v31.1.
# This ensures that the version agrees with the protobuf dependency version,
# which is necessary because Protobuf C++ requires an exact match between its
# generated code version and its runtime version.
# (https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp)
protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc")
protoc.toolchain(
google_protobuf = "com_google_protobuf",
version = "v31.1",
)
bazel_dep(name = "container_structure_test", version = "1.16.0", dev_dependency = True)
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
artifacts = [
"com.google.code.gson:gson:2.13.2",
"com.google.googlejavaformat:google-java-format:1.31.0",
"com.google.guava:guava:33.5.0-jre",
"io.grpc:grpc-testing:1.76.0",
"io.helidon.grpc:helidon-grpc-core:3.2.5",
"junit:junit:4.13.2",
"org.bouncycastle:bcprov-jdk18on:1.82",
"org.mockito:mockito-core:4.5.1",
],
repositories = [
"https://repo.maven.apache.org/maven2/",
],
)
use_repo(maven, "maven")
# Hermetic C/C++ toolchain. Required under Bazel 8: the auto-detected host
# toolchain (@local_config_cc, registered transitively by rules_cc) yields no
# matching cc toolchain on a compiler-less CI runner, which breaks protobuf's
# cc selects during the OSS-export dry-run. The downloaded LLVM toolchain
# registers a resolvable cc toolchain independent of the host.
#
# LLVM versions and platforms:
# https://github.com/bazel-contrib/toolchains_llvm/blob/master/toolchain/internal/llvm_distributions.bzl
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain(
name = "llvm_toolchain",
llvm_version = "20.1.2",
)
use_repo(llvm, "llvm_toolchain", "llvm_toolchain_llvm")
register_toolchains("@llvm_toolchain//:all")
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(
version = "1.26.5",
)
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(
go_deps,
"com_github_deckarep_golang_set_v2",
"com_github_fullstorydev_grpcurl",
"com_github_golang_jwt_jwt_v5",
"com_github_google_go_cmp",
"com_github_google_uuid",
"com_github_gosnmp_gosnmp",
"com_github_gosuri_uiprogress",
"com_github_iancoleman_strcase",
"com_github_jhump_protoreflect",
"com_github_jonboulle_clockwork",
"com_github_mattn_go_isatty",
"com_github_prometheus_client_golang",
"com_github_prometheus_client_model",
"com_github_prometheus_prom2json",
"com_github_quic_go_quic_go",
"com_github_rs_zerolog",
"com_github_samber_lo",
"com_github_sourcegraph_conc",
"com_github_urfave_cli_v2",
"com_github_vishvananda_netlink",
"com_google_cloud_go",
"com_google_cloud_go_longrunning",
"io_opentelemetry_go_contrib_instrumentation_google_golang_org_grpc_otelgrpc",
"io_opentelemetry_go_otel",
"io_opentelemetry_go_otel_exporters_otlp_otlptrace_otlptracegrpc",
"io_opentelemetry_go_otel_sdk",
"io_opentelemetry_go_otel_trace",
"io_opentelemetry_go_proto_otlp",
"org_golang_google_genproto",
"org_golang_google_genproto_googleapis_api",
"org_golang_google_genproto_googleapis_rpc",
"org_golang_google_grpc",
"org_golang_google_protobuf",
"org_golang_x_net",
"org_golang_x_sync",
"org_golang_x_sys",
"org_golang_x_text",
)
switched_rules = use_extension("@googleapis//:extensions.bzl", "switched_rules")
switched_rules.use_languages(
cc = True,
java = True,
python = True,
)
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
is_default = True,
python_version = "3.11",
)
uv = use_extension("@aspect_rules_py//uv/unstable:extension.bzl", "uv")
uv.declare_hub(hub_name = "python_deps")
uv.declare_venv(
hub_name = "python_deps",
venv_name = "default",
)
uv.lockfile(
src = "//:uv.lock",
hub_name = "python_deps",
venv_name = "default",
)
use_repo(uv, "python_deps")
pull = use_repo_rule("@rules_img//img:pull.bzl", "pull")
pull(
name = "alpine_base",
# mirror.gcr.io/library/alpine:3.19.1 (pull-through cache for docker.io)
digest = "sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b", # 3.19.1 2024-01-26
layer_handling = "lazy",
registry = "mirror.gcr.io",
repository = "library/alpine",
)
RUST_EDITION = "2024"
RUST_VERSION = "1.94.1"
# rules_rs provides hermetic Rust toolchains and the patched rules_rust facade.
rs_toolchains = use_extension("@rules_rs//rs/toolchains:module_extension.bzl", "toolchains")
rs_toolchains.toolchain(
edition = RUST_EDITION,
# -Clink-self-contained=no: link with the registered cc toolchain's linker.
# rules_rs's rustc does not ship the self-contained linker (rust-lld) in its
# sysroot, so self-contained linking (the default) fails for tool/bin targets.
extra_exec_rustc_flags = {
"x86_64-unknown-linux-gnu": ["-Clink-self-contained=no"],
},
# Must match nmts/MODULE.bazel's toolchain tag exactly: rules_rs shares this
# tag across the module graph and rejects conflicting same-name tags.
extra_rustc_flags = {
"x86_64-unknown-linux-gnu": [
"-Clink-self-contained=no",
"-Ctarget-cpu=x86-64-v3",
],
},
version = RUST_VERSION,
)
use_repo(rs_toolchains, "default_rust_toolchains")
# Re-export the pinned, patched @rules_rust so existing @rules_rust// loads keep
# working. rules_rs bundles the prost extension under @rules_rust//extensions/prost.
rules_rust = use_extension("@rules_rs//rs:rules_rust.bzl", "rules_rust")
use_repo(rules_rust, "rules_rust")
register_toolchains("@default_rust_toolchains//:all")
register_toolchains(
"//api/build_tools/prost_toolchain",
)
# Rust crate dependencies via rules_rs crate_universe (from_cargo). The
# dependency set lives in Cargo.toml / Cargo.lock (rules_rs supports only
# from_cargo). The "st_" (spacetime) prefix keeps this hub distinct from the
# nmts submodule's crate hub: the crate extension is shared across the module
# graph, so two hubs of the same name would collide.
crate = use_extension("@rules_rs//rs:extensions.bzl", "crate")
crate.annotation(
crate = "protoc-gen-prost",
gen_binaries = ["protoc-gen-prost"],
)
crate.annotation(
crate = "protoc-gen-tonic",
gen_binaries = ["protoc-gen-tonic"],
)
crate.from_cargo(
name = "st_crates",
cargo_lock = "//:Cargo.lock",
cargo_toml = "//:Cargo.toml",
platform_triples = ["x86_64-unknown-linux-gnu"],
)
use_repo(crate, "st_crates")
bazel_dep(name = "org_outernetcouncil_nmts")
archive_override(
module_name = "org_outernetcouncil_nmts",
strip_prefix = "nmts-1.10.0",
urls = ["https://github.com/outernetcouncil/nmts/archive/refs/tags/v1.10.0.tar.gz"],
)
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "opentelemetry_proto",
build_file = "//third_party/opentelemetry:otel.BUILD",
strip_prefix = "opentelemetry-proto-main",
urls = ["https://github.com/open-telemetry/opentelemetry-proto/archive/main.zip"],
)