feat: set apt alternatives when llvm is installed

This commit is contained in:
Amin Yahyaabadi 2022-04-18 23:31:31 -07:00
parent 0353a03dcd
commit dc320cd781
4 changed files with 17 additions and 3 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

@ -9,7 +9,7 @@ import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
import { addBinExtension } from "../utils/extension/extension"
import { addEnv } from "../utils/env/addEnv"
import { info, setOutput } from "@actions/core"
import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
import { warning } from "../utils/io/io"
import { existsSync } from "fs"
import { isGitHubCI } from "../utils/env/isci"
@ -307,6 +307,16 @@ export async function activateLLVM(directory: string, versionGiven: string) {
await setupMacOSSDK()
if (process.platform === "linux") {
await updateAptAlternatives("cc", `${directory}/bin/clang`)
await updateAptAlternatives("cxx", `${directory}/bin/clang++`)
await updateAptAlternatives("clang", `${directory}/bin/clang`)
await updateAptAlternatives("clang++", `${directory}/bin/clang++`)
await updateAptAlternatives("lld", `${directory}/bin/lld`)
await updateAptAlternatives("ld.lld", `${directory}/bin/ld.lld`)
await updateAptAlternatives("llvm-ar", `${directory}/bin/llvm-ar`)
}
if (isGitHubCI()) {
addLLVMLoggingMatcher()
}

View File

@ -68,3 +68,7 @@ export async function setupAptPack(
return { binDir: "/usr/bin/" }
}
export function updateAptAlternatives(name: string, path: string) {
return execSudo("update-alternatives", ["--install", `/usr/bin/${name}`, name, path, "10"])
}