use existing version of lib if versions match
This commit is contained in:
parent
f45ce963b4
commit
5a2cdb19bf
|
@ -66,12 +66,6 @@ class Compiler {
|
|||
callback(err);
|
||||
}
|
||||
);
|
||||
//for (let i = 0; i < contractFiles.length; i++) {
|
||||
// // TODO: this depends on the config
|
||||
// let filename = contractFiles[i].filename.replace('app/contracts/', '');
|
||||
// input[filename] = contractFiles[i].content.toString();
|
||||
//}
|
||||
//callback();
|
||||
},
|
||||
function loadCompiler(callback) {
|
||||
// TODO: there ino need to load this twice
|
||||
|
|
|
@ -2,8 +2,6 @@ let solc;
|
|||
|
||||
process.on('message', function (msg) {
|
||||
if (msg.action === 'loadCompiler') {
|
||||
//solc = require('solc');
|
||||
//console.log("requiring compiler at " + msg.solcLocation);
|
||||
solc = require(msg.solcLocation);
|
||||
process.send({result: "loadedCompiler"});
|
||||
}
|
||||
|
|
|
@ -3,11 +3,12 @@ let solcProcess;
|
|||
let compilerLoaded = false;
|
||||
var npm = require('../pipeline/npm.js');
|
||||
let path = require('path');
|
||||
let currentSolcVersion = require('../../package.json').dependencies.solc;
|
||||
|
||||
class SolcW {
|
||||
|
||||
constructor(version) {
|
||||
this.solcVersion = version;
|
||||
constructor(solcVersion) {
|
||||
this.solcVersion = solcVersion;
|
||||
}
|
||||
|
||||
load_compiler(done) {
|
||||
|
@ -22,13 +23,16 @@ class SolcW {
|
|||
compilerLoaded = true;
|
||||
done();
|
||||
});
|
||||
npm.getPackageVersion('solc', '0.4.10', false, function(location) {
|
||||
console.log("new compiler installed at " + location);
|
||||
//let requirePath = path.join(process.env.PWD, location.substr(2));
|
||||
let requirePath = path.join(process.env.PWD, location);
|
||||
console.log(requirePath);
|
||||
solcProcess.send({action: 'loadCompiler', solcLocation: requirePath});
|
||||
});
|
||||
|
||||
if (this.solcVersion === currentSolcVersion) {
|
||||
solcProcess.send({action: 'loadCompiler', solcLocation: 'solc'});
|
||||
} else {
|
||||
npm.getPackageVersion('solc', this.solcVersion, false, function(location) {
|
||||
let requirePath = path.join(process.env.PWD, location);
|
||||
solcProcess.send({action: 'loadCompiler', solcLocation: requirePath});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
isCompilerLoaded() {
|
||||
|
|
Loading…
Reference in New Issue