Fix Roslyn multi-targeting and testing

This commit is contained in:
Sergio Pedri
2022-09-12 21:21:26 +02:00
parent 1e1ba013e8
commit 4e43f2901e
5 changed files with 11 additions and 32 deletions
@@ -43,10 +43,10 @@
<!-- Reference the various multi-targeted versions of the source generator project (one per Roslyn version) -->
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<ProjectReference Include="..\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.csproj" ReferenceOutputAssembly="false">
<Properties>MvvmToolkitSourceGeneratorRoslynVersion=4.0.1;MvvmToolkitIsGeneratingNuGetPackage=true</Properties>
<AdditionalProperties>MvvmToolkitSourceGeneratorRoslynVersion=4.0.1;MvvmToolkitIsGeneratingNuGetPackage=true</AdditionalProperties>
</ProjectReference>
<ProjectReference Include="..\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.csproj" ReferenceOutputAssembly="false">
<Properties>MvvmToolkitSourceGeneratorRoslynVersion=4.3.0;MvvmToolkitIsGeneratingNuGetPackage=true</Properties>
<AdditionalProperties>MvvmToolkitSourceGeneratorRoslynVersion=4.3.0;MvvmToolkitIsGeneratingNuGetPackage=true</AdditionalProperties>
</ProjectReference>
</ItemGroup>
+6 -6
View File
@@ -46,13 +46,13 @@ jobs:
- script: dotnet test -c Release -f net6.0 -l "trx;LogFileName=VSTestResults_net6.0.trx"
displayName: Run .NET 6 unit tests
# Run the .NET 6 MVVM Toolkit tests targeting Roslyn 4.0.1
- script: dotnet test tests\CommunityToolkit.Mvvm.UnitTests\CommunityToolkit.Mvvm.UnitTests.csproj -c Release -f net6.0 -p:MvvmToolkitSourceGeneratorRoslynVersion=4.0.1 -l "trx;LogFileName=VSTestResults_net6.0_mvvmtoolkit_roslyn401.trx"
displayName: Run CommunityToolkit.Mvvm.UnitTests unit tests with Roslyn 4.0.1
# Run the .NET 6 MVVM Toolkit tests targeting Roslyn 4.3.0
- script: dotnet test tests\CommunityToolkit.Mvvm.UnitTests\CommunityToolkit.Mvvm.UnitTests.csproj -c Release -f net6.0 -p:MvvmToolkitSourceGeneratorRoslynVersion=4.3.0 -l "trx;LogFileName=VSTestResults_net6.0_mvvmtoolkit_roslyn430.trx"
displayName: Run CommunityToolkit.Mvvm.UnitTests unit tests with Roslyn 4.3.0
# Run the .NET 6 MVVM Toolkit source generator tests targeting Roslyn 4.0.1
- script: dotnet test tests\CommunityToolkit.Mvvm.SourceGenerators.UnitTests\CommunityToolkit.Mvvm.SourceGenerators.UnitTests.csproj -c Release -f net6.0 -p:MvvmToolkitSourceGeneratorRoslynVersion=4.0.1 -l "trx;LogFileName=VSTestResults_net6.0_mvvmtoolkit_generators_roslyn401.trx"
displayName: Run CommunityToolkit.Mvvm.SourceGenerators.UnitTests unit tests with Roslyn 4.0.1
# Run the .NET 6 MVVM Toolkit source generator tests targeting Roslyn 4.3.0
- script: dotnet test tests\CommunityToolkit.Mvvm.SourceGenerators.UnitTests\CommunityToolkit.Mvvm.SourceGenerators.UnitTests.csproj -c Release -f net6.0 -p:MvvmToolkitSourceGeneratorRoslynVersion=4.3.0 -l "trx;LogFileName=VSTestResults_net6.0_mvvmtoolkit_generators_roslyn430.trx"
displayName: Run CommunityToolkit.Mvvm.SourceGenerators.UnitTests unit tests with Roslyn 4.3.0
# Run .NET Core 3.1 tests
- script: dotnet test -c Release -f netcoreapp3.1 -l "trx;LogFileName=VSTestResults_netcoreapp3.1.trx"
@@ -12,15 +12,9 @@
<NoWarn>$(NoWarn);CS8002;SA0001</NoWarn>
</PropertyGroup>
<!-- See comments in CommunityToolkit.MvvmUnitTests -->
<PropertyGroup>
<MvvmToolkitSourceGeneratorRoslynVersion Condition="'$(MvvmToolkitSourceGeneratorRoslynVersion)' == ''">4.3.0</MvvmToolkitSourceGeneratorRoslynVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\CommunityToolkit.Mvvm\CommunityToolkit.Mvvm.csproj" />
<ProjectReference Include="..\..\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build">
<Properties>MvvmToolkitSourceGeneratorRoslynVersion=$(MvvmToolkitSourceGeneratorRoslynVersion)</Properties>
</ProjectReference>
<ProjectReference Include="..\..\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
</ItemGroup>
</Project>
@@ -12,15 +12,9 @@
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
</ItemGroup>
<!-- See comments in CommunityToolkit.MvvmUnitTests -->
<PropertyGroup>
<MvvmToolkitSourceGeneratorRoslynVersion Condition="'$(MvvmToolkitSourceGeneratorRoslynVersion)' == ''">4.3.0</MvvmToolkitSourceGeneratorRoslynVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\CommunityToolkit.Mvvm\CommunityToolkit.Mvvm.csproj" />
<ProjectReference Include="..\..\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.csproj">
<Properties>MvvmToolkitSourceGeneratorRoslynVersion=$(MvvmToolkitSourceGeneratorRoslynVersion)</Properties>
</ProjectReference>
<ProjectReference Include="..\..\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.csproj" />
</ItemGroup>
</Project>
@@ -13,17 +13,8 @@
<ItemGroup>
<ProjectReference Include="..\CommunityToolkit.Mvvm.ExternalAssembly\CommunityToolkit.Mvvm.ExternalAssembly.csproj" />
</ItemGroup>
<!-- Since the MVVM Toolkit generator uses multi-targeting for Roslyn versions, we also want to test all of them here -->
<PropertyGroup>
<MvvmToolkitSourceGeneratorRoslynVersion Condition="'$(MvvmToolkitSourceGeneratorRoslynVersion)' == ''">4.3.0</MvvmToolkitSourceGeneratorRoslynVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\CommunityToolkit.Mvvm\CommunityToolkit.Mvvm.csproj" />
<ProjectReference Include="..\..\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build">
<Properties>MvvmToolkitSourceGeneratorRoslynVersion=$(MvvmToolkitSourceGeneratorRoslynVersion)</Properties>
</ProjectReference>
<ProjectReference Include="..\..\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
</ItemGroup>
</Project>