summaryrefslogtreecommitdiff
path: root/Build-SampleSet.ps1
diff options
context:
space:
mode:
Diffstat (limited to 'Build-SampleSet.ps1')
-rw-r--r--Build-SampleSet.ps141
1 files changed, 30 insertions, 11 deletions
diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1
index 2197b967..adae8bb0 100644
--- a/Build-SampleSet.ps1
+++ b/Build-SampleSet.ps1
@@ -10,16 +10,13 @@ param(
$root = Get-Location
-# launch developer powershell (if necessary)
+# 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
}
-# source environment variables
-. .\Env-Vars.ps1
-
$ThrottleFactor = 5
$LogicalProcessors = (Get-CIMInstance -Class 'CIM_Processor' -Verbose:$false).NumberOfLogicalProcessors
@@ -56,26 +53,34 @@ 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=""
#
-# In Github we build using Nuget only and source version from repo .\Env-Vars.ps1.
+# In Github we build using NuGet and get the version from packages and vsix version from env var set from the install vsix step.
#
if ($env:GITHUB_REPOSITORY) {
$build_environment="GitHub"
- $build_number=$env:SAMPLES_BUILD_NUMBER
+ $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
}
#
# WDK NuGet will require presence of a folder 'packages'. The version is sourced from repo .\Env-Vars.ps1.
#
-# Hack: If user has hydrated nuget packages, then use those. That will be indicated by presence of a folder named .\packages.
+# Hack: If user has hydrated nuget packages, then use those. That will be indicated by presence of a folder named '.\packages'.
+# Further, we need to test that the directory has been hydrated using '.\packages\*'.
#
-elseif(Test-Path(".\packages")) {
+elseif(Test-Path(".\packages\*")) {
$build_environment=("NuGet")
- $build_number=$env:SAMPLES_BUILD_NUMBER
+ $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'.
@@ -101,7 +106,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
#
@@ -165,6 +182,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 + ")")