mirror of https://github.com/embarklabs/embark.git
Merge branch 'refactor_5_0_0' of github.com:embark-framework/embark into refactor_5_0_0
This commit is contained in:
commit
1d765cc86a
|
@ -419,54 +419,70 @@ class EmbarkController {
|
||||||
client: options.client,
|
client: options.client,
|
||||||
locale: options.locale,
|
locale: options.locale,
|
||||||
version: this.version,
|
version: this.version,
|
||||||
embarkConfig: 'embark.json',
|
embarkConfig: options.embarkConfig || 'embark.json',
|
||||||
interceptLogs: false,
|
interceptLogs: false,
|
||||||
logFile: options.logFile,
|
logFile: options.logFile,
|
||||||
logLevel: options.logLevel,
|
logLevel: options.logLevel,
|
||||||
events: options.events,
|
|
||||||
logger: options.logger,
|
logger: options.logger,
|
||||||
config: options.config,
|
config: options.config,
|
||||||
plugins: options.plugins,
|
|
||||||
context: this.context,
|
context: this.context,
|
||||||
webpackConfigName: options.webpackConfigName
|
webpackConfigName: options.webpackConfigName
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function initEngine(callback) {
|
callback => {
|
||||||
engine.init({}, callback);
|
engine.init({}, callback);
|
||||||
},
|
},
|
||||||
function startServices(callback) {
|
callback => {
|
||||||
let pluginList = engine.plugins.listPlugins();
|
let pluginList = engine.plugins.listPlugins();
|
||||||
if (pluginList.length > 0) {
|
if (pluginList.length > 0) {
|
||||||
engine.logger.info(__("loaded plugins") + ": " + pluginList.join(", "));
|
engine.logger.info(__("loaded plugins") + ": " + pluginList.join(", "));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!options.onlyCompile) engine.startService("web3");
|
engine.registerModuleGroup("coreComponents");
|
||||||
engine.startService("processManager");
|
engine.registerModuleGroup("stackComponents");
|
||||||
engine.startService("libraryManager");
|
|
||||||
engine.startService("codeRunner");
|
engine.registerModuleGroup("compiler");
|
||||||
engine.startService("pipeline");
|
engine.registerModuleGroup("contracts");
|
||||||
engine.startService("codeGenerator");
|
engine.registerModuleGroup("pipeline");
|
||||||
|
engine.registerModuleGroup("communication");
|
||||||
|
engine.registerModulePackage('embark-deploy-tracker', {plugins: engine.plugins});
|
||||||
|
|
||||||
|
engine.registerModuleGroup("blockchain");
|
||||||
if (!options.onlyCompile) {
|
if (!options.onlyCompile) {
|
||||||
engine.startService("deployment", {onlyCompile: options.onlyCompile});
|
engine.registerModuleGroup("storage");
|
||||||
engine.startService("storage");
|
|
||||||
} else {
|
|
||||||
engine.startService('compiler');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
callback();
|
engine.events.on('deployment:deployContracts:afterAll', () => {
|
||||||
},
|
engine.events.request('pipeline:generateAll', () => {
|
||||||
function buildOrBuildAndDeploy(callback) {
|
engine.events.emit('outputDone');
|
||||||
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
|
let plugin = engine.plugins.createPlugin('cmdcontrollerplugin', {});
|
||||||
engine.events.request('deploy:contracts', err => callback(err));
|
plugin.registerActionForEvent("embark:engine:started", async (_, cb) => {
|
||||||
|
try {
|
||||||
|
await Promise.all([
|
||||||
|
engine.events.request2("blockchain:node:start", engine.config.blockchainConfig),
|
||||||
|
engine.events.request2("communication:node:start", engine.config.communicationConfig)
|
||||||
|
]);
|
||||||
|
} catch (e) {
|
||||||
|
return cb(e);
|
||||||
|
}
|
||||||
|
cb();
|
||||||
|
});
|
||||||
|
|
||||||
|
engine.startEngine(async () => {
|
||||||
|
let contractsFiles = await engine.events.request2("config:contractsFiles");
|
||||||
|
let compiledContracts = await engine.events.request2("compiler:contracts:compile", contractsFiles);
|
||||||
|
let _contractsConfig = await engine.events.request2("config:contractsConfig");
|
||||||
|
let contractsConfig = cloneDeep(_contractsConfig);
|
||||||
|
let [contractsList, contractDependencies] = await engine.events.request2("contracts:build", contractsConfig, compiledContracts);
|
||||||
|
|
||||||
|
await engine.events.request2("deployment:contracts:deploy", contractsList, contractDependencies);
|
||||||
|
callback();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
function waitForWriteFinish(callback) {
|
function waitForWriteFinish(callback) {
|
||||||
if (options.onlyCompile) {
|
if (options.onlyCompile) {
|
||||||
|
@ -478,6 +494,7 @@ class EmbarkController {
|
||||||
engine.logger.info(__("Finished building").underline);
|
engine.logger.info(__("Finished building").underline);
|
||||||
callback(err, true);
|
callback(err, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
], function (err, canExit) {
|
], function (err, canExit) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
Loading…
Reference in New Issue