@echo off
setlocal

set "LOG_FILE=%TEMP%\do_it-cargo-build.log"
set "WARN_COUNT=0"

cargo build > "%LOG_FILE%" 2>&1
set "BUILD_EXIT=%ERRORLEVEL%"

for /f %%C in ('type "%LOG_FILE%" ^| findstr /C:"warning:" ^| find /C /V ""') do set "WARN_COUNT=%%C"

echo Warnings: %WARN_COUNT%

if exist "%LOG_FILE%" del "%LOG_FILE%"

exit /b %BUILD_EXIT%
