Skip to content

Commit

Permalink
fix aldoc
Browse files Browse the repository at this point in the history
  • Loading branch information
freddydk committed Oct 3, 2024
1 parent 4866e4c commit 2ebefed
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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'
Expand All @@ -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) {
Expand Down Expand Up @@ -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 {
Expand All @@ -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"
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 2ebefed

Please sign in to comment.