Skip to content

[CI-NO-BUILD] [build] Drop to 21H2 [22000] EWDK level to build Win10_SDV #1286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions build/adhoc_21h2_bootstrap.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
rem set VSCMD_DEBUG=1
set EXTERNAL_INCLUDE=
set VS170COMNTOOLS=
set WDKBuildBinRoot=
set WDKToolRoot=
set WindowsSdkBinPath=
set WindowsTargetPlatformVersion=
set __VSCMD_PREINIT_VCToolsVersion=
set DevEnvDir=%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\
set INCLUDE=%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\ATLMFC\include;%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include;%EWDK11_DIR%\Program Files\Windows Kits\10\include\shared;%EWDK11_DIR%\Program Files\Windows Kits\10\include\um;%EWDK11_DIR%\Program Files\Windows Kits\10\include\winrt;%EWDK11_DIR%\Program Files\Windows Kits\10\include\cppwinrt
set LIB=%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\ATLMFC\lib\x86;%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\lib\x86;%EWDK11_DIR%\Program Files\Windows Kits\10\lib\um\x86
set LIBPATH=%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\ATLMFC\lib\x86;%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\lib\x86;%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\lib\x86\store\references;;C:\Windows\Microsoft.NET\Framework\v4.0.30319
set Path=%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86;%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\VC\VCPackages;%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow;%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\bin\Roslyn;%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\devinit;x86;%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework\v4.0.30319;%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\;%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\Stripe\AppData\Local\Microsoft\WindowsApps;%EWDK11_DIR%\Program Files\Windows Kits\10\\bin\10.0.22000.0\x86;%EWDK11_DIR%\Program Files\Windows Kits\10\\Tools\bin\i386;%EWDK11_DIR%\Program Files\Windows Kits\10\\tools;%EWDK11_DIR%\Program Files\Windows Kits\10\\tools\x86;%EWDK11_DIR%\BuildEnv
set VCIDEInstallDir=%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\VC\
set VCINSTALLDIR=%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\
set VCToolsInstallDir=%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\
set VCToolsRedistDir=%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Redist\MSVC\14.29.30133\
set VCToolsVersion=14.29.30133
set VSINSTALLDIR=%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\
set __devinit_path=%EWDK11_DIR%\Program Files\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\devinit\devinit.exe
123 changes: 100 additions & 23 deletions build/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ set BUILD_ARCH=
set BUILD_INFO=
set BUILD_FAILED=

rem We have version 24H2 epoch buildtime conditions
rem VSCMD_VER version splits:
set VSCMD_VER_MAJOR=
set VSCMD_VER_MINOR=
set VSCMD_VER_BUILD=
rem VSCMD_VER version specific buildtime vars
set VSCMD_WHCP_LEVEL=

rem Analysis Build specific variables
set CODEQL_FAILED=
set SDV_FAILED=
Expand All @@ -64,6 +72,9 @@ if /I "%ARG%"=="32" set BUILD_ARCH=x86& goto :argloop
if /I "%ARG%"=="x86" set BUILD_ARCH=x86& goto :argloop
if /I "%ARG%"=="ARM64" set BUILD_ARCH=ARM64& goto :argloop

rem Enable ANSI palette support
call :prepare_palette

rem Assume that this is target OS version and split off the tag
call :split_target_tag "%ARG%"

Expand Down Expand Up @@ -176,9 +187,33 @@ set TARGET_VS_CONFIG="%TARGET_PROJ_CONFIG% %BUILD_FLAVOR%|%BUILD_ARCH%"

rem We set up the Build Environment and get started...
echo.
call :clr_print %_c_Cyn% "Building : %BUILD_FILE%..."
echo.
pushd %BUILD_DIR%
call "%~dp0SetVsEnv.bat" %TARGET_PROJ_CONFIG%

rem Split MSBuild version... and check if we are Windows 11, 21H2 [22000] EWDK or Windows 11, 24H2 [26100] EWDK...
for /f "tokens=1,2,3 usebackq delims=." %%i in (`echo %%VSCMD_VER%%`) do @(
set VSCMD_VER_MAJOR=%%i
set VSCMD_VER_MINOR=%%j
set VSCMD_VER_BUILD=%%k
)
rem MSBuild v17.8 and above are at least Windows 11, 24H2 [26100] EWDK, so WHCP_24H2, everything below v17.8 is WHCP_LEGACY
if %VSCMD_VER_MAJOR% GTR 16 (
if %VSCMD_VER_MAJOR% EQU 17 (
if not %VSCMD_VER_MINOR% LSS 8 (
set VSCMD_WHCP_LEVEL=WHCP_24H2
) else (
set VSCMD_WHCP_LEVEL=WHCP_LEGACY
)
)
if %VSCMD_VER_MAJOR% GTR 17 (
set VSCMD_WHCP_LEVEL=WHCP_24H2
)
) else (
set VSCMD_WHCP_LEVEL=WHCP_LEGACY
)

