-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMODULE.bazel
More file actions
329 lines (293 loc) · 13.1 KB
/
Copy pathMODULE.bazel
File metadata and controls
329 lines (293 loc) · 13.1 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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
module(
name = "dashql",
version = "0.1.0",
)
# Rules for C/C++ (cc_library, cc_test, etc.)
bazel_dep(name = "rules_cc", version = "0.2.17")
# Emscripten SDK
bazel_dep(name = "emsdk", version = "5.0.5")
# Rules for Rust
bazel_dep(name = "rules_rust", version = "0.69.0")
# wasm-bindgen extension: provides rust_wasm_bindgen (Rust cdylib -> JS glue + .wasm) for
# the vendored UMAP crates (//packages/dashql-umap). Its default toolchain bundles
# wasm-bindgen-cli 0.2.105, which is why the vendored crates pin wasm-bindgen "=0.2.105"
# (the CLI and the crate must match exactly). The extension's own module extension +
# default_wasm_bindgen_toolchain registration are pulled in transitively.
bazel_dep(name = "rules_rust_wasm_bindgen", version = "0.69.0")
# Patch rules_rust to fix Rust coverage under Bazel 8/9: collect_coverage.sh
# explicitly clears RUNFILES_DIR before exec-ing the LCOV merger, which caused
# collect_coverage.rs to resolve the wrong test binary path and produce an empty
# coverage.dat. The patch derives the bin dir from COVERAGE_DIR instead.
single_version_override(
module_name = "rules_rust",
version = "0.69.0",
patches = ["//bazel/patches:rules_rust_collect_coverage_fix.patch"],
patch_strip = 1,
)
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "rules_foreign_cc", version = "0.15.1")
bazel_dep(name = "googletest", version = "1.18.0")
bazel_dep(name = "gflags", version = "2.3.1")
# JS/TS/Jest (aspect rules) — used by packages/dashql-core/api
bazel_dep(name = "aspect_bazel_lib", version = "2.22.5")
bazel_dep(name = "aspect_rules_js", version = "2.9.2")
bazel_dep(name = "aspect_rules_ts", version = "3.8.8")
bazel_dep(name = "aspect_rules_jest", version = "0.25.2")
bazel_dep(name = "rules_nodejs", version = "6.7.3")
bazel_dep(name = "rules_shell", version = "0.7.1")
bazel_dep(name = "rules_python", version = "1.9.0")
# OCI container image rules (packages/hyper-docker)
bazel_dep(name = "rules_oci", version = "2.3.0")
bazel_dep(name = "rules_pkg", version = "1.2.0")
# Node.js toolchain (for app_bundle postprocess script).
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
node.toolchain(node_version = "24.4.1")
use_repo(node, "nodejs_toolchains")
register_toolchains("@nodejs_toolchains//:all")
# Protobuf: proto_library (rules_proto) + custom plugins (rules_proto_grpc) for protoc + protoc-gen-es
bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "rules_proto_grpc", version = "5.8.0")
bazel_dep(name = "protobuf", version = "35.1")
# protobuf 34.1 -> rules_kotlin 2.2.2 -> rules_android 0.6.4.
# rules_android 0.6.4 has two issues on Bazel 9:
# 1. Its android_sdk_repository_extension creates an @androidsdk repo whose helper.bzl
# references @local_config_platform which is not visible in bzlmod (fixed in 0.7.1 by
# upgrading rules_cc + rules_java; see bazelbuild/rules_android#374).
# 2. It pulls in rules_go 0.51.0-rc2 which uses CcInfo as a built-in symbol removed in
# newer rules_cc (fixed in rules_go >= 0.52.0).
# Override both to latest stable versions.
single_version_override(
module_name = "rules_android",
version = "0.7.1",
)
single_version_override(
module_name = "rules_go",
version = "0.60.0",
)
# copy_to_directory toolchain (assemble src + FlatBuffer TS into one tree for SWC)
bazel_lib_toolchains = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains")
bazel_lib_toolchains.copy_to_directory()
use_repo(bazel_lib_toolchains, "copy_to_directory_toolchains")
register_toolchains("@copy_to_directory_toolchains//:all")
# npm deps from pnpm lockfile at repo root. Single source: root package.json + workspace packages; run "pnpm install" to update.
npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)
npm.npm_translate_lock(
name = "npm",
data = [
"//:package.json",
],
pnpm_lock = "//:pnpm-lock.yaml",
patches = {
"d3-brush@3.0.0": ["//bazel/patches:d3-brush@3.0.0.patch"],
},
patch_args = {
"d3-brush@3.0.0": ["-p1"],
},
verify_node_modules_ignored = "//:.bazelignore",
# Hoist platform-specific native binaries so they can be found via Node.js module resolution
# (traversing up to the root node_modules). In aspect_rules_js v3, optional platform packages
# are linked inside each package's store via select(), but the select() may not resolve in
# the exec configuration (ST-<hash>) used by js_run_binary. Hoisting ensures the packages
# are always available at the top-level node_modules for the CI platforms.
public_hoist_packages = {
# rolldown native binaries (used by Vite 8)
"@rolldown/binding-darwin-arm64": [""],
"@rolldown/binding-darwin-x64": [""],
"@rolldown/binding-linux-x64-gnu": [""],
"@rolldown/binding-linux-arm64-gnu": [""],
# lightningcss native binaries (used by Vite 8 for CSS minification)
"lightningcss-darwin-arm64": [""],
"lightningcss-darwin-x64": [""],
"lightningcss-linux-x64-gnu": [""],
"lightningcss-linux-arm64-gnu": [""],
},
)
use_repo(npm, "npm")
core_deps = use_extension("//bazel:core_dependencies.bzl", "dashql_core_dependencies")
use_repo(
core_deps,
"ankerl_unordered_dense",
"apache_arrow",
"binaryen",
"bison_src",
"c4core",
"com_google_benchmark",
"com_google_flatbuffers",
"duckdb_cli_linux_amd64",
"duckdb_cli_osx",
"duckdb_source",
"flex_src",
"m4_src",
"rapidjson",
"rapidyaml",
"wabt",
)
# data.dashql.app test datasets: one hash-pinned http_file per source, declared from
# the DATASETS list in //packages/dashql-data:datasets.bzl (single source of truth).
# When adding/removing a dataset source, update the use_repo list below to match.
dashql_datasets = use_extension("//packages/dashql-data:deps.bzl", "dashql_datasets")
use_repo(
dashql_datasets,
"dataset_vega_cars_cars",
# Vendored DuckDB tpch extension, one per exec platform (backs the tpch-* datasets).
"tpch_extension_linux_amd64",
"tpch_extension_linux_arm64",
"tpch_extension_osx_amd64",
"tpch_extension_osx_arm64",
)
# Emscripten binaries (downloaded per-platform; default version is the latest bundled with emsdk 5.0.4).
emsdk_ext = use_extension("@emsdk//:emscripten_deps.bzl", "emscripten_deps")
use_repo(
emsdk_ext,
"emscripten_bin_linux",
"emscripten_bin_linux_arm64",
"emscripten_bin_mac",
"emscripten_bin_mac_arm64",
)
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = "2021",
# Register both macOS target triples so the universal-binary slices
# (mac_app_aarch64 / mac_app_x86_64) can be cross-compiled regardless of the
# runner's host arch -- macos-15 runners are Apple Silicon (aarch64 host), so
# building the x86_64 slice is a cross-compile that needs x86_64-apple-darwin
# registered as a target toolchain.
# wasm32-unknown-unknown is the target for the vendored UMAP crates
# (//packages/dashql-umap), compiled to a cdylib and run through rust_wasm_bindgen.
extra_target_triples = [
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"wasm32-unknown-unknown",
],
versions = ["1.93.1"],
)
use_repo(rust, "rust_toolchains")
register_toolchains("@rust_toolchains//:all")
# App version (git describe -> version.env for Vite genrules in dashql-app).
app_version = use_extension("//packages/dashql-app:bazel/version.bzl", "dashql_app_version_ext")
use_repo(app_version, "dashql_app_version")
# Native crate universe (dashql-native, dashql-pack -- no WASM).
# Root workspace at Cargo.toml with members pointing downward into packages/.
# Run CARGO_BAZEL_REPIN=1 bazel build @crates//:all after changing root Cargo.toml or Cargo.lock.
# Native crate universe: aarch64 + x86_64 macOS (for universal binary) + Linux.
# After changing triples, repin: CARGO_BAZEL_REPIN=1 bazel build @crates//:all
native_crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate", isolate = True)
native_crate.from_cargo(
name = "crates",
cargo_lockfile = "//:Cargo.lock",
manifests = ["//:Cargo.toml"],
supported_platform_triples = [
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"x86_64-unknown-linux-gnu",
],
)
# WASM crate universe for the vendored UMAP crates (//packages/dashql-umap). Separate
# from the native "crates" universe (isolate = True) so its wasm-only deps
# (wasm-bindgen, js-sys, getrandom/wasm_js, ...) never leak into the native binaries,
# and pinned to the single wasm32-unknown-unknown triple.
# After changing packages/dashql-umap/Cargo.{toml,lock}, repin:
# CARGO_BAZEL_REPIN=1 bazel build @umap_crates//:all
wasm_crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate", isolate = True)
wasm_crate.from_cargo(
name = "umap_crates",
cargo_lockfile = "//packages/dashql-umap:Cargo.lock",
manifests = ["//packages/dashql-umap:Cargo.toml"],
# wasm32 is the actual compile target, but the host triples MUST also be listed:
# cargo build scripts (e.g. matrixmultiply's, via autocfg) run in the exec/host
# configuration, and crate_universe marks host-side helper crates
# @@platforms//:incompatible if no host triple is declared.
supported_platform_triples = [
"wasm32-unknown-unknown",
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"x86_64-unknown-linux-gnu",
],
)
use_repo(wasm_crate, "umap_crates")
# Tauri plugin crates that ship ACL permission TOML files.
# Update version suffixes in use_repo below when upgrading tauri plugin dependencies, then repin:
# CARGO_BAZEL_REPIN=1 bazel build @crates//:all
_TAURI_PLUGINS = [
"tauri-plugin-deep-link",
"tauri-plugin-dialog",
"tauri-plugin-fs",
"tauri-plugin-http",
"tauri-plugin-log",
"tauri-plugin-os",
"tauri-plugin-process",
"tauri-plugin-shell",
"tauri-plugin-updater",
]
# Filegroup added to every tauri plugin crate so tauri-aclgen can read
# permission TOML files as proper Bazel inputs (avoids sandbox path issues).
_TAURI_PERMISSION_FILEGROUP = """
filegroup(
name = "permission_files",
srcs = glob(["permissions/**/*.toml"]),
visibility = ["//visibility:public"],
)
"""
# Export permission TOML files from tauri plugin crates.
[native_crate.annotation(
crate = plugin_name,
additive_build_file_content = _TAURI_PERMISSION_FILEGROUP,
) for plugin_name in _TAURI_PLUGINS]
use_repo(
native_crate,
"crates",
# Individual plugin crate repos for permission file access by tauri-aclgen.
"crates__tauri-plugin-deep-link-2.4.9",
"crates__tauri-plugin-dialog-2.7.1",
"crates__tauri-plugin-fs-2.5.1",
"crates__tauri-plugin-http-2.5.9",
"crates__tauri-plugin-log-2.8.0",
"crates__tauri-plugin-os-2.3.2",
"crates__tauri-plugin-process-2.3.1",
"crates__tauri-plugin-shell-2.3.5",
"crates__tauri-plugin-updater-2.10.1",
)
# WASM build: use emscripten toolchain (standalone mode, same .wasm output as WASI SDK).
register_toolchains("@emsdk//emscripten_toolchain:all")
# Execution platforms: host first (default for non-wasm actions), then the neutral
# wasm_tool_exec platform used by wasm_tool exec groups in wasm_tools.bzl / rust_wasm.bzl.
# @platforms//host:host must come first so Bazel 9 (which now auto-selects the first
# registered exec platform whose toolchains all match) picks the host for regular targets
# like //proto/pb:ts_gen rather than wasm_tool_exec (which has no Node.js/shell toolchains).
register_execution_platforms(
"@platforms//host:host",
"//bazel/platforms:wasm_tool_exec",
)
# Pull ubi9-minimal base image for //packages/hyper-docker.
# Pin the digest for reproducible builds; update with:
# crane digest registry.access.redhat.com/ubi9/ubi-minimal:9.7-1773939694
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
oci.pull(
name = "ubi9_minimal",
image = "registry.access.redhat.com/ubi9/ubi-minimal:9.7-1773939694",
# renovate: depName=registry.access.redhat.com/ubi9/ubi-minimal
digest = "sha256:5b74fce9d6e629942a0c6dc0f546c193e70d7f974d999a48c948c53dd3d36362",
platforms = ["linux/amd64"],
)
use_repo(oci, "ubi9_minimal", "ubi9_minimal_linux_amd64")
# Native Tableau Hyper API C++ distributions for //packages/hyper-api and
# //packages/hyper-docker.
tableauhyperapi = use_extension("//bazel:external_tableauhyperapi.bzl", "tableauhyperapi_ext")
use_repo(
tableauhyperapi,
"tableauhyperapi_cxx_linux_x86_64",
"tableauhyperapi_cxx_macos_arm64",
"tableauhyperapi_cxx_macos_x86_64",
)
# hyperd Docker image: resolves the Linux x86_64 hyperd binary (C++ archive,
# or HYPERD_BINARY override) and the image repo_tag. See //packages/hyper-docker.
hyperd_image = use_extension("//packages/hyper-docker:version.bzl", "hyperd_image_ext")
use_repo(hyperd_image, "hyperd_image")
# Hedron's Compile Commands Extractor for Bazel
# https://github.com/hedronvision/bazel-compile-commands-extractor
bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
git_override(
module_name = "hedron_compile_commands",
commit = "7fe1eab26d2b8eeb5e1c6a2f38bddb001e3f9696",
remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git",
)