Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
29 changes: 4 additions & 25 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,6 @@

module(name = "workerd")

bazel_dep(name = "aspect_bazel_lib", version = "2.21.2")
bazel_dep(name = "aspect_rules_lint", version = "1.10.2")
bazel_dep(name = "bazel_features", version = "1.38.0")
bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "rules_shell", version = "0.6.1")

# abseil is used by protobuf and tcmalloc.
bazel_dep(name = "abseil-cpp", version = "20250814.0")

# Not pulling in platforms via bzlmod causes issues with the Windows clang-cl toolchain
bazel_dep(name = "platforms", version = "1.0.0")

# While the build should succeed with the default toolchain configuration from rules_cc,
Copy link
Member

Choose a reason for hiding this comment

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

Where did these comment go?

# apple_support is more tailored to macOS and allows us to cross-compile easily. Note that this
# needs to be pulled in before rules_cc for this toolchain to actually be used.
bazel_dep(name = "apple_support", version = "2.0.0")
bazel_dep(name = "rules_cc", version = "0.2.15")

# compatibility proxy is needed when using current rules_cc with Bazel 8
compat = use_extension("@rules_cc//cc:extensions.bzl", "compatibility_proxy")
use_repo(compat, "cc_compatibility_proxy")

bazel_dep(name = "zlib", version = "1.3.1.bcr.7")
git_override(
module_name = "zlib",
Expand All @@ -37,9 +15,6 @@ git_override(
remote = "https://chromium.googlesource.com/chromium/src/third_party/zlib.git",
)

# Rust
bazel_dep(name = "rules_rust", version = "0.68.1")

# BoringSSL may subtly break backwards compatibility and behave differently than the latest FIPS
# version, often by rejecting key values that it considers invalid/unsafe even though they are still
# accepted by BoringSSL. Update with caution and only after confirming this is compatible with the
Expand Down Expand Up @@ -67,3 +42,7 @@ include("//build/deps:oci.MODULE.bazel")
include("//build/deps:gen/deps/deps.MODULE.bazel")
include("//build/deps:gen/build_deps/build_deps.MODULE.bazel")
include("//build/deps:gen/shared_deps/shared_deps.MODULE.bazel")

# compatibility proxy is needed when using current rules_cc with Bazel 8
compat = use_extension("@rules_cc//cc:extensions.bzl", "compatibility_proxy")
use_repo(compat, "cc_compatibility_proxy")
48 changes: 48 additions & 0 deletions build/deps/build_deps.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,54 @@
{
"$schema": "deps.schema.json",
"repositories": [
// bazel_deps from MODULE.bazel
{
"name": "aspect_bazel_lib",
"type": "bazel_dep"
},
{
"name": "aspect_rules_lint",
"type": "bazel_dep"
},
{
"name": "bazel_features",
"type": "bazel_dep"
},
{
"name": "bazel_skylib",
"type": "bazel_dep"
},
{
"name": "rules_shell",
"type": "bazel_dep"
},
// abseil is used by protobuf and tcmalloc.
{
"name": "abseil-cpp",
"type": "bazel_dep",
"freeze_version": "20250814.0"
},
// Not pulling in platforms via bzlmod causes issues with the Windows clang-cl toolchain
Copy link
Member Author

Choose a reason for hiding this comment

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

@anonrig Claude moved them here as requested

{
"name": "platforms",
"type": "bazel_dep"
},
// While the build should succeed with the default toolchain configuration from rules_cc,
// apple_support is more tailored to macOS and allows us to cross-compile easily. Note that this
// needs to be pulled in before rules_cc for this toolchain to actually be used.
{
"name": "apple_support",
"type": "bazel_dep"
},
{
"name": "rules_cc",
"type": "bazel_dep"
},
// Rust
{
"name": "rules_rust",
"type": "bazel_dep"
},
// rust
{
"name": "cargo_bazel_linux_x64",
Expand Down
5 changes: 0 additions & 5 deletions build/deps/deps.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
"""Bazel dependencies that were previously in WORKSPACE
This file is included from the root MODULE.bazel"""

bazel_dep(name = "ada-url", version = "3.3.0")
bazel_dep(name = "brotli", version = "1.2.0")

########################################################
# Override BCR versions.
# We want to avoid version skew with v8, so we use identical versions.
Expand Down Expand Up @@ -81,5 +78,3 @@ archive_override(
strip_prefix = "sqlite-src-3470000",
url = "https://sqlite.org/2024/sqlite-src-3470000.zip",
)

bazel_dep(name = "tcmalloc", version = "0.0.0-20250927-12f2552")
14 changes: 14 additions & 0 deletions build/deps/deps.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
{
"$schema": "deps.schema.json",
"repositories": [
// bazel_deps from deps.MODULE.bazel
{
"name": "ada-url",
"type": "bazel_dep"
},
{
"name": "brotli",
"type": "bazel_dep"
},
{
"name": "tcmalloc",
"type": "bazel_dep",
"freeze_version": "0.0.0-20250927-12f2552"
},
{
"name": "capnp-cpp",
"type": "github_tarball",
Expand Down
19 changes: 19 additions & 0 deletions build/deps/deps.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,25 @@
"build_file"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"const": "bazel_dep"
},
"name": {
"type": "string"
},
"freeze_version": {
"type": "string"
}
},
"required": [
"type",
"name"
],
"additionalProperties": false
}
]
}
Expand Down
10 changes: 10 additions & 0 deletions build/deps/gen/build_deps/build_deps.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

include("//build/deps:gen/build_deps/dep_abseil_cpp.MODULE.bazel")
include("//build/deps:gen/build_deps/dep_apple_support.MODULE.bazel")
include("//build/deps:gen/build_deps/dep_aspect_bazel_lib.MODULE.bazel")
include("//build/deps:gen/build_deps/dep_aspect_rules_lint.MODULE.bazel")
include("//build/deps:gen/build_deps/dep_bazel_features.MODULE.bazel")
include("//build/deps:gen/build_deps/dep_bazel_skylib.MODULE.bazel")
include("//build/deps:gen/build_deps/dep_cargo_bazel_linux_arm64.MODULE.bazel")
include("//build/deps:gen/build_deps/dep_cargo_bazel_linux_x64.MODULE.bazel")
include("//build/deps:gen/build_deps/dep_cargo_bazel_macos_arm64.MODULE.bazel")
Expand All @@ -8,3 +14,7 @@ include("//build/deps:gen/build_deps/dep_cargo_bazel_win_x64.MODULE.bazel")
include("//build/deps:gen/build_deps/dep_clang_tidy_darwin_arm64.MODULE.bazel")
include("//build/deps:gen/build_deps/dep_clang_tidy_linux_amd64.MODULE.bazel")
include("//build/deps:gen/build_deps/dep_clang_tidy_linux_arm64.MODULE.bazel")
include("//build/deps:gen/build_deps/dep_platforms.MODULE.bazel")
include("//build/deps:gen/build_deps/dep_rules_cc.MODULE.bazel")
include("//build/deps:gen/build_deps/dep_rules_rust.MODULE.bazel")
include("//build/deps:gen/build_deps/dep_rules_shell.MODULE.bazel")
6 changes: 6 additions & 0 deletions build/deps/gen/build_deps/dep_abseil_cpp.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

bazel_dep(
name = "abseil-cpp",
version = "20250814.0",
)
6 changes: 6 additions & 0 deletions build/deps/gen/build_deps/dep_apple_support.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

bazel_dep(
name = "apple_support",
version = "2.0.0",
)
6 changes: 6 additions & 0 deletions build/deps/gen/build_deps/dep_aspect_bazel_lib.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

bazel_dep(
name = "aspect_bazel_lib",
version = "2.22.0",
)
6 changes: 6 additions & 0 deletions build/deps/gen/build_deps/dep_aspect_rules_lint.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

bazel_dep(
name = "aspect_rules_lint",
version = "1.13.0",
)
6 changes: 6 additions & 0 deletions build/deps/gen/build_deps/dep_bazel_features.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

bazel_dep(
name = "bazel_features",
version = "1.38.0",
)
6 changes: 6 additions & 0 deletions build/deps/gen/build_deps/dep_bazel_skylib.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

bazel_dep(
name = "bazel_skylib",
version = "1.9.0",
)
6 changes: 6 additions & 0 deletions build/deps/gen/build_deps/dep_platforms.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

bazel_dep(
name = "platforms",
version = "1.0.0",
)
6 changes: 6 additions & 0 deletions build/deps/gen/build_deps/dep_rules_cc.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

bazel_dep(
name = "rules_cc",
version = "0.2.16",
)
6 changes: 6 additions & 0 deletions build/deps/gen/build_deps/dep_rules_rust.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

bazel_dep(
name = "rules_rust",
version = "0.68.1",
)
6 changes: 6 additions & 0 deletions build/deps/gen/build_deps/dep_rules_shell.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

bazel_dep(
name = "rules_shell",
version = "0.6.1",
)
6 changes: 6 additions & 0 deletions build/deps/gen/deps/dep_ada_url.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

bazel_dep(
name = "ada-url",
version = "3.3.0",
)
6 changes: 6 additions & 0 deletions build/deps/gen/deps/dep_brotli.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

bazel_dep(
name = "brotli",
version = "1.2.0",
)
6 changes: 3 additions & 3 deletions build/deps/gen/deps/dep_capnp_cpp.MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
http = use_extension("@//:build/exts/http.bzl", "http")
http.archive(
name = "capnp-cpp",
sha256 = "0429076f317d21655ecd2a92e6972ea49632b15e5433bde99e36e082b061e72f",
strip_prefix = "capnproto-capnproto-8db2b3c/c++",
sha256 = "0884582731fb8b9a6ef7a0d58056535d0480533256958d3eaae189d706bc43aa",
strip_prefix = "capnproto-capnproto-0776402/c++",
type = "tgz",
url = "https://github.com/capnproto/capnproto/tarball/8db2b3c13a9f18b18b2375811fef6261218e0b01",
url = "https://github.com/capnproto/capnproto/tarball/07764022ba75c6924a250d5be0bf2e83250602a0",
)
use_repo(http, "capnp-cpp")
6 changes: 6 additions & 0 deletions build/deps/gen/deps/dep_tcmalloc.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

bazel_dep(
name = "tcmalloc",
version = "0.0.0-20250927-12f2552",
)
3 changes: 3 additions & 0 deletions build/deps/gen/deps/deps.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

include("//build/deps:gen/deps/dep_ada_url.MODULE.bazel")
include("//build/deps:gen/deps/dep_brotli.MODULE.bazel")
include("//build/deps:gen/deps/dep_capnp_cpp.MODULE.bazel")
include("//build/deps:gen/deps/dep_dragonbox.MODULE.bazel")
include("//build/deps:gen/deps/dep_nbytes.MODULE.bazel")
include("//build/deps:gen/deps/dep_ncrypto.MODULE.bazel")
include("//build/deps:gen/deps/dep_simdutf.MODULE.bazel")
include("//build/deps:gen/deps/dep_tcmalloc.MODULE.bazel")
include("//build/deps:gen/deps/dep_wpt.MODULE.bazel")
44 changes: 44 additions & 0 deletions build/deps/update-deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import subprocess
import sys
import tarfile
import types
import urllib.request
import zipfile
from pathlib import Path
Expand Down Expand Up @@ -56,6 +57,15 @@
)


BAZEL_DEP_TEMPLATE = (
TOP
+ """
bazel_dep({attrs}
)
"""
)


GITHUB_ACCESS_TOKEN = ""


Expand Down Expand Up @@ -371,13 +381,47 @@ def gen_git_clone(repo):
)


