forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMultiTargetRoslynComponent.targets.template
31 lines (26 loc) · 1.17 KB
/
MultiTargetRoslynComponent.targets.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<Project>
<Target Name="_{TargetPrefix}GatherAnalyzers">
<ItemGroup>
<_{TargetPrefix}Analyzer Include="@(Analyzer)" Condition="'%(Analyzer.NuGetPackageId)' == '{NuGetPackageId}'" />
</ItemGroup>
</Target>
<Target Name="_{TargetPrefix}AnalyzerMultiTargeting"
Condition="'$(SupportsRoslynComponentVersioning)' != 'true'"
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
DependsOnTargets="_{TargetPrefix}GatherAnalyzers">
<ItemGroup>
<!-- Remove our analyzers targeting roslyn4.x -->
<Analyzer Remove="@(_{TargetPrefix}Analyzer)"
Condition="$([System.String]::Copy('%(_{TargetPrefix}Analyzer.Identity)').IndexOf('roslyn4')) >= 0"/>
</ItemGroup>
</Target>
<Target Name="_{TargetPrefix}RemoveAnalyzers"
Condition="'$({DisableSourceGeneratorPropertyName})' == 'true'"
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
DependsOnTargets="_{TargetPrefix}GatherAnalyzers">
<!-- Remove all our analyzers -->
<ItemGroup>
<Analyzer Remove="@(_{TargetPrefix}Analyzer)" />
</ItemGroup>
</Target>
</Project>