diff --git a/cmd/cmd_controller.js b/cmd/cmd_controller.js index 5b0c1d657..20d265447 100644 --- a/cmd/cmd_controller.js +++ b/cmd/cmd_controller.js @@ -205,22 +205,25 @@ class EmbarkController { engine.startService("processManager"); engine.startService("libraryManager"); engine.startService("codeRunner"); - engine.startService("web3"); if (!options.onlyCompile) { + engine.startService("web3"); + engine.startService("deployment", {onlyCompile: options.onlyCompile}); engine.startService("pipeline"); - } - engine.startService("deployment", {onlyCompile: options.onlyCompile}); - if (!options.onlyCompile) { engine.startService("storage"); engine.startService("codeGenerator"); + } else { + engine.startService('compiler'); } callback(); }, - function deploy(callback) { - engine.events.request('deploy:contracts', function (err) { - callback(err); - }); + function buildOrBuildAndDeploy(callback) { + if (options.onlyCompile) { + 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) { if (options.onlyCompile) { @@ -229,7 +232,7 @@ class EmbarkController { } engine.logger.info("Finished deploying".underline); engine.events.on('outputDone', (err) => { - engine.logger.info(__("finished building").underline); + engine.logger.info(__("Finished building").underline); callback(err, true); }); } diff --git a/lib/core/engine.js b/lib/core/engine.js index 393c16018..7e31a3138 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -63,6 +63,7 @@ class Engine { "pipeline": this.pipelineService, "codeRunner": this.codeRunnerService, "codeGenerator": this.codeGeneratorService, + "compiler": this.setupCompilerAndContractsManagerService, "deployment": this.deploymentService, "fileWatcher": this.fileWatchService, "webServer": this.webServerService, @@ -178,17 +179,21 @@ class Engine { 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) { let self = this; - this.registerModule('compiler', {plugins: self.plugins, disableOptimizations: options.disableOptimizations}); - this.registerModule('solidity', {ipc: self.ipc, useDashboard: this.useDashboard}); - this.registerModule('vyper'); + this.setupCompilerAndContractsManagerService(options); this.registerModule('profiler'); this.registerModule('deploytracker', {trackContracts: options.trackContracts}); this.registerModule('specialconfigs'); this.registerModule('console_listener', {ipc: self.ipc}); - this.registerModule('contracts_manager', {compileOnceOnly: options.compileOnceOnly}); this.registerModule('deployment', {plugins: this.plugins, onlyCompile: options.onlyCompile}); this.events.on('file-event', function (fileType) {