forked from quarylabs/sqruff
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMODULE.bazel
More file actions
120 lines (104 loc) · 3.8 KB
/
MODULE.bazel
File metadata and controls
120 lines (104 loc) · 3.8 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
"""Bazel module definition for sqruff."""
module(
name = "sqruff",
version = "0.0.0",
)
bazel_dep(name = "aspect_bazel_lib", version = "2.22.5")
# Platform-aware tool downloads (ratchet, cargo-machete, cargo-hack, uv)
tools = use_extension("//:tools.bzl", "tools")
use_repo(tools, "cargo_hack", "cargo_machete", "ratchet", "uv")
bazel_dep(name = "aspect_rules_js", version = "2.9.1")
bazel_dep(name = "rules_nodejs", version = "6.7.3")
bazel_dep(name = "rules_playwright", version = "0.5.3")
bazel_dep(name = "rules_python", version = "1.8.3")
# Python toolchain for hermetic Python builds (required by pyo3)
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
is_default = True,
python_version = "3.12",
)
use_repo(python, "python_3_12", "python_versions")
register_toolchains("@python_versions//:all")
bazel_dep(name = "aspect_rules_lint", version = "2.3.0")
bazel_dep(name = "rules_rust", version = "0.68.1")
bazel_dep(name = "rules_rust_wasm_bindgen", version = "0.68.1")
bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "rules_shellcheck", version = "0.4.0")
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
node.toolchain(node_version = "22.12.0")
npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
npm.npm_translate_lock(
name = "npm",
custom_postinstalls = {
# code-server's postinstall creates dangling symlinks in lib/vscode that
# Bazel rejects in tree artifacts. Remove them after install.
"code-server": "find . -type l ! -exec test -e {} \\; -delete 2>/dev/null || true",
},
data = [
"//:package.json",
"//:pnpm-workspace.yaml",
"//editors/code:package.json",
"//playground:package.json",
],
lifecycle_hooks_envs = {
"code-server": ["npm_config_user_agent=npm/10.0.0 node/v22.0.0"],
},
lifecycle_hooks_execution_requirements = {
"code-server": ["no-sandbox"],
},
pnpm_lock = "//:pnpm-lock.yaml",
)
use_repo(npm, "npm")
pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
pnpm.pnpm(
name = "pnpm",
pnpm_version = "10.0.0",
)
use_repo(pnpm, "pnpm")
# Playwright browsers for e2e testing
playwright = use_extension("@rules_playwright//playwright:extensions.bzl", "playwright")
playwright.repo(
name = "playwright",
playwright_version = "1.57.0",
)
use_repo(playwright, "playwright")
# Rust toolchain
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = "2024",
extra_target_triples = ["wasm32-unknown-unknown"],
versions = ["1.94.1"],
)
use_repo(rust, "rust_toolchains")
register_toolchains("@rust_toolchains//:all")
# Required for WASM cross-compilation
register_toolchains("@rules_rust//rust/private/dummy_cc_toolchain:dummy_cc_wasm32_toolchain")
# Crate universe - reads from Cargo.toml workspace
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
crate.from_cargo(
name = "crates",
cargo_lockfile = "//:Cargo.lock",
manifests = [
"//:Cargo.toml",
"//crates/cli:Cargo.toml",
"//crates/cli-lib:Cargo.toml",
"//crates/cli-python:Cargo.toml",
"//crates/lib:Cargo.toml",
"//crates/lib-core:Cargo.toml",
"//crates/lib-dialects:Cargo.toml",
"//crates/lib-wasm:Cargo.toml",
"//crates/lineage:Cargo.toml",
"//crates/lsp:Cargo.toml",
"//crates/sqlinference:Cargo.toml",
],
)
# Annotations for pyo3 crates - use Python toolchain for build scripts
crate.annotation(
build_script_toolchains = ["@rules_python//python:current_py_toolchain"],
crate = "pyo3-build-config",
)
crate.annotation(
build_script_toolchains = ["@rules_python//python:current_py_toolchain"],
crate = "pyo3-ffi",
)
use_repo(crate, "crates")