Skip to content

Commit a835d4b

Browse files
committed
fix: install the default Doxygen version on Linux
Update versions.json Update doxygen.ts
1 parent 6ef1af9 commit a835d4b

File tree

5 files changed

+35
-32
lines changed

5 files changed

+35
-32
lines changed

dist/legacy/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/legacy/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/modern/setup-cpp.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/modern/setup-cpp.mjs.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: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { addExeExt } from "patha"
55
import { installAptPack } from "setup-apt"
66
import { installBrewPack } from "setup-brew"
77
import { setupGraphviz } from "../graphviz/graphviz.js"
8-
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin.js"
8+
import { type PackageInfo, setupBin } from "../utils/setup/setupBin.js"
99
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
1010
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
1111
import { getVersion } from "../versions/versions.js"
@@ -90,33 +90,7 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
9090
return installationInfo
9191
}
9292
case "linux": {
93-
let installationInfo: InstallationInfo
94-
if (version === "" || isArch() || hasDnf()) {
95-
if (isArch()) {
96-
installationInfo = await setupPacmanPack("doxygen", version)
97-
} else if (hasDnf()) {
98-
return setupDnfPack([{ name: "doxygen", version }])
99-
} else if (isUbuntu()) {
100-
installationInfo = await installAptPack([{ name: "doxygen", version }])
101-
} else {
102-
throw new Error("Unsupported linux distributions")
103-
}
104-
} else if (isUbuntu()) {
105-
try {
106-
// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
107-
installationInfo = await setupBin("doxygen", version, getDoxygenPackageInfo, setupDir, arch)
108-
try {
109-
await installAptPack([{ name: "libclang-cpp9" }])
110-
} catch (err) {
111-
info(`Failed to download libclang-cpp9 that might be needed for running doxygen. ${err}`)
112-
}
113-
} catch (err) {
114-
notice(`Failed to download doxygen binary. ${err}. Falling back to apt-get.`)
115-
installationInfo = await installAptPack([{ name: "doxygen" }])
116-
}
117-
} else {
118-
throw new Error("Unsupported linux distributions")
119-
}
93+
const installationInfo = await setupLinuxDoxygen(version, setupDir, arch)
12094
await setupGraphviz(getVersion("graphviz", undefined, await ubuntuVersion()), "", arch)
12195
return installationInfo
12296
}
@@ -125,6 +99,35 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
12599
}
126100
}
127101
}
102+
async function setupLinuxDoxygen(version: string, setupDir: string, arch: string) {
103+
try {
104+
if (isArch()) {
105+
return await setupPacmanPack("doxygen", version)
106+
} else if (hasDnf()) {
107+
return setupDnfPack([{ name: "doxygen", version }])
108+
} else if (isUbuntu()) {
109+
return await installAptPack([{ name: "doxygen", version, fallBackToLatest: false }])
110+
} else {
111+
throw new Error("Unsupported linux distributions")
112+
}
113+
} catch {
114+
// fallback to setupBin if the installation failed
115+
try {
116+
const installationInfo = await setupBin("doxygen", version, getDoxygenPackageInfo, setupDir, arch)
117+
if (isUbuntu()) {
118+
try {
119+
await installAptPack([{ name: "libclang-cpp-dev" }])
120+
} catch (err) {
121+
info(`Failed to download libclang-cpp-dev that might be needed for running doxygen. ${err}`)
122+
}
123+
}
124+
return installationInfo
125+
} catch (err) {
126+
notice(`Failed to download doxygen binary. ${err}. Falling back to installing the latest version from apt-get.`)
127+
return installAptPack([{ name: "doxygen" }])
128+
}
129+
}
130+
}
128131

129132
async function activateWinDoxygen() {
130133
switch (process.platform) {

0 commit comments

Comments
 (0)