mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-03 01:13:55 +00:00
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) {
|
Compiler.prototype.compile_solidity = function(contractFiles) {
|
||||||
console.log("I HAVE REACHED HERE THROUGH GRUNT-EMBARK")
|
console.log(contractFiles.length);
|
||||||
var source = '{ ';
|
var source = '{ \n';
|
||||||
for (var contractFile in contractFiles){
|
for (var i = 0; i < contractFiles.length; i++){
|
||||||
source += '\'' + contractFile + '\': \''
|
source += '\'' + contractFiles[i] + '\': \''
|
||||||
var file = fs.readFileSync(contractFile).toString() + '\'';
|
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);
|
var output = solc.compile(source, 1);
|
||||||
|
|
||||||
@ -34,10 +38,12 @@ Compiler.prototype.compile_solidity = function(contractFiles) {
|
|||||||
|
|
||||||
compiled_object[className] = {};
|
compiled_object[className] = {};
|
||||||
compiled_object[className].code = contract.bytecode;
|
compiled_object[className].code = contract.bytecode;
|
||||||
|
|
||||||
compiled_object[className].info = {};
|
compiled_object[className].info = {};
|
||||||
compiled_object[className].info.abiDefinition = JSON.parse(contract.interface);
|
compiled_object[className].info.abiDefinition = JSON.parse(contract.interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return compiled_object;
|
return compiled_object;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -83,22 +89,23 @@ Compiler.prototype.compile_serpent = function(contractFile) {
|
|||||||
|
|
||||||
Compiler.prototype.compile = function(contractFiles) {
|
Compiler.prototype.compile = function(contractFiles) {
|
||||||
var solidity = [], serpent = [];
|
var solidity = [], serpent = [];
|
||||||
|
|
||||||
|
|
||||||
for (var contractFile in contractFiles) {
|
for (var i = 0; i < contractFiles.length; i++) {
|
||||||
var extension = contractFile.split('.')[1];
|
var extension = contractFiles[i].split('.')[1];
|
||||||
if (extension === 'sol') {
|
if (extension === 'sol') {
|
||||||
solidity.push(contractFile);
|
solidity.push(contractFiles[i]);
|
||||||
}
|
}
|
||||||
else if (extension === 'se') {
|
else if (extension === 'se') {
|
||||||
serpent.push(contractFile);
|
serpent.push(contractFiles[i]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new Error("extension not known");
|
throw new Error("extension not known, got " + extension);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(solidity);
|
||||||
if (solidity.length > 0) return compile_solidity(solidity);
|
if (solidity.length > 0) return this.compile_solidity(solidity);
|
||||||
if (serpent.length > 0) return compile_serpent(serpent);
|
if (serpent.length > 0) return this.compile_serpent(serpent);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = Compiler;
|
module.exports = Compiler;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user