-
Notifications
You must be signed in to change notification settings - Fork 353
/
Runtime.msbuild
162 lines (139 loc) · 8.79 KB
/
Runtime.msbuild
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<Project DefaultTargets="UnitTest" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="tools/WebStack.tasks.targets"/>
<UsingTask TaskName="SkipStrongNames.CheckSkipStrongNamesStatus" AssemblyFile="$(SkipStrongNamesExe)" />
<PropertyGroup>
<!-- build.cmd sets /p:Desktop=true. The CI server does not; instead, it does an additional step with /p:Configuration=CodeAnalysis. -->
<Configuration Condition=" '$(Configuration)' == '' and '$(Desktop)' == 'true' ">CodeAnalysis</Configuration>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<CodeAnalysis Condition=" '$(CodeAnalysis)' == '' and '$(Configuration)' != 'Release' ">true</CodeAnalysis>
<StyleCopEnabled Condition=" '$(StyleCopEnabled)' == '' ">true</StyleCopEnabled>
<BuildInParallel Condition=" '$(BuildInParallel)' == '' And $(MSBuildNodeCount) > 1 ">true</BuildInParallel>
<BuildInParallel Condition=" '$(BuildInParallel)' == '' ">false</BuildInParallel>
<RestoreInParallel Condition=" '$(RestoreInParallel)' == '' ">false</RestoreInParallel>
<TestInParallel Condition=" '$(TestInParallel)' == '' ">false</TestInParallel>
<TestResultsDirectory>$(MSBuildThisFileDirectory)bin\$(Configuration)\test\TestResults\</TestResultsDirectory>
<SkipStrongNamesExe>$(MSBuildThisFileDirectory)packages\Microsoft.Web.SkipStrongNames.1.0.0\tools\SkipStrongNames.exe</SkipStrongNamesExe>
<SkipStrongNamesXml>$(MSBuildThisFileDirectory)tools\SkipStrongNames.xml</SkipStrongNamesXml>
<NuGetExe>.nuget\NuGet.exe</NuGetExe>
</PropertyGroup>
<Target Name="EnableSkipStrongNames" DependsOnTargets="RestoreSkipStrongNames">
<Exec Command='"$(SkipStrongNamesExe)" -e "$(SkipStrongNamesXml)"' />
<CheckSkipStrongNamesStatus AssembliesFile="$(SkipStrongNamesXml)">
<Output TaskParameter="Status" PropertyName="Status" />
</CheckSkipStrongNamesStatus>
<Message Text="SkipStrongNames: $(Status)" Importance="High" />
</Target>
<Target Name="DisableSkipStrongNames" DependsOnTargets="RestoreSkipStrongNames">
<Exec Command='"$(SkipStrongNamesExe)" -d "$(SkipStrongNamesXml)"' />
<CheckSkipStrongNamesStatus AssembliesFile="$(SkipStrongNamesXml)">
<Output TaskParameter="Status" PropertyName="Status" />
</CheckSkipStrongNamesStatus>
<Message Text="SkipStrongNames: $(Status)" Importance="High" />
</Target>
<Target Name="Integration" DependsOnTargets="Clean;Build;UnitTest" />
<Target Name="Clean">
<MSBuild
Projects="Runtime.sln"
Targets="Clean"
Properties="Configuration=$(Configuration);VisualStudioVersion=$(VisualStudioVersion)" />
<RemoveDir Directories="bin\$(Configuration)" />
</Target>
<Target Name="DownloadNuGet">
<DownloadNuGet OutputFileName="$(NuGetExe)" MinimumVersion="2.12.0" />
</Target>
<Target Name="RestoreSkipStrongNames" DependsOnTargets="DownloadNuGet">
<Exec Command='"$(NuGetExe)" restore .nuget\packages.config -PackagesDirectory packages -NonInteractive -Verbosity quiet' />
</Target>
<ItemGroup>
<_Testing_NetStandard1_3 Include="true;false" />
</ItemGroup>
<Target Name="RestorePackages" DependsOnTargets="DownloadNuGet">
<Message Text="%0ARestoring NuGet packages..." Importance="High" />
<!--
Pre-restore Microsoft.TestCommon due to the many dependencies on this project. Batch it to cover the full
set of references. Remove $(Platform) to avoid 'Any CPU' appearing in output paths. Can always restore in
parallel because $(Testing_NetStandard1_3) changes both obj/ and bin/ folders entirely.
-->
<MSBuild Projects="test\Microsoft.TestCommon\Microsoft.TestCommon.csproj" Targets="Restore"
BuildInParallel="true"
Properties="Configuration=$(Configuration);CodeAnalysis=$(CodeAnalysis);StyleCopEnabled=$(StyleCopEnabled);
RestorePackagesConfig=true;VisualStudioVersion=$(VisualStudioVersion);
Testing_NetStandard1_3=%(_Testing_NetStandard1_3.Identity)"
RemoveProperties="Platform" />
<MSBuild Projects="Runtime.sln" Targets="Restore"
BuildInParallel="$(RestoreInParallel)"
Properties="Configuration=$(Configuration);CodeAnalysis=$(CodeAnalysis);StyleCopEnabled=$(StyleCopEnabled);
RestorePackagesConfig=true;VisualStudioVersion=$(VisualStudioVersion)" />
<Message Importance="High" Text="" />
</Target>
<!-- Pick the right Microsoft.Web.FxCop package to use and copy it to a standard location. -->
<Target Name="BuildTools">
<PropertyGroup>
<FxCopProjectLocation>$(MSBuildThisFileDirectory)tools\src\Microsoft.Web.FxCop\</FxCopProjectLocation>
<CustomFxCopRulesPath>$(MSBuildThisFileDirectory)packages\CustomFxCopRules</CustomFxCopRulesPath>
</PropertyGroup>
<MSBuild
Condition=" '$(CodeAnalysis)' == 'true' "
Projects="$(FxCopProjectLocation)\Microsoft.Web.FxCop.csproj"
Properties="Configuration=Release;OutputPath=$(CustomFxCopRulesPath)" />
</Target>
<Target Name="Build" DependsOnTargets="RestoreSkipStrongNames;RestorePackages;BuildTools">
<Error Condition=" '$(CodeAnalysis)' == 'true' and '$(Configuration)' == 'Release' "
Text="Unable to run code analysis in Release configuration. Release assemblies do not include SuppressMessage attributes (so code analysis would always fail with the errors that are normally suppressed)." />
<MakeDir Directories="bin\$(Configuration)" />
<!--
Prebuild Microsoft.TestCommon due to the many dependencies on this project. Batch it to cover the full
set of references. Remove $(Platform) to avoid 'Any CPU' appearing in output paths. Can always build in
parallel because $(Testing_NetStandard1_3) changes both obj/ and bin/ folders entirely.
-->
<MSBuild Projects="test\Microsoft.TestCommon\Microsoft.TestCommon.csproj" Targets="Build"
BuildInParallel="true"
Properties="Configuration=$(Configuration);CodeAnalysis=$(CodeAnalysis);StyleCopEnabled=$(StyleCopEnabled);
VisualStudioVersion=$(VisualStudioVersion);
Testing_NetStandard1_3=%(_Testing_NetStandard1_3.Identity)"
RemoveProperties="Platform" />
<MSBuild
Projects="Runtime.sln"
BuildInParallel="$(BuildInParallel)"
Targets="Build"
Properties="Configuration=$(Configuration);CodeAnalysis=$(CodeAnalysis);StyleCopEnabled=$(StyleCopEnabled);
VisualStudioVersion=$(VisualStudioVersion)" />
</Target>
<Target Name="UnitTest" DependsOnTargets="Build;PrintTestRunSummary" />
<Target Name="RunTests" DependsOnTargets="CheckSkipStrongNames">
<ItemGroup>
<_TestDLLsXunit Include="bin\$(Configuration)\test\*.Test.dll;
bin\$(Configuration)\test\*\net4*\*.Test.dll" />
<_XunitProject Include="tools\WebStack.testing.targets">
<Properties>TestAssembly=%(_TestDLLsXunit.FullPath);
XmlPath=$(TestResultsDirectory)%(_TestDLLsXunit.FileName)-XunitResults.xml</Properties>
</_XunitProject>
<_VSTestDLLs Include="bin\$(Configuration)\test\ns1_3\**\*.Test.dll;
bin\$(Configuration)\test\ns2_0\**\*.Test.dll"
Exclude="bin\$(Configuration)\test\*\net4*\*.Test.dll" />
<_XunitProject Include="tools\WebStack.testing.targets">
<Properties>TestAssembly=%(_VSTestDLLs.FullPath);
XmlPath=$(TestResultsDirectory)%(_VSTestDLLs.FileName)-$([System.String]::Copy('%(_VSTestDLLs.RecursiveDir)').Trim('\\'))-XunitResults.xml;
UseVSTest=true</Properties>
</_XunitProject>
</ItemGroup>
<!-- Recreate the test results directory so that print summary doesn't run on old test results. -->
<RemoveDir Directories="$(TestResultsDirectory)" />
<MakeDir Directories="$(TestResultsDirectory)" />
<MSBuild Projects="@(_XunitProject)" BuildInParallel="$(TestInParallel)" Targets="TestAssembly">
<Output TaskParameter="TargetOutputs" ItemName="_ExitCodes" />
</MSBuild>
</Target>
<Target Name="CheckSkipStrongNames" DependsOnTargets="RestoreSkipStrongNames">
<CheckSkipStrongNamesStatus AssembliesFile="$(SkipStrongNamesXml)">
<Output TaskParameter="Status" PropertyName="Status" />
</CheckSkipStrongNamesStatus>
<Error Text="Unit tests will not run correctly unless SkipStrongNames is Enabled. Current status: $(Status). Run build.cmd EnableSkipStrongNames to fix this problem." Condition="'$(Status)' != 'Enabled'" />
</Target>
<Target Name="PrintTestRunSummary" DependsOnTargets="RunTests">
<PrintTestRunSummary TestResultsDirectory="$(TestResultsDirectory)" />
<!-- PrintTestRunSummary stops MSBuild if tests failed. But the Xunit target may fail for other reasons... -->
<Error Text="Testing failed with exit code '%(Code)':%0A@(_ExitCodes -> ' %(Identity)', '%0A')"
Condition=" '%(Code)' != '0' " />
</Target>
</Project>