nixos: gen 62 @ lilac — 2026-09-20 02:10 26.05.20260918.cf9d2fb (Yarara) -----

This commit is contained in:
2026-09-20 02:10:41 -06:00
parent 03c32ccd43
commit 0ed1b19d50
+21 -13
View File
@@ -82,21 +82,24 @@ in
(pkgs.writeShellScriptBin "jbuild" '' (pkgs.writeShellScriptBin "jbuild" ''
set -euo pipefail set -euo pipefail
# Assign first: `cd "$(jroot)"` would swallow a jroot failure, because if [ $# -lt 1 ]; then
# `cd ""` is a successful no-op and set -e never sees the error. echo "usage: jrun <package.MainClass> [args...]" >&2
exit 1
fi
ROOT="$(jroot)" ROOT="$(jroot)"
cd "$ROOT" cd "$ROOT"
mkdir -p bin mkdir -p bin
SOURCES="$(mktemp)"
trap 'rm -f "$SOURCES"' EXIT SOURCES="$1"
find . -path ./bin -prune -o -name '.*' -prune -o -name '*.java' -print > "$SOURCES"
find "$SOURCES" -name '*.java' -path '*.java'
if [ ! -s "$SOURCES" ]; then if [ ! -s "$SOURCES" ]; then
echo "jbuild: no .java files found under $ROOT" >&2 echo "jbuild: no .java files found under ./$SOURCES" >&2
exit 1 exit 1
fi fi
# bin is deliberately NOT on the compile classpath: every source is passed
# explicitly, so a stale .class from a deleted file would silently satisfy
# references that ought to fail.
javac -g --release 21 -encoding UTF-8 -d bin -cp "lib/*" @"$SOURCES" javac -g --release 21 -encoding UTF-8 -d bin -cp "lib/*" @"$SOURCES"
'') '')
@@ -114,14 +117,19 @@ in
exit 1 exit 1
fi fi
ROOT="$(jroot)" ROOT="$(jroot)"
jbuild
cd "$ROOT" cd "$ROOT"
jbuild $1
MAIN="$1"; shift MAIN="$1"; shift
exec java -cp "bin:lib/*" "$MAIN" "$@" java -cp "bin:lib/*" "$MAIN" "$@"
'') '')
(pkgs.writeShellScriptBin "jtest" '' (pkgs.writeShellScriptBin "jtest" ''
set -euo pipefail set -euo pipefail
if [ "$#" -lt 1 ]; then
echo "usage: jtest <package.MainClass> [args...]"
exit 1
fi
# sort -V so 1.10.2 beats 1.9.0; plain tail -n1 sorts those the wrong way. # sort -V so 1.10.2 beats 1.9.0; plain tail -n1 sorts those the wrong way.
JUNIT="$(ls -1 "$HOME"/dev/jars/junit-platform-console-standalone-*.jar 2>/dev/null | sort -V | tail -n1 || true)" JUNIT="$(ls -1 "$HOME"/dev/jars/junit-platform-console-standalone-*.jar 2>/dev/null | sort -V | tail -n1 || true)"
if [ -z "$JUNIT" ]; then if [ -z "$JUNIT" ]; then
@@ -133,15 +141,15 @@ in
# on :5005 (see the "Attach to jtest" config in nvim.nix), so breakpoints # on :5005 (see the "Attach to jtest" config in nvim.nix), so breakpoints
# set before running jtest --debug are hit from the very first test. # set before running jtest --debug are hit from the very first test.
DEBUG_ARGS=() DEBUG_ARGS=()
if [ "''${1:-}" = "--debug" ]; then if [[ "$1" = "debug" ]]; then
DEBUG_ARGS=(-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005) DEBUG_ARGS=(-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005)
shift shift
echo "jtest: waiting for debugger to attach on 127.0.0.1:5005..." >&2 echo "jtest: waiting for debugger to attach on 127.0.0.1:5005..." >&2
fi fi
ROOT="$(jroot)" ROOT="$(jroot)"
jbuild
cd "$ROOT" cd "$ROOT"
jbuild "$1"
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
exec java "''${DEBUG_ARGS[@]}" -jar "$JUNIT" execute --class-path "bin:lib/*" --scan-class-path --details=tree exec java "''${DEBUG_ARGS[@]}" -jar "$JUNIT" execute --class-path "bin:lib/*" --scan-class-path --details=tree
fi fi