-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Migrate AvaloniaNameSourceGenerator to IIncrementalGenerator #19216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+708
−484
Merged
Changes from 7 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
70d1638
Add AnalyzerProject.targets targets
maxkatz6 a049f4a
PrivateAssets on Workspaces.Common
maxkatz6 235f304
Migrate AvaloniaNameSourceGenerator to IIncrementalGenerator
maxkatz6 535ecc5
Remove outdated lins in the generator readme
maxkatz6 9cc2e1a
Add GlobPattern.ToString
maxkatz6 7bbd094
Fix tests
maxkatz6 9ac88c4
Formatting
maxkatz6 7164117
Redo pipeline, make steps more independent from each other, compilati…
maxkatz6 f1ebfd9
Split XAML parsing and type resolution into separated steps
maxkatz6 c513419
Restore CompilationReferencesComparer usage
maxkatz6 7f4f248
Revert "Restore CompilationReferencesComparer usage"
maxkatz6 21897d1
Split ResolvedNamesProvider pipeline step, process files in parallel
maxkatz6 11f882d
Add comment
maxkatz6 8b61dc2
Merge branch 'master' into update-generators
maxkatz6 31e401f
Switch back to EquatableList
maxkatz6 e8d7e2f
Add cancellation to the incremenetal source gen
maxkatz6 358f22f
Rethrow cancellation exception
maxkatz6 9d28762
Merge branch 'master' into update-generators
maxkatz6 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project> | ||
|
||
<PropertyGroup> | ||
<EnforceExtendedAnalyzerRules Condition="'$(EnforceExtendedAnalyzerRules)' == ''">true</EnforceExtendedAnalyzerRules> | ||
<IsRoslynComponent Condition="'$(IsRoslynComponent)' == ''">true</IsRoslynComponent> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all"/> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" PrivateAssets="all" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.5.0" PrivateAssets="all" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
using System; | ||
|
||
namespace Avalonia.Generators.Common.Domain; | ||
|
||
internal interface IGlobPattern | ||
internal interface IGlobPattern : IEquatable<IGlobPattern> | ||
{ | ||
bool Matches(string str); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Avalonia.Generators.Common; | ||
|
||
// https://github.com/dotnet/roslyn/blob/main/docs/features/incremental-generators.cookbook.md#pipeline-model-design | ||
internal class EquatableList<T> : List<T>, IEquatable<EquatableList<T>> | ||
{ | ||
public EquatableList(IEnumerable<T> collection) : base(collection) | ||
{ | ||
|
||
} | ||
|
||
public EquatableList() | ||
{ | ||
|
||
} | ||
|
||
public bool Equals(EquatableList<T>? other) | ||
{ | ||
// If the other list is null or a different size, they're not equal | ||
if (other is null || Count != other.Count) | ||
{ | ||
return false; | ||
} | ||
|
||
// Compare each pair of elements for equality | ||
for (int i = 0; i < Count; i++) | ||
{ | ||
if (!EqualityComparer<T>.Default.Equals(this[i], other[i])) | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
// If we got this far, the lists are equal | ||
return true; | ||
} | ||
public override bool Equals(object? obj) | ||
{ | ||
return Equals(obj as EquatableList<T>); | ||
} | ||
public override int GetHashCode() | ||
{ | ||
return this.Select(item => item?.GetHashCode() ?? 0).Aggregate(0, (x, y) => x ^ y); | ||
} | ||
public static bool operator ==(EquatableList<T>? list1, EquatableList<T>? list2) | ||
{ | ||
return ReferenceEquals(list1, list2) | ||
|| list1 is not null && list2 is not null && list1.Equals(list2); | ||
} | ||
public static bool operator !=(EquatableList<T>? list1, EquatableList<T>? list2) | ||
{ | ||
return !(list1 == list2); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.