forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add v2 docs onboarding for Java * Add onboarding logic for onboarding v2 * Set skipPublishDocMs for packages that are skipped in Language-Settings.ps1 and should not publish docs. * Ignore errors removing path that doesn't exist (ensure that test runs on local machine are clean, it's OK if files aren't present to clean up. * Revert "Set skipPublishDocMs for packages that are skipped in Language-Settings.ps1 and should not publish docs." This reverts commit d383cad.
- Loading branch information
1 parent
b6e5ed1
commit fe7e43e
Showing
4 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#$SetDocsPackageOnboarding = "Set-${Language}-DocsPackageOnboarding" | ||
function Set-java-DocsPackageOnboarding($moniker, $metadata, $docRepoLocation, $packageSourceOverride) { | ||
|
||
# Do not write onboarding information for legacy moniker | ||
# TODO: remove this once legacy moniker is properly configured | ||
if ($moniker -eq 'legacy') { | ||
return | ||
} | ||
|
||
$packageJsonPath = Join-Path $docRepoLocation "package.json" | ||
$onboardingInfo = Get-Content $packageJsonPath | ConvertFrom-Json | ||
|
||
$monikerOutputPath = "docs-ref-autogen" | ||
if ($moniker -ne 'latest') { | ||
$monikerOutputPath = "$moniker/docs-ref-autogen" | ||
} | ||
$monikerIndex = -1 | ||
for($i = 0; $i -lt $onboardingInfo.Count; $i++) { | ||
if ($onboardingInfo[$i].output_path -eq $monikerOutputPath) { | ||
$monikerIndex = $i | ||
break | ||
} | ||
} | ||
|
||
if ($monikerIndex -eq -1) { | ||
Write-Error "No appropriate index for moniker $moniker" | ||
} | ||
|
||
$onboardedPackages = @() | ||
foreach ($package in $metadata) { | ||
$packageInfo = [ordered]@{ | ||
packageArtifactId = $package.Name | ||
packageGroupId = $package.Group | ||
packageVersion = $package.Version | ||
|
||
# packageDownloadUrl is required by docs build and other values are | ||
# rejected. This is a temporary workaround until the docs build | ||
# supports more package stores. | ||
packageDownloadUrl = 'https://repo1.maven.org/maven2' | ||
} | ||
|
||
# Add items from 'DocsCiConfigProperties' into onboarding info. If a | ||
# property already exists, it will be overwritten. | ||
if ($package.ContainsKey('DocsCiConfigProperties')) { | ||
foreach ($key in $package['DocsCiConfigProperties'].Keys) { | ||
$packageInfo[$key] = $package['DocsCiConfigProperties'][$key] | ||
} | ||
} | ||
|
||
$onboardedPackages += $packageInfo | ||
} | ||
|
||
$onboardingInfo[$monikerIndex].packages = $onboardedPackages | ||
|
||
Set-Content -Path $packageJsonPath -Value (ConvertTo-Json -InputObject $onboardingInfo -Depth 100) | ||
} | ||
|
||
#$GetDocsPackagesAlreadyOnboarded = "Get-${Language}-DocsPackagesAlreadyOnboarded" | ||
function Get-java-DocsPackagesAlreadyOnboarded($docRepoLocation, $moniker) { | ||
return Get-java-OnboardedDocsMsPackagesForMoniker $docRepoLocation $moniker | ||
} | ||
|
||
# $GetPackageIdentity = "Get-${Language}-PackageIdentity" | ||
function Get-java-PackageIdentity($package) { | ||
return "$($package['Group']):$($package['Name'])" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Import-Module Pester | ||
|
||
BeforeAll { | ||
. $PSScriptRoot/../Docs-Onboarding.ps1 | ||
} | ||
|
||
Describe 'Get-java-PackageIdentity' { | ||
It 'should return the package identity' { | ||
$package = [ordered]@{ | ||
Name = 'packageName' | ||
Group = 'packageGroup' | ||
} | ||
|
||
$packageIdentity = Get-java-PackageIdentity $package | ||
$packageIdentity | Should -Be 'packageGroup:packageName' | ||
} | ||
} |