5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-10 02:40:26 +08:00

Log git hash if using replaced module

This commit is contained in:
Lea Anthony 2023-08-13 19:39:11 +10:00
parent e79c1b7ea3
commit cc5c7d1d29
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405

View File

@ -3,6 +3,7 @@
package application
import (
"github.com/go-git/go-git/v5"
"github.com/samber/lo"
"github.com/wailsapp/wails/v3/internal/commands"
"path/filepath"
@ -46,10 +47,17 @@ func (a *App) logStartup() {
wailsVersion := commands.VersionString
if wailsPackage != nil && wailsPackage.Replace != nil {
wailsVersion = "(local) => " + filepath.ToSlash(wailsPackage.Replace.Path)
// Get the latest commit hash
repo, err := git.PlainOpen(filepath.Join(wailsPackage.Replace.Path, ".."))
if err == nil {
head, err := repo.Head()
if err == nil {
wailsVersion += " (" + head.Hash().String()[:8] + ")"
}
}
}
args = append(args, "Wails", wailsVersion)
args = append(args, "Compiler", BuildInfo.GoVersion)
for key, value := range BuildSettings {
args = append(args, key, value)
}