Skip to content

Commit 4fc8c1e

Browse files
committed
Revert "Replace pdf doc with html doc."
This reverts commit 7e28c32.
1 parent 12a1e71 commit 4fc8c1e

File tree

2 files changed

+22
-57
lines changed

2 files changed

+22
-57
lines changed

Build-Installer.ps1

Lines changed: 20 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -177,61 +177,26 @@ function PrepareIdfPython {
177177
}
178178

179179
function PrepareIdfDocumentation {
180-
$DocumentationBasePath = ".\build\$InstallerType\docs"
181-
$DownloadedZipName = "esp-idf-en-$OfflineBranch.zip"
182-
$DownloadUrl = "https://docs.espressif.com/projects/esp-idf/en/$OfflineBranch/esp32/$DownloadedZipName"
183-
184-
if (-Not(Test-Path -Path $DocumentationBasePath -PathType Container)) {
185-
New-Item -ItemType Directory -Path $DocumentationBasePath
186-
}
187-
188-
$ZipFilePath = Join-Path -Path $DocumentationBasePath -ChildPath $DownloadedZipName
189-
# Download the ZIP file if it doesn't already exist
190-
if (-Not(Test-Path -Path $ZipFilePath -PathType Leaf)) {
191-
"Downloading: $DownloadUrl"
192-
try {
193-
$Request = Invoke-WebRequest $DownloadUrl -OutFile $ZipFilePath -MaximumRedirection 0
194-
[int]$StatusCode = $Request.StatusCode
195-
}
196-
catch {
197-
[int]$StatusCode = $_.Exception.Response.StatusCode
198-
}
199-
200-
201-
if ($StatusCode -eq 302) {
202-
FailBuild -Message "Failed to download documentation from $DownloadUrl. Status code: $StatusCode"
203-
}
204-
} else {
205-
"Documentation ZIP file already exists: $ZipFilePath"
206-
}
207-
208-
$ExtractedPath = Join-Path -Path $DocumentationBasePath -ChildPath "html"
209-
# Extract the ZIP file if not already extracted
210-
if (-Not(Test-Path -Path $ExtractedPath -PathType Container)) {
211-
"Extracting documentation to: $ExtractedPath"
212-
try {
213-
Expand-Archive -Path $ZipFilePath -DestinationPath $ExtractedPath
214-
} catch {
215-
FailBuild -Message "Failed to extract documentation ZIP file at $ZipFilePath. Error: $_"
216-
}
217-
} else {
218-
"Documentation already extracted to: $ExtractedPath"
219-
}
220-
221-
# Create a symbolic link to the HTML index
222-
$HtmlIndexPath = Join-Path -Path $ExtractedPath -ChildPath "index.html"
223-
if (-Not(Test-Path -Path $HtmlIndexPath -PathType Leaf)) {
224-
FailBuild -Message "Documentation HTML index not found in extracted documentation path: $ExtractedPath."
225-
}
226-
$SymLinkFilePath = ".\build\$InstallerType\IDFdocumentation.html"
227-
if (-Not(Test-Path -Path $SymLinkFilePath -PathType Leaf)) {
228-
"Creating symbolic link: $SymLinkFilePath -> $HtmlIndexPath"
229-
try {
230-
$AbsoluteHtmlIndexPath = Resolve-Path -Path $HtmlIndexPath -ErrorAction SilentlyContinue
231-
New-Item -ItemType SymbolicLink -Path $SymLinkFilePath -Value $AbsoluteHtmlIndexPath > $null
232-
} catch {
233-
"ERROR: Failed to create symbolic link at $SymLinkFilePath. Error: $_"
234-
}
180+
$FullFilePath = ".\build\$InstallerType\IDFdocumentation.pdf"
181+
$DownloadUrl = "https://docs.espressif.com/projects/esp-idf/en/$OfflineBranch/esp32/esp-idf-en-$OfflineBranch-esp32.pdf"
182+
183+
if (Test-Path -Path $FullFilePath -PathType Leaf) {
184+
"$FullFilePath found."
185+
return
186+
}
187+
188+
"Downloading: $DownloadUrl"
189+
try {
190+
$Request = Invoke-WebRequest $DownloadUrl -OutFile $FullFilePath -MaximumRedirection 0
191+
[int]$StatusCode = $Request.StatusCode
192+
}
193+
catch {
194+
[int]$StatusCode = $_.Exception.Response.StatusCode
195+
}
196+
197+
198+
if ($StatusCode -eq 302) {
199+
FailBuild -Message "Failed to download documentation from $DownloadUrl. Status code: $StatusCode"
235200
}
236201
}
237202

src/InnoSetup/IdfToolsSetup.iss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Source: "..\PowerShell\Initialize-Idf.ps1"; DestDir: "{app}";
232232
Source: "{#BUILD}\espidf.constraints.v*.txt"; DestDir: "{app}"; Flags: skipifsourcedoesntexist;
233233
; IDF Documentation
234234
#if OFFLINE == 'yes'
235-
Source: "{#BUILD}\IDFdocumentation.html"; DestDir: "{app}";
235+
Source: "{#BUILD}\IDFdocumentation.pdf"; DestDir: "{app}";
236236
#endif
237237

238238
; createallsubdirs is necessary for git repo. Otherwise empty directories disappears
@@ -382,7 +382,7 @@ Filename: "cmd"; Parameters: "/c start https://docs.espressif.com/projects/esp-i
382382
#endif
383383

384384
#if OFFLINE == 'yes'
385-
Filename: "cmd"; Parameters: "/c start """" ""{app}\IDFdocumentation.html"""; Flags: nowait postinstall; Description: {cm:PointToDocumentation}; Check: IsInstallSuccess;
385+
Filename: "cmd"; Parameters: "/c start """" ""{app}\IDFdocumentation.pdf"""; Flags: nowait postinstall; Description: {cm:PointToDocumentation}; Check: IsInstallSuccess;
386386
#endif
387387

388388
; WD registration checkbox is identified by 'Windows Defender' substring anywhere in its caption, not by the position index in WizardForm.TasksList.Items

0 commit comments

Comments
 (0)