-
Notifications
You must be signed in to change notification settings - Fork 338
/
Copy pathWORKSPACE
362 lines (283 loc) · 10.8 KB
/
WORKSPACE
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
workspace(name = "workerd")
load("@//build/deps:gen/build_deps.bzl", build_deps_gen = "deps_gen")
build_deps_gen()
load("@//build/deps:gen/deps.bzl", "deps_gen")
deps_gen()
# ========================================================================================
# Bazel basics
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
NODE_VERSION = "22.11.0"
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
load(
"@build_bazel_apple_support//lib:repositories.bzl",
"apple_support_dependencies",
)
apple_support_dependencies()
# apple_support now requires bazel_features, pull in its dependencies too.
load("@bazel_features//:deps.bzl", "bazel_features_deps")
bazel_features_deps()
# ========================================================================================
# Simple dependencies
http_archive(
name = "sqlite3",
build_file = "//:build/BUILD.sqlite3",
patch_args = ["-p1"],
patches = [
"//:patches/sqlite/0001-row-counts-plain.patch",
"//:patches/sqlite/0002-macOS-missing-PATH-fix.patch",
"//:patches/sqlite/0003-sqlite-complete-early-exit.patch",
],
sha256 = "f59c349bedb470203586a6b6d10adb35f2afefa49f91e55a672a36a09a8fedf7",
strip_prefix = "sqlite-src-3470000",
url = "https://sqlite.org/2024/sqlite-src-3470000.zip",
)
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
py_repositories()
http_archive(
name = "com_google_benchmark",
integrity = "sha256-a8GApX0j1NlRVRn5KwyD1hsFtbqxiJYfNqx7BrDZ6c4=",
strip_prefix = "benchmark-1.8.3",
url = "https://github.com/google/benchmark/archive/refs/tags/v1.8.3.tar.gz",
)
# These are part of what's needed to get `bazel query 'deps(//...)'`, to work, but this is difficult to support
# based on our dependencies – just use cquery instead.
# load("@com_google_benchmark//:bazel/benchmark_deps.bzl", "benchmark_deps")
# benchmark_deps()
http_archive(
name = "brotli",
sha256 = "e720a6ca29428b803f4ad165371771f5398faba397edf6778837a18599ea13ff",
strip_prefix = "brotli-1.1.0",
urls = ["https://github.com/google/brotli/archive/refs/tags/v1.1.0.tar.gz"],
)
http_archive(
name = "nbytes",
build_file = "//:build/BUILD.nbytes",
sha256 = "34be48071c86add2f8d14fd4a238c47230965fd743a51b8a1dd0b2f0210f0171",
strip_prefix = "nbytes-0.1.1",
url = "https://github.com/nodejs/nbytes/archive/refs/tags/v0.1.1.tar.gz",
)
http_archive(
name = "ncrypto",
sha256 = "b438cf71b1c24036e388f191a348cdc76aca75310eabca0fef5d81d5032a5d20",
strip_prefix = "ncrypto-1.0.1",
type = "tgz",
url = "https://github.com/nodejs/ncrypto/archive/refs/tags/1.0.1.tar.gz",
)
http_archive(
name = "pyodide",
build_file = "//:build/BUILD.pyodide",
sha256 = "fbda450a64093a8d246c872bb901ee172a57fe594c9f35bba61f36807c73300d",
urls = ["https://github.com/pyodide/pyodide/releases/download/0.26.0a2/pyodide-core-0.26.0a2.tar.bz2"],
)
http_archive(
name = "pyodide_packages",
build_file = "//:build/BUILD.pyodide_packages",
sha256 = "c4a4e0c1cb658a39abc0435cc07df902e5a2ecffc091e0528b96b0c295e309ea",
urls = ["https://github.com/dom96/pyodide_packages/releases/download/just-stdlib/pyodide_packages.tar.zip"],
)
load("//:build/pyodide_bucket.bzl", "PYODIDE_ALL_WHEELS_ZIP_SHA256", "PYODIDE_GITHUB_RELEASE_URL")
load("//:build/python_metadata.bzl", "PYTHON_LOCKFILES")
[
http_file(
name = "pyodide-lock_" + package_date + ".json",
sha256 = package_lock_sha,
url = "https://github.com/cloudflare/pyodide-build-scripts/releases/download/" + package_date + "/pyodide-lock.json",
)
for package_date, package_lock_sha in PYTHON_LOCKFILES.items()
]
http_archive(
name = "all_pyodide_wheels",
build_file_content = """
filegroup(
name = "whls",
srcs = glob(["*"]),
visibility = ["//visibility:public"]
)
""",
sha256 = PYODIDE_ALL_WHEELS_ZIP_SHA256,
urls = [PYODIDE_GITHUB_RELEASE_URL + "all_wheels.zip"],
)
# ========================================================================================
# tcmalloc
# tcmalloc requires Abseil.
#
git_repository(
name = "com_google_absl",
commit = "72093794ac42be8105817ae0b0569fb411a6ca9b",
remote = "https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp.git",
)
git_repository(
name = "fast_float",
build_file_content = "exports_files(glob([\"**\"]))",
commit = "d7417618f93d2c47e9bbde561510f9fc8bafe003",
remote = "https://chromium.googlesource.com/external/github.com/fastfloat/fast_float.git",
)
git_repository(
name = "fp16",
build_file_content = "exports_files(glob([\"**\"]))",
commit = "0a92994d729ff76a58f692d3028ca1b64b145d91",
remote = "https://chromium.googlesource.com/external/github.com/Maratyszcza/FP16.git",
)
git_repository(
name = "highway",
commit = "00fe003dac355b979f36157f9407c7c46448958e",
remote = "https://chromium.googlesource.com/external/github.com/google/highway.git",
)
# Bindings for Highway library used by V8
bind(
name = "hwy",
actual = "@highway//:hwy",
)
# Bindings for abseil libraries used by V8
[
bind(
name = "absl_" + absl_component,
actual = "@com_google_absl//absl/container:" + absl_component,
)
for absl_component in [
"btree",
"flat_hash_map",
"flat_hash_set",
]
]
# OK, now we can bring in tcmalloc itself.
http_archive(
name = "com_google_tcmalloc",
integrity = "sha256-8joG3SxfLYqR2liUznBAcMkHKYMmUtsO1qGr505VBMY=",
strip_prefix = "google-tcmalloc-91765c1",
type = "tgz",
url = "https://github.com/google/tcmalloc/tarball/91765c11461a01579fcbdddf430a556b818818c4",
)
# ========================================================================================
# Rust bootstrap
#
git_repository(
name = "zlib",
build_file = "//:build/BUILD.zlib",
# This should match the version specified in V8 DEPS, but in practice it is generally acceptable
# for it to be behind – zlib is very stable and its API has not changed in a long time, most
# changes to the Chromium fork affect ancillary tools and not the zlib library itself.
commit = "82a5fecf8aae8f288267cfdb2d29c9ebf7b37e59",
remote = "https://chromium.googlesource.com/chromium/src/third_party/zlib.git",
)
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
rules_rust_dependencies()
rust_register_toolchains(
edition = "2021",
extra_target_triples = [
# Add support for macOS cross-compilation
"x86_64-apple-darwin",
# Add support for macOS rosetta
"aarch64-unknown-linux-gnu",
],
versions = ["1.83.0"], # LLVM 19
)
load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
crate_universe_dependencies()
# Load rust crate dependencies.
# These could be regenerated from cargo.bzl by using
# `just update-rust` (consult `just --list` or justfile for more details)
load("//deps/rust/crates:crates.bzl", "crate_repositories")
crate_repositories()
load("@rules_rust//tools/rust_analyzer:deps.bzl", "rust_analyzer_dependencies")
rust_analyzer_dependencies()
# Protobuf
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()
# rules_shell
load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains")
rules_shell_dependencies()
rules_shell_toolchains()
# ========================================================================================
# Node.js bootstrap
#
# workerd uses Node.js scripts for generating TypeScript types.
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
rules_js_register_toolchains(
node_urls = [
# github workflows may substitute a mirror URL here to avoid fetch failures.
# "WORKERS_MIRROR_URL/https://nodejs.org/dist/v{version}/{filename}",
"https://nodejs.org/dist/v{version}/{filename}",
],
node_version = NODE_VERSION,
)
load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies")
rules_ts_dependencies(ts_version_from = "//:package.json")
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
npm_translate_lock(
name = "npm",
npmrc = "//:.npmrc",
patch_args = {
"[email protected]": ["-p1"],
},
# Patches required for `capnp-ts` to type-check
patches = {
"[email protected]": ["//:patches/[email protected]"],
},
pnpm_lock = "//:pnpm-lock.yaml",
)
load("@npm//:repositories.bzl", "npm_repositories")
npm_repositories()
load("@aspect_rules_esbuild//esbuild:dependencies.bzl", "rules_esbuild_dependencies")
rules_esbuild_dependencies()
load("@aspect_rules_esbuild//esbuild:repositories.bzl", "LATEST_ESBUILD_VERSION", "esbuild_register_toolchains")
esbuild_register_toolchains(
name = "esbuild",
esbuild_version = LATEST_ESBUILD_VERSION,
)
load("@//build/deps:v8.bzl", "deps_v8")
deps_v8()
python_register_toolchains(
name = "python3_13",
ignore_root_user_error = True,
# https://github.com/bazelbuild/rules_python/blob/main/python/versions.bzl
python_version = "3.13",
)
load("@python3_13//:defs.bzl", "interpreter")
load("@rules_python//python:pip.bzl", "pip_parse")
pip_parse(
name = "v8_python_deps",
extra_pip_args = ["--require-hashes"],
python_interpreter_target = interpreter,
requirements_lock = "@v8//:bazel/requirements.txt",
)
load("@v8_python_deps//:requirements.bzl", v8_python_deps_install = "install_deps")
v8_python_deps_install()
pip_parse(
name = "py_deps",
python_interpreter_target = interpreter,
requirements_lock = "//build/deps:requirements.txt",
)
load("@py_deps//:requirements.bzl", py_deps_install = "install_deps")
py_deps_install()
bind(
name = "icu",
actual = "@com_googlesource_chromium_icu//:icu",
)
# Tell workerd code where to find v8.
#
# We indirect through `@workerd-v8` to allow dependents to override how and where `v8` is built.
#
# TODO(cleanup): There must be a better way to do this?
# TODO(soon): Figure out how to build v8 with perfetto enabled. It does not appear
# as if the v8 bazel build currently includes support for building with
# perfetto enabled as an option.
new_local_repository(
name = "workerd-v8",
build_file_content = """cc_library(
name = "v8",
deps = [ "@v8//:v8_icu", "@workerd//:icudata-embed" ],
visibility = ["//visibility:public"])""",
path = "empty",
)
# rust-based lolhtml dependency, including the API header.
# Presented as a separate repository to allow overrides.
new_local_repository(
name = "com_cloudflare_lol_html",
build_file = "@workerd//deps/rust:BUILD.lolhtml",
path = "empty",
)