Files
hcie-rust-v3.05/scripts/cargo-with-build-id.bat
Your Name 8447b2d796
mandatory-regression-gate / deterministic-tests (push) Has been cancelled
mandatory-regression-gate / protected-performance-path (push) Has been cancelled
Refactor code structure for improved readability and maintainability
2026-07-23 15:34:05 +03:00

55 lines
1.3 KiB
Batchfile

@echo off
REM Runs one Cargo command with one synchronized HCIE build-number increment (Windows)
REM Usage: scripts\cargo-with-build-id.bat <cargo-subcommand> [arguments...]
setlocal enabledelayedexpansion
set ROOT_DIR=%~dp0..\
set LOCK_DIR=%ROOT_DIR%.build-id.lock
set COUNTER_FILE=%ROOT_DIR%build.id
if "%~1"=="" (
echo usage: scripts\cargo-with-build-id.bat ^<cargo-subcommand^> [arguments...]
exit /b 2
)
REM Acquire lock (Windows-friendly using a temp file)
:acquire_lock
2>nul (
>>"%LOCK_DIR%\lock.tmp" echo(%DATE% %TIME%
) || (
REM Lock exists; wait and retry
timeout /t 1 /nobreak >nul
goto :acquire_lock
)
del "%LOCK_DIR%\lock.tmp" 2>nul
REM Read current build ID
if exist "%COUNTER_FILE%" (
set /p current=<"%COUNTER_FILE%"
) else (
set current=0
)
REM Validate it's a number
echo %current%| findstr /r "^[0-9][0-9]*$" >nul
if errorlevel 1 (
echo build.id must contain one unsigned integer, found: %current%
exit /b 1
)
set /a next=current+1
REM Write counter files
echo %next%>"%COUNTER_FILE%"
echo %next%>"%ROOT_DIR%hcie-egui-app\build.id"
echo %next%>"%ROOT_DIR%hcie-egui-app\crates\hcie-gui-egui\build.id"
set HCIE_BUILD_ID_OVERRIDE=%next%
echo HCIE build %next%: cargo %*
cd /d "%ROOT_DIR%"
cargo %*
exit /b %ERRORLEVEL%