chore: add informative messages to Windows build script
Add echo statements at key build steps to indicate progress: - Build start and version info - Output path - Environment setup - Icon resource embedding (or warning if windres not found) - Go compilation - Success completion message Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,21 +6,28 @@ 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\.."
|
||||||
|
|
||||||
|
echo [GoSentry Windows Build]
|
||||||
|
echo.
|
||||||
|
|
||||||
for /f "tokens=4" %%V in ('findstr /C:"var Version" src\app\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:"=%"
|
||||||
|
echo Version: %VERSION%
|
||||||
|
|
||||||
REM Optional first argument allows CI or a developer to choose another output
|
REM Optional first argument allows CI or a developer to choose another output
|
||||||
REM path. The default keeps all generated binaries under dist\ so the source tree
|
REM path. The default keeps all generated binaries under dist\ so the source tree
|
||||||
REM stays clean and the old bin\ folder is no longer needed.
|
REM stays clean and the old bin\ folder is no longer needed.
|
||||||
set "OUTPUT=%~1"
|
set "OUTPUT=%~1"
|
||||||
if "%OUTPUT%"=="" set "OUTPUT=dist\windows\gosentry-%VERSION%-windows-amd64.exe"
|
if "%OUTPUT%"=="" set "OUTPUT=dist\windows\gosentry-%VERSION%-windows-amd64.exe"
|
||||||
|
echo Output: %OUTPUT%
|
||||||
|
echo.
|
||||||
|
|
||||||
REM Prefer the standard Go installer path on Windows, but fall back to PATH for
|
REM Prefer the standard Go installer path on Windows, but fall back to PATH for
|
||||||
REM machines where Go was installed by another package manager.
|
REM machines where Go was installed by another package manager.
|
||||||
set "GOEXE=%ProgramFiles%\Go\bin\go.exe"
|
set "GOEXE=%ProgramFiles%\Go\bin\go.exe"
|
||||||
if not exist "%GOEXE%" set "GOEXE=go"
|
if not exist "%GOEXE%" set "GOEXE=go"
|
||||||
|
|
||||||
|
echo Setting up build environment...
|
||||||
REM Fyne uses native libraries through CGO. MSYS2 UCRT64 provides the GCC toolchain
|
REM Fyne uses native libraries through CGO. MSYS2 UCRT64 provides the GCC toolchain
|
||||||
REM expected by the Windows build; prepending it keeps the script self-contained
|
REM expected by the Windows build; prepending it keeps the script self-contained
|
||||||
REM without permanently changing the user's system PATH.
|
REM without permanently changing the user's system PATH.
|
||||||
@@ -41,15 +48,23 @@ REM shortcuts, and the taskbar can show the GoSentry icon. The Go embed package
|
|||||||
REM handles Fyne's runtime icon, but Explorer reads this Windows resource instead.
|
REM handles Fyne's runtime icon, but Explorer reads this Windows resource instead.
|
||||||
where windres.exe >nul 2>nul
|
where windres.exe >nul 2>nul
|
||||||
if %ERRORLEVEL%==0 (
|
if %ERRORLEVEL%==0 (
|
||||||
|
echo Embedding Windows icon resource...
|
||||||
windres.exe -O coff -o cmd\gosentry\rsrc_windows_amd64.syso packaging\windows\gosentry.rc
|
windres.exe -O coff -o cmd\gosentry\rsrc_windows_amd64.syso packaging\windows\gosentry.rc
|
||||||
|
) else (
|
||||||
|
echo Warning: windres not found; Windows icon resource will not be embedded.
|
||||||
)
|
)
|
||||||
|
|
||||||
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.
|
||||||
|
echo Compiling Go binary...
|
||||||
"%GOEXE%" build -trimpath -ldflags "-s -w -H=windowsgui -X gitea.mixdep.ru/mix/gosentry/src/app.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 (
|
||||||
|
echo Build failed with error code %ERRORLEVEL%
|
||||||
|
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
|
||||||
REM to the binary. Runtime YAML and log files are created by the app itself.
|
REM to the binary. Runtime YAML and log files are created by the app itself.
|
||||||
echo Built %OUTPUT%
|
echo.
|
||||||
|
echo Successfully built: %OUTPUT%
|
||||||
|
|||||||
Reference in New Issue
Block a user