From e7289e7e02468bd4d4cc2db7539f1e11a364eaf1 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Thu, 26 Jun 2025 16:11:30 +0200 Subject: [PATCH] hack: check windows resources are set in the binary Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- Dockerfile | 3 ++- hack/make/.binary | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6191381ad3..f0557ea64b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -549,7 +549,8 @@ RUN --mount=type=cache,sharing=locked,id=moby-build-aptlib,target=/var/lib/apt \ apt-get update && apt-get install --no-install-recommends -y \ clang \ lld \ - llvm + llvm \ + icoutils ARG TARGETPLATFORM RUN --mount=type=cache,sharing=locked,id=moby-build-aptlib,target=/var/lib/apt \ --mount=type=cache,sharing=locked,id=moby-build-aptcache,target=/var/cache/apt \ diff --git a/hack/make/.binary b/hack/make/.binary index 920c5aa3bc..40c0704511 100644 --- a/hack/make/.binary +++ b/hack/make/.binary @@ -96,6 +96,18 @@ source "${MAKEDIR}/.go-autogen" set -x fi ./hack/with-go-mod.sh go build -mod=vendor -modfile=vendor.mod -o "$DEST/$BINARY_FULLNAME" "${BUILDFLAGS[@]}" -ldflags "$LDFLAGS $LDFLAGS_STATIC $DOCKER_LDFLAGS" -gcflags="${GCFLAGS}" "$GO_PACKAGE" + + # Verify that the built binary contains windows resources + if [ "$(go env GOOS)" = "windows" ]; then + if command -v wrestool > /dev/null 2>&1; then + if ! wrestool -l "$DEST/$BINARY_FULLNAME" | grep -q -- '--type='; then + echo "No resources found in $DEST/$BINARY_FULLNAME" + exit 1 + fi + else + echo "WARNING: wrestool not found, skipping resources check" + fi + fi ) echo "Created binary: $DEST/$BINARY_FULLNAME"