Skip to content
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
8 changes: 6 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,12 @@ build:windows --enable_runfiles
# used by some KJ macros, and understands the `.c++` extension by default.
# As of bazel 7, toolchain resolution is enabled by default, so we need to define a platform for
# the clang-cl build.
build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl
build:windows --extra_execution_platforms=//:x64_windows-clang-cl
#build:windows_x64 --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl
#build:windows_x64 --extra_execution_platforms=//:x64_windows-clang-cl
#build:windows_arm64 --extra_toolchains=@local_config_cc//:cc-toolchain-arm64_windows-clang-cl
#build:windows_arm64 --extra_execution_platforms=//:arm64_windows-clang-cl
build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-arm64_windows-clang-cl
build:windows --extra_execution_platforms=//:arm64_windows-clang-cl

# The Windows fastbuild bazel configuration is broken in that it necessarily generates PDB debug
# information while the Linux and macOS toolchains only compile with debug information in the dbg
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
sudo apt-get install -y --no-install-recommends clang-18 lld-18 libunwind-18 libc++abi1-18 libc++1-18 libc++-18-dev libclang-rt-18-dev llvm-18
sed -i -e "s%llvm-symbolizer%/usr/lib/llvm-18/bin/llvm-symbolizer%" .bazelrc
- name: Setup Windows
if: inputs.os_name == 'windows'
if: inputs.os_name == 'windows' || inputs.os_name == 'windows-arm'
# Set a custom output root directory to avoid long file name issues.
run: |
git config --global core.symlinks true
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
{ name: linux-arm, image: ubuntu-22.04-arm },
{ name: macOS, image: macos-15 },
{ name: windows, image: windows-2025 },
{ name: windows-arm, image: windows-11-arm },
]
config: [
# Default build: no suffix or additional bazel arguments
Expand All @@ -55,6 +56,8 @@ jobs:
exclude:
- os: { name: windows, image: windows-2025 }
config: { suffix: -debug }
- os: { name: windows-arm, image: windows-11-arm }
config: { suffix: -debug }
# due to resource constraints, exclude the macOS and x64 Linux debug runners for now.
# linux-asan and arm64 linux-debug should provide sufficient coverage for building in the
# debug configuration.
Expand Down
211 changes: 211 additions & 0 deletions 0001-Add-Windows-arm64-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Felix Hanau <felix@cloudflare.com>
Date: Sat, 3 May 2025 18:39:12 -0400
Subject: Add Windows arm64 support


diff --git a/docs/repo_utils.md b/docs/repo_utils.md
index 4d61bb21927ae8f39b50958706924fd8f9633b46..4cdcb6622083e491d7a0f83ef259ad70fd8d239a 100644
--- a/docs/repo_utils.md
+++ b/docs/repo_utils.md
@@ -194,6 +194,7 @@ Common os & architecture pairs that are returned are,
- linux_s390x
- linux_ppc64le
- windows_amd64
+- windows_arm64


**PARAMETERS**
diff --git a/lib/private/copy_directory_toolchain.bzl b/lib/private/copy_directory_toolchain.bzl
index 82329e4e4b3b7411248a1f170f473363d9c3038c..ebf6541c18e9d8b93c9e5aaa2aa9e109993f0a9e 100644
--- a/lib/private/copy_directory_toolchain.bzl
+++ b/lib/private/copy_directory_toolchain.bzl
@@ -48,6 +48,12 @@ COPY_DIRECTORY_PLATFORMS = {
"@platforms//cpu:x86_64",
],
),
+ "windows_arm64": struct(
+ compatible_with = [
+ "@platforms//os:windows",
+ "@platforms//cpu:aarch64",
+ ],
+ ),
}

