forked from dotnet/roslyn
-
Notifications
You must be signed in to change notification settings - Fork 6
/
cibuild.sh
executable file
·130 lines (113 loc) · 3.97 KB
/
cibuild.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env bash
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
set -e
set -u
usage()
{
echo "Runs our integration suite on Linux"
echo "usage: cibuild.sh [options]"
echo ""
echo "Options"
echo " --debug Build Debug (default)"
echo " --release Build Release"
echo " --cleanrun Clean the project before building"
echo " --skiptest Do not run tests"
echo " --skipcommitprinting Do not print commit information"
}
THIS_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${THIS_DIR}"/build/scripts/build-utils.sh
ROOT_PATH="$(get_repo_dir)"
BINARIES_PATH="${ROOT_PATH}"/Binaries
BOOTSTRAP_PATH="${BINARIES_PATH}"/Bootstrap
SRC_PATH="${ROOT_PATH}"/src
BUILD_LOG_PATH="${BINARIES_PATH}"/Build.binlog
TARGET_FRAMEWORK=netcoreapp2.0
BUILD_CONFIGURATION=Debug
CLEAN_RUN=false
SKIP_TESTS=false
SKIP_COMMIT_PRINTING=false
# $HOME is unset when running the mac unit tests.
if [[ -z "${HOME+x}" ]]
then
# Note that while ~ usually refers to $HOME, in the case where $HOME is unset,
# it looks up the current user's home dir, which is what we want.
# https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html
export HOME="$(cd ~ && pwd)"
fi
# LTTNG is the logging infrastructure used by coreclr. Need this variable set
# so it doesn't output warnings to the console.
export LTTNG_HOME="$HOME"
# There's no reason to send telemetry or prime a local package cach when building
# in CI.
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
while [[ $# > 0 ]]
do
opt="$(echo "$1" | awk '{print tolower($0)}')"
case "$opt" in
-h|--help)
usage
exit 1
;;
--debug)
BUILD_CONFIGURATION=Debug
shift 1
;;
--release)
BUILD_CONFIGURATION=Release
shift 1
;;
--cleanrun)
CLEAN_RUN=true
shift 1
;;
--skiptests)
SKIP_TESTS=true
shift 1
;;
--skipcommitprinting)
SKIP_COMMIT_PRINTING=true
shift 1
;;
*)
usage
exit 1
;;
esac
done
if [ "$CLEAN_RUN" == "true" ]; then
echo Clean out the enlistment
git clean -dxf .
fi
if [ "$SKIP_COMMIT_PRINTING" == "false" ]; then
echo Building this commit:
git show --no-patch --pretty=raw HEAD
fi
# obtain_dotnet.sh puts the right dotnet on the PATH
FORCE_DOWNLOAD=true
source "${ROOT_PATH}"/build/scripts/obtain_dotnet.sh
RUNTIME_ID="$(dotnet --info | awk '/RID:/{print $2;}')"
echo "Using Runtime Identifier: ${RUNTIME_ID}"
RESTORE_ARGS="-r ${RUNTIME_ID} -v Minimal --disable-parallel"
echo "Restoring BaseToolset.csproj"
dotnet restore ${RESTORE_ARGS} "${ROOT_PATH}"/build/ToolsetPackages/BaseToolset.csproj
echo "Restoring CoreToolset.csproj"
dotnet restore ${RESTORE_ARGS} "${ROOT_PATH}"/build/ToolsetPackages/CoreToolset.csproj
echo "Restoring CrossPlatform.sln"
dotnet restore ${RESTORE_ARGS} "${ROOT_PATH}"/CrossPlatform.sln
BUILD_ARGS="--no-restore -c ${BUILD_CONFIGURATION} /nologo /consoleloggerparameters:Verbosity=minimal;summary /bl:${BUILD_LOG_PATH} /maxcpucount:1"
PUBLISH_ARGS="-f ${TARGET_FRAMEWORK} -r ${RUNTIME_ID} ${BUILD_ARGS}"
echo "Building bootstrap csc"
dotnet publish "${SRC_PATH}"/Compilers/CSharp/csc -o "${BOOTSTRAP_PATH}"/csc ${PUBLISH_ARGS}
echo "Building bootstrap vbc"
dotnet publish "${SRC_PATH}"/Compilers/VisualBasic/vbc -o "${BOOTSTRAP_PATH}"/vbc ${PUBLISH_ARGS}
rm -rf "${BINARIES_PATH:?}"/"${BUILD_CONFIGURATION}"
BUILD_ARGS+=" /p:CscToolPath=${BOOTSTRAP_PATH}/csc /p:CscToolExe=csc /p:VbcToolPath=${BOOTSTRAP_PATH}/vbc /p:VbcToolExe=vbc"
echo "Building CrossPlatform.sln"
dotnet build "${ROOT_PATH}"/CrossPlatform.sln ${BUILD_ARGS}
if [[ "${SKIP_TESTS}" == false ]]
then
echo "Running tests"
"${ROOT_PATH}"/build/scripts/tests.sh "${BUILD_CONFIGURATION}"
fi