Show app version and diagnostics in build scripts
This commit is contained in:
parent
01af78debc
commit
2dd9c7d279
53
main.go
53
main.go
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"image/png"
|
"image/png"
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
@ -63,8 +64,10 @@ var (
|
||||||
|
|
||||||
conversionLogSuffix = ".videotools.log"
|
conversionLogSuffix = ".videotools.log"
|
||||||
|
|
||||||
logsDirOnce sync.Once
|
logsDirOnce sync.Once
|
||||||
logsDirPath string
|
logsDirPath string
|
||||||
|
feedbackBundler = newFeedbackBundler()
|
||||||
|
appVersion = "v0.1.0-dev14"
|
||||||
|
|
||||||
modulesList = []Module{
|
modulesList = []Module{
|
||||||
{"convert", "Convert", utils.MustHex("#8B44FF"), "Convert", modules.HandleConvert}, // Violet
|
{"convert", "Convert", utils.MustHex("#8B44FF"), "Convert", modules.HandleConvert}, // Violet
|
||||||
|
|
@ -215,6 +218,33 @@ func openFolder(path string) error {
|
||||||
return cmd.Start()
|
return cmd.Start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *appState) showAbout() {
|
||||||
|
version := fmt.Sprintf("VideoTools %s", appVersion)
|
||||||
|
dev := "Leak Technologies"
|
||||||
|
logsPath := getLogsDir()
|
||||||
|
|
||||||
|
versionText := widget.NewLabel(version)
|
||||||
|
devText := widget.NewLabel(fmt.Sprintf("Developer: %s", dev))
|
||||||
|
logsLink := widget.NewButton("Open Logs Folder", func() {
|
||||||
|
if err := openFolder(logsPath); err != nil {
|
||||||
|
dialog.ShowError(fmt.Errorf("failed to open logs folder: %w", err), s.window)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
logsLink.Importance = widget.LowImportance
|
||||||
|
|
||||||
|
donateURL, _ := url.Parse("https://leaktechnologies.dev/support")
|
||||||
|
donateLink := widget.NewHyperlink("Support development", donateURL)
|
||||||
|
|
||||||
|
body := container.NewVBox(
|
||||||
|
versionText,
|
||||||
|
devText,
|
||||||
|
logsLink,
|
||||||
|
donateLink,
|
||||||
|
widget.NewLabel("Feedback: use the Logs button on the main menu to view logs; send issues with attached logs."),
|
||||||
|
)
|
||||||
|
dialog.ShowCustom("About & Support", "Close", body, s.window)
|
||||||
|
}
|
||||||
|
|
||||||
type formatOption struct {
|
type formatOption struct {
|
||||||
Label string
|
Label string
|
||||||
Ext string
|
Ext string
|
||||||
|
|
@ -618,13 +648,22 @@ func (s *appState) showMainMenu() {
|
||||||
// Update stats bar
|
// Update stats bar
|
||||||
s.updateStatsBar()
|
s.updateStatsBar()
|
||||||
|
|
||||||
|
// Footer with version info and a small About/Support button
|
||||||
|
versionLabel := widget.NewLabel(fmt.Sprintf("VideoTools %s", appVersion))
|
||||||
|
versionLabel.Alignment = fyne.TextAlignLeading
|
||||||
|
aboutBtn := widget.NewButton("About / Support", func() {
|
||||||
|
s.showAbout()
|
||||||
|
})
|
||||||
|
aboutBtn.Importance = widget.LowImportance
|
||||||
|
footer := container.NewBorder(nil, nil, nil, aboutBtn, versionLabel)
|
||||||
|
|
||||||
// Add stats bar at the bottom of the menu
|
// Add stats bar at the bottom of the menu
|
||||||
content := container.NewBorder(
|
content := container.NewBorder(
|
||||||
nil, // top
|
nil, // top
|
||||||
s.statsBar, // bottom
|
container.NewVBox(s.statsBar, footer), // bottom
|
||||||
nil, // left
|
nil, // left
|
||||||
nil, // right
|
nil, // right
|
||||||
container.NewPadded(menu), // center
|
container.NewPadded(menu), // center
|
||||||
)
|
)
|
||||||
|
|
||||||
s.setContent(content)
|
s.setContent(content)
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@ set -e
|
||||||
|
|
||||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
BUILD_OUTPUT="$PROJECT_ROOT/VideoTools"
|
BUILD_OUTPUT="$PROJECT_ROOT/VideoTools"
|
||||||
|
# Extract app version from main.go
|
||||||
|
APP_VERSION="$(grep -E 'appVersion\s*=\s*\"' "$PROJECT_ROOT/main.go" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')"
|
||||||
|
[ -z "$APP_VERSION" ] && APP_VERSION="(version unknown)"
|
||||||
|
|
||||||
echo "════════════════════════════════════════════════════════════════"
|
echo "════════════════════════════════════════════════════════════════"
|
||||||
echo " VideoTools Build Script"
|
echo " VideoTools Build Script"
|
||||||
|
|
@ -41,14 +44,15 @@ echo "🔨 Building VideoTools..."
|
||||||
# Fyne needs cgo for GLFW/OpenGL bindings; build with CGO enabled.
|
# Fyne needs cgo for GLFW/OpenGL bindings; build with CGO enabled.
|
||||||
export CGO_ENABLED=1
|
export CGO_ENABLED=1
|
||||||
if go build -o "$BUILD_OUTPUT" .; then
|
if go build -o "$BUILD_OUTPUT" .; then
|
||||||
echo "✓ Build successful!"
|
echo "✓ Build successful! (VideoTools $APP_VERSION)"
|
||||||
echo ""
|
echo ""
|
||||||
echo "════════════════════════════════════════════════════════════════"
|
echo "════════════════════════════════════════════════════════════════"
|
||||||
echo "✅ BUILD COMPLETE"
|
echo "✅ BUILD COMPLETE - $APP_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 ""
|
echo ""
|
||||||
echo "To run:"
|
echo "To run:"
|
||||||
echo " $PROJECT_ROOT/VideoTools"
|
echo " $PROJECT_ROOT/VideoTools"
|
||||||
|
|
@ -58,6 +62,7 @@ if go build -o "$BUILD_OUTPUT" .; then
|
||||||
echo " VideoTools"
|
echo " VideoTools"
|
||||||
echo ""
|
echo ""
|
||||||
else
|
else
|
||||||
echo "❌ Build failed!"
|
echo "❌ Build failed! (VideoTools $APP_VERSION)"
|
||||||
|
echo "Diagnostics: version=$APP_VERSION os=$(uname -s) arch=$(uname -m) go=$(go version | awk '{print $3}')"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
145
scripts/build.sh
Executable file → Normal file
145
scripts/build.sh
Executable file → Normal file
|
|
@ -1,12 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# VideoTools Universal Build Script
|
# VideoTools Universal Build Script (Linux/macOS/Windows via Git Bash)
|
||||||
# Auto-detects platform and builds accordingly
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# Extract app version from main.go
|
||||||
|
APP_VERSION="$(grep -E 'appVersion\s*=\s*"' "$PROJECT_ROOT/main.go" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')"
|
||||||
|
[ -z "$APP_VERSION" ] && APP_VERSION="(version unknown)"
|
||||||
|
|
||||||
echo "════════════════════════════════════════════════════════════════"
|
echo "════════════════════════════════════════════════════════════════"
|
||||||
echo " VideoTools Universal Build Script"
|
echo " VideoTools Universal Build Script"
|
||||||
echo "════════════════════════════════════════════════════════════════"
|
echo "════════════════════════════════════════════════════════════════"
|
||||||
|
|
@ -14,30 +16,18 @@ echo ""
|
||||||
|
|
||||||
# Detect platform
|
# Detect platform
|
||||||
PLATFORM="$(uname -s)"
|
PLATFORM="$(uname -s)"
|
||||||
case "${PLATFORM}" in
|
case "$PLATFORM" in
|
||||||
Linux*)
|
Linux*) OS="Linux" ;;
|
||||||
OS="Linux"
|
Darwin*) OS="macOS" ;;
|
||||||
;;
|
CYGWIN*|MINGW*|MSYS*) OS="Windows" ;;
|
||||||
Darwin*)
|
*) echo "❌ Unknown platform: $PLATFORM"; exit 1 ;;
|
||||||
OS="macOS"
|
|
||||||
;;
|
|
||||||
CYGWIN*|MINGW*|MSYS*)
|
|
||||||
OS="Windows"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "❌ Unknown platform: ${PLATFORM}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo "🔍 Detected platform: $OS"
|
echo "🔍 Detected platform: $OS"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Check if go is installed
|
# Go check
|
||||||
if ! command -v go &> /dev/null; then
|
if ! command -v go >/dev/null 2>&1; then
|
||||||
echo "❌ ERROR: Go is not installed. Please install Go 1.21 or later."
|
echo "❌ ERROR: Go is not installed. Please install Go 1.21+ (go version currently missing)."
|
||||||
echo ""
|
|
||||||
echo "Download from: https://go.dev/dl/"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -45,85 +35,68 @@ echo "📦 Go version:"
|
||||||
go version
|
go version
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Route to appropriate build script
|
diagnostics() {
|
||||||
|
echo "Diagnostics: version=$APP_VERSION os=$OS arch=$(uname -m) go=$(go version | awk '{print $3}')"
|
||||||
|
}
|
||||||
|
|
||||||
case "$OS" in
|
case "$OS" in
|
||||||
Linux)
|
Linux|macOS)
|
||||||
echo "→ Building for Linux..."
|
echo "→ Building VideoTools $APP_VERSION for $OS..."
|
||||||
echo ""
|
echo ""
|
||||||
exec "$SCRIPT_DIR/build-linux.sh"
|
exec "$SCRIPT_DIR/build-linux.sh"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
macOS)
|
|
||||||
echo "→ Building for macOS..."
|
|
||||||
echo ""
|
|
||||||
# macOS uses same build process as Linux (native build)
|
|
||||||
exec "$SCRIPT_DIR/build-linux.sh"
|
|
||||||
;;
|
|
||||||
|
|
||||||
Windows)
|
Windows)
|
||||||
echo "→ Building for Windows..."
|
echo "→ Building VideoTools $APP_VERSION for Windows..."
|
||||||
|
echo ""
|
||||||
|
cd "$PROJECT_ROOT"
|
||||||
|
|
||||||
|
echo "🧹 Cleaning previous builds..."
|
||||||
|
rm -f VideoTools.exe 2>/dev/null || true
|
||||||
|
echo "✓ Cache cleaned"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Check if running in Git Bash or similar
|
echo "⬇️ Downloading dependencies..."
|
||||||
if command -v go.exe &> /dev/null; then
|
go mod download
|
||||||
# Windows native build
|
echo "✓ Dependencies downloaded"
|
||||||
cd "$PROJECT_ROOT"
|
echo ""
|
||||||
|
|
||||||
echo "🧹 Cleaning previous builds..."
|
echo "🔨 Building VideoTools $APP_VERSION for Windows..."
|
||||||
rm -f VideoTools.exe 2>/dev/null || true
|
export CGO_ENABLED=1
|
||||||
echo "✓ Cache cleaned"
|
if go build -ldflags="-H windowsgui -s -w" -o VideoTools.exe .; then
|
||||||
|
echo "✓ Build successful! (VideoTools $APP_VERSION)"
|
||||||
echo ""
|
echo ""
|
||||||
|
if [ -f "setup-windows.bat" ]; then
|
||||||
echo "⬇️ Downloading dependencies..."
|
echo "════════════════════════════════════════════════════════════════"
|
||||||
go mod download
|
echo "✅ BUILD COMPLETE - $APP_VERSION"
|
||||||
echo "✓ Dependencies downloaded"
|
echo "════════════════════════════════════════════════════════════════"
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "🔨 Building VideoTools for Windows..."
|
|
||||||
export CGO_ENABLED=1
|
|
||||||
|
|
||||||
# Build with Windows GUI flags
|
|
||||||
if go build -ldflags="-H windowsgui -s -w" -o VideoTools.exe .; then
|
|
||||||
echo "✓ Build successful!"
|
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "Output: VideoTools.exe"
|
||||||
# Run setup script to get FFmpeg
|
if [ -f "VideoTools.exe" ]; then
|
||||||
if [ -f "setup-windows.bat" ]; then
|
SIZE=$(du -h VideoTools.exe 2>/dev/null | cut -f1 || echo "unknown")
|
||||||
echo "════════════════════════════════════════════════════════════════"
|
echo "Size: $SIZE"
|
||||||
echo "✅ BUILD COMPLETE"
|
fi
|
||||||
echo "════════════════════════════════════════════════════════════════"
|
diagnostics
|
||||||
echo ""
|
echo ""
|
||||||
echo "Output: VideoTools.exe"
|
echo "Next step: Get FFmpeg"
|
||||||
if [ -f "VideoTools.exe" ]; then
|
echo " Run: setup-windows.bat"
|
||||||
SIZE=$(du -h VideoTools.exe 2>/dev/null | cut -f1 || echo "unknown")
|
echo " Or: .\\scripts\\setup-windows.ps1 -Portable"
|
||||||
echo "Size: $SIZE"
|
echo ""
|
||||||
fi
|
if ffmpeg -version >/dev/null 2>&1 && ffprobe -version >/dev/null 2>&1; then
|
||||||
echo ""
|
echo "FFmpeg detected on PATH. Skipping bundled download."
|
||||||
|
else
|
||||||
|
echo "FFmpeg not detected on PATH."
|
||||||
echo "Next step: Get FFmpeg"
|
echo "Next step: Get FFmpeg"
|
||||||
echo " Run: setup-windows.bat"
|
echo " Run: setup-windows.bat"
|
||||||
echo " Or: .\scripts\setup-windows.ps1 -Portable"
|
echo " Or: .\\scripts\\setup-windows.ps1 -Portable"
|
||||||
echo ""
|
echo "You can skip if FFmpeg is already installed elsewhere."
|
||||||
|
|
||||||
if ffmpeg -version >/dev/null 2>&1 && ffprobe -version >/dev/null 2>&1; then
|
|
||||||
echo "FFmpeg detected on PATH. Skipping bundled download."
|
|
||||||
else
|
|
||||||
echo "FFmpeg not detected on PATH."
|
|
||||||
echo "Next step: Get FFmpeg"
|
|
||||||
echo " Run: setup-windows.bat"
|
|
||||||
echo " Or: .\\scripts\\setup-windows.ps1 -Portable"
|
|
||||||
echo "You can skip if FFmpeg is already installed elsewhere."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "✓ Build complete: VideoTools.exe"
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "❌ Build failed!"
|
echo "✓ Build complete: VideoTools.exe"
|
||||||
exit 1
|
diagnostics
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "❌ ERROR: go.exe not found."
|
echo "❌ Build failed! (VideoTools $APP_VERSION)"
|
||||||
echo "Please ensure Go is properly installed on Windows."
|
diagnostics
|
||||||
echo "Download from: https://go.dev/dl/"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user