summaryrefslogtreecommitdiff
path: root/Build-SampleSet.ps1
diff options
context:
space:
mode:
Diffstat (limited to 'Build-SampleSet.ps1')
-rw-r--r--Build-SampleSet.ps146
1 files changed, 36 insertions, 10 deletions
diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1
index 8c3f6deb..9d1cc014 100644
--- a/Build-SampleSet.ps1
+++ b/Build-SampleSet.ps1
@@ -9,6 +9,14 @@ param(
)
$root = Get-Location
+
+# launch developer powershell (if necessary to prevent multiple developer sessions)
+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
+}
+
$ThrottleFactor = 5
$LogicalProcessors = (Get-CIMInstance -Class 'CIM_Processor' -Verbose:$false).NumberOfLogicalProcessors
@@ -45,27 +53,31 @@ finally {
}
#
-# Determine build environment: 'GitHub', 'NuGet', 'EWDK', or 'WDK'. Only used to determine build number.
+# Determine build environment: 'GitHub', 'NuGet', 'EWDK', or 'WDK'.
# Determine build number (used for exclusions based on build number). Five digits. Say, '22621'.
+# Determine NuGet package version (if applicable).
+# Determine WDK vsix version.
#
$build_environment=""
$build_number=0
+$nuget_package_version=0
+$vsix_version=""
#
-# WDK NuGet will require presence of a folder 'packages'
+# In Github we build using NuGet and get the version from packages and vsix version from env var set from the install vsix step.
#
-#
-# Hack: In GitHub we do not have an environment variable where we can see WDK build number, so we have it hard coded.
-#
-if (-not $env:GITHUB_REPOSITORY -eq '') {
+if ($env:GITHUB_REPOSITORY) {
$build_environment="GitHub"
- $build_number=22621
+ $nuget_package_version=([regex]'(?<=x64\.)(\d+\.)(\d+\.)(\d+\.)(\d+)').Matches((Get-Childitem .\packages\*WDK.x64* -Name)).Value
+ $build_number=$nuget_package_version.split('.')[2]
+ $vsix_version = $env:SAMPLES_VSIX_VERSION
}
#
-# Hack: If user has hydrated nuget packages, then use those. That will be indicated by presence of a folder named .\packages.
+# WDK NuGet will require presence of a folder 'packages'. The version is sourced from repo .\Env-Vars.ps1.
#
elseif(Test-Path(".\Directory.Build.props")) {
$build_environment=("NuGet")
- $build_number=26074
+ $nuget_package_version=([regex]'(?<=x64\.)(\d+\.)(\d+\.)(\d+\.)(\d+)').Matches((Get-Childitem .\packages\*WDK.x64* -Name)).Value
+ $build_number=$nuget_package_version.split('.')[2]
}
#
# EWDK sets environment variable BuildLab. For example 'ni_release_svc_prod1.22621.2428'.
@@ -91,7 +103,19 @@ else {
Write-Error "Could not determine build environment."
exit 1
}
-
+#
+# Get the vsix version from packages if not set
+if (-not $vsix_version) {
+ $vsix_version = ls "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=*" | Select -ExpandProperty Name
+ if ($vsix_version) {
+ $vsix_version = $vsix_version.split('=')[1]
+ }
+ else {
+ Write-Error "No version of the WDK VSIX could be found. The WDK VSIX is not installed."
+ exit 1
+ }
+}
+#
#
# InfVerif_AdditionalOptions
#
@@ -155,6 +179,8 @@ $SolutionsTotal = $sampleSet.Count * $Configurations.Count * $Platforms.Count
Write-Output ("Build Environment: " + $build_environment)
Write-Output ("Build Number: " + $build_number)
+if (($build_environment -eq "GitHub") -or ($build_environment -eq "NuGet")) { Write-Output ("Nuget Package Version: " + $nuget_package_version) }
+Write-Output ("WDK VSIX Version: " + $vsix_version)
Write-Output ("Samples: " + $sampleSet.Count)
Write-Output ("Configurations: " + $Configurations.Count + " (" + $Configurations + ")")
Write-Output ("Platforms: " + $Platforms.Count + " (" + $Platforms + ")")