mirror of https://github.com/aminya/setup-cpp
Merge pull request #26 from aminya/doxygen-linux
This commit is contained in:
commit
3c105b2d7e
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -10,6 +10,7 @@ const DefaultVersions: Record<string, string> = {
|
||||||
python: "3.8.10",
|
python: "3.8.10",
|
||||||
kcov: "v39",
|
kcov: "v39",
|
||||||
task: "3.10.0",
|
task: "3.10.0",
|
||||||
|
doxygen: process.platform === "win32" ? "1.9.3.20220106" : "1.9.3",
|
||||||
gcc: process.platform === "win32" ? "11.2.0.07112021" : "11",
|
gcc: process.platform === "win32" ? "11.2.0.07112021" : "11",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import { setupDoxygen } from "../doxygen"
|
import { setupDoxygen } from "../doxygen"
|
||||||
import { testBin } from "../../utils/tests/test-helpers"
|
import { testBin } from "../../utils/tests/test-helpers"
|
||||||
import { InstallationInfo } from "../../utils/setup/setupBin"
|
import { InstallationInfo } from "../../utils/setup/setupBin"
|
||||||
|
import { getVersion } from "../../default_versions"
|
||||||
|
|
||||||
jest.setTimeout(300000)
|
jest.setTimeout(300000)
|
||||||
describe("setup-doxygen", () => {
|
describe("setup-doxygen", () => {
|
||||||
it("should setup doxygen", async () => {
|
it("should setup doxygen", async () => {
|
||||||
const installInfo = await setupDoxygen("", "", process.arch)
|
const installInfo = await setupDoxygen(getVersion("doxygen", undefined), "", process.arch)
|
||||||
|
|
||||||
await testBin("doxygen", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
|
await testBin("doxygen", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,48 +1,58 @@
|
||||||
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 { 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 { extractTarByExe } from "../utils/setup/extract"
|
||||||
|
import { warning } from "../utils/io/io"
|
||||||
|
|
||||||
|
/** Get the platform data for cmake */
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
export async function setupDoxygen(version: string | undefined, _setupDir: string, _arch: string) {
|
function getDoxygenPackageInfo(version: string, platform: NodeJS.Platform, _arch: string): PackageInfo {
|
||||||
|
switch (platform) {
|
||||||
|
case "linux": {
|
||||||
|
const folderName = `doxygen-${version}`
|
||||||
|
return {
|
||||||
|
binRelativeDir: "bin/",
|
||||||
|
binFileName: addBinExtension("doxygen"),
|
||||||
|
extractedFolderName: folderName,
|
||||||
|
extractFunction: (file: string, dest: string) => {
|
||||||
|
return extractTarByExe(file, dest, ["--strip-components=1"])
|
||||||
|
},
|
||||||
|
url: `https://www.doxygen.nl/files/${folderName}.linux.bin.tar.gz`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported platform '${platform}'`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
await setupChocoPack("doxygen.install", version)
|
||||||
// TODO fails on windows?
|
try {
|
||||||
// await setupChocoPack("graphviz", version)
|
await setupChocoPack("graphviz", undefined)
|
||||||
/**
|
} catch (err) {
|
||||||
* Graphviz v2.49.0 [Approved] graphviz package files install completed. Performing other installation steps.
|
warning(`${err}`)
|
||||||
* graphviz not installed. An error occurred during installation: Item has already been added. Key in dictionary:
|
}
|
||||||
* 'Path' Key being added: 'PATH'
|
|
||||||
*
|
|
||||||
* Chocolatey installed 0/0 packages.
|
|
||||||
* See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
|
|
||||||
* The process cannot access the file 'C:\ProgramData\chocolatey\lib\Graphviz\.chocolateyPending' because it is being used by another process.
|
|
||||||
*
|
|
||||||
* 18 | execa.sync("choco", ["install", "-y", name, `--version=${version}`, ...args])
|
|
||||||
* 19 | } else {
|
|
||||||
* > 20 | execa.sync("choco", ["install", "-y", name, ...args])
|
|
||||||
* | ^
|
|
||||||
* 21 | }
|
|
||||||
* 22 |
|
|
||||||
* 23 | const binDir = "C:/ProgramData/Chocolatey/bin/"
|
|
||||||
*
|
|
||||||
* at makeError (node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/error.js:60:11)
|
|
||||||
* at Function.Object.<anonymous>.module.exports.sync (node_modules/.pnpm/execa@5.1.1/node_modules/execa/index.js:194:17)
|
|
||||||
* at setupChocoPack (src/utils/setup/setupChocoPack.ts:20:11)
|
|
||||||
* at setupDoxygen (src/doxygen/doxygen.ts:11:27)
|
|
||||||
* at Object.<anonymous> (src/doxygen/__tests__/doxygen.test.ts:8:25)
|
|
||||||
*/
|
|
||||||
const binDir = activateWinDoxygen()
|
const binDir = activateWinDoxygen()
|
||||||
return { binDir }
|
return { binDir }
|
||||||
}
|
}
|
||||||
case "darwin": {
|
case "darwin": {
|
||||||
setupBrewPack("doxygen", version)
|
setupBrewPack("doxygen", undefined)
|
||||||
return setupBrewPack("graphviz", version)
|
return setupBrewPack("graphviz", undefined)
|
||||||
}
|
}
|
||||||
case "linux": {
|
case "linux": {
|
||||||
await setupAptPack("doxygen", version)
|
try {
|
||||||
return setupAptPack("graphviz", version)
|
// 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)
|
||||||
|
} catch (err) {
|
||||||
|
warning(`Failed to download doxygen binary. ${err}. Falling back to apt-get.`)
|
||||||
|
await setupAptPack("doxygen", undefined)
|
||||||
|
}
|
||||||
|
return setupAptPack("graphviz", undefined)
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(`Unsupported platform`)
|
throw new Error(`Unsupported platform`)
|
||||||
|
|
Loading…
Reference in New Issue