CopyToDirectoryInfo = provider(
diff --git a/lib/private/copy_to_directory_toolchain.bzl b/lib/private/copy_to_directory_toolchain.bzl
index 42fe1f19d75edbe62c3840bfce86bfcca2cb6839..dad26bfc2f72f6f4d86bc5a7a9b3fd1cc38145cf 100644
--- a/lib/private/copy_to_directory_toolchain.bzl
+++ b/lib/private/copy_to_directory_toolchain.bzl
@@ -48,6 +48,12 @@ COPY_TO_DIRECTORY_PLATFORMS = {
"@platforms//cpu:x86_64",
],
),
+ "windows_arm64": struct(
+ compatible_with = [
+ "@platforms//os:windows",
+ "@platforms//cpu:aarch64",
+ ],
+ ),
}

CopyToDirectoryInfo = provider(
diff --git a/lib/private/coreutils_toolchain.bzl b/lib/private/coreutils_toolchain.bzl
index a288464864f91eb21df2476c269bd3d24707f1f5..6b50718fd5d2334d29af64f3224a7ca30927e37e 100644
--- a/lib/private/coreutils_toolchain.bzl
+++ b/lib/private/coreutils_toolchain.bzl
@@ -32,6 +32,12 @@ COREUTILS_PLATFORMS = {
"@platforms//cpu:x86_64",
],
),
+ "windows_arm64": struct(
+ compatible_with = [
+ "@platforms//os:windows",
+ "@platforms//cpu:aarch64",
+ ],
+ ),
}

# https://github.com/uutils/coreutils/releases
@@ -39,11 +45,41 @@ COREUTILS_PLATFORMS = {
# The integrity hashes can be automatically fetched for the coreutils releases by running
# `tools/coreutils_mirror_release.sh`.
COREUTILS_VERSIONS = {
+ "0.0.30": {
+ "darwin_arm64": {
+ "filename": "coreutils-0.0.30-aarch64-apple-darwin.tar.gz",
+ "sha256": "sha256-Hr8wERvrhvPSa0LFobCaZmBxSwinqvP/IzMh+ohQPW8="
+ },
+ "windows_arm64": {
+ "filename": "coreutils-0.0.30-aarch64-pc-windows-msvc.zip",
+ "sha256": "sha256-MP6aM2P4bvQ/KG4qQD27XO272vn+uZRs903RSlZWqrs="
+ },
+ "linux_arm64": {
+ "filename": "coreutils-0.0.30-aarch64-unknown-linux-musl.tar.gz",
+ "sha256": "sha256-4Gl5zOyO0xd/DblwdkIOyD5UhFAaSAjhEyBran+KqYg="
+ },
+ "darwin_amd64": {
+ "filename": "coreutils-0.0.30-x86_64-apple-darwin.tar.gz",
+ "sha256": "sha256-meue6x/kLNDRJbq8TzahJ/qiLfuoIMhhL8hj52M3qzQ="
+ },
+ "windows_amd64": {
+ "filename": "coreutils-0.0.30-x86_64-pc-windows-msvc.zip",
+ "sha256": "sha256-OTH1cP8mZdsJswYUUhcSzB0xQmeT4Yml23BNLEBZm6k="
+ },
+ "linux_amd64": {
+ "filename": "coreutils-0.0.30-x86_64-unknown-linux-musl.tar.gz",
+ "sha256": "sha256-lI98IeTtCMcFMuPMv6xWPaIzVA2lU6ldTCfiYASay3w="
+ }
+ },
"0.0.27": {
"darwin_arm64": {
"filename": "coreutils-0.0.27-aarch64-apple-darwin.tar.gz",
"sha256": "sha256-BjAeGgJ8+sLCIwmokCOkfelCCLtnNRH49QcFnrDq8a4=",
},
+ "windows_arm64": {
+ "filename": "coreutils-0.0.27-x86_64-pc-windows-msvc.zip",
+ "sha256": "sha256-DC4H+hQX51aHoFudV39n7u217NDcNL9AiG4o4edboV0=",
+ },
"linux_arm64": {
"filename": "coreutils-0.0.27-aarch64-unknown-linux-musl.tar.gz",
"sha256": "sha256-doU+ZfTyA5I8RSwDAcsOkEI3BZXFuFwBfEbg+diS06g=",
diff --git a/lib/private/expand_template_toolchain.bzl b/lib/private/expand_template_toolchain.bzl
index 5c9f9dd4c6301fe32e47e726fec91b11050db12c..89d831ee28f7dcaff641538563c328b63469b35e 100644
--- a/lib/private/expand_template_toolchain.bzl
+++ b/lib/private/expand_template_toolchain.bzl
@@ -48,6 +48,12 @@ EXPAND_TEMPLATE_PLATFORMS = {
"@platforms//cpu:x86_64",
],
),
+ "windows_arm64": struct(
+ compatible_with = [
+ "@platforms//os:windows",
+ "@platforms//cpu:aarch64",
+ ],
+ ),
}

ExpandTemplateInfo = provider(
diff --git a/lib/private/jq_toolchain.bzl b/lib/private/jq_toolchain.bzl
index f76eeefc8073e45e16b4ce2d421ba922609d0669..7969b4ec236a0b09faf5d7b33498a1029a2b80b5 100644
--- a/lib/private/jq_toolchain.bzl
+++ b/lib/private/jq_toolchain.bzl
@@ -39,6 +39,13 @@ JQ_PLATFORMS = {
"@platforms//cpu:x86_64",
],
),
+ "windows_arm64": struct(
+ release_platform = "win64",
+ compatible_with = [
+ "@platforms//os:windows",
+ "@platforms//cpu:x86_64",
+ ],
+ ),
}

DEFAULT_JQ_VERSION = "1.7"
diff --git a/lib/private/repo_utils.bzl b/lib/private/repo_utils.bzl
index e700c3e91940857978abb7257a7047700d815ac8..001994c9216b1bdf492d7a80e0972e7264669522 100644
--- a/lib/private/repo_utils.bzl
+++ b/lib/private/repo_utils.bzl
@@ -78,6 +78,7 @@ def _platform(rctx):
- linux_s390x
- linux_ppc64le
- windows_amd64
+ - windows_arm64

Args:
rctx: rctx
diff --git a/lib/private/yq_toolchain.bzl b/lib/private/yq_toolchain.bzl
index 4aee1e0c1c8b9359d68cd87798249af490c162b2..87ba7483ce9b8b16e29ee986f64a28bdfaea00ca 100644
--- a/lib/private/yq_toolchain.bzl
+++ b/lib/private/yq_toolchain.bzl
@@ -46,11 +46,17 @@ YQ_PLATFORMS = {
"@platforms//cpu:x86_64",
],
),
+ "windows_arm64": struct(
+ compatible_with = [
+ "@platforms//os:windows",
+ "@platforms//cpu:aarch64",
+ ],
+ ),
}

