|
| 1 | +#!/usr/bin/env bash |
| 2 | +set -euo pipefail |
| 3 | + |
| 4 | +(( $# <= 1 )) || { >&2 echo "Usage: $0 [PRERELEASE_SOURCE]"; exit 1; } |
| 5 | +prerelease_source="${1:-ci}" |
| 6 | +ROOTDIR="$(realpath "$(dirname "$0")/../../")" |
| 7 | +FORCE_RELEASE="${FORCE_RELEASE:-}" |
| 8 | +CIRCLE_TAG="${CIRCLE_TAG:-}" |
| 9 | + |
| 10 | +cd "$ROOTDIR" |
| 11 | +if [[ $FORCE_RELEASE != "" || $CIRCLE_TAG != "" ]]; then |
| 12 | + echo -n > prerelease.txt |
| 13 | +else |
| 14 | + # Use last commit date rather than build date to avoid ending up with builds for |
| 15 | + # different platforms having different version strings (and therefore producing different bytecode) |
| 16 | + # if the CI is triggered just before midnight. |
| 17 | + # NOTE: The -local suffix makes git not use the timezone from the commit but instead convert to |
| 18 | + # local one, which we explicitly set to UTC. |
| 19 | + # NOTE: git --date is supposed to support the %-m/%-d format too, but it does not seem to |
| 20 | + # work on Windows. Without it we get leading zeros for month and day. |
| 21 | + last_commit_date=$(TZ=UTC git show --quiet --date="format-local:%Y-%m-%d" --format="%cd") |
| 22 | + last_commit_date_stripped=$(date --date="$last_commit_date" "+%Y.%-m.%-d") |
| 23 | + echo -n "${prerelease_source}.${last_commit_date_stripped}" > prerelease.txt |
| 24 | +fi |
| 25 | + |
| 26 | +mkdir build/ |
| 27 | +cd build/ |
| 28 | + |
| 29 | +# NOTE: Using an array to force Bash to do wildcard expansion |
| 30 | +boost_dir=("${ROOTDIR}/deps/boost/lib/cmake/Boost-"*) |
| 31 | + |
| 32 | +"${ROOTDIR}/deps/cmake/bin/cmake" \ |
| 33 | + -G "Visual Studio 16 2019" \ |
| 34 | + -DBoost_DIR="${boost_dir[*]}" \ |
| 35 | + -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded \ |
| 36 | + -DCMAKE_INSTALL_PREFIX="${ROOTDIR}/uploads/" \ |
| 37 | + .. |
| 38 | +MSBuild.exe solidity.sln \ |
| 39 | + -property:Configuration=Release \ |
| 40 | + -maxCpuCount:10 \ |
| 41 | + -verbosity:minimal |
| 42 | +"${ROOTDIR}/deps/cmake/bin/cmake" \ |
| 43 | + --build . \ |
| 44 | + -j 10 \ |
| 45 | + --target install \ |
| 46 | + --config Release |
0 commit comments