Skip to content

Commit ad52b4f

Browse files
azure-sdksima-zhu
andauthored
Sync eng/common directory with azure-sdk-tools for PR 1226 (Azure#12651)
* 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>
1 parent b1dbb64 commit ad52b4f

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

eng/common/docgeneration/Generate-DocIndex.ps1

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Param (
99
$MainJsPath = "${PSScriptRoot}\templates\matthews\styles\main.js"
1010
)
1111
. "${PSScriptRoot}\..\scripts\common.ps1"
12-
$GetGithubIoDocIndexFn = "Get-${Language}-GithubIoDocIndex"
1312

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

165-
function Mutate-Files {
164+
function UpdateDocIndexFiles {
166165
Param (
167-
[Parameter(Mandatory=$true)] [String]$appTitle,
168-
[Parameter(Mandatory=$true)] [String]$lang,
169-
[Parameter(Mandatory=$true)] [String]$indexhtmlloc,
166+
[Parameter(Mandatory=$false)] [String]$appTitleLang = $Language,
167+
[Parameter(Mandatory=$false)] [String]$lang = $Language,
168+
[Parameter(Mandatory=$false)] [String]$indexhtmlloc = "index.html",
170169
[Parameter(Mandatory=$false)] [String]$packageRegex = "`"`"",
171170
[Parameter(Mandatory=$false)] [String]$regexReplacement = ""
172171
)
173172
# Update docfx.json
174173
$docfxContent = Get-Content -Path $DocfxJsonPath -Raw
175-
$docfxContent = $docfxContent -replace "`"_appTitle`": `"`"", "`"_appTitle`": `"$appTitle`""
176-
$docfxContent = $docfxContent -replace "`"_appFooter`": `"`"", "`"_appFooter`": `"$appTitle`""
174+
$docfxContent = $docfxContent -replace "`"_appTitle`": `"`"", "`"_appTitle`": `"Azure SDK for $appTitleLang`""
175+
$docfxContent = $docfxContent -replace "`"_appFooter`": `"`"", "`"_appFooter`": `"Azure SDK for $appTitleLang`""
177176
Set-Content -Path $DocfxJsonPath -Value $docfxContent
178177
# Update main.js var lang
179178
$mainJsContent = Get-Content -Path $MainJsPath -Raw
@@ -192,5 +191,5 @@ if ($GetGithubIoDocIndexFn -and (Test-Path "function:$GetGithubIoDocIndexFn"))
192191
}
193192
else
194193
{
195-
LogWarning "The function '$GetGithubIoDocIndexFn' was not found."
194+
LogWarning "The function 'GetGithubIoDocIndexFn' was not found."
196195
}

eng/common/pipelines/templates/steps/docindex.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
jobs:
22
- job: CreateDocIndex
3-
variables:
4-
- template: templates/variables/globals.yml
53
pool:
64
vmImage: windows-2019
75
steps:
@@ -49,7 +47,7 @@ jobs:
4947
targetPath: $(Build.ArtifactStagingDirectory)/docfx_project/_site
5048

5149
- pwsh: |
52-
git checkout -b gh-pages-local --track origin/gh-pages-root
50+
git checkout -b gh-pages-local --track origin/gh-pages-root -f
5351
workingDirectory: $(Build.SourcesDirectory)
5452
displayName: Git pull GH pages branch
5553

eng/common/scripts/common.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ if (-not $LanguageShort)
3333
$GetPackageInfoFromRepoFn = "Get-${Language}-PackageInfoFromRepo"
3434
$GetPackageInfoFromPackageFileFn = "Get-${Language}-PackageInfoFromPackageFile"
3535
$PublishGithubIODocsFn = "Publish-${Language}-GithubIODocs"
36-
$UpdateDocCIFn = "Update-${Language}-CIConfig"
36+
$UpdateDocCIFn = "Update-${Language}-CIConfig"
37+
$GetGithubIoDocIndexFn = "Get-${Language}-GithubIoDocIndex"

0 commit comments

Comments
 (0)