call compiler through a request

This commit is contained in:
Iuri Matias 2018-05-18 23:19:08 -04:00 committed by Jonathan Rainville
parent af8a720e90
commit 16eaacbd54
2 changed files with 7 additions and 3 deletions

View File

@ -1,7 +1,6 @@
let toposort = require('toposort');
let async = require('async');
let Compiler = require('./compiler.js');
let utils = require('../utils/utils.js');
const constants = require('../constants');
@ -36,8 +35,7 @@ class ContractsManager {
let self = this;
async.waterfall([
function compileContracts(callback) {
let compiler = new Compiler({plugins: self.plugins, logger: self.logger});
compiler.compile_contracts(self.contractFiles, function (err, compiledObject) {
self.events.request("compiler:contracts", self.contractFiles, function (err, compiledObject) {
self.compiledContracts = compiledObject;
callback(err);
});

View File

@ -4,6 +4,7 @@ const Events = require('./events.js');
const Logger = require('./logger.js');
const Config = require('./config.js');
const Blockchain = require('../contracts/blockchain.js');
const Compiler = require('../contracts/compiler.js');
const ContractsManager = require('../contracts/contracts.js');
const DeployManager = require('../contracts/deploy_manager.js');
const CodeGenerator = require('../contracts/code_generator.js');
@ -192,6 +193,11 @@ class Engine {
deploymentService(options) {
let self = this;
let compiler = new Compiler({plugins: self.plugins, logger: self.logger});
this.events.setCommandHandler("compiler:contracts", function(contractFiles, cb) {
compiler.compile_contracts(contractFiles, cb);
});
this.registerModule('solidity', {
contractDirectories: self.config.contractDirectories
});