setup-cpp/src/cppcheck/cppcheck.ts

31 lines
905 B
TypeScript
Raw Normal View History

2021-09-18 10:17:21 +08:00
import { addPath } from "../utils/path/addPath"
2021-09-16 16:30: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 setupCppcheck(version: string | undefined, _setupCppDir: string, _arch: string) {
2021-09-16 16:30:47 +08:00
switch (process.platform) {
case "win32": {
await setupChocoPack("cppcheck", version)
2021-09-20 20:31:05 +08:00
const binDir = activateWinCppcheck()
2021-09-17 02:48:13 +08:00
return { binDir }
2021-09-16 16:30:47 +08:00
}
case "darwin": {
return setupBrewPack("cppcheck", version)
}
case "linux": {
return setupAptPack("cppcheck", version)
}
default: {
throw new Error(`Unsupported platform`)
}
}
}
2021-09-20 20:31:05 +08:00
function activateWinCppcheck() {
const binDir = "C:/Program Files/Cppcheck"
addPath(binDir)
return binDir
}