cibuild.sh 2.3 KB
Newer Older
1
#!/usr/bin/env bash
J
Jared Parsons 已提交
2
set -e
J
jaredpar 已提交
3

D
Drew DeVault 已提交
4 5 6 7 8 9
usage()
{
    echo "Runs our integration suite on Linux"
    echo "usage: cibuild.sh [options]"
    echo ""
    echo "Options"
10 11 12 13 14
    echo "  --debug               Build Debug (default)"
    echo "  --release             Build Release"
    echo "  --skiptests           Do not run tests"
    echo "  --skipcrossgen        Do not crossgen the bootstrapped compiler"
    echo "  --skipcommitprinting  Do not print commit information"
M
Matt Ellis 已提交
15
    echo "  --nocache       Force download of toolsets"
D
Drew DeVault 已提交
16 17
}

18
BUILD_CONFIGURATION=Debug
J
Jared Parsons 已提交
19
USE_CACHE=true
20
SKIP_TESTS=false
M
Matt Ellis 已提交
21
SKIP_CROSSGEN=false
22
SKIP_COMMIT_PRINTING=false
J
jaredpar 已提交
23

J
Jared Parsons 已提交
24 25 26 27 28
MAKE="make"
if [[ $OSTYPE == *[Bb][Ss][Dd]* ]]; then
    MAKE="gmake"
fi

J
Jared Parsons 已提交
29 30 31
# 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
J
Jared Parsons 已提交
32

M
Matt Ellis 已提交
33 34 35 36 37
# 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

J
jaredpar 已提交
38 39
while [[ $# > 0 ]]
do
M
Matt Ellis 已提交
40
    opt="$(echo $1 | awk '{print tolower($0)}')"
J
jaredpar 已提交
41 42 43 44 45
    case $opt in
        -h|--help)
        usage
        exit 1
        ;;
46 47 48 49 50 51 52 53
        --debug)
        BUILD_CONFIGURATION=Debug
        shift 1
        ;;
        --release)
        BUILD_CONFIGURATION=Release
        shift 1
        ;;
J
Jared Parsons 已提交
54 55 56 57
        --nocache)
        USE_CACHE=false
        shift 1
        ;;
58 59 60 61
        --skiptests)
        SKIP_TESTS=true
        shift 1
        ;;
M
Matt Ellis 已提交
62 63 64 65
        --skipcrossgen)
        SKIP_CROSSGEN=true
        shift 1
        ;;
66 67 68 69
        --skipcommitprinting)
        SKIP_COMMIT_PRINTING=true
        shift 1
        ;;
J
jaredpar 已提交
70 71 72 73 74 75 76
        *)
        usage 
        exit 1
        ;;
    esac
done

M
Matt Ellis 已提交
77
MAKE_ARGS="BUILD_CONFIGURATION=$BUILD_CONFIGURATION SKIP_CROSSGEN=$SKIP_CROSSGEN"
M
Matt Ellis 已提交
78

J
Jared Parsons 已提交
79 80 81 82
if [ "$CLEAN_RUN" == "true" ]; then
    echo Clean out the enlistment
    git clean -dxf . 
fi
J
Jared Parsons 已提交
83

J
Jared Parsons 已提交
84 85
if [ "$USE_CACHE" == "false" ]; then
    echo Clean out the toolsets
J
Jared Parsons 已提交
86
    $MAKE clean_toolset
J
Jared Parsons 已提交
87 88
fi

89 90 91 92
if [ "$SKIP_COMMIT_PRINTING" == "false" ]; then
    echo Building this commit:
    git show --no-patch --pretty=raw HEAD
fi
93

J
Jared Parsons 已提交
94
echo Building Bootstrap
J
Jared Parsons 已提交
95
$MAKE bootstrap $MAKE_ARGS 
J
Jared Parsons 已提交
96 97

echo Building CrossPlatform.sln
M
Matt Ellis 已提交
98
$MAKE all $MAKE_ARGS BOOTSTRAP=true BUILD_LOG_PATH=Binaries/Build.log
J
Jared Parsons 已提交
99

100 101 102
if [ "$SKIP_TESTS" == "false" ]; then
    $MAKE test $MAKE_ARGS
fi
J
jaredpar 已提交
103