mirror of https://github.com/aminya/setup-cpp
feat: set apt alternatives when llvm is installed
This commit is contained in:
parent
0353a03dcd
commit
dc320cd781
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@ import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
|
||||||
import { addBinExtension } from "../utils/extension/extension"
|
import { addBinExtension } from "../utils/extension/extension"
|
||||||
import { addEnv } from "../utils/env/addEnv"
|
import { addEnv } from "../utils/env/addEnv"
|
||||||
import { info, setOutput } from "@actions/core"
|
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 { warning } from "../utils/io/io"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
import { isGitHubCI } from "../utils/env/isci"
|
import { isGitHubCI } from "../utils/env/isci"
|
||||||
|
@ -307,6 +307,16 @@ export async function activateLLVM(directory: string, versionGiven: string) {
|
||||||
|
|
||||||
await setupMacOSSDK()
|
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()) {
|
if (isGitHubCI()) {
|
||||||
addLLVMLoggingMatcher()
|
addLLVMLoggingMatcher()
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,3 +68,7 @@ export async function setupAptPack(
|
||||||
|
|
||||||
return { binDir: "/usr/bin/" }
|
return { binDir: "/usr/bin/" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function updateAptAlternatives(name: string, path: string) {
|
||||||
|
return execSudo("update-alternatives", ["--install", `/usr/bin/${name}`, name, path, "10"])
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue