forked from microsoft/WPF-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AzurePipelinesMatrixGenerator.ps1
32 lines (27 loc) · 1.03 KB
/
AzurePipelinesMatrixGenerator.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<# Configuration Generator for azure-pipelines.xml #>
Function IIf($If, $Then, $Else) {
If ($If -IsNot "Boolean") {$_ = $If}
If ($If) {If ($Then -is "ScriptBlock") {&$Then} Else {$Then}}
Else {If ($Else -is "ScriptBlock") {&$Else} Else {$Else}}
}
$config = @('Debug', 'Release')
$platform = @('Any CPU', 'x86', 'x64')
$tfm = @('netcoreapp3.1', 'net6.0-windows')
$entries = @{}
foreach ($configItem in $config) {
foreach ($platformItem in $platform) {
foreach($tfmItem in $tfm){
$entries."$configItem-$platformItem-$tfmItem" = @{config=$configItem;platform=$platformItem;tfm=$tfmItem}
}
}
}
clear-host
$entries.keys | sort | foreach {
[string]$item = $PSItem
$item = $item.Replace(' ', '')
" $item`:"
" _Configuration: $($entries[$PSItem].config)"
" _Platform: `'$($entries[$PSItem].platform)`'"
" _TargetFramework: `'$($entries[$PSItem].tfm)`'"
" _ToolPlatform: " + (IIf ($($entries[$PSItem].platform) -ieq 'Any CPU') "x86" $($entries[$PSItem].platform))
}