diff options
author | Hyeongseok Oh <hseok82.oh@samsung.com> | 2017-03-16 08:10:30 +0300 |
---|---|---|
committer | Hyeongseok Oh <hseok82.oh@samsung.com> | 2017-03-17 04:00:52 +0300 |
commit | 562816dc92f885659d7b0fc258571b6ec529a03a (patch) | |
tree | 6ad33dced500fed1de8c72a599818a0be025bcfa /cross | |
parent | fa66c2ec6298da0c8ce336f692eeeb91fdaf6e47 (diff) |
[Linux/x86] Enable CI Linux/x86 build
Make new job: Linux/x86 build (debug/release)
- Triggered daily
- Docker for crossbuild
- Use pre-generated rootfs
Diffstat (limited to 'cross')
-rwxr-xr-x | cross/x86_ci_script.sh | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/cross/x86_ci_script.sh b/cross/x86_ci_script.sh new file mode 100755 index 0000000000..3e3edf40ae --- /dev/null +++ b/cross/x86_ci_script.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +function exit_with_error { + set +x + + local errorMessage="$1" + + echo "ERROR: $errorMessage" + exit 1 +} + +#Exit if input string is empty +function exit_if_empty { + local inputString="$1" + local errorMessage="$2" + local printUsage=$3 + + if [ -z "$inputString" ]; then + exit_with_error "$errorMessage" $printUsage + fi +} + +# Cross builds corefx using Docker image +function cross_build_native_with_docker { + __currentWorkingDirectory=`pwd` + + # choose Docker image + __dockerImage=" hseok82/dotnet-buildtools-prereqs:ubuntu1604_cross_prereqs_v3_x86" + __dockerEnvironmentVariables="-e ROOTFS_DIR=/crossrootfs/x86" + __runtimeOS="ubuntu.16.04" + + __dockerCmd="docker run ${__dockerEnvironmentVariables} -i --rm -v $__currentWorkingDirectory:/opt/code -w /opt/code $__dockerImage" + + # Cross building corefx with rootfs in Docker + __buildNativeCmd="./build-native.sh -buildArch=x86 -$__buildConfig -- cross" + + $__dockerCmd $__buildNativeCmd + sudo chown -R $(id -u -n) ./bin +} + +__buildConfig= +for arg in "$@" +do + case $arg in + --buildConfig=*) + __buildConfig="$(echo ${arg#*=} | awk '{print tolower($0)}')" + if [[ "$__buildConfig" != "debug" && "$__buildConfig" != "release" ]]; then + exit_with_error "--buildConfig can be only Debug or Release" true + fi + ;; + *) + ;; + esac +done + +set -x +set -e + +exit_if_empty "$__buildConfig" "--buildConfig is a mandatory argument, not provided" true + +#Complete the cross build +(set +x; echo 'Building corefx...') +cross_build_native_with_docker + +(set +x; echo 'Build complete') |