forked from dotnet/roslyn-analyzers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDirectory.Build.targets
94 lines (82 loc) · 4.15 KB
/
Directory.Build.targets
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project>
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<!-- Add License and Third Party Notices files into each VSIX. -->
<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)\assets\EULA.rtf">
<Link>EULA.rtf</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="$(MSBuildThisFileDirectory)\assets\ThirdPartyNotices.rtf">
<Link>ThirdPartyNotices.rtf</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
</ItemGroup>
<ItemGroup Condition="'$(IsUnitTestProject)' == 'true'">
<PackageReference Include="coverlet.msbuild" Version="$(CoverletVersion)" PrivateAssets="all" />
</ItemGroup>
<PropertyGroup Condition="'$(IsTestProject)' == 'true' or '$(NonShipping)' == 'true' or '$(IsVsixProject)' == 'true' or '$(FxCopAnalyzersProject)' == 'true'">
<ReleaseTrackingOptOut>true</ReleaseTrackingOptOut>
</PropertyGroup>
<PropertyGroup Condition="'$(ReleaseTrackingOptOut)' == 'true'">
<!-- RS2008: Enable analyzer release tracking -->
<NoWarn>$(NoWarn);RS2008</NoWarn>
</PropertyGroup>
<PropertyGroup>
<!-- Clear out 'RootNamespace' for VB projects. Otherwise, it prepends the RootNamespace to declared namespace for the types in the project. -->
<RootNamespace Condition="'$(Language)' == 'VB'"></RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(Coverage)' == 'true'">
<!-- https://github.com/tonerdo/coverlet/issues/363 -->
<DeterministicSourcePaths>false</DeterministicSourcePaths>
<!-- https://github.com/tonerdo/coverlet/issues/618 -->
<IncludeTestAssembly>true</IncludeTestAssembly>
<CollectCoverage>true</CollectCoverage>
<SingleHit>true</SingleHit>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<CoverletOutputFormat>opencover</CoverletOutputFormat>
<CoverletOutput>$(ArtifactsDir)coverage\$(MSBuildProjectName)_$(TargetFramework)_$(_TestArchitecture).coverage</CoverletOutput>
<Include></Include>
<Exclude></Exclude>
<ExcludeByAttribute>ExcludeFromCodeCoverage</ExcludeByAttribute>
<ExcludeByFile></ExcludeByFile>
</PropertyGroup>
<Target Name="OuterInstrumentModulesNoBuild" BeforeTargets="RunTests" Condition="'$(IsUnitTestProject)' == 'true' AND '$(TargetFramework)' == ''">
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="InnerInstrumentModulesNoBuild"
Properties="TargetFramework=%(_TargetFramework.Identity)" />
</Target>
<Target Name="OuterGenerateCoverageResult" AfterTargets="RunTests" Condition="'$(IsUnitTestProject)' == 'true' AND '$(TargetFramework)' == ''">
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="InnerGenerateCoverageResult"
Properties="TargetFramework=%(_TargetFramework.Identity)" />
</Target>
<Target Name="InnerInstrumentModulesNoBuild" BeforeTargets="RunTests" Condition="'$(IsUnitTestProject)' == 'true' AND '$(TargetFramework)' != ''">
<Coverlet.MSbuild.Tasks.InstrumentationTask
Condition="'$(CollectCoverage)' == 'true'"
Path="$(TargetPath)"
Include="$(Include)"
IncludeDirectory="$(IncludeDirectory)"
Exclude="$(Exclude)"
ExcludeByFile="$(ExcludeByFile)"
ExcludeByAttribute="$(ExcludeByAttribute)"
IncludeTestAssembly="$(IncludeTestAssembly)"
SingleHit="$(SingleHit)"
MergeWith="$(MergeWith)"
UseSourceLink="$(UseSourceLink)" >
<Output TaskParameter="InstrumenterState" PropertyName="InstrumenterState"/>
</Coverlet.MSbuild.Tasks.InstrumentationTask>
</Target>
<Target Name="InnerGenerateCoverageResult" AfterTargets="RunTests" Condition="'$(IsUnitTestProject)' == 'true' AND '$(TargetFramework)' != ''">
<Coverlet.MSbuild.Tasks.CoverageResultTask
Condition="'$(CollectCoverage)' == 'true'"
Output="$(CoverletOutput)"
OutputFormat="$(CoverletOutputFormat)"
Threshold="$(Threshold)"
ThresholdType="$(ThresholdType)"
ThresholdStat="$(ThresholdStat)"
InstrumenterState="$(InstrumenterState)"/>
</Target>
</Project>