@@ -40,12 +40,13 @@ param (
4040 [Parameter (Mandatory = $true )][string ] $PackagePropertiesFolder ,
4141 [Parameter (Mandatory = $true )][string ] $PRMatrixFile ,
4242 [Parameter (Mandatory = $true )][string ] $PRMatrixSetting ,
43- [Parameter (Mandatory = $False )][string ] $DisplayNameFilter ,
44- [Parameter (Mandatory = $False )][array ] $Filters ,
45- [Parameter (Mandatory = $False )][array ] $IndirectFilters ,
46- [Parameter (Mandatory = $False )][array ] $Replace ,
47- [Parameter (Mandatory = $False )][bool ] $SparseIndirect = $true ,
48- [Parameter (Mandatory = $False )][int ] $PackagesPerPRJob = 10 ,
43+ [Parameter (Mandatory = $false )][string ] $DisplayNameFilter ,
44+ [Parameter (Mandatory = $false )][array ] $Filters ,
45+ [Parameter (Mandatory = $false )][array ] $IndirectFilters ,
46+ [Parameter (Mandatory = $false )][array ] $Replace ,
47+ [Parameter (Mandatory = $false )][string ] $PRMatrixKey = " ArtifactName" ,
48+ [Parameter (Mandatory = $false )][bool ] $SparseIndirect = $true ,
49+ [Parameter (Mandatory = $false )][int ] $PackagesPerPRJob = 10 ,
4950 [Parameter ()][switch ] $CI = ($null -ne $env: SYSTEM_TEAMPROJECTID )
5051)
5152
@@ -74,6 +75,7 @@ function QueuePop([ref]$queue) {
7475function GeneratePRMatrixForBatch {
7576 param (
7677 [Parameter (Mandatory = $true )][array ] $Packages ,
78+ [Parameter (Mandatory = $true )][array ] $MatrixKey ,
7779 [Parameter (Mandatory = $false )][bool ] $FullSparseMatrix = $false
7880 )
7981
@@ -104,7 +106,7 @@ function GeneratePRMatrixForBatch {
104106 $matrixResults = @ ()
105107
106108 if (! $matrixConfig ) {
107- Write-Error " Unable to find matrix config for $matrixBatchKey . Check the package properties for the package $ ( $matrixBatch [0 ].ArtifactName ) ."
109+ Write-Error " Unable to find matrix config for $matrixBatchKey . Check the package properties for the package $ ( $matrixBatch [0 ].( $MatrixKey ) ) ."
108110 exit 1
109111 }
110112
@@ -166,7 +168,7 @@ function GeneratePRMatrixForBatch {
166168 $batchCounter = 1
167169
168170 foreach ($batch in $packageBatches ) {
169- $namesForBatch = ($batch | ForEach-Object { $_.ArtifactName }) -join " ,"
171+ $namesForBatch = ($batch | ForEach-Object { $_ .( $MatrixKey ) }) -join " ,"
170172
171173 foreach ($matrixOutputItem in $matrixResults ) {
172174 # we need to clone this, as each item is an object with possible children
@@ -195,7 +197,7 @@ function GeneratePRMatrixForBatch {
195197 $batchSuffixNecessary = $packageBatches.Length -gt 0
196198 $batchCounter = 1
197199 foreach ($batch in $packageBatches ) {
198- $namesForBatch = ($batch | ForEach-Object { $_.ArtifactName }) -join " ,"
200+ $namesForBatch = ($batch | ForEach-Object { $_ .( $MatrixKey ) }) -join " ,"
199201 $outputItem = QueuePop - queue ([ref ]$matrixResults )
200202
201203 $outputItem [" parameters" ][" $PRMatrixSetting " ] = $namesForBatch
@@ -228,7 +230,7 @@ if (!(Test-Path $PRMatrixFile)) {
228230 exit 1
229231}
230232
231- Write-Host " Generating PR job matrix for $PackagePropertiesFolder "
233+ Write-Host " Generating PR job matrix for $PackagePropertiesFolder using accesskey $PRMatrixKey to determine artifact batches. "
232234
233235$configs = Get-Content - Raw $PRMatrixFile | ConvertFrom-Json
234236
@@ -251,16 +253,16 @@ $OverallResult = @()
251253if ($directPackages ) {
252254 Write-Host " Discovered $ ( $directPackages.Length ) direct packages"
253255 foreach ($artifact in $directPackages ) {
254- Write-Host " -> $ ( $artifact.ArtifactName ) "
256+ Write-Host " -> $ ( $artifact .( $PRMatrixKey ) ) "
255257 }
256- $OverallResult += (GeneratePRMatrixForBatch - Packages $directPackages ) ?? @ ()
258+ $OverallResult += (GeneratePRMatrixForBatch - Packages $directPackages - MatrixKey $PRMatrixKey ) ?? @ ()
257259}
258260if ($indirectPackages ) {
259261 Write-Host " Discovered $ ( $indirectPackages.Length ) indirect packages"
260262 foreach ($artifact in $indirectPackages ) {
261- Write-Host " -> $ ( $artifact.ArtifactName ) "
263+ Write-Host " -> $ ( $artifact .( $PRMatrixKey ) ) "
262264 }
263- $OverallResult += (GeneratePRMatrixForBatch - Packages $indirectPackages - FullSparseMatrix (-not $SparseIndirect )) ?? @ ()
265+ $OverallResult += (GeneratePRMatrixForBatch - Packages $indirectPackages - MatrixKey $PRMatrixKey - FullSparseMatrix (-not $SparseIndirect )) ?? @ ()
264266}
265267$serialized = SerializePipelineMatrix $OverallResult
266268
0 commit comments