rem Check for any prerequisite x86 libraries and build them if needed...
call "%~dp0prebuild_x86_libs.bat" %BUILD_FILE% %BUILD_ARCH% "%BUILD_DIR%" %TARGET% %BUILD_FLAVOUR%
IF ERRORLEVEL 1 (
Expand All @@ -191,54 +226,80 @@ if /I "!TAG!"=="SDV" (
echo.
rem SDV is deprecated from Windows 11 24H2, both in the EWDK and WHCP. Making some allowances...
rem We only do SDV for Win10 targets.
if "%TARGET%"=="Win10" (
echo Running SDV for %BUILD_FILE%, configuration %TARGET_VS_CONFIG%
if "%TARGET%"=="Win10" (
rem Permit the Build Environment to be reconfigured if we have been called from Windows 11, 24H2 [26100] EWDK and above
if not "%VSCMD_WHCP_LEVEL%"=="WHCP_LEGACY" (
call :clr_print %_c_Cyn% "Reconfiguring Build Environment to use Windows 11, 21H2 [22000] EWDK Build Tools for a working Static Driver Verifier..."
echo.
setlocal
if not "%EWDK11_DIR%"=="" (
call "%~dp0adhoc_21h2_bootstrap.bat"
call %EWDK11_DIR%\BuildEnv\SetupBuildEnv.cmd
call "%~dp0SetVsEnv.bat" %TARGET_PROJ_CONFIG%
echo.
) else (
call :clr_print %_c_Yel% "The EWDK11_DIR environment variable is not set. Set this variable and try again."
set BUILD_FAILED=1
goto :build_arch_done
)
)
call :clr_print %_c_Cyn% "Running Static Driver Verifier build for %BUILD_FILE%."
echo Configuration ^: %TARGET_VS_CONFIG%
call :run_sdv "%TARGET_PROJ_CONFIG% %BUILD_FLAVOR%" %BUILD_ARCH%
if "%BUILD_FAILED%" EQU "1" (
echo Static Driver Verifier BUILD FAILED - Resolve problem and try again.
call :clr_print %_c_Red% "Static Driver Verifier BUILD FAILED - Resolve problem and try again."
goto :build_arch_done
)
echo Static Driver Verifier build for %BUILD_FILE% succeeded.
call :clr_print %_c_Grn% "Static Driver Verifier build for %BUILD_FILE% succeeded."
if not "%VSCMD_WHCP_LEVEL%"=="WHCP_LEGACY" (
rem Return to calling EWDK...
endlocal
)
) else (
echo Skipping SDV for %BUILD_FILE%, configuration %TARGET_VS_CONFIG%. SDV is for WHCP_LEGACY targets ONLY.
call :clr_print %_c_Yel% "Skipping Static Driver Verifier for %BUILD_FILE%. SDV if for WHCP_LEGACY targets ONLY."
echo Configuration ^: %TARGET_VS_CONFIG%
echo.
)
if exist "%CODEQL_BIN%" (
echo Running CodeQL for %BUILD_FILE%, configuration %TARGET_VS_CONFIG%
call :clr_print %_c_Cyn% "CodeQL : Performing CodeQL build for %BUILD_FILE%."
echo CodeQL ^: Configuration ^= %TARGET_VS_CONFIG%
call :run_ql "%TARGET_PROJ_CONFIG% %BUILD_FLAVOR%" %BUILD_ARCH%
if "!CODEQL_FAILED!" EQU "1" (
set BUILD_FAILED=1
echo CodeQL - BUILD FAILED - Resolve problem and try again.
call :clr_print %_c_Red% "CodeQL : BUILD FAILED" %_c_Wht% " - Resolve problem and try again."
goto :build_arch_done
)
echo CodeQL build for %BUILD_FILE% succeeded.
call :clr_print %_c_Grn% "CodeQL build for %BUILD_FILE% succeeded."
) else (
echo CodeQL binary is missing!
call :clr_print %_c_Yel% "CodeQL binary is missing!"
@echo.
)
call :run_ca "%TARGET_PROJ_CONFIG% %BUILD_FLAVOR%" %BUILD_ARCH%
if "!BUILD_FAILED!" EQU "1" (
echo Code Analysis BUILD FAILED.
call :clr_print %_c_Red% "Code Analysis BUILD FAILED."
goto :build_arch_done
)
echo Code Analysis build for %BUILD_FILE% succeeded.
call :clr_print %_c_Grn% "Code Analysis build for %BUILD_FILE% succeeded."
echo.
call :run_dvl "%TARGET_PROJ_CONFIG% %BUILD_FLAVOR%" %BUILD_ARCH%
if "!BUILD_FAILED!" EQU "1" (
echo Driver Verifier Log BUILD FAILED.
call :clr_print %_c_Red% "Driver Verifier Log BUILD FAILED."
goto :build_arch_done
)
echo Driver Verifier Log build for %BUILD_FILE% succeeded.
call :clr_print %_c_Grn% "Driver Verifier Log build for %BUILD_FILE% succeeded."
echo.
) else (
rem Do a build without analysis.
echo Building %BUILD_FILE%, configuration %TARGET_VS_CONFIG%, command %BUILD_COMMAND%
call :clr_print %_c_Cyn% "Performing No-Analysis build for %BUILD_FILE%."
@echo Configuration ^= %TARGET_VS_CONFIG%
@echo Command ^= %BUILD_COMMAND%
@echo.
call :run_build "%TARGET_PROJ_CONFIG% %BUILD_FLAVOR%" %BUILD_ARCH%
if "!BUILD_FAILED!" EQU "1" (
echo NO-ANALYSIS BUILD FAILED.
call :clr_print %_c_Red% "NO-ANALYSIS BUILD FAILED."
goto :build_arch_done
)
echo No-Analysis build for %BUILD_FILE% succeeded.
call :clr_print %_c_Grn% "No-Analysis build for %BUILD_FILE% succeeded."
echo.
)
:build_arch_done
Expand Down Expand Up @@ -266,29 +327,29 @@ goto :eof

:run_sdv
if exist sdv (
echo "Removing previously created SDV artifacts"
call :clr_print %_c_Cyn% "Removing previously created SDV artifacts..."
rmdir /s /q sdv
echo.
)

if "!SDV_FAILED!" NEQ "1" (
echo Build - Cleaning for %BUILD_FILE%...
call :clr_print %_c_Cyn% "Build: Cleaning for %BUILD_FILE%..."
msbuild.exe -maxCpuCount %~dp1%BUILD_FILE% /t:clean /p:Configuration="%~1" /P:Platform=%2
if ERRORLEVEL 1 (
set SDV_FAILED=1
)
echo.
)
if "!SDV_FAILED!" NEQ "1" (
echo Build - Cleaning SDV for %BUILD_FILE%...
call :clr_print %_c_Cyn% "Build: Cleaning SDV for %BUILD_FILE%..."
msbuild.exe -maxCpuCount %~dp1%BUILD_FILE% /t:sdv /p:inputs="/clean" /p:Configuration="%~1" /P:platform=%2
if ERRORLEVEL 1 (
set SDV_FAILED=1
)
echo.
)
if "!SDV_FAILED!" NEQ "1" (
echo Build - Performing SDV checks for %BUILD_FILE%...
call :clr_print %_c_Cyn% "Build: Performing SDV checks for %BUILD_FILE%..."
msbuild.exe -maxCpuCount %~dp1%BUILD_FILE% /t:sdv /p:inputs="/check /devenv" /p:Configuration="%~1" /P:platform=%2
if ERRORLEVEL 1 (
set SDV_FAILED=1
Expand All @@ -303,7 +364,7 @@ goto :eof
:run_ql

if exist %~dp1codeql_db (
echo CodeQL ^: Removing previously created rules database...
call :clr_print %_c_Cyn% "CodeQL : Removing previously created rules database..."
rmdir /s /q %~dp1codeql_db
)

Expand All @@ -326,15 +387,15 @@ IF "%CODEQL_FAILED%" NEQ "1" (
goto :eof

:run_ca
echo Performing Code Analysis build of %BUILD_FILE%.
call :clr_print %_c_Cyn% "Performing Code Analysis build of %BUILD_FILE%."
msbuild.exe -maxCpuCount %~dp1%BUILD_FILE% /p:Configuration="%~1" /P:Platform=%2 /P:RunCodeAnalysisOnce=True -fileLoggerParameters:LogFile=%~dp1%BUILD_NAME%.CodeAnalysis.log
if ERRORLEVEL 1 (
set BUILD_FAILED=1
)
goto :eof

:run_dvl
echo Performing Driver Verfier Log build of %BUILD_FILE%.
call :clr_print %_c_Cyn% "Performing Driver Verfier Log build of %BUILD_FILE%."
msbuild.exe -maxCpuCount %~dp1%BUILD_FILE% /t:dvl /p:Configuration="%~1" /P:platform=%2
IF ERRORLEVEL 1 (
set BUILD_FAILED=1
Expand All @@ -353,5 +414,21 @@ for /f "tokens=1,2 delims=_" %%i in (%BUILD_INFO%) do @(
)
goto :eof

:clr_print
@echo %z_esc%[%~1%~2%z_esc%[%~3%~4%z_esc%[%~5%~6%z_esc%[%~7%~8%z_esc%[0m
goto :eof

:prepare_palette
rem Colour mods should work from WIN10_TH2
rem Get the ANSI ESC character [0x27]
for /f "tokens=2 usebackq delims=#" %%i in (`"prompt #$H#$E# & echo on & for %%i in (1) do rem"`) do @set z_esc=%%i
rem Prepare pallette
set "_c_Red="40;91m""
set "_c_Grn="40;92m""
set "_c_Yel="40;93m""
set "_c_Cyn="40;96m""
set "_c_Wht="40;37m""
goto :eof

:fail
exit /B 1
21 changes: 21 additions & 0 deletions build/clean_build_log.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@echo off
cd /d %~dp0
cd ..
if not exist ".\build_log.txt" goto :eof
setlocal
Title Clean Build Log
echo Cleaning Build Log...
timeout 3 1> nul 2>&1
for /f "tokens=2 usebackq delims=#" %%i in (`"prompt #$H#$E# & echo on & for %%i in (1) do rem"`) do @set z_esc=%%i
@PowerShell "(GC .\build_log.txt)|%%{$_ -Replace '%z_esc%\[0m',''}|SC .\build_log.txt"
@PowerShell "(GC .\build_log.txt)|%%{$_ -Replace '%z_esc%\[40\;91m',''}|SC .\build_log.txt"
@PowerShell "(GC .\build_log.txt)|%%{$_ -Replace '%z_esc%\[40\;92m',''}|SC .\build_log.txt"
@PowerShell "(GC .\build_log.txt)|%%{$_ -Replace '%z_esc%\[40\;93m',''}|SC .\build_log.txt"
@PowerShell "(GC .\build_log.txt)|%%{$_ -Replace '%z_esc%\[40\;96m',''}|SC .\build_log.txt"
@PowerShell "(GC .\build_log.txt)|%%{$_ -Replace '%z_esc%\[40\;37m',''}|SC .\build_log.txt"
@PowerShell "(GC .\build_log.txt)|%%{$_ -Replace '%z_esc%\[',''}|SC .\build_log.txt"
echo Build Log successfully cleaned.
echo Removing scheduled task...
schtasks /delete /tn build_log_cleanup /f
timeout 5
endlocal
10 changes: 7 additions & 3 deletions build/prebuild_x86_libs.bat
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if "%VIOSOCK_PREBUILD_X86_LIBS%" EQU "1" (
rem Check for x86 viosock libraries and build them if needed...
if not exist "%BUILD_DIR%viosock\lib\x86\%TARGET%%BUILD_FLAVOR%\viosocklib.dll" (
echo.
echo ATTENTION ^: Need to build x86 viosock libraries before building for amd64...
call :clr_print %_c_Yel% "ATTENTION : Need to build x86 viosock libraries before building for amd64..."
setlocal
set VIRTIO_WIN_NO_ARM=1
if "%BUILD_FILE%"=="virtio-win.sln" (
Expand All @@ -50,11 +50,15 @@ if "%VIOSOCK_PREBUILD_X86_LIBS%" EQU "1" (
if "%BUILD_FAILED%" EQU "1" (
exit /B 1
)
echo Successfully built the x86 viosock libraries.
call :clr_print %_c_Grn% "Successfully built the x86 viosock libraries."
call :clr_print %_c_Cyn% "Continuing with amd64 build..."
echo.
echo Continuing with amd64 build...
endlocal
)
)
)
goto :eof

:clr_print
@echo %z_esc%[%~1%~2%z_esc%[%~3%~4%z_esc%[%~5%~6%z_esc%[%~7%~8%z_esc%[0m
goto :eof