forked from haoduotnt/aspnetwebstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRuntime.msbuild
129 lines (112 loc) · 7.39 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
<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>
<BuildPortable Condition=" '$(BuildPortable)' == '' ">false</BuildPortable>
<BuildInParallel Condition=" '$(BuildInParallel)' == '' And $(MSBuildNodeCount) > 1 ">true</BuildInParallel>
<BuildInParallel Condition=" '$(BuildInParallel)' == '' ">false</BuildInParallel>
<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>
</PropertyGroup>
<ItemGroup>
<SolutionsToBuild Include="Runtime.sln">
<BuildInParallel>$(BuildInParallel)</BuildInParallel>
</SolutionsToBuild>
<SolutionsToBuild Include="RuntimePortable.sln">
<BuildInParallel>$(BuildInParallel)</BuildInParallel>
<Portable>true</Portable>
</SolutionsToBuild>
</ItemGroup>
<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="@(SolutionsToBuild)"
Targets="Clean"
Condition=" '%(SolutionsToBuild.Portable)' != 'true' or '$(BuildPortable)' == 'true' "
Properties="Configuration=$(Configuration);VisualStudioVersion=$(VisualStudioVersion)" />
<RemoveDir Directories="bin\$(Configuration)" />
</Target>
<Target Name="RestoreSkipStrongNames">
<MSBuild Projects=".nuget\nuget.targets" Targets="RestoreSkipStrongNames" />
</Target>
<Target Name="Prereq" DependsOnTargets="PreRestorePackages">
<MSBuild Projects=".nuget\nuget.targets" Targets="RestoreBinaryDependencies" />
<MSBuild Projects="@(RestoreCsProjFiles)" Targets="RestorePackages" StopOnFirstFailure="true" />
</Target>
<Target Name="PreRestorePackages">
<ItemGroup>
<!-- The list below is an optimization. Rather than running RestorePackages over every project, we
maintain a subset that references all used packages and run RestorePackages over just this subset.
Note that this list needs to be updated from time to time to ensure the outcome is the same as running
RestorePackages against every project. -->
<RestoreCsProjFiles
Include="src\Microsoft.AspNet.Mvc.Facebook\*.csproj;
src\Microsoft.Web.WebPages.OAuth\*.csproj;
src\System.Net.Http.Formatting.NetCore\*.csproj;
src\System.Web.Http.Owin\*.csproj;
src\System.Web.Http.SignalR\*.csproj;
src\System.Web.WebPages.Administration\*.csproj;
test\System.Web.Http.OData.Test\*.csproj" />
</ItemGroup>
<Message Text="Restoring NuGet packages..." Importance="High" />
</Target>
<Target Name="RestorePackages" DependsOnTargets="PreRestorePackages">
<MSBuild Projects=".nuget\nuget.targets" Targets="EnableRestore;RestoreBinaryDependencies" />
<MSBuild Projects="@(RestoreCsProjFiles)" Targets="EnableRestore;RestorePackages" StopOnFirstFailure="true" />
</Target>
<Target Name="Build" DependsOnTargets="Prereq">
<!-- we need to batch the solution files since they both build Microsoft.TestCommon -->
<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)" />
<MSBuild
Projects="@(SolutionsToBuild)"
BuildInParallel="%(SolutionsToBuild.BuildInParallel)"
Targets="Build"
Condition=" '%(SolutionsToBuild.Portable)' != 'true' or '$(BuildPortable)' == 'true' "
Properties="Configuration=$(Configuration);CodeAnalysis=$(CodeAnalysis);StyleCopEnabled=$(StyleCopEnabled);VisualStudioVersion=$(VisualStudioVersion)" />
</Target>
<Target Name="UnitTest" DependsOnTargets="CheckSkipStrongNames;Build">
<CallTarget Targets="RunTests;PrintTestRunSummary" RunEachTargetSeparately="True" />
</Target>
<Target Name="RunTests" DependsOnTargets="CheckSkipStrongNames">
<ItemGroup>
<TestDLLsXunit Include="bin\$(Configuration)\test\*.Test.dll;bin\$(Configuration)\test\*.Test.*.dll;bin\$(Configuration)\Test\NetCore\*.Test.dll" />
<XunitProject Include="tools\WebStack.xunit.targets">
<Properties>TestAssembly=%(TestDLLsXunit.FullPath);XmlPath=$(TestResultsDirectory)%(TestDLLsXunit.FileName)-XunitResults.xml</Properties>
</XunitProject>
</ItemGroup>
<!-- Re-create 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="$(BuildInParallel)" Targets="Xunit" />
</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">
<PrintTestRunSummary TestResultsDirectory="$(TestResultsDirectory)" />
</Target>
</Project>