Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Revert "Revert "Add Dawn as an optional build dependency" (#860)" #861

Merged
merged 1 commit into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ build --verbose_failures
# Our dependencies (ICU, zlib, etc.) produce a lot of these warnings, so we disable them.
build --per_file_copt='external/com_googlesource_chromium_icu@-Wno-ambiguous-reversed-operator,-Wno-deprecated-declarations'
build --host_per_file_copt='external/com_googlesource_chromium_icu@-Wno-ambiguous-reversed-operator,-Wno-deprecated-declarations'
build --per_file_copt='external/dawn@-Wno-shorten-64-to-32,-Wno-unneeded-internal-declaration'
build --host_per_file_copt='external/dawn@-Wno-shorten-64-to-32,-Wno-unneeded-internal-declaration'

# Speed up sandboxed compilation, particularly on I/O-constrained and non-Linux systems
# https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories
Expand Down Expand Up @@ -45,7 +47,7 @@ build:thin-lto --@rules_rust//:extra_rustc_flags=-C,panic=abort,-C,codegen-units
#
# Linux and macOS
#
build:unix --cxxopt='-std=c++20' --host_cxxopt='-std=c++20' --force_pic
build:unix --cxxopt='-std=c++20' --host_cxxopt='-std=c++20'
build:unix --cxxopt='-fcoroutines-ts' --host_cxxopt='-fcoroutines-ts'
build:unix --cxxopt='-stdlib=libc++' --host_cxxopt='-stdlib=libc++'
build:unix --linkopt='-stdlib=libc++' --host_linkopt='-stdlib=libc++'
Expand Down Expand Up @@ -83,6 +85,11 @@ build:macos --macos_minimum_os=11.0 --host_macos_minimum_os=11.0
# On Linux, always link libc++ statically to avoid compatibility issues with different OS versions.
build:linux --action_env=BAZEL_LINKLIBS='-l%:libc++.a -lm -static-libgcc'

# On Linux, enable PIC. In macos pic is the default, and the objc_library rule does not work
# correctly if we use this flag since it will not find the object files to include
# https://github.com/bazelbuild/bazel/issues/12439#issuecomment-914449079
build:linux --force_pic

#
# Windows
#
Expand Down
125 changes: 94 additions & 31 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,18 @@ http_archive(

http_archive(
name = "sqlite3",
url = "https://sqlite.org/2022/sqlite-amalgamation-3400100.zip",
build_file = "//:build/BUILD.sqlite3",
sha256 = "49112cc7328392aa4e3e5dae0b2f6736d0153430143d21f69327788ff4efe734",
strip_prefix = "sqlite-amalgamation-3400100",
type = "zip",
sha256 = "49112cc7328392aa4e3e5dae0b2f6736d0153430143d21f69327788ff4efe734",
build_file = "//:build/BUILD.sqlite3",
url = "https://sqlite.org/2022/sqlite-amalgamation-3400100.zip",
)

http_archive(
name = "rules_python",
sha256 = "84aec9e21cc56fbc7f1335035a71c850d1b9b5cc6ff497306f84cced9a769841",
strip_prefix = "rules_python-0.23.1",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.23.1/rules_python-0.23.1.tar.gz",
)

# Using latest brotli commit due to macOS and clang-cl compile issues with v1.0.9, switch to a
Expand All @@ -58,6 +65,44 @@ http_archive(
urls = ["https://github.com/google/brotli/tarball/ec107cf015139c791f79afac0f96c3a2c45e157f"],
)

# ========================================================================================
# Dawn
#
# WebGPU implementation

git_repository(
name = "dawn",
build_file = "//:build/BUILD.dawn",
commit = "fd61f6244fb00ea42390f5a77267a4c195d90a06",
remote = "https://dawn.googlesource.com/dawn.git",
)

git_repository(
name = "vulkan_tools",
build_file = "//:build/BUILD.vulkan_tools",
commit = "ca8bb4ee3cc9afdeca4b49c5ef758bad7cce2c72",
remote = "https://github.com/KhronosGroup/Vulkan-Tools.git",
)

git_repository(
name = "vulkan_headers",
build_file = "//:build/BUILD.vulkan_headers",
commit = "c1a8560c5cf5e7bd6dbc71fe69b1a317411c36b8",
remote = "https://github.com/KhronosGroup/Vulkan-Headers.git",
)

git_repository(
name = "spirv_tools",
commit = "a63ac9f73d29cd27cdb6e3388d98d1d934e512bb",
remote = "https://github.com/KhronosGroup/SPIRV-Tools.git",
)

git_repository(
name = "spirv_headers",
commit = "6e09e44cd88a5297433411b2ee52f4cf9f50fa90",
remote = "https://github.com/KhronosGroup/SPIRV-Headers.git",
)

# ========================================================================================
# tcmalloc

Expand All @@ -70,9 +115,9 @@ http_archive(
# 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",
strip_prefix = "abseil-cpp-b3162b1da62711c663d0025e2eabeb83fd1f2728",
urls = ["https://github.com/abseil/abseil-cpp/archive/b3162b1da62711c663d0025e2eabeb83fd1f2728.zip"],
)

# tcmalloc requires this "rules_fuzzing" package. Its build files fail analysis without it, even
Expand All @@ -95,10 +140,10 @@ 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",
sha256 = "10b1217154c2b432241ded580d6b0e0b01f5d2566b4eeacf2edf937b87683274",
strip_prefix = "google-tcmalloc-ca82471",
type = "tgz",
sha256 = "10b1217154c2b432241ded580d6b0e0b01f5d2566b4eeacf2edf937b87683274",
url = "https://github.com/google/tcmalloc/tarball/ca82471188f4832e82d2e77078ecad66f4c425d5",
)

