Skip to content
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

Move Avalonia.NameGenerator to the main repository #10407

Merged
merged 112 commits into from
Mar 4, 2023
Merged

Conversation

maxkatz6
Copy link
Member

@maxkatz6 maxkatz6 commented Feb 20, 2023

What does the pull request do?

  • Moves Avalonia.NameGenerator to this repository.
  • Renames Avalonia.NameGenerator to Avalonia.Generators, as we plan to add more generators in the future (partial properties of C# 12 possibly)
  • Including tests
  • Enables generators on the ControlCatalog (used only in couple of pages)
  • History of changes and commit authors are kept the same (as far as github allows hit)
  • Include Avalonia.Generators in the main "Avalonia" package (similarly how System.Text.Json has done it, where main package and generator are combined, and generator can be disabled optionally).

To be done, but out of scope of this PR:

How was the solution implemented (if it's not obvious)?

  • Updated main repo project structure to match the main repo.
  • Merged one repo into another with a magic word (--allow-unrelated-histories)
  • Updated generator projects to fit main repo, use the same xamlx submodule, updated csproj...

worldbeater and others added 30 commits October 25, 2020 20:51
* Add XAML parser based on XamlX
* NameDirectiveTransformer.cs
* Build-time diagnostics
* Add basic MiniCompiler unit tests
* Add XamlX tests stub file
* Fix attached properties resolution
* Strip out controls that aren't IControl
* Be more strict and check the namespace
* Update packages, throw when class is not partial
* Use internal access modifier explicitly
* Move the attribute to Avalonia.Controls namespace
* Further documentation updates
* Add the badges
* Strip out the namespace
* Strip out the instantiation
* Actually strip out the transformer
* Refactoring, decomposition, more unit tests
* Support x:FieldModifier
* Use Xamarin.Forms API for x:FieldModifier
* Use <RestoreSources /> directive, bump Avalonia
* CRLF dance
* Use Fluent theme
* Move Avalonia packages to Directory.Build.props
* Bump test SDK version
…ces attribute (#22)

* feature: Generate x:Name mapping without the GenerateTypedNameReferences attribute.
* fix: Update README.md
…Failure (#23)

* Update README.md
* Don't crash when something goes wrong
* Add back the warning
* Update version.json
* Switch over to using x:Class
* The MsBuild property is no longer required
* Documentation updates
* Bring back the AXN0003 warning
* Bring back AXN0002
* Mocks for unit tests
* Actually use the mock in unit tests
* Bump version
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0030381-beta. (feed url: https://pkgs.dev.azure.com/AvaloniaUI/AvaloniaUI/_packaging/avalonia-all/nuget/v3/index.json) [PRBUILDID]

@maxkatz6
Copy link
Member Author

@worldbeater @robloo done. Restore sandbox and reorganized code.
Also enabled this generator as part of the Avalonia package and added one more parameter to enable/disable it.

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0030873-beta. (feed url: https://pkgs.dev.azure.com/AvaloniaUI/AvaloniaUI/_packaging/avalonia-all/nuget/v3/index.json) [PRBUILDID]

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0031423-beta. (feed url: https://pkgs.dev.azure.com/AvaloniaUI/AvaloniaUI/_packaging/avalonia-all/nuget/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 added this pull request to the merge queue Mar 4, 2023
Merged via the queue into master with commit 1da8891 Mar 4, 2023
@maxkatz6 maxkatz6 deleted the move-name-generator branch March 4, 2023 21:59
@rabbitism
Copy link
Contributor

This generator (I assume it's in analyzer folder) is not generating InitializeComponent() method. What should we config for this?

@laolarou726
Copy link
Contributor

This generator (I assume it's in analyzer folder) is not generating InitializeComponent() method. What should we config for this?

I also encounter this issue. Is there any switch we need to enable in the .csproj file?

@maxkatz6
Copy link
Member Author

In the telegram chat was found a workaround:
sharing:
1, remove XamlNameReferenceGenerator.dll from your nuget
2, add this into your proj.csproj (edit with plain text)
<Target Name="_InjectAdditionalFiles" BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun"> <ItemGroup> <AdditionalFiles Include="@(AvaloniaXaml)" SourceItemGroup="AvaloniaXaml" /> </ItemGroup> </Target>
and then *.axml will be compiled just fine.
my current solution, not sure there will be other ways from official later.

@maxkatz6
Copy link
Member Author

For the proper solution, nuget props should include Avalonia.Generators.props which is missing currently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.