-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathget_artifacts.sh
More file actions
executable file
·82 lines (68 loc) · 3.04 KB
/
get_artifacts.sh
File metadata and controls
executable file
·82 lines (68 loc) · 3.04 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# script to build artifacts required for running tests
script_path="$(cd "$(dirname "${0}")" && pwd)"
go_ten="${script_path}/../go-ten"
market="${script_path}/../market"
# purge the artifacts directory
echo Purging artifacts directory
if [ -d ${script_path}/artifacts ]; then
rm -rfv ${script_path}/artifacts
fi
mkdir ${script_path}/artifacts
mkdir ${script_path}/artifacts/go-ten
mkdir ${script_path}/artifacts/market
# -------------------------------------------------
# Build the go-ten repo artifacts
# -------------------------------------------------
if [ -d $go_ten ]; then
echo Creating go-ten build info
cd $go_ten
HASH=`git rev-parse HEAD`
BRANCH=`git rev-parse --abbrev-ref HEAD`
cd $script_path
echo "BRANCH: " $BRANCH > ${script_path}/artifacts/go-ten/build.info
echo "HASH: " $HASH >> ${script_path}/artifacts/go-ten/build.info
echo "DATE: " `date` >> ${script_path}/artifacts/go-ten/build.info
echo "" >> ${script_path}/artifacts/go-ten/build.info
# run the gateway build
echo Building the gateway
cd $go_ten/tools/gateway/main
echo Building gateway for target platform
go build -o ${script_path}/artifacts/go-ten/gateway/gateway .
echo Building gateway for GOOS=darwin GOARCH=amd64
env GOOS=darwin GOARCH=amd64 go build -o ${script_path}/artifacts/go-ten/gateway/gateway_macos_amd64 .
echo Building gateway for GOOS=darwin GOARCH=arm64
env GOOS=darwin GOARCH=arm64 go build -o ${script_path}/artifacts/go-ten/gateway/gateway_macos_arm64 .
echo Building gateway for GOOS=windows GOARCH=amd64
env GOOS=windows GOARCH=amd64 go build -o ${script_path}/artifacts/go-ten/gateway/gateway_win_amd64.exe .
echo Building gateway for GOOS=linux GOARCH=amd64
env GOOS=linux GOARCH=amd64 go build -o ${script_path}/artifacts/go-ten/gateway/gateway_linux_amd64
# run the abigen in go-ten to create the contract ABIs and copy over
echo Building the go-ten contract ABIs
cd $go_ten/contracts
npm install
npx hardhat compile
npx hardhat generate-abi-bindings --output-dir generated
cd $script_path
cp -r $go_ten/contracts/exported/src artifacts/go-ten/contracts
rm -rf $go_ten/contracts/exported/
rm -rf $go_ten/contracts/generated/ConstantSupplyERC20/
fi
# -------------------------------------------------
# Build the market repo artifacts
# -------------------------------------------------
if [ -d $market ]; then
echo Creating market build info
cd $market
HASH=`git rev-parse HEAD`
BRANCH=`git rev-parse --abbrev-ref HEAD`
cd $script_path
echo "BRANCH: " $BRANCH > ${script_path}/artifacts/market/build.info
echo "HASH: " $HASH >> ${script_path}/artifacts/market/build.info
echo "DATE: " `date` >> ${script_path}/artifacts/market/build.info
echo "" >> ${script_path}/artifacts/market/build.info
# copy the market dApp contract abi (assumes the application has been started up externally)
echo Copying the market dApp contract ABIs if they exist
if [ -d $market/packages/hardhat/artifacts/contracts ]; then
cp -r $market/packages/hardhat/artifacts/contracts artifacts/market/contracts
fi
fi