Skip to content

Commit

Permalink
Merge pull request #202 from aminya/clang-format-version [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Sep 11, 2023
2 parents 15f7626 + 17286fc commit 0cf6799
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dist/actions/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/actions/setup-cpp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/legacy/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/legacy/setup-cpp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modern/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modern/setup-cpp.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/llvm/llvm_installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function setupLLVMApt(

await setupAptPack([{ name: "curl" }])
await execa("curl", ["-LJO", "https://apt.llvm.org/llvm.sh"], { cwd: "/tmp" })
const neededPackages = await patchAptLLVMScript("/tmp/llvm.sh", "/tmp/llvm-setup-cpp.sh", packages)
const neededPackages = await patchAptLLVMScript("/tmp/llvm.sh", "/tmp/llvm-setup-cpp.sh", majorVersion, packages)
await setupAptPack(neededPackages)
await chmod("/tmp/llvm-setup-cpp.sh", "755")
await execRoot(
Expand All @@ -45,12 +45,12 @@ export async function setupLLVMApt(
}
}

async function patchAptLLVMScript(path: string, target_path: string, packages: LLVMPackages) {
async function patchAptLLVMScript(path: string, target_path: string, majorVersion: number, packages: LLVMPackages) {
let script = await readFile(path, "utf-8")

script = debugScript(script)
script = nonInteractiveScript(script)
script = choosePackages(packages, script)
script = choosePackages(packages, script, majorVersion)
script = await removeConflictingPackages(script)
script = useNalaScript(script)

Expand Down Expand Up @@ -105,9 +105,9 @@ function useNalaScript(script: string) {
return script
}

function choosePackages(packages: LLVMPackages, script: string) {
function choosePackages(packages: LLVMPackages, script: string, majorVersion: number) {
if (packages === LLVMPackages.ClangFormat) {
return script.replace(/ -y \$PKG/g, " -y clang-format")
return script.replace(/ -y \$PKG/g, ` -y clang-format-${majorVersion}`)
}
return script
}

0 comments on commit 0cf6799

Please sign in to comment.