From c4cd69f28d59363b9da4c8406ca4d28f8c21d9bc Mon Sep 17 00:00:00 2001 From: Viktor Vaczi Date: Sat, 27 Dec 2025 11:26:25 +0100 Subject: [PATCH] Make build scripts use incremental builds by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - build-wxuniversal-wasm.sh: Default to incremental, add --clean flag - build-wasm-test.sh: Remove automatic clean, add --clean flag Performance: - No changes: ~0.3s (was full rebuild) - Single file change: ~5s (just that file) - Clean rebuild: use --clean flag 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- scripts/build-wasm-test.sh | 27 ++++++++++++++------------- scripts/build-wxuniversal-wasm.sh | 10 +++++----- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/scripts/build-wasm-test.sh b/scripts/build-wasm-test.sh index 47c6acf..75a982d 100755 --- a/scripts/build-wasm-test.sh +++ b/scripts/build-wasm-test.sh @@ -3,20 +3,24 @@ # This script creates library symlinks and builds the test apps # # Usage: -# ./build-wasm-test.sh # Build all test apps (optimized) -# ./build-wasm-test.sh --debug # Build all test apps with debug symbols -# ./build-wasm-test.sh threadpool # Build only the threadpool test -# ./build-wasm-test.sh --debug menu # Build only menu test with debug symbols +# ./build-wasm-test.sh # Incremental build (default) +# ./build-wasm-test.sh --clean # Clean build from scratch +# ./build-wasm-test.sh --debug # Build with debug symbols +# ./build-wasm-test.sh menu # Build only the menu test +# ./build-wasm-test.sh --debug menu # Build menu test with debug symbols set -e DEBUG_BUILD=0 +CLEAN_BUILD=0 TARGET="" # Parse arguments for arg in "$@"; do if [ "$arg" = "--debug" ]; then DEBUG_BUILD=1 + elif [ "$arg" = "--clean" ]; then + CLEAN_BUILD=1 elif [ "$arg" != "" ]; then TARGET="$arg" fi @@ -70,19 +74,16 @@ echo "" echo "=== Building test applications ===" cd "$WASM_APP_DIR" -# Determine make target and clean behavior +# Determine make target if [ -n "$TARGET" ]; then - # Single target: only clean and build that specific target MAKE_TARGET="$TARGET" - # Clean just the target's files - rm -f "standalone/$TARGET/${TARGET}_test.o" \ - "standalone/$TARGET/${TARGET}_test.html" \ - "standalone/$TARGET/${TARGET}_test.js" \ - "standalone/$TARGET/${TARGET}_test.wasm" \ - 2>/dev/null || true else - # All targets: clean everything first MAKE_TARGET="all" +fi + +# Clean if requested +if [ "$CLEAN_BUILD" = "1" ]; then + echo "Cleaning build artifacts..." make -f Makefile.wasm clean 2>/dev/null || true fi diff --git a/scripts/build-wxuniversal-wasm.sh b/scripts/build-wxuniversal-wasm.sh index 4c22111..fd872cd 100755 --- a/scripts/build-wxuniversal-wasm.sh +++ b/scripts/build-wxuniversal-wasm.sh @@ -12,8 +12,8 @@ # ghcr.io/vslavik/bakefile:0.2 bakefile_gen # # Usage: -# ./build-wxuniversal-wasm.sh # Clean build (default) -# ./build-wxuniversal-wasm.sh --no-clean # Incremental build +# ./build-wxuniversal-wasm.sh # Incremental build (default) +# ./build-wxuniversal-wasm.sh --clean # Clean build from scratch set -e @@ -60,9 +60,9 @@ if [ "$WX_SOURCE/configure.in" -nt "$WX_SOURCE/configure" ]; then (cd "$WX_SOURCE" && autoconf) fi -# Clean by default, unless --no-clean is passed -if [ "$1" != "--no-clean" ]; then - echo "Cleaning build directory (use --no-clean to skip)..." +# Incremental build by default, use --clean for full rebuild +if [ "$1" = "--clean" ]; then + echo "Cleaning build directory..." rm -rf "$BUILD_DIR" fi