hack: check windows resources are set in the binary

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2025-06-26 16:11:30 +02:00
parent 44623fb856
commit e7289e7e02
2 changed files with 14 additions and 1 deletions

View File

@@ -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 \

View File

@@ -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"