Skip to content

Commit c755dcc

Browse files
authored
MonoAOTCompilerTask: Don't check for temp file if cache is disabled (#71411)
* MonoAOTCompilerTask: Don't check for temp file if cache is disabled Prompted by #70851 (comment) * Emit a message when deleting tmp files
1 parent c36e26d commit c755dcc

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/tasks/AotCompilerTask/MonoAOTCompiler.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -936,12 +936,6 @@ private bool PrecompileLibrary(PrecompileArguments args)
936936
bool copied = false;
937937
foreach (var proxyFile in args.ProxyFiles)
938938
{
939-
if (!File.Exists(proxyFile.TempFile))
940-
{
941-
Log.LogError($"Precompile command succeeded, but can't find the expected temporary output file - {proxyFile.TempFile} for {assembly}.{Environment.NewLine}{output}");
942-
return false;
943-
}
944-
945939
copied |= proxyFile.CopyOutputFileIfChanged();
946940
_fileWrites.Add(proxyFile.TargetFile);
947941
}
@@ -1225,11 +1219,11 @@ public bool CopyOutputFileIfChanged()
12251219
if (!_cache.Enabled)
12261220
return true;
12271221

1222+
if (!File.Exists(TempFile))
1223+
throw new LogAsErrorException($"Could not find the temporary file {TempFile} for target file {TargetFile}. Look for any errors/warnings generated earlier in the build.");
1224+
12281225
try
12291226
{
1230-
if (!File.Exists(TempFile))
1231-
throw new LogAsErrorException($"Could not find the temporary file {TempFile} for target file {TargetFile}. Look for any errors/warnings generated earlier in the build.");
1232-
12331227
if (!_cache.ShouldCopy(this, out string? cause))
12341228
{
12351229
_cache.Log.LogMessage(MessageImportance.Low, $"Skipping copying over {TargetFile} as the contents are unchanged");
@@ -1246,6 +1240,7 @@ public bool CopyOutputFileIfChanged()
12461240
}
12471241
finally
12481242
{
1243+
_cache.Log.LogMessage(MessageImportance.Low, $"Deleting temp file {TempFile}");
12491244
File.Delete(TempFile);
12501245
}
12511246
}

0 commit comments

Comments
 (0)