This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch fix/apidocs-automation
in repository https://gitbox.apache.org/repos/asf/lucenenet.git


The following commit(s) were added to refs/heads/fix/apidocs-automation by this 
push:
     new b9139b61d docs.ps1: Install docfx if it doesn't already exist as a 
local tool
b9139b61d is described below

commit b9139b61d32a2ba350212dc92161b008c2c2ed0a
Author: Shad Storhaug <[email protected]>
AuthorDate: Thu Oct 24 09:21:23 2024 +0700

    docs.ps1: Install docfx if it doesn't already exist as a local tool
---
 websites/apidocs/docs.ps1 | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/websites/apidocs/docs.ps1 b/websites/apidocs/docs.ps1
index cd609dad2..792e55b58 100644
--- a/websites/apidocs/docs.ps1
+++ b/websites/apidocs/docs.ps1
@@ -62,19 +62,32 @@ $TocPath1 = Join-Path -Path $ApiDocsFolder -ChildPath 
"toc.yml"
 $TocPath2 = Join-Path -Path $ApiDocsFolder -ChildPath "toc\toc.yml"
 $BreadcrumbPath = Join-Path -Path $ApiDocsFolder -ChildPath 
"docfx.global.subsite.json"
 
+# The default local tools directory
+$InstallDir = "$RepoRoot/.dotnet/tools"
+
 # install docfx tool
 Write-Host "Restoring docfx tool..."
 $PreviousLocation = Get-Location
 Set-Location $RepoRoot
-dotnet tool restore
+
+# Ensure docfx is installed
+if (-not (Test-Path "$InstallDir/docfx")) {
+    Write-Host "DocFX is not installed. Installing as a local tool..."
+    
+    # Install docfx as a local tool if it isn't listed in dotnet-tools.json
+    dotnet tool install --local docfx
+} else {
+    Write-Host "DocFX is already installed. Restoring tools..."
+
+    # Restore local tools listed in dotnet-tools.json
+    dotnet tool restore
+}
+
 Set-Location $PreviousLocation
 
 &dotnet tool list --local
 dotnet tool list --global
 
-$loc = Get-Location
-Write-Host "Location: $loc"
-
 
 # delete anything that already exists
 if ($Clean) {

Reply via email to