From 2e45eba69fc3f80ef8f33af47915c38fadd0b6b0 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Tue, 16 Apr 2024 11:01:57 -0700 Subject: [PATCH 01/22] Move from using the docker image to java2docfx for docs validation --- eng/pipelines/docindex.yml | 24 +- .../stages/archetype-java-release-batch.yml | 28 +- .../stages/archetype-java-release-patch.yml | 4 +- .../stages/archetype-java-release.yml | 12 +- .../steps/install-rex-validation-tool.yml | 9 + .../steps/mvn-linux-settings-for-docs.yml | 21 + eng/repo-docs/docms/daily.update.setting.xml | 10 + eng/scripts/Language-Settings.ps1 | 481 +++--------------- eng/scripts/docs/java2docfx.version.txt | 1 + 9 files changed, 127 insertions(+), 463 deletions(-) create mode 100644 eng/pipelines/templates/steps/install-rex-validation-tool.yml create mode 100644 eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml create mode 100644 eng/scripts/docs/java2docfx.version.txt diff --git a/eng/pipelines/docindex.yml b/eng/pipelines/docindex.yml index 0cb3f6205908..c128f858955d 100644 --- a/eng/pipelines/docindex.yml +++ b/eng/pipelines/docindex.yml @@ -13,7 +13,6 @@ jobs: DailyDocRepoLocation: $(Pipeline.Workspace)/daily DocRepoOwner: Azure DocRepoName: azure-docs-sdk-java - DocValidationImageId: azuresdkimages.azurecr.io/javarefautocr:latest steps: # Sync docs repo onboarding files/folders - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml @@ -29,10 +28,6 @@ jobs: WorkingDirectory: $(DocRepoLocation) - Name: azure-sdk/$(DocRepoName) WorkingDirectory: $(DailyDocRepoLocation) - # Pull and build the docker image. - - template: /eng/common/pipelines/templates/steps/docker-pull-image.yml - parameters: - ImageId: "$(DocValidationImageId)" - task: Powershell@2 inputs: @@ -46,7 +41,7 @@ jobs: inputs: pwsh: true filePath: eng/common/scripts/Update-DocsMsPackages.ps1 - arguments: -DocRepoLocation $(DocRepoLocation) -ImageId '$(DocValidationImageId)' + arguments: -DocRepoLocation $(DocRepoLocation) displayName: Update Docs Onboarding for main branch condition: and(succeeded(), or(eq(variables['Build.Reason'], 'Schedule'), eq(variables['Force.MainUpdate'], 'true'))) @@ -85,7 +80,7 @@ jobs: parameters: BaseRepoBranch: $(DefaultBranch) BaseRepoOwner: $(DocRepoOwner) - CommitMsg: "Update docs CI configuration" + CommitMsg: "Update docs CI configuration Build: $(System.CollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)" TargetRepoName: $(DocRepoName) TargetRepoOwner: $(DocRepoOwner) WorkingDirectory: $(DocRepoLocation) @@ -95,20 +90,7 @@ jobs: parameters: DailyBranchVariableName: DailyDocsBranchName - # Docs daily updates is supposed to download packages from public feed repository, so we have to specify additional repositories in a POM or the profile. - # Here is maven documentation: https://maven.apache.org/guides/mini/guide-multiple-repositories.html - - powershell: | - # Linux mvn `setting.xml` is sitting under path `~/.m2/setting.xml` - Get-Command mvn - if (!(Test-Path '~/.m2/')) { - mkdir ~/.m2/ - } - if (Test-Path '~/.m2/setting.xml') { - Write-Host "'setting.xml' exists. Overwriting the file to support multiple repositories." - } - Copy-Item "./eng/repo-docs/docms/daily.update.setting.xml" -Destination "~/.m2/settings.xml" - displayName: 'Configure mvn' - workingDirectory: $(Build.SourcesDirectory) + - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml - task: Powershell@2 inputs: diff --git a/eng/pipelines/templates/stages/archetype-java-release-batch.yml b/eng/pipelines/templates/stages/archetype-java-release-batch.yml index f1ba3d006850..8178d1d767b2 100644 --- a/eng/pipelines/templates/stages/archetype-java-release-batch.yml +++ b/eng/pipelines/templates/stages/archetype-java-release-batch.yml @@ -319,10 +319,6 @@ stages: image: azsdk-pool-mms-ubuntu-2004-1espt os: linux - variables: - - name: DocValidationImageId - value: azuresdkimages.azurecr.io/javarefautocr:latest - strategy: runOnce: deploy: @@ -338,6 +334,9 @@ stages: - download: current displayName: 'Download Artifact: ${{parameters.ArtifactName}}' artifact: ${{parameters.ArtifactName}} + + - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml + - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: PackageInfoLocations: @@ -351,7 +350,6 @@ stages: SparseCheckoutPaths: - docs-ref-services/ - metadata/ - DocValidationImageId: "$(DocValidationImageId)" - deployment: PublishDocs displayName: Publish Docs to GitHubIO Blob Storage @@ -461,9 +459,6 @@ stages: name: azsdk-pool-mms-ubuntu-2004-general image: azsdk-pool-mms-ubuntu-2004-1espt os: linux - variables: - - name: DocValidationImageId - value: azuresdkimages.azurecr.io/javarefautocr:latest steps: - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml parameters: @@ -479,20 +474,8 @@ stages: - pwsh: | Get-ChildItem -Recurse $(Pipeline.Workspace)/${{parameters.ArtifactName}}/ displayName: Show visible artifacts - # Docs daily updates is supposed to download packages from public feed repository, so we have to specify additional repositories in a POM or the profile. - # Here is maven documentation: https://maven.apache.org/guides/mini/guide-multiple-repositories.html - - powershell: | - # Linux mvn `setting.xml` is sitting under path `~/.m2/setting.xml` - Get-Command mvn - if (!(Test-Path '~/.m2/')) { - mkdir ~/.m2/ - } - if (Test-Path '~/.m2/setting.xml') { - Write-Host "'setting.xml' exists. Overwriting the file to support multiple repositories." - } - Copy-Item "./eng/repo-docs/docms/daily.update.setting.xml" -Destination "~/.m2/settings.xml" - displayName: 'Configure mvn' - workingDirectory: $(Build.SourcesDirectory) + + - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: @@ -508,6 +491,5 @@ stages: SparseCheckoutPaths: - docs-ref-services/ - metadata/ - DocValidationImageId: "$(DocValidationImageId)" - template: /eng/common/pipelines/templates/steps/docsms-ensure-validation.yml diff --git a/eng/pipelines/templates/stages/archetype-java-release-patch.yml b/eng/pipelines/templates/stages/archetype-java-release-patch.yml index 1fce6895798d..57bb5c581f48 100644 --- a/eng/pipelines/templates/stages/archetype-java-release-patch.yml +++ b/eng/pipelines/templates/stages/archetype-java-release-patch.yml @@ -239,8 +239,6 @@ stages: variables: - template: /eng/pipelines/templates/variables/globals.yml - - name: DocValidationImageId - value: azuresdkimages.azurecr.io/javarefautocr:latest strategy: runOnce: @@ -258,6 +256,7 @@ stages: - download: current displayName: 'Download Artifact: ${{parameters.ArtifactName}}' artifact: ${{parameters.ArtifactName}} + - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: PackageInfoLocations: @@ -271,7 +270,6 @@ stages: SparseCheckoutPaths: - docs-ref-services/ - metadata/ - DocValidationImageId: "$(DocValidationImageId)" - deployment: PublishDocs displayName: Publish Docs to GitHubIO Blob Storage diff --git a/eng/pipelines/templates/stages/archetype-java-release.yml b/eng/pipelines/templates/stages/archetype-java-release.yml index 232438fba90d..db821cac7ff6 100644 --- a/eng/pipelines/templates/stages/archetype-java-release.yml +++ b/eng/pipelines/templates/stages/archetype-java-release.yml @@ -257,8 +257,6 @@ stages: variables: - template: /eng/pipelines/templates/variables/globals.yml - - name: DocValidationImageId - value: azuresdkimages.azurecr.io/javarefautocr:latest strategy: runOnce: @@ -275,7 +273,9 @@ stages: - download: current displayName: 'Download Artifact: ${{parameters.ArtifactName}}' artifact: ${{parameters.ArtifactName}} - # Pull and build the docker image. + + - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml + - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: PackageInfoLocations: @@ -287,7 +287,6 @@ stages: SparseCheckoutPaths: - docs-ref-services/ - metadata/ - DocValidationImageId: "$(DocValidationImageId)" - ${{if ne(artifact.skipPublishDocGithubIo, 'true')}}: - deployment: PublishDocs @@ -443,8 +442,6 @@ stages: os: linux variables: - template: /eng/pipelines/templates/variables/globals.yml - - name: DocValidationImageId - value: azuresdkimages.azurecr.io/javarefautocr:latest steps: - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml parameters: @@ -475,6 +472,8 @@ stages: displayName: 'Configure mvn' workingDirectory: $(Build.SourcesDirectory) + - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml + - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: PackageInfoLocations: @@ -489,6 +488,5 @@ stages: SparseCheckoutPaths: - docs-ref-services/ - metadata/ - DocValidationImageId: "$(DocValidationImageId)" - template: /eng/common/pipelines/templates/steps/docsms-ensure-validation.yml diff --git a/eng/pipelines/templates/steps/install-rex-validation-tool.yml b/eng/pipelines/templates/steps/install-rex-validation-tool.yml new file mode 100644 index 000000000000..44f0ebfdc6c6 --- /dev/null +++ b/eng/pipelines/templates/steps/install-rex-validation-tool.yml @@ -0,0 +1,9 @@ +steps: + # Create a java2docfx subdirectory in the $(Build.BinariesDirectory) and install the java2docfx there + # This way, the jar file is in its own subdirectory and isolated. + - pwsh: | + $java2docfxVer = Get-Content eng/scripts/docs/java2docfx.version.txt + $java2docfxDir = Join-Path $(Build.BinariesDirectory) "java2docfx" + Write-Host "mvn dependency:copy -Dartifact=""com.microsoft:java2docfx:$java2docfxVer"" -DoutputDirectory=""$java2docfxDir""" + mvn dependency:copy -Dartifact="com.microsoft:java2docfx:$java2docfxVer" -DoutputDirectory="$java2docfxDir" + displayName: Install java2docfx for package validation \ No newline at end of file diff --git a/eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml b/eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml new file mode 100644 index 000000000000..18a59f208fce --- /dev/null +++ b/eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml @@ -0,0 +1,21 @@ +steps: + # /eng/repo-docs/docms/daily.update.setting.xml contains two settings + # 1. The java dev feed - This is for nightly builds and official builds, both of which publish + # to the dev feed. In the case of official builds, setting this up prevents us from having + # to deal with sonatype which may or may not have what was just published available. + # 2. The docs-public-packages dev feed. This is where the docs java library, java2docfx is + # published. Nightly builds and official releases are published here and, while official releases + # are also published to sonatype, it's better to hit the public dev feed whenever possible. + # Here is maven documentation: https://maven.apache.org/guides/mini/guide-multiple-repositories.html + - powershell: | + # Linux mvn `setting.xml` is sitting under path `~/.m2/setting.xml` + Get-Command mvn + if (!(Test-Path '~/.m2/')) { + mkdir ~/.m2/ + } + if (Test-Path '~/.m2/setting.xml') { + Write-Host "'setting.xml' exists. Overwriting the file to support multiple repositories." + } + Copy-Item "./eng/repo-docs/docms/daily.update.setting.xml" -Destination "~/.m2/settings.xml" + displayName: 'Configure mvn settings on linux' + workingDirectory: $(Build.SourcesDirectory) diff --git a/eng/repo-docs/docms/daily.update.setting.xml b/eng/repo-docs/docms/daily.update.setting.xml index fc1b359a3a62..f30128b6d146 100644 --- a/eng/repo-docs/docms/daily.update.setting.xml +++ b/eng/repo-docs/docms/daily.update.setting.xml @@ -18,6 +18,16 @@ true + + docs-public-packages + https://docfx.pkgs.visualstudio.com/docfx/_packaging/docs-public-packages/maven/v1 + + true + + + true + + diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index ac6cf7eb809c..743b8d3e081e 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -262,412 +262,6 @@ function Get-java-GithubIoDocIndex() GenerateDocfxTocContent -tocContent $tocContent -lang "Java" -campaignId "UA-62780441-42" } -# a "package.json configures target packages for all the monikers in a Repository, it also has a slightly different -# schema than the moniker-specific json config that is seen in python and js -function Update-java-CIConfig($pkgs, $ciRepo, $locationInDocRepo, $monikerId=$null) -{ - $pkgJsonLoc = (Join-Path -Path $ciRepo -ChildPath $locationInDocRepo) - - if (-not (Test-Path $pkgJsonLoc)) { - Write-Error "Unable to locate package json at location $pkgJsonLoc, exiting." - exit(1) - } - - $allJsonData = Get-Content $pkgJsonLoc | ConvertFrom-Json - - $visibleInCI = @{} - - for ($i=0; $i -lt $allJsonData[$monikerId].packages.Length; $i++) { - $pkgDef = $allJsonData[$monikerId].packages[$i] - $visibleInCI[$pkgDef.packageArtifactId] = $i - } - - foreach ($releasingPkg in $pkgs) { - if ($visibleInCI.ContainsKey($releasingPkg.PackageId)) { - $packagesIndex = $visibleInCI[$releasingPkg.PackageId] - $existingPackageDef = $allJsonData[$monikerId].packages[$packagesIndex] - $existingPackageDef.packageVersion = $releasingPkg.PackageVersion - } - else { - $newItem = New-Object PSObject -Property @{ - packageDownloadUrl = $PackageRepositoryUri - packageGroupId = $releasingPkg.GroupId - packageArtifactId = $releasingPkg.PackageId - packageVersion = $releasingPkg.PackageVersion - inputPath = @() - excludePath = @() - } - - $allJsonData[$monikerId].packages += $newItem - } - } - - $jsonContent = $allJsonData | ConvertTo-Json -Depth 10 | % {$_ -replace "(?m) (?<=^(?: )*)", " " } - - Set-Content -Path $pkgJsonLoc -Value $jsonContent -} - -$PackageExclusions = @{ - "azure-core-experimental" = "Don't want to include an experimental package."; - "azure-core-test" = "Don't want to include the test framework package."; - "azure-sdk-bom" = "Don't want to include the sdk bom."; - "azure-storage-internal-avro" = "No external APIs."; - "azure-cosmos-spark_3-1_2-12" = "Javadoc dependency issue."; - "azure-cosmos-spark_3-2_2-12" = "Javadoc dependency issue."; - "azure-cosmos-spark_3-3_2-12" = "Javadoc dependency issue."; - "azure-cosmos-spark_3-4_2-12" = "Javadoc dependency issue."; - "azure-cosmos-spark_3-5_2-12" = "Javadoc dependency issue."; - "azure-cosmos-test" = "Don't want to include the test framework package."; - "azure-aot-graalvm-support-netty" = "No Javadocs for the package."; - "azure-aot-graalvm-support" = "No Javadocs for the package."; - "azure-sdk-template" = "Depends on unreleased core."; - "azure-sdk-template-two" = "Depends on unreleased core."; - "azure-sdk-template-three" = "Depends on unreleased core."; - "azure-ai-personalizer" = "No java docs in this package."; - "azure-sdk-build-tool" = "Do not release docs for this package."; - "azure-resourcemanager-voiceservices" = "Doc build attempts to download a package that does not have published sources."; - "azure-resourcemanager-storagemover" = "Attempts to azure-sdk-build-tool and fails"; - "azure-security-keyvault-jca" = "Consistently hangs docs build, might be a spring package https://github.com/Azure/azure-sdk-for-java/issues/35389"; -} - -# Validates if the package will succeed in the CI build by validating the -# existence of a com folder in the unzipped source package -function SourcePackageHasComFolder($artifactNamePrefix, $packageDirectory) { - try - { - $packageArtifact = "${artifactNamePrefix}:jar:sources" - $mvnResults = mvn ` - dependency:copy ` - -Dartifact="$packageArtifact" ` - -DoutputDirectory="$packageDirectory" - - if ($LASTEXITCODE) { - LogWarning "Could not download source artifact: $packageArtifact" - $mvnResults | Write-Host - return $false - } - - $sourcesJarPath = (Get-ChildItem -File -Path $packageDirectory -Filter "*-sources.jar")[0] - $sourcesExtractPath = Join-Path $packageDirectory "sources" - - # Ensure that the sources folder is empty before extracting the jar - # otherwise there could be file collisions from a previous extraction run on - # the same system. - Remove-Item $sourcesExtractPath/* -Force -Recurse -ErrorAction Ignore - - Add-Type -AssemblyName System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::ExtractToDirectory($sourcesJarPath, $sourcesExtractPath) - - if (!(Test-Path "$sourcesExtractPath\com")) { - LogWarning "Could not locate 'com' folder extracting $packageArtifact" - return $false - } - } - catch - { - LogError "Exception while updating checking if package can be documented: $($package.packageGroupId):$($package.packageArtifactId)" - LogError $_ - LogError $_.ScriptStackTrace - return $false - } - - return $true -} - -function PackageDependenciesResolve($artifactNamePrefix, $packageDirectory) { - - $pomArtifactName = "${artifactNamePrefix}:pom" - $artifactDownloadOutput = mvn ` - dependency:copy ` - -Dartifact="$pomArtifactName" ` - -DoutputDirectory="$packageDirectory" - - if ($LASTEXITCODE) { - LogWarning "Could not download pom artifact: $pomArtifactName" - $artifactDownloadOutput | Write-Host - return $false - } - - $downloadedPomPath = (Get-ChildItem -File -Path $packageDirectory -Filter '*.pom')[0] - - # -P '!azure-mgmt-sdk-test-jar' excludes the unpublished test jar from - # dependencies - $copyDependencyOutput = mvn ` - -f $downloadedPomPath ` - dependency:copy-dependencies ` - -P '!azure-mgmt-sdk-test-jar' ` - -DoutputDirectory="$packageDirectory" - - if ($LASTEXITCODE) { - LogWarning "Could not resolve dependencies for: $pomArtifactName" - $copyDependencyOutput | Write-Host - return $false - } - - return $true -} - -function ValidatePackage($groupId, $artifactId, $version, $DocValidationImageId) { - return ValidatePackages @{ Group = $groupId; Name = $artifactId; Version = $version; } $DocValidationImageId -} - -function ValidatePackages([array]$packageInfos, $DocValidationImageId) { - $workingDirectory = Join-Path ([System.IO.Path]::GetTempPath()) "validation" - if (!(Test-Path $workingDirectory)) { - New-Item -ItemType Directory -Force -Path $workingDirectory | Out-Null - } - - # Add more validation by replicating as much of the docs CI process as - # possible - # https://github.com/Azure/azure-sdk-for-python/issues/20109 - if (!$DocValidationImageId) - { - return FallbackValidation -packageInfos $packageInfos -workingDirectory $workingDirectory - } - else - { - return DockerValidation -packageInfos $packageInfos -DocValidationImageId $DocValidationImageId -workingDirectory $workingDirectory - } -} - -function FallbackValidation ($packageInfos, $workingDirectory) { - $results = @() - - foreach ($packageInfo in $packageInfos) { - $groupId = $packageInfo.Group - $artifactId = $packageInfo.Name - $version = $packageInfo.Version - - Write-Host "Validating using mvn command directly on $artifactId." - - $artifactNamePrefix = "${groupId}:${artifactId}:${version}" - - $packageDirectory = Join-Path $workingDirectory "${groupId}__${artifactId}__${version}" - New-Item -ItemType Directory -Path $packageDirectory -Force | Out-Null - - $isValid = (SourcePackageHasComFolder $artifactNamePrefix $packageDirectory) ` - -and (PackageDependenciesResolve $artifactNamePrefix $packageDirectory) - - if (!$isValid) { - LogWarning "Package $artifactNamePrefix ref docs validation failed." - } - - $results += $isValid - } - - $allValid = $results.Where({ $_ -eq $false }).Count -eq 0 - - return $allValid -} - -function DockerValidation ($packageInfos, $DocValidationImageId, $workingDirectory) { - Write-Host "Validating $($packageInfos.Length) package(s) using $DocValidationImageId." - - $containerWorkingDirectory = '/workdir/out' - $configurationFileName = 'configuration.json' - - $hostConfigurationPath = Join-Path $workingDirectory $configurationFileName - - # Cannot use Join-Path because the container and host path separators may differ - $containerConfigurationPath = "$containerWorkingDirectory/$configurationFileName" - - $configuration = [ordered]@{ - "output_path" = "docs-ref-autogen"; - "packages" = @($packageInfos | ForEach-Object { [ordered]@{ - packageGroupId = $_.Group; - packageArtifactId = $_.Name; - packageVersion = $_.Version; - packageDownloadUrl = $PackageRepositoryUri; - } }); - } - - Set-Content -Path $hostConfigurationPath -Value ($configuration | ConvertTo-Json) | Out-Null - - docker run -v "${workingDirectory}:${containerWorkingDirectory}" ` - -e TARGET_CONFIGURATION_PATH=$containerConfigurationPath $DocValidationImageId 2>&1 ` - | Where-Object { -not ($_ -match '^Progress .*B\s*$') } ` # Remove progress messages - | Out-Host - - if ($LASTEXITCODE -ne 0) { - LogWarning "The `docker` command failed with exit code $LASTEXITCODE." - - # The docker exit codes: https://docs.docker.com/engine/reference/run/#exit-status - # If the docker validation failed because of docker itself instead of the application, or if we don't know which - # package failed, fall back to mvn validation - if ($LASTEXITCODE -in 125..127 -Or $packageInfos.Length -gt 1) { - return FallbackValidation -packageInfos $packageInfos -workingDirectory $workingDirectory - } - - return $false - } - - return $true -} - -function Update-java-DocsMsPackages($DocsRepoLocation, $DocsMetadata, $DocValidationImageId) { - Write-Host "Excluded packages:" - foreach ($excludedPackage in $PackageExclusions.Keys) { - Write-Host " $excludedPackage - $($PackageExclusions[$excludedPackage])" - } - - # Also exclude 'spring' packages - # https://github.com/Azure/azure-sdk-for-java/issues/23087 - $FilteredMetadata = $DocsMetadata.Where({ !($PackageExclusions.ContainsKey($_.Package) -or $_.Type -eq 'spring') }) - - UpdateDocsMsPackages ` - (Join-Path $DocsRepoLocation 'package.json') ` - 'preview' ` - $FilteredMetadata ` - $DocValidationImageId - - UpdateDocsMsPackages ` - (Join-Path $DocsRepoLocation 'package.json') ` - 'latest' ` - $FilteredMetadata ` - $DocValidationImageId -} - -function UpdateDocsMsPackages($DocConfigFile, $Mode, $DocsMetadata, $DocValidationImageId) { - $packageConfig = Get-Content $DocConfigFile -Raw | ConvertFrom-Json - - $packageOutputPath = 'docs-ref-autogen' - if ($Mode -eq 'preview') { - $packageOutputPath = 'preview/docs-ref-autogen' - } - $targetPackageList = $packageConfig.Where({ $_.output_path -eq $packageOutputPath}) - if ($targetPackageList.Length -eq 0) { - LogError "Unable to find package config for $packageOutputPath in $DocConfigFile" - exit 1 - } elseif ($targetPackageList.Length -gt 1) { - LogError "Found multiple package configs for $packageOutputPath in $DocConfigFile" - exit 1 - } - - $targetPackageList = $targetPackageList[0] - - $outputPackages = @() - foreach ($package in $targetPackageList.packages) { - $packageGroupId = $package.packageGroupId - $packageName = $package.packageArtifactId - - $matchingPublishedPackageArray = $DocsMetadata.Where({ - $_.Package -eq $packageName -and $_.GroupId -eq $packageGroupId - }) - - # If this package does not match any published packages keep it in the list. - # This handles packages which are not tracked in metadata but still need to - # be built in Docs CI. - if ($matchingPublishedPackageArray.Count -eq 0) { - Write-Host "Keep non-tracked package: $packageName" - $outputPackages += $package - continue - } - - if ($matchingPublishedPackageArray.Count -gt 1) { - LogWarning "Found more than one matching published package in metadata for $packageName; only updating first entry" - } - $matchingPublishedPackage = $matchingPublishedPackageArray[0] - - if ($Mode -eq 'preview' -and !$matchingPublishedPackage.VersionPreview.Trim()) { - # If we are in preview mode and the package does not have a superseding - # preview version, remove the package from the list. - Write-Host "Remove superseded preview package: $packageName" - continue - } - - if ($Mode -eq 'latest' -and !$matchingPublishedPackage.VersionGA.Trim()) { - LogWarning "Metadata is missing GA version for GA package $packageName. Keeping existing package." - $outputPackages += $package - continue - } - - $packageVersion = $($matchingPublishedPackage.VersionGA) - if ($Mode -eq 'preview') { - if (!$matchingPublishedPackage.VersionPreview.Trim()) { - LogWarning "Metadata is missing preview version for preview package $packageName. Keeping existing package." - $outputPackages += $package - continue - } - $packageVersion = $matchingPublishedPackage.VersionPreview - } - - # If upgrading the package, run basic sanity checks against the package - if ($package.packageVersion -ne $packageVersion) { - Write-Host "Validating new version detected for $packageName ($packageVersion)" - $validatePackageResult = ValidatePackage $package.packageGroupId $package.packageArtifactId $packageVersion $DocValidationImageId - - if (!$validatePackageResult) { - LogWarning "Package is not valid: $packageName. Keeping old version." - $outputPackages += $package - continue - } - - $package.packageVersion = $packageVersion - } - - Write-Host "Keeping tracked package: $packageName." - $outputPackages += $package - } - - $outputPackagesHash = @{} - foreach ($package in $outputPackages) { - $outputPackagesHash["$($package.packageGroupId):$($package.packageArtifactId)"] = $true - } - - $remainingPackages = @() - if ($Mode -eq 'preview') { - $remainingPackages = $DocsMetadata.Where({ - ![string]::IsNullOrWhiteSpace($_.VersionPreview) -and !$outputPackagesHash.ContainsKey("$($_.GroupId):$($_.Package)") - }) - } else { - $remainingPackages = $DocsMetadata.Where({ - ![string]::IsNullOrWhiteSpace($_.VersionGA) -and !$outputPackagesHash.ContainsKey("$($_.GroupId):$($_.Package)") - }) - } - - # Add packages that exist in the metadata but are not onboarded in docs config - foreach ($package in $remainingPackages) { - $packageName = $package.Package - $packageGroupId = $package.GroupId - $packageVersion = $package.VersionGA - if ($Mode -eq 'preview') { - $packageVersion = $package.VersionPreview - } - - Write-Host "Validating new package $($packageGroupId):$($packageName):$($packageVersion)" - $validatePackageResult = ValidatePackage $packageGroupId $packageName $packageVersion $DocValidationImageId - if (!$validatePackageResult) { - LogWarning "Package is not valid: ${packageGroupId}:$packageName. Cannot onboard." - continue - } - - Write-Host "Add new package from metadata: ${packageGroupId}:$packageName" - $package = [ordered]@{ - packageArtifactId = $packageName - packageGroupId = $packageGroupId - packageVersion = $packageVersion - packageDownloadUrl = $PackageRepositoryUri - } - - $outputPackages += $package - } - - $targetPackageList.packages = $outputPackages - - # It is assumed that there is a matching config from above when the number of - # matching $targetPackageList is 1 - foreach ($config in $packageConfig) { - if ($config.output_path -eq $packageOutputPath) { - $config = $targetPackageList - break - } - } - - $outputJson = ConvertTo-Json $packageConfig -Depth 100 - Set-Content -Path $DocConfigFile -Value $outputJson - Write-Host "Onboarding configuration $Mode written to: $DocConfigFile" -} - # function is used to filter packages to submit to API view tool function Find-java-Artifacts-For-Apireview($artifactDir, $pkgName) { @@ -787,12 +381,81 @@ function Validate-java-DocMsPackages ($PackageInfo, $PackageInfos, $DocValidatio $PackageInfos = @($PackageInfo) } - if (!(ValidatePackages $PackageInfos $DocValidationImageId)) { - Write-Error "Package validation failed" -ErrorAction Continue + # The install-rex-validation-tool.yml will install the java2docfx jar file into the Build.BinariesDirectory + # which is a DevOps variable for the directory. In PS that variable is BUILD_BINARIESDIRECTORY. + # The reason why this is necessary is that the command for java2docfx is in the following format: + # java –jar java2docfx-1.0.0.jar.jar --packagesJsonFile "C\temp\package.json" + # or + # java –jar java2docfx-1.0.0.jar --package "::" + # which means we need to know where, exactly, because the java command requires the full path + # to the jar file as an argument + $java2docfxJar = $null + if (!$Env:BUILD_BINARIESDIRECTORY) { + LogError "Env:BUILD_BINARIESDIRECTORY is not set and this is where the java2docfx jar file should be installed." + return $false + } + $java2docfxDir = Join-Path $Env:BUILD_BINARIESDIRECTORY "java2docfx" + if (!Test-Path $java2docfxDir) { + LogError "There should be a java2docfx directory under Env:BUILD_BINARIESDIRECTORY. Ensure that the /eng/pipelines/templates/steps/install-rex-validation-tool.yml template was run prior to whatever step is running this." + return $false + } + $java2docfxJarLoc = Get-ChildItem -Path $java2docfxDir -File -Filter "java2docfx*.jar" + if (!$java2docfxJarLoc) { + LogError "The java2docfx jar file should be installed in $java2docfxDir and is not there." return $false + } else { + # In theory, this shouldn't happen as the install-rex-validation-tool.yml is the only thing + # that'll ever install the jar + if ($java2docfxJarLoc.Count -gt 1) { + Write-Host "There were $($java2docfxJarLoc.Count) java2docfx jar files found in $Build_BinariesDirectory, using the first one" + } + $java2docfxJar = $java2docfxJarLoc[0] + Write-Host "java2docfx jar location=$java2docfxJar" + } + + $allSuccess = $true + $originLocation = Get-Location + foreach ($packageInfo in $PackageInfos) { + $artifact = "$($packageInfo.Group):$($packageInfo.Name):$($packageInfo.Version)" + $tempDirectory = Join-Path ([System.IO.Path]::GetTempPath()) "$($packageInfo.Group)-$($packageInfo.Name)-$($packageInfo.Version)" + New-Item $tempDirectory -ItemType Directory | Out-Null + # Set the location to the temp directory. The reason being is that it'll effectively be empty, no + # other jars, no POM files aka nothing Java related to pick up. + Set-Location $tempDirectory + try { + Write-Host "Calling java2docfx for $artifact" + Write-Host "java -jar $java2docfxJar -p ""$java2docfxJar"" -" + $java2docfxResults = java ` + -jar $java2docfxJar` + -p "$artifact" + # JRS-TODO: The -o option is something I'm currently questioning the behavior of but + # I can do some initial testing without that option being set + # -p "$artifact" ` + # -o "$tempDirectory" + + if ($LASTEXITCODE -ne 0) { + LogWarning "java2docfx failed for $artifact" + $java2docfxResults | Write-Host + $allSuccess = $false + } + } + catch { + LogError "Exception while trying to download: $artifact" + LogError $_ + LogError $_.ScriptStackTrace + $allSuccess = $false + } + finally { + # Ensure that the origianl location is restored + Set-Location $originLocation + # everything is contained within the temp directory, clean it up every time + if (Test-Path $tempDirectory) { + Remove-Item $tempDirectory -Recurse -Force + } + } } - return $true + return $allSuccess } function Get-java-EmitterName() { diff --git a/eng/scripts/docs/java2docfx.version.txt b/eng/scripts/docs/java2docfx.version.txt new file mode 100644 index 000000000000..7f207341d5d9 --- /dev/null +++ b/eng/scripts/docs/java2docfx.version.txt @@ -0,0 +1 @@ +1.0.1 \ No newline at end of file From c36f0b36bd8b98828285dde7c9edaf9f655c3e18 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Tue, 16 Apr 2024 12:23:37 -0700 Subject: [PATCH 02/22] Temporarily turn on docs processing for template libraries for testing --- sdk/template/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/template/ci.yml b/sdk/template/ci.yml index 8f557e2e526f..55e2d561f4ca 100644 --- a/sdk/template/ci.yml +++ b/sdk/template/ci.yml @@ -79,17 +79,17 @@ extends: groupId: com.azure safeName: azuresdktemplate releaseInBatch: ${{ parameters.release_azuresdktemplate }} - skipPublishDocMs: true + #skipPublishDocMs: true - name: azure-sdk-template-two groupId: com.azure safeName: azuresdktemplatetwo releaseInBatch: ${{ parameters.release_azuresdktemplatetwo }} - skipPublishDocMs: true + #skipPublishDocMs: true - name: azure-sdk-template-three groupId: com.azure safeName: azuresdktemplatethree releaseInBatch: ${{ parameters.release_azuresdktemplatethree }} - skipPublishDocMs: true + #skipPublishDocMs: true AdditionalModules: - name: azure-template-perf groupId: com.azure From 079bf301357411f577fb6b5f626877acd8ff9758 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Tue, 16 Apr 2024 13:57:14 -0700 Subject: [PATCH 03/22] Actually install the rex validation tool --- .../stages/archetype-java-release-batch.yml | 2 ++ .../stages/archetype-java-release-patch.yml | 1 + .../templates/stages/archetype-java-release.yml | 16 ++-------------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/eng/pipelines/templates/stages/archetype-java-release-batch.yml b/eng/pipelines/templates/stages/archetype-java-release-batch.yml index 8178d1d767b2..a5b8c4e629d7 100644 --- a/eng/pipelines/templates/stages/archetype-java-release-batch.yml +++ b/eng/pipelines/templates/stages/archetype-java-release-batch.yml @@ -336,6 +336,7 @@ stages: artifact: ${{parameters.ArtifactName}} - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml + - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: @@ -476,6 +477,7 @@ stages: displayName: Show visible artifacts - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml + - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: diff --git a/eng/pipelines/templates/stages/archetype-java-release-patch.yml b/eng/pipelines/templates/stages/archetype-java-release-patch.yml index 57bb5c581f48..d9a13424ec1a 100644 --- a/eng/pipelines/templates/stages/archetype-java-release-patch.yml +++ b/eng/pipelines/templates/stages/archetype-java-release-patch.yml @@ -257,6 +257,7 @@ stages: displayName: 'Download Artifact: ${{parameters.ArtifactName}}' artifact: ${{parameters.ArtifactName}} - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml + - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: PackageInfoLocations: diff --git a/eng/pipelines/templates/stages/archetype-java-release.yml b/eng/pipelines/templates/stages/archetype-java-release.yml index db821cac7ff6..4ebb740e7780 100644 --- a/eng/pipelines/templates/stages/archetype-java-release.yml +++ b/eng/pipelines/templates/stages/archetype-java-release.yml @@ -275,6 +275,7 @@ stages: artifact: ${{parameters.ArtifactName}} - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml + - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: @@ -457,22 +458,9 @@ stages: - pwsh: | Get-ChildItem -Recurse $(Pipeline.Workspace)/${{parameters.ArtifactName}}/ displayName: Show visible artifacts - # Docs daily updates is supposed to download packages from public feed repository, so we have to specify additional repositories in a POM or the profile. - # Here is maven documentation: https://maven.apache.org/guides/mini/guide-multiple-repositories.html - - powershell: | - # Linux mvn `setting.xml` is sitting under path `~/.m2/setting.xml` - Get-Command mvn - if (!(Test-Path '~/.m2/')) { - mkdir ~/.m2/ - } - if (Test-Path '~/.m2/setting.xml') { - Write-Host "'setting.xml' exists. Overwriting the file to support multiple repositories." - } - Copy-Item "./eng/repo-docs/docms/daily.update.setting.xml" -Destination "~/.m2/settings.xml" - displayName: 'Configure mvn' - workingDirectory: $(Build.SourcesDirectory) - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml + - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: From 0c115d6aa90f199429153de33e3428b3aef88cc9 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Tue, 16 Apr 2024 14:06:45 -0700 Subject: [PATCH 04/22] Fix the if not Test-Path statement --- eng/scripts/Language-Settings.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index 743b8d3e081e..a7681190a1f5 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -395,7 +395,7 @@ function Validate-java-DocMsPackages ($PackageInfo, $PackageInfos, $DocValidatio return $false } $java2docfxDir = Join-Path $Env:BUILD_BINARIESDIRECTORY "java2docfx" - if (!Test-Path $java2docfxDir) { + if (!(Test-Path $java2docfxDir)) { LogError "There should be a java2docfx directory under Env:BUILD_BINARIESDIRECTORY. Ensure that the /eng/pipelines/templates/steps/install-rex-validation-tool.yml template was run prior to whatever step is running this." return $false } From 9902296d88ee11558763793aecd1aed21d74bf10 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Thu, 18 Apr 2024 08:54:18 -0700 Subject: [PATCH 05/22] Update java2docfx version and add a couple of diagnostics output lines --- eng/scripts/Language-Settings.ps1 | 4 ++++ eng/scripts/docs/Docs-ToC.ps1 | 3 +++ eng/scripts/docs/java2docfx.version.txt | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index a7681190a1f5..86b281b7db38 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -162,6 +162,10 @@ function Get-java-DocsMsDevLanguageSpecificPackageInfo($packageInfo, $packageSou # them from the metadata. This allows us to set the namespaces for things that can't be figured out # through the javadoc, like track 1 libraries whose javadoc.jar files don't contain anything, in # the metadata json files. + # JRS-REMOVE this if statement, it's for diagnostics only + if (!($namespaces | Get-Member Count) { + LogWarning "Namespaces return from Fetch-Namespaces-From-Javadoc had no Count property. namespaces=$namespaces" + } if ($namespaces.Count -gt 0) { $packageInfo | Add-Member -Type NoteProperty -Name "Namespaces" -Value $namespaces } diff --git a/eng/scripts/docs/Docs-ToC.ps1 b/eng/scripts/docs/Docs-ToC.ps1 index cfb90e5f53cd..aa08864976fe 100644 --- a/eng/scripts/docs/Docs-ToC.ps1 +++ b/eng/scripts/docs/Docs-ToC.ps1 @@ -222,6 +222,9 @@ function Fetch-Namespaces-From-Javadoc($package, $groupId, $version) { } $namespaces = $namespaces | Sort-Object -Unique + # JRS-REMOVE or possibly leave this in? Right now, it's for diagnostics purposes. + Write-Host "Fetching Namespaces returning:" + $namespaces | Write-Host # Make sure this always returns an array Write-Output -NoEnumerate $namespaces } diff --git a/eng/scripts/docs/java2docfx.version.txt b/eng/scripts/docs/java2docfx.version.txt index 7f207341d5d9..e6d5cb833c63 100644 --- a/eng/scripts/docs/java2docfx.version.txt +++ b/eng/scripts/docs/java2docfx.version.txt @@ -1 +1 @@ -1.0.1 \ No newline at end of file +1.0.2 \ No newline at end of file From 519a068ccbf5464ea0e344a254c62c628f7c11ad Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Thu, 18 Apr 2024 09:20:16 -0700 Subject: [PATCH 06/22] Add missing close paren --- eng/scripts/Language-Settings.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index 86b281b7db38..947536a63a44 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -163,7 +163,7 @@ function Get-java-DocsMsDevLanguageSpecificPackageInfo($packageInfo, $packageSou # through the javadoc, like track 1 libraries whose javadoc.jar files don't contain anything, in # the metadata json files. # JRS-REMOVE this if statement, it's for diagnostics only - if (!($namespaces | Get-Member Count) { + if (!($namespaces | Get-Member Count)) { LogWarning "Namespaces return from Fetch-Namespaces-From-Javadoc had no Count property. namespaces=$namespaces" } if ($namespaces.Count -gt 0) { From 2904ca10bb497d1041a5e68bf591c799b65fd67a Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Thu, 18 Apr 2024 11:11:54 -0700 Subject: [PATCH 07/22] Ensure that Sort-Object always returns an array even if there's only one item --- eng/scripts/docs/Docs-ToC.ps1 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/eng/scripts/docs/Docs-ToC.ps1 b/eng/scripts/docs/Docs-ToC.ps1 index aa08864976fe..13e4d09a6bb5 100644 --- a/eng/scripts/docs/Docs-ToC.ps1 +++ b/eng/scripts/docs/Docs-ToC.ps1 @@ -138,7 +138,8 @@ function Get-Toc-Children($package, $docRepoLocation) { } } # Sort the array and clean out any dupes (there shouldn't be any but better safe than sorry) - $namespaces = $namespaces | Sort-Object -Unique + # Ensure that Sort-Object returns an array even if there's only a single object. + $namespaces = @($namespaces | Sort-Object -Unique) # Ensure that this always returns an array, even if there's one item or 0 items Write-Output -NoEnumerate $namespaces } @@ -221,7 +222,16 @@ function Fetch-Namespaces-From-Javadoc($package, $groupId, $version) { } } - $namespaces = $namespaces | Sort-Object -Unique + # JRS-REMOVE check the type of namespaces before and after the sort object to ensure that + # it's returning an array + Write-Host "before Sort-Object, namespaces.GetType().FullName=$($namespaces.GetType().FullName)" + + # Ensure that Sort-Object returns an array even if there's only a single object. + $namespaces = @($namespaces | Sort-Object -Unique) + + # JRS-REMOVE + Write-Host "after Sort-Object, namespaces.GetType().FullName=$($namespaces.GetType().FullName)" + # JRS-REMOVE or possibly leave this in? Right now, it's for diagnostics purposes. Write-Host "Fetching Namespaces returning:" $namespaces | Write-Host From dbc50ff7561cea41be6ab2bc2a3cd482b9342ade Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Thu, 18 Apr 2024 12:12:14 -0700 Subject: [PATCH 08/22] add another piece of diagnostics output --- eng/scripts/Language-Settings.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index 947536a63a44..6de3544533cd 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -154,6 +154,7 @@ function Get-java-DocsMsDevLanguageSpecificPackageInfo($packageInfo, $packageSou $version = $packageInfo.DevVersion } $namespaces = Fetch-Namespaces-From-Javadoc $packageInfo.Name $packageInfo.Group $version + Write-Host "in Get-java-DocsMsDevLanguageSpecificPackageInfo, namespaces.GetType().FullName=$($namespaces.GetType().FullName)" # If there are namespaces found from the javadoc.jar then add them to the packageInfo which # will later update the metadata json file in the docs repository. If there aren't any namespaces # then don't add the namespaces member with an empty list. The reason being is that the From 417b12664d82eba4aa2350a787f595f03b57cf68 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Thu, 18 Apr 2024 12:55:51 -0700 Subject: [PATCH 09/22] trying one more thing --- eng/scripts/Language-Settings.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index 6de3544533cd..bf9098ca1c42 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -153,7 +153,8 @@ function Get-java-DocsMsDevLanguageSpecificPackageInfo($packageInfo, $packageSou if ($packageInfo.DevVersion) { $version = $packageInfo.DevVersion } - $namespaces = Fetch-Namespaces-From-Javadoc $packageInfo.Name $packageInfo.Group $version + $namespaces = @() + $namespaces += Fetch-Namespaces-From-Javadoc $packageInfo.Name $packageInfo.Group $version Write-Host "in Get-java-DocsMsDevLanguageSpecificPackageInfo, namespaces.GetType().FullName=$($namespaces.GetType().FullName)" # If there are namespaces found from the javadoc.jar then add them to the packageInfo which # will later update the metadata json file in the docs repository. If there aren't any namespaces From 09eb0413727ed0cd8927b185ef9ee74262bb4f28 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Thu, 18 Apr 2024 14:02:46 -0700 Subject: [PATCH 10/22] remove some diag, add other --- eng/scripts/Language-Settings.ps1 | 11 +++++------ eng/scripts/docs/Docs-ToC.ps1 | 9 --------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index bf9098ca1c42..6384600c8f14 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -153,8 +153,7 @@ function Get-java-DocsMsDevLanguageSpecificPackageInfo($packageInfo, $packageSou if ($packageInfo.DevVersion) { $version = $packageInfo.DevVersion } - $namespaces = @() - $namespaces += Fetch-Namespaces-From-Javadoc $packageInfo.Name $packageInfo.Group $version + $namespaces = Fetch-Namespaces-From-Javadoc $packageInfo.Name $packageInfo.Group $version Write-Host "in Get-java-DocsMsDevLanguageSpecificPackageInfo, namespaces.GetType().FullName=$($namespaces.GetType().FullName)" # If there are namespaces found from the javadoc.jar then add them to the packageInfo which # will later update the metadata json file in the docs repository. If there aren't any namespaces @@ -164,12 +163,12 @@ function Get-java-DocsMsDevLanguageSpecificPackageInfo($packageInfo, $packageSou # them from the metadata. This allows us to set the namespaces for things that can't be figured out # through the javadoc, like track 1 libraries whose javadoc.jar files don't contain anything, in # the metadata json files. - # JRS-REMOVE this if statement, it's for diagnostics only - if (!($namespaces | Get-Member Count)) { - LogWarning "Namespaces return from Fetch-Namespaces-From-Javadoc had no Count property. namespaces=$namespaces" - } if ($namespaces.Count -gt 0) { + # JRS-REMOVE this if statement, it's for diagnostics only + Write-Host "Get-java-DocsMsDevLanguageSpecificPackageInfo:adding namespaces property" $packageInfo | Add-Member -Type NoteProperty -Name "Namespaces" -Value $namespaces + } else { + Write-Host "Get-java-DocsMsDevLanguageSpecificPackageInfo: no namespaces to add" } } return $packageInfo diff --git a/eng/scripts/docs/Docs-ToC.ps1 b/eng/scripts/docs/Docs-ToC.ps1 index 13e4d09a6bb5..8d1ff7ccf554 100644 --- a/eng/scripts/docs/Docs-ToC.ps1 +++ b/eng/scripts/docs/Docs-ToC.ps1 @@ -222,18 +222,9 @@ function Fetch-Namespaces-From-Javadoc($package, $groupId, $version) { } } - # JRS-REMOVE check the type of namespaces before and after the sort object to ensure that - # it's returning an array - Write-Host "before Sort-Object, namespaces.GetType().FullName=$($namespaces.GetType().FullName)" - # Ensure that Sort-Object returns an array even if there's only a single object. $namespaces = @($namespaces | Sort-Object -Unique) - # JRS-REMOVE - Write-Host "after Sort-Object, namespaces.GetType().FullName=$($namespaces.GetType().FullName)" - - # JRS-REMOVE or possibly leave this in? Right now, it's for diagnostics purposes. - Write-Host "Fetching Namespaces returning:" $namespaces | Write-Host # Make sure this always returns an array Write-Output -NoEnumerate $namespaces From 9d625ef061d79cedec012c3605e4f3a921e70c5e Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Thu, 18 Apr 2024 15:54:19 -0700 Subject: [PATCH 11/22] Remove the additional diagnostics, add permanent output message --- eng/scripts/Language-Settings.ps1 | 9 +++++---- eng/scripts/docs/Docs-ToC.ps1 | 2 -- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index 6384600c8f14..321c111c7506 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -154,7 +154,6 @@ function Get-java-DocsMsDevLanguageSpecificPackageInfo($packageInfo, $packageSou $version = $packageInfo.DevVersion } $namespaces = Fetch-Namespaces-From-Javadoc $packageInfo.Name $packageInfo.Group $version - Write-Host "in Get-java-DocsMsDevLanguageSpecificPackageInfo, namespaces.GetType().FullName=$($namespaces.GetType().FullName)" # If there are namespaces found from the javadoc.jar then add them to the packageInfo which # will later update the metadata json file in the docs repository. If there aren't any namespaces # then don't add the namespaces member with an empty list. The reason being is that the @@ -164,8 +163,8 @@ function Get-java-DocsMsDevLanguageSpecificPackageInfo($packageInfo, $packageSou # through the javadoc, like track 1 libraries whose javadoc.jar files don't contain anything, in # the metadata json files. if ($namespaces.Count -gt 0) { - # JRS-REMOVE this if statement, it's for diagnostics only - Write-Host "Get-java-DocsMsDevLanguageSpecificPackageInfo:adding namespaces property" + Write-Host "Get-java-DocsMsDevLanguageSpecificPackageInfo:adding namespaces property with the following namespaces:" + $namespaces | Write-Host $packageInfo | Add-Member -Type NoteProperty -Name "Namespaces" -Value $namespaces } else { Write-Host "Get-java-DocsMsDevLanguageSpecificPackageInfo: no namespaces to add" @@ -353,6 +352,8 @@ function GetExistingPackageVersions ($PackageName, $GroupId=$null) } } +# Defined in common.ps1 +# $GetDocsMsMetadataForPackageFn = "Get-${Language}-DocsMsMetadataForPackage" function Get-java-DocsMsMetadataForPackage($PackageInfo) { $readmeName = $PackageInfo.Name.ToLower() Write-Host "Docs.ms Readme name: $($readmeName)" @@ -404,7 +405,7 @@ function Validate-java-DocMsPackages ($PackageInfo, $PackageInfos, $DocValidatio LogError "There should be a java2docfx directory under Env:BUILD_BINARIESDIRECTORY. Ensure that the /eng/pipelines/templates/steps/install-rex-validation-tool.yml template was run prior to whatever step is running this." return $false } - $java2docfxJarLoc = Get-ChildItem -Path $java2docfxDir -File -Filter "java2docfx*.jar" + $java2docfxJarLoc = @(Get-ChildItem -Path $java2docfxDir -File -Filter "java2docfx*.jar") if (!$java2docfxJarLoc) { LogError "The java2docfx jar file should be installed in $java2docfxDir and is not there." return $false diff --git a/eng/scripts/docs/Docs-ToC.ps1 b/eng/scripts/docs/Docs-ToC.ps1 index 8d1ff7ccf554..417a5637133d 100644 --- a/eng/scripts/docs/Docs-ToC.ps1 +++ b/eng/scripts/docs/Docs-ToC.ps1 @@ -224,8 +224,6 @@ function Fetch-Namespaces-From-Javadoc($package, $groupId, $version) { # Ensure that Sort-Object returns an array even if there's only a single object. $namespaces = @($namespaces | Sort-Object -Unique) - - $namespaces | Write-Host # Make sure this always returns an array Write-Output -NoEnumerate $namespaces } From 8ab7ccd7e541669fbd88fce6bd264ca317ea58ca Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Thu, 18 Apr 2024 16:55:08 -0700 Subject: [PATCH 12/22] Invoke java -jar on java2docfx to show the help command to ensure the install is okay --- eng/pipelines/templates/steps/install-rex-validation-tool.yml | 3 +++ eng/scripts/Language-Settings.ps1 | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/install-rex-validation-tool.yml b/eng/pipelines/templates/steps/install-rex-validation-tool.yml index 44f0ebfdc6c6..ff97e77ca0eb 100644 --- a/eng/pipelines/templates/steps/install-rex-validation-tool.yml +++ b/eng/pipelines/templates/steps/install-rex-validation-tool.yml @@ -6,4 +6,7 @@ steps: $java2docfxDir = Join-Path $(Build.BinariesDirectory) "java2docfx" Write-Host "mvn dependency:copy -Dartifact=""com.microsoft:java2docfx:$java2docfxVer"" -DoutputDirectory=""$java2docfxDir""" mvn dependency:copy -Dartifact="com.microsoft:java2docfx:$java2docfxVer" -DoutputDirectory="$java2docfxDir" + $java2docfxJarLoc = Join-Path $java2docfxDir -ChildPath "java2docfx-$java2docfxVer.jar" + Write-Host "Testing the install, running java -jar $java2docfxJarLoc -h" + java -jar $java2docfxJarLoc -h displayName: Install java2docfx for package validation \ No newline at end of file diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index 321c111c7506..991d19305ef5 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -430,7 +430,7 @@ function Validate-java-DocMsPackages ($PackageInfo, $PackageInfos, $DocValidatio Set-Location $tempDirectory try { Write-Host "Calling java2docfx for $artifact" - Write-Host "java -jar $java2docfxJar -p ""$java2docfxJar"" -" + Write-Host "java -jar $java2docfxJar -p ""$artifact""" $java2docfxResults = java ` -jar $java2docfxJar` -p "$artifact" From fc9a916cb0c1f37286ed53b4c78e519d67c36cb5 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Thu, 18 Apr 2024 17:43:20 -0700 Subject: [PATCH 13/22] fiddling with the java -jar command --- eng/scripts/Language-Settings.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index 991d19305ef5..1d70e68094b8 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -430,9 +430,9 @@ function Validate-java-DocMsPackages ($PackageInfo, $PackageInfos, $DocValidatio Set-Location $tempDirectory try { Write-Host "Calling java2docfx for $artifact" - Write-Host "java -jar $java2docfxJar -p ""$artifact""" + Write-Host "java -jar ""$java2docfxJar"" -p ""$artifact""" $java2docfxResults = java ` - -jar $java2docfxJar` + -jar "$java2docfxJar"` -p "$artifact" # JRS-TODO: The -o option is something I'm currently questioning the behavior of but # I can do some initial testing without that option being set From 8673d8a7644457be04df8df7dbce589410d7bf33 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Fri, 19 Apr 2024 08:50:14 -0700 Subject: [PATCH 14/22] Set the working directory to the java2docfx directory before executing the mvn dependency download --- .../steps/install-rex-validation-tool.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/eng/pipelines/templates/steps/install-rex-validation-tool.yml b/eng/pipelines/templates/steps/install-rex-validation-tool.yml index ff97e77ca0eb..28e60144cc2a 100644 --- a/eng/pipelines/templates/steps/install-rex-validation-tool.yml +++ b/eng/pipelines/templates/steps/install-rex-validation-tool.yml @@ -4,9 +4,18 @@ steps: - pwsh: | $java2docfxVer = Get-Content eng/scripts/docs/java2docfx.version.txt $java2docfxDir = Join-Path $(Build.BinariesDirectory) "java2docfx" - Write-Host "mvn dependency:copy -Dartifact=""com.microsoft:java2docfx:$java2docfxVer"" -DoutputDirectory=""$java2docfxDir""" - mvn dependency:copy -Dartifact="com.microsoft:java2docfx:$java2docfxVer" -DoutputDirectory="$java2docfxDir" - $java2docfxJarLoc = Join-Path $java2docfxDir -ChildPath "java2docfx-$java2docfxVer.jar" - Write-Host "Testing the install, running java -jar $java2docfxJarLoc -h" - java -jar $java2docfxJarLoc -h + $originLocation = Get-Location + try { + # Set the location into the created java2docfx directory . Running mvn from the repository root + # picks up the root POM and processes that while doing the dependency:copy in spite of + # the fact it has nothing to do with this download. + Set-Location $java2docfxDir + Write-Host "mvn dependency:copy -Dartifact=""com.microsoft:java2docfx:$java2docfxVer"" -DoutputDirectory=""$java2docfxDir""" + mvn dependency:copy -Dartifact="com.microsoft:java2docfx:$java2docfxVer" -DoutputDirectory="$java2docfxDir" + $java2docfxJarLoc = Join-Path $java2docfxDir -ChildPath "java2docfx-$java2docfxVer.jar" + Write-Host "Testing the install, running java -jar $java2docfxJarLoc -h" + java -jar $java2docfxJarLoc -h + } finally { + Set-Location $originLocation + } displayName: Install java2docfx for package validation \ No newline at end of file From a080ecc6a1c95c699c797b00ce30ff2785213794 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Fri, 19 Apr 2024 09:56:04 -0700 Subject: [PATCH 15/22] Actually create the directory before trying to set location...oops --- eng/pipelines/templates/steps/install-rex-validation-tool.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/templates/steps/install-rex-validation-tool.yml b/eng/pipelines/templates/steps/install-rex-validation-tool.yml index 28e60144cc2a..904e04402123 100644 --- a/eng/pipelines/templates/steps/install-rex-validation-tool.yml +++ b/eng/pipelines/templates/steps/install-rex-validation-tool.yml @@ -4,6 +4,7 @@ steps: - pwsh: | $java2docfxVer = Get-Content eng/scripts/docs/java2docfx.version.txt $java2docfxDir = Join-Path $(Build.BinariesDirectory) "java2docfx" + New-Item $java2docfxDir -ItemType Directory | Out-Null $originLocation = Get-Location try { # Set the location into the created java2docfx directory . Running mvn from the repository root From 6c85ca7445d9ec1ed7a73db2ed4fc3039f0f31dd Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Mon, 22 Apr 2024 08:16:54 -0700 Subject: [PATCH 16/22] Update rex validation to verify MAVEN_HOME is set --- .../steps/install-rex-validation-tool.yml | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/eng/pipelines/templates/steps/install-rex-validation-tool.yml b/eng/pipelines/templates/steps/install-rex-validation-tool.yml index 904e04402123..33c7e7141d86 100644 --- a/eng/pipelines/templates/steps/install-rex-validation-tool.yml +++ b/eng/pipelines/templates/steps/install-rex-validation-tool.yml @@ -2,21 +2,27 @@ steps: # Create a java2docfx subdirectory in the $(Build.BinariesDirectory) and install the java2docfx there # This way, the jar file is in its own subdirectory and isolated. - pwsh: | - $java2docfxVer = Get-Content eng/scripts/docs/java2docfx.version.txt - $java2docfxDir = Join-Path $(Build.BinariesDirectory) "java2docfx" - New-Item $java2docfxDir -ItemType Directory | Out-Null - $originLocation = Get-Location - try { - # Set the location into the created java2docfx directory . Running mvn from the repository root - # picks up the root POM and processes that while doing the dependency:copy in spite of - # the fact it has nothing to do with this download. - Set-Location $java2docfxDir - Write-Host "mvn dependency:copy -Dartifact=""com.microsoft:java2docfx:$java2docfxVer"" -DoutputDirectory=""$java2docfxDir""" - mvn dependency:copy -Dartifact="com.microsoft:java2docfx:$java2docfxVer" -DoutputDirectory="$java2docfxDir" - $java2docfxJarLoc = Join-Path $java2docfxDir -ChildPath "java2docfx-$java2docfxVer.jar" - Write-Host "Testing the install, running java -jar $java2docfxJarLoc -h" - java -jar $java2docfxJarLoc -h - } finally { - Set-Location $originLocation + if (!$ENV:MAVEN_HOME) { + Write-Error "MAVEN_HOME is not set. java2docfx requires MAVEN_HOME be set" + exit 1 + } else { + Write-Host "MAVEN_HOME=$($ENV:MAVEN_HOME)" + $java2docfxVer = Get-Content eng/scripts/docs/java2docfx.version.txt + $java2docfxDir = Join-Path $(Build.BinariesDirectory) "java2docfx" + New-Item $java2docfxDir -ItemType Directory | Out-Null + $originLocation = Get-Location + try { + # Set the location into the created java2docfx directory . Running mvn from the repository root + # picks up the root POM and processes that while doing the dependency:copy in spite of + # the fact it has nothing to do with this download. + Set-Location $java2docfxDir + Write-Host "mvn dependency:copy -Dartifact=""com.microsoft:java2docfx:$java2docfxVer"" -DoutputDirectory=""$java2docfxDir""" + mvn dependency:copy -Dartifact="com.microsoft:java2docfx:$java2docfxVer" -DoutputDirectory="$java2docfxDir" + $java2docfxJarLoc = Join-Path $java2docfxDir -ChildPath "java2docfx-$java2docfxVer.jar" + Write-Host "Testing the install, running java -jar $java2docfxJarLoc -h" + java -jar $java2docfxJarLoc -h + } finally { + Set-Location $originLocation + } } displayName: Install java2docfx for package validation \ No newline at end of file From bf5828e6e3404a2fa94917437d33f71655b26f21 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Tue, 23 Apr 2024 14:40:38 -0700 Subject: [PATCH 17/22] Updates for Java PR 39875 which had changes from this PR that were more immediate --- .../stages/archetype-java-release-batch.yml | 4 ++-- .../stages/archetype-java-release-patch.yml | 2 +- .../stages/archetype-java-release.yml | 4 ++-- .../steps/mvn-linux-settings-for-docs.yml | 21 ------------------- eng/scripts/docs/Docs-ToC.ps1 | 2 -- 5 files changed, 5 insertions(+), 28 deletions(-) delete mode 100644 eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml diff --git a/eng/pipelines/templates/stages/archetype-java-release-batch.yml b/eng/pipelines/templates/stages/archetype-java-release-batch.yml index a5b8c4e629d7..aa9d36b53bc9 100644 --- a/eng/pipelines/templates/stages/archetype-java-release-batch.yml +++ b/eng/pipelines/templates/stages/archetype-java-release-batch.yml @@ -335,7 +335,7 @@ stages: displayName: 'Download Artifact: ${{parameters.ArtifactName}}' artifact: ${{parameters.ArtifactName}} - - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml + - template: /eng/pipelines/templates/steps/mvn-linux-repository-settings.yml - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml @@ -476,7 +476,7 @@ stages: Get-ChildItem -Recurse $(Pipeline.Workspace)/${{parameters.ArtifactName}}/ displayName: Show visible artifacts - - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml + - template: /eng/pipelines/templates/steps/mvn-linux-repository-settings.yml - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml diff --git a/eng/pipelines/templates/stages/archetype-java-release-patch.yml b/eng/pipelines/templates/stages/archetype-java-release-patch.yml index d9a13424ec1a..a32c1257f440 100644 --- a/eng/pipelines/templates/stages/archetype-java-release-patch.yml +++ b/eng/pipelines/templates/stages/archetype-java-release-patch.yml @@ -256,7 +256,7 @@ stages: - download: current displayName: 'Download Artifact: ${{parameters.ArtifactName}}' artifact: ${{parameters.ArtifactName}} - - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml + - template: /eng/pipelines/templates/steps/mvn-linux-repository-settings.yml - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml parameters: diff --git a/eng/pipelines/templates/stages/archetype-java-release.yml b/eng/pipelines/templates/stages/archetype-java-release.yml index 4ebb740e7780..262994236522 100644 --- a/eng/pipelines/templates/stages/archetype-java-release.yml +++ b/eng/pipelines/templates/stages/archetype-java-release.yml @@ -274,7 +274,7 @@ stages: displayName: 'Download Artifact: ${{parameters.ArtifactName}}' artifact: ${{parameters.ArtifactName}} - - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml + - template: /eng/pipelines/templates/steps/mvn-linux-repository-settings.yml - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml @@ -459,7 +459,7 @@ stages: Get-ChildItem -Recurse $(Pipeline.Workspace)/${{parameters.ArtifactName}}/ displayName: Show visible artifacts - - template: /eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml + - template: /eng/pipelines/templates/steps/mvn-linux-repository-settings.yml - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml diff --git a/eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml b/eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml deleted file mode 100644 index 18a59f208fce..000000000000 --- a/eng/pipelines/templates/steps/mvn-linux-settings-for-docs.yml +++ /dev/null @@ -1,21 +0,0 @@ -steps: - # /eng/repo-docs/docms/daily.update.setting.xml contains two settings - # 1. The java dev feed - This is for nightly builds and official builds, both of which publish - # to the dev feed. In the case of official builds, setting this up prevents us from having - # to deal with sonatype which may or may not have what was just published available. - # 2. The docs-public-packages dev feed. This is where the docs java library, java2docfx is - # published. Nightly builds and official releases are published here and, while official releases - # are also published to sonatype, it's better to hit the public dev feed whenever possible. - # Here is maven documentation: https://maven.apache.org/guides/mini/guide-multiple-repositories.html - - powershell: | - # Linux mvn `setting.xml` is sitting under path `~/.m2/setting.xml` - Get-Command mvn - if (!(Test-Path '~/.m2/')) { - mkdir ~/.m2/ - } - if (Test-Path '~/.m2/setting.xml') { - Write-Host "'setting.xml' exists. Overwriting the file to support multiple repositories." - } - Copy-Item "./eng/repo-docs/docms/daily.update.setting.xml" -Destination "~/.m2/settings.xml" - displayName: 'Configure mvn settings on linux' - workingDirectory: $(Build.SourcesDirectory) diff --git a/eng/scripts/docs/Docs-ToC.ps1 b/eng/scripts/docs/Docs-ToC.ps1 index 417a5637133d..153229377075 100644 --- a/eng/scripts/docs/Docs-ToC.ps1 +++ b/eng/scripts/docs/Docs-ToC.ps1 @@ -138,7 +138,6 @@ function Get-Toc-Children($package, $docRepoLocation) { } } # Sort the array and clean out any dupes (there shouldn't be any but better safe than sorry) - # Ensure that Sort-Object returns an array even if there's only a single object. $namespaces = @($namespaces | Sort-Object -Unique) # Ensure that this always returns an array, even if there's one item or 0 items Write-Output -NoEnumerate $namespaces @@ -222,7 +221,6 @@ function Fetch-Namespaces-From-Javadoc($package, $groupId, $version) { } } - # Ensure that Sort-Object returns an array even if there's only a single object. $namespaces = @($namespaces | Sort-Object -Unique) # Make sure this always returns an array Write-Output -NoEnumerate $namespaces From 784ec97bc4e15d0568bce0d3533588d5d4683c67 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Mon, 29 Apr 2024 11:20:27 -0700 Subject: [PATCH 18/22] Update java2docfx version --- eng/scripts/docs/java2docfx.version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/scripts/docs/java2docfx.version.txt b/eng/scripts/docs/java2docfx.version.txt index e6d5cb833c63..e4c0d46e55ff 100644 --- a/eng/scripts/docs/java2docfx.version.txt +++ b/eng/scripts/docs/java2docfx.version.txt @@ -1 +1 @@ -1.0.2 \ No newline at end of file +1.0.3 \ No newline at end of file From 387d38d5ee828456b3d5ec439394cd4b8c84489c Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Mon, 29 Apr 2024 11:59:08 -0700 Subject: [PATCH 19/22] remove check for MAVEN_HOME which was only for testing --- .../steps/install-rex-validation-tool.yml | 38 ++++++++----------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/eng/pipelines/templates/steps/install-rex-validation-tool.yml b/eng/pipelines/templates/steps/install-rex-validation-tool.yml index 33c7e7141d86..904e04402123 100644 --- a/eng/pipelines/templates/steps/install-rex-validation-tool.yml +++ b/eng/pipelines/templates/steps/install-rex-validation-tool.yml @@ -2,27 +2,21 @@ steps: # Create a java2docfx subdirectory in the $(Build.BinariesDirectory) and install the java2docfx there # This way, the jar file is in its own subdirectory and isolated. - pwsh: | - if (!$ENV:MAVEN_HOME) { - Write-Error "MAVEN_HOME is not set. java2docfx requires MAVEN_HOME be set" - exit 1 - } else { - Write-Host "MAVEN_HOME=$($ENV:MAVEN_HOME)" - $java2docfxVer = Get-Content eng/scripts/docs/java2docfx.version.txt - $java2docfxDir = Join-Path $(Build.BinariesDirectory) "java2docfx" - New-Item $java2docfxDir -ItemType Directory | Out-Null - $originLocation = Get-Location - try { - # Set the location into the created java2docfx directory . Running mvn from the repository root - # picks up the root POM and processes that while doing the dependency:copy in spite of - # the fact it has nothing to do with this download. - Set-Location $java2docfxDir - Write-Host "mvn dependency:copy -Dartifact=""com.microsoft:java2docfx:$java2docfxVer"" -DoutputDirectory=""$java2docfxDir""" - mvn dependency:copy -Dartifact="com.microsoft:java2docfx:$java2docfxVer" -DoutputDirectory="$java2docfxDir" - $java2docfxJarLoc = Join-Path $java2docfxDir -ChildPath "java2docfx-$java2docfxVer.jar" - Write-Host "Testing the install, running java -jar $java2docfxJarLoc -h" - java -jar $java2docfxJarLoc -h - } finally { - Set-Location $originLocation - } + $java2docfxVer = Get-Content eng/scripts/docs/java2docfx.version.txt + $java2docfxDir = Join-Path $(Build.BinariesDirectory) "java2docfx" + New-Item $java2docfxDir -ItemType Directory | Out-Null + $originLocation = Get-Location + try { + # Set the location into the created java2docfx directory . Running mvn from the repository root + # picks up the root POM and processes that while doing the dependency:copy in spite of + # the fact it has nothing to do with this download. + Set-Location $java2docfxDir + Write-Host "mvn dependency:copy -Dartifact=""com.microsoft:java2docfx:$java2docfxVer"" -DoutputDirectory=""$java2docfxDir""" + mvn dependency:copy -Dartifact="com.microsoft:java2docfx:$java2docfxVer" -DoutputDirectory="$java2docfxDir" + $java2docfxJarLoc = Join-Path $java2docfxDir -ChildPath "java2docfx-$java2docfxVer.jar" + Write-Host "Testing the install, running java -jar $java2docfxJarLoc -h" + java -jar $java2docfxJarLoc -h + } finally { + Set-Location $originLocation } displayName: Install java2docfx for package validation \ No newline at end of file From c83b4e4e70c6ae5c5cc93a89dbb6ec0cb6df3ffd Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Tue, 30 Apr 2024 10:25:13 -0700 Subject: [PATCH 20/22] Update the version of java2docfx to test a fix --- eng/scripts/docs/java2docfx.version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/scripts/docs/java2docfx.version.txt b/eng/scripts/docs/java2docfx.version.txt index e4c0d46e55ff..e5142fbc6ba0 100644 --- a/eng/scripts/docs/java2docfx.version.txt +++ b/eng/scripts/docs/java2docfx.version.txt @@ -1 +1 @@ -1.0.3 \ No newline at end of file +1.0.4-alpha.20240429.2 \ No newline at end of file From a3f089e12b666c92b5a9a7bd9d2855e2fed07033 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Mon, 6 May 2024 08:11:16 -0700 Subject: [PATCH 21/22] Update version of java2docfx to 1.0.4 --- eng/scripts/docs/java2docfx.version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/scripts/docs/java2docfx.version.txt b/eng/scripts/docs/java2docfx.version.txt index e5142fbc6ba0..a6a3a43c3a04 100644 --- a/eng/scripts/docs/java2docfx.version.txt +++ b/eng/scripts/docs/java2docfx.version.txt @@ -1 +1 @@ -1.0.4-alpha.20240429.2 \ No newline at end of file +1.0.4 \ No newline at end of file From a3eedecd369ff1eba2872348547b1b7be4e6eca0 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Mon, 6 May 2024 09:08:29 -0700 Subject: [PATCH 22/22] revert template's ci.yml changes that were only necessary to test java2docfx --- sdk/template/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/template/ci.yml b/sdk/template/ci.yml index 55e2d561f4ca..8f557e2e526f 100644 --- a/sdk/template/ci.yml +++ b/sdk/template/ci.yml @@ -79,17 +79,17 @@ extends: groupId: com.azure safeName: azuresdktemplate releaseInBatch: ${{ parameters.release_azuresdktemplate }} - #skipPublishDocMs: true + skipPublishDocMs: true - name: azure-sdk-template-two groupId: com.azure safeName: azuresdktemplatetwo releaseInBatch: ${{ parameters.release_azuresdktemplatetwo }} - #skipPublishDocMs: true + skipPublishDocMs: true - name: azure-sdk-template-three groupId: com.azure safeName: azuresdktemplatethree releaseInBatch: ${{ parameters.release_azuresdktemplatethree }} - #skipPublishDocMs: true + skipPublishDocMs: true AdditionalModules: - name: azure-template-perf groupId: com.azure