fix: retry the installation of doxygen on Windows in case of errors

This commit is contained in:
Amin Yahyaabadi 2022-12-21 13:49:50 -08:00
parent 84ecfb4b29
commit 3eac98035f
5 changed files with 14 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@ import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack" import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { addExeExt, join } from "patha" import { addExeExt, join } from "patha"
import { extractTar, extractZip } from "../utils/setup/extract" import { extractTar, extractZip } from "../utils/setup/extract"
import { notice } from "ci-log" import { info, notice } from "ci-log"
import { setupGraphviz } from "../graphviz/graphviz" import { setupGraphviz } from "../graphviz/graphviz"
import { getVersion } from "../versions/versions" import { getVersion } from "../versions/versions"
@ -15,6 +15,7 @@ import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack" import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu" import { isUbuntu } from "../utils/env/isUbuntu"
import pathExists from "path-exists" import pathExists from "path-exists"
import retry from "retry-as-promised"
/** Get the platform data for cmake */ /** Get the platform data for cmake */
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -48,7 +49,13 @@ function getDoxygenPackageInfo(version: string, platform: NodeJS.Platform, _arch
export async function setupDoxygen(version: string, setupDir: string, arch: string) { export async function setupDoxygen(version: string, setupDir: string, arch: string) {
switch (process.platform) { switch (process.platform) {
case "win32": { case "win32": {
await setupChocoPack("doxygen.install", version) // try to download the package 4 times with 2 seconds delay
await retry(
() => {
return setupChocoPack("doxygen.install", version)
},
{ max: 4, backoffBase: 2000, report: (err) => info(err) }
)
const binDir = await activateWinDoxygen() const binDir = await activateWinDoxygen()
const installationInfo = { binDir } const installationInfo = { binDir }
await setupGraphviz(getVersion("graphviz", undefined), "", arch) await setupGraphviz(getVersion("graphviz", undefined), "", arch)
@ -100,6 +107,7 @@ async function activateWinDoxygen() {
"C:/Program Files/doxygen/bin", "C:/Program Files/doxygen/bin",
"C:/Program Files (x86)/doxygen", "C:/Program Files (x86)/doxygen",
]) { ]) {
// eslint-disable-next-line no-await-in-loop
if (await pathExists(join(binDir, "doxygen.exe"))) { if (await pathExists(join(binDir, "doxygen.exe"))) {
// eslint-disable-next-line no-await-in-loop // eslint-disable-next-line no-await-in-loop
await addPath(binDir) await addPath(binDir)