diff options
| author | 5an7y <[email protected]> | 2026-03-27 16:04:47 -0700 |
|---|---|---|
| committer | 5an7y <[email protected]> | 2026-03-27 16:04:47 -0700 |
| commit | 302d18984142a22d5195105fe0347eb5b145d859 (patch) | |
| tree | 6e9ce44741bad6fe6da4eebad1a8477bc20f840f | |
| parent | 9cd8d031aa48669e9e3cc11886d856ce52d6ce20 (diff) | |
Remove Samples.txt: discover samples dynamically via ListAllSamples
- ListAllSamples.ps1: output sorted sample names to stdout instead of
writing Samples.txt. The file output is replaced with Write-Output
so callers can capture results via pipeline or command substitution.
- Build-Samples.ps1: remove SampleListPath parameter. Default discovery
now calls ListAllSamples.ps1 at runtime and consumes its stdout.
Explicit -Samples array still works and is sorted alphabetically.
Both paths guarantee a consistent alphabetical sample ordering.
- Samples.txt: deleted. No longer needed as a pre-generated artifact.
WDS_TestPass.cs is unaffected - it only passes -LogFilesDirectory and
-InfOptions, neither of which changed.
Co-authored-by: Copilot <[email protected]>
| -rw-r--r-- | Build-Samples.ps1 | 33 | ||||
| -rw-r--r-- | ListAllSamples.ps1 | 14 | ||||
| -rw-r--r-- | Samples.txt | 134 |
3 files changed, 21 insertions, 160 deletions
diff --git a/Build-Samples.ps1 b/Build-Samples.ps1 index 6fd86bd3..aad2d3e5 100644 --- a/Build-Samples.ps1 +++ b/Build-Samples.ps1 @@ -6,7 +6,7 @@ This is the main build orchestrator for driver samples. It performs these steps: 1. Ensures a developer build environment (VS DevShell or EWDK) is active - 2. Reads sample names from Samples.txt (or a specified file/array) + 2. Discovers samples via ListAllSamples.ps1 (or uses the -Samples parameter if provided) 3. Detects the build environment (GitHub CI, NuGet, EWDK, or WDK) and build number 4. Loads exclusions from exclusions.csv (supports wildcard paths) 5. Builds all non-excluded sample/configuration/platform combinations in parallel @@ -15,15 +15,12 @@ Requires PowerShell 7+ (uses ForEach-Object -Parallel). Typical call chain: - Build-AllSamples.ps1 -> ListAllSamples.ps1 -> Build-Samples.ps1 -> Build-Sample.ps1 - (this script) + Build-AllSamples.ps1 -> Build-Samples.ps1 -> ListAllSamples.ps1 (for discovery) + (this script) -> Build-Sample.ps1 (per sample) -.PARAMETER SampleListPath - Path to the file containing sample names (one per line, dot-separated). - Defaults to Samples.txt in the current directory. .PARAMETER Samples - Optional array of specific sample names to build. When provided, overrides SampleListPath. + Optional array of specific sample names to build. When omitted, all samples are discovered dynamically via ListAllSamples.ps1. .PARAMETER Configurations Build configurations (e.g. 'Debug','Release'). Defaults to $env:WDS_Configuration or @@ -49,7 +46,7 @@ .EXAMPLE .\Build-Samples - Builds all samples from Samples.txt with default settings. + Discovers all samples via ListAllSamples.ps1 and builds them with default settings. .EXAMPLE .\Build-Samples -Samples 'audio.acx.samples.audiocodec.driver','usb.kmdf_fx2' -Configurations 'Debug' -Platforms 'x64' @@ -57,16 +54,15 @@ Builds specific samples for a single configuration and platform. .EXAMPLE - .\Build-Samples -SampleListPath .\MySamples.txt -ThrottleLimit 8 + .\Build-Samples -ThrottleLimit 8 - Builds samples from a custom list with limited parallelism. + Discovers all samples and builds them with limited parallelism. #> #Requires -Version 7.0 [CmdletBinding()] param( - [string]$SampleListPath = (Join-Path (Get-Location) "Samples.txt"), [string[]]$Samples, [string[]]$Configurations = @(if ([string]::IsNullOrEmpty($env:WDS_Configuration)) { ('Debug', 'Release') } else { $env:WDS_Configuration }), [string[]]$Platforms = @(if ([string]::IsNullOrEmpty($env:WDS_Platform)) { ('x64', 'arm64') } else { $env:WDS_Platform }), @@ -282,14 +278,15 @@ $reportCsvPath = Join-Path $LogFilesDirectory "$ReportFileName.csv" # ============================================================================= if ($Samples) { - $sampleNames = $Samples + # Explicit list passed by the caller — use as-is, sorted alphabetically. + $sampleNames = $Samples | Sort-Object } else { - if (-not (Test-Path $SampleListPath)) { - Write-Error "Sample list not found: $SampleListPath. Run .\ListAllSamples.ps1 first." - exit 1 - } - $sampleNames = Get-Content $SampleListPath | Where-Object { -not [string]::IsNullOrWhiteSpace($_) } + # Default: discover samples dynamically via ListAllSamples.ps1. + # ListAllSamples outputs one alphabetically-sorted sample name per line to stdout. + Write-Verbose "No -Samples provided. Discovering samples via ListAllSamples.ps1..." + $sampleNames = & (Join-Path $PSScriptRoot 'ListAllSamples.ps1') -Verbose:$verbose | + Where-Object { -not [string]::IsNullOrWhiteSpace($_) } } # Map sample names to directory paths, validating each exists @@ -307,7 +304,7 @@ foreach ($name in $sampleNames) { } if ($sampleSet.Count -eq 0) { - Write-Error "No valid sample directories found. Verify Samples.txt and current directory." + Write-Error "No valid sample directories found. Ensure ListAllSamples.ps1 is available in the repo root." exit 1 } diff --git a/ListAllSamples.ps1 b/ListAllSamples.ps1 index f533c080..1a1a4a78 100644 --- a/ListAllSamples.ps1 +++ b/ListAllSamples.ps1 @@ -1,11 +1,11 @@ <# .SYNOPSIS - Enumerates all available sample solutions in the repository and writes them to Samples.txt. + Enumerates all available sample solutions in the repository and writes them to the console. .DESCRIPTION Searches for all .sln files recursively from the repo root, excludes NuGet package directories (paths containing 'packages' as a segment), computes a normalized sample name for each, and writes - the sorted list to Samples.txt (one sample name per line). + the sorted list to stdout (one sample name per line). The sample name is derived from the relative directory path: backslashes are replaced with dots and the result is lowercased. @@ -13,10 +13,10 @@ .EXAMPLE .\ListAllSamples - Discovers all samples and writes Samples.txt to the repo root. + Discovers all samples and writes the sorted names to the console. .OUTPUTS - Samples.txt in the current working directory. + Sorted sample names written to stdout, one per line. #> [CmdletBinding()] @@ -45,7 +45,5 @@ foreach ($file in $solutionFiles) { $sortedNames = $sampleNames.Keys | Sort-Object -$outputPath = Join-Path $root "Samples.txt" -$sortedNames | Out-File -FilePath $outputPath -Encoding utf8 - -Write-Output "Found $($sortedNames.Count) samples. Written to Samples.txt" +Write-Verbose "Found $($sortedNames.Count) samples." +$sortedNames | Write-Output diff --git a/Samples.txt b/Samples.txt deleted file mode 100644 index 571b6b4c..00000000 --- a/Samples.txt +++ /dev/null @@ -1,134 +0,0 @@ -audio.acx.samples.audiocodec.driver -audio.simpleaudiosample -audio.soundwire.samples.sdcavad -audio.sysvad -avstream.avscamera -avstream.avshws -avstream.avssamp -avstream.sampledevicemft -avstream.samplemft0 -bluetooth.bthecho -bluetooth.serialhcibus -filesys.cdfs -filesys.fastfat -filesys.minifilter.avscan -filesys.minifilter.cancelsafe -filesys.minifilter.cdo -filesys.minifilter.change -filesys.minifilter.ctx -filesys.minifilter.delete -filesys.minifilter.metadatamanager -filesys.minifilter.minispy -filesys.minifilter.namechanger -filesys.minifilter.nullfilter -filesys.minifilter.passthrough -filesys.minifilter.scanner -filesys.minifilter.simrep -filesys.minifilter.swapbuffers -general.cancel -general.dchu.osrfx2_dchu_base -general.dchu.osrfx2_dchu_extension_loose -general.dchu.osrfx2_dchu_extension_tight -general.echo.kmdf -general.echo.umdf2 -general.event -general.ioctl.kmdf -general.ioctl.wdm -general.obcallback -general.pcidrv -general.perfcounters.kcs -general.plx9x5x -general.registry.regfltr -general.simplemediasource -general.systemdma.wdm -general.toaster.toastdrv -general.toaster.toastpkg -general.toaster.umdf2 -general.tracing.evntdrv -general.tracing.systemtracecontrol -general.tracing.tracedriver -gnss -gpio.samples -hid.firefly -hid.hclient -hid.hidusbfx2 -hid.vhidmini2 -input.kbfiltr -input.layout -input.moufiltr -network.config.bindview -network.modem.fakemodem -network.ndis.extension -network.ndis.filter -network.ndis.mux -network.ndis.ndisprot_kmdf -network.ndis.ndisprot.6x -network.ndis.netvmini.6x -network.radio.radiomanagersample -network.trans.ddproxy -network.trans.inspect -network.trans.msnmntr -network.trans.stmedit -network.trans.wfpsampler -network.wlan.wdi -network.wsk.echosrv -network.wwan.cxwmbclass -nfc.nfccxsample -nfp.net -pofx.pep -pofx.umdf2 -pofx.wdf -pos.drivers.barcodescanner -pos.drivers.magneticstripereader -powerlimit.plclient -powerlimit.plpolicy -prm -sd.miniport.sdhc -security.elam -sensors.activity -sensors.adxl345acc -sensors.customsensors -sensors.fusion -sensors.pedometer -sensors.sensorscombodriver -sensors.simpledeviceorientationsensor -serial.serenum -serial.serial -serial.virtualserial2 -setup.devcon -simbatt.func -smartcrd -spb.skeletoni2c -spb.spbtesttool -storage.class.classpnp -storage.class.disk -storage.iscsi -storage.miniports.lsi_u3 -storage.miniports.storahci -storage.msdsm -storage.tools.spti -thermal.simsensor -thermal.thermalclient -tools.dv.samples.dv-faildriver-wdm.driver -tools.kasan.samples.kasandemo-wdm -tools.sdv.samples.sdv-faildriver-kmdf -tools.sdv.samples.sdv-faildriver-ndis -tools.sdv.samples.sdv-faildriver-storport -tools.sdv.samples.sdv-faildriver-wdm -tree -usb.kmdf_enumswitches -usb.kmdf_fx2 -usb.ucmcxucsi -usb.ucmtcpcicxclientsample -usb.ucmucsiacpisample -usb.ufxclientsample -usb.umdf2_fx2 -usb.usbsamp -usb.usbview -usb.wdf_osrfx2_lab -video.archive.pixlib -video.indirectdisplay -video.kmdod -wia -wmi.wmiacpi -wmi.wmisamp |
