3 Commits

Author SHA1 Message Date
eric
65404a1883 chore(release): v1.0.1
Some checks failed
CI / test (ubuntu-latest, linux-x64) (push) Failing after 59s
Docs Pages / deploy (push) Failing after 34s
Copilot Setup Steps / copilot-setup-steps (push) Failing after 37s
CI / test (macos-14, darwin-arm64) (push) Has been cancelled
CI / test (windows-latest, windows) (push) Has been cancelled
2026-03-15 11:57:45 +01:00
eric
f317a618b8 fix: context leak 2026-03-15 11:50:25 +01:00
eric
683de60603 fix: windows targets 2026-03-15 11:24:36 +01:00
23 changed files with 269 additions and 78 deletions

View File

@@ -28,7 +28,7 @@ jobs:
USE_BAZEL_VERSION: 9.0.0
steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.15.0
- uses: bazel-contrib/setup-bazel@0.18.0
with:
bazelisk-cache: true
repository-cache: true
@@ -36,6 +36,8 @@ jobs:
disk-cache: ci-${{ matrix.phase8_target }}
cache-save: ${{ github.event_name != 'pull_request' }}
- name: Run tests (${{ matrix.phase8_target }})
shell: bash
run: |
echo "Phase 8 target: ${{ matrix.phase8_target }}"
bazel test //tests/...
targets="$(./tests/ci_test/phase8_ci_targets.sh "${{ matrix.phase8_target }}")"
bazel test ${targets}

View File

@@ -30,7 +30,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.15.0
- uses: bazel-contrib/setup-bazel@0.18.0
with:
bazelisk-cache: true
repository-cache: true

View File

@@ -1,6 +1,6 @@
module(
name = "rules_bun",
version = "1.0.0",
version = "1.0.1",
)
# Core ruleset dependencies.

4
MODULE.bazel.lock generated
View File

