-
Notifications
You must be signed in to change notification settings - Fork 311
/
WORKSPACE
335 lines (270 loc) · 11.4 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
workspace(name = "workerd")
# ========================================================================================
# Bazel basics
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
http_archive(
name = "bazel_skylib",
sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz",
],
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
http_archive(
name = "rules_foreign_cc",
sha256 = "6041f1374ff32ba711564374ad8e007aef77f71561a7ce784123b9b4b88614fc",
strip_prefix = "rules_foreign_cc-0.8.0",
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.8.0.tar.gz",
)
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
rules_foreign_cc_dependencies()
# ========================================================================================
# Simple dependencies
http_archive(
name = "capnp-cpp",
sha256 = "79d1ae721c79bd5679ff3036961045c410eccf6dd8199fef4767ca9c343eb438",
strip_prefix = "capnproto-capnproto-f557d9d/c++",
type = "tgz",
urls = ["https://github.com/capnproto/capnproto/tarball/f557d9d728a773d954cf0586fe6e78adf828c5f4"],
)
http_archive(
name = "ssl",
sha256 = "873ec711658f65192e9c58554ce058d1cfa4e57e13ab5366ee16f76d1c757efc",
strip_prefix = "google-boringssl-ed2e74e",
type = "tgz",
# from master-with-bazel branch
urls = ["https://github.com/google/boringssl/tarball/ed2e74e737dc802ed9baad1af62c1514430a70d6"],
)
http_archive(
name = "com_cloudflare_lol_html",
url = "https://github.com/cloudflare/lol-html/tarball/1b64a2ed0d719ce5dfac316108ca2dfad73ff9b4",
strip_prefix = "cloudflare-lol-html-1b64a2e",
type = "tgz",
sha256 = "9648017d74fbb2ab8418efe12e7baff0c0acd4b97f9a0023b562f3a3744b6d7b",
build_file = "//:build/BUILD.lol-html",
)
# ========================================================================================
# tcmalloc
# tcmalloc requires Abseil.
#
# WARNING: This MUST appear before rules_fuzzing_depnedencies(), below. Otherwise,
# rules_fuzzing_depnedencies() will choose to pull in a different version of Abseil that is too
# old for tcmalloc. Absurdly, Bazel simply ignores later attempts to define the same repo name,
# rather than erroring out. Thus this leads to confusing compiler errors in tcmalloc complaining
# that ABSL_ATTRIBUTE_PURE_FUNCTION is not defined.
http_archive(
name = "com_google_absl",
urls = ["https://github.com/abseil/abseil-cpp/archive/b3162b1da62711c663d0025e2eabeb83fd1f2728.zip"],
strip_prefix = "abseil-cpp-b3162b1da62711c663d0025e2eabeb83fd1f2728",
sha256 = "d5c91248c33269fcc7ab35897315a45cfa2c37abb4c6d4ed36cb5c82f366367a",
)
# tcmalloc requires this "rules_fuzzing" package. Its build files fail analysis without it, even
# though it is unused for our purposes.
http_archive(
name = "rules_fuzzing",
sha256 = "a5734cb42b1b69395c57e0bbd32ade394d5c3d6afbfe782b24816a96da24660d",
strip_prefix = "rules_fuzzing-0.1.1",
urls = ["https://github.com/bazelbuild/rules_fuzzing/archive/v0.1.1.zip"],
)
load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies")
rules_fuzzing_dependencies()
load("@rules_fuzzing//fuzzing:init.bzl", "rules_fuzzing_init")
rules_fuzzing_init()
# OK, now we can bring in tcmalloc itself.
http_archive(
name = "com_google_tcmalloc",
url = "https://github.com/google/tcmalloc/tarball/ca82471188f4832e82d2e77078ecad66f4c425d5",
strip_prefix = "google-tcmalloc-ca82471",
type = "tgz",
sha256 = "10b1217154c2b432241ded580d6b0e0b01f5d2566b4eeacf2edf937b87683274",
)
# ========================================================================================
# Rust bootstrap
#
# workerd uses some Rust libraries, especially lolhtml for implementing HtmlRewriter.
http_file(
name = "cargo_bazel_linux_x64",
executable = True,
sha256 = "a9f81a6fd356fc01e3da2483bdd1f9dfb080b0bdf5a128fa036c048e5b301562",
urls = [
"https://github.com/bazelbuild/rules_rust/releases/download/0.10.0/cargo-bazel-x86_64-unknown-linux-gnu",
],
)
http_file(
name = "cargo_bazel_linux_arm64",
executable = True,
sha256 = "f2d168c386d38c0d5ca429c34dcbc5a6aec5be19ee1d4f6f0e614293b0e55468",
urls = [
"https://github.com/bazelbuild/rules_rust/releases/download/0.10.0/cargo-bazel-aarch64-unknown-linux-gnu",
],
)
http_file(
name = "cargo_bazel_macos_x64",
executable = True,
sha256 = "fb80acb9fcfd83674f73e98bf956bc65b33f31a4380ba72fbc1a6a9bf22c2f8c",
urls = [
"https://github.com/bazelbuild/rules_rust/releases/download/0.10.0/cargo-bazel-x86_64-apple-darwin",
],
)
http_file(
name = "cargo_bazel_macos_arm64",
executable = True,
sha256 = "4104ea8edd3fccbcfc43265e4fa02dfc25b12b32250ff46456b829ab9cb78908",
urls = [
"https://github.com/bazelbuild/rules_rust/releases/download/0.10.0/cargo-bazel-aarch64-apple-darwin",
],
)
http_archive(
name = "rules_rust",
sha256 = "0cc7e6b39e492710b819e00d48f2210ae626b717a3ab96e048c43ab57e61d204",
urls = [
"https://github.com/bazelbuild/rules_rust/releases/download/0.10.0/rules_rust-v0.10.0.tar.gz",
],
)
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
rules_rust_dependencies()
rust_register_toolchains(
edition = "2018",
version = "1.66.0",
)
load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
crate_universe_dependencies()
load("//rust-deps/crates:crates.bzl", "crate_repositories")
crate_repositories()
load("//rust-deps/cxxbridge_crates:crates.bzl", cxxbridge_repositories = "crate_repositories")
cxxbridge_repositories()
load("@rules_rust//tools/rust_analyzer:deps.bzl", "rust_analyzer_dependencies")
rust_analyzer_dependencies()
# ========================================================================================
# Node.js bootstrap
#
# workerd uses Node.js scripts for generating TypeScript types.
http_archive(
name = "aspect_rules_js",
sha256 = "686d5b345592c1958b4aea24049d935ada11b83ae5538658d22b84b353cfbb1e",
strip_prefix = "rules_js-1.13.1",
url = "https://github.com/aspect-build/rules_js/archive/refs/tags/v1.13.1.tar.gz",
)
http_archive(
name = "aspect_rules_ts",
sha256 = "6406905c5f7c5ca6dedcca5dacbffbf32bb2a5deb77f50da73e7195b2b7e8cbc",
strip_prefix = "rules_ts-1.0.5",
url = "https://github.com/aspect-build/rules_ts/archive/refs/tags/v1.0.5.tar.gz",
)
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
nodejs_register_toolchains(
name = "nodejs",
node_version = "18.10.0",
)
load("@aspect_rules_ts//ts:repositories.bzl", TS_LATEST_VERSION = "LATEST_VERSION", "rules_ts_dependencies")
rules_ts_dependencies(ts_version = TS_LATEST_VERSION)
load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")
npm_translate_lock(
name = "npm",
pnpm_lock = "//:pnpm-lock.yaml",
# Patches required for `capnp-ts` to type-check
patches = {
"[email protected]": ["//:patches/[email protected]"],
},
patch_args = {
"[email protected]": ["-p1"],
},
)
load("@npm//:repositories.bzl", "npm_repositories")
npm_repositories()
# ========================================================================================
# V8 and its dependencies
#
# Note that googlesource does not generate tarballs deterministically, so we cannot use
# http_archive: https://github.com/google/gitiles/issues/84
#
# It would seem that googlesource would rather we use git protocol (ideally with shallow clones).
# Fine, we can do that.
#
# Note that while there is an official mirror of V8 on GitHub, there do not appear to be
# mirrors of the dependencies: zlib (Chromium fork), icu (Chromium fork), and trace_event. So
# fetching from GitHub instead wouldn't really solve the problem.
git_repository(
name = "v8",
remote = "https://chromium.googlesource.com/v8/v8.git",
commit = "18865d6af0404f2d2aeb1c99dd73503364ce0967",
shallow_since = "1662649276 +0000",
patch_args = [ "-p1" ],
patches = [
"//:patches/v8/0001-Allow-manually-setting-ValueDeserializer-format-vers.patch",
"//:patches/v8/0002-Allow-manually-setting-ValueSerializer-format-versio.patch",
"//:patches/v8/0003-Make-icudata-target-public.patch",
"//:patches/v8/0004-Add-ArrayBuffer-MaybeNew.patch",
"//:patches/v8/0005-Revert-bazel-Add-hide-symbols-from-release-fast-buil.patch",
"//:patches/v8/0006-bazel-Allow-compiling-on-macOS-catalina-and-ventura.patch",
],
)
new_git_repository(
name = "com_googlesource_chromium_icu",
remote = "https://chromium.googlesource.com/chromium/deps/icu.git",
commit = "20f8ac695af59b6c830def7d4e95bfeb13dd7be5",
shallow_since = "1660168635 +0000",
build_file = "@v8//:bazel/BUILD.icu",
patch_cmds = [ "find source -name BUILD.bazel | xargs rm" ]
)
new_git_repository(
name = "com_googlesource_chromium_base_trace_event_common",
remote = "https://chromium.googlesource.com/chromium/src/base/trace_event/common.git",
commit = "521ac34ebd795939c7e16b37d9d3ddb40e8ed556",
shallow_since = "1659619139 -0700",
build_file = "@v8//:bazel/BUILD.trace_event_common",
)
http_archive(
name = "rules_python",
sha256 = "a30abdfc7126d497a7698c29c46ea9901c6392d6ed315171a6df5ce433aa4502",
strip_prefix = "rules_python-0.6.0",
url = "https://github.com/bazelbuild/rules_python/archive/0.6.0.tar.gz",
)
load("@rules_python//python:pip.bzl", "pip_install")
pip_install(
name = "v8_python_deps",
extra_pip_args = ["--require-hashes"],
requirements = "@v8//:bazel/requirements.txt",
)
bind(
name = "zlib_compression_utils",
actual = "@com_googlesource_chromium_zlib//:zlib_compression_utils",
)
bind(
name = "icu",
actual = "@com_googlesource_chromium_icu//:icu",
)
bind(
name = "base_trace_event_common",
actual = "@com_googlesource_chromium_base_trace_event_common//:trace_event_common",
)
# 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?
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",
)
# ========================================================================================
# Tools
# Hedron's Compile Commands Extractor for Bazel
# https://github.com/hedronvision/bazel-compile-commands-extractor
http_archive(
name = "hedron_compile_commands",
sha256 = "ab6c6b4ceaf12b224e571ec075fd79086c52c3430993140bb2ed585b08dfc552",
strip_prefix = "bazel-compile-commands-extractor-d1e95ec162e050b04d0a191826f9bc478de639f7",
url = "https://github.com/hedronvision/bazel-compile-commands-extractor/archive/d1e95ec162e050b04d0a191826f9bc478de639f7.tar.gz",
)
load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup")
hedron_compile_commands_setup()