-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcompileProd.sh
executable file
·36 lines (31 loc) · 1.11 KB
/
compileProd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
set -e
DIST_DIR="dist"
C_SRC_DIR="contracts"
SOLC_VER=$(solc --version | tail -n 1 | cut -d ' ' -f 2 | cut -d '+' -f 1)
# TODO: Fix this, dont' want to delete archives //facepalm
rm -rf ./$DIST_DIR/* || true
mkdir -p $DIST_DIR || true
doSvCompile(){
cname="$(echo $1 | sed 's/\.sol$//g')"
cfile="$cname.sol"
dist_src="$DIST_DIR/$cfile"
# sensible snake case
distname=$(echo "$cname" | sed -E 's/([A-Z])([a-z])/_\L\1\2/g' | sed -E 's/([A-Z])([A-Z]*)/_\L\1\L\2/g' | sed 's/^_//')
outdir="dist/$distname"
solidity_flattener "./$C_SRC_DIR/$cfile" --solc-paths './lib,./ens,' > "$dist_src"
sed -i "s/pragma solidity \^0.4.13;/pragma solidity $SOLC_VER;\n\n\/\/ (c) 2018 SecureVote (Exo One Pty Ltd)/" "$dist_src"
mkdir -p "$outdir"
./bin/compile.sh -d "$DIST_DIR" -c "$cfile" -o "$outdir"
echo "-------------"
echo "$cname compile to $outdir"
echo "-------------"
}
# doSvCompile SVIndex
# doSvCompile SVIndexBackend
# doSvCompile SVPayments
# doSvCompile BBFarm
doSvCompile BBFarmRemote
# doSvCompile BBFarmProxy
# doSvCompile CommunityAuction
# doSvCompile EnsOwnerProxy