-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMODULE.bazel
More file actions
287 lines (257 loc) · 11.6 KB
/
Copy pathMODULE.bazel
File metadata and controls
287 lines (257 loc) · 11.6 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
"""bzlmod wrapper around the FastSlide library.
Consumers reference targets as `@fastslide//:fastslide_lib`,
`@fastslide//python:fastslide`, etc. Wired into the aiforoncology monorepo via
local_path_override.
"""
module(
name = "fastslide",
version = "0.8.1",
)
bazel_dep(name = "rules_cc", version = "0.2.17")
bazel_dep(name = "platforms", version = "1.1.0")
bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_pkg", version = "1.1.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.22.5")
bazel_dep(name = "rules_multirun", version = "0.13.0")
bazel_dep(name = "googletest", version = "1.17.0")
bazel_dep(name = "google_benchmark", version = "1.9.2")
bazel_dep(name = "zlib", version = "1.3.1.bcr.5")
bazel_dep(name = "zstd", version = "1.5.7")
bazel_dep(name = "libjpeg_turbo", version = "2.1.91")
bazel_dep(name = "nlohmann_json", version = "3.11.3.bcr.1")
# aifocore-cpp is not on the Bazel Central Registry. In the monorepo this
# bazel_dep is satisfied by the root module's local_path_override; the
# git_override below is silently ignored in that context (Bazel only honors
# *_override directives in the root module). When this MODULE.bazel is the
# root (i.e. the standalone NKI-AI/aifocore checkout), the git_override
# resolves the dep from GitHub instead.
bazel_dep(name = "aifocore-cpp", version = "0.0.1")
git_override(
module_name = "aifocore-cpp",
commit = "e09db7a3b6ee6decb84b08e22080158012b15a46",
remote = "https://github.com/NKI-AI/aifocore.git",
)
# jpeg-compressor is not on the Bazel Central Registry. In the monorepo this
# bazel_dep is satisfied by the root module's local_path_override; the
# git_override below is silently ignored in that context (Bazel only honors
# *_override directives in the root module). When this MODULE.bazel is the
# root (i.e. the standalone NKI-AI/jpeg-compressor checkout), the git_override
# resolves the dep from GitHub instead.
bazel_dep(name = "jpeg-compressor", version = "0.0.1")
git_override(
module_name = "jpeg-compressor",
commit = "927f759d349b7ce2588d50465d719c42011ccb4b",
remote = "https://github.com/NKI-AI/jpeg-compressor.git",
)
# simpletiff is not on the Bazel Central Registry. In the monorepo this
# bazel_dep is satisfied by the root module's local_path_override; the
# git_override below is silently ignored in that context (Bazel only honors
# *_override directives in the root module). When this MODULE.bazel is the
# root (i.e. the standalone NKI-AI/simpletiff checkout), the git_override
# resolves the dep from GitHub instead.
bazel_dep(name = "simpletiff", version = "0.0.1")
git_override(
module_name = "simpletiff",
commit = "babc4f958b60f493f3d5092cbd4a11af350ea6fa",
remote = "https://github.com/NKI-AI/simpletiff.git",
)
# jxrlib is available on github, but does not have a Bazel entry,
# and we have some compile errors we have fixed, therefore we
# have a custom version.
bazel_dep(name = "jxrlib", version = "1.1.0")
git_override(
module_name = "jxrlib",
commit = "7632349d973656c773f7ecb45325390f463bc92a",
remote = "https://github.com/NKI-AI/jxrlib.git",
)
bazel_dep(name = "nanobind_bazel", version = "2.12.0")
bazel_dep(name = "rules_python", version = "2.0.0")
bazel_dep(name = "aspect_rules_py", version = "1.11.5")
bazel_dep(name = "emsdk", version = "5.0.4")
bazel_dep(name = "rules_go", version = "0.60.0")
bazel_dep(name = "gazelle", version = "0.43.0")
bazel_dep(name = "rules_java", version = "9.6.1")
bazel_dep(name = "rules_doxygen", version = "2.5.0")
bazel_dep(name = "rules_uv", version = "0.89.2")
bazel_dep(name = "sphinxdocs", version = "2.0.1")
# Rust bindings (rust/fastslide, rust/fastslide-sys).
#
# `rules_rs` is a regular dependency so the BUILD files under `rust/` can load
# the rule definitions in both the aiforoncology monorepo (where fastslide is a
# non-root dependency) and the standalone fastslide checkout. The Rust toolchain
# itself is registered as a dev_dependency: it is active only when fastslide is
# the root module (standalone build). Inside the monorepo the root module already
# provisions and registers a Rust toolchain, so registering here too would be
# redundant.
bazel_dep(name = "rules_rs", version = "0.0.76")
# Standalone-only: patch rules_rust to drop its hermetic macOS SDKROOT
# injection, which since rules_rs 0.0.76 collides with apple_support's
# cc_toolchain and crashes Bazel on macOS
# (https://github.com/bazelbuild/bazel/issues/25438). dev_dependency so it is
# applied only when fastslide is the root module (standalone build); in the
# aiforoncology monorepo the root module already applies the equivalent patch
# (patches from non-root modules are ignored by Bazel regardless).
rules_rust = use_extension(
"@rules_rs//rs:rules_rust.bzl",
"rules_rust",
dev_dependency = True,
)
rules_rust.patch(
patches = ["//third_party:rules_rust_no_macos_sdkroot.patch"],
strip = 1,
)
use_repo(rules_rust, "rules_rust")
rust_toolchains = use_extension(
"@rules_rs//rs/toolchains:module_extension.bzl",
"toolchains",
dev_dependency = True,
)
rust_toolchains.toolchain(
edition = "2024",
version = "1.88.0",
)
use_repo(rust_toolchains, "default_rust_toolchains")
register_toolchains(
"@default_rust_toolchains//:all",
dev_dependency = True,
)
# Formatter-only deps. Marked dev_dependency so they are active only when
# fastslide is the root module (standalone repo). In a larger workspace such as
# the aiforoncology monorepo, fastslide is a non-root dependency, dev deps are
# ignored, and the host workspace supplies its own formatter. This also avoids
# the `toolchains_llvm` `llvm` extension (root-module-only) failing module
# resolution when fastslide is consumed as a dependency.
bazel_dep(name = "aspect_rules_lint", version = "2.3.0", dev_dependency = True)
bazel_dep(name = "aspect_rules_js", version = "2.9.2", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "8.0.3", dev_dependency = True)
bazel_dep(name = "toolchains_llvm", version = "1.7.0", dev_dependency = True)
# The Python bindings ship two wheels: a stable-ABI (abi3) wheel built against
# 3.12 that runs on every CPython >= 3.12, plus a version-specific cp311 wheel
# for the one release still predating the stable-ABI floor. 3.12 is the default
# toolchain; 3.11 is registered only so the cp311 wheel's transition can resolve.
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
is_default = True,
python_version = "3.12",
)
python.toolchain(python_version = "3.11")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
enable_implicit_namespace_pkgs = True,
hub_name = "fastslide_pip",
python_version = "3.12",
requirements_darwin = "//:requirements_darwin.txt",
requirements_lock = "//:requirements_linux.txt",
)
pip.parse(
enable_implicit_namespace_pkgs = True,
hub_name = "fastslide_docs_pip",
python_version = "3.12",
requirements_darwin = "//docs:requirements_darwin.txt",
requirements_lock = "//docs:requirements_linux.txt",
)
use_repo(pip, "fastslide_docs_pip", "fastslide_pip")
# Formatter-only (prettier for Markdown). dev_dependency so it is ignored when
# fastslide is a non-root dependency; the hub name is fastslide-specific to
# avoid colliding with a host workspace's own `npm` hub.
npm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
"npm",
dev_dependency = True,
)
npm.npm_translate_lock(
name = "fastslide_npm",
npmrc = "//tools/format:.npmrc",
pnpm_lock = "//tools/format:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)
use_repo(npm, "fastslide_npm")
doxygen_extension = use_extension("@rules_doxygen//:extensions.bzl", "doxygen_extension")
doxygen_extension.repository(name = "fastslide_doxygen")
doxygen_extension.configuration(
platform = "mac",
version = "0.0.0",
)
use_repo(doxygen_extension, "fastslide_doxygen")
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.25.0")
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//go:go.mod")
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "hwy",
patch_args = ["-p1"],
patches = ["//third_party:hwy_bazel_includes.patch"],
sha256 = "e8d696900b45f4123be8a9d6866f4e7b6831bf599f4b9c178964d968e6a58a69",
strip_prefix = "highway-1.3.0",
urls = ["https://github.com/google/highway/releases/download/1.3.0/highway-1.3.0.tar.gz"],
)
http_archive(
name = "openjp2",
build_file = "//third_party:openjp2.BUILD",
sha256 = "8702ba68b442657f11aaeb2b338443ca8d5fb95b0d845757968a7be31ef7f16d",
strip_prefix = "openjpeg-2.4.0",
urls = ["https://github.com/uclouvain/openjpeg/archive/v2.4.0.tar.gz"],
)
# Little CMS 2 (lcms2): ICC color-management engine used to apply embedded
# slide ICC profiles during region decode. Not on the BCR, so vendored via
# http_archive with a custom BUILD file, like openjp2/libdicom/lodepng.
http_archive(
name = "lcms2",
build_file = "//third_party:lcms2.BUILD",
sha256 = "bfc54f7bab59fbc921012014a8032e4cba4abd46db47d46b76416a8c0b2815c8",
strip_prefix = "lcms2-2.19.1",
urls = ["https://github.com/mm2/Little-CMS/releases/download/lcms2.19.1/lcms2-2.19.1.tar.gz"],
)
# The main monorepo vendors this module.
http_archive(
name = "lodepng",
build_file = "//third_party:lodepng.BUILD",
sha256 = "e3e5a62322b7afd5037d0aaa27188457226ccdaacc1353d0a1efcccd8f87f504",
strip_prefix = "lodepng-ed6fe5825c6a4fbb7f58ab35a4231c7543cd452a",
urls = ["https://github.com/lvandeve/lodepng/archive/ed6fe5825c6a4fbb7f58ab35a4231c7543cd452a.zip"],
)
http_archive(
name = "libdicom",
build_file = "//third_party:libdicom.BUILD",
sha256 = "75f1167f5153c659cdd58f2b432d2592bf0477abe0087e195bc621b5594ef10a",
strip_prefix = "libdicom-1.3.0",
urls = ["https://github.com/ImagingDataCommons/libdicom/releases/download/v1.3.0/libdicom-1.3.0.tar.xz"],
)
http_archive(
name = "uthash",
build_file = "//third_party:uthash.BUILD",
sha256 = "e10382ab75518bad8319eb922ad04f907cb20cccb451a3aa980c9d005e661acc",
strip_prefix = "uthash-2.3.0",
urls = ["https://github.com/troydhanson/uthash/archive/refs/tags/v2.3.0.tar.gz"],
)
# pugixml is fetched as an http_archive rather than via the BCR
# bazel_dep, because we need to inject `-fexceptions` for the Emscripten/wasm
# build: pugixml's XPath module uses `throw`, which emcc rejects unless
# exceptions are explicitly enabled. The BCR build file offers no knob for
# that, so we wrap the upstream tarball with our own BUILD file.
http_archive(
name = "pugixml",
build_file = "//third_party:pugixml.BUILD",
sha256 = "655ade57fa703fb421c2eb9a0113b5064bddb145d415dd1f88c79353d90d511a",
strip_prefix = "pugixml-1.15",
urls = ["https://github.com/zeux/pugixml/releases/download/v1.15/pugixml-1.15.tar.gz"],
)
# Hermetic C++ toolchain for cross-compilation (opt-in via --config=hermetic).
# Uses Zig's compiler for hermetic cross-compilation without replacing the
# default host toolchain.
bazel_dep(name = "hermetic_cc_toolchain", version = "4.1.0")
toolchains = use_extension("@hermetic_cc_toolchain//toolchain:ext.bzl", "toolchains")
use_repo(toolchains, "zig_sdk")
# Formatter-only (clang-format). dev_dependency so the root-module-only `llvm`
# extension is not evaluated when fastslide is consumed as a dependency.
llvm = use_extension(
"@toolchains_llvm//toolchain/extensions:llvm.bzl",
"llvm",
dev_dependency = True,
)
llvm.toolchain(
llvm_version = "21.1.8",
)
use_repo(llvm, "llvm_toolchain", "llvm_toolchain_llvm")