Skip to content

Commit 9327b28

Browse files
committed
Rewrite build_win.ps1 in Bash
1 parent ccb1c48 commit 9327b28

File tree

3 files changed

+47
-28
lines changed

3 files changed

+47
-28
lines changed

.circleci/build_win.ps1

Lines changed: 0 additions & 26 deletions
This file was deleted.

.circleci/config.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,8 +1640,7 @@ jobs:
16401640
- .\deps
16411641
- run:
16421642
name: "Building solidity"
1643-
command: .circleci/build_win.ps1
1644-
shell: powershell.exe
1643+
command: scripts/ci/build_win.sh
16451644
- run:
16461645
name: "Run solc.exe to make sure build was successful."
16471646
command: .\build\solc\Release\solc.exe --version

scripts/ci/build_win.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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

Comments
 (0)