mirror of https://github.com/embarklabs/embark.git
fix(commands/build): don't start blockchain node when `--contracts` is used
Prior to this commit `$ embark build --contracts` spinned up a blockchain node which is not necessary as `--contracts` can be seen as a "compile only" option. This commit ensures we don't start any web3 services with `--contracts` is used.
This commit is contained in:
parent
e48de3d2ea
commit
80c80e9beb
|
@ -205,22 +205,25 @@ class EmbarkController {
|
||||||
engine.startService("processManager");
|
engine.startService("processManager");
|
||||||
engine.startService("libraryManager");
|
engine.startService("libraryManager");
|
||||||
engine.startService("codeRunner");
|
engine.startService("codeRunner");
|
||||||
|
if (!options.onlyCompile) {
|
||||||
engine.startService("web3");
|
engine.startService("web3");
|
||||||
if (!options.onlyCompile) {
|
|
||||||
engine.startService("pipeline");
|
|
||||||
}
|
|
||||||
engine.startService("deployment", {onlyCompile: options.onlyCompile});
|
engine.startService("deployment", {onlyCompile: options.onlyCompile});
|
||||||
if (!options.onlyCompile) {
|
engine.startService("pipeline");
|
||||||
engine.startService("storage");
|
engine.startService("storage");
|
||||||
engine.startService("codeGenerator");
|
engine.startService("codeGenerator");
|
||||||
|
} else {
|
||||||
|
engine.startService('compiler');
|
||||||
}
|
}
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
},
|
},
|
||||||
function deploy(callback) {
|
function buildOrBuildAndDeploy(callback) {
|
||||||
engine.events.request('deploy:contracts', function (err) {
|
if (options.onlyCompile) {
|
||||||
callback(err);
|
engine.events.request('contracts:build', {}, err => callback(err));
|
||||||
});
|
} else {
|
||||||
|
// deploy:contracts will trigger a build as well
|
||||||
|
engine.events.request('deploy:contracts', err => callback(err));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
function waitForWriteFinish(callback) {
|
function waitForWriteFinish(callback) {
|
||||||
if (options.onlyCompile) {
|
if (options.onlyCompile) {
|
||||||
|
@ -229,7 +232,7 @@ class EmbarkController {
|
||||||
}
|
}
|
||||||
engine.logger.info("Finished deploying".underline);
|
engine.logger.info("Finished deploying".underline);
|
||||||
engine.events.on('outputDone', (err) => {
|
engine.events.on('outputDone', (err) => {
|
||||||
engine.logger.info(__("finished building").underline);
|
engine.logger.info(__("Finished building").underline);
|
||||||
callback(err, true);
|
callback(err, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ class Engine {
|
||||||
"pipeline": this.pipelineService,
|
"pipeline": this.pipelineService,
|
||||||
"codeRunner": this.codeRunnerService,
|
"codeRunner": this.codeRunnerService,
|
||||||
"codeGenerator": this.codeGeneratorService,
|
"codeGenerator": this.codeGeneratorService,
|
||||||
|
"compiler": this.setupCompilerAndContractsManagerService,
|
||||||
"deployment": this.deploymentService,
|
"deployment": this.deploymentService,
|
||||||
"fileWatcher": this.fileWatchService,
|
"fileWatcher": this.fileWatchService,
|
||||||
"webServer": this.webServerService,
|
"webServer": this.webServerService,
|
||||||
|
@ -178,17 +179,21 @@ class Engine {
|
||||||
this.events.on('asset-changed', addToCargo);
|
this.events.on('asset-changed', addToCargo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setupCompilerAndContractsManagerService(options) {
|
||||||
|
this.registerModule('compiler', {plugins: this.plugins, disableOptimizations: options.disableOptimizations});
|
||||||
|
this.registerModule('solidity', {ipc: this.ipc, useDashboard: this.useDashboard});
|
||||||
|
this.registerModule('vyper');
|
||||||
|
this.registerModule('contracts_manager', {compileOnceOnly: options.compileOnceOnly});
|
||||||
|
}
|
||||||
|
|
||||||
deploymentService(options) {
|
deploymentService(options) {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
this.registerModule('compiler', {plugins: self.plugins, disableOptimizations: options.disableOptimizations});
|
this.setupCompilerAndContractsManagerService(options);
|
||||||
this.registerModule('solidity', {ipc: self.ipc, useDashboard: this.useDashboard});
|
|
||||||
this.registerModule('vyper');
|
|
||||||
this.registerModule('profiler');
|
this.registerModule('profiler');
|
||||||
this.registerModule('deploytracker', {trackContracts: options.trackContracts});
|
this.registerModule('deploytracker', {trackContracts: options.trackContracts});
|
||||||
this.registerModule('specialconfigs');
|
this.registerModule('specialconfigs');
|
||||||
this.registerModule('console_listener', {ipc: self.ipc});
|
this.registerModule('console_listener', {ipc: self.ipc});
|
||||||
this.registerModule('contracts_manager', {compileOnceOnly: options.compileOnceOnly});
|
|
||||||
this.registerModule('deployment', {plugins: this.plugins, onlyCompile: options.onlyCompile});
|
this.registerModule('deployment', {plugins: this.plugins, onlyCompile: options.onlyCompile});
|
||||||
|
|
||||||
this.events.on('file-event', function (fileType) {
|
this.events.on('file-event', function (fileType) {
|
||||||
|
|
Loading…
Reference in New Issue