add solc wrapper

This commit is contained in:
Iuri Matias 2017-02-24 19:27:27 -05:00
parent a2a27bb0c2
commit 4b119fffde
3 changed files with 19 additions and 2 deletions

View File

@ -1,6 +1,6 @@
/*jshint esversion: 6, loopfunc: true */ /*jshint esversion: 6, loopfunc: true */
var solc = require('solc');
var async = require('async'); var async = require('async');
var SolcW = require('./solcW.js');
function asyncEachObject(object, iterator, callback) { function asyncEachObject(object, iterator, callback) {
async.each( async.each(
@ -64,6 +64,11 @@ Compiler.prototype.compile_solidity = function(contractFiles, cb) {
input[filename] = contractFiles[i].content.toString(); input[filename] = contractFiles[i].content.toString();
} }
var solcW = new SolcW();
console.log("loading solc..");
var solc = solcW.load_compiler(function(){
console.log("loaded solc");
});
var output = solc.compile({sources: input}, 1); var output = solc.compile({sources: input}, 1);
if (output.errors) { if (output.errors) {

12
lib/contracts/solcW.js Normal file
View File

@ -0,0 +1,12 @@
var SolcW = function() {
};
SolcW.prototype.load_compiler = function(done) {
var solc = require('solc');
done();
return solc;
};
module.exports = SolcW;

View File

@ -136,7 +136,7 @@ var Embark = {
Embark.servicesMonitor.startMonitor(); Embark.servicesMonitor.startMonitor();
callback(); callback();
}, },
function (callback) { function deploy(callback) {
var deployManager = new DeployManager({ var deployManager = new DeployManager({
config: Embark.config, config: Embark.config,
logger: Embark.logger, logger: Embark.logger,