forked from dotnet/roslyn-analyzers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BuildAndTest.proj
83 lines (68 loc) · 3.76 KB
/
BuildAndTest.proj
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
<Project
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
DefaultTargets="BuildAndTest"
ToolsVersion="14.0">
<PropertyGroup>
<SolutionFile>$(MSBuildThisFileDirectory)RoslynAnalyzers.sln</SolutionFile>
<PackagingProject>$(MSBuildThisFileDirectory)src\Packaging\Packaging.proj</PackagingProject>
<BinariesPath>$(MSBuildThisFileDirectory)Binaries\$(Configuration)</BinariesPath>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<IncludePattern Condition="'$(IncludePattern)' == ''">*.Test*.dll</IncludePattern>
<!-- Emit XML in order to get structured test results -->
<RunTestArgs>-noshadow -parallel all -xml Binaries\$(Configuration)\TestResults.xml</RunTestArgs>
<!-- Arguments to the SignTool -->
<SignRoslynArgs>-msbuildPath "$(MSBuildBinPath)\msbuild.exe" -config "$(MSBuildThisFileDirectory)build\Config\SignToolData.json"</SignRoslynArgs>
<RoslynToolsMicrosoftSignToolVersion>0.3.0-beta</RoslynToolsMicrosoftSignToolVersion>
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == ''">$(NUGET_PACKAGES)</NuGetPackageRoot>
<!-- Respect environment variable if set -->
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' and
'$(OS)' == 'Windows_NT'">$(UserProfile)\.nuget\packages</NuGetPackageRoot>
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' and
'$(OS)' != 'Windows_NT'">$(HOME)\.nuget\packages</NuGetPackageRoot>
</PropertyGroup>
<Target Name="RestorePackages">
<MSBuild BuildInParallel="true"
Projects="$(SolutionFile)"
Properties="RestorePackages=true"
Targets="Restore"/>
</Target>
<Target Name="Build" DependsOnTargets="RestorePackages">
<MSBuild BuildInParallel="true"
Projects="$(SolutionFile)"
Properties="RestorePackages=false;TreatWarningsAsErrors=true"
Targets="Build"/>
</Target>
<Target Name="Clean">
<MSBuild BuildInParallel="true"
Projects="$(SolutionFile)"
Properties="RestorePackages=false"
Targets="Clean"/>
<MSBuild Projects="$(PackagingProject)"
Targets="Clean" />
</Target>
<Target Name="Rebuild">
<MSBuild BuildInParallel="true"
Projects="$(SolutionFile)"
Properties="RestorePackages=false;TreatWarningsAsErrors=true"
Targets="Rebuild"/>
</Target>
<Target Name="Sign" Condition="'$(OfficialBuild)' == 'true'">
<Exec Command="$(NuGetPackageRoot)\RoslynTools.Microsoft.SignTool\$(RoslynToolsMicrosoftSignToolVersion)\tools\SignTool.exe $(SignRoslynArgs) "$(BinariesPath)"" WorkingDirectory="$(MSBuildThisFileDirectory)" />
</Target>
<Target Name="Package" DependsOnTargets="Build">
<MSBuild Projects="$(PackagingProject)" Targets="Build" />
</Target>
<Target Name="Test">
<ItemGroup>
<TestAssemblies Include="Binaries\$(Configuration)\Microsoft.CodeAnalysis.Analyzers.UnitTests.dll" />
<TestAssemblies Include="Binaries\$(Configuration)\Microsoft.CodeQuality.Analyzers.UnitTests.dll" />
<TestAssemblies Include="Binaries\$(Configuration)\Microsoft.NetCore.Analyzers.UnitTests.dll" />
<TestAssemblies Include="Binaries\$(Configuration)\Microsoft.NetFramework.Analyzers.UnitTests.dll" />
<TestAssemblies Include="Binaries\$(Configuration)\Roslyn.Diagnostics.Analyzers.UnitTests.dll" />
<TestAssemblies Include="Binaries\$(Configuration)\Text.Analyzers.UnitTests.dll" />
</ItemGroup>
<Exec Command=""$(NuGetPackageRoot)\xunit.runner.console\2.1.0\tools\xunit.console.x86.exe" @(TestAssemblies, ' ') $(RunTestArgs)" />
</Target>
<Target Name="BuildAndTest"
DependsOnTargets="Build;Sign;Package;Test" />
</Project>