Skip to content

Commit

Permalink
build: workaround aspect bazel lib tar.gz windows issue
Browse files Browse the repository at this point in the history
Workaround until `rules_js` imports the latest version of
`aspect_bazel_lib`: bazel-contrib/bazel-lib#968
  • Loading branch information
devversion committed Dec 2, 2024
1 parent 4139a54 commit 0ef1a3d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ jobs:
subset: [npm, esbuild]
shard: [0, 1, 2, 3, 4, 5]
exclude:
# Skip yarn subset on Windows
- os: windows-latest
subset: yarn
# Skip pnpm subset on Windows
- os: windows-latest
subset: pnpm
# Skip Node.js v18 tests on Windows
- os: windows-latest
node: 18
Expand All @@ -91,6 +85,10 @@ jobs:
node: 20
runs-on: ${{ matrix.os }}
steps:
# Workaround for: https://github.com/bazel-contrib/bazel-lib/issues/968.
# TODO(devversion): Remove when Aspect lib issue is fixed.
- run: choco install gzip
if: ${{matrix.os == 'windows-latest'}}
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@9ad44d7add69b53cec32d6486e9e8a83e7ec6622
- name: Install node modules
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ jobs:
e2e-windows-subset:
runs-on: windows-latest
steps:
# Workaround for: https://github.com/bazel-contrib/bazel-lib/issues/968.
# TODO(devversion): Remove when Aspect lib issue is fixed.
- run: choco install gzip
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@9ad44d7add69b53cec32d6486e9e8a83e7ec6622
- name: Install node modules
Expand Down
6 changes: 6 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ workspace(name = "angular_cli")

DEFAULT_NODE_VERSION = "18.19.1"

# Workaround for: https://github.com/bazel-contrib/bazel-lib/issues/968.
# Override toolchain for tar on windows.
register_toolchains(
"//tools:windows_tar_system_toolchain",
)

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
Expand Down
14 changes: 14 additions & 0 deletions tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@aspect_bazel_lib//lib/private:tar_toolchain.bzl", "tar_toolchain")

# Copyright Google Inc. All Rights Reserved.
#
# Use of this source code is governed by an MIT-style license that can be
Expand Down Expand Up @@ -28,4 +30,16 @@ nodejs_binary(
entry_point = "quicktype_runner.js",
templated_args = ["--bazel_patch_module_resolver"],
)

tar_toolchain(
name = "system_tar_exec",
binary = "tar_system.bat",
)

toolchain(
name = "windows_tar_system_toolchain",
exec_compatible_with = ["@platforms//os:windows"],
toolchain = ":system_tar_exec",
toolchain_type = "@aspect_bazel_lib//lib:tar_toolchain_type",
)
# @external_end
5 changes: 5 additions & 0 deletions tools/tar_system.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if exist "C:\Program Files\Git\bin\bash.exe" (
set "BASH=C:\Program Files\Git\bin\bash.exe"
)

"%BASH%" -c "tar %*"

0 comments on commit 0ef1a3d

Please sign in to comment.