#!/bin/bash # Run cargo in WSL Ubuntu against this worktree with a worktree-local target dir (STRA-338 gateway track). # usage: scripts/dev/wsl-cargo.sh LOGFILE cargo-args... (from Git Bash on the Windows host) log="$1"; shift root="$(cd "$(dirname "$0")/../.." && pwd)" wslroot="/mnt/$(echo "${root}" | sed -E 's#^/([a-zA-Z])/#\L\1/#')" MSYS_NO_PATHCONV=1 wsl -d Ubuntu -e bash -lc "source ~/.cargo/env; cd '${wslroot}'; export CARGO_INCREMENTAL=0 CARGO_PROFILE_DEV_DEBUG=${CARGO_PROFILE_DEV_DEBUG:-0} CARGO_BUILD_JOBS=${CARGO_BUILD_JOBS:-4} CARGO_TARGET_DIR=\$PWD/target/wsl; cargo $* > '${wslroot}/${log}' 2>&1; echo \"EXIT \$?\" >> '${wslroot}/${log}'"