From aed3485726cf49aa7355b1e2504bef74aa79d30d Mon Sep 17 00:00:00 2001 From: Felix Hanau Date: Sat, 28 Dec 2024 00:28:12 +0000 Subject: [PATCH] [build] Add support for Bazel header parsing Header parsing will be part of the downstream lint checks, I hope to add it to the workerd lint job in a follow-up PR too. --- src/workerd/api/node/buffer-string-search.h | 9 ++++++--- src/workerd/jsg/BUILD.bazel | 2 ++ src/workerd/util/BUILD.bazel | 5 +++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/workerd/api/node/buffer-string-search.h b/src/workerd/api/node/buffer-string-search.h index 55b1e671be1..c2f6f343459 100644 --- a/src/workerd/api/node/buffer-string-search.h +++ b/src/workerd/api/node/buffer-string-search.h @@ -28,8 +28,11 @@ // found in the LICENSE file. #pragma once -#include -#include +#include + +#include + +using kj::uint; namespace workerd::api::node { namespace stringsearch { @@ -201,7 +204,7 @@ inline T AlignDown(T value, U alignment) { } inline uint8_t GetHighestValueByte(uint16_t character) { - return std::max(static_cast(character & 0xFF), static_cast(character >> 8)); + return kj::max(static_cast(character & 0xFF), static_cast(character >> 8)); } inline uint8_t GetHighestValueByte(uint8_t character) { diff --git a/src/workerd/jsg/BUILD.bazel b/src/workerd/jsg/BUILD.bazel index db18b202ded..5eb9925e707 100644 --- a/src/workerd/jsg/BUILD.bazel +++ b/src/workerd/jsg/BUILD.bazel @@ -54,6 +54,8 @@ wd_cc_library( "web-idl.h", "wrappable.h", ], + # Some JSG headers can't be compiled on their own + features = ["-parse_headers"], visibility = ["//visibility:public"], deps = [ ":exception", diff --git a/src/workerd/util/BUILD.bazel b/src/workerd/util/BUILD.bazel index 9d4edf94f2f..bac0f29ab31 100644 --- a/src/workerd/util/BUILD.bazel +++ b/src/workerd/util/BUILD.bazel @@ -63,6 +63,8 @@ wd_cc_library( ":duration-exceeded-logger", "@capnp-cpp//src/kj", "@capnp-cpp//src/kj:kj-async", + # TODO(cleanup): Only for abortable.h, factor out + "@capnp-cpp//src/kj/compat:kj-http", ], ) @@ -165,6 +167,9 @@ wd_cc_library( name = "sentry", hdrs = ["sentry.h"], visibility = ["//visibility:public"], + deps = [ + "@capnp-cpp//src/kj", + ], ) wd_cc_library(