couple of forgotten things needed to be fixed up
This commit is contained in:
parent
ce7693eca2
commit
f2e4333d1e
|
@ -13,15 +13,19 @@ Compiler.prototype.init = function(env) {
|
|||
};
|
||||
|
||||
Compiler.prototype.compile_solidity = function(contractFiles) {
|
||||
console.log("I HAVE REACHED HERE THROUGH GRUNT-EMBARK")
|
||||
var source = '{ ';
|
||||
for (var contractFile in contractFiles){
|
||||
source += '\'' + contractFile + '\': \''
|
||||
var file = fs.readFileSync(contractFile).toString() + '\'';
|
||||
console.log(contractFiles.length);
|
||||
var source = '{ \n';
|
||||
for (var i = 0; i < contractFiles.length; i++){
|
||||
source += '\'' + contractFiles[i] + '\': \''
|
||||
var file = fs.readFileSync(contractFiles[i]).toString();
|
||||
|
||||
if (!contractFiles.length) source += ', '
|
||||
source += file + '\'\n';
|
||||
|
||||
if (i < contractFiles.length - 1) source += ', \n'
|
||||
}
|
||||
source += '}';
|
||||
source += '\n}';
|
||||
|
||||
|
||||
|
||||
var output = solc.compile(source, 1);
|
||||
|
||||
|
@ -34,10 +38,12 @@ Compiler.prototype.compile_solidity = function(contractFiles) {
|
|||
|
||||
compiled_object[className] = {};
|
||||
compiled_object[className].code = contract.bytecode;
|
||||
|
||||
compiled_object[className].info = {};
|
||||
compiled_object[className].info.abiDefinition = JSON.parse(contract.interface);
|
||||
}
|
||||
|
||||
|
||||
return compiled_object;
|
||||
};
|
||||
|
||||
|
@ -83,22 +89,23 @@ Compiler.prototype.compile_serpent = function(contractFile) {
|
|||
|
||||
Compiler.prototype.compile = function(contractFiles) {
|
||||
var solidity = [], serpent = [];
|
||||
|
||||
|
||||
for (var contractFile in contractFiles) {
|
||||
var extension = contractFile.split('.')[1];
|
||||
for (var i = 0; i < contractFiles.length; i++) {
|
||||
var extension = contractFiles[i].split('.')[1];
|
||||
if (extension === 'sol') {
|
||||
solidity.push(contractFile);
|
||||
solidity.push(contractFiles[i]);
|
||||
}
|
||||
else if (extension === 'se') {
|
||||
serpent.push(contractFile);
|
||||
serpent.push(contractFiles[i]);
|
||||
}
|
||||
else {
|
||||
throw new Error("extension not known");
|
||||
throw new Error("extension not known, got " + extension);
|
||||
}
|
||||
}
|
||||
|
||||
if (solidity.length > 0) return compile_solidity(solidity);
|
||||
if (serpent.length > 0) return compile_serpent(serpent);
|
||||
console.log(solidity);
|
||||
if (solidity.length > 0) return this.compile_solidity(solidity);
|
||||
if (serpent.length > 0) return this.compile_serpent(serpent);
|
||||
};
|
||||
|
||||
module.exports = Compiler;
|
||||
|
|
Loading…
Reference in New Issue