Skip to content

Commit

Permalink
[build] Fix Windows build
Browse files Browse the repository at this point in the history
aspect_bazel_lib (and by extension rules_js) has broken dependencies, manually
pull in the fixed version.
  • Loading branch information
fhanau committed Sep 19, 2024
1 parent 501ef65 commit c5152e9
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
17 changes: 17 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,23 @@ rust_analyzer_dependencies()
#
# workerd uses Node.js scripts for generating TypeScript types.

# TODO(soon): rules_js depends on bazel-lib, which broke on Windows after a dependency binary was
# deleted. There is a fix available at https://github.com/bazel-contrib/bazel-lib/pull/940, but it
# is based off of a commit where WORKSPACE dependencies appear to be broken. Create a patch for the
# latest release build instead. Remove this ASAP once the fix has been merged and rules_js has been
# updated with the fixed version.
http_archive(
name = "aspect_bazel_lib",
patch_args = ["-p1"],
patches = [
# based on https://github.com/bazel-contrib/bazel-lib/pull/940.
"//:patches/bazel-lib/0001-chore-deps-upgrade-to-newest-bsdtar.patch",
],
sha256 = "688354ee6beeba7194243d73eb0992b9a12e8edeeeec5b6544f4b531a3112237",
strip_prefix = "bazel-lib-2.8.1",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.8.1/bazel-lib-v2.8.1.tar.gz",
)

http_archive(
name = "aspect_rules_js",
sha256 = "6b7e73c35b97615a09281090da3645d9f03b2a09e8caa791377ad9022c88e2e6",
Expand Down
72 changes: 72 additions & 0 deletions patches/bazel-lib/0001-chore-deps-upgrade-to-newest-bsdtar.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
From fa8dd505d99db57f3a9c00a40d01971ab6a5a3c3 Mon Sep 17 00:00:00 2001
From: Alex Eagle <[email protected]>
Date: Tue, 17 Sep 2024 13:26:20 -0700
Subject: chore(deps): upgrade to newest bsdtar


diff --git a/lib/private/tar_toolchain.bzl b/lib/private/tar_toolchain.bzl
index 22fe717b5095e338272c6a48b1eeafbacece4fa1..0ed46317422c528bdf97903b08501d990b48ee69 100644
--- a/lib/private/tar_toolchain.bzl
+++ b/lib/private/tar_toolchain.bzl
@@ -36,44 +36,36 @@ BSDTAR_PLATFORMS = {

BSDTAR_PREBUILT = {
"darwin_amd64": (
- "https://github.com/aspect-build/bsdtar-prebuilt/releases/download/v3.7.4-3/tar_darwin_amd64",
- "e872943518f946a4a73106c1fa811c0211cb74a6e6d673f5a2ffbfaf40806ec0",
+ "https://github.com/aspect-build/bsdtar-prebuilt/releases/download/v3.7.5-1/tar_darwin_amd64",
+ "6c7752869833c5cd4cf9728f90afd37f6665d7f9e06a4fbfdeb0fa41267575cf",
),
"darwin_arm64": (
- "https://github.com/aspect-build/bsdtar-prebuilt/releases/download/v3.7.4-3/tar_darwin_arm64",
- "81d992eeefb519421dc18db63fce51f7fef7204b94e17e9b490af7699b565ff1",
+ "https://github.com/aspect-build/bsdtar-prebuilt/releases/download/v3.7.5-1/tar_darwin_arm64",
+ "1718c23919bae478ed13c682a341e389de6ba4396220fc8e75a7f0e5d6024019",
),
"linux_amd64": (
- "https://github.com/aspect-build/bsdtar-prebuilt/releases/download/v3.7.4-3/tar_linux_amd64",
- "9dba82030199b2660086e458fa6481cf73089ee5c47d216e647bb2a6b0fae792",
+ "https://github.com/aspect-build/bsdtar-prebuilt/releases/download/v3.7.5-1/tar_linux_amd64",
+ "b8c492a51fb9e4c59dfa71b3c62191210c48280b98c2a88f7cef8ba973a9ad39",
),
"linux_arm64": (
- "https://github.com/aspect-build/bsdtar-prebuilt/releases/download/v3.7.4-3/tar_linux_arm64",
- "105f91ad792fce13030bd249d8f9a14fd7ceaf908e1caeb99685b0b1fac44be2",
+ "https://github.com/aspect-build/bsdtar-prebuilt/releases/download/v3.7.5-1/tar_linux_arm64",
+ "aa760c25a5445320bb3cde06e60c99ebc95fb29f330af0212bd099dd24e1cc54",
),
"windows_amd64": (
- "https://github.com/libarchive/libarchive/releases/download/v3.7.4/libarchive-v3.7.4-amd64.zip",
- "7ced6865d5e22e1dab0c3f3d65094d946ae505ec4e8db026f82c9e1c413f3c59",
+ "https://github.com/aspect-build/bsdtar-prebuilt/releases/download/v3.7.5-1/tar_windows_x86_64.exe",
+ "80c109b9477ed44e9f8626cd9d8a635c8761c4506030c91f46b289798c7a22b6",
),
}

def _bsdtar_binary_repo(rctx):
(url, sha256) = BSDTAR_PREBUILT[rctx.attr.platform]
- if rctx.attr.platform.startswith("windows"):
- rctx.download_and_extract(
- url = url,
- type = "zip",
- sha256 = sha256,
- )
- binary = "libarchive/bin/bsdtar.exe"
- else:
- rctx.download(
- url = url,
- output = "tar",
- executable = True,
- sha256 = sha256,
- )
- binary = "tar"
+ binary = "tar.exe" if rctx.attr.platform.startswith("windows") else "tar"
+ rctx.download(
+ url = url,
+ output = binary,
+ executable = True,
+ sha256 = sha256,
+ )

rctx.file("BUILD.bazel", """\
# @generated by @aspect_bazel_lib//lib/private:tar_toolchain.bzl

0 comments on commit c5152e9

Please sign in to comment.