1
1
function DownloadAlDoc {
2
2
if (" $ENV: aldocPath " -eq " " ) {
3
+ $ENV: aldocCommand = ' '
3
4
Write-Host " Locating aldoc"
4
5
$artifactUrl = Get-BCArtifactUrl - type sandbox - country core - select Latest - accept_insiderEula
5
6
Write-Host " Downloading aldoc"
13
14
Remove-Item - Path " $ ( $tempFolder ) .zip" - Force
14
15
if ($IsLinux ) {
15
16
$ENV: aldocPath = Join-Path $tempFolder ' extension/bin/linux/aldoc'
17
+ if (Test-Path $ENV: aldocPath ) {
18
+ & / usr/ bin/ env sudo pwsh - command " & chmod +x $ENV: aldocPath "
19
+ }
20
+ else {
21
+ # If the executable isn't found, use dotnet to run the dll
22
+ $ENV: aldocPath = Join-Path $tempFolder ' extension/bin/linux/aldoc.dll'
23
+ $ENV: aldocCommand = ' dotnet'
24
+ }
16
25
}
17
26
else {
18
27
$ENV: aldocPath = Join-Path $tempFolder ' extension/bin/win32/aldoc.exe'
21
30
throw " aldoc tool not found at $ENV: aldocPath "
22
31
}
23
32
if ($IsLinux ) {
24
- & / usr/ bin/ env sudo pwsh - command " & chmod +x $ENV: aldocPath "
25
33
}
26
34
Write-Host " Installing/Updating docfx"
27
35
CmdDo - command dotnet - arguments @ (" tool" , " update" , " --global docfx --version 2.75.3" ) - messageIfCmdNotFound " dotnet not found. Please install it from https://dotnet.microsoft.com/download"
28
36
}
29
- return $ENV: aldocPath
37
+ return $ENV: aldocPath , $ ENV: aldocCommand
30
38
}
31
39
32
40
function SanitizeFileName ([string ] $fileName ) {
@@ -167,7 +175,15 @@ function GenerateDocsSite {
167
175
}
168
176
$indexContent = ReplacePlaceHolders - str $indexTemplate - version $version - releaseNotes $releaseNotes - indexTemplateRelativePath $thisTemplateRelativePath
169
177
170
- $alDocPath = DownloadAlDoc
178
+ $aldocPath , $aldocCommand = DownloadAlDoc
179
+ if ($aldocCommand ) {
180
+ $aldocArguments = @ ($aldocPath )
181
+ }
182
+ else {
183
+ $aldocArguments = @ ()
184
+ $aldocCommand = $aldocPath
185
+ }
186
+
171
187
$docfxPath = Join-Path ([System.IO.Path ]::GetTempPath()) ([Guid ]::NewGuid().ToString())
172
188
New-Item - Path $docfxPath - ItemType Directory | Out-Null
173
189
try {
@@ -181,14 +197,14 @@ function GenerateDocsSite {
181
197
}
182
198
$apps = @ ($apps | Select-Object - Unique)
183
199
184
- $arguments = @ (
200
+ $arguments = $aldocArguments + @ (
185
201
" init"
186
202
" --output "" $docfxpath "" "
187
203
" --loglevel $loglevel "
188
204
" --targetpackages "" $ ( $apps -join ' ","' ) "" "
189
205
)
190
- Write-Host " invoke aldoc $arguments "
191
- CmdDo - command $aldocPath - arguments $arguments
206
+ Write-Host " invoke $aldocCommand $arguments "
207
+ CmdDo - command $aldocCommand - arguments $arguments
192
208
193
209
# Update docfx.json
194
210
Write-Host " Update docfx.json"
@@ -214,14 +230,14 @@ function GenerateDocsSite {
214
230
Get-Content $tocYmlFile | Out-Host
215
231
216
232
$apps | ForEach-Object {
217
- $arguments = @ (
233
+ $arguments = $aldocArguments + @ (
218
234
" build"
219
235
" --output "" $docfxpath "" "
220
236
" --loglevel $loglevel "
221
237
" --source "" $_ "" "
222
238
)
223
- Write-Host " invoke aldoc $arguments "
224
- CmdDo - command $aldocPath - arguments $arguments
239
+ Write-Host " invoke $aldocCommand $arguments "
240
+ CmdDo - command $aldocCommand - arguments $arguments
225
241
}
226
242
227
243
# Set release notes
0 commit comments