diff options
Diffstat (limited to 'Build-SampleSet.ps1')
| -rw-r--r-- | Build-SampleSet.ps1 | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1 index 2197b967..5be14dcf 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,30 @@ 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'. # $build_environment="" $build_number=0 +$nuget_package_version=0 # # In Github we build using Nuget only and source version from repo .\Env-Vars.ps1. # 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] } # # 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'. @@ -164,6 +165,10 @@ $jresult = @{ $SolutionsTotal = $sampleSet.Count * $Configurations.Count * $Platforms.Count Write-Output ("Build Environment: " + $build_environment) +if (($build_environment -eq "GitHub") -or ($build_environment -eq "NuGet")) { + Write-Output ("Nuget Package Version: " + $nuget_package_version) +} +Write-Output ("WDK VSIX Version: " + ($env:SAMPLES_VSIX_VERSION) ? $env:SAMPLES_VSIX_VERSION : (ls "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=*" | Select -ExpandProperty Name).split('=')[1]) Write-Output ("Build Number: " + $build_number) Write-Output ("Samples: " + $sampleSet.Count) Write-Output ("Configurations: " + $Configurations.Count + " (" + $Configurations + ")") |
