Browse Source

CompileAvaloniaXamlTask - handle no-pdb compilations (#15509)

* CompileAvaloniaXamlTask - handle no-pdb compilations

* handle PDBs separately
pull/15588/head
Lubomir Tetak 2 years ago
committed by GitHub
parent
commit
d1d6e4fe8e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  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. // 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(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)) if (!string.IsNullOrEmpty(refOutputPath))
{ {
@ -49,8 +49,18 @@ namespace Avalonia.Build.Tasks
return res.Success; 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.Copy(source, destination, overwrite: true);
File.SetLastWriteTimeUtc(destination, DateTime.UtcNow); File.SetLastWriteTimeUtc(destination, DateTime.UtcNow);
} }

Loading…
Cancel
Save