From 015d531acc39d459c26cacebae6cf6d45988183c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adonais=20Romero=20Gonz=C3=A1lez?= Date: Fri, 22 Nov 2024 17:49:52 -0800 Subject: [PATCH] Refactor Build-SampleSet to remove warnings & support EWDK --- Build-SampleSet.ps1 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1 index f6765395a..270a7eaa1 100644 --- a/Build-SampleSet.ps1 +++ b/Build-SampleSet.ps1 @@ -14,7 +14,7 @@ $root = Get-Location if (-not $env:VSCMD_VER) { Import-Module (Resolve-Path "$env:ProgramFiles\Microsoft Visual Studio\2022\*\Common7\Tools\Microsoft.VisualStudio.DevShell.dll") Enter-VsDevShell -VsInstallPath (Resolve-Path "$env:ProgramFiles\Microsoft Visual Studio\2022\*") - cd $root + Set-Location $root } $ThrottleFactor = 5 @@ -97,7 +97,7 @@ else { # Dump all environment variables so as to help debug error: Write-Output "Environment variables {" - gci env:* | sort-object name + Get-ChildItem env:* | Sort-Object name Write-Output "Environment variables }" Write-Error "Could not determine build environment." @@ -105,11 +105,17 @@ else { } # # Get the WDK extension version from installed packages -$wdk_extension_ver = ls "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=*" | Select -ExpandProperty Name +$wdk_extension_ver = Get-ChildItem "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=*" | Select-Object -ExpandProperty Name $wdk_extension_ver = ([regex]'(\d+\.)(\d+\.)(\d+\.)(\d+)').Matches($wdk_extension_ver).Value if (-not $wdk_extension_ver) { - Write-Error "No version of the WDK Visual Studio Extension could be found. The WDK Extension is not installed." - exit 1 + # Be lenient with EWDK builds that do not include the package information + if ($build_environment -match '^EWDK') { + $wdk_extension_ver = "(package not found)" + } + else { + Write-Error "No version of the WDK Visual Studio Extension could be found. The WDK Extension is not installed." + exit 1 + } } # # @@ -348,7 +354,7 @@ $Results = $jresult.Results Write-Output "Built all combinations." Write-Output "" Write-Output "Elapsed time: $min minutes, $seconds seconds." -Write-Output ("Disk Remaining (GB): " + (((Get-Volume ($DriveLetter = (Get-Item ".").PSDrive.Name)).SizeRemaining / 1GB))) +Write-Output ("Disk Remaining (GB): " + (((Get-Volume (Get-Item ".").PSDrive.Name).SizeRemaining / 1GB))) Write-Output ("Samples: " + $sampleSet.Count) Write-Output ("Configurations: " + $Configurations.Count + " (" + $Configurations + ")") Write-Output ("Platforms: " + $Platforms.Count + " (" + $Platforms + ")")