From 44eeecae85dc1aae6ecd9d81e18088238d91e640 Mon Sep 17 00:00:00 2001 From: Smit Patel Date: Wed, 7 Jun 2017 16:05:25 -0700 Subject: [PATCH] Make binary logging conditional Set $env:KOREBUILD_ENABLE_BINARY_LOG=1 to enable logging --- build/KoreBuild.ps1 | 11 +++++++++-- build/KoreBuild.sh | 10 ++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/build/KoreBuild.ps1 b/build/KoreBuild.ps1 index 851325b..d6b82d9 100644 --- a/build/KoreBuild.ps1 +++ b/build/KoreBuild.ps1 @@ -119,15 +119,22 @@ if (!($env:Path.Split(';') -icontains $dotnetLocalInstallFolder)) $makeFileProj = "$PSScriptRoot/KoreBuild.proj" $msbuildArtifactsDir = "$repoFolder/artifacts/msbuild" -$msbuildLogFilePath = "$msbuildArtifactsDir/msbuild.binlog" $msBuildResponseFile = "$msbuildArtifactsDir/msbuild.rsp" +$msBuildLogArgument = "" + +if ($env:KOREBUILD_ENABLE_BINARY_LOG -eq "1") +{ + Write-Host "Enabling binary logging because KOREBUILD_ENABLE_BINARY_LOG = 1" + $msbuildLogFilePath = "$msbuildArtifactsDir/msbuild.binlog" + $msBuildLogArgument = "/bl:$msbuildLogFilePath" +} $msBuildArguments = @" /nologo /m /p:RepositoryRoot="$repoFolder/" -/bl:"$msbuildLogFilePath" +"$msBuildLogArgument" /clp:Summary "$makeFileProj" "@ diff --git a/build/KoreBuild.sh b/build/KoreBuild.sh index e6d8dc4..bece042 100755 --- a/build/KoreBuild.sh +++ b/build/KoreBuild.sh @@ -152,7 +152,13 @@ export ReferenceAssemblyRoot=$NUGET_PACKAGES/netframeworkreferenceassemblies/$ne makeFileProj="$scriptRoot/KoreBuild.proj" msbuildArtifactsDir="$repoFolder/artifacts/msbuild" msbuildResponseFile="$msbuildArtifactsDir/msbuild.rsp" -msbuildLogFile="$msbuildArtifactsDir/msbuild.binlog" +msBuildLogArgument="" + +if [ ! -z "$KOREBUILD_ENABLE_BINARY_LOG" ]; then + echo "Enabling binary logging because KOREBUILD_ENABLE_BINARY_LOG is set" + msBuildLogFile="$msbuildArtifactsDir/msbuild.binlog" + msBuildLogArgument="/bl:$msBuildLogFile" +fi if [ ! -f $msbuildArtifactsDir ]; then mkdir -p $msbuildArtifactsDir @@ -162,7 +168,7 @@ cat > $msbuildResponseFile <