From 0bd5969a900d7859d5624610db7f118dceb287b8 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sun, 20 Feb 2022 14:05:27 -0600
Subject: [PATCH 11/21] cirrus: make DebugInformationFormat=OldStyle for CI
 builds..

This is a hack to allow it to use an alternate setting, since the existing
setting precludes use of ccache/clcache.

Backtraces still seem to work fine.

ci-os-only: windows
---
 .cirrus.yml                      | 2 ++
 src/tools/msvc/MSBuildProject.pm | 9 ++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index ff8b138b9d1..02f04aa98bb 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -374,6 +374,8 @@ task:
     # -fileLoggerParameters1: write warnings to msbuild.warn.log.
     MSBFLAGS: -m -verbosity:minimal "-consoleLoggerParameters:Summary;ForceNoAlign" /p:TrackFileAccess=false -nologo -fileLoggerParameters1:warningsonly;logfile=msbuild.warn.log
 
+    DebugInformationFormat: OldStyle
+
     # If tests hang forever, cirrus eventually times out. In that case log
     # output etc is not uploaded, making the problem hard to debug. Of course
     # tests internally should have shorter timeouts, but that's proven to not
diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm
index f24d9e53482..264b98d1f68 100644
--- a/src/tools/msvc/MSBuildProject.pm
+++ b/src/tools/msvc/MSBuildProject.pm
@@ -81,13 +81,15 @@ EOF
   </PropertyGroup>
 EOF
 
+	my $debugformat = $ENV{'DebugInformationFormat'} || 'ProgramDatabase';
 	$self->WriteItemDefinitionGroup(
 		$f, 'Debug',
 		{
 			defs    => "_DEBUG;DEBUG=1",
 			opt     => 'Disabled',
 			strpool => 'false',
-			runtime => 'MultiThreadedDebugDLL'
+			runtime => 'MultiThreadedDebugDLL',
+			debugformat => $debugformat,
 		});
 	$self->WriteItemDefinitionGroup(
 		$f,
@@ -96,7 +98,8 @@ EOF
 			defs    => "",
 			opt     => 'Full',
 			strpool => 'true',
-			runtime => 'MultiThreadedDLL'
+			runtime => 'MultiThreadedDLL',
+			debugformat => $debugformat,
 		});
 	return;
 }
@@ -333,7 +336,7 @@ sub WriteItemDefinitionGroup
       <BrowseInformation>false</BrowseInformation>
       <WarningLevel>Level3</WarningLevel>
       <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <DebugInformationFormat>$p->{debugformat}</DebugInformationFormat>
       <CompileAs>Default</CompileAs>
     </ClCompile>
     <Link>
-- 
2.17.1

