Extract helper code for Analyzers and Source Generators

This commit is contained in:
YoshiRulz 2022-09-24 09:26:52 +10:00
parent 1fbb95a353
commit 7efafc18da
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
7 changed files with 20 additions and 14 deletions

View File

@ -0,0 +1,16 @@
<Project>
<!--
This is a set of MSBuild imports rather than a project because I COULD NOT for the life of me get the latter to work.
With the workaround given in dotnet/roslyn#61940, everything built, but then the main solution wouldn't build. Every project gave:
warning CS8785: Generator 'VIMGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result.
Exception was of type 'FileNotFoundException'
with message 'Could not load file or assembly 'BizHawk.Analyzers.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Yes, even with an EXPLICIT <Reference/> to the Common project's assembly. So you get this instead. —yoshi
-->
<Import Project="LibCommon.props" />
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" />
<Compile Include="$(ProjectDir)../AnalyzersCommon/**/*.cs" />
</ItemGroup>
</Project>

View File

@ -4,7 +4,7 @@ using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
internal static class RoslynUtils
public static class RoslynUtils
{
public static SyntaxNode? EnclosingTypeDeclarationSyntax(this CSharpSyntaxNode node)
{

View File

@ -2,12 +2,5 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<Import Project="../LibCommon.props" />
<PropertyGroup>
<NoWarn>$(NoWarn);SA1200</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" PrivateAssets="all" />
</ItemGroup>
<Import Project="../AnalyzersCommon.props" />
</Project>

View File

@ -2,9 +2,5 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<Import Project="../LibCommon.props" />
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" PrivateAssets="all" />
</ItemGroup>
<Import Project="../AnalyzersCommon.props" />
</Project>

View File

@ -1,6 +1,7 @@
<Project>
<Import Project="../Common.props" />
<PropertyGroup>
<NoWarn>$(NoWarn);SA1200</NoWarn>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
</PropertyGroup>
<ItemGroup>

Binary file not shown.