2 Commits

Author SHA1 Message Date
olemorud
8f0e275979 [refactor] Simplify regex 2023-03-16 14:46:36 +01:00
olemorud
4c3b4df0ad DO NOT SHIP THIS COMMIT 2023-03-14 17:25:50 +01:00
4 changed files with 6 additions and 9 deletions

View File

@@ -1,5 +1,7 @@
# GCC problem matcher
# DO NOT COMMIT THIS LINE
Creates annotations for warnings and errors in gcc builds.
## Inputs

View File

@@ -4,7 +4,7 @@
"owner": "gcc-problem-matcher",
"pattern": [
{
"regexp": "^.*?${{ BASE }}\/?(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
"regexp": "^\\s*${{ BASE }}\/?(.*?):(\\d+):(\\d+):.*?(warning|error): (.*)$"
"file": 1,
"line": 2,
"column": 3,

9
dist/index.js vendored
View File

@@ -2862,18 +2862,13 @@ const templatePath = __nccwpck_require__.ab + "gcc_matcher.jsontemplate";
const matcherPath = __nccwpck_require__.ab + "gcc_matcher.json";
// rootdir :: string
const rootdir = () =>
core.getInput('build-directory', {required: false});
const rootdir = core.getInput('build-directory', {required: false});
// parse :: IO() => IO() => Error | null
const parse = (templatePath) => (matcherPath) => {
const r = rootdir();
console.log(r);
const content = fs.readFileSync(templatePath, 'utf-8');
const parsed = content.replace(variable("BASE"), escapeRegExp(rootdir()));
const parsed = content.replace(variable("BASE"), escapeRegExp(rootdir));
fs.writeFileSync(matcherPath, parsed);

View File

@@ -4,7 +4,7 @@
"owner": "gcc-problem-matcher",
"pattern": [
{
"regexp": "^.*?${{ BASE }}\/?(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
"regexp": "^\\s*${{ BASE }}\/?(.*?):(\\d+):(\\d+):.*?(warning|error): (.*)$"
"file": 1,
"line": 2,
"column": 3,