Skip to content

Commit

Permalink
Add analyzer assemblies to code coverage (#60859)
Browse files Browse the repository at this point in the history
* Add analyzer assemblies to code coverage

Instrument analyzer assemblies as well when measuring code coverage.
Filter out the ones which aren't referenced via the P2P protocol.

* Update coverage.targets
  • Loading branch information
ViktorHofer authored Oct 27, 2021
1 parent a53e68e commit 69270ff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion eng/testing/coverage.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project>
<Target Name="SetupCoverageFilter">
<Target Name="SetupCoverageFilter"
DependsOnTargets="ResolveReferences">
<!--
We need to filter the data to only the assembly being tested. Otherwise we will gather tons of data about other assemblies.
If the code being tested is part of the runtime itself, it requires special treatment.
Expand All @@ -18,6 +19,8 @@
<CoverageInclude Include="System.Private.CoreLib" Condition="'$(TestRuntime)' == 'true'" />
<CoverageInclude Include="@(AssembliesBeingTested)" />
<CoverageInclude Include="$(CoverageAssemblies)" Condition="'$(CoverageAssemblies)' != ''" />
<!-- Include analyzer assemblies which are referenced via the P2P protocol. -->
<CoverageInclude Include="@(ReferencePath->WithMetadataValue('OutputItemType', 'Analyzer')->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->Metadata('Filename'))" />
</ItemGroup>

<PropertyGroup>
Expand Down

0 comments on commit 69270ff

Please sign in to comment.