Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dotnet/targets/Xamarin.Shared.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,7 @@
<FindAotCompiler
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' And '$(_RunAotCompiler)' == 'true'"
KeepTemporaryOutput="$(FindAotCompilerKeepKeepTemporaryOutput)"
MonoAotCrossCompiler="@(MonoAotCrossCompiler)"
RuntimeIdentifier="$(RuntimeIdentifier)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
Expand Down
18 changes: 16 additions & 2 deletions msbuild/Xamarin.MacDev.Tasks/Tasks/FindAotCompilerTaskBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public abstract class FindAotCompilerTaskBase : XamarinTask {
[Required]
public ITaskItem[] MonoAotCrossCompiler { get; set; }

public bool KeepTemporaryOutput { get; set; }

[Required]
public string RuntimeIdentifier { get; set; }

Expand Down Expand Up @@ -45,9 +47,12 @@ string ComputeAotCompilerPath ()
{
var projectPath = Path.GetTempFileName ();
var outputFile = Path.GetTempFileName ();
var binlog = Path.GetTempFileName ();

File.Delete (projectPath);
projectPath += ".csproj";
File.Delete (binlog);
binlog += ".binlog";
var csproj = $@"<?xml version=""1.0"" encoding=""utf-8""?>
<Project Sdk=""Microsoft.NET.Sdk"">
<PropertyGroup>
Expand All @@ -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<string, string>);
Expand All @@ -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);
}
}
}
}
Expand Down