diff --git a/.bazelrc b/.bazelrc index 80fb5f7ce01..49367fbe744 100644 --- a/.bazelrc +++ b/.bazelrc @@ -346,6 +346,15 @@ build:windows --enable_runfiles build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl build:windows --extra_execution_platforms=//:x64_windows-clang-cl +# Windows ARM64 overrides: use the ARM64 platform instead of x64. The toolchain name is +# auto-generated by local_config_cc – if this doesn't match what Bazel detects on the ARM64 +# runner, query @local_config_cc//:all to find the correct name. +build:windows_arm64 --extra_toolchains=@local_config_cc//:cc-toolchain-arm64_windows-clang-cl +build:windows_arm64 --extra_execution_platforms=//:arm64_windows-clang-cl +# clang-cl on ARM64 Windows doesn't auto-link compiler-rt builtins, causing undefined symbols +# like __udivti3 (128-bit integer division). Link the builtins library explicitly. +build:windows_arm64 --linkopt=clang_rt.builtins-aarch64.lib + # 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 # configuration or when requested with the -g flag. This causes huge increases in compile time and @@ -435,6 +444,9 @@ build:release_windows --per_file_copt="src/workerd/server/container-client"@/cla # Work around Windows test failures in rpc-related tests build:release_windows --per_file_copt=src/workerd/io/worker-interface@/clang:-fno-inline +build:release_windows_arm64 --config=release_windows +build:release_windows_arm64 --config=windows_arm64 + build:windows --cxxopt='/std:c++23preview' --host_cxxopt='/std:c++23preview' build:windows --copt='/D_CRT_USE_BUILTIN_OFFSETOF' --host_copt='/D_CRT_USE_BUILTIN_OFFSETOF' build:windows --copt='/DWIN32_LEAN_AND_MEAN' --host_copt='/DWIN32_LEAN_AND_MEAN' diff --git a/.github/actions/setup-runner/action.yml b/.github/actions/setup-runner/action.yml index 3e93db9dbe9..d5f0cbf1c87 100644 --- a/.github/actions/setup-runner/action.yml +++ b/.github/actions/setup-runner/action.yml @@ -49,6 +49,14 @@ runs: git config --show-scope --show-origin core.symlinks git config --system core.longpaths true [System.IO.File]::WriteAllLines((Join-Path -Path $env:USERPROFILE -ChildPath '.bazelrc'), 'startup --output_user_root=\\\\?\\C:\\tmp') + - name: Use Bazel 9.0.2rc1 on ARM64 Windows + shell: pwsh + if: runner.os == 'Windows' && runner.arch == 'ARM64' + # Bazel 9.0.1 has a broken ARM64 Windows build (bazelbuild/bazel#28941). + # Use 9.0.2rc1 which fixes the JNI DLL architecture mismatch. + # TODO(cleanup): Remove this once .bazelversion is bumped to 9.0.2+. + run: | + echo "USE_BAZEL_VERSION=9.0.2rc1" >> $env:GITHUB_ENV - name: Setup macOS if: runner.os == 'macOS' shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4b932573ac6..01af1aff805 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -104,6 +104,11 @@ jobs: image: windows-2025-16core bazel-config: release_windows target-arch: X64 + - title: windows-arm64 + os-name: Windows + image: windows-11-arm + bazel-config: release_windows_arm64 + target-arch: ARM64 name: build (${{ matrix.title }}) uses: './.github/workflows/_bazel.yml' with: @@ -130,8 +135,6 @@ jobs: strategy: matrix: arch: [linux-64, darwin-64, windows-64] - # This variable itself is unused, but allows us to set up two macOS builds. arm64 builds for - # other platforms will be supported later, then we'll list both architectures here. cpu: [X64] include: - arch: linux-64 @@ -146,6 +149,9 @@ jobs: cpu: ARM64 - arch: windows-64 name: Windows-X64 + - arch: windows-arm64 + name: Windows-ARM64 + cpu: ARM64 steps: - name: Checkout Repo uses: actions/checkout@v6 @@ -158,15 +164,15 @@ jobs: name: ${{ matrix.name }}-binary path: /tmp # Set execute permissions before compressing the binary - - if: matrix.arch != 'windows-64' + - if: ${{ !contains(matrix.arch, 'windows') }} run: chmod +x /tmp/workerd - name: Compress release binary run: | # As of release v1.20230404.0 the Linux x64 binary after debug_strip is 65.8 MB, # 21.0 MB with gzip and 17.3 MB with brotli -9. Use gzip as a widely supported format # which still produces an acceptable compressed size. - gzip -9N -k /tmp/workerd${{ matrix.arch == 'windows-64' && '.exe' || '' }} - - run: mv /tmp/workerd${{ matrix.arch == 'windows-64' && '.exe' || '' }}.gz /tmp/workerd-${{ matrix.arch }}.gz + gzip -9N -k /tmp/workerd${{ contains(matrix.arch, 'windows') && '.exe' || '' }} + - run: mv /tmp/workerd${{ contains(matrix.arch, 'windows') && '.exe' || '' }}.gz /tmp/workerd-${{ matrix.arch }}.gz # Upload compressed release binaries – one set of artifacts is sufficient with gzip being # widely supported - name: Upload Release Assets @@ -191,7 +197,7 @@ jobs: WORKERD_VERSION: ${{ needs.version.outputs.version }} LATEST_COMPATIBILITY_DATE: ${{ needs.version.outputs.date }} - run: mkdir npm/workerd-${{ matrix.arch }}/bin - - run: cp /tmp/workerd${{ matrix.arch == 'windows-64' && '.exe' || '' }} npm/workerd-${{ matrix.arch }}/bin/workerd${{ matrix.arch == 'windows-64' && '.exe' || '' }} + - run: cp /tmp/workerd${{ contains(matrix.arch, 'windows') && '.exe' || '' }} npm/workerd-${{ matrix.arch }}/bin/workerd${{ contains(matrix.arch, 'windows') && '.exe' || '' }} - run: echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > npm/workerd-${{ matrix.arch }}/.npmrc - run: cd npm/workerd-${{ matrix.arch }} && npm publish --access public --tag ${{ startsWith(needs.version.outputs.version, '0') && 'beta' || 'latest'}} env: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9f003357ec4..2afc3278c15 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,6 +37,7 @@ jobs: { name: linux-arm, arch: ARM64, image: ubuntu-22.04-arm-16core }, { name: macOS, arch: ARM64, image: macos-15-xlarge, use_lld: true }, { name: windows, arch: X64, image: windows-2025-16core }, + { name: windows-arm64, arch: ARM64, image: windows-11-arm }, ] config: [ # Default build: no suffix or additional bazel arguments @@ -57,6 +58,8 @@ jobs: exclude: - os: { name: windows, arch: X64, image: windows-2025-16core } config: { suffix: -debug } + - os: { name: windows-arm64, arch: ARM64, 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. diff --git a/BUILD.bazel b/BUILD.bazel index f9f8c1a3714..98e91c5a7a6 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -62,6 +62,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", diff --git a/MODULE.bazel b/MODULE.bazel index 5519dd686a9..68a7ae786f3 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -35,6 +35,42 @@ archive_override( bazel_dep(name = "rules_go", version = "0.60.0", repo_name = None) bazel_dep(name = "rules_android", version = "0.7.1", repo_name = None) +# Override yq.bzl to 0.3.5 for Windows ARM64 yq toolchain support. The transitive version (0.3.2) +# pulled in by aspect_rules_js lacks windows_arm64 in its platform list. +bazel_dep(name = "yq.bzl", version = "0.3.5") +archive_override( + module_name = "yq.bzl", + integrity = "sha256-zma0n7LjdqDY0rxYe8GqIju96A6GwKghRXCYp56lgDg=", + strip_prefix = "yq.bzl-0.3.5", + url = "https://github.com/bazel-contrib/yq.bzl/releases/download/v0.3.5/yq.bzl-v0.3.5.tar.gz", +) + +# Patch aspect_rules_js to add yq_windows_arm64 to its use_repo list. Without this, the +# @yq_windows_arm64 repo created by yq.bzl is not visible from aspect_rules_js's module scope. +archive_override( + module_name = "aspect_rules_js", + integrity = "sha256-eBgxR7xQutVxi+c7M4Dn9G4hR/PJl6KQ4sXpWZQQUuE=", + patch_args = ["-p1"], + patches = [ + "//:patches/aspect_rules_js/0001-add-yq-windows-arm64-to-use-repo.patch", + ], + strip_prefix = "rules_js-3.0.3", + url = "https://github.com/aspect-build/rules_js/releases/download/v3.0.3/rules_js-v3.0.3.tar.gz", +) + +# Patch aspect_rules_esbuild to add win32-arm64 platform + integrity hash. The upstream rules +# don't include ARM64 Windows despite esbuild shipping native binaries for it. +archive_override( + module_name = "aspect_rules_esbuild", + integrity = "sha256-tz1ly+0pGMOC93pUihBpgrQPhSAPAlVl1c+hsuCQEec=", + patch_args = ["-p1"], + patches = [ + "//:patches/aspect_rules_esbuild/0001-add-win32-arm64-platform.patch", + ], + strip_prefix = "rules_esbuild-0.25.1", + url = "https://github.com/aspect-build/rules_esbuild/releases/download/v0.25.1/rules_esbuild-v0.25.1.tar.gz", +) + # Automatically managed dependencies include("//build/deps:gen/deps.MODULE.bazel") include("//build/deps:gen/build_deps.MODULE.bazel") diff --git a/RELEASE.md b/RELEASE.md index 0c8a435a580..b1b5f92a15a 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -8,4 +8,4 @@ The primary distribution channel for `workerd` right now is through `npm`. We us ## Cutting Releases -This is pretty simple, and completely automatic—every time the date in [release-version.txt](src/workerd/io/release-version.txt) changes, a new release is generated, along with the built binaries for `linux-64`, `linux-arm64`, `darwin-64`, `darwin-arm64` and `windows-64`. The types will also be generated and published automatically. This is governed by the [release.yml](.github/workflows/release.yml) GitHub Action. +This is pretty simple, and completely automatic—every time the date in [release-version.txt](src/workerd/io/release-version.txt) changes, a new release is generated, along with the built binaries for `linux-64`, `linux-arm64`, `darwin-64`, `darwin-arm64`, `windows-64` and `windows-arm64`. The types will also be generated and published automatically. This is governed by the [release.yml](.github/workflows/release.yml) GitHub Action. diff --git a/build/ci.bazelrc b/build/ci.bazelrc index 995053de13e..0423e44dc38 100644 --- a/build/ci.bazelrc +++ b/build/ci.bazelrc @@ -88,12 +88,17 @@ test:ci-macOS --spawn_strategy=local build:ci-windows --config=release_windows build:ci-windows-debug --config=debug +build:ci-windows-arm64 --config=release_windows_arm64 + # Some tests (like Python import tests) take a long time to run, especially when debug is enabled # For that reason, we only run them in the default configuration for each platform to minimize # effect on CI pipeline runtime. test:ci-linux --test_size_filters= test:ci-macOS --test_size_filters= test:ci-windows --test_size_filters= +test:ci-windows-arm64 --test_size_filters= +# The windows-11-arm runner has only 4 vCPUs (vs 16 for x64 Windows), so tests need more time. +test:ci-windows-arm64 --test_timeout=15,60,240,240 # Run container tests on Linux CI test:ci-linux --test_tag_filters=-off-by-default,-requires-fuzzilli diff --git a/build/deps/rust.MODULE.bazel b/build/deps/rust.MODULE.bazel index 4e4506dade2..e9f97d0a905 100644 --- a/build/deps/rust.MODULE.bazel +++ b/build/deps/rust.MODULE.bazel @@ -8,6 +8,8 @@ RUST_TARGET_TRIPLES = [ "x86_64-apple-darwin", # Add support for macOS rosetta "aarch64-unknown-linux-gnu", + # Add support for Windows ARM64 + "aarch64-pc-windows-msvc", ] # rules_rust @@ -36,6 +38,7 @@ rust.toolchain( "x86_64-pc-windows-msvc": ["-Ctarget-feature=+sse4.2"], "aarch64-unknown-linux-gnu": ["-Ctarget-feature=+crc"], # No options needed for aarch64-apple-darwin: CRC feature is enabled by default. + # No options needed for aarch64-pc-windows-msvc: CRC feature is enabled by default on ARM64. }, extra_target_triples = RUST_TARGET_TRIPLES, rustfmt_version = RUST_NIGHTLY_VERSION, diff --git a/deps/rust/BUILD.bazel b/deps/rust/BUILD.bazel index 419608a3838..bbc0acc4719 100644 --- a/deps/rust/BUILD.bazel +++ b/deps/rust/BUILD.bazel @@ -45,12 +45,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", + # x64 cargo-bazel runs under emulation on Windows ARM64 + ":win_arm64": "@cargo_bazel_win_x64//file:downloaded.exe", }) # Generates a repository containing all the crates we reference from our @@ -82,6 +92,7 @@ crates_vendor( "aarch64-unknown-linux-gnu", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc", + "aarch64-pc-windows-msvc", ], ) diff --git a/deps/rust/crates/BUILD.ahash-0.8.12.bazel b/deps/rust/crates/BUILD.ahash-0.8.12.bazel index 1c1a5bb807a..e5e020bbeee 100644 --- a/deps/rust/crates/BUILD.ahash-0.8.12.bazel +++ b/deps/rust/crates/BUILD.ahash-0.8.12.bazel @@ -56,6 +56,9 @@ rust_library( "@rules_rust//rust/platform:x86_64-apple-darwin": [ "@crates_vendor__once_cell-1.21.4//:once_cell", # cfg(not(all(target_arch = "arm", target_os = "none"))) ], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [ + "@crates_vendor__once_cell-1.21.4//:once_cell", # cfg(not(all(target_arch = "arm", target_os = "none"))) + ], "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [ "@crates_vendor__once_cell-1.21.4//:once_cell", # cfg(not(all(target_arch = "arm", target_os = "none"))) ], diff --git a/deps/rust/crates/BUILD.jobserver-0.1.34.bazel b/deps/rust/crates/BUILD.jobserver-0.1.34.bazel index ea21894bb82..961f26e94d0 100644 --- a/deps/rust/crates/BUILD.jobserver-0.1.34.bazel +++ b/deps/rust/crates/BUILD.jobserver-0.1.34.bazel @@ -51,6 +51,9 @@ rust_library( "@rules_rust//rust/platform:x86_64-apple-darwin": [ "@crates_vendor__libc-0.2.183//:libc", # cfg(unix) ], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [ + "@crates_vendor__getrandom-0.3.4//:getrandom", # cfg(windows) + ], "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [ "@crates_vendor__getrandom-0.3.4//:getrandom", # cfg(windows) ], diff --git a/deps/rust/crates/BUILD.mio-1.2.0.bazel b/deps/rust/crates/BUILD.mio-1.2.0.bazel index 1c8fdd0ed1a..55759229699 100644 --- a/deps/rust/crates/BUILD.mio-1.2.0.bazel +++ b/deps/rust/crates/BUILD.mio-1.2.0.bazel @@ -56,6 +56,9 @@ rust_library( "@rules_rust//rust/platform:x86_64-apple-darwin": [ "@crates_vendor__libc-0.2.183//:libc", # cfg(any(unix, target_os = "hermit", target_os = "wasi")) ], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [ + "@crates_vendor__windows-sys-0.61.2//:windows_sys", # cfg(windows) + ], "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [ "@crates_vendor__windows-sys-0.61.2//:windows_sys", # cfg(windows) ], diff --git a/deps/rust/crates/BUILD.sha1-0.10.6.bazel b/deps/rust/crates/BUILD.sha1-0.10.6.bazel index 68fbd011c88..855177dd72a 100644 --- a/deps/rust/crates/BUILD.sha1-0.10.6.bazel +++ b/deps/rust/crates/BUILD.sha1-0.10.6.bazel @@ -58,6 +58,9 @@ rust_library( "@rules_rust//rust/platform:x86_64-apple-darwin": [ "@crates_vendor__cpufeatures-0.2.17//:cpufeatures", # cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")) ], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [ + "@crates_vendor__cpufeatures-0.2.17//:cpufeatures", # cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")) + ], "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [ "@crates_vendor__cpufeatures-0.2.17//:cpufeatures", # cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")) ], diff --git a/deps/rust/crates/BUILD.socket2-0.6.3.bazel b/deps/rust/crates/BUILD.socket2-0.6.3.bazel index 6ec06936883..8d8420d28b9 100644 --- a/deps/rust/crates/BUILD.socket2-0.6.3.bazel +++ b/deps/rust/crates/BUILD.socket2-0.6.3.bazel @@ -54,6 +54,9 @@ rust_library( "@rules_rust//rust/platform:x86_64-apple-darwin": [ "@crates_vendor__libc-0.2.183//:libc", # cfg(any(unix, target_os = "wasi")) ], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [ + "@crates_vendor__windows-sys-0.61.2//:windows_sys", # cfg(windows) + ], "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [ "@crates_vendor__windows-sys-0.61.2//:windows_sys", # cfg(windows) ], diff --git a/deps/rust/crates/BUILD.termcolor-1.4.1.bazel b/deps/rust/crates/BUILD.termcolor-1.4.1.bazel index 1ffd857c3a9..58db6521099 100644 --- a/deps/rust/crates/BUILD.termcolor-1.4.1.bazel +++ b/deps/rust/crates/BUILD.termcolor-1.4.1.bazel @@ -42,6 +42,9 @@ rust_library( ], version = "1.4.1", deps = select({ + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [ + "@crates_vendor__winapi-util-0.1.11//:winapi_util", # cfg(windows) + ], "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [ "@crates_vendor__winapi-util-0.1.11//:winapi_util", # cfg(windows) ], diff --git a/deps/rust/crates/BUILD.tokio-1.50.0.bazel b/deps/rust/crates/BUILD.tokio-1.50.0.bazel index 207831d0088..ac098db8cfb 100644 --- a/deps/rust/crates/BUILD.tokio-1.50.0.bazel +++ b/deps/rust/crates/BUILD.tokio-1.50.0.bazel @@ -37,6 +37,9 @@ rust_library( "socket2", "time", ] + select({ + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [ + "windows-sys", # aarch64-pc-windows-msvc + ], "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [ "windows-sys", # x86_64-pc-windows-msvc ], @@ -69,6 +72,9 @@ rust_library( "@rules_rust//rust/platform:x86_64-apple-darwin": [ "@crates_vendor__libc-0.2.183//:libc", # x86_64-apple-darwin ], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [ + "@crates_vendor__windows-sys-0.61.2//:windows_sys", # aarch64-pc-windows-msvc + ], "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [ "@crates_vendor__windows-sys-0.61.2//:windows_sys", # x86_64-pc-windows-msvc ], diff --git a/deps/rust/crates/BUILD.winapi-util-0.1.11.bazel b/deps/rust/crates/BUILD.winapi-util-0.1.11.bazel index e65f9416061..3c6a2325660 100644 --- a/deps/rust/crates/BUILD.winapi-util-0.1.11.bazel +++ b/deps/rust/crates/BUILD.winapi-util-0.1.11.bazel @@ -42,6 +42,9 @@ rust_library( ], version = "0.1.11", deps = select({ + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [ + "@crates_vendor__windows-sys-0.61.2//:windows_sys", # cfg(windows) + ], "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [ "@crates_vendor__windows-sys-0.61.2//:windows_sys", # cfg(windows) ], diff --git a/deps/rust/crates/defs.bzl b/deps/rust/crates/defs.bzl index 15735bec951..935ce6b6896 100644 --- a/deps/rust/crates/defs.bzl +++ b/deps/rust/crates/defs.bzl @@ -402,14 +402,14 @@ _CONDITIONS = { "cfg(all(target_arch = \"wasm32\", target_os = \"wasi\", target_env = \"p2\"))": [], "cfg(all(target_os = \"uefi\", getrandom_backend = \"efi_rng\"))": [], "cfg(any())": [], - "cfg(any(target_arch = \"aarch64\", target_arch = \"x86\", target_arch = \"x86_64\"))": ["@rules_rust//rust/platform:aarch64-apple-darwin", "@rules_rust//rust/platform:aarch64-unknown-linux-gnu", "@rules_rust//rust/platform:x86_64-apple-darwin", "@rules_rust//rust/platform:x86_64-pc-windows-msvc", "@rules_rust//rust/platform:x86_64-unknown-linux-gnu"], + "cfg(any(target_arch = \"aarch64\", target_arch = \"x86\", target_arch = \"x86_64\"))": ["@rules_rust//rust/platform:aarch64-apple-darwin", "@rules_rust//rust/platform:aarch64-pc-windows-msvc", "@rules_rust//rust/platform:aarch64-unknown-linux-gnu", "@rules_rust//rust/platform:x86_64-apple-darwin", "@rules_rust//rust/platform:x86_64-pc-windows-msvc", "@rules_rust//rust/platform:x86_64-unknown-linux-gnu"], "cfg(any(target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"hurd\", target_os = \"illumos\", target_os = \"cygwin\", all(target_os = \"horizon\", target_arch = \"arm\")))": [], "cfg(any(target_os = \"haiku\", target_os = \"redox\", target_os = \"nto\", target_os = \"aix\"))": [], "cfg(any(target_os = \"ios\", target_os = \"visionos\", target_os = \"watchos\", target_os = \"tvos\"))": [], "cfg(any(target_os = \"macos\", target_os = \"openbsd\", target_os = \"vita\", target_os = \"emscripten\"))": ["@rules_rust//rust/platform:aarch64-apple-darwin", "@rules_rust//rust/platform:x86_64-apple-darwin"], "cfg(any(unix, target_os = \"hermit\", target_os = \"wasi\"))": ["@rules_rust//rust/platform:aarch64-apple-darwin", "@rules_rust//rust/platform:aarch64-unknown-linux-gnu", "@rules_rust//rust/platform:x86_64-apple-darwin", "@rules_rust//rust/platform:x86_64-unknown-linux-gnu"], "cfg(any(unix, target_os = \"wasi\"))": ["@rules_rust//rust/platform:aarch64-apple-darwin", "@rules_rust//rust/platform:aarch64-unknown-linux-gnu", "@rules_rust//rust/platform:x86_64-apple-darwin", "@rules_rust//rust/platform:x86_64-unknown-linux-gnu"], - "cfg(not(all(target_arch = \"arm\", target_os = \"none\")))": ["@rules_rust//rust/platform:aarch64-apple-darwin", "@rules_rust//rust/platform:aarch64-unknown-linux-gnu", "@rules_rust//rust/platform:x86_64-apple-darwin", "@rules_rust//rust/platform:x86_64-pc-windows-msvc", "@rules_rust//rust/platform:x86_64-unknown-linux-gnu"], + "cfg(not(all(target_arch = \"arm\", target_os = \"none\")))": ["@rules_rust//rust/platform:aarch64-apple-darwin", "@rules_rust//rust/platform:aarch64-pc-windows-msvc", "@rules_rust//rust/platform:aarch64-unknown-linux-gnu", "@rules_rust//rust/platform:x86_64-apple-darwin", "@rules_rust//rust/platform:x86_64-pc-windows-msvc", "@rules_rust//rust/platform:x86_64-unknown-linux-gnu"], "cfg(not(windows))": ["@rules_rust//rust/platform:aarch64-apple-darwin", "@rules_rust//rust/platform:aarch64-unknown-linux-gnu", "@rules_rust//rust/platform:x86_64-apple-darwin", "@rules_rust//rust/platform:x86_64-unknown-linux-gnu"], "cfg(target_os = \"hermit\")": [], "cfg(target_os = \"netbsd\")": [], @@ -417,8 +417,9 @@ _CONDITIONS = { "cfg(target_os = \"vxworks\")": [], "cfg(target_os = \"wasi\")": [], "cfg(unix)": ["@rules_rust//rust/platform:aarch64-apple-darwin", "@rules_rust//rust/platform:aarch64-unknown-linux-gnu", "@rules_rust//rust/platform:x86_64-apple-darwin", "@rules_rust//rust/platform:x86_64-unknown-linux-gnu"], - "cfg(windows)": ["@rules_rust//rust/platform:x86_64-pc-windows-msvc"], + "cfg(windows)": ["@rules_rust//rust/platform:aarch64-pc-windows-msvc", "@rules_rust//rust/platform:x86_64-pc-windows-msvc"], "x86_64-apple-darwin": ["@rules_rust//rust/platform:x86_64-apple-darwin"], + "aarch64-pc-windows-msvc": ["@rules_rust//rust/platform:aarch64-pc-windows-msvc"], "x86_64-pc-windows-msvc": ["@rules_rust//rust/platform:x86_64-pc-windows-msvc"], "x86_64-unknown-linux-gnu": ["@rules_rust//rust/platform:x86_64-unknown-linux-gnu"], } diff --git a/images/BUILD.bazel b/images/BUILD.bazel index 91c80184435..60258f4ab28 100644 --- a/images/BUILD.bazel +++ b/images/BUILD.bazel @@ -9,6 +9,9 @@ IMAGES = { command( name = name, command = target, + target_compatible_with = [ + "@platforms//os:linux", + ], ) for (name, target) in IMAGES.items() ] @@ -16,4 +19,7 @@ IMAGES = { multirun( name = "load_all", commands = IMAGES.keys(), + target_compatible_with = [ + "@platforms//os:linux", + ], ) diff --git a/images/container-client-test/BUILD.bazel b/images/container-client-test/BUILD.bazel index 510b9d28d99..a47b0610a31 100644 --- a/images/container-client-test/BUILD.bazel +++ b/images/container-client-test/BUILD.bazel @@ -37,6 +37,9 @@ oci_load( name = "load", image = ":image", repo_tags = ["cloudflare/workerd/container-client-test:latest"], + target_compatible_with = [ + "@platforms//os:linux", + ], visibility = ["//visibility:public"], ) @@ -44,5 +47,8 @@ oci_load( name = "load-proxy-everything", image = "@proxy_everything", repo_tags = ["cloudflare/proxy-everything:main"], + target_compatible_with = [ + "@platforms//os:linux", + ], visibility = ["//visibility:public"], ) diff --git a/npm/lib/node-platform.ts b/npm/lib/node-platform.ts index ae9264b4bd1..348c6e97167 100644 --- a/npm/lib/node-platform.ts +++ b/npm/lib/node-platform.ts @@ -17,6 +17,7 @@ export const knownPackages: Record = { "darwin x64 LE": "@cloudflare/workerd-darwin-64", "linux arm64 LE": "@cloudflare/workerd-linux-arm64", "linux x64 LE": "@cloudflare/workerd-linux-64", + "win32 arm64 LE": "@cloudflare/workerd-windows-arm64", "win32 x64 LE": "@cloudflare/workerd-windows-64", }; diff --git a/npm/scripts/build-shim-package.mjs b/npm/scripts/build-shim-package.mjs index 94eba0a93fc..c801e7025f5 100644 --- a/npm/scripts/build-shim-package.mjs +++ b/npm/scripts/build-shim-package.mjs @@ -17,6 +17,7 @@ function buildNeutralLib() { '@cloudflare/workerd-darwin-64': process.env.WORKERD_VERSION, '@cloudflare/workerd-linux-arm64': process.env.WORKERD_VERSION, '@cloudflare/workerd-linux-64': process.env.WORKERD_VERSION, + '@cloudflare/workerd-windows-arm64': process.env.WORKERD_VERSION, '@cloudflare/workerd-windows-64': process.env.WORKERD_VERSION, }; fs.writeFileSync(pjPath, JSON.stringify(package_json, null, 2) + '\n'); diff --git a/npm/workerd-windows-arm64/package.json b/npm/workerd-windows-arm64/package.json new file mode 100644 index 00000000000..e0c5a3f9743 --- /dev/null +++ b/npm/workerd-windows-arm64/package.json @@ -0,0 +1,17 @@ +{ + "name": "@cloudflare/workerd-windows-arm64", + "description": "👷 workerd for Windows ARM64, Cloudflare's JavaScript/Wasm Runtime", + "repository": "https://github.com/cloudflare/workerd", + "license": "Apache-2.0", + "preferUnplugged": false, + "engines": { + "node": ">=16" + }, + "os": [ + "win32" + ], + "cpu": [ + "arm64" + ], + "version": "1.20220926.0" +} diff --git a/npm/workerd/package.json b/npm/workerd/package.json index de01663616a..86c57aa085b 100644 --- a/npm/workerd/package.json +++ b/npm/workerd/package.json @@ -18,6 +18,7 @@ "@cloudflare/workerd-darwin-64": "1.20220926.0", "@cloudflare/workerd-linux-arm64": "1.20220926.0", "@cloudflare/workerd-linux-64": "1.20220926.0", + "@cloudflare/workerd-windows-arm64": "1.20220926.0", "@cloudflare/workerd-windows-64": "1.20220926.0" }, "license": "Apache-2.0" diff --git a/patches/aspect_rules_esbuild/0001-add-win32-arm64-platform.patch b/patches/aspect_rules_esbuild/0001-add-win32-arm64-platform.patch new file mode 100644 index 00000000000..e3eec67ece8 --- /dev/null +++ b/patches/aspect_rules_esbuild/0001-add-win32-arm64-platform.patch @@ -0,0 +1,29 @@ +diff --git a/esbuild/private/toolchains_repo.bzl b/esbuild/private/toolchains_repo.bzl +index 7ac299c..d3c9648 100644 +--- a/esbuild/private/toolchains_repo.bzl ++++ b/esbuild/private/toolchains_repo.bzl +@@ -52,6 +52,12 @@ _PLATFORMS = { + "@platforms//cpu:x86_64", + ], + ), ++ "win32-arm64": struct( ++ compatible_with = [ ++ "@platforms//os:windows", ++ "@platforms//cpu:aarch64", ++ ], ++ ), + } + + def get_platforms(version): +diff --git a/esbuild/private/versions.bzl b/esbuild/private/versions.bzl +index fa70920..be75f12 100644 +--- a/esbuild/private/versions.bzl ++++ b/esbuild/private/versions.bzl +@@ -100,6 +100,7 @@ TOOL_VERSIONS = { + "linux-x64": "sha512-JUjpystGFFmNrEHQnIVG8hKwvA2DN5o7RqiO1CVX8EN/F/gkCjkUMgVn6hzScpwnJtl2mPR6I9XV1oW8k9O+0A==", + "linux-arm64": "sha512-PiPblfe1BjK7WDAKR1Cr9O7VVPqVNpwFcPWgfn4xu0eMemzRp442hXyzF/fSwgrufI66FpHOEJk0yYdPInsmyQ==", + "win32-x64": "sha512-oxoQgglOP7RH6iasDrhY+R/3cHrfwIDvRlT4CGChflq6twk8iENeVvMJjmvBb94Ik1Z+93iGO27err7w6l54GQ==", ++ "win32-arm64": "sha512-GQoa6OrQ8G08guMFgeXPH7yE/8Dt0IfOGWJSfSH4uafwdC7rWwrfE6P9N8AtPGIjUzdo2+7bN8Xo3qC578olhg==", + }, + "0.19.8": { + "npm": "sha512-l7iffQpT2OrZfH2rXIp7/FkmaeZM0vxbxN9KfiCwGYuZqzMg/JdvX26R31Zxn/Pxvsrg3Y9N6XTcnknqDyyv4w==", diff --git a/patches/aspect_rules_js/0001-add-yq-windows-arm64-to-use-repo.patch b/patches/aspect_rules_js/0001-add-yq-windows-arm64-to-use-repo.patch new file mode 100644 index 00000000000..f8b7e62be78 --- /dev/null +++ b/patches/aspect_rules_js/0001-add-yq-windows-arm64-to-use-repo.patch @@ -0,0 +1,12 @@ +diff --git a/MODULE.bazel b/MODULE.bazel +index 9100e7b..c773576 100644 +--- a/MODULE.bazel ++++ b/MODULE.bazel +@@ -72,6 +72,7 @@ use_repo( + "yq_linux_ppc64le", + "yq_linux_s390x", + "yq_windows_amd64", ++ "yq_windows_arm64", + ) + + tar_toolchains = use_extension("@tar.bzl//tar:extensions.bzl", "toolchains") diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel index 6dd0c7ade0f..e037ca3d839 100644 --- a/tools/BUILD.bazel +++ b/tools/BUILD.bazel @@ -51,6 +51,8 @@ native_binary( "@bazel_tools//src/conditions:darwin_arm64": "@wasm_tools_macos_arm64//:wasm-tools", "@bazel_tools//src/conditions:darwin_x86_64": "@wasm_tools_macos_x64//:wasm-tools", "@bazel_tools//src/conditions:windows_x64": "@wasm_tools_windows_x64//:wasm-tools.exe", + # x64 binary runs under emulation on Windows ARM64 + "@bazel_tools//src/conditions:windows_arm64": "@wasm_tools_windows_x64//:wasm-tools.exe", }, ), out = "wasm-tools", @@ -65,6 +67,8 @@ native_binary( "@bazel_tools//src/conditions:linux_aarch64": "@clang_tidy_linux_arm64//file:downloaded", "@bazel_tools//src/conditions:darwin_arm64": "@clang_tidy_darwin_arm64//file:downloaded", "@bazel_tools//src/conditions:windows_x64": "@clang_tidy_windows_amd64//file:downloaded", + # x64 binary runs under emulation on Windows ARM64 + "@bazel_tools//src/conditions:windows_arm64": "@clang_tidy_windows_amd64//file:downloaded", }, ), out = "clang_tidy", diff --git a/tools/windows/workspace-status.cmd b/tools/windows/workspace-status.cmd index be63831ffad..80c1a57cbe7 100644 --- a/tools/windows/workspace-status.cmd +++ b/tools/windows/workspace-status.cmd @@ -4,14 +4,16 @@ @rem find git.exe for /F "tokens=* USEBACKQ" %%F in (`where git.exe`) do ( set "GIT=%%F" - break + goto :found_git ) +:found_git @rem Git's bash is located at %GITINSTALLDIR%\bin\bash.exe -@rem Git's git.exe is typically located at %GITINSTALLDIR%\cmd\git.exe or -@rem %GITINSTALLDIR%\mingw64\bin\git.exe. +@rem Git's git.exe is typically located at %GITINSTALLDIR%\cmd\git.exe, +@rem %GITINSTALLDIR%\mingw64\bin\git.exe, or %GITINSTALLDIR%\bin\git.exe. set "_GITEXEDIR=%GIT:\cmd\git.exe=%" -set "GITEXEDIR=%_GITEXEDIR:\mingw64\bin\git.exe=%" +set "_GITEXEDIR=%_GITEXEDIR:\mingw64\bin\git.exe=%" +set "GITEXEDIR=%_GITEXEDIR:\bin\git.exe=%" set "BASH=%GITEXEDIR%\bin\bash.exe" @rem Change to the directory of this script (tools/windows) to