99)
1010
1111$root = Get-Location
12+
13+ # launch developer powershell (if necessary to prevent multiple developer sessions)
14+ if (-not $env: VSCMD_VER ) {
15+ Import-Module (Resolve-Path " $env: ProgramFiles \Microsoft Visual Studio\2022\*\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" )
16+ Enter-VsDevShell - VsInstallPath (Resolve-Path " $env: ProgramFiles \Microsoft Visual Studio\2022\*" )
17+ cd $root
18+ }
19+
1220$ThrottleFactor = 5
1321$LogicalProcessors = (Get-CIMInstance - Class ' CIM_Processor' - Verbose:$false ).NumberOfLogicalProcessors
1422
@@ -45,27 +53,31 @@ finally {
4553}
4654
4755#
48- # Determine build environment: 'GitHub', 'NuGet', 'EWDK', or 'WDK'. Only used to determine build number.
56+ # Determine build environment: 'GitHub', 'NuGet', 'EWDK', or 'WDK'.
4957# Determine build number (used for exclusions based on build number). Five digits. Say, '22621'.
58+ # Determine NuGet package version (if applicable).
5059#
5160$build_environment = " "
5261$build_number = 0
62+ $nuget_package_version = 0
5363#
54- # WDK NuGet will require presence of a folder 'packages'
64+ # In Github we build using NuGet.
5565#
56- #
57- # Hack: In GitHub we do not have an environment variable where we can see WDK build number, so we have it hard coded.
58- #
59- if (-not $env: GITHUB_REPOSITORY -eq ' ' ) {
66+ if ($env: GITHUB_REPOSITORY ) {
6067 $build_environment = " GitHub"
61- $build_number = 22621
68+ $nuget_package_version = ([regex ]' (?<=x64\.)(\d+\.)(\d+\.)(\d+\.)(\d+)' ).Matches((Get-Childitem .\packages\* WDK.x64* - Name)).Value
69+ $build_number = $nuget_package_version.split (' .' )[2 ]
6270}
6371#
64- # Hack: If user has hydrated nuget packages, then use those. That will be indicated by presence of a folder named .\packages.
72+ # WDK NuGet will require presence of a folder 'packages'. The version is sourced from repo .\Env-Vars.ps1.
73+ #
74+ # Hack: If user has hydrated nuget packages, then use those. That will be indicated by presence of a folder named '.\packages'.
75+ # Further, we need to test that the directory has been hydrated using '.\packages\*'.
6576#
66- elseif (Test-Path (" .\packages" )) {
77+ elseif (Test-Path (" .\packages\* " )) {
6778 $build_environment = (" NuGet" )
68- $build_number = 26100
79+ $nuget_package_version = ([regex ]' (?<=x64\.)(\d+\.)(\d+\.)(\d+\.)(\d+)' ).Matches((Get-Childitem .\packages\* WDK.x64* - Name)).Value
80+ $build_number = $nuget_package_version.split (' .' )[2 ]
6981}
7082#
7183# EWDK sets environment variable BuildLab. For example 'ni_release_svc_prod1.22621.2428'.
@@ -91,7 +103,15 @@ else {
91103 Write-Error " Could not determine build environment."
92104 exit 1
93105}
94-
106+ #
107+ # Get the WDK extension version from installed packages
108+ $wdk_extension_ver = ls " ${env: ProgramData} \Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=*" | Select - ExpandProperty Name
109+ $wdk_extension_ver = ([regex ]' (\d+\.)(\d+\.)(\d+\.)(\d+)' ).Matches($wdk_extension_ver ).Value
110+ if (-not $wdk_extension_ver ) {
111+ Write-Error " No version of the WDK Visual Studio Extension could be found. The WDK Extension is not installed."
112+ exit 1
113+ }
114+ #
95115#
96116# InfVerif_AdditionalOptions
97117#
@@ -153,18 +173,22 @@ $jresult = @{
153173
154174$SolutionsTotal = $sampleSet.Count * $Configurations.Count * $Platforms.Count
155175
156- Write-Output (" Build Environment: " + $build_environment )
157- Write-Output (" Build Number: " + $build_number )
158- Write-Output (" Samples: " + $sampleSet.Count )
159- Write-Output (" Configurations: " + $Configurations.Count + " (" + $Configurations + " )" )
160- Write-Output (" Platforms: " + $Platforms.Count + " (" + $Platforms + " )" )
176+ Write-Output " WDK Build Environment: $build_environment "
177+ Write-Output " WDK Build Number: $build_number "
178+ if (($build_environment -eq " GitHub" ) -or ($build_environment -eq " NuGet" )) {
179+ Write-Output " WDK Nuget Version: $nuget_package_version "
180+ }
181+ Write-Output " WDK Extension Version: $wdk_extension_ver "
182+ Write-Output " Samples: $ ( $sampleSet.Count ) "
183+ Write-Output " Configurations: $ ( $Configurations.Count ) ($Configurations )"
184+ Write-Output " Platforms: $ ( $Platforms.Count ) ($Platforms )"
161185Write-Output " InfVerif_AdditionalOptions: $InfVerif_AdditionalOptions "
162186Write-Output " Combinations: $SolutionsTotal "
163187Write-Output " LogicalProcessors: $LogicalProcessors "
164188Write-Output " ThrottleFactor: $ThrottleFactor "
165189Write-Output " ThrottleLimit: $ThrottleLimit "
166190Write-Output " WDS_WipeOutputs: $env: WDS_WipeOutputs "
167- Write-Output ( " Disk Remaining (GB): " + (((Get-Volume ($DriveLetter = (Get-Item " ." ).PSDrive.Name)).SizeRemaining / 1 GB )))
191+ Write-Output " Disk Remaining (GB): $ ( ((Get-Volume ((Get-Item " ." ).PSDrive.Name)).SizeRemaining) / 1 GB ) "
168192Write-Output " "
169193Write-Output " T: Combinations"
170194Write-Output " B: Built"
0 commit comments