Skip to content
This repository has been archived by the owner on Jun 13, 2018. It is now read-only.

enable non flat file layout #52

Merged
merged 2 commits into from
Sep 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions libexec/dapp/dapp-build
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ if [[ $remappings ]]; then
while read -r line; do opts+=("$line"); done <<<"$remappings"
fi

shopt -s nullglob
for x in "${DAPP_SRC}"/*.sol; do
(set -x; solc "${opts[@]}" --abi --bin --bin-runtime = -o "$DAPP_OUT" "$x")
json_file=$DAPP_OUT/${x#$DAPP_SRC}.json
find "${DAPP_SRC}" -name '*.sol' | while read -r x; do
dir=${x%\/*}
dir=${dir#$DAPP_SRC}
dir=${dir#/}
mkdir -p "$DAPP_OUT/$dir"
(set -x; solc "${opts[@]}" --abi --bin --bin-runtime = -o "$DAPP_OUT/$dir" "$x")
json_file=$DAPP_OUT/$dir/${x##*/}.json
(set -x; solc "${opts[@]}" "${json_opts[@]}" = "$x" >"$json_file")
done
30 changes: 22 additions & 8 deletions libexec/dapp/dapp-quicktest
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var PROGRAM_ARGS = process.argv.slice(2)

var BigNumber = require("bignumber.js")
var ethabi = require("ethereumjs-abi")
var fs = require("fs")

BigNumber.config({ DECIMAL_PLACES: 36 })

Expand Down Expand Up @@ -49,26 +50,39 @@ for (var i = 0; i < PROGRAM_ARGS.length; i++) {
}
}


function readdirSyncr(path, files=[]){
fs.readdirSync(path).map(file => {
var nextpath = path + '/' + file;
if (fs.lstatSync(nextpath).isDirectory()) {
readdirSyncr(nextpath, files);
} else {
files.push(nextpath);
}
});
return files;
}

var classesJSON

if (inputFiles.length >= 1 && (
require("fs").lstatSync(inputFiles[0]).isDirectory()
fs.lstatSync(inputFiles[0]).isDirectory()
)) {
classesJSON = {
contracts: Object.assign({
}, ...require("fs").readdirSync(inputFiles[0]).filter(x => {
}, ...readdirSyncr(inputFiles[0]).filter(x => {
return /\.abi$/.test(x)
}).map(x => {
var filename = `${inputFiles[0]}/${x}`
var filename = `${x}`
return {
[x.replace(/\.abi$/, "")]: {
abi: require("fs").readFileSync(
abi: fs.readFileSync(
filename, { encoding: "utf-8" }
),
bin: require("fs").readFileSync(
bin: fs.readFileSync(
`${filename.replace(/abi$/, "bin")}`, { encoding: "utf-8" }
),
"bin-runtime": require("fs").readFileSync(
"bin-runtime": fs.readFileSync(
`${filename.replace(/abi$/, "bin-runtime")}`, {
encoding: "utf-8"
}
Expand All @@ -84,9 +98,9 @@ if (inputFiles.length >= 1 && (
// extra bytecode to deploy via ethrun
var extraBytecode = []
if (inputFiles.length > 1 && (
require("fs").lstatSync(inputFiles[0]).isDirectory()
fs.lstatSync(inputFiles[0]).isDirectory()
)) {
const readBytes = f => require("fs").readFileSync(f, { encoding: "utf-8"})
const readBytes = f => fs.readFileSync(f, { encoding: "utf-8"})
extraBytecode = inputFiles.slice(1).map(readBytes)
}

Expand Down
2 changes: 1 addition & 1 deletion libexec/dapp/dapp-test-hsevm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
set -e
shopt -s nullglob

for x in "${DAPP_OUT?}"/*.t.sol.json; do
find "${DAPP_OUT?}" -name '*.t.sol.json' | while read -r x; do
hsevm dapp-test --json-file="$x" --dapp-root=.
done