Skip to content

Commit 3eac980

Browse files
committed
fix: retry the installation of doxygen on Windows in case of errors
1 parent 84ecfb4 commit 3eac980

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

dist/node12/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node12/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node16/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node16/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/doxygen/doxygen.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { setupBrewPack } from "../utils/setup/setupBrewPack"
66
import { setupChocoPack } from "../utils/setup/setupChocoPack"
77
import { addExeExt, join } from "patha"
88
import { extractTar, extractZip } from "../utils/setup/extract"
9-
import { notice } from "ci-log"
9+
import { info, notice } from "ci-log"
1010
import { setupGraphviz } from "../graphviz/graphviz"
1111
import { getVersion } from "../versions/versions"
1212

@@ -15,6 +15,7 @@ import { hasDnf } from "../utils/env/hasDnf"
1515
import { setupDnfPack } from "../utils/setup/setupDnfPack"
1616
import { isUbuntu } from "../utils/env/isUbuntu"
1717
import pathExists from "path-exists"
18+
import retry from "retry-as-promised"
1819

1920
/** Get the platform data for cmake */
2021
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -48,7 +49,13 @@ function getDoxygenPackageInfo(version: string, platform: NodeJS.Platform, _arch
4849
export async function setupDoxygen(version: string, setupDir: string, arch: string) {
4950
switch (process.platform) {
5051
case "win32": {
51-
await setupChocoPack("doxygen.install", version)
52+
// try to download the package 4 times with 2 seconds delay
53+
await retry(
54+
() => {
55+
return setupChocoPack("doxygen.install", version)
56+
},
57+
{ max: 4, backoffBase: 2000, report: (err) => info(err) }
58+
)
5259
const binDir = await activateWinDoxygen()
5360
const installationInfo = { binDir }
5461
await setupGraphviz(getVersion("graphviz", undefined), "", arch)
@@ -100,6 +107,7 @@ async function activateWinDoxygen() {
100107
"C:/Program Files/doxygen/bin",
101108
"C:/Program Files (x86)/doxygen",
102109
]) {
110+
// eslint-disable-next-line no-await-in-loop
103111
if (await pathExists(join(binDir, "doxygen.exe"))) {
104112
// eslint-disable-next-line no-await-in-loop
105113
await addPath(binDir)

0 commit comments

Comments
 (0)