From 568496057d1f2dfa46af4f8a4df8657420b63523 Mon Sep 17 00:00:00 2001 From: Will Godbe Date: Tue, 5 May 2020 13:11:54 -0700 Subject: [PATCH 1/7] Add -NoBinaryLog switch to opt-out of binlog in CI --- eng/common/build.ps1 | 6 +++++- eng/common/build.sh | 9 ++++++++- eng/common/tools.ps1 | 13 ++++++++++--- eng/common/tools.sh | 13 ++++++++++--- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 813d440d2a8..54f9cd36c44 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -20,6 +20,7 @@ Param( [switch] $publish, [switch] $clean, [switch][Alias('bl')]$binaryLog, + [switch][Alias('nobl')]$noBinaryLog, [switch] $ci, [switch] $prepareMachine, [switch] $help, @@ -58,6 +59,7 @@ function Print-Usage() { Write-Host "Advanced settings:" Write-Host " -projects Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)" Write-Host " -ci Set when running on CI server" + Write-Host " -noBinaryLog Don't output binary log (useful when running on CI server) (short: -nobl)" Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" Write-Host " -warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." @@ -134,7 +136,9 @@ try { } if ($ci) { - $binaryLog = $true + if (-not $noBinaryLog) { + $binaryLog = $true + } $nodeReuse = $false } diff --git a/eng/common/build.sh b/eng/common/build.sh index 36f9aa0462e..3c8aeb14ace 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -32,6 +32,7 @@ usage() echo "Advanced settings:" echo " --projects Project or solution file(s) to build" echo " --ci Set when running on CI server" + echo " --noBinaryLog Don't output binary log (useful when running on CI server) (short: -nobl)" echo " --prepareMachine Prepare machine for CI run, clean up processes after build" echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" @@ -68,6 +69,7 @@ clean=false warn_as_error=true node_reuse=true binary_log=false +no_binary_log=false pipelines_log=false projects='' @@ -98,6 +100,9 @@ while [[ $# > 0 ]]; do -binarylog|-bl) binary_log=true ;; + -noBinarylog|-nobl) + no_binary_log=true + ;; -pipelineslog|-pl) pipelines_log=true ;; @@ -156,8 +161,10 @@ done if [[ "$ci" == true ]]; then pipelines_log=true - binary_log=true node_reuse=false + if [[ "$binary_log=false" ]]; then + binary_log=true + fi fi . "$scriptroot/tools.sh" diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index f31377a6be5..5ebe0efb4eb 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -8,9 +8,16 @@ [string]$configuration = if (Test-Path variable:configuration) { $configuration } else { 'Debug' } # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. -# Binary log must be enabled on CI. [bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci } +# Set to true to opt out of outputing binary log while running in CI +[bool]$noBinaryLog = if (Test-Path variable:noBinaryLog) { $noBinaryLog } else { $false } + +# Correct the value of $binaryLog if the user wants to opt out while running in CI +if ($ci -and $noBinaryLog) { + $binaryLog = $false +} + # 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 @@ -605,8 +612,8 @@ function MSBuild() { # function MSBuild-Core() { if ($ci) { - if (!$binaryLog) { - Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build.' + if (!$binaryLog -and !$noBinaryLog) { + Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build, or explicitly opted-out from with the -noBinaryLog switch.' ExitWithExitCode 1 } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index a9dff4408c2..c4db20895d1 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -19,9 +19,16 @@ fi configuration=${configuration:-'Debug'} # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. -# Binary log must be enabled on CI. binary_log=${binary_log:-$ci} +# Set to true to opt out of outputing binary log while running in CI +no_binary_log=${no_binary_log:-false} + +# Correct the value of $binaryLog if the user wants to opt out while running in CI +if [[ "$ci" == true && "$no_binary_log" == true ]]; then + binary_log=false +} + # Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes). prepare_machine=${prepare_machine:-false} @@ -404,8 +411,8 @@ function MSBuild { function MSBuild-Core { if [[ "$ci" == true ]]; then - if [[ "$binary_log" != true ]]; then - Write-PipelineTelemetryError -category 'Build' "Binary log must be enabled in CI build." + if [[ "$binary_log" != true && "$no_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." ExitWithExitCode 1 fi From 7dfbda9128c5894e9239c5897837e08af30a0fee Mon Sep 17 00:00:00 2001 From: Will Godbe Date: Wed, 6 May 2020 11:06:09 -0700 Subject: [PATCH 2/7] respond to feedback --- eng/common/build.ps1 | 2 +- eng/common/build.sh | 4 ++-- eng/common/tools.ps1 | 11 +++-------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 54f9cd36c44..4242bdb58e7 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -59,7 +59,7 @@ function Print-Usage() { Write-Host "Advanced settings:" Write-Host " -projects Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)" Write-Host " -ci Set when running on CI server" - Write-Host " -noBinaryLog Don't output binary log (useful when running on CI server) (short: -nobl)" + Write-Host " -noBinaryLog Don't output binary log (short: -nobl)" Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" Write-Host " -warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." diff --git a/eng/common/build.sh b/eng/common/build.sh index 3c8aeb14ace..94d33f7cc6e 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -32,7 +32,7 @@ usage() echo "Advanced settings:" echo " --projects Project or solution file(s) to build" echo " --ci Set when running on CI server" - echo " --noBinaryLog Don't output binary log (useful when running on CI server) (short: -nobl)" + echo " --noBinaryLog Don't output binary log" echo " --prepareMachine Prepare machine for CI run, clean up processes after build" echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" @@ -162,7 +162,7 @@ done if [[ "$ci" == true ]]; then pipelines_log=true node_reuse=false - if [[ "$binary_log=false" ]]; then + if [[ "$binary_log" == false ]]; then binary_log=true fi fi diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 5ebe0efb4eb..42f1cbce463 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -7,16 +7,11 @@ # Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names. [string]$configuration = if (Test-Path variable:configuration) { $configuration } else { 'Debug' } -# Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. -[bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci } - -# Set to true to opt out of outputing binary log while running in CI +# Set to true to opt out of outputting binary log while running in CI [bool]$noBinaryLog = if (Test-Path variable:noBinaryLog) { $noBinaryLog } else { $false } -# Correct the value of $binaryLog if the user wants to opt out while running in CI -if ($ci -and $noBinaryLog) { - $binaryLog = $false -} +# Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. +[bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci -and !$noBinaryLog } # 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 From cf5eefb50f6873f5c615bd338f1198152a5cf209 Mon Sep 17 00:00:00 2001 From: Will Godbe Date: Wed, 6 May 2020 11:22:33 -0700 Subject: [PATCH 3/7] Fixup --- eng/common/build.sh | 2 +- eng/common/tools.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/common/build.sh b/eng/common/build.sh index 94d33f7cc6e..6ca661d98a2 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -162,7 +162,7 @@ done if [[ "$ci" == true ]]; then pipelines_log=true node_reuse=false - if [[ "$binary_log" == false ]]; then + if [[ "$no_binary_log" == false ]]; then binary_log=true fi fi diff --git a/eng/common/tools.sh b/eng/common/tools.sh index c4db20895d1..1d8f2b89e6c 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -21,13 +21,13 @@ configuration=${configuration:-'Debug'} # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. binary_log=${binary_log:-$ci} -# Set to true to opt out of outputing binary log while running in CI +# Set to true to opt out of outputting binary log while running in CI no_binary_log=${no_binary_log:-false} # Correct the value of $binaryLog if the user wants to opt out while running in CI if [[ "$ci" == true && "$no_binary_log" == true ]]; then binary_log=false -} +fi # Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes). prepare_machine=${prepare_machine:-false} From 36feef5d65b9b2c4da57d60f8aed5fa7321fafa2 Mon Sep 17 00:00:00 2001 From: Will Godbe Date: Thu, 7 May 2020 12:26:51 -0700 Subject: [PATCH 4/7] Respond to feedback --- eng/common/build.ps1 | 6 +++--- eng/common/build.sh | 10 +++++----- eng/common/tools.ps1 | 8 ++++---- eng/common/tools.sh | 12 ++++++------ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 4242bdb58e7..18f32ba0e1d 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -20,7 +20,7 @@ Param( [switch] $publish, [switch] $clean, [switch][Alias('bl')]$binaryLog, - [switch][Alias('nobl')]$noBinaryLog, + [switch][Alias('nobl')]$noCIBinaryLog, [switch] $ci, [switch] $prepareMachine, [switch] $help, @@ -59,7 +59,7 @@ function Print-Usage() { Write-Host "Advanced settings:" Write-Host " -projects Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)" Write-Host " -ci Set when running on CI server" - Write-Host " -noBinaryLog Don't output binary log (short: -nobl)" + Write-Host " -noCIBinaryLog Don't output binary log (short: -nobl)" Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" Write-Host " -warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." @@ -136,7 +136,7 @@ try { } if ($ci) { - if (-not $noBinaryLog) { + if (-not $noCIBinaryLog) { $binaryLog = $true } $nodeReuse = $false diff --git a/eng/common/build.sh b/eng/common/build.sh index 6ca661d98a2..d97cd4e77bd 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -32,7 +32,7 @@ usage() echo "Advanced settings:" echo " --projects Project or solution file(s) to build" echo " --ci Set when running on CI server" - echo " --noBinaryLog Don't output binary log" + echo " --noCIBinaryLog Don't output binary log (short: -nobl)" echo " --prepareMachine Prepare machine for CI run, clean up processes after build" echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" @@ -69,7 +69,7 @@ clean=false warn_as_error=true node_reuse=true binary_log=false -no_binary_log=false +no_ci_binary_log=false pipelines_log=false projects='' @@ -100,8 +100,8 @@ while [[ $# > 0 ]]; do -binarylog|-bl) binary_log=true ;; - -noBinarylog|-nobl) - no_binary_log=true + -noCIBinarylog|-nobl) + no_ci_binary_log=true ;; -pipelineslog|-pl) pipelines_log=true @@ -162,7 +162,7 @@ done if [[ "$ci" == true ]]; then pipelines_log=true node_reuse=false - if [[ "$no_binary_log" == false ]]; then + if [[ "$no_ci_binary_log" == false ]]; then binary_log=true fi fi diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 42f1cbce463..a750dc6928f 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -8,10 +8,10 @@ [string]$configuration = if (Test-Path variable:configuration) { $configuration } else { 'Debug' } # Set to true to opt out of outputting binary log while running in CI -[bool]$noBinaryLog = if (Test-Path variable:noBinaryLog) { $noBinaryLog } else { $false } +[bool]$noCIBinaryLog = if (Test-Path variable:noCIBinaryLog) { $noCIBinaryLog } else { $false } # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. -[bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci -and !$noBinaryLog } +[bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci -and !$noCIBinaryLog } # 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 @@ -607,8 +607,8 @@ function MSBuild() { # function MSBuild-Core() { if ($ci) { - if (!$binaryLog -and !$noBinaryLog) { - Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build, or explicitly opted-out from with the -noBinaryLog switch.' + if (!$binaryLog -and !$noCIBinaryLog) { + Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build, or explicitly opted-out from with the -noCIBinaryLog switch.' ExitWithExitCode 1 } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 1d8f2b89e6c..b5750f836d7 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -18,14 +18,14 @@ fi # Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names. configuration=${configuration:-'Debug'} -# Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. -binary_log=${binary_log:-$ci} - # Set to true to opt out of outputting binary log while running in CI -no_binary_log=${no_binary_log:-false} +no_ci_binary_log=${no_ci_binary_log:-false} + +# Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. +binary_log=${binary_log:-$ci && -n $no_ci_binary_log} # Correct the value of $binaryLog if the user wants to opt out while running in CI -if [[ "$ci" == true && "$no_binary_log" == true ]]; then +if [[ "$ci" == true && "$no_ci_binary_log" == true ]]; then binary_log=false fi @@ -411,7 +411,7 @@ function MSBuild { function MSBuild-Core { if [[ "$ci" == true ]]; then - if [[ "$binary_log" != true && "$no_binary_log" != true ]]; then + if [[ "$binary_log" != true && "$no_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." ExitWithExitCode 1 fi From 9c04562a295817c4bebaec2a4d29e287dda789a2 Mon Sep 17 00:00:00 2001 From: Will Godbe Date: Thu, 7 May 2020 12:27:31 -0700 Subject: [PATCH 5/7] One more fixup --- eng/common/tools.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/eng/common/tools.sh b/eng/common/tools.sh index b5750f836d7..4821c4649f1 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -24,11 +24,6 @@ no_ci_binary_log=${no_ci_binary_log:-false} # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. binary_log=${binary_log:-$ci && -n $no_ci_binary_log} -# Correct the value of $binaryLog if the user wants to opt out while running in CI -if [[ "$ci" == true && "$no_ci_binary_log" == true ]]; then - binary_log=false -fi - # Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes). prepare_machine=${prepare_machine:-false} From 5e1277a7e4a017e02894934ddb1082d13641e661 Mon Sep 17 00:00:00 2001 From: Will Godbe Date: Thu, 7 May 2020 15:47:42 -0700 Subject: [PATCH 6/7] Change prop name --- eng/common/build.ps1 | 6 +++--- eng/common/build.sh | 10 +++++----- eng/common/tools.ps1 | 8 ++++---- eng/common/tools.sh | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 18f32ba0e1d..329572afa0f 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -20,7 +20,7 @@ Param( [switch] $publish, [switch] $clean, [switch][Alias('bl')]$binaryLog, - [switch][Alias('nobl')]$noCIBinaryLog, + [switch][Alias('nobl')]$excludeCIBinlog, [switch] $ci, [switch] $prepareMachine, [switch] $help, @@ -59,7 +59,7 @@ function Print-Usage() { Write-Host "Advanced settings:" Write-Host " -projects Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)" Write-Host " -ci Set when running on CI server" - Write-Host " -noCIBinaryLog Don't output binary log (short: -nobl)" + Write-Host " -excludeCIBinlog Don't output binary log (short: -nobl)" Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" Write-Host " -warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." @@ -136,7 +136,7 @@ try { } if ($ci) { - if (-not $noCIBinaryLog) { + if (-not $excludeCIBinlog) { $binaryLog = $true } $nodeReuse = $false diff --git a/eng/common/build.sh b/eng/common/build.sh index d97cd4e77bd..b31180449c8 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -32,7 +32,7 @@ usage() echo "Advanced settings:" echo " --projects Project or solution file(s) to build" echo " --ci Set when running on CI server" - echo " --noCIBinaryLog Don't output binary log (short: -nobl)" + echo " --excludeCIBinlog Don't output binary log (short: -nobl)" echo " --prepareMachine Prepare machine for CI run, clean up processes after build" echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" @@ -69,7 +69,7 @@ clean=false warn_as_error=true node_reuse=true binary_log=false -no_ci_binary_log=false +exclude_ci_binary_log=false pipelines_log=false projects='' @@ -100,8 +100,8 @@ while [[ $# > 0 ]]; do -binarylog|-bl) binary_log=true ;; - -noCIBinarylog|-nobl) - no_ci_binary_log=true + -excludeCIBinlog|-nobl) + exclude_ci_binary_log=true ;; -pipelineslog|-pl) pipelines_log=true @@ -162,7 +162,7 @@ done if [[ "$ci" == true ]]; then pipelines_log=true node_reuse=false - if [[ "$no_ci_binary_log" == false ]]; then + if [[ "$exclude_ci_binary_log" == false ]]; then binary_log=true fi fi diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index a750dc6928f..d65d6b87b58 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -8,10 +8,10 @@ [string]$configuration = if (Test-Path variable:configuration) { $configuration } else { 'Debug' } # Set to true to opt out of outputting binary log while running in CI -[bool]$noCIBinaryLog = if (Test-Path variable:noCIBinaryLog) { $noCIBinaryLog } else { $false } +[bool]$excludeCIBinlog = if (Test-Path variable:excludeCIBinlog) { $excludeCIBinlog } else { $false } # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. -[bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci -and !$noCIBinaryLog } +[bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci -and !$excludeCIBinlog } # 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 @@ -607,8 +607,8 @@ function MSBuild() { # function MSBuild-Core() { if ($ci) { - if (!$binaryLog -and !$noCIBinaryLog) { - Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build, or explicitly opted-out from with the -noCIBinaryLog switch.' + if (!$binaryLog -and !$excludeCIBinlog) { + Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build, or explicitly opted-out from with the -excludeCIBinlog switch.' ExitWithExitCode 1 } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 4821c4649f1..72ff6326539 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -19,10 +19,10 @@ fi configuration=${configuration:-'Debug'} # Set to true to opt out of outputting binary log while running in CI -no_ci_binary_log=${no_ci_binary_log:-false} +exclude_ci_binary_log=${exclude_ci_binary_log:-false} # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. -binary_log=${binary_log:-$ci && -n $no_ci_binary_log} +binary_log=${binary_log:-$ci && -n $exclude_ci_binary_log} # Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes). prepare_machine=${prepare_machine:-false} @@ -406,7 +406,7 @@ function MSBuild { function MSBuild-Core { if [[ "$ci" == true ]]; then - if [[ "$binary_log" != true && "$no_ci_binary_log" != true ]]; then + 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." ExitWithExitCode 1 fi From b539815e5e503d0e2e3dc36cbcf5dc2a1e81dd1e Mon Sep 17 00:00:00 2001 From: Will Godbe Date: Fri, 8 May 2020 10:37:48 -0700 Subject: [PATCH 7/7] Fixup .sh, fix syntax --- eng/common/build.ps1 | 6 +++--- eng/common/build.sh | 4 ++-- eng/common/tools.ps1 | 8 ++++---- eng/common/tools.sh | 8 +++++++- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 329572afa0f..67ee6d28d3f 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -20,7 +20,7 @@ Param( [switch] $publish, [switch] $clean, [switch][Alias('bl')]$binaryLog, - [switch][Alias('nobl')]$excludeCIBinlog, + [switch][Alias('nobl')]$excludeCIBinarylog, [switch] $ci, [switch] $prepareMachine, [switch] $help, @@ -59,7 +59,7 @@ function Print-Usage() { Write-Host "Advanced settings:" Write-Host " -projects Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)" Write-Host " -ci Set when running on CI server" - Write-Host " -excludeCIBinlog Don't output binary log (short: -nobl)" + Write-Host " -excludeCIBinarylog Don't output binary log (short: -nobl)" Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" Write-Host " -warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." @@ -136,7 +136,7 @@ try { } if ($ci) { - if (-not $excludeCIBinlog) { + if (-not $excludeCIBinarylog) { $binaryLog = $true } $nodeReuse = $false diff --git a/eng/common/build.sh b/eng/common/build.sh index b31180449c8..6d7c5a1f69c 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -32,7 +32,7 @@ usage() echo "Advanced settings:" echo " --projects Project or solution file(s) to build" echo " --ci Set when running on CI server" - echo " --excludeCIBinlog Don't output binary log (short: -nobl)" + echo " --excludeCIBinarylog Don't output binary log (short: -nobl)" echo " --prepareMachine Prepare machine for CI run, clean up processes after build" echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" @@ -100,7 +100,7 @@ while [[ $# > 0 ]]; do -binarylog|-bl) binary_log=true ;; - -excludeCIBinlog|-nobl) + -excludeCIBinarylog|-nobl) exclude_ci_binary_log=true ;; -pipelineslog|-pl) diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index d65d6b87b58..d504da64857 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -8,10 +8,10 @@ [string]$configuration = if (Test-Path variable:configuration) { $configuration } else { 'Debug' } # Set to true to opt out of outputting binary log while running in CI -[bool]$excludeCIBinlog = if (Test-Path variable:excludeCIBinlog) { $excludeCIBinlog } else { $false } +[bool]$excludeCIBinarylog = if (Test-Path variable:excludeCIBinarylog) { $excludeCIBinarylog } else { $false } # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. -[bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci -and !$excludeCIBinlog } +[bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci -and !$excludeCIBinarylog } # 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 @@ -607,8 +607,8 @@ function MSBuild() { # function MSBuild-Core() { if ($ci) { - if (!$binaryLog -and !$excludeCIBinlog) { - Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build, or explicitly opted-out from with the -excludeCIBinlog switch.' + if (!$binaryLog -and !$excludeCIBinarylog) { + Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build, or explicitly opted-out from with the -excludeCIBinarylog switch.' ExitWithExitCode 1 } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 72ff6326539..e94fce22ec3 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -21,8 +21,14 @@ configuration=${configuration:-'Debug'} # 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 + # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. -binary_log=${binary_log:-$ci && -n $exclude_ci_binary_log} +binary_log=${binary_log:-$binary_log_default} # Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes). prepare_machine=${prepare_machine:-false}