# ========================================================================================
Expand Down Expand Up @@ -147,12 +192,12 @@ http_file(

http_file(
name = "cargo_bazel_win_x64",
downloaded_file_path = "downloaded.exe", # .exe extension required for Windows to recognise as executable
executable = True,
sha256 = "a51d0db5a0c5ce9622d0f87cf8828b7c15825a48558c05d9861563f65837f115",
urls = [
"https://github.com/bazelbuild/rules_rust/releases/download/0.25.1/cargo-bazel-x86_64-pc-windows-msvc.exe",
],
downloaded_file_path = "downloaded.exe" # .exe extension required for Windows to recognise as executable
)

http_archive(
Expand Down Expand Up @@ -214,22 +259,22 @@ nodejs_register_toolchains(
node_version = "18.10.0",
)

load("@aspect_rules_ts//ts:repositories.bzl", TS_LATEST_VERSION = "LATEST_VERSION", "rules_ts_dependencies")
load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies", TS_LATEST_VERSION = "LATEST_VERSION")

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",
patch_args = {
"capnp-ts@0.7.0": ["-p1"],
},
# Patches required for `capnp-ts` to type-check
patches = {
"capnp-ts@0.7.0": ["//:patches/capnp-ts@0.7.0.patch"],
},
patch_args = {
"capnp-ts@0.7.0": ["-p1"],
},
pnpm_lock = "//:pnpm-lock.yaml",
)

load("@npm//:repositories.bzl", "npm_repositories")
Expand All @@ -251,10 +296,8 @@ npm_repositories()

git_repository(
name = "v8",
remote = "https://chromium.googlesource.com/v8/v8.git",
commit = "84b0aff45ebe07dce522d2c90b42074b25b60927",
shallow_since = "1685722300 +0000",
patch_args = [ "-p1" ],
patch_args = ["-p1"],
patches = [
"//:patches/v8/0001-Allow-manually-setting-ValueDeserializer-format-vers.patch",
"//:patches/v8/0002-Allow-manually-setting-ValueSerializer-format-versio.patch",
Expand All @@ -266,43 +309,63 @@ git_repository(
"//:patches/v8/0008-Make-v8-Locker-automatically-call-isolate-Enter.patch",
"//:patches/v8/0009-Add-an-API-to-capture-and-restore-the-cage-base-poin.patch",
"//:patches/v8/0010-Speed-up-V8-bazel-build-by-always-using-target-cfg.patch",
"//:patches/v8/0011-Implement-Promise-Context-Tagging.patch"
"//:patches/v8/0011-Implement-Promise-Context-Tagging.patch",
],
remote = "https://chromium.googlesource.com/v8/v8.git",
shallow_since = "1685722300 +0000",
)

new_git_repository(
name = "com_googlesource_chromium_icu",
remote = "https://chromium.googlesource.com/chromium/deps/icu.git",
build_file = "@v8//:bazel/BUILD.icu",
commit = "a2961dc659b4ae847a9c6120718cc2517ee57d9e",
patch_cmds = ["find source -name BUILD.bazel | xargs rm"],
patch_cmds_win = ["Get-ChildItem -Path source -File -Include BUILD.bazel -Recurse | Remove-Item"],
remote = "https://chromium.googlesource.com/chromium/deps/icu.git",
shallow_since = "1683080067 +0000",
build_file = "@v8//:bazel/BUILD.icu",
patch_cmds = [ "find source -name BUILD.bazel | xargs rm" ],
patch_cmds_win = [ "Get-ChildItem -Path source -File -Include BUILD.bazel -Recurse | Remove-Item" ],
)

new_git_repository(
name = "com_googlesource_chromium_base_trace_event_common",
remote = "https://chromium.googlesource.com/chromium/src/base/trace_event/common.git",
build_file = "@v8//:bazel/BUILD.trace_event_common",
commit = "147f65333c38ddd1ebf554e89965c243c8ce50b3",
remote = "https://chromium.googlesource.com/chromium/src/base/trace_event/common.git",
shallow_since = "1676317690 -0800",
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",
# This sets up a hermetic python3, rather than depending on what is installed.
load("@rules_python//python:repositories.bzl", "python_register_toolchains")

python_register_toolchains(
name = "python3_11",
# https://github.com/bazelbuild/rules_python/blob/main/python/versions.bzl
python_version = "3.11",
)

load("@rules_python//python:pip.bzl", "pip_install")
load("@python3_11//:defs.bzl", "interpreter")
load("@rules_python//python:pip.bzl", "pip_parse")

pip_install(
pip_parse(
name = "v8_python_deps",
extra_pip_args = ["--require-hashes"],
python_interpreter_target = interpreter,
requirements = "@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 = "//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",
Expand Down Expand Up @@ -337,4 +400,4 @@ new_local_repository(
strip_include_prefix = "/",
visibility = ["//visibility:public"],)""",
path = "empty",
)
)
Loading