diff options
| author | JakobL-MSFT <[email protected]> | 2024-01-15 13:06:49 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-01-15 13:06:49 -0800 |
| commit | d3e7ba7e0625b0235a51206f558b4b5574992916 (patch) | |
| tree | 8f47b699a2838e4229b1b2fd3a8ed7be8e42792f /Build-SampleSet.ps1 | |
| parent | 7b0c7e24905cf4cafd33da5737b573696beb66b7 (diff) | |
Partial Manual Merge of develop to main specifically to add support for fine grained exclusions (#1076)
user/jakob/partial_manual_merge_develop_to_main_fine_grained_exclusion
Diffstat (limited to 'Build-SampleSet.ps1')
| -rw-r--r-- | Build-SampleSet.ps1 | 71 |
1 files changed, 66 insertions, 5 deletions
diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1 index a776af3a..2c75143a 100644 --- a/Build-SampleSet.ps1 +++ b/Build-SampleSet.ps1 @@ -44,16 +44,74 @@ finally { $ErrorActionPreference = $oldPreference } +# +# Determine build environment: 'WDK', 'EWDK', or 'GitHub'. Only used to determine build number. +# Determine build number (used for exclusions based on build number). Five digits. Say, '22621'. +# +$build_environment="" +$build_number=0 +# +# EWDK sets environment variable Version_Number. For example '10.0.22621.0'. +# +if($env:Version_Number -match '10.0.(?<build>.*).0') { + $build_environment="EWDK" + $build_number=$Matches.build +} +# +# WDK sets environment variable UCRTVersion. For example '10.0.22621.0'. +# +elseif ($env:UCRTVersion -match '10.0.(?<build>.*).0') { + $build_environment="WDK" + $build_number=$Matches.build +} +# +# Hack: In GitHub we do not have an environment variable where we can see WDK build number, so we have it hard coded. +# +elseif (-not $env:GITHUB_REPOSITORY -eq '') { + $build_environment="GitHub" + $build_number=22621 +} +else { + + # Dump all environment variables so as to help debug error: + Write-Output "Environment variables {" + gci env:* | sort-object name + Write-Output "Environment variables }" + + Write-Error "Could not determine build environment." + exit 1 +} + +# +# Determine exclusions. +# +# Exclusions are loaded from .\exclusions.csv. +# Each line has form: +# Path,Configurations,MinBuild,MaxBuild,Reason +# Where: +# Path: Is the path to folder containing solution(s) using backslashes. For example: 'audio\acx\samples\audiocodec\driver' . +# Configurations: Are the configurations to exclude. For example: '*|arm64' . +# MinBuild: Is the minimum WDK/EWDK build number the exclusion is applicable for. For example: '22621' . +# MaxBuild: Is the maximum WDK/EWDK build number the exclusion is applicable for. For example: '26031' . +# Reason: Is plain text documenting the reason for the exclusion. For example: 'error C1083: Cannot open include file: 'acx.h': No such file or directory' . +# $exclusionConfigurations = @{} $exclusionReasons = @{} Import-Csv 'exclusions.csv' | ForEach-Object { - if ($_.Configurations) { - $exclusionConfigurations[$_.Path.Replace($root, '').Trim('\').Replace('\', '.').ToLower()] = $_.Configurations + $excluded_driver=$_.Path.Replace($root, '').Trim('\').Replace('\', '.').ToLower() + $excluded_configurations=($_.configurations -eq '' ? '*' : $_.configurations) + $excluded_minbuild=($_.MinBuild -eq '' ? 00000 : $_.MinBuild) + $excluded_maxbuild=($_.MaxBuild -eq '' ? 99999 : $_.MaxBuild) + if (($excluded_minbuild -le $build_number) -and ($build_number -le $excluded_maxbuild) ) + { + $exclusionConfigurations[$excluded_driver] = $excluded_configurations + $exclusionReasons[$excluded_driver] = $_.Reason + Write-Verbose "Exclusion.csv entry applied for '$excluded_driver' for configuration '$excluded_configurations'." } - else { - $exclusionConfigurations[$_.Path.Replace($root, '').Trim('\').Replace('\', '.').ToLower()] = '*' + else + { + Write-Verbose "Exclusion.csv entry not applied for '$excluded_driver' due to build number." } - $exclusionReasons[$_.Path.Replace($root, '').Trim('\').Replace('\', '.').ToLower()] = $_.Reason } $jresult = @{ @@ -67,6 +125,8 @@ $jresult = @{ $SolutionsTotal = $sampleSet.Count * $Configurations.Count * $Platforms.Count +Write-Output ("Build Environment: " + $build_environment) +Write-Output ("Build Number: " + $build_number) Write-Output ("Samples: " + $sampleSet.Count) Write-Output ("Configurations: " + $Configurations.Count + " (" + $Configurations + ")") Write-Output ("Platforms: " + $Platforms.Count + " (" + $Platforms + ")") @@ -178,6 +238,7 @@ $sw.Stop() if ($jresult.FailSet.Count -gt 0) { Write-Output "Some combinations were built with errors:" + $jresult.FailSet = $jresult.FailSet | Sort-Object foreach ($failedSample in $jresult.FailSet) { $failedSample -match "^(.*) (\w*)\|(\w*)$" | Out-Null $failName = $Matches[1] |
