Merge pull request #437 from embark-framework/no_solc_reload
don't unnecessary reload solc
This commit is contained in:
commit
566bcc71ae
|
@ -7,6 +7,8 @@ class Solidity {
|
|||
this.logger = embark.logger;
|
||||
this.events = embark.events;
|
||||
this.contractDirectories = options.contractDirectories;
|
||||
this.solcAlreadyLoaded = false;
|
||||
this.solcW = null;
|
||||
|
||||
embark.registerCompiler(".sol", this.compile_solidity.bind(this));
|
||||
}
|
||||
|
@ -17,7 +19,6 @@ class Solidity {
|
|||
}
|
||||
let self = this;
|
||||
let input = {};
|
||||
let solcW;
|
||||
async.waterfall([
|
||||
function prepareInput(callback) {
|
||||
async.each(contractFiles,
|
||||
|
@ -44,14 +45,14 @@ class Solidity {
|
|||
);
|
||||
},
|
||||
function loadCompiler(callback) {
|
||||
// TODO: there ino need to load this twice
|
||||
solcW = new SolcW({logger: self.logger, events: self.events});
|
||||
if (solcW.isCompilerLoaded()) {
|
||||
if (self.solcAlreadyLoaded) {
|
||||
return callback();
|
||||
}
|
||||
self.solcW = new SolcW({logger: self.logger, events: self.events});
|
||||
|
||||
self.logger.info(__("loading solc compiler") + "..");
|
||||
solcW.load_compiler(function (err) {
|
||||
self.solcW.load_compiler(function (err) {
|
||||
self.solcAlreadyLoaded = true;
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
|
@ -73,7 +74,7 @@ class Solidity {
|
|||
}
|
||||
};
|
||||
|
||||
solcW.compile(jsonObj, function (output) {
|
||||
self.solcW.compile(jsonObj, function (output) {
|
||||
if (output.errors) {
|
||||
for (let i=0; i<output.errors.length; i++) {
|
||||
if (output.errors[i].type === 'Warning') {
|
||||
|
|
|
@ -49,7 +49,9 @@ class SolcW {
|
|||
}
|
||||
|
||||
compile(jsonObj, done) {
|
||||
const self = this;
|
||||
this.solcProcess.subscribeTo('result', 'compilation', (msg) => {
|
||||
self.solcProcess.unsubscribeTo('result', 'compilation');
|
||||
done(JSON.parse(msg.output));
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue