diff --git a/src/cmd/cmd_controller.js b/src/cmd/cmd_controller.js index 668e24307..bb9c3a1f0 100644 --- a/src/cmd/cmd_controller.js +++ b/src/cmd/cmd_controller.js @@ -213,10 +213,10 @@ class EmbarkController { engine.startService("processManager"); engine.startService("libraryManager"); engine.startService("codeRunner"); + engine.startService("pipeline"); if (!options.onlyCompile) { engine.startService("web3"); engine.startService("deployment", {onlyCompile: options.onlyCompile}); - engine.startService("pipeline"); engine.startService("storage"); engine.startService("codeGenerator"); } else { @@ -226,12 +226,14 @@ class EmbarkController { callback(); }, 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)); - } + if (options.onlyCompile) + return engine.events.request('contracts:build', {}, err => { + if(err !== undefined) return callback(err); + engine.events.request('pipeline:build:contracts', err => callback(err)); + }); + + // deploy:contracts will trigger a build as well + engine.events.request('deploy:contracts', err => callback(err)); }, function waitForWriteFinish(callback) { if (options.onlyCompile) { diff --git a/src/lib/modules/pipeline/index.js b/src/lib/modules/pipeline/index.js index 76f523709..336f6e1cc 100644 --- a/src/lib/modules/pipeline/index.js +++ b/src/lib/modules/pipeline/index.js @@ -22,6 +22,7 @@ class Pipeline { this.isFirstBuild = true; 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); let plugin = this.plugins.createPlugin('deployment', {}); @@ -34,7 +35,7 @@ class Pipeline { } catch (error) { return res.send({error: error.message}); } - + const name = path.basename(req.query.path); const content = fs.readFileSync(req.query.path, 'utf8'); res.send({name, content, path: req.query.path}); @@ -51,7 +52,7 @@ class Pipeline { } catch (error) { return res.send({error: error.message}); } - + fs.mkdirpSync(req.body.path); const name = path.basename(req.body.path); res.send({name, path: req.body.path}); @@ -97,7 +98,7 @@ class Pipeline { const walk = (dir, filelist = []) => fs.readdirSync(dir).map(name => { let isRoot = rootPath === dir; if (fs.statSync(path.join(dir, name)).isDirectory()) { - return { + return { isRoot, name, dirname: dir,