@@ -26,8 +26,8 @@ class PackageProps {
26
26
$this.Initialize ($name , $version , $directoryPath , $serviceDirectory )
27
27
}
28
28
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 )
31
31
}
32
32
33
33
hidden [void ]Initialize(
@@ -70,20 +70,32 @@ class PackageProps {
70
70
[string ]$version ,
71
71
[string ]$directoryPath ,
72
72
[string ]$serviceDirectory ,
73
- [string ]$group
73
+ [string ]$group ,
74
+ [string ]$artifactName
74
75
) {
75
- $this.Initialize ($name , $version , $directoryPath , $serviceDirectory )
76
76
$this.Group = $group
77
+ $this.ArtifactName = $artifactName
78
+ $this.Initialize ($name , $version , $directoryPath , $serviceDirectory )
77
79
}
78
-
79
80
hidden [PSCustomObject ]ParseYmlForArtifact([string ]$ymlPath ) {
80
81
$content = LoadFrom- Yaml $ymlPath
81
82
if ($content ) {
82
83
$artifacts = GetValueSafelyFrom- Yaml $content @ (" extends" , " parameters" , " Artifacts" )
83
84
$artifactForCurrentPackage = $null
84
-
85
85
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
+ }
87
99
}
88
100
89
101
# 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