Support for nuget package with multiple Roslyn version analyzers by hadashiA · Pull Request #616 · GlitchEnzo/NuGetForUnity (original) (raw)

Conversation

@hadashiA

To address the #615, I added a process to prevent the same analyzer from being enabled more than once.

It works as follows.

@hadashiA

@hadashiA

popara96

igor84

| if (!enabledRoslynVersions.Contains(assetRoslynVersion) || | | --------------------------------------------------------------------------- | | string.CompareOrdinal(assetRoslynVersion, enabledRoslynVersions.Max()) < 0) | | { | | AssetDatabase.SetLabels(plugin, new[] { ProcessedLabel }); |

Choose a reason for hiding this comment

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

Instead of setting and then removing the label, just save in some bool variable if RoslynAnalyzer label should be added and then in the end just SetLabels once to proper value depending on that bool.

Choose a reason for hiding this comment

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

Ok, I fixed.

@hadashiA

@hadashiA

igor84

@hadashiA

popara96

JoC0de

Choose a reason for hiding this comment

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

Thanks for the contribution.
I still don't understand why Unity doesn't handle this by itself but at least we can fix it 😃

@hadashiA

@JoC0de

@JoC0de JoC0de linked an issue

Mar 3, 2024

that may beclosed by this pull request

@JoC0de

… add unit test for package with multiple roslyn analyzers

JoC0de

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

[ Show hidden characters]({{ revealButtonHref }})