From 6d6292c0fc1295bccd0ec2e91a916bce02210d0f Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Fri, 4 Oct 2024 09:23:38 +0200 Subject: [PATCH] Fix aldoc in BC 25.0 (#1233) Co-authored-by: freddydk Co-authored-by: Alexander Holstrup <117829001+aholstrup1@users.noreply.github.com> --- ...ReferenceDocumentation.HelperFunctions.ps1 | 34 ++++++++++++++----- RELEASENOTES.md | 1 + 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index 733fc5345..7dc0bc4bd 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -1,5 +1,6 @@ function DownloadAlDoc { if ("$ENV:aldocPath" -eq "") { + $ENV:aldocCommand = '' Write-Host "Locating aldoc" $artifactUrl = Get-BCArtifactUrl -type sandbox -country core -select Latest -accept_insiderEula Write-Host "Downloading aldoc" @@ -13,6 +14,14 @@ Remove-Item -Path "$($tempFolder).zip" -Force if ($IsLinux) { $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/linux/aldoc' + if (Test-Path $ENV:aldocPath) { + & /usr/bin/env sudo pwsh -command "& chmod +x $ENV:aldocPath" + } + else { + # If the executable isn't found, use dotnet to run the dll + $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/linux/aldoc.dll' + $ENV:aldocCommand = 'dotnet' + } } else { $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/win32/aldoc.exe' @@ -21,12 +30,11 @@ throw "aldoc tool not found at $ENV:aldocPath" } if ($IsLinux) { - & /usr/bin/env sudo pwsh -command "& chmod +x $ENV:aldocPath" } Write-Host "Installing/Updating docfx" 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" } - return $ENV:aldocPath + return $ENV:aldocPath, $ENV:aldocCommand } function SanitizeFileName([string] $fileName) { @@ -167,7 +175,15 @@ function GenerateDocsSite { } $indexContent = ReplacePlaceHolders -str $indexTemplate -version $version -releaseNotes $releaseNotes -indexTemplateRelativePath $thisTemplateRelativePath - $alDocPath = DownloadAlDoc + $aldocPath, $aldocCommand = DownloadAlDoc + if ($aldocCommand) { + $aldocArguments = @($aldocPath) + } + else { + $aldocArguments = @() + $aldocCommand = $aldocPath + } + $docfxPath = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) New-Item -Path $docfxPath -ItemType Directory | Out-Null try { @@ -181,14 +197,14 @@ function GenerateDocsSite { } $apps = @($apps | Select-Object -Unique) - $arguments = @( + $arguments = $aldocArguments + @( "init" "--output ""$docfxpath""" "--loglevel $loglevel" "--targetpackages ""$($apps -join '","')""" ) - Write-Host "invoke aldoc $arguments" - CmdDo -command $aldocPath -arguments $arguments + Write-Host "invoke $aldocCommand $arguments" + CmdDo -command $aldocCommand -arguments $arguments # Update docfx.json Write-Host "Update docfx.json" @@ -214,14 +230,14 @@ function GenerateDocsSite { Get-Content $tocYmlFile | Out-Host $apps | ForEach-Object { - $arguments = @( + $arguments = $aldocArguments + @( "build" "--output ""$docfxpath""" "--loglevel $loglevel" "--source ""$_""" ) - Write-Host "invoke aldoc $arguments" - CmdDo -command $aldocPath -arguments $arguments + Write-Host "invoke $aldocCommand $arguments" + CmdDo -command $aldocCommand -arguments $arguments } # Set release notes diff --git a/RELEASENOTES.md b/RELEASENOTES.md index bf77cdaa9..60f04c4b4 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -1,6 +1,7 @@ ### Issues - Issue 1184 Publish to Environment fails on 'Permission Denied' +- AL Language extension in 25.0 doesn't contain the linux executable, use dotnet to invoke the dll instead. ### New Settings