mirror of
https://github.com/embarklabs/embark-solc.git
synced 2025-02-28 22:40:26 +00:00
Changes based on code review
This commit is contained in:
parent
31b2cfc7f6
commit
3f69a5c2e4
@ -1,6 +1,7 @@
|
|||||||
const async = require('async');
|
const async = require('async');
|
||||||
const shelljs = require('shelljs');
|
const shelljs = require('shelljs');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
function compileSolcContract(logger, filename, callback) {
|
function compileSolcContract(logger, filename, callback) {
|
||||||
shelljs.exec(`solc --optimize --combined-json abi,bin,bin-runtime,compact-format,hashes,interface,metadata ${filename}`,
|
shelljs.exec(`solc --optimize --combined-json abi,bin,bin-runtime,compact-format,hashes,interface,metadata ${filename}`,
|
||||||
@ -64,8 +65,6 @@ function compileSolc(embark, contractFiles, cb) {
|
|||||||
compiled_object[className].functionHashes = contract.hashes;
|
compiled_object[className].functionHashes = contract.hashes;
|
||||||
compiled_object[className].abiDefinition = JSON.parse(contract.abi);
|
compiled_object[className].abiDefinition = JSON.parse(contract.abi);
|
||||||
compiled_object[className].filename = fileName;
|
compiled_object[className].filename = fileName;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fileCb();
|
fileCb();
|
||||||
@ -73,20 +72,17 @@ function compileSolc(embark, contractFiles, cb) {
|
|||||||
},
|
},
|
||||||
function (err) {
|
function (err) {
|
||||||
cb(err, compiled_object);
|
cb(err, compiled_object);
|
||||||
|
if(outputBinary){
|
||||||
embark.events.on("outputDone", function() {
|
embark.events.on("outputDone", function() {
|
||||||
if(outputBinary){
|
|
||||||
Object.keys(compiled_object).map(function(className, index) {
|
Object.keys(compiled_object).map(function(className, index) {
|
||||||
fs.writeFile(outputDir + className + ".bin", compiled_object[className].bin, (err) => {
|
fs.writeFile(path.join(outputDir, className + ".bin"), compiled_object[className].bin, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error("Error writing binary file: " + JSON.stringify(err));
|
logger.error("Error writing binary file: " + JSON.stringify(err));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user