Running pytest against a stale build/ binary silently proved nothing: test.sh and test-headless.sh now run build.sh first, and build.sh skips meson setup/compile when both binaries are newer than their sources (tracked per program: kick.c feeds kick, tests/wltest.c feeds wltest, meson.build and subprojects feed both).
39 lines
1 KiB
Bash
Executable file
39 lines
1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
|
|
set -e
|
|
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
# Rebuild only when a source is newer than the built binary; otherwise
|
|
# meson setup/compile would (re)generate everything each run. Sources
|
|
# are tracked per program: kick.c only feeds kick, tests/wltest.c only
|
|
# feeds wltest, while meson.build and the vendored subprojects feed both.
|
|
stale() {
|
|
# $1 = binary; $2.. = source paths/dirs it depends on.
|
|
bin=$1
|
|
shift
|
|
[ -x "$bin" ] || return 0
|
|
for p in "$@"; do
|
|
[ -e "$p" ] || continue
|
|
if [ -d "$p" ]; then
|
|
if find "$p" -type f -newer "$bin" -print -quit | grep -q .; then
|
|
return 0
|
|
fi
|
|
elif [ "$p" -nt "$bin" ]; then
|
|
return 0
|
|
fi
|
|
done
|
|
return 1
|
|
}
|
|
|
|
if stale build/kick kick.c meson.build subprojects wlr-protocols \
|
|
|| stale build/wltest tests/wltest.c meson.build subprojects; then
|
|
set -x
|
|
meson setup build --reconfigure
|
|
meson compile -C build
|
|
echo "Built: ./build/kick"
|
|
else
|
|
echo "build: nothing to do (binaries up to date)"
|
|
fi
|