From 60ddbcdbcbcf3b2051e7577916cec7ed2ea88c33 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 6 Sep 2022 17:15:11 +0200 Subject: [PATCH] [msbuild] Add support for keeping temporary output when looking for AOT compilers. --- dotnet/targets/Xamarin.Shared.Sdk.targets | 1 + .../Tasks/FindAotCompilerTaskBase.cs | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index 4fc1d1921b16..ba1d70d9016a 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -975,6 +975,7 @@ @@ -72,6 +77,7 @@ string ComputeAotCompilerPath () arguments.Add ("/p:OutputFilePath=" + outputFile); arguments.Add ("/p:RuntimeIdentifier=" + RuntimeIdentifier); arguments.Add ("/t:ComputeAotCompilerPath"); + arguments.Add ("/bl:" + binlog); arguments.Add (projectPath); var environment = default (Dictionary); @@ -85,8 +91,16 @@ string ComputeAotCompilerPath () ExecuteAsync (executable, arguments, environment: environment).Wait (); return File.ReadAllText (outputFile).Trim (); } finally { - File.Delete (projectPath); - File.Delete (outputFile); + if (KeepTemporaryOutput) { + Log.LogMessage (MessageImportance.Normal, "Temporary files for the FindAotCompiler task:"); + Log.LogMessage (MessageImportance.Normal, $" Project file: {projectPath}"); + Log.LogMessage (MessageImportance.Normal, $" Output file: {outputFile}"); + Log.LogMessage (MessageImportance.Normal, $" Binary log: {binlog}"); + } else { + File.Delete (projectPath); + File.Delete (outputFile); + File.Delete (binlog); + } } } }