File index.js changed (mode: 100755) (index c80ecb3..448c402) |
3 |
3 |
const fs = require("fs"), |
const fs = require("fs"), |
4 |
4 |
path = require("path"), |
path = require("path"), |
5 |
5 |
tmp = require("tmp"), |
tmp = require("tmp"), |
|
6 |
|
YAML = require("yamljs"), |
6 |
7 |
shell = require("shelljs"), |
shell = require("shelljs"), |
7 |
8 |
cursor = require("ansi")(process.stdout), |
cursor = require("ansi")(process.stdout), |
8 |
9 |
argv = require("minimist")(process.argv.slice(2)), |
argv = require("minimist")(process.argv.slice(2)), |
|
... |
... |
processDef(defPath); |
24 |
25 |
function processDef(defPath) { |
function processDef(defPath) { |
25 |
26 |
console.log("processing ", defPath); |
console.log("processing ", defPath); |
26 |
27 |
readDef(defPath).then((obj) => { |
readDef(defPath).then((obj) => { |
27 |
|
readDef(path.join(__dirname, "asserter/def.json")).then((obj2) => { |
|
|
28 |
|
readDef(path.join(__dirname, "asserter/def.yml")).then((obj2) => { |
28 |
29 |
let result = [obj, obj2].join(" "); |
let result = [obj, obj2].join(" "); |
29 |
30 |
if (argv.common || argv.c) { |
if (argv.common || argv.c) { |
30 |
31 |
result += " -pthread -DTARGET_TEST=1"; |
result += " -pthread -DTARGET_TEST=1"; |
|
... |
... |
function processDef(defPath) { |
64 |
65 |
}); |
}); |
65 |
66 |
} |
} |
66 |
67 |
|
|
|
68 |
|
function getDef(def, defFile) { |
|
69 |
|
const extname = path.extname(defFile); |
|
70 |
|
if (extname.toUpperCase() === ".YML") { |
|
71 |
|
return YAML.parse(def); |
|
72 |
|
} |
|
73 |
|
return JSON.parse(def); |
|
74 |
|
} |
|
75 |
|
|
67 |
76 |
function readDef(defFile) { |
function readDef(defFile) { |
68 |
77 |
return new Promise((resolve, reject) => { |
return new Promise((resolve, reject) => { |
69 |
78 |
const base = path.dirname(defFile); |
const base = path.dirname(defFile); |
70 |
79 |
fs.readFile(defFile, "utf8", (err, def) => { |
fs.readFile(defFile, "utf8", (err, def) => { |
71 |
80 |
if (err) throw err; |
if (err) throw err; |
72 |
|
const { includes, sources, tests } = JSON.parse(def); |
|
|
81 |
|
const { includes, sources, tests } = getDef(def, defFile); |
73 |
82 |
let result = `-isystem ${base} `; |
let result = `-isystem ${base} `; |
74 |
83 |
if (sources) { |
if (sources) { |
75 |
84 |
result += sources |
result += sources |
File package-lock.json changed (mode: 100644) (index 0037a3c..ccda211) |
9 |
9 |
"resolved": "https://registry.npmjs.org/ansi/-/ansi-0.3.1.tgz", |
"resolved": "https://registry.npmjs.org/ansi/-/ansi-0.3.1.tgz", |
10 |
10 |
"integrity": "sha1-DELU+xcWDVqa8eSEus4cZpIsGyE=" |
"integrity": "sha1-DELU+xcWDVqa8eSEus4cZpIsGyE=" |
11 |
11 |
}, |
}, |
|
12 |
|
"argparse": { |
|
13 |
|
"version": "1.0.10", |
|
14 |
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", |
|
15 |
|
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", |
|
16 |
|
"requires": { |
|
17 |
|
"sprintf-js": "~1.0.2" |
|
18 |
|
} |
|
19 |
|
}, |
12 |
20 |
"balanced-match": { |
"balanced-match": { |
13 |
21 |
"version": "1.0.0", |
"version": "1.0.0", |
14 |
22 |
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", |
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", |
|
135 |
143 |
"rechoir": "^0.6.2" |
"rechoir": "^0.6.2" |
136 |
144 |
} |
} |
137 |
145 |
}, |
}, |
|
146 |
|
"sprintf-js": { |
|
147 |
|
"version": "1.0.3", |
|
148 |
|
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", |
|
149 |
|
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" |
|
150 |
|
}, |
138 |
151 |
"tmp": { |
"tmp": { |
139 |
152 |
"version": "0.1.0", |
"version": "0.1.0", |
140 |
153 |
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.1.0.tgz", |
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.1.0.tgz", |
|
147 |
160 |
"version": "1.0.2", |
"version": "1.0.2", |
148 |
161 |
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", |
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", |
149 |
162 |
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" |
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" |
|
163 |
|
}, |
|
164 |
|
"yamljs": { |
|
165 |
|
"version": "0.3.0", |
|
166 |
|
"resolved": "https://registry.npmjs.org/yamljs/-/yamljs-0.3.0.tgz", |
|
167 |
|
"integrity": "sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==", |
|
168 |
|
"requires": { |
|
169 |
|
"argparse": "^1.0.7", |
|
170 |
|
"glob": "^7.0.5" |
|
171 |
|
} |
150 |
172 |
} |
} |
151 |
173 |
} |
} |
152 |
174 |
} |
} |