Skip to content

Commit 1850bfa

Browse files
committed
Use goversioninfo to include app manifest, icon, and version
1 parent 1243461 commit 1850bfa

8 files changed

Lines changed: 65 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ dist/
44
/.venv
55
/redbot-update
66
*.exe
7+
**/resources/generated/
8+
resources_windows.syso

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ build-all: build-go build-python
1111

1212
.PHONY: build-go
1313
build-go:
14+
CGO_ENABLED=1 go generate ./...
1415
CGO_ENABLED=1 go build ./...
1516
CGO_ENABLED=1 go build ./go/cmd/redbot-update
1617

go.mod

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,10 @@ module github.com/cog-creators/redbot-update-wrapper
33
go 1.26
44

55
toolchain go1.26.3
6+
7+
tool github.com/josephspurrier/goversioninfo/cmd/goversioninfo
8+
9+
require (
10+
github.com/akavel/rsrc v0.10.2 // indirect
11+
github.com/josephspurrier/goversioninfo v1.7.0 // indirect
12+
)

go.sum

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw=
2+
github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
3+
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
4+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5+
github.com/josephspurrier/goversioninfo v1.7.0 h1:LQzXOlVm/CtbwJ9/UHl5a2HT0BjcLAwid5gqGd7ZUJ8=
6+
github.com/josephspurrier/goversioninfo v1.7.0/go.mod h1:z9y0r2G6g5jwSJaFE0cxW9to0aeIibK7UYeLx53aQRU=
7+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
8+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
9+
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
10+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
11+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
12+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

go/cmd/redbot-update/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//go:generate go run ../../build_tools/generate_versioninfo ../../..
2+
//go:generate go tool github.com/josephspurrier/goversioninfo/cmd/goversioninfo -o resources_windows.syso resources/generated/versioninfo.json
3+
14
package main
25

36
import (
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
3+
<assemblyIdentity version="{{ .ProductVersion }}" name="redbot-update.exe" type="win32" />
4+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
5+
<security>
6+
<requestedPrivileges>
7+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
8+
</requestedPrivileges>
9+
</security>
10+
</trustInfo>
11+
</assembly>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"FixedFileInfo": {
3+
"FileFlagsMask": "3f",
4+
"FileFlags ": "00",
5+
"FileOS": "040004",
6+
"FileType": "01",
7+
"FileSubType": "00"
8+
},
9+
"StringFileInfo": {
10+
"Comments": "",
11+
"CompanyName": "Cog Creators",
12+
"FileDescription": "redbot-update wrapper",
13+
"InternalName": "redbot-update.exe",
14+
"LegalCopyright": "Copyright (c) 2026 Cog Creators (https://github.com/Cog-Creators)",
15+
"LegalTrademarks": "",
16+
"OriginalFilename": "redbot-update.exe",
17+
"PrivateBuild": "",
18+
"ProductName": "redbot-update wrapper",
19+
"SpecialBuild": ""
20+
},
21+
"IconPath": "resources/cog-creators.ico",
22+
"ManifestPath": "resources/generated/app.manifest"
23+
}

hatch_build.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ def dependencies(self) -> List[str]:
198198

199199
def initialize(self, version: str, build_data: Dict[str, Any]) -> None:
200200
if self.target_name == "sdist":
201+
go_bin_args = _get_go_bin_args(prefer_system=not self._force_use_go_bin)
202+
generate_command = (*go_bin_args, "generate", "./go/cmd/redbot-update")
203+
204+
self.app.display_info("Generating redbot-update resources")
205+
subprocess.check_call(generate_command)
206+
self.app.display_success("Generated redbot-update resources")
201207
return
202208

203209
if version == "editable":

0 commit comments

Comments
 (0)