@@ -64,6 +64,9 @@ if /I "%ARG%"=="32" set BUILD_ARCH=x86& goto :argloop
6464if /I " %ARG% " == " x86" set BUILD_ARCH = x86& goto :argloop
6565if /I " %ARG% " == " ARM64" set BUILD_ARCH = ARM64& goto :argloop
6666
67+ rem Enable ANSI palette support
68+ call :prepare_palette
69+
6770rem Assume that this is target OS version and split off the tag
6871call :split_target_tag " %ARG% "
6972
@@ -176,6 +179,7 @@ set TARGET_VS_CONFIG="%TARGET_PROJ_CONFIG% %BUILD_FLAVOR%|%BUILD_ARCH%"
176179
177180rem We set up the Build Environment and get started...
178181echo .
182+ call :clr_print %_c_Cyn% " Building : %BUILD_FILE% "
179183pushd %BUILD_DIR%
180184call " %~dp0 SetVsEnv.bat" %TARGET_PROJ_CONFIG%
181185
@@ -192,53 +196,59 @@ if /I "!TAG!"=="SDV" (
192196 rem SDV is deprecated from Windows 11 24H2, both in the EWDK and WHCP. Making some allowances...
193197 rem We only do SDV for Win10 targets.
194198 if " %TARGET% " == " Win10" (
195- echo Running SDV for %BUILD_FILE% , configuration %TARGET_VS_CONFIG%
199+ call :clr_print %_c_Cyn% " Running Static Driver Verifier build for %BUILD_FILE% ."
200+ echo Configuration ^ : %TARGET_VS_CONFIG%
196201 call :run_sdv " %TARGET_PROJ_CONFIG% %BUILD_FLAVOR% " %BUILD_ARCH%
197202 if " %BUILD_FAILED% " EQU " 1" (
198- echo Static Driver Verifier BUILD FAILED - Resolve problem and try again.
203+ call : clr_print %_c_Red% " Static Driver Verifier BUILD FAILED - Resolve problem and try again."
199204 goto :build_arch_done
200205 )
201- echo Static Driver Verifier build for %BUILD_FILE% succeeded.
206+ call : clr_print %_c_Grn% " Static Driver Verifier build for %BUILD_FILE% succeeded."
202207 ) else (
203- echo Skipping SDV for %BUILD_FILE% , configuration %TARGET_VS_CONFIG% . SDV is for WHCP_LEGACY targets ONLY.
208+ call :clr_print %_c_Yel% " Skipping Static Driver Verifier for %BUILD_FILE% . SDV if for WHCP_LEGACY targets ONLY."
209+ echo Configuration ^ : %TARGET_VS_CONFIG%
204210 echo .
205211 )
206212 if exist " %CODEQL_BIN% " (
207- echo Running CodeQL for %BUILD_FILE% , configuration %TARGET_VS_CONFIG%
213+ call :clr_print %_c_Cyn% " CodeQL : Performing CodeQL build for %BUILD_FILE% ."
214+ echo CodeQL ^ : Configuration ^ = %TARGET_VS_CONFIG%
208215 call :run_ql " %TARGET_PROJ_CONFIG% %BUILD_FLAVOR% " %BUILD_ARCH%
209216 if " !CODEQL_FAILED! " EQU " 1" (
210217 set BUILD_FAILED = 1
211- echo CodeQL - BUILD FAILED - Resolve problem and try again.
218+ call : clr_print %_c_Red% " CodeQL : BUILD FAILED" %_c_Wht% " - Resolve problem and try again."
212219 goto :build_arch_done
213220 )
214- echo CodeQL build for %BUILD_FILE% succeeded.
221+ call : clr_print %_c_Grn% " CodeQL build for %BUILD_FILE% succeeded."
215222 ) else (
216- echo CodeQL binary is missing!
223+ call : clr_print %_c_Yel% " CodeQL binary is missing!"
217224 @ echo .
218225 )
219226 call :run_ca " %TARGET_PROJ_CONFIG% %BUILD_FLAVOR% " %BUILD_ARCH%
220227 if " !BUILD_FAILED! " EQU " 1" (
221- echo Code Analysis BUILD FAILED.
228+ call : clr_print %_c_Red% " Code Analysis BUILD FAILED."
222229 goto :build_arch_done
223230 )
224- echo Code Analysis build for %BUILD_FILE% succeeded.
231+ call : clr_print %_c_Grn% " Code Analysis build for %BUILD_FILE% succeeded."
225232 echo .
226233 call :run_dvl " %TARGET_PROJ_CONFIG% %BUILD_FLAVOR% " %BUILD_ARCH%
227234 if " !BUILD_FAILED! " EQU " 1" (
228- echo Driver Verifier Log BUILD FAILED.
235+ call : clr_print %_c_Red% " Driver Verifier Log BUILD FAILED."
229236 goto :build_arch_done
230237 )
231- echo Driver Verifier Log build for %BUILD_FILE% succeeded.
238+ call : clr_print %_c_Grn% " Driver Verifier Log build for %BUILD_FILE% succeeded."
232239 echo .
233240) else (
234241 rem Do a build without analysis.
235- echo Building %BUILD_FILE% , configuration %TARGET_VS_CONFIG% , command %BUILD_COMMAND%
242+ call :clr_print %_c_Cyn% " Performing No-Analysis build for %BUILD_FILE% ."
243+ @ echo Configuration ^ = %TARGET_VS_CONFIG%
244+ @ echo Command ^ = %BUILD_COMMAND%
245+ @ echo .
236246 call :run_build " %TARGET_PROJ_CONFIG% %BUILD_FLAVOR% " %BUILD_ARCH%
237247 if " !BUILD_FAILED! " EQU " 1" (
238- echo NO-ANALYSIS BUILD FAILED.
248+ call : clr_print %_c_Red% " NO-ANALYSIS BUILD FAILED."
239249 goto :build_arch_done
240250 )
241- echo No-Analysis build for %BUILD_FILE% succeeded.
251+ call : clr_print %_c_Grn% " No-Analysis build for %BUILD_FILE% succeeded."
242252 echo .
243253)
244254:build_arch_done
@@ -266,29 +276,29 @@ goto :eof
266276
267277:run_sdv
268278if exist sdv (
269- echo " Removing previously created SDV artifacts"
279+ call : clr_print %_c_Cyn% " Removing previously created SDV artifacts... "
270280 rmdir /s /q sdv
271281 echo .
272282)
273283
274284if " !SDV_FAILED! " NEQ " 1" (
275- echo Build - Cleaning for %BUILD_FILE% ...
285+ call : clr_print %_c_Cyn% " Build: Cleaning for %BUILD_FILE% ..."
276286 msbuild.exe -maxCpuCount %~dp1 %BUILD_FILE% /t:clean /p:Configuration=" %~1 " /P:Platform=%2
277287 if ERRORLEVEL 1 (
278288 set SDV_FAILED = 1
279289 )
280290 echo .
281291)
282292if " !SDV_FAILED! " NEQ " 1" (
283- echo Build - Cleaning SDV for %BUILD_FILE% ...
293+ call : clr_print %_c_Cyn% " Build: Cleaning SDV for %BUILD_FILE% ..."
284294 msbuild.exe -maxCpuCount %~dp1 %BUILD_FILE% /t:sdv /p:inputs=" /clean" /p:Configuration=" %~1 " /P:platform=%2
285295 if ERRORLEVEL 1 (
286296 set SDV_FAILED = 1
287297 )
288298 echo .
289299)
290300if " !SDV_FAILED! " NEQ " 1" (
291- echo Build - Performing SDV checks for %BUILD_FILE% ...
301+ call : clr_print %_c_Cyn% " Build: Performing SDV checks for %BUILD_FILE% ..."
292302 msbuild.exe -maxCpuCount %~dp1 %BUILD_FILE% /t:sdv /p:inputs=" /check /devenv" /p:Configuration=" %~1 " /P:platform=%2
293303 if ERRORLEVEL 1 (
294304 set SDV_FAILED = 1
@@ -303,7 +313,7 @@ goto :eof
303313:run_ql
304314
305315if exist %~dp1 codeql_db (
306- echo CodeQL ^ : Removing previously created rules database...
316+ call : clr_print %_c_Cyn% " CodeQL : Removing previously created rules database..."
307317 rmdir /s /q %~dp1 codeql_db
308318)
309319
@@ -326,15 +336,15 @@ IF "%CODEQL_FAILED%" NEQ "1" (
326336goto :eof
327337
328338:run_ca
329- echo Performing Code Analysis build of %BUILD_FILE% .
339+ call : clr_print %_c_Cyn% " Performing Code Analysis build of %BUILD_FILE% ."
330340msbuild.exe -maxCpuCount %~dp1 %BUILD_FILE% /p:Configuration=" %~1 " /P:Platform=%2 /P:RunCodeAnalysisOnce=True -fileLoggerParameters:LogFile=%~dp1 %BUILD_NAME% .CodeAnalysis.log
331341if ERRORLEVEL 1 (
332342 set BUILD_FAILED = 1
333343)
334344goto :eof
335345
336346:run_dvl
337- echo Performing Driver Verfier Log build of %BUILD_FILE% .
347+ call : clr_print %_c_Cyn% " Performing Driver Verfier Log build of %BUILD_FILE% ."
338348msbuild.exe -maxCpuCount %~dp1 %BUILD_FILE% /t:dvl /p:Configuration=" %~1 " /P:platform=%2
339349IF ERRORLEVEL 1 (
340350 set BUILD_FAILED = 1
@@ -353,5 +363,21 @@ for /f "tokens=1,2 delims=_" %%i in (%BUILD_INFO%) do @(
353363)
354364goto :eof
355365
366+ :clr_print
367+ @ echo %z_esc% [%~1%~2 %z_esc% [%~3%~4 %z_esc% [%~5%~6 %z_esc% [%~7%~8 %z_esc% [0m
368+ goto :eof
369+
370+ :prepare_palette
371+ rem Colour mods should work from WIN10_TH2
372+ rem Get the ANSI ESC character [0x27]
373+ for /f " tokens=2 usebackq delims=#" %%i in (`" prompt #$H#$E# & echo on & for %%i in (1) do rem" `) do @ set z_esc = %%i
374+ rem Prepare pallette
375+ set " _c_Red = " 40;91m" "
376+ set " _c_Grn = " 40;92m" "
377+ set " _c_Yel = " 40;93m" "
378+ set " _c_Cyn = " 40;96m" "
379+ set " _c_Wht = " 40;37m" "
380+ goto :eof
381+
356382:fail
357383exit /B 1
0 commit comments