diff --git a/.circleci/config.yml b/.circleci/config.yml index 8acbc0888..48b9a537f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -56,10 +56,10 @@ jobs: paths: - boost_1_68_0 - store_artifacts: - path: build/libsolc/soljson.js + path: emscripten_build/libsolc/soljson.js destination: soljson.js - run: mkdir -p workspace - - run: cp build/libsolc/soljson.js workspace/soljson.js + - run: cp emscripten_build/libsolc/soljson.js workspace/soljson.js - run: scripts/get_version.sh > workspace/version.txt - persist_to_workspace: root: workspace diff --git a/.gitignore b/.gitignore index e0f010d34..62ddd1af0 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ prerelease.txt # Build directory build/ +emscripten_build/ docs/_build docs/utils/__pycache__ docs/utils/*.pyc diff --git a/scripts/build_emscripten.sh b/scripts/build_emscripten.sh index 2a670daf1..25f6f7f8c 100755 --- a/scripts/build_emscripten.sh +++ b/scripts/build_emscripten.sh @@ -28,7 +28,13 @@ set -e +if test -z "$1"; then + BUILD_DIR="emscripten_build" +else + BUILD_DIR="$1" +fi + docker run -v $(pwd):/root/project -w /root/project trzeci/emscripten:sdk-tag-1.38.22-64bit \ ./scripts/travis-emscripten/install_deps.sh docker run -v $(pwd):/root/project -w /root/project trzeci/emscripten:sdk-tag-1.38.22-64bit \ - ./scripts/travis-emscripten/build_emscripten.sh + ./scripts/travis-emscripten/build_emscripten.sh $BUILD_DIR diff --git a/scripts/bytecodecompare/storebytecode.sh b/scripts/bytecodecompare/storebytecode.sh index 4208d67ff..b7f562621 100755 --- a/scripts/bytecodecompare/storebytecode.sh +++ b/scripts/bytecodecompare/storebytecode.sh @@ -29,6 +29,12 @@ set -e REPO_ROOT="$(dirname "$0")"/../.. +if test -z "$1"; then + BUILD_DIR="build" +else + BUILD_DIR="$1" +fi + echo "Compiling all test contracts into bytecode..." TMPDIR=$(mktemp -d) ( @@ -43,7 +49,7 @@ TMPDIR=$(mktemp -d) # npm install solc git clone --depth 1 https://github.com/ethereum/solc-js.git solc-js ( cd solc-js; npm install ) - cp "$REPO_ROOT/build/libsolc/soljson.js" solc-js/ + cp "$REPO_ROOT/emscripten_build/libsolc/soljson.js" solc-js/ cat > solc < report.txt else - $REPO_ROOT/scripts/bytecodecompare/prepare_report.py $REPO_ROOT/build/solc/solc + $REPO_ROOT/scripts/bytecodecompare/prepare_report.py $REPO_ROOT/$BUILD_DIR/solc/solc fi if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ] diff --git a/scripts/test_emscripten.sh b/scripts/test_emscripten.sh index 1804f23a1..783a64065 100755 --- a/scripts/test_emscripten.sh +++ b/scripts/test_emscripten.sh @@ -28,8 +28,14 @@ set -e +if test -z "$1"; then + BUILD_DIR="emscripten_build" +else + BUILD_DIR="$1" +fi + REPO_ROOT=$(cd $(dirname "$0")/.. && pwd) -SOLJSON="$REPO_ROOT/build/libsolc/soljson.js" +SOLJSON="$REPO_ROOT/$BUILD_DIR/libsolc/soljson.js" VERSION=$("$REPO_ROOT"/scripts/get_version.sh) echo "Running solcjs tests...." diff --git a/scripts/travis-emscripten/build_emscripten.sh b/scripts/travis-emscripten/build_emscripten.sh index 0b6c53462..5b5540b6d 100755 --- a/scripts/travis-emscripten/build_emscripten.sh +++ b/scripts/travis-emscripten/build_emscripten.sh @@ -34,6 +34,12 @@ set -ev +if test -z "$1"; then + BUILD_DIR="emscripten_build" +else + BUILD_DIR="$1" +fi + if ! type git &>/dev/null; then # We need git for extracting the commit hash apt-get update @@ -76,8 +82,8 @@ echo -en 'travis_fold:end:install_cmake.sh\\r' # Build dependent components and solidity itself echo -en 'travis_fold:start:compiling_solidity\\r' cd $WORKSPACE -mkdir -p build -cd build +mkdir -p $BUILD_DIR +cd $BUILD_DIR cmake \ -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/emscripten.cmake \ -DCMAKE_BUILD_TYPE=Release \ @@ -97,9 +103,9 @@ make -j 4 cd .. mkdir -p upload # Patch soljson.js to provide backwards-compatibility with older emscripten versions -echo ";/* backwards compatibility */ Module['Runtime'] = Module;" >> build/libsolc/soljson.js -cp build/libsolc/soljson.js upload/ -cp build/libsolc/soljson.js ./ +echo ";/* backwards compatibility */ Module['Runtime'] = Module;" >> $BUILD_DIR/libsolc/soljson.js +cp $BUILD_DIR/libsolc/soljson.js upload/ +cp $BUILD_DIR/libsolc/soljson.js ./ OUTPUT_SIZE=`ls -la soljson.js`