diff --git a/NuGet.config b/NuGet.config index d12badea78..94e12ce1b4 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,14 +2,12 @@ - + - - diff --git a/build.ps1 b/build.ps1 index 0ac6c0627a..37f57517bf 100644 --- a/build.ps1 +++ b/build.ps1 @@ -253,9 +253,7 @@ $RunRestore = if ($NoRestore) { $false } # Target selection $MSBuildArguments += "/p:Restore=$RunRestore" $MSBuildArguments += "/p:Build=$RunBuild" -if (-not $RunBuild) { - $MSBuildArguments += "/p:NoBuild=true" -} +if (-not $RunBuild) { $MSBuildArguments += "/p:NoBuild=true" } $MSBuildArguments += "/p:Pack=$Pack" $MSBuildArguments += "/p:Test=$Test" $MSBuildArguments += "/p:Sign=$Sign" @@ -364,18 +362,20 @@ Remove-Item variable:global:_MSBuildExe -ea Ignore # Import Arcade . "$PSScriptRoot/eng/common/tools.ps1" +# Add default .binlog location if not already on the command line. tools.ps1 does not handle this; it just checks +# $BinaryLog, $CI and $ExcludeCIBinarylog values for an error case. But tools.ps1 provides a nice function to help. +if ($BinaryLog) { + $bl = GetMSBuildBinaryLogCommandLineArgument($MSBuildArguments) + if (-not $bl) { + $MSBuildArguments += "/bl:" + (Join-Path $LogDir "Build.binlog") + } +} + # Capture MSBuild crash logs $env:MSBUILDDEBUGPATH = $LogDir $local:exit_code = $null try { - # Import custom tools configuration, if present in the repo. - # Note: Import in global scope so that the script set top-level variables without qualification. - $configureToolsetScript = Join-Path $EngRoot "configure-toolset.ps1" - if (Test-Path $configureToolsetScript) { - . $configureToolsetScript - } - # Set this global property so Arcade will always initialize the toolset. The error message you get when you build on a clean machine # with -norestore is not obvious about what to do to fix it. As initialization takes very little time, we think always initializing # the toolset is a better default behavior. diff --git a/build.sh b/build.sh index 97c3750bc7..cdc6ad3188 100755 --- a/build.sh +++ b/build.sh @@ -288,10 +288,6 @@ if [ -z "$configuration" ]; then fi msbuild_args[${#msbuild_args[*]}]="-p:Configuration=$configuration" -# Set verbosity -echo "Setting msbuild verbosity to $verbosity" -msbuild_args[${#msbuild_args[*]}]="-verbosity:$verbosity" - # Set up additional runtime args toolset_build_args=() if [ ! -z "$dotnet_runtime_source_feed$dotnet_runtime_source_feed_key" ]; then @@ -328,15 +324,25 @@ fi # Import Arcade . "$DIR/eng/common/tools.sh" +# Add default .binlog location if not already on the command line. tools.sh does not handle this; it just checks +# $binary_log, $ci and $exclude_ci_binary_log values for an error case. +if [[ "$binary_log" == true ]]; then + found=false + for arg in "${msbuild_args[@]}"; do + opt="$(echo "${arg/#--/-}" | awk '{print tolower($0)}')" + if [[ "$opt" == [-/]bl:* || "$opt" == [-/]binarylogger:* ]]; then + found=true + break + fi + done + if [[ "$found" == false ]]; then + msbuild_args[${#msbuild_args[*]}]="/bl:$log_dir/Build.binlog" + fi +fi + # Capture MSBuild crash logs export MSBUILDDEBUGPATH="$log_dir" -# Import custom tools configuration, if present in the repo. -configure_toolset_script="$eng_root/configure-toolset.sh" -if [[ -a "$configure_toolset_script" ]]; then - . "$configure_toolset_script" -fi - # Set this global property so Arcade will always initialize the toolset. The error message you get when you build on a clean machine # with -norestore is not obvious about what to do to fix it. As initialization takes very little time, we think always initializing # the toolset is a better default behavior.