aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Dockerfile_alpine5
-rwxr-xr-xscripts/build_emscripten.sh2
-rwxr-xr-xscripts/bytecodecompare/storebytecode.sh16
-rwxr-xr-xscripts/check_style.sh10
-rwxr-xr-xscripts/docker_build.sh4
-rwxr-xr-xscripts/docker_deploy.sh24
-rwxr-xr-xscripts/docker_deploy_manual.sh27
-rwxr-xr-xscripts/install_deps.sh2
-rwxr-xr-xscripts/report_errors.sh49
-rwxr-xr-xscripts/travis-emscripten/build_emscripten.sh27
-rwxr-xr-xscripts/travis-emscripten/install_deps.sh18
11 files changed, 132 insertions, 52 deletions
diff --git a/scripts/Dockerfile_alpine b/scripts/Dockerfile_alpine
new file mode 100644
index 00000000..21bba456
--- /dev/null
+++ b/scripts/Dockerfile_alpine
@@ -0,0 +1,5 @@
+FROM alpine
+MAINTAINER chriseth <chris@ethereum.org>
+
+COPY upload/solc-static-linux /usr/local/bin/solc
+ENTRYPOINT ["/usr/local/bin/solc"]
diff --git a/scripts/build_emscripten.sh b/scripts/build_emscripten.sh
index cddcd4f8..14c497ae 100755
--- a/scripts/build_emscripten.sh
+++ b/scripts/build_emscripten.sh
@@ -30,5 +30,5 @@ set -e
if [[ "$OSTYPE" != "darwin"* ]]; then
./scripts/travis-emscripten/install_deps.sh
- docker run -v $(pwd):/root/project -w /root/project trzeci/emscripten:sdk-tag-1.35.4-64bit ./scripts/travis-emscripten/build_emscripten.sh
+ docker run -v $(pwd):/root/project -w /root/project trzeci/emscripten:sdk-tag-1.37.21-64bit ./scripts/travis-emscripten/build_emscripten.sh
fi
diff --git a/scripts/bytecodecompare/storebytecode.sh b/scripts/bytecodecompare/storebytecode.sh
index ccf6e60e..4208d67f 100755
--- a/scripts/bytecodecompare/storebytecode.sh
+++ b/scripts/bytecodecompare/storebytecode.sh
@@ -58,7 +58,7 @@ for (var optimize of [false, true])
if (filename !== undefined)
{
var inputs = {}
- inputs[filename] = fs.readFileSync(filename).toString()
+ inputs[filename] = { content: fs.readFileSync(filename).toString() }
var input = {
language: 'Solidity',
sources: inputs,
@@ -68,16 +68,22 @@ for (var optimize of [false, true])
}
}
var result = JSON.parse(compiler.compile(JSON.stringify(input)))
- if (!('contracts' in result) || Object.keys(result['contracts']).length === 0)
+ if (
+ !('contracts' in result) ||
+ Object.keys(result['contracts']).length === 0 ||
+ !result['contracts'][filename] ||
+ Object.keys(result['contracts'][filename]).length === 0
+ )
{
+ // NOTE: do not exit here because this may be run on source which cannot be compiled
console.log(filename + ': ERROR')
}
else
{
- for (var contractName in result['contracts'])
+ for (var contractName in result['contracts'][filename])
{
- console.log(contractName + ' ' + result['contracts'][contractName].evm.bytecode.object)
- console.log(contractName + ' ' + result['contracts'][contractName].metadata)
+ console.log(filename + ':' + contractName + ' ' + result['contracts'][filename][contractName].evm.bytecode.object)
+ console.log(filename + ':' + contractName + ' ' + result['contracts'][filename][contractName].metadata)
}
}
}
diff --git a/scripts/check_style.sh b/scripts/check_style.sh
index 4f716d66..171867f9 100755
--- a/scripts/check_style.sh
+++ b/scripts/check_style.sh
@@ -1,5 +1,7 @@
#!/usr/bin/env bash
+. scripts/report_errors.sh
+
(
REPO_ROOT="$(dirname "$0")"/..
cd $REPO_ROOT
@@ -8,8 +10,8 @@ WHITESPACE=$(git grep -n -I -E "^.*[[:space:]]+$" | grep -v "test/libsolidity/AS
if [[ "$WHITESPACE" != "" ]]
then
- echo "Error: Trailing whitespace found:" >&2
- echo "$WHITESPACE" >&2
+ echo "Error: Trailing whitespace found:" | tee -a $ERROR_LOG
+ echo "$WHITESPACE" | tee -a $ERROR_LOG
exit 1
fi
@@ -22,8 +24,8 @@ git grep -nIE "\<if\>\s*\(.*\)\s*\{\s*$" -- '*.h' '*.cpp'
if [[ "$FORMATERROR" != "" ]]
then
- echo "Error: Format error for if/for:" >&2
- echo "$FORMATERROR" >&2
+ echo "Error: Format error for if/for:" | tee -a $ERROR_LOG
+ echo "$FORMATERROR" | tee -a $ERROR_LOG
exit 1
fi
)
diff --git a/scripts/docker_build.sh b/scripts/docker_build.sh
index 22657a8c..9eedec34 100755
--- a/scripts/docker_build.sh
+++ b/scripts/docker_build.sh
@@ -2,7 +2,11 @@
set -e
+# Scratch image
docker build -t ethereum/solc:build -f scripts/Dockerfile .
tmp_container=$(docker create ethereum/solc:build sh)
mkdir -p upload
docker cp ${tmp_container}:/usr/bin/solc upload/solc-static-linux
+
+# Alpine image
+docker build -t ethereum/solc:build-alpine -f scripts/Dockerfile_alpine .
diff --git a/scripts/docker_deploy.sh b/scripts/docker_deploy.sh
index 00705725..36e918cf 100755
--- a/scripts/docker_deploy.sh
+++ b/scripts/docker_deploy.sh
@@ -2,20 +2,28 @@
set -e
+image="ethereum/solc"
+
+tag_and_push()
+{
+ docker tag "$image:$1" "$image:$2"
+ docker push "$image:$2"
+}
+
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
version=$($(dirname "$0")/get_version.sh)
if [ "$TRAVIS_BRANCH" = "develop" ]
then
- docker tag ethereum/solc:build ethereum/solc:nightly;
- docker tag ethereum/solc:build ethereum/solc:nightly-"$version"-"$TRAVIS_COMMIT"
- docker push ethereum/solc:nightly-"$version"-"$TRAVIS_COMMIT";
- docker push ethereum/solc:nightly;
+ tag_and_push build nightly
+ tag_and_push build nightly-"$version"-"$TRAVIS_COMMIT"
+ tag_and_push build-alpine nightly-alpine
+ tag_and_push build-alpine nightly-alpine-"$version"-"$TRAVIS_COMMIT"
elif [ "$TRAVIS_TAG" = v"$version" ]
then
- docker tag ethereum/solc:build ethereum/solc:stable;
- docker tag ethereum/solc:build ethereum/solc:"$version";
- docker push ethereum/solc:stable;
- docker push ethereum/solc:"$version";
+ tag_and_push build stable
+ tag_and_push build "$version"
+ tag_and_push build-alpine stable-alpine
+ tag_and_push build-alpine "$version"-alpine
else
echo "Not publishing docker image from branch $TRAVIS_BRANCH or tag $TRAVIS_TAG"
fi
diff --git a/scripts/docker_deploy_manual.sh b/scripts/docker_deploy_manual.sh
index c098f4ee..0393d22d 100755
--- a/scripts/docker_deploy_manual.sh
+++ b/scripts/docker_deploy_manual.sh
@@ -7,6 +7,7 @@ then
echo "Usage: $0 <tag/branch>"
exit 1
fi
+image="ethereum/solc"
branch="$1"
#docker login
@@ -27,21 +28,27 @@ else
date -u +"nightly.%Y.%-m.%-d" > prerelease.txt
fi
+tag_and_push()
+{
+ docker tag "$image:$1" "$image:$2"
+ docker push "$image:$2"
+}
+
rm -rf .git
-docker build -t ethereum/solc:build -f scripts/Dockerfile .
-tmp_container=$(docker create ethereum/solc:build sh)
+docker build -t "$image":build -f scripts/Dockerfile .
+tmp_container=$(docker create "$image":build sh)
if [ "$branch" = "develop" ]
then
- docker tag ethereum/solc:build ethereum/solc:nightly;
- docker tag ethereum/solc:build ethereum/solc:nightly-"$version"-"$commithash"
- docker push ethereum/solc:nightly-"$version"-"$commithash";
- docker push ethereum/solc:nightly;
+ tag_and_push build nightly
+ tag_and_push build nightly-"$version"-"$commithash"
+ tag_and_push build-alpine nightly-alpine
+ tag_and_push build-alpine nightly-alpine-"$version"-"$commithash"
elif [ "$branch" = v"$version" ]
then
- docker tag ethereum/solc:build ethereum/solc:stable;
- docker tag ethereum/solc:build ethereum/solc:"$version";
- docker push ethereum/solc:stable;
- docker push ethereum/solc:"$version";
+ tag_and_push build stable
+ tag_and_push build "$version"
+ tag_and_push build-alpine stable-alpine
+ tag_and_push build-alpine "$version"-alpine
else
echo "Not publishing docker image from branch or tag $branch"
fi
diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh
index b107f7c9..09d5a249 100755
--- a/scripts/install_deps.sh
+++ b/scripts/install_deps.sh
@@ -55,7 +55,7 @@ detect_linux_distro() {
DISTRO=$(lsb_release -is)
elif [ -f /etc/os-release ]; then
# extract 'foo' from NAME=foo, only on the line with NAME=foo
- DISTRO=$(sed -n -e 's/^NAME="\(.*\)\"/\1/p' /etc/os-release)
+ DISTRO=$(sed -n -e 's/^NAME="\?\([^"]*\)"\?$/\1/p' /etc/os-release)
elif [ -f /etc/centos-release ]; then
DISTRO=CentOS
else
diff --git a/scripts/report_errors.sh b/scripts/report_errors.sh
new file mode 100755
index 00000000..55fc2e8c
--- /dev/null
+++ b/scripts/report_errors.sh
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+
+export ERROR_LOG="/tmp/error.log"
+
+function report_error_to_github
+{
+ if [ $? -eq 0 ]
+ then
+ exit 0
+ fi
+
+ if [ -z $CIRCLE_PR_NUMBER ]
+ then
+ CIRCLE_PR_NUMBER="${CIRCLE_PULL_REQUEST//[^0-9]/}"
+ fi
+
+ ERROR_MSG=$(cat $ERROR_LOG)
+
+ echo $ERROR_MSG
+
+ if [ ! -z $CI ]
+ then
+ echo "posting error message to github"
+ post_error_to_github
+ fi
+}
+
+function post_error_to_github
+{
+ if [ -z $CIRCLE_PR_NUMBER ]
+ then
+ CIRCLE_PR_NUMBER="${CIRCLE_PULL_REQUEST//[^0-9]/}"
+ fi
+
+ GITHUB_API_URL="https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/issues/$CIRCLE_PR_NUMBER/comments"
+
+ ESCAPED_ERROR_MSG=$(cat -e $ERROR_LOG | sed 's/\\/\\\\/g' | sed 's/"/\\\"/g')
+
+ FORMATTED_ERROR_MSG=$(echo $ESCAPED_ERROR_MSG | sed 's/\$/\\n/g' | tr -d '\n')
+
+ curl --request POST \
+ --url $GITHUB_API_URL \
+ --header 'accept: application/vnd.github.v3+json' \
+ --header 'content-type: application/json' \
+ -u stackenbotten:$GITHUB_ACCESS_TOKEN \
+ --data "{\"body\": \"There was an error when running \`$CIRCLE_JOB\` for commit \`$CIRCLE_SHA1\`:\n\`\`\`\n$FORMATTED_ERROR_MSG\n\`\`\`\nPlease check that your changes are working as intended.\"}"
+}
+
+trap report_error_to_github EXIT
diff --git a/scripts/travis-emscripten/build_emscripten.sh b/scripts/travis-emscripten/build_emscripten.sh
index f49ff5b2..32899903 100755
--- a/scripts/travis-emscripten/build_emscripten.sh
+++ b/scripts/travis-emscripten/build_emscripten.sh
@@ -56,18 +56,14 @@ else
echo 'NODE_JS=["nodejs", "--stack_size=8192"]' > ~/.emscripten
fi
-
# Boost
echo -en 'travis_fold:start:compiling_boost\\r'
-cd "$WORKSPACE"/boost_1_57_0
+cd "$WORKSPACE"/boost_1_67_0
# if b2 exists, it is a fresh checkout, otherwise it comes from the cache
# and is already compiled
test -e b2 && (
-sed -i 's|using gcc ;|using gcc : : em++ ;|g' ./project-config.jam
-sed -i 's|$(archiver\[1\])|emar|g' ./tools/build/src/tools/gcc.jam
-sed -i 's|$(ranlib\[1\])|emranlib|g' ./tools/build/src/tools/gcc.jam
-./b2 link=static variant=release threading=single runtime-link=static \
- system regex filesystem unit_test_framework program_options
+./b2 toolset=emscripten link=static variant=release threading=single runtime-link=static \
+ system regex filesystem unit_test_framework program_options cxxflags="-Wno-unused-local-typedef -Wno-variadic-macros -Wno-c99-extensions -Wno-all"
find . -name 'libboost*.a' -exec cp {} . \;
rm -rf b2 libs doc tools more bin.v2 status
)
@@ -89,17 +85,12 @@ cmake \
-DBoost_FOUND=1 \
-DBoost_USE_STATIC_LIBS=1 \
-DBoost_USE_STATIC_RUNTIME=1 \
- -DBoost_INCLUDE_DIR="$WORKSPACE"/boost_1_57_0/ \
- -DBoost_FILESYSTEM_LIBRARY="$WORKSPACE"/boost_1_57_0/libboost_filesystem.a \
- -DBoost_FILESYSTEM_LIBRARIES="$WORKSPACE"/boost_1_57_0/libboost_filesystem.a \
- -DBoost_PROGRAM_OPTIONS_LIBRARY="$WORKSPACE"/boost_1_57_0/libboost_program_options.a \
- -DBoost_PROGRAM_OPTIONS_LIBRARIES="$WORKSPACE"/boost_1_57_0/libboost_program_options.a \
- -DBoost_REGEX_LIBRARY="$WORKSPACE"/boost_1_57_0/libboost_regex.a \
- -DBoost_REGEX_LIBRARIES="$WORKSPACE"/boost_1_57_0/libboost_regex.a \
- -DBoost_SYSTEM_LIBRARY="$WORKSPACE"/boost_1_57_0/libboost_system.a \
- -DBoost_SYSTEM_LIBRARIES="$WORKSPACE"/boost_1_57_0/libboost_system.a \
- -DBoost_UNIT_TEST_FRAMEWORK_LIBRARY="$WORKSPACE"/boost_1_57_0/libboost_unit_test_framework.a \
- -DBoost_UNIT_TEST_FRAMEWORK_LIBRARIES="$WORKSPACE"/boost_1_57_0/libboost_unit_test_framework.a \
+ -DBoost_INCLUDE_DIR="$WORKSPACE"/boost_1_67_0/ \
+ -DBoost_FILESYSTEM_LIBRARY_RELEASE="$WORKSPACE"/boost_1_67_0/libboost_filesystem.a \
+ -DBoost_PROGRAM_OPTIONS_LIBRARY_RELEASE="$WORKSPACE"/boost_1_67_0/libboost_program_options.a \
+ -DBoost_REGEX_LIBRARY_RELEASE="$WORKSPACE"/boost_1_67_0/libboost_regex.a \
+ -DBoost_SYSTEM_LIBRARY_RELEASE="$WORKSPACE"/boost_1_67_0/libboost_system.a \
+ -DBoost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE="$WORKSPACE"/boost_1_67_0/libboost_unit_test_framework.a \
-DTESTS=0 \
..
make -j 4
diff --git a/scripts/travis-emscripten/install_deps.sh b/scripts/travis-emscripten/install_deps.sh
index 45c16a9f..155506e4 100755
--- a/scripts/travis-emscripten/install_deps.sh
+++ b/scripts/travis-emscripten/install_deps.sh
@@ -30,11 +30,19 @@
set -ev
echo -en 'travis_fold:start:installing_dependencies\\r'
-test -e boost_1_57_0 -a -e boost_1_57_0/boost || (
-wget 'https://sourceforge.net/projects/boost/files/boost/1.57.0/boost_1_57_0.tar.gz/download'\
- -O - | tar xz
-cd boost_1_57_0
-./bootstrap.sh --with-toolset=gcc --with-libraries=thread,system,regex,date_time,chrono,filesystem,program_options,random
+test -e boost_1_67_0 -a -e boost_1_67_0/boost || (
+rm -rf boost_1_67_0
+rm -f boost.tar.xz
+wget -q 'https://sourceforge.net/projects/boost/files/boost/1.67.0/boost_1_67_0.tar.gz/download'\
+ -O boost.tar.xz
+test "$(shasum boost.tar.xz)" = "77e73c9fd7bf85b14067767b9e8fdc39b49ee0f2 boost.tar.xz"
+tar -xzf boost.tar.xz
+rm boost.tar.xz
+cd boost_1_67_0
+./bootstrap.sh
+wget -q 'https://raw.githubusercontent.com/tee3/boost-build-emscripten/master/emscripten.jam'
+test "$(shasum emscripten.jam)" = "a7e13fc2c1e53b0e079ef440622f879aa6da3049 emscripten.jam"
+echo "using emscripten : : em++ ;" >> project-config.jam
)
cd ..
echo -en 'travis_fold:end:installing_dependencies\\r'