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

Rework Analyzer/Source Generator support #452

Merged
merged 1 commit into from
Oct 4, 2024
Merged

Conversation

purkhusid
Copy link
Collaborator

What?

Reworks the analyzer/source generator support so that it more robust and so that end users can use and author source generators

## What?
Reworks the analyzer/source generator support so that it more robust and so that end users can use and author source generators
@purkhusid
Copy link
Collaborator Author

@tomdegoede Any chance you could look over this? I don't use analyzers/source generators daily so I don't have much experience with them.

Copy link
Collaborator

@tomdegoede tomdegoede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! We (thankfully) never ran into the language specific analyzers. Personally I would prefer not to mention vb, cs and fs in many places. Would it be possible to convert analyzers and transitive_analyzers on the provider to a dict() of analyzer depsets keyed by ("", "vb", "cs", "fs")? You can then propagate the analyzers from collect_compile_info as: depset(transitive = [analyzers.get("", depset()), analyzers.get(language, depset())]).

@purkhusid
Copy link
Collaborator Author

This looks good! We (thankfully) never ran into the language specific analyzers. Personally I would prefer not to mention vb, cs and fs in many places. Would it be possible to convert analyzers and transitive_analyzers on the provider to a dict() of analyzer depsets keyed by ("", "vb", "cs", "fs")? You can then propagate the analyzers from collect_compile_info as: depset(transitive = [analyzers.get("", depset()), analyzers.get(language, depset())]).

I don't like the lang prefixes either. Will see if I can use your suggestion to get rid of most of them.

@purkhusid
Copy link
Collaborator Author

Going to keep it like it is for now, I've got some refactoring ideas to get rid of some of the duplication between languages but I don't have time to do it now. I don't consider the providers public interfaces at the moment so I'm not too worried about breaking changes there.

@purkhusid purkhusid merged commit cb45459 into master Oct 4, 2024
1 of 2 checks passed
@tomdegoede
Copy link
Collaborator

No problem. We are currently adding support for VB and WPF to our setup. I have open-sourced a minimal setup here: https://github.com/AFASResearch/bazel-template. In case you are interested in how we minimalize code duplication, everything still lives in binary.bzl and assembly.bzl.

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

Successfully merging this pull request may close these issues.

2 participants