Skip to content

Commit cc4cfdf

Browse files
committed
fix: fix doxygen installation on linux
1 parent 954f03e commit cc4cfdf

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

dist/setup_cpp.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/doxygen/__tests__/doxygen.test.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
import { setupDoxygen } from "../doxygen"
2-
import { testBin } from "../../utils/tests/test-helpers"
2+
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
33
import { InstallationInfo } from "../../utils/setup/setupBin"
44
import { getVersion } from "../../default_versions"
55

66
jest.setTimeout(300000)
77
describe("setup-doxygen", () => {
8+
let directory: string
9+
beforeAll(async () => {
10+
directory = await setupTmpDir("doxygen")
11+
})
12+
813
it("should setup doxygen", async () => {
9-
const installInfo = await setupDoxygen(getVersion("doxygen", undefined), "", process.arch)
14+
const installInfo = await setupDoxygen(getVersion("doxygen", undefined), directory, process.arch)
1015

1116
await testBin("doxygen", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
1217
})
18+
19+
afterAll(async () => {
20+
await cleanupTmpDir("doxygen")
21+
}, 100000)
1322
})

src/doxygen/doxygen.ts

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { addPath } from "../utils/path/addPath"
22
import { setupAptPack } from "../utils/setup/setupAptPack"
3-
import { PackageInfo, setupBin } from "../utils/setup/setupBin"
3+
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
44
import { setupBrewPack } from "../utils/setup/setupBrewPack"
55
import { setupChocoPack } from "../utils/setup/setupChocoPack"
66
import { addBinExtension } from "../utils/extension/extension"
7-
import { extractTarByExe } from "../utils/setup/extract"
7+
import { extractTar } from "../utils/setup/extract"
88
import { warning } from "../utils/io/io"
99

1010
/** Get the platform data for cmake */
@@ -17,9 +17,7 @@ function getDoxygenPackageInfo(version: string, platform: NodeJS.Platform, _arch
1717
binRelativeDir: "bin/",
1818
binFileName: addBinExtension("doxygen"),
1919
extractedFolderName: folderName,
20-
extractFunction: (file: string, dest: string) => {
21-
return extractTarByExe(file, dest, ["--strip-components=1"])
22-
},
20+
extractFunction: extractTar,
2321
url: `https://www.doxygen.nl/files/${folderName}.linux.bin.tar.gz`,
2422
}
2523
}
@@ -41,18 +39,21 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
4139
return { binDir }
4240
}
4341
case "darwin": {
44-
setupBrewPack("doxygen", undefined)
45-
return setupBrewPack("graphviz", undefined)
42+
const installationInfo = setupBrewPack("doxygen", undefined)
43+
setupBrewPack("graphviz", undefined)
44+
return installationInfo
4645
}
4746
case "linux": {
47+
let installationInfo: InstallationInfo
4848
try {
4949
// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
50-
await setupBin("doxygen", version, getDoxygenPackageInfo, setupDir, arch)
50+
installationInfo = await setupBin("doxygen", version, getDoxygenPackageInfo, setupDir, arch)
5151
} catch (err) {
5252
warning(`Failed to download doxygen binary. ${err}. Falling back to apt-get.`)
53-
await setupAptPack("doxygen", undefined)
53+
installationInfo = await setupAptPack("doxygen", undefined)
5454
}
55-
return setupAptPack("graphviz", undefined)
55+
await setupAptPack("graphviz", undefined)
56+
return installationInfo
5657
}
5758
default: {
5859
throw new Error(`Unsupported platform`)

0 commit comments

Comments
 (0)