@@ -193,7 +193,7 @@
"//bun:extensions.bzl%bun": {
"general": {
"bzlTransitiveDigest": "314UOH4dQIGBHGpxCwA7yzI++E2J3bjIc20m5MZhM7U=",
"usagesDigest": "F7vNx1FkssnJKNa2AZDuwHKkH7+IjJNX42lRAaJhhKE=",
"usagesDigest": "Pk8TCTd2EBKQ8R+VSF0M7sU9apLb/5tBy/dP2pjs3AU=",
"recordedInputs": [
"REPO_MAPPING:,bazel_tools bazel_tools"
],
@@ -284,7 +284,7 @@
"//bun:extensions.bzl%bun_install": {
"general": {
"bzlTransitiveDigest": "314UOH4dQIGBHGpxCwA7yzI++E2J3bjIc20m5MZhM7U=",
"usagesDigest": "5mKuORKUFhw+/OMHQF0I8Ngq0GV2eqMaOTDmyqaQa8M=",
"usagesDigest": "2qW6PUxkK7CgK8mcsgVvlIbuJS/cBBkw5mylpKlqftE=",
"recordedInputs": [
"REPO_MAPPING:,bazel_tools bazel_tools"
],

View File

@@ -80,7 +80,7 @@ Release announcements should provide a copy-pasteable module snippet in the
standard ruleset form:
```starlark
bazel_dep(name = "rules_bun", version = "1.0.0")
bazel_dep(name = "rules_bun", version = "1.0.1")
```
Then add the Bun repositories and register the toolchains in `MODULE.bazel`:

View File

@@ -1,3 +1,3 @@
1.0.0
1.0.1
stable
0

View File

@@ -1 +1,3 @@
package(default_visibility = ["//visibility:public"])
exports_files(["nested_bazel_test.sh"])

View File

@@ -197,11 +197,13 @@ sh_test(
name = "bundle_sourcemap_shape_test",
size = "small",
srcs = ["verify_sourcemap_shape.sh"],
tags = ["exclusive"],
data = [
"BUILD.bazel",
"//:repo_runtime_files",
"//bun:repo_runtime_files",
"//internal:repo_runtime_files",
"//tests:nested_bazel_test.sh",
"//tests/bundle_test/sourcemap_case:BUILD.bazel",
"//tests/bundle_test/sourcemap_case:entry.ts",
],
@@ -236,6 +238,7 @@ sh_test(
name = "bun_build_compile_flag_shape_test",
size = "small",
srcs = ["verify_flag_aquery.sh"],
tags = ["exclusive"],
data = [
"BUILD.bazel",
"cli.ts",
@@ -246,6 +249,7 @@ sh_test(
"//:repo_runtime_files",
"//bun:repo_runtime_files",
"//internal:repo_runtime_files",
"//tests:nested_bazel_test.sh",
],
env_inherit = ["PATH"],
)

View File

@@ -1,19 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
if command -v bazel >/dev/null 2>&1; then
bazel_cmd=(bazel)
elif command -v bazelisk >/dev/null 2>&1; then
bazel_cmd=(bazelisk)
else
echo "bazel or bazelisk is required on PATH" >&2
exit 1
fi
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
# shellcheck source=../nested_bazel_test.sh
source "${script_dir}/../nested_bazel_test.sh"
setup_nested_bazel_cmd
find_workspace_root() {
local candidate
local module_path
local script_dir
local search_dir
for candidate in \
"${TEST_SRCDIR:-}/${TEST_WORKSPACE:-}" \
@@ -32,8 +28,8 @@ find_workspace_root() {
fi
fi
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
candidate="$(cd "${script_dir}/../.." && pwd -P)"
search_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
candidate="$(cd "${search_dir}/../.." && pwd -P)"
if [[ -f "${candidate}/MODULE.bazel" ]]; then
printf '%s\n' "${candidate}"
return 0
@@ -45,6 +41,14 @@ find_workspace_root() {
rules_bun_root="$(find_workspace_root)"
cleanup() {
local status="$1"
trap - EXIT
shutdown_nested_bazel_workspace "${rules_bun_root}"
exit "${status}"
}
trap 'cleanup $?' EXIT
run_aquery() {
local mnemonic="$1"
local target="$2"

View File

@@ -1,19 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
if command -v bazel >/dev/null 2>&1; then
bazel_cmd=(bazel)
elif command -v bazelisk >/dev/null 2>&1; then
bazel_cmd=(bazelisk)
else
echo "bazel or bazelisk is required on PATH" >&2
exit 1
fi
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
# shellcheck source=../nested_bazel_test.sh
source "${script_dir}/../nested_bazel_test.sh"
setup_nested_bazel_cmd
find_workspace_root() {
local candidate
local module_path
local script_dir
local search_dir
for candidate in \
"${TEST_SRCDIR:-}/${TEST_WORKSPACE:-}" \
@@ -32,8 +28,8 @@ find_workspace_root() {
fi
fi
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
candidate="$(cd "${script_dir}/../.." && pwd -P)"
search_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
candidate="$(cd "${search_dir}/../.." && pwd -P)"
if [[ -f "${candidate}/MODULE.bazel" ]]; then
printf '%s\n' "${candidate}"
return 0
@@ -45,6 +41,14 @@ find_workspace_root() {
rules_bun_root="$(find_workspace_root)"
cleanup() {
local status="$1"
trap - EXIT
shutdown_nested_bazel_workspace "${rules_bun_root}"
exit "${status}"
}
trap 'cleanup $?' EXIT
bundle_output="$(
cd "${rules_bun_root}" &&
"${bazel_cmd[@]}" aquery 'mnemonic("BunBundle", //tests/bundle_test/sourcemap_case:sourcemap_bundle)' --output=textproto

View File

@@ -8,6 +8,14 @@ sh_test(
data = ["//.github/workflows:ci.yml"],
)
sh_test(
name = "phase8_ci_targets_test",
size = "small",
srcs = ["phase8_ci_targets_test.sh"],
args = ["$(location :phase8_ci_targets.sh)"],
data = [":phase8_ci_targets.sh"],
)
sh_test(
name = "native_wrapper_shape_test",
size = "small",

View File

@@ -22,6 +22,17 @@ check_pattern 'os:[[:space:]]+ubuntu-latest' "missing ubuntu matrix entry"
check_pattern 'phase8_target:[[:space:]]+linux-x64' "missing linux-x64 matrix target"
check_pattern 'os:[[:space:]]+macos-14' "missing macos matrix entry"
check_pattern 'phase8_target:[[:space:]]+darwin-arm64' "missing darwin-arm64 matrix target"
check_pattern 'os:[[:space:]]+windows-latest' "missing windows matrix entry"
check_pattern 'phase8_target:[[:space:]]+windows' "missing windows matrix target"
has_windows_os=0
has_windows_target=0
if grep -Eq 'os:[[:space:]]+windows-latest' "${workflow_file}"; then
has_windows_os=1
fi
if grep -Eq 'phase8_target:[[:space:]]+windows' "${workflow_file}"; then
has_windows_target=1
fi
if [[ ${has_windows_os} -ne ${has_windows_target} ]]; then
echo "Error: windows matrix entry and windows phase8 target must be added or removed together" >&2
exit 1
fi
echo "CI matrix shape checks passed"

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
phase8_target="${1:-}"
if [[ -z ${phase8_target} ]]; then
echo "Error: phase8 target required as first argument" >&2
exit 1
fi
case "${phase8_target}" in
linux-x64 | darwin-arm64)
printf '%s\n' "//tests/..."
;;
windows)
printf '%s\n' \
"//tests/binary_test/..." \
"//tests/bun_test_test/..." \
"//tests/ci_test/..." \
"//tests/js_compat_test/..." \
"//tests/script_test/..." \
"//tests/toolchain_test/..."
;;
*)
echo "Error: unsupported phase8 target: ${phase8_target}" >&2
exit 1
;;
esac

View File

@@ -0,0 +1,44 @@
#!/usr/bin/env bash
set -euo pipefail
resolver="${1:-}"
if [[ -z ${resolver} ]]; then
echo "Error: resolver path required as first argument" >&2
exit 1
fi
linux_targets="$("${resolver}" linux-x64)"
if [[ ${linux_targets} != "//tests/..." ]]; then
echo "Error: linux-x64 should resolve to //tests/..." >&2
exit 1
fi
darwin_targets="$("${resolver}" darwin-arm64)"
if [[ ${darwin_targets} != "//tests/..." ]]; then
echo "Error: darwin-arm64 should resolve to //tests/..." >&2
exit 1
fi
windows_targets="$("${resolver}" windows)"
expected_windows_targets="$(
cat <<'EOF'
//tests/binary_test/...
//tests/bun_test_test/...
//tests/ci_test/...
//tests/js_compat_test/...
//tests/script_test/...
//tests/toolchain_test/...
EOF
)"
if [[ ${windows_targets} != "${expected_windows_targets}" ]]; then
echo "Error: unexpected windows targets" >&2
printf 'Expected:\n%s\nActual:\n%s\n' "${expected_windows_targets}" "${windows_targets}" >&2
exit 1
fi
if "${resolver}" unsupported >/dev/null 2>&1; then
echo "Error: unsupported phase8 target should fail" >&2
exit 1
fi
echo "Phase 8 CI targets resolve correctly"

View File

@@ -32,6 +32,14 @@ config_setting(
],
)
config_setting(
name = "windows_x86_64",
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
)
sh_test(
name = "bun_install_clean_install_test",
size = "small",
@@ -41,6 +49,7 @@ sh_test(
":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"],
":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"],
":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"],
":windows_x86_64": ["$(location @bun_windows_x64//:bun)"],
"//conditions:default": ["$(location @bun_linux_x64//:bun)"],
}),
data = select({
@@ -48,6 +57,7 @@ sh_test(
":linux_aarch64": ["@bun_linux_aarch64//:bun"],
":darwin_x86_64": ["@bun_darwin_x64//:bun"],
":darwin_aarch64": ["@bun_darwin_aarch64//:bun"],
":windows_x86_64": ["@bun_windows_x64//:bun"],
"//conditions:default": ["@bun_linux_x64//:bun"],
}),
)
@@ -61,6 +71,7 @@ sh_test(
":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"],
":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"],
":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"],
":windows_x86_64": ["$(location @bun_windows_x64//:bun)"],
"//conditions:default": ["$(location @bun_linux_x64//:bun)"],
}),
data = select({
@@ -68,6 +79,7 @@ sh_test(
":linux_aarch64": ["@bun_linux_aarch64//:bun"],
":darwin_x86_64": ["@bun_darwin_x64//:bun"],
":darwin_aarch64": ["@bun_darwin_aarch64//:bun"],
":windows_x86_64": ["@bun_windows_x64//:bun"],
"//conditions:default": ["@bun_linux_x64//:bun"],
}),
)
@@ -97,6 +109,7 @@ sh_test(
":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"],
":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"],
":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"],
":windows_x86_64": ["$(location @bun_windows_x64//:bun)"],
"//conditions:default": ["$(location @bun_linux_x64//:bun)"],
}),
data = select({
@@ -104,6 +117,7 @@ sh_test(
":linux_aarch64": ["@bun_linux_aarch64//:bun"],
":darwin_x86_64": ["@bun_darwin_x64//:bun"],
":darwin_aarch64": ["@bun_darwin_aarch64//:bun"],
":windows_x86_64": ["@bun_windows_x64//:bun"],
"//conditions:default": ["@bun_linux_x64//:bun"],
}),
)
@@ -117,6 +131,7 @@ sh_test(
":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"],
":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"],
":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"],
":windows_x86_64": ["$(location @bun_windows_x64//:bun)"],
"//conditions:default": ["$(location @bun_linux_x64//:bun)"],
}),
data = select({
@@ -124,18 +139,22 @@ sh_test(
":linux_aarch64": ["@bun_linux_aarch64//:bun"],
":darwin_x86_64": ["@bun_darwin_x64//:bun"],
":darwin_aarch64": ["@bun_darwin_aarch64//:bun"],
":windows_x86_64": ["@bun_windows_x64//:bun"],
"//conditions:default": ["@bun_linux_x64//:bun"],
}),
)
sh_test(
name = "bun_install_workspace_parity_test",
size = "large",
srcs = ["workspace_parity.sh"],
tags = ["exclusive"],
args = select({
":linux_x86_64": ["$(location @bun_linux_x64//:bun)"],
":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"],
":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"],
":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"],
":windows_x86_64": ["$(location @bun_windows_x64//:bun)"],
"//conditions:default": ["$(location @bun_linux_x64//:bun)"],
}),
data = select({
@@ -143,11 +162,13 @@ sh_test(
":linux_aarch64": ["@bun_linux_aarch64//:bun"],
":darwin_x86_64": ["@bun_darwin_x64//:bun"],
":darwin_aarch64": ["@bun_darwin_aarch64//:bun"],
":windows_x86_64": ["@bun_windows_x64//:bun"],
"//conditions:default": ["@bun_linux_x64//:bun"],
}) + [
"//:repo_runtime_files",
"//bun:repo_runtime_files",
"//internal:repo_runtime_files",
"//tests:nested_bazel_test.sh",
],
env_inherit = ["PATH"],
)
@@ -164,11 +185,13 @@ sh_test(
name = "bun_install_repeatability_test",
size = "small",
srcs = ["repeatability.sh"],
tags = ["exclusive"],
args = select({
":linux_x86_64": ["$(location @bun_linux_x64//:bun)"],
":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"],
":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"],
":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"],
":windows_x86_64": ["$(location @bun_windows_x64//:bun)"],
"//conditions:default": ["$(location @bun_linux_x64//:bun)"],
}),
data = select({
@@ -176,11 +199,13 @@ sh_test(
":linux_aarch64": ["@bun_linux_aarch64//:bun"],
":darwin_x86_64": ["@bun_darwin_x64//:bun"],
":darwin_aarch64": ["@bun_darwin_aarch64//:bun"],
":windows_x86_64": ["@bun_windows_x64//:bun"],
"//conditions:default": ["@bun_linux_x64//:bun"],
}) + [
"//:repo_runtime_files",
"//bun:repo_runtime_files",
"//internal:repo_runtime_files",
"//tests:nested_bazel_test.sh",
],
env_inherit = ["PATH"],
)
@@ -189,11 +214,13 @@ sh_test(
name = "bun_install_lifecycle_scripts_test",
size = "small",
srcs = ["lifecycle_scripts.sh"],
tags = ["exclusive"],
args = select({
":linux_x86_64": ["$(location @bun_linux_x64//:bun)"],
":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"],
":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"],
":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"],
":windows_x86_64": ["$(location @bun_windows_x64//:bun)"],
"//conditions:default": ["$(location @bun_linux_x64//:bun)"],
}),
data = select({
@@ -201,11 +228,13 @@ sh_test(
":linux_aarch64": ["@bun_linux_aarch64//:bun"],
":darwin_x86_64": ["@bun_darwin_x64//:bun"],
":darwin_aarch64": ["@bun_darwin_aarch64//:bun"],
":windows_x86_64": ["@bun_windows_x64//:bun"],
"//conditions:default": ["@bun_linux_x64//:bun"],
}) + [
"//:repo_runtime_files",
"//bun:repo_runtime_files",
"//internal:repo_runtime_files",
"//tests:nested_bazel_test.sh",
],
env_inherit = ["PATH"],
)

