Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,8 @@ function Get-java-GithubIoDocIndex()
}

# function is used to filter packages to submit to API view tool
function Find-java-Artifacts-For-Apireview($artifactDir, $pkgName)
# Function pointer name: FindArtifactForApiReviewFn
function Find-java-Artifacts-For-Apireview($artifactDir, $pkgName, $packageInfo = $null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function Find-java-Artifacts-For-Apireview($artifactDir, $pkgName, $packageInfo = $null)
function Find-java-Artifacts-For-Apireview($artifactDir, $packageInfo)

I thought that is what you would have based on your common changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid breaking change and down time, my roll out plan includes three steps:

  1. merge this PR by just adding packageInfo parameter.
  2. merge the PR of apiview pipeline&script changes which take packageInfo parameter
  3. remove the redundant pkgName from this function Find-java-Artifacts-For-Apireview

What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with that but I though your change in eng/common already accounted for this by looking at the parameters and calling the correct function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#2 is another PR I haven't created yet.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created Azure/azure-sdk-tools#12467 for step#2. I can update this PR after merge the former PR for the changes in API-review templates.

{
# skip spark packages
if ($pkgName.Contains("-spark")) {
Expand All @@ -495,15 +496,21 @@ function Find-java-Artifacts-For-Apireview($artifactDir, $pkgName)
return $null
}

# Find all source jar files in given artifact directory
# Filter for package in "com.azure*" groupId.
$artifactPath = Join-Path $artifactDir "com.azure*" $pkgName
Write-Host "Checking for source jar in artifact path $($artifactPath)"
$files = @(Get-ChildItem -Recurse "${artifactPath}" | Where-Object -FilterScript {$_.Name.EndsWith("sources.jar")})
# And filter for packages in "io.clientcore*" groupId.
# (Is there a way to pass more information here to know the explicit groupId?)
$artifactPath = Join-Path $artifactDir "io.clientcore*" $pkgName
$files += @(Get-ChildItem -Recurse "${artifactPath}" | Where-Object -FilterScript {$_.Name.EndsWith("sources.jar")})
if ($packageInfo) {
$artifactPath = Join-Path $artifactDir $packageInfo.Group $packageInfo.ArtifactName
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property access uses $packageInfo.Group but based on the context and typical Java artifact structure, this should likely be $packageInfo.GroupId to match Maven/Gradle conventions for group identifiers.

Suggested change
$artifactPath = Join-Path $artifactDir $packageInfo.Group $packageInfo.ArtifactName
$artifactPath = Join-Path $artifactDir $packageInfo.GroupId $packageInfo.ArtifactName

Copilot uses AI. Check for mistakes.

$files = @(Get-ChildItem "${artifactPath}" | Where-Object -FilterScript {$_.Name.EndsWith("sources.jar")})
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Get-ChildItem command may fail if the $artifactPath directory doesn't exist, but there's no error handling. Consider adding -ErrorAction SilentlyContinue or checking if the path exists before attempting to access it.

Copilot uses AI. Check for mistakes.

} else {
# Find all source jar files in given artifact directory
# Filter for package in "com.azure*" groupId.
$artifactPath = Join-Path $artifactDir "com.azure*" $pkgName
Write-Host "Checking for source jar in artifact path $($artifactPath)"
$files = @(Get-ChildItem -Recurse "${artifactPath}" | Where-Object -FilterScript {$_.Name.EndsWith("sources.jar")})
# And filter for packages in "io.clientcore*" groupId.
# (Is there a way to pass more information here to know the explicit groupId?)
$artifactPath = Join-Path $artifactDir "io.clientcore*" $pkgName
$files += @(Get-ChildItem -Recurse "${artifactPath}" | Where-Object -FilterScript {$_.Name.EndsWith("sources.jar")})
}

if (!$files)
{
Write-Host "$($artifactPath) does not have any package"
Expand Down Expand Up @@ -643,6 +650,7 @@ function Update-java-GeneratedSdks([string]$PackageDirectoriesFile) {
}
}

# Function pointer: IsApiviewStatusCheckRequiredFn
function Get-java-ApiviewStatusCheckRequirement($packageInfo) {
if ($packageInfo.IsNewSdk -and ($packageInfo.SdkType -eq "client" -or $packageInfo.SdkType -eq "spring")) {
return $true
Expand Down