From e65be1d24bbb7d756a74e2a5f43aecfe6c703d24 Mon Sep 17 00:00:00 2001 From: DanS Date: Sun, 11 Oct 2026 06:05:07 -0500 Subject: [PATCH] build(cmake): add a dragonx_release target that builds only what ships Release builds ran a plain `cmake --build .`, which builds `all`: on top of the app and the wallet-rebuild helper, every --*-release run also compiled HushChatFixtureCheck, ObsidianDragonTests where BUILD_TESTING is on (Linux, macOS) and, in Lite backend trees, lite_smoke and lite_send_smoke. None of them ship. A new `dragonx_release` custom target depends on ObsidianDragon plus dragonx-wallet-rebuild, copy_langs and copy_themes where those targets exist, and the three release paths in build.sh build only that target. The dev build (./build.sh) still builds `all`. BUILD_TESTING is deliberately left alone: release and dev builds share build/, and writing BUILD_TESTING=OFF into that cache would leave ctest running a stale test binary. Measured: - a dry run of dragonx_release schedules none of the test, smoke-tool or fixture-CLI builds that `all` schedules, in a full-node, a Lite+backend and a mingw tree; the wallet-rebuild helper is still built; - all four release builds (Linux and Windows, full node and Lite) log the dragonx_release target and no ObsidianDragonTests build, and the Linux zip and AppImage file lists are unchanged. Consequences: a release run no longer refreshes the test binary or the lite smoke tools in build//bin, so run ./build.sh or `cmake --build` before ctest, and build the Windows smoke tools with `--target lite_smoke lite_send_smoke`. If a release step starts copying another CMake-built file out of bin/, its target must be added to dragonx_release. Not verifiable here: macOS --mac-release (the .app should still contain the app, dragonx-wallet-rebuild and Contents/Resources/res). Co-Authored-By: Claude Opus 5.5 --- CMakeLists.txt | 13 +++++++++++++ build.sh | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7db4ac2..89b7a85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1139,6 +1139,19 @@ else() message(STATUS "wallet-rebuild helper: OFF (no Berkeley DB found; set DRAGONX_BDB_ROOT for release builds)") endif() +# Release packaging (build.sh --linux-release / --win-release / --mac-release) builds ONLY what ships: +# cmake --build . --target dragonx_release +# The test binary, the lite smoke tools and the dev CLIs are skipped WITHOUT writing BUILD_TESTING=OFF into the +# build/ cache that dev builds share. A stale OFF would leave ctest running an old test binary. +# If a release path starts copying a new CMake-built file out of bin/, add its target here. +add_custom_target(dragonx_release) +add_dependencies(dragonx_release ObsidianDragon) +foreach(_dragonx_release_dep dragonx-wallet-rebuild copy_langs copy_themes) + if(TARGET ${_dragonx_release_dep}) + add_dependencies(dragonx_release ${_dragonx_release_dep}) + endif() +endforeach() + # ----------------------------------------------------------------------------- # fake_dragonxd — a deliberately slow, scriptable dragonxd stand-in that reproduces the daemon-stop # incident (usage and the incident it models: tools/fake_dragonxd/README.md). diff --git a/build.sh b/build.sh index 74a9df5..26097c6 100755 --- a/build.sh +++ b/build.sh @@ -393,7 +393,7 @@ build_release_linux() { "${CMAKE_LITE_ARGS[@]}" info "Building with $JOBS jobs ..." - cmake --build . -j "$JOBS" + cmake --build . -j "$JOBS" --target dragonx_release [[ -f "bin/${APP_BASENAME}" ]] || { err "Linux build failed"; exit 1; } @@ -854,7 +854,7 @@ HDR "${CMAKE_LITE_ARGS[@]}" info "Building with $JOBS jobs ..." - cmake --build . -j "$JOBS" + cmake --build . -j "$JOBS" --target dragonx_release [[ -f "bin/${APP_BASENAME}.exe" ]] || { err "Windows build failed"; exit 1; } # Strip the app exe — the Linux and macOS release paths already strip theirs, and even the Windows @@ -1150,7 +1150,7 @@ TOOLCHAIN fi info "Building with $JOBS jobs ..." - cmake --build . -j "$JOBS" + cmake --build . -j "$JOBS" --target dragonx_release [[ -f "bin/${APP_BASENAME}" ]] || { err "macOS build failed"; exit 1; }