feat: new bun_build and bun_compile, extend bun_install
This commit is contained in:
@@ -71,3 +71,25 @@ sh_test(
|
||||
args = ["$(location :env_parent_cwd_bin)"],
|
||||
data = [":env_parent_cwd_bin"],
|
||||
)
|
||||
|
||||
bun_binary(
|
||||
name = "runtime_flag_bin",
|
||||
entry_point = "flag_probe.ts",
|
||||
args = ["one", "two"],
|
||||
preload = ["preload.ts"],
|
||||
env_files = ["runtime.env"],
|
||||
)
|
||||
|
||||
sh_test(
|
||||
name = "bun_binary_runtime_flags_test",
|
||||
srcs = ["run_flag_binary.sh"],
|
||||
args = ["$(location :runtime_flag_bin)"],
|
||||
data = [":runtime_flag_bin"],
|
||||
)
|
||||
|
||||
sh_test(
|
||||
name = "bun_binary_runtime_flags_shape_test",
|
||||
srcs = ["verify_runtime_flags_shape.sh"],
|
||||
args = ["$(location :runtime_flag_bin)"],
|
||||
data = [":runtime_flag_bin"],
|
||||
)
|
||||
|
||||
7
tests/binary_test/flag_probe.ts
Normal file
7
tests/binary_test/flag_probe.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
const state = globalThis as typeof globalThis & { __rules_bun_preloaded?: string };
|
||||
|
||||
console.log(JSON.stringify({
|
||||
preloaded: state.__rules_bun_preloaded ?? null,
|
||||
env: process.env.RUNTIME_FLAG_TEST ?? null,
|
||||
argv: process.argv.slice(2),
|
||||
}));
|
||||
1
tests/binary_test/preload.ts
Normal file
1
tests/binary_test/preload.ts
Normal file
@@ -0,0 +1 @@
|
||||
(globalThis as typeof globalThis & { __rules_bun_preloaded?: string }).__rules_bun_preloaded = "yes";
|
||||
@@ -5,7 +5,7 @@ binary="$1"
|
||||
expected="$2"
|
||||
output="$(${binary})"
|
||||
|
||||
if [[ "${output}" != "${expected}" ]]; then
|
||||
if [[ ${output} != "${expected}" ]]; then
|
||||
echo "Unexpected output from ${binary}: ${output}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
12
tests/binary_test/run_flag_binary.sh
Executable file
12
tests/binary_test/run_flag_binary.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
binary="$1"
|
||||
output="$(${binary})"
|
||||
|
||||
expected='{"preloaded":"yes","env":"from-env-file","argv":["one","two"]}'
|
||||
|
||||
if [[ ${output} != "${expected}" ]]; then
|
||||
echo "Unexpected output from ${binary}: ${output}" >&2
|
||||
exit 1
|
||||
fi
|
||||
1
tests/binary_test/runtime.env
Normal file
1
tests/binary_test/runtime.env
Normal file
@@ -0,0 +1 @@
|
||||
RUNTIME_FLAG_TEST=from-env-file
|
||||
8
tests/binary_test/verify_runtime_flags_shape.sh
Executable file
8
tests/binary_test/verify_runtime_flags_shape.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
binary="$1"
|
||||
|
||||
grep -Fq -- '--no-install' "${binary}"
|
||||
grep -Fq -- '--preload' "${binary}"
|
||||
grep -Fq -- '--env-file' "${binary}"
|
||||
Reference in New Issue
Block a user