Repository navigation
Expand file tree
/
Copy pathMODULE.bazel
More file actions
235 lines (200 loc) · 8.73 KB
/
Copy pathMODULE.bazel
File metadata and controls
235 lines (200 loc) · 8.73 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
# MODULE.bazel defines the external dependencies used by bazel.
# ========================================
# Core Build Rules
# ========================================
bazel_dep(name = "rules_java", version = "9.6.1")
bazel_dep(name = "rules_scala", version = "7.0.0")
bazel_dep(name = "rules_proto", version = "7.0.2")
bazel_dep(name = "contrib_rules_jvm", version = "0.32.0")
bazel_dep(name = "rules_pkg", version = "0.7.0")
# Pin rules_pkg to 0.7.0 to match the internal Databricks build. protobuf requests 1.0.1, and
# bazel_dep only sets a minimum version, so the override is required.
single_version_override(
module_name = "rules_pkg",
version = "0.7.0",
)
# Use precompiled protoc rather than building it from source, which saves about 30 seconds on a
# new build. See
# https://github.com/bazel-contrib/rules_scala/tree/v7.0.0?tab=readme-ov-file#using-a-precompiled-protocol-compiler
# for more details.
register_toolchains(
"@rules_scala_protoc_toolchains//...:all",
dev_dependency = True,
)
scala_protoc = use_extension(
"@rules_scala//scala/extensions:protoc.bzl",
"scala_protoc",
dev_dependency = True,
)
use_repo(scala_protoc, "rules_scala_protoc_toolchains")
# Required for protocol compiler toolchainization. Pinned to 30.2 until resolution of
# protocolbuffers/protobuf#19679 (missing Python toolchain registration in earlier versions).
bazel_dep(name = "protobuf", version = "30.2")
single_version_override(
module_name = "protobuf",
patch_strip = 1,
patches = ["//bazel:protobuf.patch"],
version = "30.2",
)
# ========================================
# Scala Configuration
# ========================================
# Configure Scala version (2.12.20) and toolchain parameters.
# Scala 2.12 is used for compatibility with internal Databricks systems.
scala_config = use_extension(
"@rules_scala//scala/extensions:config.bzl",
"scala_config",
)
scala_config.settings(scala_version = "2.12.20")
# Configure Scala dependencies extension for toolchains and libraries.
scala_deps = use_extension(
"@rules_scala//scala/extensions:deps.bzl",
"scala_deps",
)
# Configure Scala proto generation with gRPC support and flat package structure.
scala_deps.scala_proto(
default_gen_opts = [
"grpc",
"flat_package",
],
)
# Reexport proto and gRPC-related dependencies from rules_scala.
use_repo(
scala_deps,
"com_google_protobuf_protobuf_java",
"scala_proto_rules_grpc_api",
"scala_proto_rules_grpc_netty",
"scala_proto_rules_grpc_stub",
"scala_proto_rules_netty_handler",
"scala_proto_rules_scalapb_runtime",
)
# Load default Scala toolchain (compiler and standard libraries).
scala_deps.scala()
# Enable ScalaTest toolchain for unit testing.
scala_deps.scalatest()
# Reexport ScalaTest dependencies for direct use in BUILD files.
use_repo(
scala_deps,
"io_bazel_rules_scala_scalactic",
"io_bazel_rules_scala_scalatest",
"io_bazel_rules_scala_scalatest_compatible",
"io_bazel_rules_scala_scalatest_core",
"io_bazel_rules_scala_scalatest_funsuite",
"io_bazel_rules_scala_scalatest_shouldmatchers",
)
# Declare the etcd extension for etcd binary distribution.
etcd_extension = use_extension("//bazel:etcd.bzl", "etcd_extension")
use_repo(etcd_extension, "etcd_release")
# ========================================
# Maven Dependencies
# ========================================
bazel_dep(name = "rules_jvm_external", version = "7.0")
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
artifacts = [
# Core utilities
"com.google.code.findbugs:jsr305:3.0.2",
"com.google.errorprone:error_prone_annotations:2.5.1",
"com.google.guava:guava:32.0.1-jre",
"com.typesafe:config:1.2.1",
"commons-io:commons-io:2.19.0",
"org.apache.commons:commons-math3:3.6.1",
"org.apache.hadoop:hadoop-common:3.4.1",
"org.scala-lang.modules:scala-collection-compat_2.12:2.11.0",
"org.scala-lang.modules:scala-java8-compat_2.12:0.9.1",
"org.scala-lang.modules:scala-xml_2.12:2.3.0",
"org.scala-lang:scala-reflect:2.12.20",
# Caching and utility libraries
"com.github.ben-manes.caffeine:caffeine:2.9.3",
"com.github.blemale:scaffeine_2.12:5.2.1",
"com.lihaoyi:geny_2.12:0.6.10",
"com.lihaoyi:mainargs_2.12:0.2.5",
"com.lihaoyi:os-lib_2.12:0.9.1",
"com.lihaoyi:sourcecode_2.12:0.3.1",
# Logging and monitoring
"com.typesafe.scala-logging:scala-logging_2.12:3.9.5",
"io.prometheus:simpleclient:0.16.0",
"io.prometheus:simpleclient_common:0.16.0",
"org.apache.logging.log4j:log4j-api:2.20.0",
"org.apache.logging.log4j:log4j-core:2.20.0",
"org.apache.logging.log4j:log4j-slf4j2-impl:2.20.0",
"org.slf4j:slf4j-api:2.0.9",
# JSON parsing (Jackson)
"com.fasterxml.jackson.core:jackson-core:2.17.2",
"com.fasterxml.jackson.core:jackson-databind:2.17.2",
"com.fasterxml.jackson.module:jackson-module-scala_2.12:2.17.2",
# JSON parsing (ujson and related libraries)
"com.lihaoyi:ujson_2.12:1.2.0",
"com.lihaoyi:upack_2.12:1.2.0",
"com.lihaoyi:upickle-core_2.12:1.2.0",
"com.lihaoyi:upickle_2.12:1.2.0",
# Kubernetes client
"com.squareup.okhttp3:okhttp:4.12.0",
"io.kubernetes:client-java:19.0.2",
"io.kubernetes:client-java-api:19.0.2",
"io.kubernetes:client-java-extended:19.0.2",
# etcd client (Jetcd - used for distributed coordination)
"io.etcd:jetcd-core:0.8.2",
"io.etcd:jetcd-grpc:0.8.2",
# Java test utilities
"org.assertj:assertj-core:3.24.2",
# OpenCensus ZPages (used for observability and debugging)
"com.lihaoyi:scalatags_2.12:0.13.1",
"io.opencensus:opencensus-contrib-grpc-metrics:0.31.1",
"io.opencensus:opencensus-contrib-zpages:0.31.1",
],
# Fail to build if the artifacts list above is updated without updating the lockfile.
fail_if_repin_required = True,
# Pin artifact versions and hashes using a lockfile.
lock_file = "//bazel:maven_install.json",
repositories = [
"https://repo1.maven.org/maven2",
],
# REQUIRED: Pin artifact versions to match internal Databricks compilation environment.
# Without this, rules_jvm_external resolves transitive dependency conflicts by selecting
# the latest version, which can cause incompatibilities with components that depend on
# specific library versions (e.g., Guava for Dicer).
version_conflict_policy = "pinned",
)
# Reexport `contrib_rules_jvm_deps` from `contrib_rules_jvm`, so that we use the same version of
# JUnit libraries.
use_repo(maven, "contrib_rules_jvm_deps", "maven")
# ========================================
# Rust Dependencies
# ========================================
RULES_RUST_VERSION = "0.70.0"
bazel_dep(name = "rules_rust", version = RULES_RUST_VERSION)
bazel_dep(name = "rules_rust_prost", version = RULES_RUST_VERSION)
single_version_override(
module_name = "rules_rust_prost",
patch_strip = 3,
patches = [
# Names each generated crate after its full label (`<package>_<name>`) rather than just the
# target name.
"//bazel:prost-crate-name.patch",
],
version = RULES_RUST_VERSION,
)
RUSTC_VERSION = "1.97.1"
RUSTFMT_VERSION = "nightly/2025-08-07"
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = "2024",
rust_analyzer_version = RUSTC_VERSION,
rustfmt_version = RUSTFMT_VERSION,
# rules_rust 0.70.0 predates 1.97.1, so it doesn't have its hashes built-in.
sha256s = {
"cargo-1.97.1-x86_64-unknown-linux-gnu.tar.xz": "e1be5f5ff7f7f80ca506fb65770b759edbdc6d303781ed71c5de8ec8a8394779",
"clippy-1.97.1-x86_64-unknown-linux-gnu.tar.xz": "3441df8fb54db985f8c8a3e8356b8874a3f92cc8cca8565cfe36f1dc15935e72",
"llvm-tools-1.97.1-x86_64-unknown-linux-gnu.tar.xz": "3e7a1c596a42dea6bf625ec6f006ce2fbcf5d1ff892f082828eb182a5d483b95",
"rust-analyzer-1.97.1-x86_64-unknown-linux-gnu.tar.xz": "4d6b6055bea92ed2b2e53a35577d9b43dd4d0c6234be72044d3097b7d3f16572",
"rust-src-1.97.1.tar.xz": "e9a1e616d04c6845895c827a178b9227f7c7199f3f4a80af81ab3aff7b80156b",
"rust-std-1.97.1-x86_64-unknown-linux-gnu.tar.xz": "1c1e704ae80126b7de34f72ea2825f7fd01736dec20732faed47374b95282fba",
"rustc-1.97.1-x86_64-unknown-linux-gnu.tar.xz": "9819d0a32d56bd339585319c80260e332779f5541fd66838ab7e016d6c814819",
},
versions = [RUSTC_VERSION],
)
register_toolchains("//bazel/toolchains/rust:prost_toolchain")
# Crate definitions live in bazel/rust_crates.MODULE.bazel to avoid polluting this file with all
# the crate dependencies.
include("//bazel:rust_crates.MODULE.bazel")