Skip to content

Commit

Permalink
Merge pull request #36 from aminya/clang-matcher [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Feb 12, 2022
2 parents 016b16a + 32a17be commit 491bdd1
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 4 deletions.
17 changes: 17 additions & 0 deletions dist/llvm_matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "llvm",
"pattern": [
{
"regexp": "^(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
]
}
]
}
2 changes: 1 addition & 1 deletion dist/setup_cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/setup_cpp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build.docker": "pnpm build && docker build -f ./building/docker/debian_node.dockerfile -t setup_cpp .",
"bump": "ncu -u -x execa",
"clean": "shx rm -rf dist exe",
"copy.matchers": "shx cp ./src/gcc/gcc_matcher.json ./dist/ && shx cp ./src/msvc/msvc_matcher.json ./dist && shx cp ./src/python/python_matcher.json ./dist/",
"copy.matchers": "shx cp ./src/gcc/gcc_matcher.json ./dist/ && shx cp ./src/msvc/msvc_matcher.json ./dist && shx cp ./src/python/python_matcher.json ./dist/ && shx cp ./src/llvm/llvm_matcher.json ./dist/ ",
"dev": "cross-env NODE_ENV=development parcel watch",
"format": "prettier --write .",
"lint": "eslint . --fix",
Expand Down
20 changes: 19 additions & 1 deletion src/llvm/llvm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ import { getSpecificVersionAndUrl, getVersions, semverCoerceIfInvalid } from "..
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
import { addBinExtension } from "../utils/extension/extension"
import { addEnv } from "../utils/env/addEnv"
import { setOutput } from "@actions/core"
import { info, setOutput } from "@actions/core"
import { setupAptPack } from "../utils/setup/setupAptPack"
import { warning } from "../utils/io/io"
import { existsSync } from "fs"
import { isGitHubCI } from "../utils/env/isci"

//================================================
// Version
Expand Down Expand Up @@ -281,9 +284,24 @@ export async function activateLLVM(directory: string, versionGiven: string) {
addEnv("LIBRARY_PATH", `${directory}/lib`)

await setupMacOSSDK()

if (isGitHubCI()) {
addLLVMLoggingMatcher()
}
}

/** Setup llvm tools (clang tidy, clang format, etc) without activating llvm and using it as the compiler */
export function setupClangTools(version: string, setupDir: string, arch: string): Promise<InstallationInfo> {
if (isGitHubCI()) {
addLLVMLoggingMatcher()
}
return setupBin("llvm", version, getLLVMPackageInfo, setupDir, arch)
}

function addLLVMLoggingMatcher() {
const matcherPath = path.join(__dirname, "llvm_matcher.json")
if (!existsSync(matcherPath)) {
return warning("the llvm_matcher.json file does not exist in the same folder as setup_cpp.js")
}
info(`::add-matcher::${matcherPath}`)
}
17 changes: 17 additions & 0 deletions src/llvm/llvm_matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "llvm",
"pattern": [
{
"regexp": "^(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
]
}
]
}

0 comments on commit 491bdd1

Please sign in to comment.