Skip to content
File

Blob: build/deps/v8.MODULE.bazel

4.7 KB
1"""
2V8 and its dependencies
3 
4Note that googlesource does not generate tarballs deterministically, so we cannot use
5http_archive: https://github.com/google/gitiles/issues/84
6 
7It would seem that googlesource would rather we use git protocol.
8Fine, we can do that.
9 
10We previously used shallow_since for our git-based dependencies, but this may actually be
11harmful: https://github.com/bazelbuild/bazel/issues/12857
12 
13There is an official mirror for V8 itself on GitHub, but not for dependencies like zlib (Chromium
14fork), icu (Chromium fork), and trace_event, so we still have to use git for them.
15"""
16 
17http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
18 
19git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
20 
21VERSION = "14.8.180"
22 
23INTEGRITY = "sha256-VQdRoKnkJKBl0GAChhM2Gk+X5HOnZqh8A3PhTtRXoBs="
24 
25PATCHES = [
26 "0001-Allow-manually-setting-ValueDeserializer-format-vers.patch",
27 "0002-Allow-manually-setting-ValueSerializer-format-versio.patch",
28 "0003-Allow-Windows-builds-under-Bazel.patch",
29 "0004-Disable-bazel-whole-archive-build.patch",
30 "0005-Speed-up-V8-bazel-build-by-always-using-target-cfg.patch",
31 "0006-Implement-Promise-Context-Tagging.patch",
32 "0007-Randomize-the-initial-ExecutionContextId-used-by-the.patch",
33 "0008-increase-visibility-of-virtual-method.patch",
34 "0009-Add-ValueSerializer-SetTreatFunctionsAsHostObjects.patch",
35 "0010-Modify-where-to-look-for-fp16-dependency.-This-depen.patch",
36 "0011-Revert-heap-Add-masm-specific-unwinding-annotations-.patch",
37 "0012-Update-illegal-invocation-error-message-in-v8.patch",
38 "0013-Implement-cross-request-context-promise-resolve-hand.patch",
39 "0014-Add-another-slot-in-the-isolate-for-embedder.patch",
40 "0015-Add-ValueSerializer-SetTreatProxiesAsHostObjects.patch",
41 "0016-Disable-memory-leak-assert-when-shutting-down-V8.patch",
42 "0017-Enable-V8-shared-linkage.patch",
43 "0018-Modify-where-to-look-for-fast_float-and-simdutf.patch",
44 "0019-Remove-unneded-latomic-linker-flag.patch",
45 "0020-Add-methods-to-get-heap-and-external-memory-sizes-di.patch",
46 "0021-Port-concurrent-mksnapshot-support.patch",
47 "0022-Port-V8_USE_ZLIB-support.patch",
48 "0023-Modify-where-to-look-for-dragonbox.patch",
49 "0024-Disable-slow-handle-check.patch",
50 "0025-Workaround-for-builtin-can-allocate-issue.patch",
51 "0026-Implement-additional-Exception-construction-methods.patch",
52 "0027-Export-icudata-file-to-facilitate-embedding-it.patch",
53 "0028-bind-icu-to-googlesource.patch",
54 "0029-Add-v8-String-IsFlat-API.patch",
55 "0030-Expose-AdjustAmountOfExternalAllocatedMemoryImpl-as-.patch",
56 "0031-Add-verify_write_barriers-flag-in-V8-s-bazel-config.patch",
57 "0032-Change-lamba-signature-to-get-around-windows-build-f.patch",
58 "0033-Return-false-on-Object.hasOwnProperty-with-intercept.patch",
59 "0034-Remove-V8-MODULE.bazel-llvm-toolchain-and-libcxx-rep.patch",
60 "0035-Remove-libcxx-dep-from-defs.bzl-not-resolvable-via-h.patch",
61 "0036-Fix-non-conforming-braced-init-list-in-value_or.patch",
62 "0037-Fix-non-portable-std-atomic_flag-construction-in-run.patch",
63]
64 
65http_archive(
66 name = "v8",
67 integrity = INTEGRITY,
68 patch_args = ["-p1"],
69 patches = ["//:patches/v8/" + p for p in PATCHES],
70 strip_prefix = "v8-" + VERSION,
71 url = "https://github.com/v8/v8/archive/refs/tags/" + VERSION + ".tar.gz",
72)
73 
74git_repository(
75 name = "com_googlesource_chromium_icu",
76 build_file = "@v8//:bazel/BUILD.icu",
77 commit = "ee5f27adc28bd3f15b2c293f726d14d2e336cbd5",
78 patch_cmds = ["find source -name BUILD.bazel | xargs rm"],
79 patch_cmds_win = ["Get-ChildItem -Path source -File -Include BUILD.bazel -Recurse | Remove-Item"],
80 remote = "https://chromium.googlesource.com/chromium/deps/icu.git",
81)
82 
83# For use with perfetto, see https://github.com/google/perfetto/blob/main/bazel/standalone/README.md
84local_path_override(
85 module_name = "perfetto_cfg",
86 path = "build/perfetto",
87)
88 
89# perfetto is managed in deps.jsonc with use_bazel_dep: true
90 
91bazel_dep(name = "workerd-v8")
92 
93# Tell workerd code where to find v8.
94#
95# We indirect through `@workerd-v8` to allow dependents to override how and where `v8` is built.
96# This is overridden in the internal non-OSS repo.
97#
98# TODO(cleanup): There must be a better way to do this?
99# TODO(soon): Figure out how to build v8 with perfetto enabled. It does not appear
100# as if the v8 bazel build currently includes support for building with
101# perfetto enabled as an option.
102local_path_override(
103 module_name = "workerd-v8",
104 path = "build/workerd-v8",
105)
106 
107bazel_dep(name = "google_benchmark")
108local_path_override(
109 module_name = "google_benchmark",
110 path = "build/google-benchmark",
111)