From d3e7ba7e0625b0235a51206f558b4b5574992916 Mon Sep 17 00:00:00 2001 From: JakobL-MSFT <110699333+JakobL-MSFT@users.noreply.github.com> Date: Mon, 15 Jan 2024 13:06:49 -0800 Subject: 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 --- .github/scripts/Build-ChangedSamples.ps1 | 2 +- Build-AllSamples.ps1 | 4 +- Build-SampleSet.ps1 | 71 +++++++++++++++++++++++++++++--- exclusions.csv | 34 ++++++++------- 4 files changed, 88 insertions(+), 23 deletions(-) diff --git a/.github/scripts/Build-ChangedSamples.ps1 b/.github/scripts/Build-ChangedSamples.ps1 index 21fbe6bb..f7dc95f5 100644 --- a/.github/scripts/Build-ChangedSamples.ps1 +++ b/.github/scripts/Build-ChangedSamples.ps1 @@ -22,7 +22,7 @@ foreach ($file in $ChangedFiles) { $filename = Split-Path $file -Leaf # Files that can affect how every sample is built should trigger a full build - if ($filename -eq "Build-AllSamples.ps1" -or $filename -eq "Build-Sample.ps1" -or $filename -eq "Build-SampleSet.ps1") { + if ($filename -eq "Build-AllSamples.ps1" -or $filename -eq "Build-Sample.ps1" -or $filename -eq "Build-SampleSet.ps1" -or $filename -eq "exclusions.csv") { $buildAll = $true } if ($dir -like "$root\.github\scripts" -or $dir -like "$root\.github\scripts\*") { diff --git a/Build-AllSamples.ps1 b/Build-AllSamples.ps1 index 24113c5f..353d95a3 100644 --- a/Build-AllSamples.ps1 +++ b/Build-AllSamples.ps1 @@ -57,11 +57,11 @@ foreach ($file in $solutionFiles) { $dir = (Get-Item $file).DirectoryName $dir_norm = $dir.Replace($root, '').Trim('\').Replace('\', '.').ToLower() if ($dir_norm -match ($Samples)) { - Write-Verbose "`u{1F50E} Found and included sample [$dir_norm] at $dir" + Write-Verbose "`u{1F50E} Found and filtered in sample [$dir_norm] at $dir" $sampleSet[$dir_norm] = $dir } else { - Write-Verbose "`u{1F50E} Found and excluded sample [$dir_norm] at $dir" + Write-Verbose "`u{1F50E} Found and filtered out sample [$dir_norm] at $dir" } } 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.(?.*).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.(?.*).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] diff --git a/exclusions.csv b/exclusions.csv index 86ab66e8..11330227 100644 --- a/exclusions.csv +++ b/exclusions.csv @@ -1,15 +1,19 @@ -Path,Reason -general\dchu\osrfx2_dchu_base,Wrong Toolset - needs migration -general\dchu\osrfx2_dchu_extension_loose,Needs fix for project not found -general\dchu\osrfx2_dchu_extension_tight,Wrong Toolset - needs migration -general\filehistory,Deprecated APIs -general\simplemediasource,ARM64 LNK1181: cannot open input file 'SimpleMediaSource.lib' -general\winhec 2017 lab\toaster driver,Needs input from end user -general\winhec 2017 lab\toaster support app,Needs input from end user -network\trans\stmedit,Invalid Win32 architecture -network\trans\wfpsampler,Missing INF section; missing libs -network\wlan\wdi,Invalid architecture -print\oem printer customization plug-in samples\c++,Invalid architecture -print\v4printdriversamples\printerextensionsample,Invalid architecture -tree,Missing headers -video\indirectdisplay,ARM64 Warning C4530: C++ exception handler used but unwind semantics are not enabled \ No newline at end of file +Path,Configurations,MinBuild,MaxBuild,Reason +avstream\sampledevicemft,*,26031,,Only GE: Fails to build +general\dchu\osrfx2_dchu_base,*,,,Wrong Toolset - needs migration +general\dchu\osrfx2_dchu_extension_loose,*,,,Needs fix for project not found +general\dchu\osrfx2_dchu_extension_tight,*,,,Wrong Toolset - needs migration +general\filehistory,*,,,Deprecated APIs +general\simplemediasource,Debug|arm64,,,Only Debug|arm64: LNK1181: cannot open input file 'SimpleMediaSource.lib' +general\winhec 2017 lab\toaster driver,*,,,Needs input from end user +general\winhec 2017 lab\toaster support app,*,,,Needs input from end user +hid\hidusbfx2,*,,22621,Only NI: Bug 48374115: NI Serviced version of infverif and NI version of Windows Driver Samples should be compatible +hid\vhidmini2,*,,22621,Only NI: Bug 48374115: NI Serviced version of infverif and NI version of Windows Driver Samples should be compatible +network\trans\stmedit,*,,,Invalid Win32 architecture +network\trans\wfpsampler,*,,,Missing INF section; missing libs +network\wlan\wdi,*,,,Invalid architecture +print\oem printer customization plug-in samples\c++,*,,,Invalid architecture +print\v4printdriversamples\printerextensionsample,*,,,Invalid architecture +storage\class\cdrom,*,26031,,Only GE: Fails to build +tree,*,,,Missing headers +video\indirectdisplay,*|arm64,,,Only arm64: Warning C4530: C++ exception handler used but unwind semantics are not enabled -- cgit v1.3.1