3 # Stop script if unbound variable found (use ${var:-} if intentional)
6 # Stop script if command returns non-zero exit code.
7 # Prevents hidden errors caused by missing error code propagation.
10 # Handle being in the "wrong" directory
11 cd "${BASH_SOURCE%/*}/"
13 # Include VSTS logging helpers
14 . ..
/eng
/common
/pipeline-logging-functions.sh
18 echo "Common settings:"
19 echo " --configuration <value> Build configuration: 'Debug' or 'Release' (short: -c)"
20 echo " --help Print help and exit (short: -h)"
24 echo " --pack Package build outputs into NuGet packages"
25 echo " --test Run all unit tests in the solution (short: -t)"
26 echo " --interpreter Run tests with interpreter"
27 echo " --rebuild Run ../.autogen.sh"
28 echo " --llvm Enable LLVM support"
29 echo " --skipnative Do not build runtime"
30 echo " --skipmscorlib Do not build System.Private.CoreLib"
31 echo " --ci Enable Azure DevOps telemetry decoration"
34 echo "Command line arguments starting with '/p:' are passed through to MSBuild."
35 echo "Arguments can also be passed in with a single hyphen."
51 while [[ $# > 0 ]]; do
52 opt
="$(echo "${1/#--/-}" | awk '{print tolower($0)}')"
59 properties
="$properties $1 $2"
70 test_mono_flags
="$test_mono_flags --interpreter"
71 test_xunit_flags
="$test_xunit_flags @../../../../CoreFX.issues_interpreter.rsp -parallel none"
84 test_mono_flags
="$test_mono_flags --llvm"
90 properties
="$properties $1"
93 properties
="$properties $1"
96 properties
="$properties $1"
99 properties
="$properties $1"
102 echo "Invalid argument: $1"
111 CPU_COUNT
=$
(getconf _NPROCESSORS_ONLN ||
echo 4)
113 if [[ "$configuration" == "Debug" ]]; then
114 EXTRA_CFLAGS
="-O0 -ggdb3 -fno-omit-frame-pointer"
115 EXTRA_CXXFLAGS
="-O0 -ggdb3 -fno-omit-frame-pointer"
116 elif [[ "$configuration" == "Release" ]]; then
117 EXTRA_CFLAGS
="-O2 -g"
118 EXTRA_CXXFLAGS
="-O2 -g"
121 if [ "$llvm" = "true" ]; then
122 git submodule update
--init -- ..
/external
/llvm-project ||
(Write-PipelineTelemetryError
-c "git" -e 1 "Error fetching LLVM submodule" && exit 1)
123 autogen_params
="$autogen_params --enable-llvm"
126 if [[ "$configuration" == "Debug" ]]; then
127 autogen_params
="$autogen_params --enable-checked-build=private_types"
130 # run .././autogen.sh only once or if "--rebuild" argument is provided
131 if [[ "$force_rebuild" == "true" ||
! -f .configured
]]; then
132 (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)
137 if [ "$skipnative" = "false" ]; then
138 make runtime
-j$CPU_COUNT ||
(Write-PipelineTelemetryError
-c "runtime" -e 1 "Error building unmanaged runtime" && exit 1)
141 # build System.Private.CoreLib (../mcs/class/System.Private.CoreLib)
142 if [ "$skipmscorlib" = "false" ]; then
143 make bcl CORLIB_BUILD_FLAGS
="$properties" ||
(Write-PipelineTelemetryError
-c "bcl" -e 1 "Error building System.Private.CoreLib" && exit 1)
146 # create a nupkg with runtime and System.Private.CoreLib
147 if [ "$pack" = "true" ]; then
148 if [ "$llvm" = "true" ]; then
149 make nupkg-llvm ||
(Write-PipelineTelemetryError
-c "nupkg" -e 1 "Error packing NuGet package" && exit 1)
151 make nupkg ||
(Write-PipelineTelemetryError
-c "nupkg" -e 1 "Error packing NuGet package" && exit 1)
155 # run all xunit tests
156 if [ "$test" = "true" ]; then
157 make update-tests-corefx ||
(Write-PipelineTelemetryError
-c "tests-download" -e 1 "Error downloading tests" && exit 1)
158 if [ "$ci" = "true" ]; then
159 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)
161 make run-tests-corefx XUNIT_MONO_ENV_OPTIONS
="$test_mono_flags" XUNIT_ARGS
="$test_xunit_flags"