-
Notifications
You must be signed in to change notification settings - Fork 0
/
.atom-build.js
54 lines (52 loc) · 1.67 KB
/
.atom-build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
XRegExp = require('xregexp');
fs = require('fs');
path = require('path');
_functionMatch = function (output) {
filePattern = '(?<file>[a-zA-Z-_\\d\.\/]+)';
linePattern = '(?<line>\\d+)';
colPattern = '(?<col>\\d+)';
patterns = [
XRegExp(`^ *${filePattern}:${linePattern}(:(?<col>\\d+):)?`),
XRegExp(`^-- .+ -+ ${filePattern}\\n\\n(?<message>.+)\\n\\n( )?${linePattern}\\|`),
XRegExp(`\\sat Context\.<anonymous> \\(${filePattern}:${linePattern}:(?<col>\\d+)\\)`),
XRegExp(` ✗ ${filePattern}\\n ✗ #${linePattern}: `),
XRegExp(` at ${filePattern}:${linePattern}:${colPattern}`),
];
var locations = [];
lines = output.split('\n');
lines.forEach((line, index) => {
patterns.forEach(pattern => {
section = lines.slice(index, index + 5).join('\n');
const match = XRegExp.exec(section, pattern);
if (match) {
match.line = parseInt(match.line);
loc = {
file: match.file,
line: match.line
};
if (typeof match.col !== "undefined"){
loc.col = parseInt(match.col);
}
locations.push(loc);
}
});
});
locations = locations.filter(location => {
if (fs.existsSync(location.file)) {
return true;
} else if (fs.existsSync('tests/' + location.file)) {
location.file = path.normalize("tests/" + location.file);
return true;
} else if (fs.existsSync('client/tests/' + location.file)) {
location.file = path.normalize("client/tests/" + location.file);
return true;
};
return false;
});
return locations;
};
module.exports = {
cmd: "make -f geany",
functionMatch: _functionMatch,
_functionMatch: _functionMatch
};