View File

@@ -1,22 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
# shellcheck source=../nested_bazel_test.sh
source "${script_dir}/../nested_bazel_test.sh"
setup_nested_bazel_cmd
bun_path="$1"
if command -v bazel >/dev/null 2>&1; then
bazel_cmd=(bazel)
elif command -v bazelisk >/dev/null 2>&1; then
bazel_cmd=(bazelisk)
else
echo "bazel or bazelisk is required on PATH" >&2
exit 1
fi
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
rules_bun_root="$(cd "${script_dir}/../.." && pwd -P)"
workdir="$(mktemp -d)"
trap 'rm -rf "${workdir}"' EXIT
cleanup() {
local status="$1"
trap - EXIT
shutdown_nested_bazel_workspace "${fixture_dir:-}"
rm -rf "${workdir}"
exit "${status}"
}
trap 'cleanup $?' EXIT
fixture_dir="${workdir}/fixture"
mkdir -p "${fixture_dir}"

View File

@@ -1,22 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
# shellcheck source=../nested_bazel_test.sh
source "${script_dir}/../nested_bazel_test.sh"
setup_nested_bazel_cmd
bun_path="$1"
if command -v bazel >/dev/null 2>&1; then
bazel_cmd=(bazel)
elif command -v bazelisk >/dev/null 2>&1; then
bazel_cmd=(bazelisk)
else
echo "bazel or bazelisk is required on PATH" >&2
exit 1
fi
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
rules_bun_root="$(cd "${script_dir}/../.." && pwd -P)"
workdir="$(mktemp -d)"
trap 'rm -rf "${workdir}"' EXIT
cleanup() {
local status="$1"
trap - EXIT
shutdown_nested_bazel_workspace "${fixture_dir:-}"
rm -rf "${workdir}"
exit "${status}"
}
trap 'cleanup $?' EXIT
fixture_dir="${workdir}/fixture"
mkdir -p "${fixture_dir}"

