fix(@embark/cmd): output contract json

This fix ensures that `embark build --contracts` outputs the contracts
the same way a normal build would.
This commit is contained in:
Andre Medeiros 2018-11-20 14:46:59 -05:00 committed by Iuri Matias
parent 46e351ed36
commit 4dca72368b
2 changed files with 13 additions and 10 deletions

View File

@ -213,10 +213,10 @@ class EmbarkController {
engine.startService("processManager"); engine.startService("processManager");
engine.startService("libraryManager"); engine.startService("libraryManager");
engine.startService("codeRunner"); engine.startService("codeRunner");
engine.startService("pipeline");
if (!options.onlyCompile) { if (!options.onlyCompile) {
engine.startService("web3"); engine.startService("web3");
engine.startService("deployment", {onlyCompile: options.onlyCompile}); engine.startService("deployment", {onlyCompile: options.onlyCompile});
engine.startService("pipeline");
engine.startService("storage"); engine.startService("storage");
engine.startService("codeGenerator"); engine.startService("codeGenerator");
} else { } else {
@ -226,12 +226,14 @@ class EmbarkController {
callback(); callback();
}, },
function buildOrBuildAndDeploy(callback) { function buildOrBuildAndDeploy(callback) {
if (options.onlyCompile) { if (options.onlyCompile)
engine.events.request('contracts:build', {}, err => callback(err)); return engine.events.request('contracts:build', {}, err => {
} else { if(err !== undefined) return callback(err);
engine.events.request('pipeline:build:contracts', err => callback(err));
});
// deploy:contracts will trigger a build as well // deploy:contracts will trigger a build as well
engine.events.request('deploy:contracts', err => callback(err)); engine.events.request('deploy:contracts', err => callback(err));
}
}, },
function waitForWriteFinish(callback) { function waitForWriteFinish(callback) {
if (options.onlyCompile) { if (options.onlyCompile) {

View File

@ -22,6 +22,7 @@ class Pipeline {
this.isFirstBuild = true; this.isFirstBuild = true;
this.events.setCommandHandler('pipeline:build', (options, callback) => this.build(options, callback)); this.events.setCommandHandler('pipeline:build', (options, callback) => this.build(options, callback));
this.events.setCommandHandler('pipeline:build:contracts', callback => this.buildContracts(callback));
fs.removeSync(this.buildDir); fs.removeSync(this.buildDir);
let plugin = this.plugins.createPlugin('deployment', {}); let plugin = this.plugins.createPlugin('deployment', {});