Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[nfc] dependency updates, expand usage of bazel implementation_deps #1583

Merged
merged 2 commits into from
Feb 2, 2024
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
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.1
7.0.2
67 changes: 37 additions & 30 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ apple_support_dependencies()

http_archive(
name = "capnp-cpp",
integrity = "sha256-eLxPfuuwuX9FTYCHgB8Q6tpBq/aVHzBbi8yie8WwpAo",
strip_prefix = "capnproto-capnproto-af4c99d/c++",
sha256 = "f14d3f4469044de19f447a20a8bfeed59cfdd5b15d2bed6d96dcef7c63c9ccd7",
strip_prefix = "capnproto-capnproto-ae261d9/c++",
type = "tgz",
urls = ["https://github.com/capnproto/capnproto/tarball/af4c99d89dea3e6e299c3ff953ee03326fce80d6"],
urls = ["https://github.com/capnproto/capnproto/tarball/ae261d9fde3dbedc8c0334ae2a342b18ce43857a"],
)

http_archive(
Expand All @@ -69,21 +69,26 @@ http_archive(

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",
sha256 = "9d04041ac92a0985e344235f5d946f71ac543f1b1565f2cdbc9a2aaee8adf55b",
strip_prefix = "rules_python-0.26.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.26.0/rules_python-0.26.0.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

http_archive(
name = "com_google_benchmark",
sha256 = "2aab2980d0376137f969d92848fbb68216abb07633034534fc8c65cc4e7a0e93",
strip_prefix = "benchmark-1.8.2",
url = "https://github.com/google/benchmark/archive/refs/tags/v1.8.2.tar.gz",
)

load("@com_google_benchmark//:bazel/benchmark_deps.bzl", "benchmark_deps")

benchmark_deps()
# 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",
Expand Down Expand Up @@ -141,7 +146,6 @@ http_archive(
strip_prefix = "KhronosGroup-Vulkan-Utility-Libraries-5b3147a",
type = "tgz",
url = "https://github.com/KhronosGroup/Vulkan-Utility-Libraries/tarball/5b3147a535e28a48ae760efacdf97b296d9e8c73",

)

http_archive(
Expand All @@ -151,7 +155,6 @@ http_archive(
strip_prefix = "KhronosGroup-Vulkan-Headers-aff5071",
type = "tgz",
url = "https://github.com/KhronosGroup/Vulkan-Headers/tarball/aff5071d4ee6215c60a91d8d983cad91bb25fb57",

)

http_archive(
Expand All @@ -167,20 +170,21 @@ http_archive(

# 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.
# WARNING: This MUST appear before rules_fuzzing_dependencies(), below. Otherwise,
# rules_fuzzing_dependencies() will choose to pull in an older version of Abseil. Absurdly, Bazel
# simply ignores later attempts to define the same repo name, rather than erroring out. This led
# to confusing compiler errors in tcmalloc in the past.
git_repository(
name = "com_google_absl",
remote = "https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp.git",
commit = "0764ad493e54a79c7e3e02fc3412ef55b4835b9e",
remote = "https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp.git",
)

bind(
name = "absl_flat_hash_set",
actual = "@com_google_absl//absl/container:flat_hash_set",
)

bind(
name = "absl_flat_hash_map",
actual = "@com_google_absl//absl/container:flat_hash_map",
Expand All @@ -190,14 +194,17 @@ bind(
# though it is unused for our purposes.
http_archive(
name = "rules_fuzzing",
sha256 = "bc286c36bf40c5447d8e4ee047f471c934fe99d4acba0de7a866f38d2ea83a21",
strip_prefix = "rules_fuzzing-0.1.1",
urls = ["https://github.com/bazelbuild/rules_fuzzing/archive/v0.1.1.tar.gz"],
sha256 = "f6f3f42c48576acd5653bf07637deee2ae4ebb77ccdb0dacc67c184508bedc8c",
strip_prefix = "rules_fuzzing-0.4.1",
urls = ["https://github.com/bazelbuild/rules_fuzzing/archive/v0.4.1.tar.gz"],
)

load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies")

rules_fuzzing_dependencies()
rules_fuzzing_dependencies(
honggfuzz = False,
jazzer = False,
)

load("@rules_fuzzing//fuzzing:init.bzl", "rules_fuzzing_init")

Expand All @@ -206,14 +213,14 @@ rules_fuzzing_init()
# OK, now we can bring in tcmalloc itself.
http_archive(
name = "com_google_tcmalloc",
patch_args = ["-p1"],
patches = [
"//:patches/tcmalloc/0001-Replace-ANNOTATE_MEMORY_IS_INITIALIZED-with-ABSL_ANN.patch",
],
sha256 = "10b1217154c2b432241ded580d6b0e0b01f5d2566b4eeacf2edf937b87683274",
strip_prefix = "google-tcmalloc-ca82471",
type = "tgz",
url = "https://github.com/google/tcmalloc/tarball/ca82471188f4832e82d2e77078ecad66f4c425d5",
patches = [
"//:patches/tcmalloc/0001-Replace-ANNOTATE_MEMORY_IS_INITIALIZED-with-ABSL_ANN.patch",
],
patch_args = ["-p1"],
)

# ========================================================================================
Expand Down Expand Up @@ -446,11 +453,11 @@ git_repository(

http_archive(
name = "perfetto",
patch_args = ["-p1"],
patches = [
"//:patches/perfetto/0001-Rename-ui-build-to-ui-build.sh-to-allow-bazel-build-.patch",
],
patch_args = ["-p1"],
repo_mapping = {"@perfetto_dep_zlib" : "@zlib"},
repo_mapping = {"@perfetto_dep_zlib": "@zlib"},
sha256 = "241cbaddc9ff4e5d1de2d28497fef40b5510e9ca60808815bf4944d0d2f026db",
strip_prefix = "perfetto-39.0",
type = "tgz",
Expand All @@ -460,17 +467,17 @@ http_archive(
# For use with perfetto
http_archive(
name = "com_google_protobuf",
sha256 = "2ee9dcec820352671eb83e081295ba43f7a4157181dad549024d7070d079cf65",
strip_prefix = "protobuf-3.9.0",
type = "tgz",
sha256 = "2ee9dcec820352671eb83e081295ba43f7a4157181dad549024d7070d079cf65",
url = "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.9.0.tar.gz",
)

# For use with perfetto
new_local_repository(
name = "perfetto_cfg",
build_file_content = "",
path = "build/perfetto",
build_file_content = ""
)

git_repository(
Expand Down Expand Up @@ -548,7 +555,7 @@ new_local_repository(
name = "lolhtml",
hdrs = ["@workerd//rust-deps:lol_html_api"],
deps = ["@workerd//rust-deps"],
# TODO(soon): This workaround appears to be needed when linking the rust library figure
# TODO(soon): This workaround appears to be needed when linking the rust library - figure
# out why and develop a better approach to address this.
linkopts = select({
"@platforms//os:windows": ["ntdll.lib"],
Expand Down
11 changes: 4 additions & 7 deletions build/BUILD.ada-url
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@

cc_library(
name = "ada-url",
hdrs = ["ada.h", "ada_c.h"],
srcs = ["ada.cpp"],
hdrs = [
"ada.h",
"ada_c.h",
],
visibility = ["//visibility:public"],
include_prefix = ".",
copts = ["-w"],
defines = [
"ADA_SSE2=1"
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just need some context... Why are you removing this define?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ada-url auto-detects support for SSE2, see https://github.com/ada-url/ada/blob/7ed703c4fddeaaa0178383a86df9f40d34ff2881/include/ada/common_defs.h#L292. SSE2 support is required for x86_64 machines and detected as such, so there is no need to enable it explicitly. I previously thought that this could also cause problems when compiling on arm64 as SSE2 is an x86-specific instruction set, but luckily ada checks for the presence of ADA_NEON before checking for SSE2 (Neon instructions are required for arm64 and also autodetected here).
Note that this also enables warnings for ada-url – disabling warnings can be useful for 3rd-Party dependencies and we do it manually for a few in .bazelrc but I didn't encounter any warnings locally on macOS so it might not be needed here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah nice. I added this originally because the build had failed originally locally without it but appears to be working with this now. Interesting.

)
23 changes: 14 additions & 9 deletions src/workerd/api/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,17 @@ wd_cc_library(
name = "rtti",
srcs = ["rtti.c++"],
hdrs = [
"rtti.h",
"modules.h",
"rtti.h",
"//src/pyodide:generated/pyodide_extra.capnp.h"
],
visibility = ["//visibility:public"],
deps = [
":html-rewriter",
"//src/workerd/io",
"//src/pyodide",
"//src/pyodide:pyodide_extra_capnp",
"//src/workerd/io",
"//src/workerd/jsg:rtti",
],
)

Expand All @@ -79,22 +81,27 @@ wd_cc_library(
name = "html-rewriter",
srcs = ["html-rewriter.c++"],
hdrs = ["html-rewriter.h"],
implementation_deps = [
"@com_cloudflare_lol_html//:lolhtml",
],
visibility = ["//visibility:public"],
deps = [
"//src/workerd/io",
"@com_cloudflare_lol_html//:lolhtml",
],
)

wd_cc_library(
name = "pyodide",
srcs = ["pyodide.c++"],
hdrs = ["pyodide.h", "//src/pyodide:generated/pyodide_extra.capnp.h"],
hdrs = [
"pyodide.h",
"//src/pyodide:generated/pyodide_extra.capnp.h",
],
visibility = ["//visibility:public"],
deps = [
"//src/workerd/server:workerd_capnp",
"//src/pyodide:pyodide",
"//src/pyodide",
"//src/pyodide:pyodide_extra_capnp",
"//src/workerd/server:workerd_capnp",
],
)

Expand Down Expand Up @@ -130,7 +137,7 @@ kj_test(
deps = [
"//src/workerd/io",
"//src/workerd/tests:test-fixture",
]
],
)

kj_test(
Expand Down Expand Up @@ -159,5 +166,3 @@ kj_test(
) for f in glob(
["**/*.wd-test"],
)]


13 changes: 6 additions & 7 deletions src/workerd/io/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ wd_cc_library(
":set_enable_experimental_webgpu": ["WORKERD_EXPERIMENTAL_ENABLE_WEBGPU"],
"//conditions:default": [],
}),
implementation_deps = [
"@capnp-cpp//src/kj/compat:kj-brotli",
"@capnp-cpp//src/kj/compat:kj-gzip",
],
visibility = ["//visibility:public"],
deps = [
":capnp",
Expand All @@ -63,18 +67,13 @@ wd_cc_library(
":worker-interface",
"//src/cloudflare",
"//src/node",
"//src/pyodide",
"//src/pyodide:pyodide_extra_capnp",
"//src/workerd/api:analytics-engine_capnp",
"//src/workerd/api:r2-api_capnp",
"//src/workerd/jsg",
"//src/workerd/jsg:rtti",
"//src/workerd/util:sqlite",
"@capnp-cpp//src/capnp:capnp-rpc",
"@capnp-cpp//src/capnp/compat:http-over-capnp",
"@capnp-cpp//src/kj:kj-async",
"@capnp-cpp//src/kj/compat:kj-brotli",
"@capnp-cpp//src/kj/compat:kj-gzip",
] + select({
":set_enable_experimental_webgpu": ["@dawn"],
"//conditions:default": [],
Expand All @@ -88,8 +87,8 @@ wd_cc_library(
visibility = ["//visibility:public"],
deps = [
":capnp",
"//src/workerd/util:perfetto",
"//src/workerd/util:own-util",
"//src/workerd/util:perfetto",
"//src/workerd/util:thread-scopes",
"@capnp-cpp//src/kj:kj-async",
"@capnp-cpp//src/kj/compat:kj-http",
Expand All @@ -109,7 +108,7 @@ wd_cc_library(
wd_cc_library(
name = "limit-enforcer",
hdrs = ["limit-enforcer.h"],
visibility = ["//visibility:public"]
visibility = ["//visibility:public"],
)

wd_cc_library(
Expand Down
2 changes: 1 addition & 1 deletion src/workerd/jsg/url.c++
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <kj/hash.h>

extern "C" {
#include <ada_c.h>
#include "ada_c.h"
}

#include <kj/debug.h>
Expand Down
6 changes: 4 additions & 2 deletions src/workerd/util/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ wd_cc_library(
"sqlite.h",
"sqlite-kv.h",
],
implementation_deps = [
"@sqlite3",
],
visibility = ["//visibility:public"],
deps = [
"@capnp-cpp//src/kj:kj-async",
"@sqlite3",
"//src/workerd/util:sentry",
"@capnp-cpp//src/kj:kj-async",
],
)

Expand Down
Loading