Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31f5585936 | ||
|
|
e413405c42 | ||
|
|
e758cb8cf0 |
2
.github/workflows/CI.yml
vendored
2
.github/workflows/CI.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
|||||||
- name: Apply problem matcher
|
- name: Apply problem matcher
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
build-directory: ""
|
build-directory: build/
|
||||||
|
|
||||||
- name: Test problem matcher
|
- name: Test problem matcher
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
13
dist/gcc_matcher.jsontemplate
vendored
13
dist/gcc_matcher.jsontemplate
vendored
@@ -4,12 +4,13 @@
|
|||||||
"owner": "gcc-problem-matcher",
|
"owner": "gcc-problem-matcher",
|
||||||
"pattern": [
|
"pattern": [
|
||||||
{
|
{
|
||||||
"regexp": "^.*?${{ BASE }}\/?(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
|
"regexp": "^(${{ BASE }}\\/?)(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
|
||||||
"file": 1,
|
"fromPath": 1,
|
||||||
"line": 2,
|
"file": 2,
|
||||||
"column": 3,
|
"line": 3,
|
||||||
"severity": 4,
|
"column": 4,
|
||||||
"message": 5
|
"severity": 5,
|
||||||
|
"message": 6
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
15
dist/index.js
vendored
15
dist/index.js
vendored
@@ -2848,7 +2848,7 @@ const core = __nccwpck_require__(127);
|
|||||||
// escapeRegExp :: string => string
|
// escapeRegExp :: string => string
|
||||||
// escape all characters with special meanings in regexp
|
// escape all characters with special meanings in regexp
|
||||||
const escapeRegExp = (s) =>
|
const escapeRegExp = (s) =>
|
||||||
s.replace(/[/\-^$*+?.()|[\]{}]/g, "\\$&");
|
s.replace(/[/\-^$*+?.()|[\]{}]/g, "\\\\$&");
|
||||||
|
|
||||||
// variable :: string => RegExp
|
// variable :: string => RegExp
|
||||||
// create regex to match ${{ key }}
|
// create regex to match ${{ key }}
|
||||||
@@ -2859,21 +2859,16 @@ const variable = (key) =>
|
|||||||
const templatePath = __nccwpck_require__.ab + "gcc_matcher.jsontemplate";
|
const templatePath = __nccwpck_require__.ab + "gcc_matcher.jsontemplate";
|
||||||
|
|
||||||
// matcherPath :: string
|
// matcherPath :: string
|
||||||
const matcherPath = __nccwpck_require__.ab + "gcc_matcher.json";
|
const outputPath = __nccwpck_require__.ab + "gcc_matcher.json";
|
||||||
|
|
||||||
// rootdir :: string
|
// rootdir :: string
|
||||||
const rootdir = () =>
|
const rootdir = core.getInput('build-directory', {required: false});
|
||||||
core.getInput('build-directory', {required: false});
|
|
||||||
|
|
||||||
// parse :: IO() => IO() => Error | null
|
// parse :: string => string => Error | null
|
||||||
const parse = (templatePath) => (matcherPath) => {
|
const parse = (templatePath) => (matcherPath) => {
|
||||||
const r = rootdir();
|
|
||||||
|
|
||||||
console.log(r);
|
|
||||||
|
|
||||||
const content = fs.readFileSync(templatePath, 'utf-8');
|
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);
|
fs.writeFileSync(matcherPath, parsed);
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,13 @@
|
|||||||
"owner": "gcc-problem-matcher",
|
"owner": "gcc-problem-matcher",
|
||||||
"pattern": [
|
"pattern": [
|
||||||
{
|
{
|
||||||
"regexp": "^.*?${{ BASE }}\/?(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
|
"regexp": "^(${{ BASE }}\\/?)(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
|
||||||
"file": 1,
|
"fromPath": 1,
|
||||||
"line": 2,
|
"file": 2,
|
||||||
"column": 3,
|
"line": 3,
|
||||||
"severity": 4,
|
"column": 4,
|
||||||
"message": 5
|
"severity": 5,
|
||||||
|
"message": 6
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const core = require('@actions/core');
|
|||||||
// escapeRegExp :: string => string
|
// escapeRegExp :: string => string
|
||||||
// escape all characters with special meanings in regexp
|
// escape all characters with special meanings in regexp
|
||||||
const escapeRegExp = (s) =>
|
const escapeRegExp = (s) =>
|
||||||
s.replace(/[/\-^$*+?.()|[\]{}]/g, "\\$&");
|
s.replace(/[/\-^$*+?.()|[\]{}]/g, "\\\\$&");
|
||||||
|
|
||||||
// variable :: string => RegExp
|
// variable :: string => RegExp
|
||||||
// create regex to match ${{ key }}
|
// create regex to match ${{ key }}
|
||||||
@@ -16,12 +16,12 @@ const variable = (key) =>
|
|||||||
const templatePath = path.join(__dirname, "gcc_matcher.jsontemplate");
|
const templatePath = path.join(__dirname, "gcc_matcher.jsontemplate");
|
||||||
|
|
||||||
// matcherPath :: string
|
// matcherPath :: string
|
||||||
const matcherPath = path.join(__dirname, "gcc_matcher.json");
|
const outputPath = path.join(__dirname, "gcc_matcher.json");
|
||||||
|
|
||||||
// rootdir :: string
|
// rootdir :: string
|
||||||
const rootdir = core.getInput('build-directory', {required: false});
|
const rootdir = core.getInput('build-directory', {required: false});
|
||||||
|
|
||||||
// parse :: IO() => IO() => Error | null
|
// parse :: string => string => Error | null
|
||||||
const parse = (templatePath) => (matcherPath) => {
|
const parse = (templatePath) => (matcherPath) => {
|
||||||
const content = fs.readFileSync(templatePath, 'utf-8');
|
const content = fs.readFileSync(templatePath, 'utf-8');
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ const parse = (templatePath) => (matcherPath) => {
|
|||||||
|
|
||||||
// main:
|
// main:
|
||||||
try {
|
try {
|
||||||
parse(templatePath)(matcherPath);
|
parse(templatePath)(outputPath);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
core.setFailed(`Action failed with error ${err}`)
|
core.setFailed(`Action failed with error ${err}`)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user