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

Add solution source generator path from attribute support and exception reporting #1207

Merged

Conversation

jwfx
Copy link
Contributor

@jwfx jwfx commented Jun 26, 2023

Adds the missing support for supplying the solution name via attribute parameter instead of parameter.json while having source generation enabled, e.g.
[Solution("my.sln", GenerateProjects = true)] readonly Solution Solution;

Prevent source generator exceptions from being swallowed and replaced by unhelpful generic compiler errors by using the proper reporting facility context.ReportDiagnostic().

Fixes #1205

I confirm that the pull-request:

  • Follows the contribution guidelines
  • Is based on my own work
  • Is in compliance with my employer

@matkoch
Copy link
Member

matkoch commented Jul 25, 2023

Can you please split this in two PRs, or at least two commits? The current one does two things at the same time.

For the exception handling I suggest introducing another Execute overload that takes the compilation. This way, the error handling is a single response of the outer method, and there's not a huge indented block as it is now.

@jwfx jwfx force-pushed the solution-source-generator-improvements branch from 96969dc to 09e745d Compare July 26, 2023 18:47
@jwfx
Copy link
Contributor Author

jwfx commented Jul 26, 2023

Can you please split this in two PRs, or at least two commits? The current one does two things at the same time.

Done, split it in two commits.

For the exception handling I suggest introducing another Execute overload that takes the compilation. This way, the error handling is a single response of the outer method, and there's not a huge indented block as it is now.

I turned the source generation into a method. It felt a bit awkward to make an overload that would take the context and the compilation from the same context. The context would still have been required because of the AddSource() call.

@matkoch
Copy link
Member

matkoch commented Aug 14, 2023

This is perfect! Just as I would've done it.

@matkoch matkoch force-pushed the solution-source-generator-improvements branch from 09e745d to 9a4638c Compare August 14, 2023 19:16
@matkoch matkoch added this to the v7.0.3 milestone Aug 14, 2023
@matkoch matkoch merged commit 33ea8ec into nuke-build:develop Aug 14, 2023
3 of 4 checks passed
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.

Solution source generator can't handle solution path from attribute / does not report exceptions properly
2 participants