Skip to content

Commit

Permalink
fix(cmd-controller): fix build --contracts command starting comm node
Browse files Browse the repository at this point in the history
Fixes #2288
Only start a blockchain node when there is no --contracts flag and
start only needed modules for compilation
  • Loading branch information
jrainville committed Feb 24, 2020
1 parent 584845b commit d881d6f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/embark/src/cmd/cmd_controller.js
Expand Up @@ -291,15 +291,14 @@ class EmbarkController {

engine.registerModuleGroup("compiler");
engine.registerModuleGroup("contracts");
engine.registerModuleGroup("pipeline");
engine.registerModuleGroup("communication");
engine.registerModuleGroup("namesystem");
engine.registerModulePackage('embark-deploy-tracker', { plugins: engine.plugins });

engine.registerModuleGroup("blockchain");

if (!options.onlyCompile) {
engine.registerModuleGroup("blockchain");
engine.registerModuleGroup("namesystem");
engine.registerModuleGroup("storage");
engine.registerModuleGroup("communication");
engine.registerModuleGroup("pipeline");
engine.registerModulePackage('embark-deploy-tracker', { plugins: engine.plugins });
}

// load custom plugins
Expand All @@ -311,6 +310,9 @@ class EmbarkController {

let plugin = engine.plugins.createPlugin('cmdcontrollerplugin', {});
plugin.registerActionForEvent("embark:engine:started", async (_, cb) => {
if (options.onlyCompile) {
return cb();
}
try {
await Promise.all([
engine.events.request2("blockchain:node:start", engine.config.blockchainConfig),
Expand Down Expand Up @@ -382,8 +384,8 @@ class EmbarkController {
await engine.events.request2("deployment:contracts:deploy", contractsList, contractDependencies);
await engine.events.request2('scripts-runner:initialize');
await engine.events.request2('scripts-runner:execute', options.target, options.forceTracking);
} catch (err) {
return callback(err);
} catch (e) {
return callback(e);
}
callback();
});
Expand Down

0 comments on commit d881d6f

Please sign in to comment.