Browse Source

CompileAvaloniaXamlTask - handle no-pdb compilations (#15509)

* CompileAvaloniaXamlTask - handle no-pdb compilations

* handle PDBs separately
release/11.1.0-rc1
Lubomir Tetak 2 years ago
committed by Max Katz
parent
commit
f9a90231a3
  1. 14
      src/Avalonia.Build.Tasks/CompileAvaloniaXamlTask.cs

14
src/Avalonia.Build.Tasks/CompileAvaloniaXamlTask.cs

@ -38,7 +38,7 @@ namespace Avalonia.Build.Tasks
{
// To simplify incremental build checks, copy the input files to the expected output locations even if the Xaml compiler didn't do anything.
CopyAndTouch(AssemblyFile.ItemSpec, outputPath);
CopyAndTouch(Path.ChangeExtension(AssemblyFile.ItemSpec, ".pdb"), Path.ChangeExtension(outputPath, ".pdb"));
CopyAndTouch(Path.ChangeExtension(AssemblyFile.ItemSpec, ".pdb"), Path.ChangeExtension(outputPath, ".pdb"), false);
if (!string.IsNullOrEmpty(refOutputPath))
{
@ -49,8 +49,18 @@ namespace Avalonia.Build.Tasks
return res.Success;
}
private static void CopyAndTouch(string source, string destination)
private static void CopyAndTouch(string source, string destination, bool shouldExist = true)
{
if (!File.Exists(source))
{
if (shouldExist)
{
throw new FileNotFoundException($"Could not copy file '{source}'. File does not exist.");
}
return;
}
File.Copy(source, destination, overwrite: true);
File.SetLastWriteTimeUtc(destination, DateTime.UtcNow);
}

Loading…
Cancel
Save