setup-cpp/src/doxygen/doxygen.ts

59 lines
2.5 KiB
TypeScript
Raw Normal View History

2021-09-18 10:17:21 +08:00
import { addPath } from "../utils/path/addPath"
2021-09-16 16:47:47 +08:00
import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupDoxygen(version: string | undefined, _setupDir: string, _arch: string) {
2021-09-16 16:47:47 +08:00
switch (process.platform) {
case "win32": {
await setupChocoPack("doxygen.install", version)
2021-09-19 17:55:54 +08:00
// TODO fails on windows?
// await setupChocoPack("graphviz", version)
/**
* Graphviz v2.49.0 [Approved] graphviz package files install completed. Performing other installation steps.
* 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)
*/
2021-09-20 20:31:40 +08:00
const binDir = activateWinDoxygen()
2021-09-17 02:49:24 +08:00
return { binDir }
2021-09-16 16:47:47 +08:00
}
case "darwin": {
2021-09-17 18:17:21 +08:00
setupBrewPack("doxygen", version)
return setupBrewPack("graphviz", version)
2021-09-16 16:47:47 +08:00
}
case "linux": {
2021-09-17 18:17:21 +08:00
await setupAptPack("doxygen", version)
return setupAptPack("graphviz", version)
2021-09-16 16:47:47 +08:00
}
default: {
throw new Error(`Unsupported platform`)
}
}
}
2021-09-20 20:31:40 +08:00
function activateWinDoxygen() {
addPath("C:/Program Files/Graphviz/bin")
const binDir = "C:/Program Files/doxygen/bin"
addPath(binDir)
return binDir
}