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

[EXP] Bazel 8 support #3013

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -371,3 +371,5 @@ build:windows --cxxopt='/Zc:__cplusplus' --host_cxxopt='/Zc:__cplusplus'
# enable clang coverage: https://clang.llvm.org/docs/SourceBasedCodeCoverage.html
build:clang-coverage --copt="-fprofile-instr-generate" --linkopt="-fprofile-instr-generate"
build:clang-coverage --copt="-fcoverage-mapping" --linkopt="-fcoverage-mapping"

build --enable_workspace --incompatible_autoload_externally="+@rules_python,+@protobuf,@rules_shell"
3 changes: 2 additions & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
7.3.1
ed9bbd0e510afce7981f8af5916c034a2476715f
# last available bazel 8 commit as of 10/25
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# We don't use bzlmod at this time, but bazel 8 still expects us to have a MODULE.bazel file.
51 changes: 51 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,54 @@ deps_gen()
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")

http_archive(
name = "rules_cc",
sha256 = "d9bdd3ec66b6871456ec9c965809f43a0901e692d754885e89293807762d3d80",
strip_prefix = "rules_cc-0.0.13",
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.13/rules_cc-0.0.13.tar.gz"],
)

PTAG_NAME = "v28.2"

PURL = "https://github.com/protocolbuffers/protobuf/releases/download/v28.2/protobuf-28.2.tar.gz"

PSTRIP_PREFIX = "protobuf-28.2"

PSHA256 = "b2340aa47faf7ef10a0328190319d3f3bee1b24f426d4ce8f4253b6f27ce16db"

PTYPE = "tgz"

http_archive(
name = "protobuf",
sha256 = PSHA256,
strip_prefix = PSTRIP_PREFIX,
type = PTYPE,
url = PURL,
)

http_archive(
name = "rules_shell",
sha256 = "0d0c56d01c3c40420bf7bf14d73113f8a92fbd9f5cd13205a3b89f72078f0321",
strip_prefix = "rules_shell-0.1.1",
url = "https://github.com/bazelbuild/rules_shell/releases/download/v0.1.1/rules_shell-v0.1.1.tar.gz",
)

load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains")

rules_shell_dependencies()

rules_shell_toolchains()

http_archive(
name = "rules_proto",
sha256 = "66bfdf8782796239d3875d37e7de19b1d94301e8972b3cbd2446b332429b4df1",
strip_prefix = "rules_proto-4.0.0",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
],
)

NODE_VERSION = "20.14.0"

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
Expand Down Expand Up @@ -53,6 +101,8 @@ load("@rules_python//python:repositories.bzl", "py_repositories", "python_regist

py_repositories()

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

http_archive(
name = "com_google_benchmark",
integrity = "sha256-a8GApX0j1NlRVRn5KwyD1hsFtbqxiJYfNqx7BrDZ6c4=",
Expand Down Expand Up @@ -302,6 +352,7 @@ http_archive(
"//:patches/v8/0018-Update-illegal-invocation-error-message-in-v8.patch",
"//:patches/v8/0019-Implement-cross-request-context-promise-resolve-hand.patch",
"//:patches/v8/0020-Modify-where-to-look-for-fast_float-dependency.patch",
"//:patches/v8/0021-bazel-Add-missing-imports-needed-with-Bazel-8.patch",
],
strip_prefix = "v8-13.0.245.16",
url = "https://github.com/v8/v8/archive/refs/tags/13.0.245.16.tar.gz",
Expand Down
8 changes: 4 additions & 4 deletions build/deps/gen/dep_rules_python.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

load("@//:build/http.bzl", "http_archive")

TAG_NAME = "0.37.0"
URL = "https://api.github.com/repos/bazelbuild/rules_python/tarball/0.37.0"
STRIP_PREFIX = "bazelbuild-rules_python-0c0492d"
SHA256 = "442740dfce802db482633d11302ef0894c2d8641c988aa1aa8f129acccdee2be"
TAG_NAME = "0.37.1"
URL = "https://api.github.com/repos/bazelbuild/rules_python/tarball/0.37.1"
STRIP_PREFIX = "bazelbuild-rules_python-8c3acea"
SHA256 = "3a71f2ab193743465bbaa3b426028577a35e032f052f67018d284a16a3ce328f"
TYPE = "tgz"

def dep_rules_python():
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
From c9688d31cd8e1e8cbb5624f9cee367029d5a728a Mon Sep 17 00:00:00 2001
From: Felix Hanau <felix@cloudflare.com>
Date: Sun, 27 Oct 2024 16:49:31 +0000
Subject: [bazel] Add missing imports needed with Bazel 8


diff --git a/BUILD.bazel b/BUILD.bazel
index 3fa74551420b48f226553ddaa00eb9926a3b009f..5860920e592b2b22d44bbd6a62783fc472e4dcf7 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -3,7 +3,7 @@
# found in the LICENSE file.

load("@bazel_skylib//lib:selects.bzl", "selects")
-load("@rules_python//python:defs.bzl", "py_binary")
+load("@rules_python//python:defs.bzl", "py_binary", "py_test")
load("@v8_python_deps//:requirements.bzl", "requirement")
load(
"@v8//:bazel/defs.bzl",
9 changes: 1 addition & 8 deletions src/workerd/util/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,10 @@ wd_cc_library(
"perfetto-tracing.h",
"use-perfetto-categories.h",
],
defines = select({
"@platforms//os:windows": [],
"//conditions:default": ["WORKERD_USE_PERFETTO"],
}),
visibility = ["//visibility:public"],
deps = [
"@capnp-cpp//src/kj",
] + select({
"@platforms//os:windows": [],
"//conditions:default": ["@perfetto//:libperfetto_client_experimental"],
}),
],
)
# TODO(later): Currently perfetto support is not enabled on Windows simply because the
# perfetto bazel build fails on windows for some reason and it's currently not worth
Expand Down
Loading