Files
openzeppelin-contracts/scripts/compile.sh
Nicolás Venturo be5ed7364b Release v2.1.0 solc 0.5.x (#1568)
* Now compiling in a separate directory using truffle 5.

* Ported to 0.5.1, now compiling using 0.5.1.

* test now also compiles using the truffle 5 hack.

* Downgraded to 0.5.0.

* Sorted scripts.

* Cleaned up the compile script a bit.
2018-12-20 12:26:43 -03:00

43 lines
820 B
Bash
Executable File

#!/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