Files
navi/build.bat
T
M4andCursor 43882b95ad Release 2.7.2.4: macOS app icon, glaze UI and auto build numbers.
Add green N AppIcon to the .app bundle, keep WKWebView GUI stable, and stamp builds via BaseVersion/BuildNumber.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 17:57:18 +03:00

47 lines
2.1 KiB
Batchfile

@echo off
setlocal EnableDelayedExpansion
cd /d "%~dp0"
REM --- bump build number ---
for /f "usebackq delims=" %%i in (`python -c "from pathlib import Path; import re; t=Path('internal/update/version.go').read_text(); print(re.search(r'BaseVersion\\s*=\\s*\"([^\"]+)\"', t).group(1))"`) do set BASE_VERSION=%%i
if not exist buildnum.txt echo 0>buildnum.txt
set /p BUILD_NUM=<buildnum.txt
set /a BUILD_NUM+=1
echo %BUILD_NUM%>buildnum.txt
set FULL_VERSION=%BASE_VERSION%.%BUILD_NUM%
echo Building Windows Navis %FULL_VERSION% ...
python -c "from pathlib import Path; import re; p=Path('internal/update/version.go'); t=p.read_text(); p.write_text(re.sub(r'(var BuildNumber = \")[^\"]*(\")', r'\g<1>%BUILD_NUM%\2', t))"
python -c "import json; from pathlib import Path; maj,mi,pa=map(int,'%BASE_VERSION%'.split('.')[:3]); b=int('%BUILD_NUM%'); p=Path('versioninfo.json'); d=json.loads(p.read_text()); d['FixedFileInfo']['FileVersion']={'Major':maj,'Minor':mi,'Patch':pa,'Build':b}; d['FixedFileInfo']['ProductVersion']=d['FixedFileInfo']['FileVersion']; d['StringFileInfo']['FileVersion']=f'{maj}.{mi}.{pa}.{b}'; d['StringFileInfo']['ProductVersion']=d['StringFileInfo']['FileVersion']; p.write_text(json.dumps(d,indent=2)+chr(10))"
echo Generating Windows icon resources...
go run ./tools/mkico
if errorlevel 1 exit /b 1
where goversioninfo >nul 2>&1
if errorlevel 1 (
go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest
)
goversioninfo -64 -icon assets\navis.ico -manifest assets\app.manifest -o cmd\vpnapp\resource.syso versioninfo.json
if errorlevel 1 exit /b 1
set LDFLAGS=-H windowsgui -s -w -X vpnclient/internal/update.BuildNumber=%BUILD_NUM%
echo Building Navis GUI and CLI...
go build -ldflags="%LDFLAGS%" -trimpath -o Navis.exe ./cmd/vpnapp
if errorlevel 1 exit /b 1
go build -ldflags="-s -w -X vpnclient/internal/update.BuildNumber=%BUILD_NUM%" -trimpath -o vpnclient.exe ./cmd/vpnclient
if errorlevel 1 exit /b 1
echo %FULL_VERSION%> Navis.version
echo.
echo Done: Navis %FULL_VERSION%
echo Navis.exe
echo vpnclient.exe
echo Navis.version
echo assets\navis.ico
endlocal