Skip to content

Commit 6d6292c

Browse files
freddydkaholstrup1
andauthored
Fix aldoc in BC 25.0 (#1233)
Co-authored-by: freddydk <[email protected]> Co-authored-by: Alexander Holstrup <[email protected]>
1 parent 8ae7fea commit 6d6292c

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1

+25-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
function DownloadAlDoc {
22
if ("$ENV:aldocPath" -eq "") {
3+
$ENV:aldocCommand = ''
34
Write-Host "Locating aldoc"
45
$artifactUrl = Get-BCArtifactUrl -type sandbox -country core -select Latest -accept_insiderEula
56
Write-Host "Downloading aldoc"
@@ -13,6 +14,14 @@
1314
Remove-Item -Path "$($tempFolder).zip" -Force
1415
if ($IsLinux) {
1516
$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+
}
1625
}
1726
else {
1827
$ENV:aldocPath = Join-Path $tempFolder 'extension/bin/win32/aldoc.exe'
@@ -21,12 +30,11 @@
2130
throw "aldoc tool not found at $ENV:aldocPath"
2231
}
2332
if ($IsLinux) {
24-
& /usr/bin/env sudo pwsh -command "& chmod +x $ENV:aldocPath"
2533
}
2634
Write-Host "Installing/Updating docfx"
2735
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"
2836
}
29-
return $ENV:aldocPath
37+
return $ENV:aldocPath, $ENV:aldocCommand
3038
}
3139

3240
function SanitizeFileName([string] $fileName) {
@@ -167,7 +175,15 @@ function GenerateDocsSite {
167175
}
168176
$indexContent = ReplacePlaceHolders -str $indexTemplate -version $version -releaseNotes $releaseNotes -indexTemplateRelativePath $thisTemplateRelativePath
169177

170-
$alDocPath = DownloadAlDoc
178+
$aldocPath, $aldocCommand = DownloadAlDoc
179+
if ($aldocCommand) {
180+
$aldocArguments = @($aldocPath)
181+
}
182+
else {
183+
$aldocArguments = @()
184+
$aldocCommand = $aldocPath
185+
}
186+
171187
$docfxPath = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString())
172188
New-Item -Path $docfxPath -ItemType Directory | Out-Null
173189
try {
@@ -181,14 +197,14 @@ function GenerateDocsSite {
181197
}
182198
$apps = @($apps | Select-Object -Unique)
183199

184-
$arguments = @(
200+
$arguments = $aldocArguments + @(
185201
"init"
186202
"--output ""$docfxpath"""
187203
"--loglevel $loglevel"
188204
"--targetpackages ""$($apps -join '","')"""
189205
)
190-
Write-Host "invoke aldoc $arguments"
191-
CmdDo -command $aldocPath -arguments $arguments
206+
Write-Host "invoke $aldocCommand $arguments"
207+
CmdDo -command $aldocCommand -arguments $arguments
192208

193209
# Update docfx.json
194210
Write-Host "Update docfx.json"
@@ -214,14 +230,14 @@ function GenerateDocsSite {
214230
Get-Content $tocYmlFile | Out-Host
215231

216232
$apps | ForEach-Object {
217-
$arguments = @(
233+
$arguments = $aldocArguments + @(
218234
"build"
219235
"--output ""$docfxpath"""
220236
"--loglevel $loglevel"
221237
"--source ""$_"""
222238
)
223-
Write-Host "invoke aldoc $arguments"
224-
CmdDo -command $aldocPath -arguments $arguments
239+
Write-Host "invoke $aldocCommand $arguments"
240+
CmdDo -command $aldocCommand -arguments $arguments
225241
}
226242

227243
# Set release notes

RELEASENOTES.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
### Issues
22

33
- Issue 1184 Publish to Environment fails on 'Permission Denied'
4+
- AL Language extension in 25.0 doesn't contain the linux executable, use dotnet to invoke the dll instead.
45

56
### New Settings
67

0 commit comments

Comments
 (0)