66 [Parameter (mandatory = $false )]
77 [string ]$PackageNames = " " ,
88 [Parameter (mandatory = $false )]
9+ # ServiceDirectory is required when using PackageNames,
10+ # or when Artifacts do not include their own ServiceDirectory property.
911 [string ]$ServiceDirectory ,
1012 [Parameter (mandatory = $false )]
1113 [string ]$TagSeparator = " _" ,
@@ -32,14 +34,15 @@ if ($Artifacts -and $Artifacts.Count -gt 0) {
3234 LogError " Artifact is missing required 'name' property."
3335 exit 1
3436 }
35-
37+
3638 $packageName = $artifact.name
3739 if ([String ]::IsNullOrWhiteSpace($packageName )) {
3840 LogError " Artifact 'name' property is null or empty."
3941 exit 1
4042 }
4143
42- # Check for ServiceDirectory property
44+ $artifactServiceDirectory = $null
45+ # Check for ServiceDirectory property
4346 if (Get-Member - InputObject $artifact - Name ' ServiceDirectory' - MemberType Properties) {
4447 if (! [String ]::IsNullOrWhiteSpace($artifact.ServiceDirectory )) {
4548 $artifactServiceDirectory = $artifact.ServiceDirectory
@@ -65,13 +68,13 @@ if ($Artifacts -and $Artifacts.Count -gt 0) {
6568 LogError " Artifact '$packageName ' is missing required 'groupId' property for Java language."
6669 exit 1
6770 }
68-
71+
6972 $groupId = $artifact.groupId
7073 if ([String ]::IsNullOrWhiteSpace($groupId )) {
7174 LogError " GroupId is missing for package $packageName ."
7275 exit 1
7376 }
74-
77+
7578 Write-Host " Processing $packageName with groupId $groupId "
7679 # Use groupId+artifactName format for tag prefix (e.g., "com.azure.v2+azure-sdk-template_")
7780 $prefix = " $groupId +$packageName$TagSeparator "
@@ -123,6 +126,7 @@ if ($Artifacts -and $Artifacts.Count -gt 0) {
123126 LogError " ServiceDirectory is required when using PackageNames."
124127 exit 1
125128 }
129+
126130 $packageNamesArray = $PackageNames.Split (' ,' )
127131 foreach ($packageName in $packageNamesArray ) {
128132 Write-Host " Processing $packageName "
0 commit comments