forked from dotnet/roslyn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcibuild.sh
executable file
·126 lines (109 loc) · 3.82 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
#!/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)
BINARIES_PATH=${THIS_DIR}/Binaries
BOOTSTRAP_PATH=${BINARIES_PATH}/Bootstrap
SRC_PATH=${THIS_DIR}/src
BUILD_LOG_PATH=${BINARIES_PATH}/Build.log
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 ${THIS_DIR}/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} ${THIS_DIR}/build/ToolsetPackages/BaseToolset.csproj
echo "Restoring CoreToolset.csproj"
dotnet restore ${RESTORE_ARGS} ${THIS_DIR}/build/ToolsetPackages/CoreToolset.csproj
echo "Restoring CrossPlatform.sln"
dotnet restore ${RESTORE_ARGS} ${THIS_DIR}/CrossPlatform.sln
BUILD_ARGS="--no-restore -c ${BUILD_CONFIGURATION} -r ${RUNTIME_ID} /nologo /consoleloggerparameters:Verbosity=minimal;summary /filelogger /fileloggerparameters:Verbosity=normal;logFile=${BUILD_LOG_PATH} /maxcpucount:1"
echo "Building bootstrap CscCore"
dotnet publish ${SRC_PATH}/Compilers/CSharp/CscCore -o ${BOOTSTRAP_PATH}/csc ${BUILD_ARGS}
echo "Building bootstrap VbcCore"
dotnet publish ${SRC_PATH}/Compilers/VisualBasic/VbcCore -o ${BOOTSTRAP_PATH}/vbc ${BUILD_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 ${THIS_DIR}/CrossPlatform.sln ${BUILD_ARGS}
if [[ "${SKIP_TESTS}" == false ]]
then
echo "Running tests"
${THIS_DIR}/build/scripts/tests.sh ${BUILD_CONFIGURATION}
fi