Sync eng/common directory with azure-sdk-tools for PR 10081 (#6473)

* update generate-matrix function ProcessImport to return a structured result, versus a tuple that is destructured immediately

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
Co-authored-by: Scott Beddall <45376673+scbedd@users.noreply.github.com>
This commit is contained in:
Azure SDK Bot 2025-03-19 14:53:35 -07:00 committed by GitHub
parent e05a88682d
commit bebf2310f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -99,8 +99,12 @@ function GenerateMatrix(
[Array]$nonSparseParameters = @(),
[Switch]$skipEnvironmentVariables
) {
$matrixParameters, $importedMatrix, $combinedDisplayNameLookup = `
ProcessImport $config.matrixParameters $selectFromMatrixType $nonSparseParameters $config.displayNamesLookup
$result = ProcessImport $config.matrixParameters $selectFromMatrixType $nonSparseParameters $config.displayNamesLookup
$matrixParameters = $result.Matrix
$importedMatrix = $result.ImportedMatrix
$combinedDisplayNameLookup = $result.DisplayNamesLookup
if ($selectFromMatrixType -eq "sparse") {
$matrix = GenerateSparseMatrix $matrixParameters $config.displayNamesLookup $nonSparseParameters
}
@ -144,6 +148,9 @@ function ProcessNonSparseParameters(
$nonSparse = [MatrixParameter[]]@()
foreach ($param in $parameters) {
if ($null -eq $param){
continue
}
if ($param.Name -in $nonSparseParameters) {
$nonSparse += $param
}
@ -422,7 +429,11 @@ function ProcessImport([MatrixParameter[]]$matrix, [String]$selection, [Array]$n
}
}
if ((!$matrix -and !$importPath) -or !$importPath) {
return $matrix, @(), $displayNamesLookup
return [PSCustomObject]@{
Matrix = $matrix
ImportedMatrix = @()
DisplayNamesLookup = $displayNamesLookup
}
}
if (!(Test-Path $importPath)) {
@ -444,7 +455,11 @@ function ProcessImport([MatrixParameter[]]$matrix, [String]$selection, [Array]$n
$combinedDisplayNameLookup[$lookup.Name] = $lookup.Value
}
return $matrix, $importedMatrix, $combinedDisplayNameLookup
return [PSCustomObject]@{
Matrix = $matrix ?? @()
ImportedMatrix = $importedMatrix
DisplayNamesLookup = $combinedDisplayNameLookup
}
}
function CombineMatrices([Array]$matrix1, [Array]$matrix2, [Hashtable]$displayNamesLookup = @{}) {
@ -628,6 +643,9 @@ function InitializeMatrix {
function GetMatrixDimensions([MatrixParameter[]]$parameters) {
$dimensions = @()
foreach ($param in $parameters) {
if ($null -eq $param){
continue
}
$dimensions += $param.Length()
}