-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMODULE.bazel
More file actions
140 lines (122 loc) · 4.09 KB
/
Copy pathMODULE.bazel
File metadata and controls
140 lines (122 loc) · 4.09 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
"""
Bazel MODULE file for the DimensionalVariable project.
https://dv.alextac.com
"""
module(name = "dv")
# =============================================================================
# Import Bazel Dependencies
# =============================================================================
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "rules_rust", version = "0.67.0")
bazel_dep(name = "rules_cc", version = "0.2.8")
bazel_dep(name = "rules_python", version = "1.6.3")
bazel_dep(name = "rules_uv", version = "0.88.0")
bazel_dep(name = "aspect_rules_js", version = "2.6.0")
bazel_dep(name = "nlohmann_json", version = "3.11.3")
# =============================================================================
# Rust Setup
# =============================================================================
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(edition = "2024")
use_repo(rust, "rust_toolchains")
# Shared Rust crates for workspace tests/utilities
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
crate.spec(
package = "serde_json",
version = "1.0",
)
crate.spec(
package = "diplomat",
version = "0.14.0",
)
crate.spec(
package = "diplomat-runtime",
version = "0.14.0",
)
crate.spec(
package = "diplomat-tool",
version = "0.14.1",
)
crate.from_specs()
use_repo(crate, "crates")
# ==============================================================================
# C/C++ Setup
# ==============================================================================
# Hermetic C/C++ toolchains (LLVM/Clang)
bazel_dep(name = "toolchains_llvm", version = "1.5.0")
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain(
name = "llvm_toolchain",
llvm_version = "19.1.6",
)
use_repo(llvm, "llvm_toolchain")
# Register the LLVM cc toolchains so Bazel uses hermetic clang by default
register_toolchains(
"@llvm_toolchain//:all",
)
# ==============================================================================
# Python Setup
# ==============================================================================
# Register Python toolchains for supported wheel builds
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.defaults(
python_version = "3.12",
)
python.toolchain(
python_version = "3.10",
)
python.toolchain(
python_version = "3.11",
)
python.toolchain(
python_version = "3.12",
)
use_repo(
python,
"python_3_10",
"python_3_11",
"python_3_12",
)
# Set up pip dependencies
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pypi",
python_version = "3.12",
requirements_lock = "//:tools/requirements.txt",
)
pip.parse(
hub_name = "pypi_310",
python_version = "3.10",
requirements_lock = "//:tools/requirements.txt",
)
pip.parse(
hub_name = "pypi_311",
python_version = "3.11",
requirements_lock = "//:tools/requirements.txt",
)
pip.parse(
hub_name = "pypi_312",
python_version = "3.12",
requirements_lock = "//:tools/requirements.txt",
)
use_repo(pip, "pypi", "pypi_310", "pypi_311", "pypi_312")
# ==============================================================================
# JavaScript / Node.js Setup
# ==============================================================================
# Node.js version
# By default you get the node version from DEFAULT_NODE_VERSION in @rules_nodejs//nodejs:repositories.bzl
# Optionally you can pin a different node version:
bazel_dep(name = "rules_nodejs", version = "6.3.0")
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node", dev_dependency = True)
node.toolchain(node_version = "20.13.1")
# Set up npm and pnpm package managers
npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
npm.npm_translate_lock(
name = "npm",
pnpm_lock = "//docs:pnpm-lock.yaml",
)
use_repo(npm, "npm")
# Allows developers to use the matching pnpm version, for example:
# bazel run -- @pnpm --dir $PWD install
pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
use_repo(pnpm, "pnpm")