Skip to content

Commit

Permalink
MonoAOTCompilerTask: Don't check for temp file if cache is disabled (#…
Browse files Browse the repository at this point in the history
…71411)

* MonoAOTCompilerTask: Don't check for temp file if cache is disabled

Prompted by #70851 (comment)

* Emit a message when deleting tmp files
  • Loading branch information
radical authored Jun 29, 2022
1 parent c36e26d commit c755dcc
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/tasks/AotCompilerTask/MonoAOTCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -936,12 +936,6 @@ private bool PrecompileLibrary(PrecompileArguments args)
bool copied = false;
foreach (var proxyFile in args.ProxyFiles)
{
if (!File.Exists(proxyFile.TempFile))
{
Log.LogError($"Precompile command succeeded, but can't find the expected temporary output file - {proxyFile.TempFile} for {assembly}.{Environment.NewLine}{output}");
return false;
}

copied |= proxyFile.CopyOutputFileIfChanged();
_fileWrites.Add(proxyFile.TargetFile);
}
Expand Down Expand Up @@ -1225,11 +1219,11 @@ public bool CopyOutputFileIfChanged()
if (!_cache.Enabled)
return true;

if (!File.Exists(TempFile))
throw new LogAsErrorException($"Could not find the temporary file {TempFile} for target file {TargetFile}. Look for any errors/warnings generated earlier in the build.");

try
{
if (!File.Exists(TempFile))
throw new LogAsErrorException($"Could not find the temporary file {TempFile} for target file {TargetFile}. Look for any errors/warnings generated earlier in the build.");

if (!_cache.ShouldCopy(this, out string? cause))
{
_cache.Log.LogMessage(MessageImportance.Low, $"Skipping copying over {TargetFile} as the contents are unchanged");
Expand All @@ -1246,6 +1240,7 @@ public bool CopyOutputFileIfChanged()
}
finally
{
_cache.Log.LogMessage(MessageImportance.Low, $"Deleting temp file {TempFile}");
File.Delete(TempFile);
}
}
Expand Down

0 comments on commit c755dcc

Please sign in to comment.