Skip to content

Commit

Permalink
Update supported Roslyn version to v4
Browse files Browse the repository at this point in the history
Fixes #123

* removed manual binding redirects file
* added dummy project with conflicting package resfs to force auto-regen of binding directs
* enable end-to-end tests for Roslyn v3 and v4
  • Loading branch information
duncanp-sonar committed Nov 17, 2021
1 parent c6503c3 commit 274f9de
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 102 deletions.
10 changes: 8 additions & 2 deletions PluginGenerator.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31815.197
# Visual Studio Version 16
VisualStudioVersion = 16.0.31613.86
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{AEB50389-D3DD-4EF3-9974-109BC5F20646}"
EndProject
Expand Down Expand Up @@ -38,6 +38,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RoslynAnalyzer333", "Tests\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RoslynAnalyzer298", "Tests\ExampleAnalyzers\RoslynAnalyzer298\RoslynAnalyzer298.csproj", "{4AD02214-637F-40A7-990E-9EA7FDFCB108}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RoslynV1Refs", "RoslynV1Resfs\RoslynV1Refs.csproj", "{60280BDB-61A9-4FC8-A9A9-62E04BF6644E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -92,6 +94,10 @@ Global
{4AD02214-637F-40A7-990E-9EA7FDFCB108}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4AD02214-637F-40A7-990E-9EA7FDFCB108}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4AD02214-637F-40A7-990E-9EA7FDFCB108}.Release|Any CPU.Build.0 = Release|Any CPU
{60280BDB-61A9-4FC8-A9A9-62E04BF6644E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60280BDB-61A9-4FC8-A9A9-62E04BF6644E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60280BDB-61A9-4FC8-A9A9-62E04BF6644E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60280BDB-61A9-4FC8-A9A9-62E04BF6644E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
82 changes: 0 additions & 82 deletions RoslynPluginGenerator/App.config

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@
</PropertyGroup>

<ItemGroup Label="NuGet packages">
<PackageReference Include="Microsoft.CodeAnalysis" Version="2.9.0" ExcludeAssets="analyzers" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.0.1" ExcludeAssets="analyzers" />
<PackageReference Include="NuGet.CommandLine" Version="4.7.0" GeneratePathProperty="true" PrivateAssets="all" />
<Reference Include="$(PkgNuGet_CommandLine)\tools\NuGet.exe" />
<PackageReference Include="System.IO.Compression" Version="4.0.0" Private="true" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.IO.Compression.FileSystem" Private="true" />
</ItemGroup>

<ItemGroup>
<Compile Update="CommandLine\CmdLineResources.Designer.cs">
<AutoGen>True</AutoGen>
Expand Down Expand Up @@ -62,6 +59,7 @@
<Project>{db16ccfa-b97f-4c5e-a99a-a6062ecf5d98}</Project>
<Name>SonarQube.Plugins.PluginGenerator</Name>
</ProjectReference>
<ProjectReference Include="..\RoslynV1Resfs\RoslynV1Refs.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
33 changes: 33 additions & 0 deletions RoslynV1Resfs/RoslynV1Refs.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<!-- Dummy project referencing Roslyn v1 packaes.
This project does not contain any code.
It exists to force the exe project to automatically generate binding updates for the Roslyn
assemblies for conflicting packages (the binding redirects won't be auto-generated unless
there are conflicts).
-->

<PropertyGroup>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis" Version="1.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="1.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Features" Version="1.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="1.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="1.0.0" />

<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="1.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Features" Version="1.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="1.0.0" />

<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="1.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Features" Version="1.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="1.0.0" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions Tests/IntegrationTests/EndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public async Task Execute_MissingArgs_Fails()
[DataRow("RoslynAnalyzer10:1.0.0")]
[DataRow("RoslynAnalyzer11:1.0.0")]
[DataRow("wintellect.analyzers")]
//[DataRow("RoslynV298")]
//[DataRow("RoslynV333")]
[DataRow("RoslynV298")]
[DataRow("RoslynV333")]
public async Task Execute_ExampleAnalyzers_Succeeds(string analyzerArg)
{
var exeFilePath = GetExeFilePath();
Expand Down
2 changes: 1 addition & 1 deletion Tests/IntegrationTests/IntegrationTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis" Version="2.9.0" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.0.1" />
<PackageReference Include="NuGet.CommandLine" Version="4.7.0" GeneratePathProperty="true" PrivateAssets="all" />
<Reference Include="$(PkgNuGet_CommandLine)\tools\NuGet.exe" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ public void InstantiateDiags_MultipleAssemblies_AnalyzersFound()
[TestMethod]
[DataRow(typeof(RoslynAnalyzer10.ExampleAnalyzer2), 1)]
[DataRow(typeof(RoslynAnalyzer11.CSharpAnalyzer), 3)]
//[DataRow(typeof(RoslynAnalyzer298.RoslynAnalyzer298Analyzer), 1)]
//[DataRow(typeof(RoslynAnalyzer333.RoslynAnalyzer333Analyzer), 1)]
[DataRow(typeof(RoslynAnalyzer298.RoslynAnalyzer298Analyzer), 1)]
[DataRow(typeof(RoslynAnalyzer333.RoslynAnalyzer333Analyzer), 1)]
public void InstantiateDiags_DifferentRoslynVersions_AnalyzersFound(Type typeInTargetAssembly, int expectedAnalyzerCount)
{
// Arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup Label="Test packages">
<PackageReference Include="Microsoft.CodeAnalysis" Version="2.9.0" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
Expand All @@ -19,19 +19,15 @@
<PackageReference Include="NuGet.CommandLine" Version="4.7.0" GeneratePathProperty="true" />
<Reference Include="$(PkgNuGet_CommandLine)\tools\NuGet.exe" />
</ItemGroup>

<!--<ItemGroup>
<Reference Include="System.IO.Compression.FileSystem" Private="true" />
</ItemGroup>-->


<ItemGroup>
<ProjectReference Include="..\..\Common\SonarQube.Plugins.Common.csproj" />
<ProjectReference Include="..\..\PluginGenerator\SonarQube.Plugins.PluginGenerator.csproj" />
<ProjectReference Include="..\..\RoslynPluginGenerator\SonarQube.Plugins.Roslyn.PluginGenerator.csproj" />
<ProjectReference Include="..\Common\SonarQube.Plugins.Test.Common.csproj" />
<ProjectReference Include="..\ExampleAnalyzers\RoslynAnalyzer10\RoslynAnalyzer10\RoslynAnalyzer10.csproj" />
<ProjectReference Include="..\ExampleAnalyzers\RoslynAnalyzer11\RoslynAnalyzer11\RoslynAnalyzer11.csproj" />
<!--<ProjectReference Include="..\ExampleAnalyzers\RoslynAnalyzer298\RoslynAnalyzer298.csproj" />
<ProjectReference Include="..\ExampleAnalyzers\RoslynAnalyzer333\RoslynAnalyzer333.csproj" />-->
<ProjectReference Include="..\ExampleAnalyzers\RoslynAnalyzer298\RoslynAnalyzer298.csproj" />
<ProjectReference Include="..\ExampleAnalyzers\RoslynAnalyzer333\RoslynAnalyzer333.csproj" />
</ItemGroup>
</Project>

0 comments on commit 274f9de

Please sign in to comment.