Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 1226 (Azure#17128)
Browse files Browse the repository at this point in the history
* Fixed the docindex.yml and rename the files

* Reset the mutated changes

* Force checkout as the changes have already copied out

* Minor changes for parameters

* Update Generate-DocIndex.ps1

* Update Generate-DocIndex.ps1

* Update Generate-DocIndex.ps1

* Added function to common

* Update Generate-DocIndex.ps1

Co-authored-by: Sima Zhu <sizhu@microsoft.com>
Co-authored-by: Sima Zhu <48036328+sima-zhu@users.noreply.github.com>
  • Loading branch information
3 people authored and annelo-msft committed Feb 17, 2021
1 parent 92ddaad commit 341d09d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
17 changes: 8 additions & 9 deletions eng/common/docgeneration/Generate-DocIndex.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Param (
$MainJsPath = "${PSScriptRoot}\templates\matthews\styles\main.js"
)
. "${PSScriptRoot}\..\scripts\common.ps1"
$GetGithubIoDocIndexFn = "Get-${Language}-GithubIoDocIndex"

# Given the metadata url under https://github.com/Azure/azure-sdk/tree/master/_data/releases/latest,
# the function will return the csv metadata back as part of response.
Expand Down Expand Up @@ -119,7 +118,7 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang) {
New-Item -Path $YmlPath -Name "toc.yml" -Force
$visitedService = @{}
# Sort and display toc service name by alphabetical order, and then sort artifact by order.
foreach ($serviceMapping in ($tocContent.GetEnumerator() | Sort-Object Value[0], Key)) {
foreach ($serviceMapping in ($tocContent.GetEnumerator() | Sort-Object Value, Key)) {
$artifact = $serviceMapping.Key
$serviceName = $serviceMapping.Value[0]
$displayName = $serviceMapping.Value[1]
Expand Down Expand Up @@ -162,18 +161,18 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang) {
Copy-Item "${DocGenDir}/assets/logo.svg" -Destination "${DocOutDir}/_site/" -Force
}

function Mutate-Files {
function UpdateDocIndexFiles {
Param (
[Parameter(Mandatory=$true)] [String]$appTitle,
[Parameter(Mandatory=$true)] [String]$lang,
[Parameter(Mandatory=$true)] [String]$indexhtmlloc,
[Parameter(Mandatory=$false)] [String]$appTitleLang = $Language,
[Parameter(Mandatory=$false)] [String]$lang = $Language,
[Parameter(Mandatory=$false)] [String]$indexhtmlloc = "index.html",
[Parameter(Mandatory=$false)] [String]$packageRegex = "`"`"",
[Parameter(Mandatory=$false)] [String]$regexReplacement = ""
)
# Update docfx.json
$docfxContent = Get-Content -Path $DocfxJsonPath -Raw
$docfxContent = $docfxContent -replace "`"_appTitle`": `"`"", "`"_appTitle`": `"$appTitle`""
$docfxContent = $docfxContent -replace "`"_appFooter`": `"`"", "`"_appFooter`": `"$appTitle`""
$docfxContent = $docfxContent -replace "`"_appTitle`": `"`"", "`"_appTitle`": `"Azure SDK for $appTitleLang`""
$docfxContent = $docfxContent -replace "`"_appFooter`": `"`"", "`"_appFooter`": `"Azure SDK for $appTitleLang`""
Set-Content -Path $DocfxJsonPath -Value $docfxContent
# Update main.js var lang
$mainJsContent = Get-Content -Path $MainJsPath -Raw
Expand All @@ -192,5 +191,5 @@ if ($GetGithubIoDocIndexFn -and (Test-Path "function:$GetGithubIoDocIndexFn"))
}
else
{
LogWarning "The function '$GetGithubIoDocIndexFn' was not found."
LogWarning "The function 'GetGithubIoDocIndexFn' was not found."
}
4 changes: 1 addition & 3 deletions eng/common/pipelines/templates/steps/docindex.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
jobs:
- job: CreateDocIndex
variables:
- template: templates/variables/globals.yml
pool:
vmImage: windows-2019
steps:
Expand Down Expand Up @@ -49,7 +47,7 @@ jobs:
targetPath: $(Build.ArtifactStagingDirectory)/docfx_project/_site

- pwsh: |
git checkout -b gh-pages-local --track origin/gh-pages-root
git checkout -b gh-pages-local --track origin/gh-pages-root -f
workingDirectory: $(Build.SourcesDirectory)
displayName: Git pull GH pages branch
Expand Down
3 changes: 2 additions & 1 deletion eng/common/scripts/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ if (-not $LanguageShort)
$GetPackageInfoFromRepoFn = "Get-${Language}-PackageInfoFromRepo"
$GetPackageInfoFromPackageFileFn = "Get-${Language}-PackageInfoFromPackageFile"
$PublishGithubIODocsFn = "Publish-${Language}-GithubIODocs"
$UpdateDocCIFn = "Update-${Language}-CIConfig"
$UpdateDocCIFn = "Update-${Language}-CIConfig"
$GetGithubIoDocIndexFn = "Get-${Language}-GithubIoDocIndex"

0 comments on commit 341d09d

Please sign in to comment.