2019-05-21 00:04:04 +03:00
|
|
|
#!/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 " --verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
|
|
|
|
echo " --binaryLog Create MSBuild binary log (short: -bl)"
|
|
|
|
echo " --help Print help and exit (short: -h)"
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
echo "Actions:"
|
|
|
|
echo " --restore Restore dependencies (short: -r)"
|
|
|
|
echo " --build Build solution (short: -b)"
|
2022-08-01 17:08:12 +03:00
|
|
|
echo " --sourceBuild Source-build the solution (short: -sb)"
|
|
|
|
echo " Will additionally trigger the following actions: --restore, --build, --pack"
|
|
|
|
echo " If --configuration is not set explicitly, will also set it to 'Release'"
|
2024-03-01 21:59:11 +03:00
|
|
|
echo " --productBuild Build the solution in the way it will be built in the full .NET product (VMR) build (short: -pb)"
|
|
|
|
echo " Will additionally trigger the following actions: --restore, --build, --pack"
|
|
|
|
echo " If --configuration is not set explicitly, will also set it to 'Release'"
|
2019-05-21 00:04:04 +03:00
|
|
|
echo " --rebuild Rebuild solution"
|
|
|
|
echo " --test Run all unit tests in the solution (short: -t)"
|
|
|
|
echo " --integrationTest Run all integration tests in the solution"
|
|
|
|
echo " --performanceTest Run all performance tests in the solution"
|
|
|
|
echo " --pack Package build outputs into NuGet packages and Willow components"
|
|
|
|
echo " --sign Sign build outputs"
|
|
|
|
echo " --publish Publish artifacts (e.g. symbols)"
|
2019-11-01 03:18:24 +03:00
|
|
|
echo " --clean Clean the solution"
|
2019-05-21 00:04:04 +03:00
|
|
|
echo ""
|
|
|
|
|
|
|
|
echo "Advanced settings:"
|
|
|
|
echo " --projects <value> Project or solution file(s) to build"
|
|
|
|
echo " --ci Set when running on CI server"
|
2020-05-15 03:17:02 +03:00
|
|
|
echo " --excludeCIBinarylog Don't output binary log (short: -nobl)"
|
2019-05-21 00:04:04 +03:00
|
|
|
echo " --prepareMachine Prepare machine for CI run, clean up processes after build"
|
|
|
|
echo " --nodeReuse <value> Sets nodereuse msbuild parameter ('true' or 'false')"
|
|
|
|
echo " --warnAsError <value> Sets warnaserror msbuild parameter ('true' or 'false')"
|
|
|
|
echo ""
|
|
|
|
echo "Command line arguments not listed above are passed thru to msbuild."
|
|
|
|
echo "Arguments can also be passed in with a single hyphen."
|
|
|
|
}
|
|
|
|
|
|
|
|
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 )"
|
|
|
|
|
|
|
|
restore=false
|
|
|
|
build=false
|
2022-08-01 17:08:12 +03:00
|
|
|
source_build=false
|
2024-03-01 21:59:11 +03:00
|
|
|
product_build=false
|
2019-05-21 00:04:04 +03:00
|
|
|
rebuild=false
|
|
|
|
test=false
|
|
|
|
integration_test=false
|
|
|
|
performance_test=false
|
|
|
|
pack=false
|
|
|
|
publish=false
|
|
|
|
sign=false
|
|
|
|
public=false
|
|
|
|
ci=false
|
2019-11-01 03:18:24 +03:00
|
|
|
clean=false
|
2019-05-21 00:04:04 +03:00
|
|
|
|
|
|
|
warn_as_error=true
|
|
|
|
node_reuse=true
|
|
|
|
binary_log=false
|
2020-05-15 03:17:02 +03:00
|
|
|
exclude_ci_binary_log=false
|
2019-05-24 01:35:49 +03:00
|
|
|
pipelines_log=false
|
2019-05-21 00:04:04 +03:00
|
|
|
|
|
|
|
projects=''
|
2022-08-01 17:08:12 +03:00
|
|
|
configuration=''
|
2019-05-21 00:04:04 +03:00
|
|
|
prepare_machine=false
|
|
|
|
verbosity='minimal'
|
2020-08-29 01:18:52 +03:00
|
|
|
runtime_source_feed=''
|
|
|
|
runtime_source_feed_key=''
|
2019-05-21 00:04:04 +03:00
|
|
|
|
|
|
|
properties=''
|
|
|
|
while [[ $# > 0 ]]; do
|
2021-01-11 17:21:25 +03:00
|
|
|
opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")"
|
2019-05-21 00:04:04 +03:00
|
|
|
case "$opt" in
|
|
|
|
-help|-h)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
2019-11-01 03:18:24 +03:00
|
|
|
-clean)
|
|
|
|
clean=true
|
|
|
|
;;
|
2019-05-21 00:04:04 +03:00
|
|
|
-configuration|-c)
|
|
|
|
configuration=$2
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-verbosity|-v)
|
|
|
|
verbosity=$2
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-binarylog|-bl)
|
|
|
|
binary_log=true
|
|
|
|
;;
|
2023-10-23 16:26:21 +03:00
|
|
|
-excludecibinarylog|-nobl)
|
2020-05-15 03:17:02 +03:00
|
|
|
exclude_ci_binary_log=true
|
|
|
|
;;
|
2019-05-24 01:35:49 +03:00
|
|
|
-pipelineslog|-pl)
|
|
|
|
pipelines_log=true
|
|
|
|
;;
|
2019-05-21 00:04:04 +03:00
|
|
|
-restore|-r)
|
|
|
|
restore=true
|
|
|
|
;;
|
|
|
|
-build|-b)
|
|
|
|
build=true
|
|
|
|
;;
|
|
|
|
-rebuild)
|
|
|
|
rebuild=true
|
|
|
|
;;
|
|
|
|
-pack)
|
|
|
|
pack=true
|
|
|
|
;;
|
2022-08-01 17:08:12 +03:00
|
|
|
-sourcebuild|-sb)
|
|
|
|
build=true
|
|
|
|
source_build=true
|
2024-03-01 21:59:11 +03:00
|
|
|
product_build=true
|
|
|
|
restore=true
|
|
|
|
pack=true
|
|
|
|
;;
|
|
|
|
-productBuild|-pb)
|
|
|
|
build=true
|
|
|
|
product_build=true
|
2022-08-01 17:08:12 +03:00
|
|
|
restore=true
|
|
|
|
pack=true
|
|
|
|
;;
|
2019-05-21 00:04:04 +03:00
|
|
|
-test|-t)
|
|
|
|
test=true
|
|
|
|
;;
|
|
|
|
-integrationtest)
|
|
|
|
integration_test=true
|
|
|
|
;;
|
|
|
|
-performancetest)
|
|
|
|
performance_test=true
|
|
|
|
;;
|
|
|
|
-sign)
|
|
|
|
sign=true
|
|
|
|
;;
|
|
|
|
-publish)
|
|
|
|
publish=true
|
|
|
|
;;
|
|
|
|
-preparemachine)
|
|
|
|
prepare_machine=true
|
|
|
|
;;
|
|
|
|
-projects)
|
|
|
|
projects=$2
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-ci)
|
|
|
|
ci=true
|
|
|
|
;;
|
|
|
|
-warnaserror)
|
|
|
|
warn_as_error=$2
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-nodereuse)
|
|
|
|
node_reuse=$2
|
|
|
|
shift
|
|
|
|
;;
|
2020-08-29 01:18:52 +03:00
|
|
|
-runtimesourcefeed)
|
|
|
|
runtime_source_feed=$2
|
|
|
|
shift
|
|
|
|
;;
|
2020-10-28 02:41:17 +03:00
|
|
|
-runtimesourcefeedkey)
|
2020-08-29 01:18:52 +03:00
|
|
|
runtime_source_feed_key=$2
|
|
|
|
shift
|
|
|
|
;;
|
2019-05-21 00:04:04 +03:00
|
|
|
*)
|
|
|
|
properties="$properties $1"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2022-08-01 17:08:12 +03:00
|
|
|
if [[ -z "$configuration" ]]; then
|
|
|
|
if [[ "$source_build" = true ]]; then configuration="Release"; else configuration="Debug"; fi
|
|
|
|
fi
|
|
|
|
|
2019-05-21 00:04:04 +03:00
|
|
|
if [[ "$ci" == true ]]; then
|
2019-05-24 01:35:49 +03:00
|
|
|
pipelines_log=true
|
2019-05-21 00:04:04 +03:00
|
|
|
node_reuse=false
|
2020-05-15 03:17:02 +03:00
|
|
|
if [[ "$exclude_ci_binary_log" == false ]]; then
|
|
|
|
binary_log=true
|
|
|
|
fi
|
2019-05-21 00:04:04 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
. "$scriptroot/tools.sh"
|
|
|
|
|
|
|
|
function InitializeCustomToolset {
|
|
|
|
local script="$eng_root/restore-toolset.sh"
|
|
|
|
|
|
|
|
if [[ -a "$script" ]]; then
|
|
|
|
. "$script"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function Build {
|
|
|
|
InitializeToolset
|
|
|
|
InitializeCustomToolset
|
|
|
|
|
|
|
|
if [[ ! -z "$projects" ]]; then
|
|
|
|
properties="$properties /p:Projects=$projects"
|
|
|
|
fi
|
|
|
|
|
|
|
|
local bl=""
|
|
|
|
if [[ "$binary_log" == true ]]; then
|
|
|
|
bl="/bl:\"$log_dir/Build.binlog\""
|
|
|
|
fi
|
|
|
|
|
|
|
|
MSBuild $_InitializeToolset \
|
|
|
|
$bl \
|
|
|
|
/p:Configuration=$configuration \
|
|
|
|
/p:RepoRoot="$repo_root" \
|
|
|
|
/p:Restore=$restore \
|
|
|
|
/p:Build=$build \
|
2024-03-01 21:59:11 +03:00
|
|
|
/p:DotNetBuildRepo=$product_build \
|
2022-08-01 17:08:12 +03:00
|
|
|
/p:ArcadeBuildFromSource=$source_build \
|
2024-03-01 21:59:11 +03:00
|
|
|
/p:DotNetBuildSourceOnly=$source_build \
|
2019-05-21 00:04:04 +03:00
|
|
|
/p:Rebuild=$rebuild \
|
|
|
|
/p:Test=$test \
|
|
|
|
/p:Pack=$pack \
|
|
|
|
/p:IntegrationTest=$integration_test \
|
|
|
|
/p:PerformanceTest=$performance_test \
|
|
|
|
/p:Sign=$sign \
|
|
|
|
/p:Publish=$publish \
|
|
|
|
$properties
|
|
|
|
|
|
|
|
ExitWithExitCode 0
|
|
|
|
}
|
|
|
|
|
2019-11-01 03:18:24 +03:00
|
|
|
if [[ "$clean" == true ]]; then
|
|
|
|
if [ -d "$artifacts_dir" ]; then
|
|
|
|
rm -rf $artifacts_dir
|
|
|
|
echo "Artifacts directory deleted."
|
|
|
|
fi
|
|
|
|
exit 0
|
2019-05-21 00:04:04 +03:00
|
|
|
fi
|
|
|
|
|
2019-11-01 03:18:24 +03:00
|
|
|
if [[ "$restore" == true ]]; then
|
2019-05-21 00:04:04 +03:00
|
|
|
InitializeNativeTools
|
|
|
|
fi
|
|
|
|
|
2020-05-29 21:53:59 +03:00
|
|
|
Build
|