mirror of
https://github.com/embarklabs/embark-solc.git
synced 2025-02-28 14:30:36 +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 path = require('path');
|
||||
|
||||
function compileSolcContract(logger, filename, callback) {
|
||||
shelljs.exec(`solc --optimize --combined-json abi,bin,bin-runtime,compact-format,hashes,interface,metadata ${filename}`,
|
||||
function compileSolcContract(logger, filename, allowedDirectories, callback) {
|
||||
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) => {
|
||||
|
||||
if (stderr) {
|
||||
@ -40,11 +42,13 @@ function compileSolc(embark, contractFiles, cb) {
|
||||
}
|
||||
|
||||
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 = {};
|
||||
async.each(contractFiles,
|
||||
function (file, fileCb) {
|
||||
compileSolcContract(logger, file.filename, (err, compileString) => {
|
||||
compileSolcContract(logger, file.filename, allowedDirectories, (err, compileString) => {
|
||||
if (err) {
|
||||
return fileCb(err);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user