View File

@@ -1,22 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
# shellcheck source=../nested_bazel_test.sh
source "${script_dir}/../nested_bazel_test.sh"
setup_nested_bazel_cmd
bun_path="${1:-bun}"
if command -v bazel >/dev/null 2>&1; then
bazel_cmd=(bazel)
elif command -v bazelisk >/dev/null 2>&1; then
bazel_cmd=(bazelisk)
else
echo "bazel or bazelisk is required on PATH" >&2
exit 1
fi
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
rules_bun_root="$(cd "${script_dir}/../.." && pwd -P)"
workdir="$(mktemp -d)"
trap 'rm -rf "${workdir}"' EXIT
cleanup() {
local status="$1"
trap - EXIT
shutdown_nested_bazel_workspace "${bazel_dir:-}"
rm -rf "${workdir}"
exit "${status}"
}
trap 'cleanup $?' EXIT
fixture_dir="${workdir}/fixture"
plain_dir="${workdir}/plain"

View File

@@ -3,4 +3,6 @@ set -euo pipefail
workflow_file="$1"
grep -Eq 'bazel test //(tests/)?\.\.\.' "${workflow_file}"
grep -Fq './tests/ci_test/phase8_ci_targets.sh "${{ matrix.phase8_target }}"' "${workflow_file}"
grep -Fq 'targets="$(./tests/ci_test/phase8_ci_targets.sh "${{ matrix.phase8_target }}")"' "${workflow_file}"
grep -Fq 'bazel test ${targets}' "${workflow_file}"

