blob: a57401e8195dfeea6f16608f3a6a5bf7d7c0bd28 (
plain)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
#!/usr/bin/env bash
# Stop script if unbound variable found (use ${var:-} if intentional)
set -u
# Stop script if command returns non-zero exit code.
# Prevents hidden errors caused by missing error code propagation.
set -e
# Handle being in the "wrong" directory
cd "${BASH_SOURCE%/*}/"
# Include VSTS logging helpers
. ../eng/common/pipeline-logging-functions.sh
usage()
{
echo "Common settings:"
echo " --configuration <value> Build configuration: 'Debug' or 'Release' (short: -c)"
echo " --help Print help and exit (short: -h)"
echo ""
echo "Actions:"
echo " --pack Package build outputs into NuGet packages"
echo " --test Run all unit tests in the solution (short: -t)"
echo " --interpreter Run tests with interpreter"
echo " --rebuild Run ../.autogen.sh"
echo " --llvm Enable LLVM support"
echo " --skipnative Do not build runtime"
echo " --skipmscorlib Do not build System.Private.CoreLib"
echo " --ci Enable Azure DevOps telemetry decoration"
echo ""
echo "Command line arguments starting with '/p:' are passed through to MSBuild."
echo "Arguments can also be passed in with a single hyphen."
}
pack=false
configuration='Debug'
test_mono_flags=''
test_xunit_flags=''
properties=''
force_rebuild=false
test=false
skipmscorlib=false
skipnative=false
llvm=false
autogen_params=''
ci=false
while [[ $# > 0 ]]; do
opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')"
case "$opt" in
-help|-h)
usage
exit 0
;;
-configuration|-c)
properties="$properties $1 $2"
configuration=$2
shift
;;
-pack)
pack=true
;;
-test|-t)
test=true
;;
-interpreter)
test_mono_flags="$test_mono_flags --interpreter"
test_xunit_flags="$test_xunit_flags @../../../../CoreFX.issues_interpreter.rsp -parallel none"
;;
-rebuild)
force_rebuild=true
;;
-skipmscorlib)
skipmscorlib=true
;;
-skipnative)
skipnative=true
;;
-llvm)
llvm=true
test_mono_flags="$test_mono_flags --llvm"
;;
-ci)
ci=true
;;
-p:*|/p:*)
properties="$properties $1"
;;
-m:*|/m:*)
properties="$properties $1"
;;
-bl:*|/bl:*)
properties="$properties $1"
;;
-dl:*|/dl:*)
properties="$properties $1"
;;
*)
echo "Invalid argument: $1"
usage
exit 1
;;
esac
shift
done
CPU_COUNT=$(getconf _NPROCESSORS_ONLN || echo 4)
if [[ "$configuration" == "Debug" ]]; then
EXTRA_CFLAGS="-O0 -ggdb3 -fno-omit-frame-pointer"
EXTRA_CXXFLAGS="-O0 -ggdb3 -fno-omit-frame-pointer"
elif [[ "$configuration" == "Release" ]]; then
EXTRA_CFLAGS="-O2 -g"
EXTRA_CXXFLAGS="-O2 -g"
fi
if [ "$llvm" = "true" ]; then
git submodule update --init -- ../external/llvm-project || (Write-PipelineTelemetryError -c "git" -e 1 "Error fetching LLVM submodule" && exit 1)
autogen_params="$autogen_params --enable-llvm"
fi
if [[ "$configuration" == "Debug" ]]; then
autogen_params="$autogen_params --enable-checked-build=private_types"
fi
# run .././autogen.sh only once or if "--rebuild" argument is provided
if [[ "$force_rebuild" == "true" || ! -f .configured ]]; then
(cd .. && ./autogen.sh --with-core=only $autogen_params CFLAGS="$EXTRA_CFLAGS" CXXFLAGS="$EXTRA_CXXFLAGS") || (Write-PipelineTelemetryError -c "configure" -e 1 "Error running autogen" && exit 1)
touch .configured
fi
# build mono runtime
if [ "$skipnative" = "false" ]; then
make runtime -j$CPU_COUNT || (Write-PipelineTelemetryError -c "runtime" -e 1 "Error building unmanaged runtime" && exit 1)
fi
# build System.Private.CoreLib (../mcs/class/System.Private.CoreLib)
if [ "$skipmscorlib" = "false" ]; then
make bcl CORLIB_BUILD_FLAGS="$properties" || (Write-PipelineTelemetryError -c "bcl" -e 1 "Error building System.Private.CoreLib" && exit 1)
fi
# create a nupkg with runtime and System.Private.CoreLib
if [ "$pack" = "true" ]; then
if [ "$llvm" = "true" ]; then
make nupkg-llvm || (Write-PipelineTelemetryError -c "nupkg" -e 1 "Error packing NuGet package" && exit 1)
else
make nupkg || (Write-PipelineTelemetryError -c "nupkg" -e 1 "Error packing NuGet package" && exit 1)
fi
fi
# run all xunit tests
if [ "$test" = "true" ]; then
make update-tests-corefx || (Write-PipelineTelemetryError -c "tests-download" -e 1 "Error downloading tests" && exit 1)
if [ "$ci" = "true" ]; then
make run-tests-corefx XUNIT_MONO_ENV_OPTIONS="$test_mono_flags" XUNIT_ARGS="$test_xunit_flags" USE_TIMEOUT=1 || (Write-PipelineTelemetryError -c "tests" -e 1 "Error running tests" && exit 1)
else
make run-tests-corefx XUNIT_MONO_ENV_OPTIONS="$test_mono_flags" XUNIT_ARGS="$test_xunit_flags"
fi
fi
|