2019-05-22 12:11:57 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-12-19 20:55:42 +00:00
|
|
|
# Initialize variables if they aren't already defined.
|
|
|
|
|
|
|
|
# CI mode - set to true on CI server for PR validation build or official build.
|
2018-10-22 05:07:26 +00:00
|
|
|
ci=${ci:-false}
|
2018-12-19 20:55:42 +00:00
|
|
|
|
2019-05-22 12:11:57 +00:00
|
|
|
# Set to true to use the pipelines logger which will enable Azure logging output.
|
|
|
|
# https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md
|
|
|
|
# This flag is meant as a temporary opt-opt for the feature while validate it across
|
|
|
|
# our consumers. It will be deleted in the future.
|
|
|
|
if [[ "$ci" == true ]]; then
|
|
|
|
pipelines_log=${pipelines_log:-true}
|
|
|
|
else
|
|
|
|
pipelines_log=${pipelines_log:-false}
|
|
|
|
fi
|
|
|
|
|
2018-12-19 20:55:42 +00:00
|
|
|
# Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names.
|
2018-10-22 05:07:26 +00:00
|
|
|
configuration=${configuration:-'Debug'}
|
2018-12-19 20:55:42 +00:00
|
|
|
|
2020-05-12 12:48:04 +00:00
|
|
|
# Set to true to opt out of outputting binary log while running in CI
|
|
|
|
exclude_ci_binary_log=${exclude_ci_binary_log:-false}
|
|
|
|
|
|
|
|
if [[ "$ci" == true && "$exclude_ci_binary_log" == false ]]; then
|
|
|
|
binary_log_default=true
|
|
|
|
else
|
|
|
|
binary_log_default=false
|
|
|
|
fi
|
|
|
|
|
2018-12-19 20:55:42 +00:00
|
|
|
# Set to true to output binary log from msbuild. Note that emitting binary log slows down the build.
|
2020-05-12 12:48:04 +00:00
|
|
|
binary_log=${binary_log:-$binary_log_default}
|
2018-12-19 20:55:42 +00:00
|
|
|
|
|
|
|
# Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes).
|
2018-10-22 05:07:26 +00:00
|
|
|
prepare_machine=${prepare_machine:-false}
|
2018-12-19 20:55:42 +00:00
|
|
|
|
|
|
|
# True to restore toolsets and dependencies.
|
2018-10-22 05:07:26 +00:00
|
|
|
restore=${restore:-true}
|
2018-12-19 20:55:42 +00:00
|
|
|
|
|
|
|
# Adjusts msbuild verbosity level.
|
2018-10-22 05:07:26 +00:00
|
|
|
verbosity=${verbosity:-'minimal'}
|
|
|
|
|
2018-12-19 20:55:42 +00:00
|
|
|
# Set to true to reuse msbuild nodes. Recommended to not reuse on CI.
|
|
|
|
if [[ "$ci" == true ]]; then
|
|
|
|
node_reuse=${node_reuse:-false}
|
|
|
|
else
|
|
|
|
node_reuse=${node_reuse:-true}
|
2018-12-06 01:48:17 +00:00
|
|
|
fi
|
|
|
|
|
2018-12-19 20:55:42 +00:00
|
|
|
# Configures warning treatment in msbuild.
|
|
|
|
warn_as_error=${warn_as_error:-true}
|
2018-10-22 05:07:26 +00:00
|
|
|
|
2020-02-08 00:51:24 +00:00
|
|
|
# True to attempt using .NET Core already that meets requirements specified in global.json
|
2018-12-19 20:55:42 +00:00
|
|
|
# installed on the machine instead of downloading one.
|
|
|
|
use_installed_dotnet_cli=${use_installed_dotnet_cli:-true}
|
|
|
|
|
2019-08-02 12:38:38 +00:00
|
|
|
# Enable repos to use a particular version of the on-line dotnet-install scripts.
|
2021-07-13 19:44:25 +00:00
|
|
|
# default URL: https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh
|
2019-08-02 12:38:38 +00:00
|
|
|
dotnetInstallScriptVersion=${dotnetInstallScriptVersion:-'v1'}
|
|
|
|
|
2018-12-19 20:55:42 +00:00
|
|
|
# True to use global NuGet cache instead of restoring packages to repository-local directory.
|
|
|
|
if [[ "$ci" == true ]]; then
|
|
|
|
use_global_nuget_cache=${use_global_nuget_cache:-false}
|
|
|
|
else
|
|
|
|
use_global_nuget_cache=${use_global_nuget_cache:-true}
|
|
|
|
fi
|
2018-10-22 05:07:26 +00:00
|
|
|
|
2020-08-26 13:09:20 +00:00
|
|
|
# Used when restoring .NET SDK from alternative feeds
|
|
|
|
runtime_source_feed=${runtime_source_feed:-''}
|
|
|
|
runtime_source_feed_key=${runtime_source_feed_key:-''}
|
|
|
|
|
2018-12-19 20:55:42 +00:00
|
|
|
# Resolve any symlinks in the given path.
|
2018-10-22 05:07:26 +00:00
|
|
|
function ResolvePath {
|
|
|
|
local path=$1
|
|
|
|
|
|
|
|
while [[ -h $path ]]; do
|
|
|
|
local dir="$( cd -P "$( dirname "$path" )" && pwd )"
|
|
|
|
path="$(readlink "$path")"
|
|
|
|
|
|
|
|
# if $path was a relative symlink, we need to resolve it relative to the path where the
|
|
|
|
# symlink file was located
|
|
|
|
[[ $path != /* ]] && path="$dir/$path"
|
|
|
|
done
|
|
|
|
|
|
|
|
# return value
|
|
|
|
_ResolvePath="$path"
|
|
|
|
}
|
|
|
|
|
|
|
|
# ReadVersionFromJson [json key]
|
|
|
|
function ReadGlobalVersion {
|
|
|
|
local key=$1
|
|
|
|
|
2021-01-09 13:53:15 +00:00
|
|
|
if command -v jq &> /dev/null; then
|
|
|
|
_ReadGlobalVersion="$(jq -r ".[] | select(has(\"$key\")) | .\"$key\"" "$global_json_file")"
|
|
|
|
elif [[ "$(cat "$global_json_file")" =~ \"$key\"[[:space:]\:]*\"([^\"]+) ]]; then
|
|
|
|
_ReadGlobalVersion=${BASH_REMATCH[1]}
|
|
|
|
fi
|
2018-10-22 05:07:26 +00:00
|
|
|
|
2021-01-09 13:53:15 +00:00
|
|
|
if [[ -z "$_ReadGlobalVersion" ]]; then
|
2019-11-22 13:41:58 +00:00
|
|
|
Write-PipelineTelemetryError -category 'Build' "Error: Cannot find \"$key\" in $global_json_file"
|
2018-10-22 05:07:26 +00:00
|
|
|
ExitWithExitCode 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function InitializeDotNetCli {
|
2018-12-19 20:55:42 +00:00
|
|
|
if [[ -n "${_InitializeDotNetCli:-}" ]]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2018-10-22 05:07:26 +00:00
|
|
|
local install=$1
|
|
|
|
|
|
|
|
# Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism
|
|
|
|
export DOTNET_MULTILEVEL_LOOKUP=0
|
|
|
|
|
2021-09-17 13:01:04 +00:00
|
|
|
# Disable first run since we want to control all package sources
|
|
|
|
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
|
|
|
|
2018-12-19 20:55:42 +00:00
|
|
|
# Disable telemetry on CI
|
|
|
|
if [[ $ci == true ]]; then
|
|
|
|
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# LTTNG is the logging infrastructure used by Core CLR. Need this variable set
|
|
|
|
# so it doesn't output warnings to the console.
|
|
|
|
export LTTNG_HOME="$HOME"
|
|
|
|
|
2018-10-22 05:07:26 +00:00
|
|
|
# Source Build uses DotNetCoreSdkDir variable
|
|
|
|
if [[ -n "${DotNetCoreSdkDir:-}" ]]; then
|
|
|
|
export DOTNET_INSTALL_DIR="$DotNetCoreSdkDir"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Find the first path on $PATH that contains the dotnet.exe
|
2019-05-07 12:30:40 +00:00
|
|
|
if [[ "$use_installed_dotnet_cli" == true && $global_json_has_runtimes == false && -z "${DOTNET_INSTALL_DIR:-}" ]]; then
|
2018-10-22 05:07:26 +00:00
|
|
|
local dotnet_path=`command -v dotnet`
|
|
|
|
if [[ -n "$dotnet_path" ]]; then
|
|
|
|
ResolvePath "$dotnet_path"
|
|
|
|
export DOTNET_INSTALL_DIR=`dirname "$_ResolvePath"`
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
ReadGlobalVersion "dotnet"
|
|
|
|
local dotnet_sdk_version=$_ReadGlobalVersion
|
|
|
|
local dotnet_root=""
|
|
|
|
|
|
|
|
# Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version,
|
|
|
|
# otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues.
|
2019-05-07 12:30:40 +00:00
|
|
|
if [[ $global_json_has_runtimes == false && -n "${DOTNET_INSTALL_DIR:-}" && -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then
|
2018-10-22 05:07:26 +00:00
|
|
|
dotnet_root="$DOTNET_INSTALL_DIR"
|
|
|
|
else
|
|
|
|
dotnet_root="$repo_root/.dotnet"
|
2019-05-07 12:30:40 +00:00
|
|
|
|
2018-10-22 05:07:26 +00:00
|
|
|
export DOTNET_INSTALL_DIR="$dotnet_root"
|
|
|
|
|
|
|
|
if [[ ! -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then
|
|
|
|
if [[ "$install" == true ]]; then
|
|
|
|
InstallDotNetSdk "$dotnet_root" "$dotnet_sdk_version"
|
|
|
|
else
|
2019-06-14 12:10:56 +00:00
|
|
|
Write-PipelineTelemetryError -category 'InitializeToolset' "Unable to find dotnet with SDK version '$dotnet_sdk_version'"
|
2018-10-22 05:07:26 +00:00
|
|
|
ExitWithExitCode 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-12-19 20:55:42 +00:00
|
|
|
# Add dotnet to PATH. This prevents any bare invocation of dotnet in custom
|
|
|
|
# build steps from using anything other than what we've downloaded.
|
2019-07-19 12:39:46 +00:00
|
|
|
Write-PipelinePrependPath -path "$dotnet_root"
|
2018-12-19 20:55:42 +00:00
|
|
|
|
2019-07-19 12:39:46 +00:00
|
|
|
Write-PipelineSetVariable -name "DOTNET_MULTILEVEL_LOOKUP" -value "0"
|
2021-09-17 13:01:04 +00:00
|
|
|
Write-PipelineSetVariable -name "DOTNET_SKIP_FIRST_TIME_EXPERIENCE" -value "1"
|
2019-01-11 13:12:40 +00:00
|
|
|
|
2018-10-22 05:07:26 +00:00
|
|
|
# return value
|
|
|
|
_InitializeDotNetCli="$dotnet_root"
|
|
|
|
}
|
|
|
|
|
|
|
|
function InstallDotNetSdk {
|
|
|
|
local root=$1
|
|
|
|
local version=$2
|
2020-08-26 13:09:20 +00:00
|
|
|
local architecture="unset"
|
|
|
|
if [[ $# -ge 3 ]]; then
|
2019-05-07 12:30:40 +00:00
|
|
|
architecture=$3
|
|
|
|
fi
|
2021-12-06 17:03:16 +00:00
|
|
|
InstallDotNet "$root" "$version" $architecture 'sdk' 'true' $runtime_source_feed $runtime_source_feed_key
|
2019-05-07 12:30:40 +00:00
|
|
|
}
|
2018-10-22 05:07:26 +00:00
|
|
|
|
2019-05-07 12:30:40 +00:00
|
|
|
function InstallDotNet {
|
|
|
|
local root=$1
|
|
|
|
local version=$2
|
2023-05-06 12:33:43 +00:00
|
|
|
local runtime=$4
|
|
|
|
|
|
|
|
local dotnetVersionLabel="'$runtime v$version'"
|
|
|
|
if [[ -n "${4:-}" ]] && [ "$4" != 'sdk' ]; then
|
|
|
|
runtimePath="$root"
|
|
|
|
runtimePath="$runtimePath/shared"
|
|
|
|
case "$runtime" in
|
|
|
|
dotnet)
|
|
|
|
runtimePath="$runtimePath/Microsoft.NETCore.App"
|
|
|
|
;;
|
|
|
|
aspnetcore)
|
|
|
|
runtimePath="$runtimePath/Microsoft.AspNetCore.App"
|
|
|
|
;;
|
|
|
|
windowsdesktop)
|
|
|
|
runtimePath="$runtimePath/Microsoft.WindowsDesktop.App"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
runtimePath="$runtimePath/$version"
|
|
|
|
|
|
|
|
dotnetVersionLabel="runtime toolset '$runtime/$architecture v$version'"
|
|
|
|
|
|
|
|
if [ -d "$runtimePath" ]; then
|
|
|
|
echo " Runtime toolset '$runtime/$architecture v$version' already installed."
|
|
|
|
local installSuccess=1
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
2020-02-08 00:51:24 +00:00
|
|
|
|
2018-10-22 05:07:26 +00:00
|
|
|
GetDotNetInstallScript "$root"
|
|
|
|
local install_script=$_GetDotNetInstallScript
|
|
|
|
|
2021-11-17 14:57:23 +00:00
|
|
|
local installParameters=(--version $version --install-dir "$root")
|
|
|
|
|
2020-08-26 13:09:20 +00:00
|
|
|
if [[ -n "${3:-}" ]] && [ "$3" != 'unset' ]; then
|
2021-11-17 14:57:23 +00:00
|
|
|
installParameters+=(--architecture $3)
|
2019-05-07 12:30:40 +00:00
|
|
|
fi
|
2020-08-26 13:09:20 +00:00
|
|
|
if [[ -n "${4:-}" ]] && [ "$4" != 'sdk' ]; then
|
2021-11-17 14:57:23 +00:00
|
|
|
installParameters+=(--runtime $4)
|
2019-02-06 13:45:20 +00:00
|
|
|
fi
|
2020-08-26 13:09:20 +00:00
|
|
|
if [[ "$#" -ge "5" ]] && [[ "$5" != 'false' ]]; then
|
2021-11-17 14:57:23 +00:00
|
|
|
installParameters+=(--skip-non-versioned-files)
|
2019-05-07 12:30:40 +00:00
|
|
|
fi
|
2019-10-24 22:05:36 +00:00
|
|
|
|
2021-11-17 14:57:23 +00:00
|
|
|
local variations=() # list of variable names with parameter arrays in them
|
|
|
|
|
|
|
|
local public_location=("${installParameters[@]}")
|
|
|
|
variations+=(public_location)
|
|
|
|
|
|
|
|
local dotnetbuilds=("${installParameters[@]}" --azure-feed "https://dotnetbuilds.azureedge.net/public")
|
|
|
|
variations+=(dotnetbuilds)
|
2019-10-24 22:05:36 +00:00
|
|
|
|
2021-11-17 14:57:23 +00:00
|
|
|
if [[ -n "${6:-}" ]]; then
|
|
|
|
variations+=(private_feed)
|
|
|
|
local private_feed=("${installParameters[@]}" --azure-feed $6)
|
2020-08-26 13:09:20 +00:00
|
|
|
if [[ -n "${7:-}" ]]; then
|
|
|
|
# The 'base64' binary on alpine uses '-d' and doesn't support '--decode'
|
|
|
|
# '-d'. To work around this, do a simple detection and switch the parameter
|
|
|
|
# accordingly.
|
|
|
|
decodeArg="--decode"
|
|
|
|
if base64 --help 2>&1 | grep -q "BusyBox"; then
|
|
|
|
decodeArg="-d"
|
2019-10-24 22:05:36 +00:00
|
|
|
fi
|
2020-08-26 13:09:20 +00:00
|
|
|
decodedFeedKey=`echo $7 | base64 $decodeArg`
|
2021-11-17 14:57:23 +00:00
|
|
|
private_feed+=(--feed-credential $decodedFeedKey)
|
2020-08-26 13:09:20 +00:00
|
|
|
fi
|
2021-11-17 14:57:23 +00:00
|
|
|
fi
|
2019-10-24 22:05:36 +00:00
|
|
|
|
2021-11-17 14:57:23 +00:00
|
|
|
local installSuccess=0
|
|
|
|
for variationName in "${variations[@]}"; do
|
|
|
|
local name="$variationName[@]"
|
|
|
|
local variation=("${!name}")
|
2023-05-06 12:33:43 +00:00
|
|
|
echo " Attempting to install $dotnetVersionLabel from $variationName."
|
2021-11-17 14:57:23 +00:00
|
|
|
bash "$install_script" "${variation[@]}" && installSuccess=1
|
|
|
|
if [[ "$installSuccess" -eq 1 ]]; then
|
|
|
|
break
|
2019-10-24 22:05:36 +00:00
|
|
|
fi
|
2021-11-17 14:57:23 +00:00
|
|
|
|
2023-05-06 12:33:43 +00:00
|
|
|
echo " Failed to install $dotnetVersionLabel from $variationName."
|
2021-11-17 14:57:23 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
if [[ "$installSuccess" -eq 0 ]]; then
|
2023-05-06 12:33:43 +00:00
|
|
|
Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install $dotnetVersionLabel from any of the specified locations."
|
2021-11-17 14:57:23 +00:00
|
|
|
ExitWithExitCode 1
|
|
|
|
fi
|
2018-10-22 05:07:26 +00:00
|
|
|
}
|
|
|
|
|
2020-02-08 00:51:24 +00:00
|
|
|
function with_retries {
|
|
|
|
local maxRetries=5
|
|
|
|
local retries=1
|
|
|
|
echo "Trying to run '$@' for maximum of $maxRetries attempts."
|
|
|
|
while [[ $((retries++)) -le $maxRetries ]]; do
|
|
|
|
"$@"
|
|
|
|
|
|
|
|
if [[ $? == 0 ]]; then
|
|
|
|
echo "Ran '$@' successfully."
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2020-12-03 14:19:38 +00:00
|
|
|
timeout=$((3**$retries-1))
|
2020-02-08 00:51:24 +00:00
|
|
|
echo "Failed to execute '$@'. Waiting $timeout seconds before next attempt ($retries out of $maxRetries)." 1>&2
|
|
|
|
sleep $timeout
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Failed to execute '$@' for $maxRetries times." 1>&2
|
|
|
|
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2018-10-22 05:07:26 +00:00
|
|
|
function GetDotNetInstallScript {
|
|
|
|
local root=$1
|
|
|
|
local install_script="$root/dotnet-install.sh"
|
2021-07-13 19:44:25 +00:00
|
|
|
local install_script_url="https://dotnet.microsoft.com/download/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.sh"
|
2018-10-22 05:07:26 +00:00
|
|
|
|
|
|
|
if [[ ! -a "$install_script" ]]; then
|
|
|
|
mkdir -p "$root"
|
|
|
|
|
2020-10-28 15:07:45 +00:00
|
|
|
echo "Downloading '$install_script_url'"
|
2018-10-22 05:07:26 +00:00
|
|
|
|
2020-10-28 15:07:45 +00:00
|
|
|
# Use curl if available, otherwise use wget
|
|
|
|
if command -v curl > /dev/null; then
|
2020-12-03 14:19:38 +00:00
|
|
|
# first, try directly, if this fails we will retry with verbose logging
|
|
|
|
curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || {
|
2021-02-26 13:51:15 +00:00
|
|
|
if command -v openssl &> /dev/null; then
|
2021-01-09 13:53:15 +00:00
|
|
|
echo "Curl failed; dumping some information about dotnet.microsoft.com for later investigation"
|
|
|
|
echo | openssl s_client -showcerts -servername dotnet.microsoft.com -connect dotnet.microsoft.com:443
|
|
|
|
fi
|
2020-12-31 14:01:40 +00:00
|
|
|
echo "Will now retry the same URL with verbose logging."
|
2020-12-03 14:19:38 +00:00
|
|
|
with_retries curl "$install_script_url" -sSL --verbose --retry 10 --create-dirs -o "$install_script" || {
|
|
|
|
local exit_code=$?
|
|
|
|
Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')."
|
|
|
|
ExitWithExitCode $exit_code
|
|
|
|
}
|
2020-10-28 15:07:45 +00:00
|
|
|
}
|
2020-02-08 00:51:24 +00:00
|
|
|
else
|
2020-10-28 15:07:45 +00:00
|
|
|
with_retries wget -v -O "$install_script" "$install_script_url" || {
|
|
|
|
local exit_code=$?
|
|
|
|
Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')."
|
|
|
|
ExitWithExitCode $exit_code
|
|
|
|
}
|
2018-10-22 05:07:26 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
# return value
|
|
|
|
_GetDotNetInstallScript="$install_script"
|
|
|
|
}
|
|
|
|
|
2018-12-19 20:55:42 +00:00
|
|
|
function InitializeBuildTool {
|
|
|
|
if [[ -n "${_InitializeBuildTool:-}" ]]; then
|
|
|
|
return
|
|
|
|
fi
|
2020-02-08 00:51:24 +00:00
|
|
|
|
2018-12-19 20:55:42 +00:00
|
|
|
InitializeDotNetCli $restore
|
|
|
|
|
2019-01-06 13:08:39 +00:00
|
|
|
# return values
|
2020-02-08 00:51:24 +00:00
|
|
|
_InitializeBuildTool="$_InitializeDotNetCli/dotnet"
|
2019-01-06 13:08:39 +00:00
|
|
|
_InitializeBuildToolCommand="msbuild"
|
2023-01-18 10:18:03 +00:00
|
|
|
_InitializeBuildToolFramework="net8.0"
|
2018-12-19 20:55:42 +00:00
|
|
|
}
|
|
|
|
|
[master] Update dependencies from dotnet/arcade (#8726)
* Update dependencies from https://github.com/dotnet/arcade build 20200924.4
Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 5.0.0-beta.20471.1 -> To Version 5.0.0-beta.20474.4
Dependency coherency updates
Microsoft.WindowsDesktop.App.Ref,Microsoft.WindowsDesktop.App,Microsoft.AspNetCore.App.Ref,Microsoft.AspNetCore.App.Ref.Internal,Microsoft.AspNetCore.App.Runtime.win-x64,VS.Redist.Common.AspNetCore.TargetingPack.x64.5.0,dotnet-dev-certs,dotnet-user-secrets,dotnet-watch,Microsoft.Dotnet.WinForms.ProjectTemplates,Microsoft.WindowsDesktop.App.Runtime.win-x64,Microsoft.DotNet.Wpf.ProjectTemplates,Microsoft.FSharp.Compiler,Microsoft.NET.Test.Sdk,Microsoft.NET.ILLink.Tasks,Microsoft.Net.Compilers.Toolset,Microsoft.Build,NuGet.Build.Tasks
From Version 5.0.0-rc.2.20474.5 -> To Version 5.0.0-rc.1.20417.4 (parent: Microsoft.NET.Sdk
* Update dependencies from https://github.com/dotnet/arcade build 20200928.3
Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 5.0.0-beta.20471.1 -> To Version 5.0.0-beta.20478.3
Dependency coherency updates
Microsoft.WindowsDesktop.App.Ref,Microsoft.WindowsDesktop.App,Microsoft.AspNetCore.App.Ref,Microsoft.AspNetCore.App.Ref.Internal,Microsoft.AspNetCore.App.Runtime.win-x64,VS.Redist.Common.AspNetCore.TargetingPack.x64.5.0,dotnet-dev-certs,dotnet-user-secrets,dotnet-watch,Microsoft.Dotnet.WinForms.ProjectTemplates,Microsoft.WindowsDesktop.App.Runtime.win-x64,Microsoft.DotNet.Wpf.ProjectTemplates,Microsoft.FSharp.Compiler,Microsoft.NET.Test.Sdk,Microsoft.NET.ILLink.Tasks,Microsoft.Net.Compilers.Toolset,Microsoft.Build,NuGet.Build.Tasks
From Version 5.0.0-rc.2.20474.5 -> To Version 5.0.0-rc.1.20417.4 (parent: Microsoft.NET.Sdk
* Update dependencies from https://github.com/dotnet/arcade build 20201006.7
Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 5.0.0-beta.20471.1 -> To Version 5.0.0-beta.20506.7
Dependency coherency updates
Microsoft.WindowsDesktop.App.Ref,Microsoft.WindowsDesktop.App,Microsoft.AspNetCore.App.Ref,Microsoft.AspNetCore.App.Ref.Internal,Microsoft.AspNetCore.App.Runtime.win-x64,VS.Redist.Common.AspNetCore.TargetingPack.x64.5.0,dotnet-dev-certs,dotnet-user-secrets,dotnet-watch,Microsoft.Dotnet.WinForms.ProjectTemplates,Microsoft.WindowsDesktop.App.Runtime.win-x64,Microsoft.DotNet.Wpf.ProjectTemplates,Microsoft.FSharp.Compiler,Microsoft.NET.Test.Sdk,Microsoft.NET.ILLink.Tasks,Microsoft.Net.Compilers.Toolset,Microsoft.Build,NuGet.Build.Tasks,Microsoft.SourceLink.GitHub,XliffTasks
From Version 5.0.0-rc.2.20474.5 -> To Version 5.0.0-rc.1.20417.4 (parent: Microsoft.NET.Sdk
* Update dependencies from https://github.com/dotnet/arcade build 20201009.12
Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 5.0.0-beta.20471.1 -> To Version 6.0.0-beta.20509.12
Dependency coherency updates
Microsoft.WindowsDesktop.App.Ref,Microsoft.WindowsDesktop.App,Microsoft.AspNetCore.App.Ref,Microsoft.AspNetCore.App.Ref.Internal,Microsoft.AspNetCore.App.Runtime.win-x64,VS.Redist.Common.AspNetCore.TargetingPack.x64.5.0,dotnet-dev-certs,dotnet-user-secrets,dotnet-watch,Microsoft.Dotnet.WinForms.ProjectTemplates,Microsoft.WindowsDesktop.App.Runtime.win-x64,Microsoft.DotNet.Wpf.ProjectTemplates,Microsoft.FSharp.Compiler,Microsoft.NET.Test.Sdk,Microsoft.NET.ILLink.Tasks,Microsoft.Net.Compilers.Toolset,Microsoft.Build,NuGet.Build.Tasks,Microsoft.SourceLink.GitHub,XliffTasks
From Version 5.0.0-rc.2.20474.5 -> To Version 5.0.0-rc.1.20417.4 (parent: Microsoft.NET.Sdk
* Update dependencies from https://github.com/dotnet/arcade build 20201020.8
Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 5.0.0-beta.20471.1 -> To Version 6.0.0-beta.20520.8
Dependency coherency updates
Microsoft.SourceLink.GitHub,XliffTasks
From Version 1.1.0-beta-20464-02 -> To Version 1.1.0-beta-20519-02 (parent: Microsoft.DotNet.Arcade.Sdk
* Update FileInfoAssertions.cs
* Update FileInfoAssertions.cs
* Use tasks provided by Microsoft.DotNet.Build.Tasks.Installers when provided.
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
Co-authored-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
2020-10-23 07:44:02 +00:00
|
|
|
# Set RestoreNoCache as a workaround for https://github.com/NuGet/Home/issues/3116
|
2018-12-19 20:55:42 +00:00
|
|
|
function GetNuGetPackageCachePath {
|
|
|
|
if [[ -z ${NUGET_PACKAGES:-} ]]; then
|
|
|
|
if [[ "$use_global_nuget_cache" == true ]]; then
|
|
|
|
export NUGET_PACKAGES="$HOME/.nuget/packages"
|
|
|
|
else
|
|
|
|
export NUGET_PACKAGES="$repo_root/.packages"
|
[master] Update dependencies from dotnet/arcade (#8726)
* Update dependencies from https://github.com/dotnet/arcade build 20200924.4
Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 5.0.0-beta.20471.1 -> To Version 5.0.0-beta.20474.4
Dependency coherency updates
Microsoft.WindowsDesktop.App.Ref,Microsoft.WindowsDesktop.App,Microsoft.AspNetCore.App.Ref,Microsoft.AspNetCore.App.Ref.Internal,Microsoft.AspNetCore.App.Runtime.win-x64,VS.Redist.Common.AspNetCore.TargetingPack.x64.5.0,dotnet-dev-certs,dotnet-user-secrets,dotnet-watch,Microsoft.Dotnet.WinForms.ProjectTemplates,Microsoft.WindowsDesktop.App.Runtime.win-x64,Microsoft.DotNet.Wpf.ProjectTemplates,Microsoft.FSharp.Compiler,Microsoft.NET.Test.Sdk,Microsoft.NET.ILLink.Tasks,Microsoft.Net.Compilers.Toolset,Microsoft.Build,NuGet.Build.Tasks
From Version 5.0.0-rc.2.20474.5 -> To Version 5.0.0-rc.1.20417.4 (parent: Microsoft.NET.Sdk
* Update dependencies from https://github.com/dotnet/arcade build 20200928.3
Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 5.0.0-beta.20471.1 -> To Version 5.0.0-beta.20478.3
Dependency coherency updates
Microsoft.WindowsDesktop.App.Ref,Microsoft.WindowsDesktop.App,Microsoft.AspNetCore.App.Ref,Microsoft.AspNetCore.App.Ref.Internal,Microsoft.AspNetCore.App.Runtime.win-x64,VS.Redist.Common.AspNetCore.TargetingPack.x64.5.0,dotnet-dev-certs,dotnet-user-secrets,dotnet-watch,Microsoft.Dotnet.WinForms.ProjectTemplates,Microsoft.WindowsDesktop.App.Runtime.win-x64,Microsoft.DotNet.Wpf.ProjectTemplates,Microsoft.FSharp.Compiler,Microsoft.NET.Test.Sdk,Microsoft.NET.ILLink.Tasks,Microsoft.Net.Compilers.Toolset,Microsoft.Build,NuGet.Build.Tasks
From Version 5.0.0-rc.2.20474.5 -> To Version 5.0.0-rc.1.20417.4 (parent: Microsoft.NET.Sdk
* Update dependencies from https://github.com/dotnet/arcade build 20201006.7
Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 5.0.0-beta.20471.1 -> To Version 5.0.0-beta.20506.7
Dependency coherency updates
Microsoft.WindowsDesktop.App.Ref,Microsoft.WindowsDesktop.App,Microsoft.AspNetCore.App.Ref,Microsoft.AspNetCore.App.Ref.Internal,Microsoft.AspNetCore.App.Runtime.win-x64,VS.Redist.Common.AspNetCore.TargetingPack.x64.5.0,dotnet-dev-certs,dotnet-user-secrets,dotnet-watch,Microsoft.Dotnet.WinForms.ProjectTemplates,Microsoft.WindowsDesktop.App.Runtime.win-x64,Microsoft.DotNet.Wpf.ProjectTemplates,Microsoft.FSharp.Compiler,Microsoft.NET.Test.Sdk,Microsoft.NET.ILLink.Tasks,Microsoft.Net.Compilers.Toolset,Microsoft.Build,NuGet.Build.Tasks,Microsoft.SourceLink.GitHub,XliffTasks
From Version 5.0.0-rc.2.20474.5 -> To Version 5.0.0-rc.1.20417.4 (parent: Microsoft.NET.Sdk
* Update dependencies from https://github.com/dotnet/arcade build 20201009.12
Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 5.0.0-beta.20471.1 -> To Version 6.0.0-beta.20509.12
Dependency coherency updates
Microsoft.WindowsDesktop.App.Ref,Microsoft.WindowsDesktop.App,Microsoft.AspNetCore.App.Ref,Microsoft.AspNetCore.App.Ref.Internal,Microsoft.AspNetCore.App.Runtime.win-x64,VS.Redist.Common.AspNetCore.TargetingPack.x64.5.0,dotnet-dev-certs,dotnet-user-secrets,dotnet-watch,Microsoft.Dotnet.WinForms.ProjectTemplates,Microsoft.WindowsDesktop.App.Runtime.win-x64,Microsoft.DotNet.Wpf.ProjectTemplates,Microsoft.FSharp.Compiler,Microsoft.NET.Test.Sdk,Microsoft.NET.ILLink.Tasks,Microsoft.Net.Compilers.Toolset,Microsoft.Build,NuGet.Build.Tasks,Microsoft.SourceLink.GitHub,XliffTasks
From Version 5.0.0-rc.2.20474.5 -> To Version 5.0.0-rc.1.20417.4 (parent: Microsoft.NET.Sdk
* Update dependencies from https://github.com/dotnet/arcade build 20201020.8
Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 5.0.0-beta.20471.1 -> To Version 6.0.0-beta.20520.8
Dependency coherency updates
Microsoft.SourceLink.GitHub,XliffTasks
From Version 1.1.0-beta-20464-02 -> To Version 1.1.0-beta-20519-02 (parent: Microsoft.DotNet.Arcade.Sdk
* Update FileInfoAssertions.cs
* Update FileInfoAssertions.cs
* Use tasks provided by Microsoft.DotNet.Build.Tasks.Installers when provided.
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
Co-authored-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
2020-10-23 07:44:02 +00:00
|
|
|
export RESTORENOCACHE=true
|
2018-12-19 20:55:42 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# return value
|
|
|
|
_GetNuGetPackageCachePath=$NUGET_PACKAGES
|
|
|
|
}
|
|
|
|
|
2019-05-02 12:26:55 +00:00
|
|
|
function InitializeNativeTools() {
|
2019-11-02 12:56:53 +00:00
|
|
|
if [[ -n "${DisableNativeToolsetInstalls:-}" ]]; then
|
2019-10-24 22:05:36 +00:00
|
|
|
return
|
|
|
|
fi
|
2019-05-02 12:26:55 +00:00
|
|
|
if grep -Fq "native-tools" $global_json_file
|
|
|
|
then
|
|
|
|
local nativeArgs=""
|
|
|
|
if [[ "$ci" == true ]]; then
|
2019-07-27 12:35:24 +00:00
|
|
|
nativeArgs="--installDirectory $tools_dir"
|
2019-05-02 12:26:55 +00:00
|
|
|
fi
|
|
|
|
"$_script_dir/init-tools-native.sh" $nativeArgs
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-10-22 05:07:26 +00:00
|
|
|
function InitializeToolset {
|
2018-12-19 20:55:42 +00:00
|
|
|
if [[ -n "${_InitializeToolset:-}" ]]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
GetNuGetPackageCachePath
|
|
|
|
|
2018-10-22 05:07:26 +00:00
|
|
|
ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk"
|
|
|
|
|
|
|
|
local toolset_version=$_ReadGlobalVersion
|
|
|
|
local toolset_location_file="$toolset_dir/$toolset_version.txt"
|
|
|
|
|
|
|
|
if [[ -a "$toolset_location_file" ]]; then
|
|
|
|
local path=`cat "$toolset_location_file"`
|
|
|
|
if [[ -a "$path" ]]; then
|
2018-12-19 20:55:42 +00:00
|
|
|
# return value
|
|
|
|
_InitializeToolset="$path"
|
2018-10-22 05:07:26 +00:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$restore" != true ]]; then
|
2019-06-14 12:10:56 +00:00
|
|
|
Write-PipelineTelemetryError -category 'InitializeToolset' "Toolset version $toolset_version has not been restored."
|
2018-10-22 05:07:26 +00:00
|
|
|
ExitWithExitCode 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
local proj="$toolset_dir/restore.proj"
|
|
|
|
|
2019-02-15 13:37:10 +00:00
|
|
|
local bl=""
|
|
|
|
if [[ "$binary_log" == true ]]; then
|
|
|
|
bl="/bl:$log_dir/ToolsetRestore.binlog"
|
|
|
|
fi
|
2020-02-08 00:51:24 +00:00
|
|
|
|
2018-10-22 05:07:26 +00:00
|
|
|
echo '<Project Sdk="Microsoft.DotNet.Arcade.Sdk"/>' > "$proj"
|
2019-05-22 12:11:57 +00:00
|
|
|
MSBuild-Core "$proj" $bl /t:__WriteToolsetLocation /clp:ErrorsOnly\;NoSummary /p:__ToolsetLocationOutputFile="$toolset_location_file"
|
2018-10-22 05:07:26 +00:00
|
|
|
|
2018-12-19 20:55:42 +00:00
|
|
|
local toolset_build_proj=`cat "$toolset_location_file"`
|
2018-10-22 05:07:26 +00:00
|
|
|
|
|
|
|
if [[ ! -a "$toolset_build_proj" ]]; then
|
2019-11-22 13:41:58 +00:00
|
|
|
Write-PipelineTelemetryError -category 'Build' "Invalid toolset path: $toolset_build_proj"
|
2018-10-22 05:07:26 +00:00
|
|
|
ExitWithExitCode 3
|
|
|
|
fi
|
|
|
|
|
2018-12-19 20:55:42 +00:00
|
|
|
# return value
|
|
|
|
_InitializeToolset="$toolset_build_proj"
|
2018-10-22 05:07:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function ExitWithExitCode {
|
|
|
|
if [[ "$ci" == true && "$prepare_machine" == true ]]; then
|
|
|
|
StopProcesses
|
|
|
|
fi
|
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
|
|
|
function StopProcesses {
|
|
|
|
echo "Killing running build processes..."
|
2019-01-09 13:14:18 +00:00
|
|
|
pkill -9 "dotnet" || true
|
|
|
|
pkill -9 "vbcscompiler" || true
|
2018-10-22 05:07:26 +00:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
function MSBuild {
|
2019-05-24 12:12:50 +00:00
|
|
|
local args=$@
|
2019-05-22 12:11:57 +00:00
|
|
|
if [[ "$pipelines_log" == true ]]; then
|
|
|
|
InitializeBuildTool
|
|
|
|
InitializeToolset
|
2019-09-13 12:37:37 +00:00
|
|
|
|
|
|
|
if [[ "$ci" == true ]]; then
|
2019-10-24 22:05:36 +00:00
|
|
|
export NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS=20
|
|
|
|
export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20
|
|
|
|
Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20"
|
|
|
|
Write-PipelineSetVariable -name "NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS" -value "20"
|
2019-09-13 12:37:37 +00:00
|
|
|
fi
|
|
|
|
|
2019-05-24 12:12:50 +00:00
|
|
|
local toolset_dir="${_InitializeToolset%/*}"
|
2021-02-10 23:17:22 +00:00
|
|
|
# new scripts need to work with old packages, so we need to look for the old names/versions
|
|
|
|
local selectedPath=
|
|
|
|
local possiblePaths=()
|
|
|
|
possiblePaths+=( "$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.ArcadeLogging.dll" )
|
|
|
|
possiblePaths+=( "$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll" )
|
|
|
|
possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.ArcadeLogging.dll" )
|
|
|
|
possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.Arcade.Sdk.dll" )
|
2021-09-07 19:27:33 +00:00
|
|
|
possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.ArcadeLogging.dll" )
|
|
|
|
possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.Arcade.Sdk.dll" )
|
2023-01-18 10:18:03 +00:00
|
|
|
possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.ArcadeLogging.dll" )
|
|
|
|
possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.Arcade.Sdk.dll" )
|
2021-02-10 23:17:22 +00:00
|
|
|
for path in "${possiblePaths[@]}"; do
|
|
|
|
if [[ -f $path ]]; then
|
|
|
|
selectedPath=$path
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [[ -z "$selectedPath" ]]; then
|
|
|
|
Write-PipelineTelemetryError -category 'Build' "Unable to find arcade sdk logger assembly."
|
|
|
|
ExitWithExitCode 1
|
2021-01-09 13:53:15 +00:00
|
|
|
fi
|
2021-02-10 23:17:22 +00:00
|
|
|
args+=( "-logger:$selectedPath" )
|
2019-05-22 12:11:57 +00:00
|
|
|
fi
|
2019-05-24 12:12:50 +00:00
|
|
|
|
2019-05-22 12:11:57 +00:00
|
|
|
MSBuild-Core ${args[@]}
|
|
|
|
}
|
|
|
|
|
|
|
|
function MSBuild-Core {
|
2018-12-19 20:55:42 +00:00
|
|
|
if [[ "$ci" == true ]]; then
|
2020-05-12 12:48:04 +00:00
|
|
|
if [[ "$binary_log" != true && "$exclude_ci_binary_log" != true ]]; then
|
|
|
|
Write-PipelineTelemetryError -category 'Build' "Binary log must be enabled in CI build, or explicitly opted-out from with the -noBinaryLog switch."
|
2018-12-19 20:55:42 +00:00
|
|
|
ExitWithExitCode 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$node_reuse" == true ]]; then
|
2019-11-22 13:41:58 +00:00
|
|
|
Write-PipelineTelemetryError -category 'Build' "Node reuse must be disabled in CI build."
|
2018-12-19 20:55:42 +00:00
|
|
|
ExitWithExitCode 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
InitializeBuildTool
|
|
|
|
|
2018-10-22 05:07:26 +00:00
|
|
|
local warnaserror_switch=""
|
2018-12-19 20:55:42 +00:00
|
|
|
if [[ $warn_as_error == true ]]; then
|
2018-10-22 05:07:26 +00:00
|
|
|
warnaserror_switch="/warnaserror"
|
|
|
|
fi
|
|
|
|
|
2020-04-24 17:34:25 +00:00
|
|
|
function RunBuildTool {
|
|
|
|
export ARCADE_BUILD_TOOL_COMMAND="$_InitializeBuildTool $@"
|
|
|
|
|
|
|
|
"$_InitializeBuildTool" "$@" || {
|
|
|
|
local exit_code=$?
|
2020-12-09 03:11:38 +00:00
|
|
|
# We should not Write-PipelineTaskError here because that message shows up in the build summary
|
|
|
|
# The build already logged an error, that's the reason it failed. Producing an error here only adds noise.
|
|
|
|
echo "Build failed with exit code $exit_code. Check errors above."
|
2023-01-04 23:26:05 +00:00
|
|
|
|
|
|
|
# When running on Azure Pipelines, override the returned exit code to avoid double logging.
|
|
|
|
if [[ "$ci" == "true" && -n ${SYSTEM_TEAMPROJECT:-} ]]; then
|
2020-12-09 03:11:38 +00:00
|
|
|
Write-PipelineSetResult -result "Failed" -message "msbuild execution failed."
|
|
|
|
# Exiting with an exit code causes the azure pipelines task to log yet another "noise" error
|
|
|
|
# The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error
|
|
|
|
ExitWithExitCode 0
|
|
|
|
else
|
|
|
|
ExitWithExitCode $exit_code
|
|
|
|
fi
|
2020-04-24 17:34:25 +00:00
|
|
|
}
|
2019-01-09 13:14:18 +00:00
|
|
|
}
|
2020-04-24 17:34:25 +00:00
|
|
|
|
|
|
|
RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@"
|
2018-10-22 05:07:26 +00:00
|
|
|
}
|
|
|
|
|
2022-10-22 12:27:57 +00:00
|
|
|
function GetDarc {
|
|
|
|
darc_path="$temp_dir/darc"
|
|
|
|
version="$1"
|
|
|
|
|
|
|
|
if [[ -n "$version" ]]; then
|
|
|
|
version="--darcversion $version"
|
|
|
|
fi
|
|
|
|
|
|
|
|
"$eng_root/common/darc-init.sh" --toolpath "$darc_path" $version
|
|
|
|
}
|
|
|
|
|
2018-12-19 20:55:42 +00:00
|
|
|
ResolvePath "${BASH_SOURCE[0]}"
|
|
|
|
_script_dir=`dirname "$_ResolvePath"`
|
|
|
|
|
2019-06-22 12:29:08 +00:00
|
|
|
. "$_script_dir/pipeline-logging-functions.sh"
|
|
|
|
|
2018-12-19 20:55:42 +00:00
|
|
|
eng_root=`cd -P "$_script_dir/.." && pwd`
|
|
|
|
repo_root=`cd -P "$_script_dir/../.." && pwd`
|
2021-06-12 12:58:31 +00:00
|
|
|
repo_root="${repo_root}/"
|
|
|
|
artifacts_dir="${repo_root}artifacts"
|
2018-12-19 20:55:42 +00:00
|
|
|
toolset_dir="$artifacts_dir/toolset"
|
2021-06-12 12:58:31 +00:00
|
|
|
tools_dir="${repo_root}.tools"
|
2018-12-19 20:55:42 +00:00
|
|
|
log_dir="$artifacts_dir/log/$configuration"
|
|
|
|
temp_dir="$artifacts_dir/tmp/$configuration"
|
|
|
|
|
2021-06-12 12:58:31 +00:00
|
|
|
global_json_file="${repo_root}global.json"
|
2019-05-07 12:30:40 +00:00
|
|
|
# determine if global.json contains a "runtimes" entry
|
|
|
|
global_json_has_runtimes=false
|
2021-01-09 13:53:15 +00:00
|
|
|
if command -v jq &> /dev/null; then
|
2022-11-30 16:23:50 +00:00
|
|
|
if jq -e '.tools | has("runtimes")' "$global_json_file" &> /dev/null; then
|
2021-01-09 13:53:15 +00:00
|
|
|
global_json_has_runtimes=true
|
|
|
|
fi
|
|
|
|
elif [[ "$(cat "$global_json_file")" =~ \"runtimes\"[[:space:]\:]*\{ ]]; then
|
2019-05-07 12:30:40 +00:00
|
|
|
global_json_has_runtimes=true
|
|
|
|
fi
|
2018-12-19 20:55:42 +00:00
|
|
|
|
2018-10-22 05:07:26 +00:00
|
|
|
# HOME may not be defined in some scenarios, but it is required by NuGet
|
|
|
|
if [[ -z $HOME ]]; then
|
2021-06-12 12:58:31 +00:00
|
|
|
export HOME="${repo_root}artifacts/.home/"
|
2018-10-22 05:07:26 +00:00
|
|
|
mkdir -p "$HOME"
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "$toolset_dir"
|
2018-12-19 20:55:42 +00:00
|
|
|
mkdir -p "$temp_dir"
|
2018-10-22 05:07:26 +00:00
|
|
|
mkdir -p "$log_dir"
|
|
|
|
|
2019-07-19 12:39:46 +00:00
|
|
|
Write-PipelineSetVariable -name "Artifacts" -value "$artifacts_dir"
|
|
|
|
Write-PipelineSetVariable -name "Artifacts.Toolset" -value "$toolset_dir"
|
|
|
|
Write-PipelineSetVariable -name "Artifacts.Log" -value "$log_dir"
|
|
|
|
Write-PipelineSetVariable -name "Temp" -value "$temp_dir"
|
|
|
|
Write-PipelineSetVariable -name "TMP" -value "$temp_dir"
|
2019-10-24 22:05:36 +00:00
|
|
|
|
|
|
|
# Import custom tools configuration, if present in the repo.
|
2019-11-22 13:41:58 +00:00
|
|
|
if [ -z "${disable_configure_toolset_import:-}" ]; then
|
2019-10-24 22:05:36 +00:00
|
|
|
configure_toolset_script="$eng_root/configure-toolset.sh"
|
|
|
|
if [[ -a "$configure_toolset_script" ]]; then
|
|
|
|
. "$configure_toolset_script"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# TODO: https://github.com/dotnet/arcade/issues/1468
|
|
|
|
# Temporary workaround to avoid breaking change.
|
|
|
|
# Remove once repos are updated.
|
|
|
|
if [[ -n "${useInstalledDotNetCli:-}" ]]; then
|
|
|
|
use_installed_dotnet_cli="$useInstalledDotNetCli"
|
|
|
|
fi
|