def get_bcr_version(name: str) -> str:
module_versions_url = f"https://bcr.bazel.build/modules/{name}/metadata.json"
with urllib.request.urlopen(module_versions_url) as res:
meta = json.load(res, object_hook=lambda d: types.SimpleNamespace(**d))
# FIXME: Is the last version listed always latest?
new_version = meta.versions[-1]
return new_version


def gen_bazel_dep(repo):
name = repo["name"]

# Always fetch the latest version from BCR
latest_version = get_bcr_version(name)

if "freeze_version" in repo:
frozen_version = repo["freeze_version"]
if frozen_version != latest_version:
print(
f"frozen, update available: {frozen_version} -> {latest_version}",
end="",
)
version = frozen_version
else:
print(latest_version, end="")
version = latest_version

return BAZEL_DEP_TEMPLATE.format(
attrs=format_attr_list(dict(name=name, version=version))
)


def gen_repo_str(repo):
if repo["type"] == "github_tarball":
return gen_github_tarball(repo)
elif repo["type"] == "github_release":
return gen_github_release(repo)
elif repo["type"] == "git_clone":
return gen_git_clone(repo)
elif repo["type"] == "bazel_dep":
return gen_bazel_dep(repo)
else:
raise UnsupportedException(f"Unsupported repo type: {repo['type']}")

Expand Down