| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- #!/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
- 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 " --rebuild Run ../.autogen.sh"
- echo " --skipnative Do not build runtime"
- echo " --skipmscorlib Do not build System.Private.CoreLib"
- 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'
- properties=''
- force_rebuild=false
- test=false
- skipmscorlib=false
- skipnative=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
- ;;
- -rebuild)
- force_rebuild=true
- ;;
- -skipmscorlib)
- skipmscorlib=true
- ;;
- -skipnative)
- skipnative=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)
- # run .././autogen.sh only once or if "--rebuild" argument is provided
- if [[ "$force_rebuild" == "true" || ! -f .configured ]]; then
- (cd .. && ./autogen.sh --with-core=only)
- touch .configured
- fi
- # build mono runtime
- if [ "$skipnative" = "false" ]; then
- make runtime -j$CPU_COUNT
- fi
- # build System.Private.CoreLib (../mcs/class/System.Private.CoreLib)
- if [ "$skipmscorlib" = "false" ]; then
- make bcl CORLIB_BUILD_FLAGS="$properties"
- fi
- # create a nupkg with runtime and System.Private.CoreLib
- if [ "$pack" = "true" ]; then
- make nupkg
- fi
- # run all xunit tests
- if [ "$test" = "true" ]; then
- make update-tests-corefx
- for testdir in corefx/tests/extracted/*; do
- ../scripts/ci/./run-step.sh --label=$(basename $testdir) --timeout=15m make run-tests-corefx-$(basename $testdir)
- done
- fi
|