forked from dotnet/roslyn-analyzers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Directory.Build.targets
76 lines (64 loc) · 3.36 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
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. 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'">
<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" BeforeTargets="Test" Condition="'$(IsUnitTestProject)' == 'true' AND '$(TargetFramework)' == ''">
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Targets="InnerGenerateCoverageResult"
Properties="TargetFramework=%(_TargetFramework.Identity)" />
</Target>
<Target Name="InnerInstrumentModulesNoBuild"
BeforeTargets="RunTests"
DependsOnTargets="InstrumentModules"
Condition="'$(IsUnitTestProject)' == 'true' AND '$(TargetFramework)' != '' AND '$(CollectCoverage)' == 'true'" />
<Target Name="InnerGenerateCoverageResult"
BeforeTargets="Test"
DependsOnTargets="GenerateCoverageResult"
Condition="'$(IsUnitTestProject)' == 'true' AND '$(TargetFramework)' != '' AND '$(CollectCoverage)' == 'true'" />
</Project>