Skip to content

Commit 015d531

Browse files
committed
Refactor Build-SampleSet to remove warnings & support EWDK
1 parent 8785be3 commit 015d531

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

Build-SampleSet.ps1

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $root = Get-Location
1414
if (-not $env:VSCMD_VER) {
1515
Import-Module (Resolve-Path "$env:ProgramFiles\Microsoft Visual Studio\2022\*\Common7\Tools\Microsoft.VisualStudio.DevShell.dll")
1616
Enter-VsDevShell -VsInstallPath (Resolve-Path "$env:ProgramFiles\Microsoft Visual Studio\2022\*")
17-
cd $root
17+
Set-Location $root
1818
}
1919

2020
$ThrottleFactor = 5
@@ -97,19 +97,25 @@ else {
9797

9898
# Dump all environment variables so as to help debug error:
9999
Write-Output "Environment variables {"
100-
gci env:* | sort-object name
100+
Get-ChildItem env:* | Sort-Object name
101101
Write-Output "Environment variables }"
102102

103103
Write-Error "Could not determine build environment."
104104
exit 1
105105
}
106106
#
107107
# 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
108+
$wdk_extension_ver = Get-ChildItem "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=*" | Select-Object -ExpandProperty Name
109109
$wdk_extension_ver = ([regex]'(\d+\.)(\d+\.)(\d+\.)(\d+)').Matches($wdk_extension_ver).Value
110110
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
111+
# Be lenient with EWDK builds that do not include the package information
112+
if ($build_environment -match '^EWDK') {
113+
$wdk_extension_ver = "(package not found)"
114+
}
115+
else {
116+
Write-Error "No version of the WDK Visual Studio Extension could be found. The WDK Extension is not installed."
117+
exit 1
118+
}
113119
}
114120
#
115121
#
@@ -348,7 +354,7 @@ $Results = $jresult.Results
348354
Write-Output "Built all combinations."
349355
Write-Output ""
350356
Write-Output "Elapsed time: $min minutes, $seconds seconds."
351-
Write-Output ("Disk Remaining (GB): " + (((Get-Volume ($DriveLetter = (Get-Item ".").PSDrive.Name)).SizeRemaining / 1GB)))
357+
Write-Output ("Disk Remaining (GB): " + (((Get-Volume (Get-Item ".").PSDrive.Name).SizeRemaining / 1GB)))
352358
Write-Output ("Samples: " + $sampleSet.Count)
353359
Write-Output ("Configurations: " + $Configurations.Count + " (" + $Configurations + ")")
354360
Write-Output ("Platforms: " + $Platforms.Count + " (" + $Platforms + ")")

0 commit comments

Comments
 (0)