Implement a Windows application manifest (#1445)

This commit is contained in:
Jan-Otto Kröpke 2024-05-03 07:30:31 +02:00 committed by GitHub
parent f6b91e5cb0
commit 8f6a1e3f07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 65 additions and 5 deletions

2
.gitignore vendored
View File

@ -7,4 +7,4 @@ output/
.idea
*.syso
installer/*.msi
installer/*.wixpdb
installer/*.wixpdb

View File

@ -12,10 +12,15 @@ ALL_OS:= 1809 ltsc2022
BASE_IMAGE=mcr.microsoft.com/windows/nanoserver
.PHONY: build
build: windows_exporter.exe
build: generate windows_exporter.exe
windows_exporter.exe: pkg/**/*.go
promu build -v
.PHONY: generate
generate:
go generate ./...
test:
go test -v ./...
@ -36,7 +41,7 @@ promtool: windows_exporter.exe
fmt:
gofmt -l -w -s .
crossbuild:
crossbuild: generate
# The prometheus/golang-builder image for promu crossbuild doesn't exist
# on Windows, so for now, we'll just build twice
GOARCH=amd64 promu build --prefix=output/amd64

View File

@ -1,8 +1,13 @@
//go:build windows
//go:generate go run github.com/tc-hib/go-winres@v0.3.3 make --product-version=git-tag --file-version=git-tag --arch=amd64,arm64
package main
import (
// Its important that we do these first so that we can register with the Windows service control ASAP to avoid timeouts
"github.com/prometheus-community/windows_exporter/pkg/initiate"
"encoding/json"
"fmt"
"net/http"
@ -13,8 +18,6 @@ import (
"sort"
"strings"
// Its important that we do these first so that we can register with the windows service control ASAP to avoid timeouts
"github.com/prometheus-community/windows_exporter/pkg/initiate"
winlog "github.com/prometheus-community/windows_exporter/pkg/log"
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus-community/windows_exporter/pkg/utils"

52
winres/winres.json Normal file
View File

@ -0,0 +1,52 @@
{
"RT_GROUP_ICON": {
"APP": {}
},
"RT_MANIFEST": {
"#1": {
"0409": {
"description": "A Prometheus exporter for Windows machines.",
"minimum-os": "win7",
"execution-level": "as invoker",
"ui-access": false,
"auto-elevate": false,
"dpi-awareness": "system",
"disable-theming": false,
"disable-window-filtering": false,
"high-resolution-scrolling-aware": false,
"ultra-high-resolution-scrolling-aware": false,
"long-path-aware": false,
"printer-driver-isolation": false,
"gdi-scaling": false,
"segment-heap": false,
"use-common-controls-v6": false
}
}
},
"RT_VERSION": {
"#1": {
"0000": {
"fixed": {
"file_version": "0.0.0.0",
"product_version": "0.0.0.0"
},
"info": {
"0409": {
"Comments": "",
"CompanyName": "Prometheus Community",
"FileDescription": "A Prometheus exporter for Windows machines.",
"FileVersion": "",
"InternalName": "",
"LegalCopyright": "",
"LegalTrademarks": "",
"OriginalFilename": "",
"PrivateBuild": "",
"ProductName": "",
"ProductVersion": "",
"SpecialBuild": ""
}
}
}
}
}
}