fix(windows): fail loudly when the generator binary is missing

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 <noreply@anthropic.com>
This commit is contained in:
Dario Gabriel Lipicar
2026-08-10 16:30:42 -03:00
co-authored by Claude Opus 5
parent 4ddad6ba17
commit 6a79a9637f
+17 -3
View File
@@ -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