From 6a79a9637f544ec2c75faef8ead5bb59030864a6 Mon Sep 17 00:00:00 2001 From: Dario Gabriel Lipicar Date: Thu, 6 Aug 2026 16:14:41 -0300 Subject: [PATCH] fix(windows): fail loudly when the generator binary is missing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The install test named only the unsuffixed `logos-cpp-generator` and had no else-branch, so a mingw build — which produces `logos-cpp-generator.exe` — copied nothing, succeeded, and shipped an EMPTY $out/bin. The failure then surfaced in whichever consumer tried to run the generator, nowhere near the cause. Probe both names, and exit 1 with a directory listing if neither is there. Verified: the Windows build now installs a real PE, and the native build is unchanged. Co-Authored-By: Claude Opus 5 --- nix/bin.nix | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/nix/bin.nix b/nix/bin.nix index e23d257..c243d03 100644 --- a/nix/bin.nix +++ b/nix/bin.nix @@ -34,11 +34,25 @@ pkgs.stdenv.mkDerivation { installPhase = '' runHook preInstall - # Install generator binary + # Install generator binary. + # + # Probe both names and FAIL if neither is there. The unsuffixed-only test + # this replaces had no else-branch, so a mingw build (which produces + # logos-cpp-generator.exe) copied nothing, succeeded, and shipped an EMPTY + # $out/bin -- the failure then surfaced in whichever consumer tried to run + # the generator, nowhere near the cause. mkdir -p $out/bin - if [ -f build-generator/bin/logos-cpp-generator ]; then - cp build-generator/bin/logos-cpp-generator $out/bin/ + _gen="" + for _cand in build-generator/bin/logos-cpp-generator build-generator/bin/logos-cpp-generator.exe; do + if [ -f "$_cand" ]; then _gen="$_cand"; break; fi + done + if [ -z "$_gen" ]; then + echo "Error: logos-cpp-generator was not produced by the build" >&2 + echo "Contents of build-generator/bin:" >&2 + ls -la build-generator/bin 2>&1 >&2 || echo " (no such directory)" >&2 + exit 1 fi + cp "$_gen" $out/bin/ # Shared C++/Qt codegen backend helpers for logos-qt-sdk's # logos-qt-generator: the Qt type-name mapping (lidl_emit_common), the