View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
setup_nested_bazel_cmd() {
if command -v bazel >/dev/null 2>&1; then
bazel_cmd=(bazel)
elif command -v bazelisk >/dev/null 2>&1; then
bazel_cmd=(bazelisk)
else
echo "bazel or bazelisk is required on PATH" >&2
exit 1
fi
}
shutdown_nested_bazel_workspace() {
local workspace_dir="${1:-}"
if [[ -z ${workspace_dir} || ! -d ${workspace_dir} ]]; then
return 0
fi
(
cd "${workspace_dir}"
"${bazel_cmd[@]}" shutdown >/dev/null 2>&1
) || true
}

View File

@@ -32,15 +32,25 @@ config_setting(
],
)
config_setting(
name = "windows_x86_64",
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
)
sh_test(
name = "npm_translate_lock_workspace_test",
size = "small",
srcs = ["npm_translate_lock_workspace_test.sh"],
tags = ["exclusive"],
args = select({
":linux_x86_64": ["$(location @bun_linux_x64//:bun)"],
":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"],
":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"],
":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"],
":windows_x86_64": ["$(location @bun_windows_x64//:bun)"],
"//conditions:default": ["$(location @bun_linux_x64//:bun)"],
}),
data = select({
@@ -48,6 +58,7 @@ sh_test(
":linux_aarch64": ["@bun_linux_aarch64//:bun"],
":darwin_x86_64": ["@bun_darwin_x64//:bun"],
":darwin_aarch64": ["@bun_darwin_aarch64//:bun"],
":windows_x86_64": ["@bun_windows_x64//:bun"],
"//conditions:default": ["@bun_linux_x64//:bun"],
}) + [
"//:repo_runtime_files",
@@ -55,6 +66,7 @@ sh_test(
"//internal:repo_runtime_files",
"//js:repo_runtime_files",
"//npm:repo_runtime_files",
"//tests:nested_bazel_test.sh",
],
env_inherit = ["PATH"],
)

View File

@@ -1,22 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
if command -v bazel >/dev/null 2>&1; then
bazel_bin="$(command -v bazel)"
elif command -v bazelisk >/dev/null 2>&1; then
bazel_bin="$(command -v bazelisk)"
else
echo "bazel or bazelisk is required on PATH" >&2
exit 1
fi
bun_path="${1:-bun}"
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
# shellcheck source=../nested_bazel_test.sh
source "${script_dir}/../nested_bazel_test.sh"
setup_nested_bazel_cmd
rules_bun_root="$(cd "${script_dir}/../.." && pwd -P)"
workdir="$(mktemp -d)"
trap 'rm -rf "${workdir}"' EXIT
cleanup() {
local status="$1"
trap - EXIT
shutdown_nested_bazel_workspace "${fixture_dir:-}"
rm -rf "${workdir}"
exit "${status}"
}
trap 'cleanup $?' EXIT
fixture_dir="${workdir}/fixture"
mkdir -p "${fixture_dir}"
@@ -100,7 +102,7 @@ EOF
output="$(
cd "${fixture_dir}" &&
"${bazel_bin}" run //:app
"${bazel_cmd[@]}" run //:app
)"
if [[ ${output} != *"compat:true"* ]]; then
@@ -110,7 +112,7 @@ fi
query_output="$(
cd "${fixture_dir}" &&
"${bazel_bin}" query //:npm__is_number
"${bazel_cmd[@]}" query //:npm__is_number
)"
if ! grep -Fxq "//:npm__is_number" <<<"${query_output}"; then
echo "expected npm_link_all_packages to create //:npm__is_number" >&2

View File

@@ -32,6 +32,14 @@ config_setting(
],
)
config_setting(
name = "windows_x86_64",
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
)
sh_test(
name = "bun_version_test",
size = "small",
@@ -41,6 +49,7 @@ sh_test(
":linux_aarch64": ["$(location @bun_linux_aarch64//:bun)"],
":darwin_x86_64": ["$(location @bun_darwin_x64//:bun)"],
":darwin_aarch64": ["$(location @bun_darwin_aarch64//:bun)"],
":windows_x86_64": ["$(location @bun_windows_x64//:bun)"],
"//conditions:default": ["$(location @bun_linux_x64//:bun)"],
}),
data = select({
@@ -48,6 +57,7 @@ sh_test(
":linux_aarch64": ["@bun_linux_aarch64//:bun"],
":darwin_x86_64": ["@bun_darwin_x64//:bun"],
":darwin_aarch64": ["@bun_darwin_aarch64//:bun"],
":windows_x86_64": ["@bun_windows_x64//:bun"],
"//conditions:default": ["@bun_linux_x64//:bun"],
}),
)