Skip to content

Commit

Permalink
[vioscsi] Conditionally manage DVL copying
Browse files Browse the repository at this point in the history
Addendum to 7348ad4.

1. Refactors changes to the CustomBuildStep Command following code
   review. We now perform all steps regardless of Target OS. We also
   now create DVL files in the Project (driver) folder with version
   numbers in the file name for DVL files created with legacy EWDKs,
   and with the "latest" label for current EWDKs. These files are
   then copied to the relevant .\Install folders and renamed for
   extant WHCP submission operations.

2. New build\makeLegacyDVLs.bat now creates all legacy DVL files.
   This functionally replaces build\dvl1903.bat and extends it to
   service any legacy DVL build. It provides a framework to manage
   legacy DVL creation and a common place to lay out version-specific
   DVL operations and manipulations. Logging is also enabled to
   provide feedback when read at the tail of root\buildAll.bat.
   Please see PR virtio-win#1212 for details on these changes.

Signed-off-by: benyamin-codez <[email protected]>
  • Loading branch information
benyamin-codez committed Dec 14, 2024
1 parent 7348ad4 commit ef107f2
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 23 deletions.
84 changes: 84 additions & 0 deletions build/makeLegacyDVLs.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
@echo off
setlocal enabledelayedexpansion

rem Add Legacy DVL folders here, seperated by a space, in the format
rem DVLbbbb, where bbbb is the Windows version, e.g. DVL1903.
rem If you do not wish to build any Legacy DVLs, leave the
rem _legacy_dvls_ variable equal to NULL.
set _legacy_dvls_=DVL1903 DVL1607

if "%_legacy_dvls_%"=="" (
echo INFO : No Legacy DVLs were selected for building.
goto :eof
)
if "%DVL1607%"=="" set DVL1607=C:\DVL1607
if "%DVL1903%"=="" set DVL1903=C:\DVL1903
set "ProjDir=%~1"
set "IntDir_DVL=%~1%~2"
set "TargetName_DVL=%~3"
set "CONFIGURATION_DVL=%~4"
set "PLATFORM_DVL=%~5"
if exist "%ProjDir%%TargetName_DVL%.legacy_dvl_result.txt" (
del /f "%ProjDir%%TargetName_DVL%.legacy_dvl_result.txt"
)
echo.
call :proc_legacy_dvls %_legacy_dvls_%
endlocal
goto :eof

:proc_legacy_dvls
if "%~1"=="" goto :eof
call :do_dvl %1
shift
goto :proc_legacy_dvls

