Skip to content

Commit 491bdd1

Browse files
authored
Merge pull request #36 from aminya/clang-matcher [skip ci]
2 parents 016b16a + 32a17be commit 491bdd1

File tree

6 files changed

+56
-4
lines changed

6 files changed

+56
-4
lines changed

dist/llvm_matcher.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "llvm",
5+
"pattern": [
6+
{
7+
"regexp": "^(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"severity": 4,
12+
"message": 5
13+
}
14+
]
15+
}
16+
]
17+
}

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"build.docker": "pnpm build && docker build -f ./building/docker/debian_node.dockerfile -t setup_cpp .",
1717
"bump": "ncu -u -x execa",
1818
"clean": "shx rm -rf dist exe",
19-
"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/",
19+
"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/ ",
2020
"dev": "cross-env NODE_ENV=development parcel watch",
2121
"format": "prettier --write .",
2222
"lint": "eslint . --fix",

src/llvm/llvm.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ import { getSpecificVersionAndUrl, getVersions, semverCoerceIfInvalid } from "..
88
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
99
import { addBinExtension } from "../utils/extension/extension"
1010
import { addEnv } from "../utils/env/addEnv"
11-
import { setOutput } from "@actions/core"
11+
import { info, setOutput } from "@actions/core"
1212
import { setupAptPack } from "../utils/setup/setupAptPack"
13+
import { warning } from "../utils/io/io"
14+
import { existsSync } from "fs"
15+
import { isGitHubCI } from "../utils/env/isci"
1316

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

283286
await setupMacOSSDK()
287+
288+
if (isGitHubCI()) {
289+
addLLVMLoggingMatcher()
290+
}
284291
}
285292

286293
/** Setup llvm tools (clang tidy, clang format, etc) without activating llvm and using it as the compiler */
287294
export function setupClangTools(version: string, setupDir: string, arch: string): Promise<InstallationInfo> {
295+
if (isGitHubCI()) {
296+
addLLVMLoggingMatcher()
297+
}
288298
return setupBin("llvm", version, getLLVMPackageInfo, setupDir, arch)
289299
}
300+
301+
function addLLVMLoggingMatcher() {
302+
const matcherPath = path.join(__dirname, "llvm_matcher.json")
303+
if (!existsSync(matcherPath)) {
304+
return warning("the llvm_matcher.json file does not exist in the same folder as setup_cpp.js")
305+
}
306+
info(`::add-matcher::${matcherPath}`)
307+
}

src/llvm/llvm_matcher.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "llvm",
5+
"pattern": [
6+
{
7+
"regexp": "^(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"severity": 4,
12+
"message": 5
13+
}
14+
]
15+
}
16+
]
17+
}

0 commit comments

Comments
 (0)