fix: fix doxygen installation on linux

This commit is contained in:
Amin Yahyaabadi 2022-02-08 17:55:33 -08:00
parent 954f03e554
commit cc4cfdf4da
4 changed files with 24 additions and 14 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,13 +1,22 @@
import { setupDoxygen } from "../doxygen" import { setupDoxygen } from "../doxygen"
import { testBin } from "../../utils/tests/test-helpers" import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { InstallationInfo } from "../../utils/setup/setupBin" import { InstallationInfo } from "../../utils/setup/setupBin"
import { getVersion } from "../../default_versions" import { getVersion } from "../../default_versions"
jest.setTimeout(300000) jest.setTimeout(300000)
describe("setup-doxygen", () => { describe("setup-doxygen", () => {
let directory: string
beforeAll(async () => {
directory = await setupTmpDir("doxygen")
})
it("should setup doxygen", async () => { it("should setup doxygen", async () => {
const installInfo = await setupDoxygen(getVersion("doxygen", undefined), "", process.arch) const installInfo = await setupDoxygen(getVersion("doxygen", undefined), directory, process.arch)
await testBin("doxygen", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir) await testBin("doxygen", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
}) })
afterAll(async () => {
await cleanupTmpDir("doxygen")
}, 100000)
}) })

View File

@ -1,10 +1,10 @@
import { addPath } from "../utils/path/addPath" import { addPath } from "../utils/path/addPath"
import { setupAptPack } from "../utils/setup/setupAptPack" import { setupAptPack } from "../utils/setup/setupAptPack"
import { PackageInfo, setupBin } from "../utils/setup/setupBin" import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
import { setupBrewPack } from "../utils/setup/setupBrewPack" import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack" import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { addBinExtension } from "../utils/extension/extension" import { addBinExtension } from "../utils/extension/extension"
import { extractTarByExe } from "../utils/setup/extract" import { extractTar } from "../utils/setup/extract"
import { warning } from "../utils/io/io" import { warning } from "../utils/io/io"
/** Get the platform data for cmake */ /** Get the platform data for cmake */
@ -17,9 +17,7 @@ function getDoxygenPackageInfo(version: string, platform: NodeJS.Platform, _arch
binRelativeDir: "bin/", binRelativeDir: "bin/",
binFileName: addBinExtension("doxygen"), binFileName: addBinExtension("doxygen"),
extractedFolderName: folderName, extractedFolderName: folderName,
extractFunction: (file: string, dest: string) => { extractFunction: extractTar,
return extractTarByExe(file, dest, ["--strip-components=1"])
},
url: `https://www.doxygen.nl/files/${folderName}.linux.bin.tar.gz`, url: `https://www.doxygen.nl/files/${folderName}.linux.bin.tar.gz`,
} }
} }
@ -41,18 +39,21 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
return { binDir } return { binDir }
} }
case "darwin": { case "darwin": {
setupBrewPack("doxygen", undefined) const installationInfo = setupBrewPack("doxygen", undefined)
return setupBrewPack("graphviz", undefined) setupBrewPack("graphviz", undefined)
return installationInfo
} }
case "linux": { case "linux": {
let installationInfo: InstallationInfo
try { try {
// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself // doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
await setupBin("doxygen", version, getDoxygenPackageInfo, setupDir, arch) installationInfo = await setupBin("doxygen", version, getDoxygenPackageInfo, setupDir, arch)
} catch (err) { } catch (err) {
warning(`Failed to download doxygen binary. ${err}. Falling back to apt-get.`) warning(`Failed to download doxygen binary. ${err}. Falling back to apt-get.`)
await setupAptPack("doxygen", undefined) installationInfo = await setupAptPack("doxygen", undefined)
} }
return setupAptPack("graphviz", undefined) await setupAptPack("graphviz", undefined)
return installationInfo
} }
default: { default: {
throw new Error(`Unsupported platform`) throw new Error(`Unsupported platform`)