summaryrefslogtreecommitdiff
path: root/Build-AllSamples.ps1
diff options
context:
space:
mode:
authorJakobL-MSFT <[email protected]>2023-02-03 14:43:16 -0800
committerGitHub <[email protected]>2023-02-03 14:43:16 -0800
commit08607873c07b796e912560b7fa359b06e1a21404 (patch)
treee02ca7474a93ab367dc6aee544081b6720a08bd1 /Build-AllSamples.ps1
parent07779ee84973f2f63a1f2ced6377463b1c01baaf (diff)
Incremental improvements of the sample build system (#849)
Diffstat (limited to 'Build-AllSamples.ps1')
-rw-r--r--Build-AllSamples.ps127
1 files changed, 19 insertions, 8 deletions
diff --git a/Build-AllSamples.ps1 b/Build-AllSamples.ps1
index d857c641..fb876d99 100644
--- a/Build-AllSamples.ps1
+++ b/Build-AllSamples.ps1
@@ -5,14 +5,17 @@ Builds all available sample solutions in the repository (excluding specific solu
.DESCRIPTION
This script searches for all available Visual Studio Solutions (.sln files) and attempts to run MSBuild to build them for the specified configurations and platforms.
+.PARAMETER Samples
+A regular expression matching the samples to be built. Default is '' that matches all samples. Examples include '^tools.' or '.dchu'.
+
.PARAMETER Configurations
-A list of configurations to build samples under. Values available are "Debug" and "Release". By default, $env:Configuration will be used as the sole configuration to build for. If this value doesn't exist, "Debug" will be used instead.
+A list of configurations to build samples under. Values available are 'Debug' and 'Release'. By default, $env:Configuration will be used as the sole configuration to build for. If this environment variable is not set the default is 'Debug' and 'Release'.
.PARAMETER Platforms
-A list of platforms to build samples under (e.g. "x64", "arm64"). By default, $env:Platform will be used as the sole platform to build for. If this value doesn't exist, "x64" will be used instead.
+A list of platforms to build samples under (e.g. 'x64', 'arm64'). By default, $env:Platform will be used as the sole platform to build for. If this environment variable is not set the default is 'x64' and'arm64'.
.PARAMETER LogFilesDirectory
-Path to a directory where the log files will be written to. If not provided, outputs will be logged to the "_logs" directory within the current working directory.
+Path to a directory where the log files will be written to. If not provided, outputs will be logged to the '_logs' directory within the current working directory.
.INPUTS
None.
@@ -24,14 +27,15 @@ None.
.\Build-AllSamples
.EXAMPLE
-.\Build-AllSamples -Configurations 'Debug','Release' -Platforms 'x64','arm64' -LogFilesDirectory .\_logs
+.\Build-AllSamples -Samples '^tools.' -Configurations 'Debug','Release' -Platforms 'x64','arm64' -LogFilesDirectory .\_logs
#>
[CmdletBinding()]
param(
- [string[]]$Configurations = @([string]::IsNullOrEmpty($env:Configuration) ? "Debug" : $env:Configuration),
- [string[]]$Platforms = @([string]::IsNullOrEmpty($env:Platform) ? "x64" : $env:Platform),
+ [string]$Samples = "",
+ [string[]]$Configurations = @([string]::IsNullOrEmpty($env:Configuration) ? ('Debug','Release') : $env:Configuration),
+ [string[]]$Platforms = @([string]::IsNullOrEmpty($env:Platform) ? ('x64','arm64') : $env:Platform),
[string]$LogFilesDirectory = (Join-Path (Get-Location) "_logs")
)
@@ -48,8 +52,15 @@ $sampleSet = @{}
foreach ($file in $solutionFiles) {
$dir = (Get-Item $file).DirectoryName
$dir_norm = $dir.Replace($root, '').Trim('\').Replace('\', '.').ToLower()
- Write-Verbose "`u{1F50E} Found sample [$dir_norm] at $dir"
- $sampleSet[$dir_norm] = $dir
+ if($dir_norm -match ($Samples))
+ {
+ Write-Verbose "`u{1F50E} Found and included sample [$dir_norm] at $dir"
+ $sampleSet[$dir_norm] = $dir
+ }
+ else
+ {
+ Write-Verbose "`u{1F50E} Found and excluded sample [$dir_norm] at $dir"
+ }
}