diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index 3cba14474fa2..53c170404e1a 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -79,7 +79,7 @@ jobs: Codeql.BuildIdentifier: ${{ parameters.ServiceDirectory }} Codeql.SkipTaskAutoInjection: false SDKType: ${{ parameters.SDKType }} - + # Only run CG and codeql on internal build job ${{ if eq(variables['System.TeamProject'], 'internal') }}: templateContext: @@ -260,7 +260,9 @@ jobs: - template: /eng/common/pipelines/templates/steps/create-apireview.yml parameters: - Artifacts: ${{parameters.ReleaseArtifacts}} + PackageInfoFiles: + - ${{ each artifact in parameters.ReleaseArtifacts }}: + - $(Build.ArtifactStagingDirectory)/PackageInfo/${{artifact.name}}.json - template: /eng/common/pipelines/templates/steps/detect-api-changes.yml diff --git a/eng/pipelines/templates/stages/archetype-java-release-batch.yml b/eng/pipelines/templates/stages/archetype-java-release-batch.yml index 352a80d181bb..b2cbc0021636 100644 --- a/eng/pipelines/templates/stages/archetype-java-release-batch.yml +++ b/eng/pipelines/templates/stages/archetype-java-release-batch.yml @@ -277,8 +277,10 @@ stages: - template: /eng/common/pipelines/templates/steps/create-apireview.yml parameters: + PackageInfoFiles: + - ${{ each artifact in parameters.Artifacts }}: + - $(Pipeline.Workspace)/packages-signed/PackageInfo/${{artifact.name}}.json ArtifactPath: $(Pipeline.Workspace)/packages-signed - Artifacts: ${{parameters.Artifacts}} ConfigFileDir: $(Pipeline.Workspace)/packages-signed/PackageInfo MarkPackageAsShipped: true ArtifactName: packages-signed diff --git a/eng/pipelines/templates/stages/archetype-java-release-patch.yml b/eng/pipelines/templates/stages/archetype-java-release-patch.yml index eedda64b29c6..d428dd9310fb 100644 --- a/eng/pipelines/templates/stages/archetype-java-release-patch.yml +++ b/eng/pipelines/templates/stages/archetype-java-release-patch.yml @@ -175,8 +175,10 @@ stages: ArtifactPath: $(Pipeline.Workspace)/packages-signed - template: /eng/common/pipelines/templates/steps/create-apireview.yml parameters: + PackageInfoFiles: + - ${{ each artifact in parameters.Artifacts }}: + - $(Pipeline.Workspace)/packages-signed/PackageInfo/${{artifact.name}}.json ArtifactPath: $(Pipeline.Workspace)/packages-signed - Artifacts: ${{parameters.Artifacts}} ConfigFileDir: $(Pipeline.Workspace)/packages-signed/PackageInfo MarkPackageAsShipped: true ArtifactName: packages-signed diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index 4068c4719be4..9429ca370f98 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -484,8 +484,17 @@ 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, $packageInfo) { + # Check if packageInfo is null first + if (!$packageInfo) { + Write-Host "Package info is null, skipping API review artifact search" + return $null + } + + $pkgName = $packageInfo.ArtifactName ?? $packageInfo.Name + # skip spark packages if ($pkgName.Contains("-spark")) { return $null @@ -495,15 +504,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 $pkgName + $files = @(Get-ChildItem "${artifactPath}" | Where-Object -FilterScript {$_.Name.EndsWith("sources.jar")}) + } 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" @@ -643,6 +658,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