@@ -26,8 +26,8 @@ class PackageProps {
2626 $this.Initialize ($name , $version , $directoryPath , $serviceDirectory )
2727 }
2828
29- PackageProps([string ]$name , [string ]$version , [string ]$directoryPath , [string ]$serviceDirectory , [string ]$group = " " ) {
30- $this.Initialize ($name , $version , $directoryPath , $serviceDirectory , $group )
29+ PackageProps([string ]$name , [string ]$version , [string ]$directoryPath , [string ]$serviceDirectory , [string ]$group = " " , [ string ] $artifactName = " " ) {
30+ $this.Initialize ($name , $version , $directoryPath , $serviceDirectory , $group , $artifactName )
3131 }
3232
3333 hidden [void ]Initialize(
@@ -70,20 +70,32 @@ class PackageProps {
7070 [string ]$version ,
7171 [string ]$directoryPath ,
7272 [string ]$serviceDirectory ,
73- [string ]$group
73+ [string ]$group ,
74+ [string ]$artifactName
7475 ) {
75- $this.Initialize ($name , $version , $directoryPath , $serviceDirectory )
7676 $this.Group = $group
77+ $this.ArtifactName = $artifactName
78+ $this.Initialize ($name , $version , $directoryPath , $serviceDirectory )
7779 }
78-
7980 hidden [PSCustomObject ]ParseYmlForArtifact([string ]$ymlPath ) {
8081 $content = LoadFrom- Yaml $ymlPath
8182 if ($content ) {
8283 $artifacts = GetValueSafelyFrom- Yaml $content @ (" extends" , " parameters" , " Artifacts" )
8384 $artifactForCurrentPackage = $null
84-
8585 if ($artifacts ) {
86- $artifactForCurrentPackage = $artifacts | Where-Object { $_ [" name" ] -eq $this.ArtifactName -or $_ [" name" ] -eq $this.Name }
86+ # If there's an artifactName match that to the name field from the yml
87+ if ($this.ArtifactName ) {
88+ # Additionally, if there's a group, then the group and artifactName need to match the groupId and name in the yml
89+ if ($this.Group ) {
90+ $artifactForCurrentPackage = $artifacts | Where-Object { $_ [" name" ] -eq $this.ArtifactName -and $_ [" groupId" ] -eq $this.Group }
91+ } else {
92+ # just matching the artifactName
93+ $artifactForCurrentPackage = $artifacts | Where-Object { $_ [" name" ] -eq $this.ArtifactName }
94+ }
95+ } else {
96+ # This is the default, match the Name to the name field from the yml
97+ $artifactForCurrentPackage = $artifacts | Where-Object { $_ [" name" ] -eq $this.Name }
98+ }
8799 }
88100
89101 # if we found an artifact for the current package, we should count this ci file as the source of the matrix for this package
0 commit comments