Include git commit in version string
This commit is contained in:
parent
3fcaa9959b
commit
e0abdd6a33
14
main.go
14
main.go
|
|
@ -76,6 +76,7 @@ var (
|
||||||
logsDirPath string
|
logsDirPath string
|
||||||
feedbackBundler = utils.NewFeedbackBundler()
|
feedbackBundler = utils.NewFeedbackBundler()
|
||||||
appVersion = "v0.1.0-dev24"
|
appVersion = "v0.1.0-dev24"
|
||||||
|
buildCommit = "dev"
|
||||||
|
|
||||||
hwAccelProbeOnce sync.Once
|
hwAccelProbeOnce sync.Once
|
||||||
hwAccelSupported atomic.Value // map[string]bool
|
hwAccelSupported atomic.Value // map[string]bool
|
||||||
|
|
@ -139,6 +140,13 @@ func statusStrip(bar *ui.ConversionStatsBar) fyne.CanvasObject {
|
||||||
return container.NewMax(bg, content)
|
return container.NewMax(bg, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func fullVersion() string {
|
||||||
|
if buildCommit == "" || buildCommit == "dev" {
|
||||||
|
return appVersion
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%s_%s", appVersion, buildCommit)
|
||||||
|
}
|
||||||
|
|
||||||
// moduleFooter stacks a dark status strip above a tinted action/footer band.
|
// moduleFooter stacks a dark status strip above a tinted action/footer band.
|
||||||
// If content is nil, a spacer is used for consistent height/color.
|
// If content is nil, a spacer is used for consistent height/color.
|
||||||
func moduleFooter(tint color.Color, content fyne.CanvasObject, bar *ui.ConversionStatsBar) fyne.CanvasObject {
|
func moduleFooter(tint color.Color, content fyne.CanvasObject, bar *ui.ConversionStatsBar) fyne.CanvasObject {
|
||||||
|
|
@ -554,7 +562,7 @@ func generatePixelatedQRCode() (fyne.CanvasObject, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *appState) showAbout() {
|
func (s *appState) showAbout() {
|
||||||
version := fmt.Sprintf("VideoTools %s", appVersion)
|
version := fmt.Sprintf("VideoTools %s", fullVersion())
|
||||||
dev := "Leak Technologies"
|
dev := "Leak Technologies"
|
||||||
logsPath := getLogsDir()
|
logsPath := getLogsDir()
|
||||||
|
|
||||||
|
|
@ -2009,7 +2017,7 @@ func (s *appState) showMainMenu() {
|
||||||
s.updateStatsBar()
|
s.updateStatsBar()
|
||||||
|
|
||||||
// Footer with version info and a small About/Support button
|
// Footer with version info and a small About/Support button
|
||||||
versionLabel := widget.NewLabel(fmt.Sprintf("VideoTools %s", appVersion))
|
versionLabel := widget.NewLabel(fmt.Sprintf("VideoTools %s", fullVersion()))
|
||||||
versionLabel.Alignment = fyne.TextAlignLeading
|
versionLabel.Alignment = fyne.TextAlignLeading
|
||||||
aboutBtn := widget.NewButton("About / Support", func() {
|
aboutBtn := widget.NewButton("About / Support", func() {
|
||||||
s.showAbout()
|
s.showAbout()
|
||||||
|
|
@ -6595,7 +6603,7 @@ func main() {
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
logging.SetDebug(*debugFlag || os.Getenv("VIDEOTOOLS_DEBUG") != "")
|
logging.SetDebug(*debugFlag || os.Getenv("VIDEOTOOLS_DEBUG") != "")
|
||||||
logging.Debug(logging.CatSystem, "starting VideoTools prototype at %s", time.Now().Format(time.RFC3339))
|
logging.Debug(logging.CatSystem, "starting VideoTools %s at %s", fullVersion(), time.Now().Format(time.RFC3339))
|
||||||
|
|
||||||
// Detect platform and configure paths
|
// Detect platform and configure paths
|
||||||
cfg := DetectPlatform() // Detect and initialize platform paths locally
|
cfg := DetectPlatform() // Detect and initialize platform paths locally
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,15 @@ BUILD_OUTPUT="$PROJECT_ROOT/VideoTools"
|
||||||
# Extract app version from main.go (avoid grep warnings on Git Bash)
|
# Extract app version from main.go (avoid grep warnings on Git Bash)
|
||||||
APP_VERSION="$(grep -m1 'appVersion' "$PROJECT_ROOT/main.go" | sed -E 's/.*\"([^\"]+)\".*/\1/')"
|
APP_VERSION="$(grep -m1 'appVersion' "$PROJECT_ROOT/main.go" | sed -E 's/.*\"([^\"]+)\".*/\1/')"
|
||||||
[ -z "$APP_VERSION" ] && APP_VERSION="(version unknown)"
|
[ -z "$APP_VERSION" ] && APP_VERSION="(version unknown)"
|
||||||
|
GIT_COMMIT=""
|
||||||
|
if command -v git >/dev/null 2>&1; then
|
||||||
|
GIT_COMMIT="$(git -C "$PROJECT_ROOT" rev-parse --short HEAD 2>/dev/null || true)"
|
||||||
|
fi
|
||||||
|
if [ -n "$GIT_COMMIT" ]; then
|
||||||
|
FULL_VERSION="${APP_VERSION}_${GIT_COMMIT}"
|
||||||
|
else
|
||||||
|
FULL_VERSION="$APP_VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "════════════════════════════════════════════════════════════════"
|
echo "════════════════════════════════════════════════════════════════"
|
||||||
echo " VideoTools Build Script"
|
echo " VideoTools Build Script"
|
||||||
|
|
@ -78,19 +87,23 @@ if [ -d "$PROJECT_ROOT/vendor" ] && [ ! -f "$PROJECT_ROOT/vendor/modules.txt" ];
|
||||||
export GOFLAGS="${GOFLAGS:-} -mod=mod"
|
export GOFLAGS="${GOFLAGS:-} -mod=mod"
|
||||||
fi
|
fi
|
||||||
# GStreamer is always enabled now (mandatory dependency)
|
# GStreamer is always enabled now (mandatory dependency)
|
||||||
if go build -tags gstreamer -o "$BUILD_OUTPUT" .; then
|
LDFLAGS=""
|
||||||
|
if [ -n "$GIT_COMMIT" ]; then
|
||||||
|
LDFLAGS="-X main.buildCommit=$GIT_COMMIT"
|
||||||
|
fi
|
||||||
|
if go build -tags gstreamer -ldflags="$LDFLAGS" -o "$BUILD_OUTPUT" .; then
|
||||||
build_end=$(date +%s)
|
build_end=$(date +%s)
|
||||||
build_secs=$((build_end - build_start))
|
build_secs=$((build_end - build_start))
|
||||||
echo "Build successful! (VideoTools $APP_VERSION)"
|
echo "Build successful! (VideoTools $FULL_VERSION)"
|
||||||
echo "Build time: ${build_secs}s"
|
echo "Build time: ${build_secs}s"
|
||||||
echo ""
|
echo ""
|
||||||
echo "════════════════════════════════════════════════════════════════"
|
echo "════════════════════════════════════════════════════════════════"
|
||||||
echo "BUILD COMPLETE - $APP_VERSION"
|
echo "BUILD COMPLETE - $FULL_VERSION"
|
||||||
echo "════════════════════════════════════════════════════════════════"
|
echo "════════════════════════════════════════════════════════════════"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Output: $BUILD_OUTPUT"
|
echo "Output: $BUILD_OUTPUT"
|
||||||
echo "Size: $(du -h "$BUILD_OUTPUT" | cut -f1)"
|
echo "Size: $(du -h "$BUILD_OUTPUT" | cut -f1)"
|
||||||
echo "Diagnostics: version=$APP_VERSION os=$(uname -s) arch=$(uname -m) go=$(go version | awk '{print $3}')"
|
echo "Diagnostics: version=$FULL_VERSION os=$(uname -s) arch=$(uname -m) go=$(go version | awk '{print $3}')"
|
||||||
echo ""
|
echo ""
|
||||||
echo "To run:"
|
echo "To run:"
|
||||||
echo " $PROJECT_ROOT/VideoTools"
|
echo " $PROJECT_ROOT/VideoTools"
|
||||||
|
|
@ -100,8 +113,8 @@ if go build -tags gstreamer -o "$BUILD_OUTPUT" .; then
|
||||||
echo " VideoTools"
|
echo " VideoTools"
|
||||||
echo ""
|
echo ""
|
||||||
else
|
else
|
||||||
echo "Build failed! (VideoTools $APP_VERSION)"
|
echo "Build failed! (VideoTools $FULL_VERSION)"
|
||||||
echo "Diagnostics: version=$APP_VERSION os=$(uname -s) arch=$(uname -m) go=$(go version | awk '{print $3}')"
|
echo "Diagnostics: version=$FULL_VERSION os=$(uname -s) arch=$(uname -m) go=$(go version | awk '{print $3}')"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Help: check the Go error messages above."
|
echo "Help: check the Go error messages above."
|
||||||
echo " - Undefined symbol/identifier: usually a missing variable or typo in source; see the referenced file:line."
|
echo " - Undefined symbol/identifier: usually a missing variable or typo in source; see the referenced file:line."
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,17 @@ set -e
|
||||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
BUILD_OUTPUT="$PROJECT_ROOT/VideoTools.exe"
|
BUILD_OUTPUT="$PROJECT_ROOT/VideoTools.exe"
|
||||||
DIST_DIR="$PROJECT_ROOT/dist/windows"
|
DIST_DIR="$PROJECT_ROOT/dist/windows"
|
||||||
|
APP_VERSION="$(grep -m1 'appVersion' "$PROJECT_ROOT/main.go" | sed -E 's/.*\"([^\"]+)\".*/\1/')"
|
||||||
|
[ -z "$APP_VERSION" ] && APP_VERSION="(version unknown)"
|
||||||
|
GIT_COMMIT=""
|
||||||
|
if command -v git >/dev/null 2>&1; then
|
||||||
|
GIT_COMMIT="$(git -C "$PROJECT_ROOT" rev-parse --short HEAD 2>/dev/null || true)"
|
||||||
|
fi
|
||||||
|
if [ -n "$GIT_COMMIT" ]; then
|
||||||
|
FULL_VERSION="${APP_VERSION}_${GIT_COMMIT}"
|
||||||
|
else
|
||||||
|
FULL_VERSION="$APP_VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "════════════════════════════════════════════════════════════════"
|
echo "════════════════════════════════════════════════════════════════"
|
||||||
echo " VideoTools Windows Build Script (Cross-Compilation)"
|
echo " VideoTools Windows Build Script (Cross-Compilation)"
|
||||||
|
|
@ -87,6 +98,9 @@ export CXX=x86_64-w64-mingw32-g++
|
||||||
# -H windowsgui: Hide console window (GUI application)
|
# -H windowsgui: Hide console window (GUI application)
|
||||||
# -s -w: Strip debug symbols (smaller binary)
|
# -s -w: Strip debug symbols (smaller binary)
|
||||||
LDFLAGS="-H windowsgui -s -w"
|
LDFLAGS="-H windowsgui -s -w"
|
||||||
|
if [ -n "$GIT_COMMIT" ]; then
|
||||||
|
LDFLAGS="$LDFLAGS -X main.buildCommit=$GIT_COMMIT"
|
||||||
|
fi
|
||||||
|
|
||||||
if go build -ldflags="$LDFLAGS" -o "$BUILD_OUTPUT" .; then
|
if go build -ldflags="$LDFLAGS" -o "$BUILD_OUTPUT" .; then
|
||||||
echo "Cross-compilation successful!"
|
echo "Cross-compilation successful!"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,15 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
# Extract app version from main.go (avoid grep warnings on Git Bash)
|
# Extract app version from main.go (avoid grep warnings on Git Bash)
|
||||||
APP_VERSION="$(grep -m1 'appVersion' "$PROJECT_ROOT/main.go" | sed -E 's/.*\"([^\"]+)\".*/\1/')"
|
APP_VERSION="$(grep -m1 'appVersion' "$PROJECT_ROOT/main.go" | sed -E 's/.*\"([^\"]+)\".*/\1/')"
|
||||||
[ -z "$APP_VERSION" ] && APP_VERSION="(version unknown)"
|
[ -z "$APP_VERSION" ] && APP_VERSION="(version unknown)"
|
||||||
|
GIT_COMMIT=""
|
||||||
|
if command -v git >/dev/null 2>&1; then
|
||||||
|
GIT_COMMIT="$(git -C "$PROJECT_ROOT" rev-parse --short HEAD 2>/dev/null || true)"
|
||||||
|
fi
|
||||||
|
if [ -n "$GIT_COMMIT" ]; then
|
||||||
|
FULL_VERSION="${APP_VERSION}_${GIT_COMMIT}"
|
||||||
|
else
|
||||||
|
FULL_VERSION="$APP_VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
# Detect platform
|
# Detect platform
|
||||||
PLATFORM="$(uname -s)"
|
PLATFORM="$(uname -s)"
|
||||||
|
|
@ -36,17 +45,17 @@ go version
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
diagnostics() {
|
diagnostics() {
|
||||||
echo "Diagnostics: version=$APP_VERSION os=$OS arch=$(uname -m) go=$(go version | awk '{print $3}')"
|
echo "Diagnostics: version=$FULL_VERSION os=$OS arch=$(uname -m) go=$(go version | awk '{print $3}')"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$OS" in
|
case "$OS" in
|
||||||
Linux|macOS)
|
Linux|macOS)
|
||||||
echo "→ Building VideoTools $APP_VERSION for $OS..."
|
echo "→ Building VideoTools $FULL_VERSION for $OS..."
|
||||||
echo ""
|
echo ""
|
||||||
exec "$SCRIPT_DIR/build-linux.sh"
|
exec "$SCRIPT_DIR/build-linux.sh"
|
||||||
;;
|
;;
|
||||||
Windows)
|
Windows)
|
||||||
echo "→ Building VideoTools $APP_VERSION for Windows..."
|
echo "→ Building VideoTools $FULL_VERSION for Windows..."
|
||||||
echo ""
|
echo ""
|
||||||
cd "$PROJECT_ROOT"
|
cd "$PROJECT_ROOT"
|
||||||
build_start=$(date +%s)
|
build_start=$(date +%s)
|
||||||
|
|
@ -71,22 +80,26 @@ case "$OS" in
|
||||||
echo "GStreamer found ($(pkg-config --modversion gstreamer-1.0 2>/dev/null || echo 'version unknown'))"
|
echo "GStreamer found ($(pkg-config --modversion gstreamer-1.0 2>/dev/null || echo 'version unknown'))"
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
echo "Building VideoTools $APP_VERSION for Windows..."
|
echo "Building VideoTools $FULL_VERSION for Windows..."
|
||||||
export CGO_ENABLED=1
|
export CGO_ENABLED=1
|
||||||
# GStreamer is always enabled (mandatory dependency on supported platforms)
|
# GStreamer is always enabled (mandatory dependency on supported platforms)
|
||||||
export GOFLAGS="${GOFLAGS:-} -tags gstreamer"
|
export GOFLAGS="${GOFLAGS:-} -tags gstreamer"
|
||||||
if [ -d "$PROJECT_ROOT/vendor" ] && [ ! -f "$PROJECT_ROOT/vendor/modules.txt" ]; then
|
if [ -d "$PROJECT_ROOT/vendor" ] && [ ! -f "$PROJECT_ROOT/vendor/modules.txt" ]; then
|
||||||
export GOFLAGS="${GOFLAGS:-} -mod=mod"
|
export GOFLAGS="${GOFLAGS:-} -mod=mod"
|
||||||
fi
|
fi
|
||||||
if go build -ldflags="-H windowsgui -s -w" -o VideoTools.exe .; then
|
LDFLAGS="-H windowsgui -s -w"
|
||||||
|
if [ -n "$GIT_COMMIT" ]; then
|
||||||
|
LDFLAGS="$LDFLAGS -X main.buildCommit=$GIT_COMMIT"
|
||||||
|
fi
|
||||||
|
if go build -ldflags="$LDFLAGS" -o VideoTools.exe .; then
|
||||||
build_end=$(date +%s)
|
build_end=$(date +%s)
|
||||||
build_secs=$((build_end - build_start))
|
build_secs=$((build_end - build_start))
|
||||||
echo "Build successful! (VideoTools $APP_VERSION)"
|
echo "Build successful! (VideoTools $FULL_VERSION)"
|
||||||
echo "Build time: ${build_secs}s"
|
echo "Build time: ${build_secs}s"
|
||||||
echo ""
|
echo ""
|
||||||
if [ -f "setup-windows.bat" ]; then
|
if [ -f "setup-windows.bat" ]; then
|
||||||
echo "════════════════════════════════════════════════════════════════"
|
echo "════════════════════════════════════════════════════════════════"
|
||||||
echo "BUILD COMPLETE - $APP_VERSION"
|
echo "BUILD COMPLETE - $FULL_VERSION"
|
||||||
echo "════════════════════════════════════════════════════════════════"
|
echo "════════════════════════════════════════════════════════════════"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Output: VideoTools.exe"
|
echo "Output: VideoTools.exe"
|
||||||
|
|
@ -114,7 +127,7 @@ case "$OS" in
|
||||||
diagnostics
|
diagnostics
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Build failed! (VideoTools $APP_VERSION)"
|
echo "Build failed! (VideoTools $FULL_VERSION)"
|
||||||
diagnostics
|
diagnostics
|
||||||
echo ""
|
echo ""
|
||||||
echo "Help: check the Go error messages above."
|
echo "Help: check the Go error messages above."
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user