From 8db24b237b210a2e248ef888bb012d6bedd4b428 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 25 Sep 2024 09:46:41 -0700 Subject: [PATCH 1/3] Docs onboarding cleanup --- eng/scripts/Language-Settings.ps1 | 85 --------------------------- eng/scripts/docs/Docs-Onboarding.ps1 | 88 +++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 86 deletions(-) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index dfbd0f1ba16c4..c4dd1db98b1db 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -379,91 +379,6 @@ function Get-java-DocsMsMetadataForPackage($PackageInfo) { } } -# Defined in common.ps1 as: -# $ValidateDocsMsPackagesFn = "Validate-${Language}-DocMsPackages" -function Validate-java-DocMsPackages ($PackageInfo, $PackageInfos, $DocValidationImageId) { - # While eng/common/scripts/Update-DocsMsMetadata.ps1 is still passing a single packageInfo, process as a batch - if (!$PackageInfos) { - $PackageInfos = @($PackageInfo) - } - - # 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 ""$artifact""" - $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 $allSuccess -} - function Get-java-EmitterName() { return "@azure-tools/typespec-java" } diff --git a/eng/scripts/docs/Docs-Onboarding.ps1 b/eng/scripts/docs/Docs-Onboarding.ps1 index e00958605ac29..3b3af23bdce99 100644 --- a/eng/scripts/docs/Docs-Onboarding.ps1 +++ b/eng/scripts/docs/Docs-Onboarding.ps1 @@ -62,4 +62,90 @@ function Get-java-PackageIdentity($package) { # $GetPackageIdentityFromCsvMetadata = "Get-${Language}-PackageIdentityFromCsvMetadata" function Get-java-PackageIdentityFromCsvMetadata($package) { return "$($package.GroupId):$($Package.Package)" -} \ No newline at end of file +} + + +# Defined in common.ps1 as: +# $ValidateDocsMsPackagesFn = "Validate-${Language}-DocMsPackages" +function Validate-java-DocMsPackages ($PackageInfo, $PackageInfos, $DocValidationImageId) { + # While eng/common/scripts/Update-DocsMsMetadata.ps1 is still passing a single packageInfo, process as a batch + if (!$PackageInfos) { + $PackageInfos = @($PackageInfo) + } + + # 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 ""$artifact""" + $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 $allSuccess + } From 9ac66e571a2f15c728932415197c998f2ceedd0e Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 25 Sep 2024 09:48:40 -0700 Subject: [PATCH 2/3] REVERT - enable docs.ms publishing for azure-sdk-template for testing --- sdk/template/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/template/ci.yml b/sdk/template/ci.yml index 8b3c77612241e..f0ccff18c0fa4 100644 --- a/sdk/template/ci.yml +++ b/sdk/template/ci.yml @@ -78,7 +78,6 @@ extends: groupId: com.azure safeName: azuresdktemplate releaseInBatch: ${{ parameters.release_azuresdktemplate }} - skipPublishDocMs: true - name: azure-sdk-template-two groupId: com.azure safeName: azuresdktemplatetwo From c20bfe2a99920b17ee4e5464d88e039b54964361 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 25 Sep 2024 11:41:03 -0700 Subject: [PATCH 3/3] Revert "REVERT - enable docs.ms publishing for azure-sdk-template for testing" This reverts commit 9ac66e571a2f15c728932415197c998f2ceedd0e. --- sdk/template/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/template/ci.yml b/sdk/template/ci.yml index f0ccff18c0fa4..8b3c77612241e 100644 --- a/sdk/template/ci.yml +++ b/sdk/template/ci.yml @@ -78,6 +78,7 @@ extends: groupId: com.azure safeName: azuresdktemplate releaseInBatch: ${{ parameters.release_azuresdktemplate }} + skipPublishDocMs: true - name: azure-sdk-template-two groupId: com.azure safeName: azuresdktemplatetwo