@@ -32,7 +32,7 @@ function GenerateMatrix(
32
32
[Array ]$filters = @ (),
33
33
[Array ]$nonSparseParameters = @ ()
34
34
) {
35
- $orderedMatrix , $importedMatrix = ProcessImport $config.orderedMatrix $selectFromMatrixType
35
+ $orderedMatrix , $importedMatrix , $importedDisplayNamesLookup = ProcessImport $config.orderedMatrix $selectFromMatrixType
36
36
if ($selectFromMatrixType -eq " sparse" ) {
37
37
[Array ]$matrix = GenerateSparseMatrix $orderedMatrix $config.displayNamesLookup $nonSparseParameters
38
38
} elseif ($selectFromMatrixType -eq " all" ) {
@@ -44,7 +44,7 @@ function GenerateMatrix(
44
44
# Combine with imported after matrix generation, since a sparse selection should result in a full combination of the
45
45
# top level and imported sparse matrices (as opposed to a sparse selection of both matrices).
46
46
if ($importedMatrix ) {
47
- [Array ]$matrix = CombineMatrices $matrix $importedMatrix
47
+ [Array ]$matrix = CombineMatrices $matrix $importedMatrix $importedDisplayNamesLookup
48
48
}
49
49
50
50
if ($config.exclude ) {
@@ -199,19 +199,19 @@ function ProcessIncludes([MatrixConfig]$config, [Array]$matrix)
199
199
function ProcessImport ([System.Collections.Specialized.OrderedDictionary ]$matrix , [String ]$selection )
200
200
{
201
201
if (! $matrix -or ! $matrix.Contains ($IMPORT_KEYWORD )) {
202
- return $matrix
202
+ return $matrix , @ () , @ {}
203
203
}
204
204
205
205
$importPath = $matrix [$IMPORT_KEYWORD ]
206
206
$matrix.Remove ($IMPORT_KEYWORD )
207
207
208
- $matrixConfig = GetMatrixConfigFromJson (Get-Content $importPath )
209
- $importedMatrix = GenerateMatrix $matrixConfig $selection
208
+ $importedMatrixConfig = GetMatrixConfigFromJson (Get-Content $importPath )
209
+ $importedMatrix = GenerateMatrix $importedMatrixConfig $selection
210
210
211
- return $matrix , $importedMatrix
211
+ return $matrix , $importedMatrix , $importedMatrixConfig .displayNamesLookup
212
212
}
213
213
214
- function CombineMatrices ([Array ]$matrix1 , [Array ]$matrix2 )
214
+ function CombineMatrices ([Array ]$matrix1 , [Array ]$matrix2 , [ Hashtable ] $displayNamesLookup = @ {} )
215
215
{
216
216
$combined = @ ()
217
217
if (! $matrix1 ) {
@@ -223,21 +223,22 @@ function CombineMatrices([Array]$matrix1, [Array]$matrix2)
223
223
224
224
foreach ($entry1 in $matrix1 ) {
225
225
foreach ($entry2 in $matrix2 ) {
226
+ $entry2name = @ ()
226
227
$newEntry = @ {
227
228
name = $entry1.name
228
229
parameters = CloneOrderedDictionary $entry1.parameters
229
230
}
230
231
foreach ($param in $entry2.parameters.GetEnumerator ()) {
231
- if (! $newEntry.Contains ($param.Name )) {
232
+ if (! $newEntry.parameters. Contains ($param.Name )) {
232
233
$newEntry.parameters [$param.Name ] = $param.Value
234
+ $entry2name += CreateDisplayName $param.Value $displayNamesLookup
233
235
} else {
234
236
Write-Warning " Skipping duplicate parameter `" $ ( $param.Name ) `" when combining matrix."
235
237
}
236
238
}
237
239
238
240
# The maximum allowed matrix name length is 100 characters
239
- $entry2.name = $entry2.name.TrimStart (" job_" )
240
- $newEntry.name = $newEntry.name , $entry2.name -join " _"
241
+ $newEntry.name = @ ($newEntry.name , ($entry2name -join " _" )) -join " _"
241
242
if ($newEntry.name.Length -gt 100 ) {
242
243
$newEntry.name = $newEntry.name [0 .. 99 ] -join " "
243
244
}
@@ -305,7 +306,7 @@ function GenerateSparseMatrix(
305
306
306
307
if ($nonSparse ) {
307
308
[Array ]$allOfMatrix = GenerateFullMatrix $nonSparse $displayNamesLookup
308
- return CombineMatrices $allOfMatrix $sparseMatrix
309
+ return CombineMatrices $allOfMatrix $sparseMatrix $displayNamesLookup
309
310
}
310
311
311
312
return $sparseMatrix
0 commit comments