# Note: this is not the latest release, because it has significant breaking changes.
# See https://github.com/bazel-contrib/bazel-lib/pull/421
-DEFAULT_YQ_VERSION = "4.25.2"
+DEFAULT_YQ_VERSION = "4.45.2"

# https://github.com/mikefarah/yq/releases
#
@@ -61,6 +67,16 @@ DEFAULT_YQ_VERSION = "4.25.2"
# Alternatively, you can compute them manually by running
# `shasum -b -a 384 [downloaded file] | awk '{ print $1 }' | xxd -r -p | base64`
YQ_VERSIONS = {
+ "4.45.2": {
+ "darwin_amd64": "sha384-TBsrUTy6n6qA2hiSlpnEN6iEDDz4Tiy++AxLOpeXU1aUaI6uIuEBx8hgPYWWuD8V",
+ "darwin_arm64": "sha384-bnZ5TqsG5pcWB6gC87QKrBrjcKYmdOcSD7TpFVeCU6Nj7z5egeZzm4BH1FHbqo0e",
+ "linux_amd64": "sha384-jEOdMXHPvRiaFXWRnSA5Mw41VCKkNPv42i35i9BiVxrAnfyl/3/Li/iyQyj16QIr",
+ "linux_arm64": "sha384-4bEWn6fDQhIomb6Smzm8yw26RvqsjHh3PH/SogwWoLC9uJRoyQagY2PJZaYWxUDY",
+ "linux_s390x": "sha384-9uU3CXqjUG/SuPiHPKIUqbOVyqx7JiVOtRzeFta9IBFkJyUB0pBBOYkoDppvrmzz",
+ "linux_ppc64le": "sha384-bB03rZ0ptRt2EuFnA9SvscPMe3gVJecBvxhzPbYe7wsfoHvzzYqWffCchZVxRg+9",
+ "windows_amd64": "sha384-vG8R2+s/sD8DbeCM9H0xCy5JgtAOII7SLRx2g+ALtQZWW/q3XjXlzN2CKW/zU+EH",
+ "windows_arm64": "sha384-XHgi894S4cQ2qgJx47cPu5vtb2MOXA2YZ7QgExODwNoIPhji5wXK2MrgMB+RI7gZ",
+ },
"4.33.3": {
"darwin_amd64": "sha384-IJhMHD71yq+OR8AHFPfZr3XVpFlG2ZAfcexDKojtSLcCMV1pw0X2jza4qFUZiKEt",
"darwin_arm64": "sha384-euQkz1Bu/dFuJoRgG4xIh9BhP2RvOceTDPSY8EzSIM5xykbMkwDNhr1PtCcUF5ye",
diff --git a/tools/yq_mirror_release.sh b/tools/yq_mirror_release.sh
index 2b81f2f1a84a819a1e41e7965307221abcd30063..53550b80b9afcbb8bc07dabee16f3dd79208c53b 100755
--- a/tools/yq_mirror_release.sh
+++ b/tools/yq_mirror_release.sh
@@ -21,7 +21,7 @@ chmod u+x extract-checksum.sh

# Extract the checksums and output a starlark map entry
echo "\"$version\": {"
-platforms=(darwin_{amd64,arm64} linux_{amd64,arm64,s390x,ppc64le} windows_amd64)
+platforms=(darwin_{amd64,arm64} linux_{amd64,arm64,s390x,ppc64le} windows_{amd64,arm64})
for release in ${platforms[@]}; do
artifact=$release
if [[ $release == windows* ]]; then
12 changes: 10 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@aspect_rules_js//npm:defs.bzl", "npm_link_package")
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
Expand Down Expand Up @@ -28,7 +27,7 @@ capnp_es_binary.capnp_es_binary(
visibility = ["//visibility:public"],
)

# Platform definition for using clang-cl on Windows
# Platform definitions for using clang-cl on Windows
platform(
name = "x64_windows-clang-cl",
constraint_values = [
Expand All @@ -38,6 +37,15 @@ platform(
],
)

platform(
name = "arm64_windows-clang-cl",
constraint_values = [
"@platforms//cpu:aarch64",
"@platforms//os:windows",
"@bazel_tools//tools/cpp:clang-cl",
],
)

# Used for cross-compilation
platform(
name = "macOS_x86",
Expand Down
1 change: 1 addition & 0 deletions build/ci.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ build:ci-macOS --copt=-UDEBUG
build:ci-macOS-debug --config=debug

build:ci-windows --config=windows_no_dbg
build:ci-windows-arm --config=windows_no_dbg
build:ci-windows-debug --config=debug

# Some tests (like Python import tests) take a long time to run, especially when debug is enabled
Expand Down
9 changes: 9 additions & 0 deletions build/deps/build_deps.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@
"repo": "rules_nodejs",
"file_regex": "^rules_nodejs-.*\\.tar\\.gz$"
},
{
// Needed for aspect_rules_js, build fails on Windows if it is not fetched explicitly.
// rules_js 2.1.0 uses a fixed version, once we update to that version this can be dropped.
"name": "aspect_bazel_lib",
"type": "github_release",
"owner": "bazel-contrib",
"repo": "bazel-lib",
"file_regex": "^bazel-lib-.*\\.tar\\.gz$"
},
{
"name": "aspect_rules_js",
"type": "github_release",
Expand Down
2 changes: 2 additions & 0 deletions build/deps/gen/build_deps.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

load("@//build/deps:gen/dep_aspect_bazel_lib.bzl", "dep_aspect_bazel_lib")
load("@//build/deps:gen/dep_aspect_rules_esbuild.bzl", "dep_aspect_rules_esbuild")
load("@//build/deps:gen/dep_aspect_rules_js.bzl", "dep_aspect_rules_js")
load("@//build/deps:gen/dep_aspect_rules_ts.bzl", "dep_aspect_rules_ts")
Expand Down Expand Up @@ -36,6 +37,7 @@ def deps_gen():
dep_rules_shell()
dep_aspect_rules_esbuild()
dep_rules_nodejs()
dep_aspect_bazel_lib()
dep_aspect_rules_js()
dep_aspect_rules_ts()
dep_clang_format_linux_amd64()
Expand Down
22 changes: 22 additions & 0 deletions build/deps/gen/dep_aspect_bazel_lib.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

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

TAG_NAME = "v2.15.3"
URL = "https://github.com/bazel-contrib/bazel-lib/releases/download/v2.15.3/bazel-lib-v2.15.3.tar.gz"
STRIP_PREFIX = "bazel-lib-2.15.3"
SHA256 = "2be8a5df0b20b0ed37604b050da01dbf7ad45ad44768c0d478b64779b9f58412"
TYPE = "tgz"

def dep_aspect_bazel_lib():
http_archive(
name = "aspect_bazel_lib",
url = URL,
strip_prefix = STRIP_PREFIX,
type = TYPE,
sha256 = SHA256,
patch_args = ["-p1"],
patches = [
"//:0001-Add-Windows-arm64-support.patch",
],
)
11 changes: 11 additions & 0 deletions deps/rust/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,22 @@ selects.config_setting_group(
],
)

selects.config_setting_group(
name = "win_arm64",
match_all = [
"@platforms//os:windows",
"@platforms//cpu:aarch64",
],
)

CARGO_BAZEL = select({
":linux_x64": "@cargo_bazel_linux_x64//file:downloaded",
":linux_arm64": "@cargo_bazel_linux_arm64//file:downloaded",
":macos_x64": "@cargo_bazel_macos_x64//file:downloaded",
":macos_arm64": "@cargo_bazel_macos_arm64//file:downloaded",
":win_x64": "@cargo_bazel_win_x64//file:downloaded.exe",
# TODO(use native arm64 binary)
":win_arm64": "@cargo_bazel_win_x64//file:downloaded.exe",
})

# Generates a repository containing all the crates we reference from our
Expand All @@ -73,6 +83,7 @@ crates_vendor(
"aarch64-unknown-linux-gnu",
"x86_64-unknown-linux-gnu",
"x86_64-pc-windows-msvc",
"aarch64-pc-windows-msvc",
],
)

Expand Down
3 changes: 3 additions & 0 deletions deps/rust/crates/BUILD.backtrace-0.3.74.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ rust_library(
"@crates_vendor__miniz_oxide-0.8.8//:miniz_oxide", # cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))
"@crates_vendor__object-0.36.7//:object", # cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))
],
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [
"@crates_vendor__windows-targets-0.52.6//:windows_targets", # cfg(windows)
],
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [
"@crates_vendor__addr2line-0.24.2//:addr2line", # cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))
"@crates_vendor__libc-0.2.172//:libc", # cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))
Expand Down
3 changes: 3 additions & 0 deletions deps/rust/crates/BUILD.mio-1.0.3.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ rust_library(
"@rules_rust//rust/platform:aarch64-apple-darwin": [
"@crates_vendor__libc-0.2.172//:libc", # cfg(unix)
],
"@rules_rust//rust/platform:aarch64-pc-windows-msvc": [
"@crates_vendor__windows-sys-0.52.0//:windows_sys", # cfg(windows)
],
"@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [
"@crates_vendor__libc-0.2.172//:libc", # cfg(unix)
],
Expand Down
Loading
Loading