:do_dvl
set dvl_ver=%1
set dvl_ver=%dvl_ver:~-4%
if exist !%~1! (
echo Found !%~1!. Building Driver Verification Log for Windows 10 version !dvl_ver!...
!%~1!\dvl.exe
if "!errorlevel!" NEQ "0" (
echo ERROR building Driver Verification Log for Windows 10 version !dvl_ver!.
echo The DVL file %ProjDir%%TargetName_DVL%.DVL-win10-!dvl_ver!.XML will NOT exist.
echo.
echo !dvl_ver!,fail >> "%ProjDir%%TargetName_DVL%.legacy_dvl_result.txt"
goto :eof
)
echo Copying DVL to %ProjDir%%TargetName_DVL%.DVL-win10-!dvl_ver!.XML.
copy /y "%ProjDir%%TargetName_DVL%.DVL.XML" "%ProjDir%%TargetName_DVL%.DVL-win10-!dvl_ver!.XML"
echo !dvl_ver!,!dvl_ver! >> "%ProjDir%%TargetName_DVL%.legacy_dvl_result.txt"
) else (
echo The !%~1! directory was not found. Unable to build Driver Verification Log.
if "%~1"=="DVL1607" (
if exist "%ProjDir%%TargetName_DVL%.DVL-win10-1903.XML" (
echo Creating Driver Verification Log for Windows 10 version !dvl_ver! from alternate DVL instead.
echo Alternate DVL : %TargetName_DVL%.DVL-win10-1903.XML
findstr /v /c:"General.Checksum" "%ProjDir%%TargetName_DVL%.DVL-win10-1903.XML" > "%ProjDir%%TargetName_DVL%.DVL-win10-!dvl_ver!.XML"
echo 1607,1903 >> "%ProjDir%%TargetName_DVL%.legacy_dvl_result.txt"
) else (
if exist "%ProjDir%%TargetName_DVL%.DVL-win10-latest.XML" (
echo Creating Driver Verification Log for Windows 10 version !dvl_ver! from alternate DVL instead.
echo Alternate DVL : %TargetName_DVL%.DVL-win10-latest.XML
findstr /v /c:"General.Checksum" "%ProjDir%%TargetName_DVL%.DVL-win10-latest.XML" | findstr /v /c:".Semmle." > "%ProjDir%%TargetName_DVL%.DVL-win10-!dvl_ver!.XML"
echo 1607,latest >> "%ProjDir%%TargetName_DVL%.legacy_dvl_result.txt"
) else (
echo Unable to create Driver Verification Log from alternates as no suitable alternate exists.
echo.
echo 1607,fail >> "%ProjDir%%TargetName_DVL%.legacy_dvl_result.txt"
goto :eof
)
)
echo Driver Verification Log Created. You can locate the Driver Verification Log file at:
echo %ProjDir%%TargetName_DVL%.DVL-win10-!dvl_ver!.XML
)
if "%~1"=="DVL1903" (
echo Unable to create Driver Verification Log from alternates as no suitable alternate exists.
echo.
echo 1903,fail >> "%ProjDir%%TargetName_DVL%.legacy_dvl_result.txt"
goto :eof
)
)
echo Finished creating Driver Verification Log for Windows 10 version !dvl_ver!.
echo.
goto :eof
50 changes: 27 additions & 23 deletions vioscsi/vioscsi.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -130,35 +130,39 @@
<ItemDefinitionGroup>
<CustomBuildStep>
<Command>
copy /Y $(ProjectDir)vioscsi.DVL.XML $(ProjectDir)Install\$(TargetOS)\$(TargetArch)
echo Copying $(TargetName).DVL.XML to Install\$(TargetOS)\$(TargetArch)\$(TargetName).DVL.XML
copy /Y $(ProjectDir)$(TargetName).DVL.XML^
$(ProjectDir)Install\$(TargetOS)\$(TargetArch)
echo Copying $(IntDir)vc.nativecodeanalysis.all.xml to $(ProjectDir)
copy /Y $(IntDir)vc.nativecodeanalysis.all.xml $(ProjectDir)
if "$(TargetOS)"=="Win10" (
if exist C:\DVL1903 (
call "..\build\dvl1903.bat" "$(ProjectDir)\$(IntDir)" "$(TargetName)" "$(Configuration)" "$(Platform)"
copy /Y $(ProjectDir)vioscsi.DVL.XML $(ProjectDir)vioscsi.DVL-compat.XML
copy /Y $(ProjectDir)vioscsi.DVL.XML $(ProjectDir)Install\$(TargetOS)\$(TargetArch)\vioscsi.DVL-compat.XML
)
echo Copying $(TargetName).DVL.XML to $(ProjectDir)$(TargetName).DVL-win10-latest.XML
copy /Y $(ProjectDir)$(TargetName).DVL.XML^
$(ProjectDir)$(TargetName).DVL-win10-latest.XML
)
if "$(TargetOS)"=="Win11" (
if exist $(ProjectDir)Install\Win10\$(TargetArch)\vioscsi.DVL.XML (
copy /Y $(ProjectDir)Install\Win10\$(TargetArch)\vioscsi.DVL.XML $(ProjectDir)Install\$(TargetOS)\$(TargetArch)\vioscsi.DVL-win10.XML
) else (
copy /Y $(ProjectDir)vioscsi.DVL.XML $(ProjectDir)Install\$(TargetOS)\$(TargetArch)\vioscsi.DVL-win10.XML
)
if exist $(ProjectDir)Install\Win10\$(TargetArch)\vioscsi.DVL-compat.XML (
copy /Y $(ProjectDir)Install\Win10\$(TargetArch)\vioscsi.DVL-compat.XML $(ProjectDir)Install\$(TargetOS)\$(TargetArch)\vioscsi.DVL-compat.XML
) else (
if exist $(ProjectDir)vioscsi.DVL-compat.XML (
copy /Y $(ProjectDir)vioscsi.DVL-compat.XML $(ProjectDir)Install\$(TargetOS)\$(TargetArch)\vioscsi.DVL-compat.XML
) else (
findstr /v /c:"General.Checksum" "$(ProjectDir)vioscsi.DVL.XML" | findstr /v /c:".Semmle." > $(ProjectDir)vioscsi.DVL-compat.XML
copy /Y $(ProjectDir)vioscsi.DVL-compat.XML $(ProjectDir)Install\$(TargetOS)\$(TargetArch)\vioscsi.DVL-compat.XML
)
)
echo Copying $(TargetName).DVL.XML to $(ProjectDir)$(TargetName).DVL-win11-latest.XML
copy /Y $(ProjectDir)$(TargetName).DVL.XML^
$(ProjectDir)$(TargetName).DVL-win11-latest.XML
)
call "..\build\makeLegacyDVLs.bat" "$(ProjectDir)" "$(IntDir)" "$(TargetName)" "$(Configuration)" "$(Platform)"
if exist "$(ProjectDir)$(TargetName).DVL-win10-1903.XML" (
echo Copying $(TargetName).DVL-win10-1903.XML to Install\$(TargetOS)\$(TargetArch)\$(TargetName).DVL-win10.XML
copy /Y $(ProjectDir)$(TargetName).DVL-win10-1903.XML^
$(ProjectDir)Install\$(TargetOS)\$(TargetArch)\$(TargetName).DVL-win10.XML
) else (
echo Unable to copy Win10 DVL $(ProjectDir)$(TargetName).DVL-win10-1903.XML - it does not exist.
)
if exist "$(ProjectDir)$(TargetName).DVL-win10-1607.XML" (
echo Copying $(TargetName).DVL-win10-1607.XML to Install\$(TargetOS)\$(TargetArch)\$(TargetName).DVL-compat.XML
copy /Y $(ProjectDir)$(TargetName).DVL-win10-latest.XML^
$(ProjectDir)Install\$(TargetOS)\$(TargetArch)\$(TargetName).DVL-compat.XML
) else (
echo Unable to copy COMPAT DVL $(ProjectDir)$(TargetName).DVL-win10-1607.XML - it does not exist.
)
</Command>
<Inputs>$(IntDir)vc.nativecodeanalysis.all.xml;$(ProjectDir)vioscsi.DVL.XML</Inputs>
<Outputs>$(ProjectDir)Install\$(TargetOS)\$(TargetArch)\vioscsi.DVL.XML;$(ProjectDir)Install\$(TargetOS)\$(TargetArch)\vioscsi.DVL-win10.XML</Outputs>
<Inputs>$(IntDir)vc.nativecodeanalysis.all.xml;$(ProjectDir)$(TargetName).DVL.XML</Inputs>
<Outputs>$(ProjectDir)Install\$(TargetOS)\$(TargetArch)\$(TargetName).DVL.XML;$(ProjectDir)Install\$(TargetOS)\$(TargetArch)\$(TargetName).DVL-win10.XML</Outputs>
</CustomBuildStep>
<ClCompile>
<WppEnabled Condition="'$(Configuration)|$(Platform)'=='Win10 Release|Win32'">true</WppEnabled>
Expand Down

0 comments on commit ef107f2

Please sign in to comment.