summaryrefslogtreecommitdiff
path: root/eng/common/build.sh
diff options
context:
space:
mode:
authorJuan Sebastian Hoyos Ayala <juan.hoyos@microsoft.com>2018-11-01 13:59:59 -0700
committerJuan Sebastian Hoyos Ayala <juan.hoyos@microsoft.com>2018-11-01 16:14:03 -0700
commit84387fa5f788603ff6eb85f5a0c6c954bd90d362 (patch)
treea877e42b21915fb859131f9933e58c537c0c97b1 /eng/common/build.sh
parentdf0cd2cd2c026af3aff78206bed6b45429dc9e19 (diff)
downloadcoreclr-84387fa5f788603ff6eb85f5a0c6c954bd90d362.tar.gz
coreclr-84387fa5f788603ff6eb85f5a0c6c954bd90d362.tar.bz2
coreclr-84387fa5f788603ff6eb85f5a0c6c954bd90d362.zip
Add base arcade scripts and versioning files
Diffstat (limited to 'eng/common/build.sh')
-rw-r--r--eng/common/build.sh171
1 files changed, 171 insertions, 0 deletions
diff --git a/eng/common/build.sh b/eng/common/build.sh
new file mode 100644
index 0000000000..941db3bd57
--- /dev/null
+++ b/eng/common/build.sh
@@ -0,0 +1,171 @@
+#!/usr/bin/env bash
+
+source="${BASH_SOURCE[0]}"
+
+# resolve $source until the file is no longer a symlink
+while [[ -h "$source" ]]; do
+ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+ source="$(readlink "$source")"
+ # if $source was a relative symlink, we need to resolve it relative to the path where the
+ # symlink file was located
+ [[ $source != /* ]] && source="$scriptroot/$source"
+done
+scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+
+help=false
+restore=false
+build=false
+rebuild=false
+test=false
+pack=false
+publish=false
+integration_test=false
+performance_test=false
+sign=false
+public=false
+ci=false
+
+warnaserror=true
+nodereuse=true
+
+projects=''
+configuration='Debug'
+prepare_machine=false
+verbosity='minimal'
+properties=''
+
+while (($# > 0)); do
+ lowerI="$(echo $1 | awk '{print tolower($0)}')"
+ case $lowerI in
+ --build)
+ build=true
+ shift 1
+ ;;
+ --ci)
+ ci=true
+ shift 1
+ ;;
+ --configuration)
+ configuration=$2
+ shift 2
+ ;;
+ --help)
+ echo "Common settings:"
+ echo " --configuration <value> Build configuration Debug, Release"
+ echo " --verbosity <value> Msbuild verbosity (q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic])"
+ echo " --help Print help and exit"
+ echo ""
+ echo "Actions:"
+ echo " --restore Restore dependencies"
+ echo " --build Build solution"
+ echo " --rebuild Rebuild solution"
+ echo " --test Run all unit tests in the solution"
+ echo " --sign Sign build outputs"
+ echo " --publish Publish artifacts (e.g. symbols)"
+ echo " --pack Package build outputs into NuGet packages and Willow components"
+ echo ""
+ echo "Advanced settings:"
+ echo " --solution <value> Path to solution to build"
+ echo " --ci Set when running on CI server"
+ echo " --prepareMachine Prepare machine for CI run"
+ echo ""
+ echo "Command line arguments not listed above are passed through to MSBuild."
+ exit 0
+ ;;
+ --pack)
+ pack=true
+ shift 1
+ ;;
+ --preparemachine)
+ prepare_machine=true
+ shift 1
+ ;;
+ --rebuild)
+ rebuild=true
+ shift 1
+ ;;
+ --restore)
+ restore=true
+ shift 1
+ ;;
+ --sign)
+ sign=true
+ shift 1
+ ;;
+ --solution)
+ solution=$2
+ shift 2
+ ;;
+ --projects)
+ projects=$2
+ shift 2
+ ;;
+ --test)
+ test=true
+ shift 1
+ ;;
+ --integrationtest)
+ integration_test=true
+ shift 1
+ ;;
+ --performancetest)
+ performance_test=true
+ shift 1
+ ;;
+ --publish)
+ publish=true
+ shift 1
+ ;;
+ --verbosity)
+ verbosity=$2
+ shift 2
+ ;;
+ --warnaserror)
+ warnaserror=$2
+ shift 2
+ ;;
+ --nodereuse)
+ nodereuse=$2
+ shift 2
+ ;;
+ *)
+ properties="$properties $1"
+ shift 1
+ ;;
+ esac
+done
+
+. "$scriptroot/tools.sh"
+
+if [[ -z $projects ]]; then
+ projects="$repo_root/*.sln"
+fi
+
+InitializeTools
+
+build_log="$log_dir/Build.binlog"
+
+MSBuild "$toolset_build_proj" \
+ /bl:"$build_log" \
+ /p:Configuration=$configuration \
+ /p:Projects="$projects" \
+ /p:RepoRoot="$repo_root" \
+ /p:Restore=$restore \
+ /p:Build=$build \
+ /p:Rebuild=$rebuild \
+ /p:Test=$test \
+ /p:Pack=$pack \
+ /p:IntegrationTest=$integration_test \
+ /p:PerformanceTest=$performance_test \
+ /p:Sign=$sign \
+ /p:Publish=$publish \
+ /p:ContinuousIntegrationBuild=$ci \
+ $properties
+
+lastexitcode=$?
+
+if [[ $lastexitcode != 0 ]]; then
+ echo "Build failed (exit code '$lastexitcode'). See log: $build_log"
+fi
+
+ExitWithExitCode $lastexitcode