clean up build

This commit is contained in:
Aliaksei Chapyzhenka 2019-12-17 17:47:48 -08:00
parent f94792b9ec
commit 7e9c08e591
3 changed files with 194 additions and 178 deletions

View File

@ -17,7 +17,6 @@ jobs:
- name: npm install, build, and test
run: |
npm i
npm run build
npm test
env:
CI: true

View File

@ -1,9 +1,23 @@
#!/usr/bin/env node
'use strict';
const fs = require('fs');
const fs = require('fs-extra');
const cp = require('child_process');
const llparse = require('llparse');
const llparseDot = require('llparse-dot');
const gyp = cb => {
console.log('build');
const proc = cp.spawn('node-gyp', ['configure', 'build']);
proc.stderr.on('data', data => {
console.error(data.toString());
});
proc.on('close', (cb || (() => {
console.log('done');
})));
};
const generate = cb => {
// const llparseDot = require('llparse-dot');
const prj = 'vcd_parser';
const p = new llparse.LLParse(prj);
@ -210,16 +224,18 @@ simulationId
.match(spaces, idSpan.end(simulation))
.skipTo(simulationId);
// Build
const artifacts = p.build(declaration);
fs.writeFileSync(prj + '.h', artifacts.header);
// fs.writeFileSync('verilog_preprocessor.bc', artifacts.bitcode);
fs.writeFileSync(prj + '.c', artifacts.c);
const dot = new llparseDot.Dot();
// const dot = new llparseDot.Dot();
// fs.writeFileSync(prj + '.dot', dot.build(declaration));
fs.writeFileSync(prj + '.dot', dot.build(declaration));
cb();
};
generate(gyp);
/* eslint camelcase: 0 */

View File

@ -5,7 +5,8 @@
"main": "lib/index.js",
"scripts": {
"test": "eslint bin lib && nyc -r=text -r=lcov mocha",
"build": "node bin/build.js && node-gyp rebuild"
"install": "node bin/build.js",
"prepare": "node bin/build.js"
},
"files": [
"*.c",