Sync eng/common directory with azure-sdk-tools for PR 9290 (#6158)
* identify and resolve missing function GenerateMatrixForConfig * identify and resolve miss-used null-coalesce operator --------- Co-authored-by: Scott Beddall <scbedd@microsoft.com>
This commit is contained in:
Родитель
1bc37d0627
Коммит
9d76fb6c61
|
@ -64,7 +64,9 @@ $packageProperties = Get-ChildItem -Recurse "$PackagePropertiesFolder" *.json `
|
|||
|
||||
# set default matrix config for each package if there isn't an override
|
||||
$packageProperties | ForEach-Object {
|
||||
$_.CIMatrixConfigs = $_.CIMatrixConfigs ?? $configs
|
||||
if (-not $_.CIMatrixConfigs) {
|
||||
$_.CIMatrixConfigs = $configs
|
||||
}
|
||||
}
|
||||
|
||||
# The key here is that after we group the packages by the matrix config objects, we can use the first item's MatrixConfig
|
||||
|
|
|
@ -740,3 +740,28 @@ function Get4dMatrixIndex([int]$index, [Array]$dimensions) {
|
|||
return @($page3, $page2, $page1, $remainder)
|
||||
}
|
||||
|
||||
function GenerateMatrixForConfig {
|
||||
param (
|
||||
[Parameter(Mandatory = $true)][string] $ConfigPath,
|
||||
[Parameter(Mandatory = $True)][string] $Selection,
|
||||
[Parameter(Mandatory = $false)][string] $DisplayNameFilter,
|
||||
[Parameter(Mandatory = $false)][array] $Filters,
|
||||
[Parameter(Mandatory = $false)][array] $Replace
|
||||
)
|
||||
$matrixFile = Join-Path $PSScriptRoot ".." ".." ".." ".." $ConfigPath
|
||||
|
||||
$resolvedMatrixFile = Resolve-Path $matrixFile
|
||||
|
||||
$config = GetMatrixConfigFromFile (Get-Content $resolvedMatrixFile -Raw)
|
||||
# Strip empty string filters in order to be able to use azure pipelines yaml join()
|
||||
$Filters = $Filters | Where-Object { $_ }
|
||||
|
||||
[array]$matrix = GenerateMatrix `
|
||||
-config $config `
|
||||
-selectFromMatrixType $Selection `
|
||||
-displayNameFilter $DisplayNameFilter `
|
||||
-filters $Filters `
|
||||
-replace $Replace
|
||||
|
||||
return , $matrix
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче