Build Path Cleanup
This commit is contained in:
+26
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user