Skip to content

Commit 1a6b87e

Browse files
committed
Query api view artifact by package info
1 parent 44e1e6a commit 1a6b87e

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

eng/scripts/Language-Settings.ps1

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,17 @@ function Get-java-GithubIoDocIndex()
484484
}
485485

486486
# function is used to filter packages to submit to API view tool
487-
function Find-java-Artifacts-For-Apireview($artifactDir, $pkgName)
487+
# Function pointer name: FindArtifactForApiReviewFn
488+
function Find-java-Artifacts-For-Apireview($artifactDir, $packageInfo)
488489
{
490+
# Check if packageInfo is null first
491+
if (!$packageInfo) {
492+
Write-Host "Package info is null, skipping API review artifact search"
493+
return $null
494+
}
495+
496+
$pkgName = $packageInfo.ArtifactName ?? $packageInfo.Name
497+
489498
# skip spark packages
490499
if ($pkgName.Contains("-spark")) {
491500
return $null
@@ -495,15 +504,21 @@ function Find-java-Artifacts-For-Apireview($artifactDir, $pkgName)
495504
return $null
496505
}
497506

498-
# Find all source jar files in given artifact directory
499-
# Filter for package in "com.azure*" groupId.
500-
$artifactPath = Join-Path $artifactDir "com.azure*" $pkgName
501-
Write-Host "Checking for source jar in artifact path $($artifactPath)"
502-
$files = @(Get-ChildItem -Recurse "${artifactPath}" | Where-Object -FilterScript {$_.Name.EndsWith("sources.jar")})
503-
# And filter for packages in "io.clientcore*" groupId.
504-
# (Is there a way to pass more information here to know the explicit groupId?)
505-
$artifactPath = Join-Path $artifactDir "io.clientcore*" $pkgName
506-
$files += @(Get-ChildItem -Recurse "${artifactPath}" | Where-Object -FilterScript {$_.Name.EndsWith("sources.jar")})
507+
if ($packageInfo) {
508+
$artifactPath = Join-Path $artifactDir $packageInfo.Group $pkgName
509+
$files = @(Get-ChildItem "${artifactPath}" | Where-Object -FilterScript {$_.Name.EndsWith("sources.jar")})
510+
} else {
511+
# Find all source jar files in given artifact directory
512+
# Filter for package in "com.azure*" groupId.
513+
$artifactPath = Join-Path $artifactDir "com.azure*" $pkgName
514+
Write-Host "Checking for source jar in artifact path $($artifactPath)"
515+
$files = @(Get-ChildItem -Recurse "${artifactPath}" | Where-Object -FilterScript {$_.Name.EndsWith("sources.jar")})
516+
# And filter for packages in "io.clientcore*" groupId.
517+
# (Is there a way to pass more information here to know the explicit groupId?)
518+
$artifactPath = Join-Path $artifactDir "io.clientcore*" $pkgName
519+
$files += @(Get-ChildItem -Recurse "${artifactPath}" | Where-Object -FilterScript {$_.Name.EndsWith("sources.jar")})
520+
}
521+
507522
if (!$files)
508523
{
509524
Write-Host "$($artifactPath) does not have any package"
@@ -643,6 +658,7 @@ function Update-java-GeneratedSdks([string]$PackageDirectoriesFile) {
643658
}
644659
}
645660

661+
# Function pointer: IsApiviewStatusCheckRequiredFn
646662
function Get-java-ApiviewStatusCheckRequirement($packageInfo) {
647663
if ($packageInfo.IsNewSdk -and ($packageInfo.SdkType -eq "client" -or $packageInfo.SdkType -eq "spring")) {
648664
return $true

0 commit comments

Comments
 (0)