From e6c67422458de5cc3a737a23c3d2345567b6879d Mon Sep 17 00:00:00 2001 From: Paul Irwin Date: Sun, 22 Sep 2024 11:32:44 -0600 Subject: [PATCH] Remove SkipToolInstall flag since we now check the version; fix main site build and upgrade to latest docfx --- websites/apidocs/docs.ps1 | 35 ++++++++--------- websites/site/docfx.json | 3 +- .../partials/head-content.tmpl.partial | 2 +- .../lucenetemplate/partials/head.tmpl.partial | 2 +- websites/site/site.ps1 | 38 +++++++++++-------- 5 files changed, 42 insertions(+), 38 deletions(-) diff --git a/websites/apidocs/docs.ps1 b/websites/apidocs/docs.ps1 index 55cf9700fe..627cac6c8c 100644 --- a/websites/apidocs/docs.ps1 +++ b/websites/apidocs/docs.ps1 @@ -23,7 +23,6 @@ param ( [string] $LuceneNetVersion, [switch] $ServeDocs = $false, [switch] $Clean = $false, - [switch] $SkipToolInstall = $false, # to speed up iteration if you already have the tool installed [switch] $DisableMetaData = $false, [switch] $DisableBuild = $false, [switch] $DisablePlugins = $false, @@ -65,27 +64,25 @@ $TocPath2 = Join-Path -Path $ApiDocsFolder -ChildPath "toc\toc.yml" $BreadcrumbPath = Join-Path -Path $ApiDocsFolder -ChildPath "docfx.global.subsite.json" # install docfx tool -if ($SkipToolInstall -eq $false) { - $InstallDocFx = $false - try { - $InstalledDocFxVersion = (& docfx --version).Trim().Split('+')[0] - - if ([version]$InstalledDocFxVersion -lt [version]$DocFxVersion) { - Write-Host "DocFx is installed, but the version is less than $DocFxVersion, will install it." - $InstallDocFx = $true - } - else { - Write-Host "DocFx is installed and the version is $InstalledDocFxVersion." - } - } catch { - Write-Host "DocFx is not installed or not in the PATH, will install it." +$InstallDocFx = $false +try { + $InstalledDocFxVersion = (& docfx --version).Trim().Split('+')[0] + + if ([version]$InstalledDocFxVersion -lt [version]$DocFxVersion) { + Write-Host "DocFx is installed, but the version is less than $DocFxVersion, will install it." $InstallDocFx = $true } - - if ($InstallDocFx -eq $true) { - Write-Host "Installing docfx global tool..." - dotnet tool install -g docfx --version $DocFxVersion + else { + Write-Host "DocFx is installed and the version is $InstalledDocFxVersion." } +} catch { + Write-Host "DocFx is not installed or not in the PATH, will install it." + $InstallDocFx = $true +} + +if ($InstallDocFx -eq $true) { + Write-Host "Installing docfx global tool..." + dotnet tool install -g docfx --version $DocFxVersion } # delete anything that already exists diff --git a/websites/site/docfx.json b/websites/site/docfx.json index 2fe7086826..6338c8d5a4 100644 --- a/websites/site/docfx.json +++ b/websites/site/docfx.json @@ -53,10 +53,9 @@ "lucenetemplate" ], "postProcessors": [], - "markdownEngineName": "markdig", "noLangKeyword": false, "keepFileLink": false, "cleanupCacheHistory": false, "disableGitFeatures": false } -} \ No newline at end of file +} diff --git a/websites/site/lucenetemplate/partials/head-content.tmpl.partial b/websites/site/lucenetemplate/partials/head-content.tmpl.partial index b207f9ea99..e63c0b4817 100644 --- a/websites/site/lucenetemplate/partials/head-content.tmpl.partial +++ b/websites/site/lucenetemplate/partials/head-content.tmpl.partial @@ -9,7 +9,7 @@ {{#_description}}{{/_description}} - + diff --git a/websites/site/lucenetemplate/partials/head.tmpl.partial b/websites/site/lucenetemplate/partials/head.tmpl.partial index 2a02a275dc..dfe3e4e724 100644 --- a/websites/site/lucenetemplate/partials/head.tmpl.partial +++ b/websites/site/lucenetemplate/partials/head.tmpl.partial @@ -9,7 +9,7 @@ {{#_description}}{{/_description}} - + diff --git a/websites/site/site.ps1 b/websites/site/site.ps1 index 241ebbb029..1e18cb6325 100644 --- a/websites/site/site.ps1 +++ b/websites/site/site.ps1 @@ -29,6 +29,8 @@ param ( $StagingPort = 8081 ) +$DocFxVersion = "2.77.0" # Required DocFx version + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $PSScriptFilePath = (Get-Item $MyInvocation.MyCommand.Path).FullName @@ -43,21 +45,27 @@ if ($Clean) { Remove-Item (Join-Path -Path $ToolsFolder "\*") -recurse -force -ErrorAction SilentlyContinue } -New-Item "$ToolsFolder\tmp" -type directory -force +# install docfx tool +$InstallDocFx = $false +try { + $InstalledDocFxVersion = (& docfx --version).Trim().Split('+')[0] -# Go get docfx.exe if we don't have it -New-Item "$ToolsFolder\docfx" -type directory -force -$DocFxExe = "$ToolsFolder\docfx\docfx.exe" -if (-not (test-path $DocFxExe)) -{ - Write-Host "Retrieving docfx..." - $DocFxZip = "$ToolsFolder\tmp\docfx.zip" - Invoke-WebRequest "https://github.com/dotnet/docfx/releases/download/v2.58/docfx.zip" -OutFile $DocFxZip -TimeoutSec 60 - #unzip - Expand-Archive $DocFxZip -DestinationPath (Join-Path -Path $ToolsFolder -ChildPath "docfx") + if ([version]$InstalledDocFxVersion -lt [version]$DocFxVersion) { + Write-Host "DocFx is installed, but the version is less than $DocFxVersion, will install it." + $InstallDocFx = $true + } + else { + Write-Host "DocFx is installed and the version is $InstalledDocFxVersion." + } +} catch { + Write-Host "DocFx is not installed or not in the PATH, will install it." + $InstallDocFx = $true } - Remove-Item -Recurse -Force "$ToolsFolder\tmp" +if ($InstallDocFx -eq $true) { + Write-Host "Installing docfx global tool..." + dotnet tool install -g docfx --version $DocFxVersion +} # delete anything that already exists if ($Clean) { @@ -75,11 +83,11 @@ if($?) { if ($ServeDocs -eq $false) { # build the output Write-Host "Building docs..." - & $DocFxExe build $DocFxJson -l "$DocFxLog" --loglevel $LogLevel + & docfx build $DocFxJson -l "$DocFxLog" --logLevel $LogLevel } else { # build + serve (for testing) Write-Host "starting website..." - & $DocFxExe $DocFxJson --serve --port $StagingPort + & docfx $DocFxJson --serve --port $StagingPort } -} \ No newline at end of file +}