#!/usr/bin/env bash # Build the leleka-runtime test binary of THIS worktree in WSL (never on the server) and print its path. # scripts/profile/build_rt.sh TAG (run from Windows Git Bash in the worktree; needs WSL distro "Ubuntu") # Result: WSL ~/ledger-bin/rt-TAG. Copy to the server with: scp (see docs/ledger.md). set -euo pipefail tag=${1:?tag} root=$(git rev-parse --show-toplevel) tmp=$(mktemp -d) git -C "$root" -c core.autocrlf=false ls-files -z | tar -C "$root" --null -T - -cf "$tmp/wt.tar" win=$(cygpath -w "$tmp/wt.tar" | sed 's#\\#/#g; s#^\([A-Za-z]\):#/mnt/\L\1#') wsl -d Ubuntu -e bash -lc " set -e source ~/.cargo/env export PATH=\$HOME/cuda-toolkits/13.2.2/bin:\$HOME/.cargo/bin:/usr/local/bin:/usr/bin:/bin rm -rf ~/ledger-src && mkdir -p ~/ledger-src ~/ledger-bin && tar -xf '$win' -C ~/ledger-src cd ~/ledger-src export CARGO_TARGET_DIR=\$HOME/ledger-target nice -n 10 cargo test --no-run --locked --release -p leleka-runtime --lib 2>&1 | tee ~/ledger-build-$tag.log | grep -E 'Executable|^error|warning: unused' | tail -5 exe=\$(grep -o 'target/release/deps/leleka_runtime-[0-9a-f]*' ~/ledger-build-$tag.log | tail -1) cp \$CARGO_TARGET_DIR/\${exe#target/} ~/ledger-bin/rt-$tag ls -la ~/ledger-bin/rt-$tag " rm -rf "$tmp"