Add Windows application manifest (#620)

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2024-04-24 19:26:35 +02:00
committed by GitHub
parent 40c8955a10
commit 219b1f243a
9 changed files with 80 additions and 5 deletions

6
.gitattributes vendored
View File

@@ -1,3 +1,7 @@
pkg/operator/crds/*.yaml linguist-generated=true
*.txtar text eol=lf
*.txtar text eol=lf
Makefile text eol=lf
tools/make/*.mk text eol=lf
tools/image-tag text eol=lf
tools/release text eol=lf

1
.gitignore vendored
View File

@@ -24,6 +24,7 @@ buildx-v*
cover*.out
.uptodate
node_modules
*.syso
/docs/variables.mk.local

View File

@@ -47,6 +47,7 @@
## generate-helm-tests Generate Helm chart tests.
## generate-ui Generate the UI assets.
## generate-versioned-files Generate versioned files.
## generate-winmanifest Generate the Windows application manifest.
##
## Other targets:
##
@@ -210,8 +211,8 @@ alloy-image-windows:
# Targets for generating assets
#
.PHONY: generate generate-drone generate-helm-docs generate-helm-tests generate-ui generate-versioned-files
generate: generate-drone generate-helm-docs generate-helm-tests generate-ui generate-versioned-files generate-docs
.PHONY: generate generate-drone generate-helm-docs generate-helm-tests generate-ui generate-versioned-files generate-winmanifest
generate: generate-drone generate-helm-docs generate-helm-tests generate-ui generate-versioned-files generate-docs generate-winmanifest
generate-drone:
drone jsonnet -V BUILD_IMAGE_VERSION=$(BUILD_IMAGE_VERSION) --stream --format --source .drone/drone.jsonnet --target .drone/drone.yml
@@ -250,6 +251,13 @@ ifeq ($(USE_CONTAINER),1)
else
go generate ./docs
endif
generate-winmanifest:
ifeq ($(USE_CONTAINER),1)
$(RERUN_IN_CONTAINER)
else
go generate ./internal/winmanifest
endif
#
# Other targets
#

View File

@@ -9,6 +9,9 @@ import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"golang.org/x/sys/windows/svc"
// Embed application manifest for Windows builds
_ "github.com/grafana/alloy/internal/winmanifest"
)
const serviceName = "Alloy"

View File

@@ -0,0 +1,9 @@
// Package winmanifest provides a basic manifest.
//
// You import it for its side effects only, as
//
// import _ "github.com/grafana/alloy/internal/winmanifest"
//
// On non-Windows platforms this package does nothing.
package winmanifest

View File

@@ -0,0 +1,3 @@
package winmanifest
//go:generate go run github.com/tc-hib/go-winres@v0.3.3 make --product-version=git-tag --file-version=git-tag

View File

@@ -0,0 +1,44 @@
{
"RT_GROUP_ICON": {
"#1": {
"0000": "../../../packaging/windows/logo.ico"
}
},
"RT_MANIFEST": {
"#1": {
"0409": {
"description": "OpenTelemetry Collector distribution with programmable pipelines",
"minimum-os": "win7",
"execution-level": "as invoker",
"ui-access": false,
"long-path-aware": true
}
}
},
"RT_VERSION": {
"#1": {
"0000": {
"fixed": {
"file_version": "0.0.0.0",
"product_version": "0.0.0.0"
},
"info": {
"0409": {
"Comments": "",
"CompanyName": "Grafana Labs",
"FileDescription": "OpenTelemetry Collector distribution with programmable pipelines",
"FileVersion": "",
"InternalName": "",
"LegalCopyright": "Grafana Labs",
"LegalTrademarks": "",
"OriginalFilename": "",
"PrivateBuild": "",
"ProductName": "Grafana Alloy",
"ProductVersion": "",
"SpecialBuild": ""
}
}
}
}
}
}

View File

@@ -15,6 +15,9 @@ import (
// Embed a set of fallback X.509 trusted roots
// Allows the app to work correctly even when the OS does not provide a verifier or systems roots pool
_ "golang.org/x/crypto/x509roots/fallback"
// Embed application manifest for Windows builds
_ "github.com/grafana/alloy/internal/winmanifest"
)
func init() {

View File

@@ -73,7 +73,7 @@ dist/alloy-darwin-arm64: generate-ui
dist/alloy-windows-amd64.exe: GO_TAGS += builtinassets
dist/alloy-windows-amd64.exe: GOOS := windows
dist/alloy-windows-amd64.exe: GOARCH := amd64
dist/alloy-windows-amd64.exe: generate-ui
dist/alloy-windows-amd64.exe: generate-ui generate-winmanifest
$(PACKAGING_VARS) ALLOY_BINARY=$@ "$(MAKE)" -f $(PARENT_MAKEFILE) alloy
# NOTE(rfratto): do not use netgo when building Windows binaries, which
@@ -102,7 +102,7 @@ dist-alloy-service-binaries: dist.temp/alloy-service-windows-amd64.exe
dist.temp/alloy-service-windows-amd64.exe: GO_TAGS += builtinassets
dist.temp/alloy-service-windows-amd64.exe: GOOS := windows
dist.temp/alloy-service-windows-amd64.exe: GOARCH := amd64
dist.temp/alloy-service-windows-amd64.exe: generate-ui
dist.temp/alloy-service-windows-amd64.exe: generate-ui generate-winmanifest
$(PACKAGING_VARS) SERVICE_BINARY=$@ "$(MAKE)" -f $(PARENT_MAKEFILE) alloy-service
#