You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
820 B
43 lines
820 B
6 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
|
# Configure to exit script as soon as a command fails.
|
||
|
set -o errexit
|
||
|
|
||
|
SOLC_05_DIR=solc-0.5
|
||
|
|
||
|
# Delete any previous build artifacts
|
||
|
rm -rf build/
|
||
|
|
||
|
# Create a subproject where 0.5.x compilation will take place
|
||
|
mkdir -p "$SOLC_05_DIR"
|
||
|
|
||
|
cd "$SOLC_05_DIR"
|
||
|
npm init --yes
|
||
|
npm install --save-dev truffle@5.0.0
|
||
|
|
||
|
rm -rf contracts
|
||
|
ln --symbolic ../contracts contracts
|
||
|
|
||
|
# Delete any previous build artifacts
|
||
|
rm -rf build/
|
||
|
|
||
|
# Compile
|
||
|
echo "
|
||
|
module.exports = {
|
||
|
compilers: {
|
||
|
solc: {
|
||
|
version: \"0.5.0\",
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
" > truffle-config.js
|
||
|
|
||
|
npx truffle compile
|
||
|
|
||
|
# Modify the paths in the artifacts to make it look as if they were built in the root
|
||
|
sed --in-place --expression "s/\/$SOLC_05_DIR//g" build/contracts/*.json
|
||
|
|
||
|
# Copy them back into the root
|
||
|
cd ..
|
||
|
cp --recursive "$SOLC_05_DIR"/build build
|