mirror of
https://github.com/embarklabs/embark-solc.git
synced 2025-02-28 22:40:26 +00:00
Add directory list to list of allowed paths
This commit is contained in:
parent
3f69a5c2e4
commit
21d65e8f8c
@ -3,8 +3,10 @@ const shelljs = require('shelljs');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
function compileSolcContract(logger, filename, callback) {
|
function compileSolcContract(logger, filename, allowedDirectories, callback) {
|
||||||
shelljs.exec(`solc --optimize --combined-json abi,bin,bin-runtime,compact-format,hashes,interface,metadata ${filename}`,
|
const command = `solc --optimize --combined-json abi,bin,bin-runtime,compact-format,hashes,interface,metadata --allow-paths ${allowedDirectories.join(',')} ${filename}`;
|
||||||
|
console.log(command);
|
||||||
|
shelljs.exec(command,
|
||||||
{silent: true}, (code, stdout, stderr) => {
|
{silent: true}, (code, stdout, stderr) => {
|
||||||
|
|
||||||
if (stderr) {
|
if (stderr) {
|
||||||
@ -41,10 +43,12 @@ function compileSolc(embark, contractFiles, cb) {
|
|||||||
|
|
||||||
logger.info("compiling solidity contracts with command line solc...");
|
logger.info("compiling solidity contracts with command line solc...");
|
||||||
|
|
||||||
|
const allowedDirectories = contractFiles.map((contractFile) => path.dirname(path.join(process.cwd(), contractFile.path)));
|
||||||
|
|
||||||
let compiled_object = {};
|
let compiled_object = {};
|
||||||
async.each(contractFiles,
|
async.each(contractFiles,
|
||||||
function (file, fileCb) {
|
function (file, fileCb) {
|
||||||
compileSolcContract(logger, file.filename, (err, compileString) => {
|
compileSolcContract(logger, file.filename, allowedDirectories, (err, compileString) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return fileCb(err);
|
return fileCb(err);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user