Skip to content

Commit

Permalink
Filter non-xaml projects
Browse files Browse the repository at this point in the history
  • Loading branch information
rstm-sf committed Nov 5, 2021
1 parent 2c5f43b commit 6c34563
Showing 1 changed file with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,18 @@ private List<XamlFileInfo> ResolveReferenceXamlFileInfoCollection(
// ReSharper disable once InvertIf
if (TryResolvePreviewInfoCommonProjectReference(path, projectReadiesInner, out var xamlFileInfo))
{
xamlFileInfoCollection.Add(new XamlFileInfo
{
ProjectPath = xamlFileInfo.ProjectPath,
AvaloniaResource = xamlFileInfo.AvaloniaResource,
AvaloniaXaml = xamlFileInfo.AvaloniaXaml,
});
xamlFileInfoCollection.AddRange(xamlFileInfo.ReferenceXamlFileInfoCollection);
if (ShouldContainsAvaloniaXaml(xamlFileInfo))
xamlFileInfoCollection.Add(new XamlFileInfo
{
ProjectPath = xamlFileInfo.ProjectPath,
AvaloniaResource = xamlFileInfo.AvaloniaResource,
AvaloniaXaml = xamlFileInfo.AvaloniaXaml,
});

xamlFileInfoCollection.AddRange(
xamlFileInfo.ReferenceXamlFileInfoCollection
.Where(x =>
ShouldContainsAvaloniaXaml(x) || x.ReferenceXamlFileInfoCollection.Count > 0));

projectReadiesInner.Add(xamlFileInfo.ProjectPath);
projectReadiesInner.AddRange(xamlFileInfo.ReferenceXamlFileInfoCollection.Select(x => x.ProjectPath));
Expand Down Expand Up @@ -321,6 +326,9 @@ private void SendMessage(PreviewInfo previewInfo)
}
}

private static bool ShouldContainsAvaloniaXaml(XamlFileInfo value) =>
!(string.IsNullOrEmpty(value.AvaloniaResource) && string.IsNullOrEmpty(value.AvaloniaXaml));

// ReSharper disable once InconsistentNaming
private static PreviewInfo SelectPreviewInfoCommon(Dictionary<string, ITaskItem[]> targetOutputs) =>
new()
Expand Down

0 comments on commit 6c34563

Please sign in to comment.