diff --git a/lib/contracts/compiler.js b/lib/contracts/compiler.js index 75e7551a..137fbc66 100644 --- a/lib/contracts/compiler.js +++ b/lib/contracts/compiler.js @@ -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 diff --git a/lib/contracts/solcP.js b/lib/contracts/solcP.js index d62e8299..9444f3a8 100644 --- a/lib/contracts/solcP.js +++ b/lib/contracts/solcP.js @@ -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"}); } diff --git a/lib/contracts/solcW.js b/lib/contracts/solcW.js index 3c6c744c..9acce168 100644 --- a/lib/contracts/solcW.js +++ b/lib/contracts/solcW.js @@ -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() {