T1.8: Delete empty src/core; move version to src/app
Move version.go from src/core to src/app to prepare for deleting the now-empty src/core package. Update all imports and build script references to use src/app.Version instead of src/core.Version. Fix import aliasing conflict between Fyne's desktop package and our platform/desktop package by aliasing Fyne imports as fyneapp and fynedesktop. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ set -euo pipefail
|
|||||||
# Optional first argument mirrors build-linux.sh. The Docker build still writes
|
# Optional first argument mirrors build-linux.sh. The Docker build still writes
|
||||||
# the final artifact into the local dist/ tree, not into the container. The
|
# the final artifact into the local dist/ tree, not into the container. The
|
||||||
# default includes the application version and target platform.
|
# default includes the application version and target platform.
|
||||||
version="$(sed -n 's/^var Version = "\(.*\)"/\1/p' src/core/version.go)"
|
version="$(sed -n 's/^var Version = "\(.*\)"/\1/p' src/app/version.go)"
|
||||||
version="${version:-0.0.0-dev}"
|
version="${version:-0.0.0-dev}"
|
||||||
tag="gitea.mixdep.ru/mix/gosentry-builder:${version}"
|
tag="gitea.mixdep.ru/mix/gosentry-builder:${version}"
|
||||||
output="${1:-dist/linux/gosentry-${version}-linux-amd64}"
|
output="${1:-dist/linux/gosentry-${version}-linux-amd64}"
|
||||||
@@ -26,7 +26,7 @@ docker run --rm \
|
|||||||
-v "$(pwd):/src" \
|
-v "$(pwd):/src" \
|
||||||
-w /src \
|
-w /src \
|
||||||
"$tag" \
|
"$tag" \
|
||||||
bash -c 'CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildvcs=false -trimpath -ldflags "-s -w -X gitea.mixdep.ru/mix/gosentry/src/core.Version=${VERSION}" -o "${OUTPUT}" ./cmd/gosentry'
|
bash -c 'CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildvcs=false -trimpath -ldflags "-s -w -X gitea.mixdep.ru/mix/gosentry/src/app.Version=${VERSION}" -o "${OUTPUT}" ./cmd/gosentry'
|
||||||
|
|
||||||
# Icons are embedded in the Go binary, so there is no assets directory to copy
|
# Icons are embedded in the Go binary, so there is no assets directory to copy
|
||||||
# after extracting the Linux executable.
|
# after extracting the Linux executable.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -euo pipefail
|
|||||||
|
|
||||||
# Optional first argument lets a developer or CI job choose the output path. The
|
# Optional first argument lets a developer or CI job choose the output path. The
|
||||||
# default includes the application version and target platform.
|
# default includes the application version and target platform.
|
||||||
version="$(sed -n 's/^var Version = "\(.*\)"/\1/p' src/core/version.go)"
|
version="$(sed -n 's/^var Version = "\(.*\)"/\1/p' src/app/version.go)"
|
||||||
version="${version:-0.0.0-dev}"
|
version="${version:-0.0.0-dev}"
|
||||||
output="${1:-dist/linux/gosentry-${version}-linux-amd64}"
|
output="${1:-dist/linux/gosentry-${version}-linux-amd64}"
|
||||||
mkdir -p "$(dirname "$output")"
|
mkdir -p "$(dirname "$output")"
|
||||||
@@ -17,7 +17,7 @@ export GOARCH=amd64
|
|||||||
|
|
||||||
# -trimpath removes local machine paths from debug/build metadata. -s -w strips
|
# -trimpath removes local machine paths from debug/build metadata. -s -w strips
|
||||||
# symbol/debug tables to keep the desktop binary smaller.
|
# symbol/debug tables to keep the desktop binary smaller.
|
||||||
go build -trimpath -ldflags "-s -w -X gitea.mixdep.ru/mix/gosentry/src/core.Version=${version}" -o "$output" ./cmd/gosentry
|
go build -trimpath -ldflags "-s -w -X gitea.mixdep.ru/mix/gosentry/src/app.Version=${version}" -o "$output" ./cmd/gosentry
|
||||||
|
|
||||||
# The application icon is embedded by Go, so the Linux build does not need a
|
# The application icon is embedded by Go, so the Linux build does not need a
|
||||||
# sidecar assets directory beside the executable.
|
# sidecar assets directory beside the executable.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||||||
repo_root="$(cd "${script_dir}/.." && pwd)"
|
repo_root="$(cd "${script_dir}/.." && pwd)"
|
||||||
cd "$repo_root"
|
cd "$repo_root"
|
||||||
|
|
||||||
version="$(sed -n 's/^var Version = "\(.*\)"/\1/p' src/core/version.go)"
|
version="$(sed -n 's/^var Version = "\(.*\)"/\1/p' src/app/version.go)"
|
||||||
version="${version:-0.0.0-dev}"
|
version="${version:-0.0.0-dev}"
|
||||||
tag="gitea.mixdep.ru/mix/gosentry-builder:${version}"
|
tag="gitea.mixdep.ru/mix/gosentry-builder:${version}"
|
||||||
|
|
||||||
@@ -99,15 +99,15 @@ run_in_builder() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build_linux_amd64() {
|
build_linux_amd64() {
|
||||||
run_in_builder 'mkdir -p dist/linux && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildvcs=false -trimpath -ldflags "-s -w -X gitea.mixdep.ru/mix/gosentry/src/core.Version=${VERSION}" -o "dist/linux/gosentry-${VERSION}-linux-amd64" ./cmd/gosentry'
|
run_in_builder 'mkdir -p dist/linux && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildvcs=false -trimpath -ldflags "-s -w -X gitea.mixdep.ru/mix/gosentry/src/app.Version=${VERSION}" -o "dist/linux/gosentry-${VERSION}-linux-amd64" ./cmd/gosentry'
|
||||||
}
|
}
|
||||||
|
|
||||||
build_linux_arm64() {
|
build_linux_arm64() {
|
||||||
run_in_builder 'mkdir -p dist/linux && CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CGO_CFLAGS="--sysroot=/ -I/usr/include/aarch64-linux-gnu" CGO_LDFLAGS="--sysroot=/ -L/usr/lib/aarch64-linux-gnu" PKG_CONFIG_LIBDIR=/usr/lib/aarch64-linux-gnu/pkgconfig go build -buildvcs=false -trimpath -ldflags "-s -w -X gitea.mixdep.ru/mix/gosentry/src/core.Version=${VERSION}" -o "dist/linux/gosentry-${VERSION}-linux-arm64" ./cmd/gosentry'
|
run_in_builder 'mkdir -p dist/linux && CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CGO_CFLAGS="--sysroot=/ -I/usr/include/aarch64-linux-gnu" CGO_LDFLAGS="--sysroot=/ -L/usr/lib/aarch64-linux-gnu" PKG_CONFIG_LIBDIR=/usr/lib/aarch64-linux-gnu/pkgconfig go build -buildvcs=false -trimpath -ldflags "-s -w -X gitea.mixdep.ru/mix/gosentry/src/app.Version=${VERSION}" -o "dist/linux/gosentry-${VERSION}-linux-arm64" ./cmd/gosentry'
|
||||||
}
|
}
|
||||||
|
|
||||||
build_windows_amd64() {
|
build_windows_amd64() {
|
||||||
run_in_builder 'mkdir -p dist/windows && x86_64-w64-mingw32-windres -O coff -o cmd/gosentry/rsrc_windows_amd64.syso packaging/windows/gosentry.rc && CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -buildvcs=false -trimpath -ldflags "-s -w -H=windowsgui -X gitea.mixdep.ru/mix/gosentry/src/core.Version=${VERSION}" -o "dist/windows/gosentry-${VERSION}-windows-amd64.exe" ./cmd/gosentry'
|
run_in_builder 'mkdir -p dist/windows && x86_64-w64-mingw32-windres -O coff -o cmd/gosentry/rsrc_windows_amd64.syso packaging/windows/gosentry.rc && CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -buildvcs=false -trimpath -ldflags "-s -w -H=windowsgui -X gitea.mixdep.ru/mix/gosentry/src/app.Version=${VERSION}" -o "dist/windows/gosentry-${VERSION}-windows-amd64.exe" ./cmd/gosentry'
|
||||||
}
|
}
|
||||||
|
|
||||||
mapfile -t targets < <(choose_targets "$@" | normalize_targets | awk '!seen[$0]++')
|
mapfile -t targets < <(choose_targets "$@" | normalize_targets | awk '!seen[$0]++')
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ REM directory. Move to the repository root (the parent of scripts\) before using
|
|||||||
REM relative paths such as .\cmd\gosentry and packaging\windows\gosentry.rc.
|
REM relative paths such as .\cmd\gosentry and packaging\windows\gosentry.rc.
|
||||||
cd /d "%~dp0\.."
|
cd /d "%~dp0\.."
|
||||||
|
|
||||||
for /f "tokens=4" %%V in ('findstr /C:"var Version" src\core\version.go') do set "VERSION=%%~V"
|
for /f "tokens=4" %%V in ('findstr /C:"var Version" src\app\version.go') do set "VERSION=%%~V"
|
||||||
if "%VERSION%"=="" set "VERSION=0.0.0-dev"
|
if "%VERSION%"=="" set "VERSION=0.0.0-dev"
|
||||||
set "VERSION=%VERSION:"=%"
|
set "VERSION=%VERSION:"=%"
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ if %ERRORLEVEL%==0 (
|
|||||||
REM -trimpath removes local machine paths from the binary, -s -w reduce binary
|
REM -trimpath removes local machine paths from the binary, -s -w reduce binary
|
||||||
REM size, and -H=windowsgui prevents a separate console window from opening when
|
REM size, and -H=windowsgui prevents a separate console window from opening when
|
||||||
REM the GUI app starts from Explorer or a shortcut.
|
REM the GUI app starts from Explorer or a shortcut.
|
||||||
"%GOEXE%" build -trimpath -ldflags "-s -w -H=windowsgui -X gitea.mixdep.ru/mix/gosentry/src/core.Version=%VERSION%" -o "%OUTPUT%" .\cmd\gosentry
|
"%GOEXE%" build -trimpath -ldflags "-s -w -H=windowsgui -X gitea.mixdep.ru/mix/gosentry/src/app.Version=%VERSION%" -o "%OUTPUT%" .\cmd\gosentry
|
||||||
if errorlevel 1 exit /b 1
|
if errorlevel 1 exit /b 1
|
||||||
|
|
||||||
REM Icons are embedded into the executable, so no assets directory is copied next
|
REM Icons are embedded into the executable, so no assets directory is copied next
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package core
|
package app
|
||||||
|
|
||||||
// Version is the application version shown in the GUI and used by build
|
// Version is the application version shown in the GUI and used by build
|
||||||
// scripts in artifact names. It is a var rather than a const so release builds
|
// scripts in artifact names. It is a var rather than a const so release builds
|
||||||
@@ -1 +0,0 @@
|
|||||||
package core
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
package core
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
package core
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
package core
|
|
||||||
+7
-7
@@ -13,7 +13,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.mixdep.ru/mix/gosentry/assets"
|
"gitea.mixdep.ru/mix/gosentry/assets"
|
||||||
"gitea.mixdep.ru/mix/gosentry/src/core"
|
"gitea.mixdep.ru/mix/gosentry/src/app"
|
||||||
"gitea.mixdep.ru/mix/gosentry/src/domain"
|
"gitea.mixdep.ru/mix/gosentry/src/domain"
|
||||||
"gitea.mixdep.ru/mix/gosentry/src/platform/autostart"
|
"gitea.mixdep.ru/mix/gosentry/src/platform/autostart"
|
||||||
"gitea.mixdep.ru/mix/gosentry/src/platform/desktop"
|
"gitea.mixdep.ru/mix/gosentry/src/platform/desktop"
|
||||||
@@ -22,10 +22,10 @@ import (
|
|||||||
"gitea.mixdep.ru/mix/gosentry/src/storage"
|
"gitea.mixdep.ru/mix/gosentry/src/storage"
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/app"
|
fyneapp "fyne.io/fyne/v2/app"
|
||||||
"fyne.io/fyne/v2/container"
|
"fyne.io/fyne/v2/container"
|
||||||
"fyne.io/fyne/v2/dialog"
|
"fyne.io/fyne/v2/dialog"
|
||||||
"fyne.io/fyne/v2/driver/desktop"
|
fynedesktop "fyne.io/fyne/v2/driver/desktop"
|
||||||
"fyne.io/fyne/v2/layout"
|
"fyne.io/fyne/v2/layout"
|
||||||
"fyne.io/fyne/v2/theme"
|
"fyne.io/fyne/v2/theme"
|
||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
@@ -60,10 +60,10 @@ func Run(startInTray bool) {
|
|||||||
|
|
||||||
// A stable app ID lets Fyne persist desktop preferences consistently across
|
// A stable app ID lets Fyne persist desktop preferences consistently across
|
||||||
// launches and gives tray/window integration a predictable identity.
|
// launches and gives tray/window integration a predictable identity.
|
||||||
a := app.NewWithID(appID)
|
a := fyneapp.NewWithID(appID)
|
||||||
a.SetIcon(loadAppIcon())
|
a.SetIcon(loadAppIcon())
|
||||||
|
|
||||||
w := a.NewWindow("GoSentry " + core.Version)
|
w := a.NewWindow("GoSentry " + app.Version)
|
||||||
configureSystemTray(a, w)
|
configureSystemTray(a, w)
|
||||||
w.Resize(fyne.NewSize(1120, 720))
|
w.Resize(fyne.NewSize(1120, 720))
|
||||||
content, recordStartup := newMainView(w)
|
content, recordStartup := newMainView(w)
|
||||||
@@ -91,7 +91,7 @@ func loadAppIcon() fyne.Resource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func configureSystemTray(a fyne.App, w fyne.Window) {
|
func configureSystemTray(a fyne.App, w fyne.Window) {
|
||||||
desk, ok := a.(desktop.App)
|
desk, ok := a.(fynedesktop.App)
|
||||||
if !ok {
|
if !ok {
|
||||||
// Not every Fyne driver exposes desktop tray features. Returning silently
|
// Not every Fyne driver exposes desktop tray features. Returning silently
|
||||||
// keeps the same binary usable on platforms or sessions without a tray.
|
// keeps the same binary usable on platforms or sessions without a tray.
|
||||||
@@ -1015,7 +1015,7 @@ func settingsView(w fyne.Window, store *storage.Store, jobs *[]job) fyne.CanvasO
|
|||||||
settingsStatus,
|
settingsStatus,
|
||||||
widget.NewSeparator(),
|
widget.NewSeparator(),
|
||||||
widget.NewLabelWithStyle("About", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
widget.NewLabelWithStyle("About", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
||||||
settingsRow("GoSentry", widget.NewLabel(core.Version)),
|
settingsRow("GoSentry", widget.NewLabel(app.Version)),
|
||||||
settingsRow("Go", widget.NewLabel(runtime.Version())),
|
settingsRow("Go", widget.NewLabel(runtime.Version())),
|
||||||
settingsRow("Fyne", widget.NewLabel(fyneVersion())),
|
settingsRow("Fyne", widget.NewLabel(fyneVersion())),
|
||||||
settingsRow("Repository", widget.NewHyperlink(projectRepositoryURL, mustParseURL(projectRepositoryURL))),
|
settingsRow("Repository", widget.NewHyperlink(projectRepositoryURL, mustParseURL(projectRepositoryURL))),
|
||||||
|
|||||||
Reference in New Issue
Block a user