Build Path Cleanup

This commit is contained in:
2026-04-17 21:09:02 +02:00
parent d77b44c210
commit f32dd224fe
6 changed files with 178 additions and 35 deletions
+26 -1
View File
@@ -2,5 +2,30 @@
set -eu
cd "$(dirname "$0")"
output="./tools/sow-toolkit"
tool_sources_are_newer() {
if [ ! -x "$output" ]; then
return 0
fi
for path in go.mod go.sum cmd internal; do
if [ ! -e "$path" ]; then
continue
fi
if [ -n "$(find "$path" -type f -newer "$output" -print -quit)" ]; then
return 0
fi
done
return 1
}
mkdir -p tools .cache/go-build
GOCACHE="${PWD}/.cache/go-build" go build -o ./tools/sow-toolkit ./cmd/nwn-tool
if ! tool_sources_are_newer; then
echo "sow-toolkit is up to date."
exit 0
fi
echo "Building sow-toolkit..."
GOCACHE="${PWD}/.cache/go-build" go build -o "$output" ./cmd/nwn-tool