forked from nunit/nunit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NUnitFramework.msbuild
250 lines (234 loc) · 13 KB
/
NUnitFramework.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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" InitialTargets="" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Common Properties">
<ProjectName>$(MSBuildProjectName)</ProjectName>
<PackageVersion>2.9.6</PackageVersion>
<PackageName>$(ProjectName)-$(PackageVersion)</PackageName>
</PropertyGroup>
<PropertyGroup Label="Platform-specific properties">
<IsWindows Condition=" '$(OS)' == 'Windows_NT' ">true</IsWindows>
<IsWindows Condition=" '$(OS)' != 'Windows_NT' ">false</IsWindows>
<RemoveDir Condition="$(IsWindows)">rmdir /s /q</RemoveDir>
<RemoveDir Condition="!$(IsWindows)">rm -rf</RemoveDir>
</PropertyGroup>
<PropertyGroup Label="Project Directories">
<ProjectBaseDir>$(MSBuildProjectDirectory)</ProjectBaseDir>
<ProjectBuildDir>$(ProjectBaseDir)\build</ProjectBuildDir>
<ProjectPackageDir>$(ProjectBaseDir)\package</ProjectPackageDir>
<ProjectSrcDir>$(ProjectBaseDir)\src</ProjectSrcDir>
<ProjectToolsDir>$(ProjectBaseDir)\tools</ProjectToolsDir>
<PartCoverDir>$(ProjectToolsDir)\PartCover</PartCoverDir>
</PropertyGroup>
<PropertyGroup Label="Packaging Directories">
<PackageWorkingDir Condition="'$(PackageWorkingDir)' == ''">$(ProjectPackageDir)\$(PackageName)</PackageWorkingDir>
<PackageBinDir>$(PackageWorkingDir)\bin</PackageBinDir>
<PackageDocDir>$(PackageWorkingDir)\doc</PackageDocDir>
<PackageSamplesDir>$(PackageWorkingDir)\samples</PackageSamplesDir>
<PackageSrcDir>$(PackageWorkingDir)\src</PackageSrcDir>
<PackageLibDir>$(PackageWorkingDir)\lib</PackageLibDir>
</PropertyGroup>
<PropertyGroup Label="Build Configurations">
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<DefaultFramework Condition="$(IsWindows)">net-4.5</DefaultFramework>
<DefaultFramework Condition="!$(IsWindows)">mono-4.0</DefaultFramework>
<Framework Condition="'$(Framework)' == ''">$(DefaultFramework)</Framework>
</PropertyGroup>
<PropertyGroup Condition="'$(Framework)'=='net-4.5'">
<ProjectSuffix>4.5</ProjectSuffix>
<Runtime>NET</Runtime>
</PropertyGroup>
<PropertyGroup Condition="'$(Framework)'=='net-4.0'">
<ProjectSuffix>4.0</ProjectSuffix>
<Runtime>NET</Runtime>
</PropertyGroup>
<PropertyGroup Condition="'$(Framework)'=='net-3.5'">
<ProjectSuffix>3.5</ProjectSuffix>
<Runtime>NET</Runtime>
</PropertyGroup>
<PropertyGroup Condition="'$(Framework)'=='net-2.0'">
<ProjectSuffix>2.0</ProjectSuffix>
<Runtime>NET</Runtime>
</PropertyGroup>
<PropertyGroup Condition="'$(Framework)'=='mono-4.5'">
<ProjectSuffix>4.5</ProjectSuffix>
<Runtime>mono</Runtime>
</PropertyGroup>
<PropertyGroup Condition="'$(Framework)'=='mono-4.0'">
<ProjectSuffix>4.0</ProjectSuffix>
<Runtime>mono</Runtime>
</PropertyGroup>
<PropertyGroup Condition="'$(Framework)'=='mono-3.5'">
<ProjectSuffix>3.5</ProjectSuffix>
<Runtime>mono</Runtime>
</PropertyGroup>
<PropertyGroup Condition="'$(Framework)'=='mono-2.0'">
<ProjectSuffix>2.0</ProjectSuffix>
<Runtime>mono</Runtime>
</PropertyGroup>
<PropertyGroup Condition="'$(Framework)'=='netcf-3.5'">
<ProjectSuffix>netcf-3.5</ProjectSuffix>
<Runtime>netcf</Runtime>
</PropertyGroup>
<PropertyGroup Condition="'$(Framework)'=='netcf-2.0'">
<ProjectSuffix>netcf-2.0</ProjectSuffix>
<Runtime>netcf</Runtime>
</PropertyGroup>
<PropertyGroup Condition="'$(Framework)'=='silverlight-5.0'">
<ProjectSuffix>sl-5.0</ProjectSuffix>
<Runtime>silverlight</Runtime>
</PropertyGroup>
<PropertyGroup Label="Properties for running tests">
<TestOptions Condition="'$(TestOptions)' == ''"></TestOptions>
<ManagedExeLauncher Condition="'$(Runtime)' == 'mono'">mono</ManagedExeLauncher>
<TestRunnerProgram>test-harness.exe</TestRunnerProgram>
<TestRunnerArgs>nunit.framework.tests.dll $(TestOptions)</TestRunnerArgs>
<HarnessSelfTestArgs>--selftest $(TestOptions)</HarnessSelfTestArgs>
</PropertyGroup>
<PropertyGroup>
<ConfigurationBuildDir>$(ProjectBuildDir)\$(Configuration)</ConfigurationBuildDir>
<FrameworkBuildDir>$(ConfigurationBuildDir)\$(Framework)</FrameworkBuildDir>
</PropertyGroup>
<Target Name="DumpSettings">
<Message Text=" "></Message>
<Message Text="Platform-specific properties:"></Message>
<Message Text=" Running on '$(OS)' ('IsWindows' = $(IsWindows))"></Message>
<Message Text=" RemoveDir command: '$(RemoveDir)'"></Message>
<Message Text=" "></Message>
<Message Text="Project directories:"></Message>
<Message Text=" Base: $(ProjectBaseDir)"></Message>
<Message Text=" Build: $(ProjectBuildDir)"></Message>
<Message Text=" Package: $(ProjectPackageDir)"></Message>
<Message Text=" Source: $(ProjectSrcDir)"></Message>
<Message Text=" Tools: $(ProjectToolsDir)"></Message>
<Message Text=" "></Message>
<Message Text="Frameworks:"></Message>
<Message Text=" Default: $(DefaultFramework)"></Message>
<Message Text=" "></Message>
<Message Text="Current build settings:"></Message>
<Message Text=" Configuration: $(Configuration)"></Message>
<Message Text=" Framework: $(Framework)"></Message>
<Message Text=" Runtime: $(Runtime)"></Message>
<Message Text=" Build dir: $(FrameworkBuildDir)"></Message>
<Message Text=" Proj. suffix: $(ProjectSuffix)"></Message>
<Message Text=" "></Message>
<Message Text="Packaging"></Message>
<Message Text=" Name: $(PackageName)"></Message>
<Message Text=" Version: $(PackageVersion)"></Message>
<Message Text=" Work dir: $(PackageWorkingDir)"></Message>
<Message Text=" Bin: $(PackageBinDir)"></Message>
<Message Text=" Source: $(PackageSrcDir)"></Message>
<Message Text=" "></Message>
</Target>
<Target Name="Clean">
<Exec Command="$(RemoveDir) $(FrameworkBuildDir)" Condition="Exists('$(FrameworkBuildDir)')"></Exec>
<Delete Files="$(ProjectSrcDir)\GeneratedAssemblyInfo.cs" Condition="Exists('$(ProjectSrcDir)\GeneratedAssemblyInfo.cs')" />
</Target>
<Target Name="Build">
<CallTarget Targets="_BuildNUnit" Condition="'$(Runtime)' != 'netcf' And '$(Runtime)' != 'silverlight'" />
<CallTarget Targets="_BuildNUnitLite" />
</Target>
<ItemGroup>
<NUnitProject Include="$(ProjectSrcDir)\framework\nunit.framework-$(ProjectSuffix).csproj"></NUnitProject>
<NUnitProject Include="$(ProjectSrcDir)\mock-assembly\mock-nunit-assembly-$(ProjectSuffix).csproj"></NUnitProject>
<NUnitProject Include="$(ProjectSrcDir)\testdata\nunit.testdata-$(ProjectSuffix).csproj"></NUnitProject>
<NUnitProject Include="$(ProjectSrcDir)\tests\nunit.framework.tests-$(ProjectSuffix).csproj"></NUnitProject>
<NUnitProject Include="$(ProjectSrcDir)\harness\test-harness-$(ProjectSuffix).csproj"></NUnitProject>
</ItemGroup>
<ItemGroup>
<NUnitLiteProject Include="$(ProjectSrcDir)\framework\nunitlite-$(ProjectSuffix).csproj"></NUnitLiteProject>
<NUnitLiteProject Include="$(ProjectSrcDir)\mock-assembly\mock-nunitlite-assembly-$(ProjectSuffix).csproj"
Condition="'$(Runtime)' != 'netcf' And '$(Runtime)' != 'silverlight'"></NUnitLiteProject>
<NUnitLiteProject Include="$(ProjectSrcDir)\testdata\nunitlite.testdata-$(ProjectSuffix).csproj"></NUnitLiteProject>
<NUnitLiteProject Include="$(ProjectSrcDir)\tests\nunitlite.tests-$(ProjectSuffix).csproj"></NUnitLiteProject>
</ItemGroup>
<Target Name="_BuildNUnit">
<Error Condition="'$(Runtime)' == 'netcf' Or '$(Runtime)' == 'silverlight'" Text="The full NUnit framework cannot be built for $(Runtime)"></Error>
<MSBuild Targets="Rebuild" Projects="@(NUnitProject)" Properties="Configuration=$(Configuration); OutputPath=$(FrameworkBuildDir); Platform=AnyCPU">
</MSBuild>
</Target>
<Target Name="_BuildNUnitLite">
<MSBuild Targets="Rebuild" Projects="@(NUnitLiteProject)" Properties="Configuration=$(Configuration); OutputPath=$(FrameworkBuildDir); Platform=AnyCPU">
</MSBuild>
</Target>
<Target Name="Test">
<CallTarget Targets="_NUnitTest" Condition="'$(Runtime)' != 'netcf' And '$(Runtime)' != 'silverlight'"></CallTarget>
<CallTarget Targets="_NUnitLiteTest"></CallTarget>
</Target>
<Target Name="_NUnitTest">
<Message Text="Testing NUnitFramework $(Framework) - $(Configuration)"></Message>
<Error Condition="'$(Runtime)' == 'netcf' Or '$(Runtime)' == 'silverlight'" Text="The full NUnit framework cannot be tested under $(Runtime)"></Error>
<Exec WorkingDirectory="$(FrameworkBuildDir)" Command="$(ManagedExeLauncher) $(FrameworkBuildDir)\$(TestRunnerProgram) $(TestRunnerArgs)">
</Exec>
</Target>
<Target Name="_NUnitLiteTest">
<Message Text="Testing NUnitLite $(Framework) - $(Configuration)"></Message>
<Exec WorkingDirectory="$(FrameworkBuildDir)" Command="$(ManagedExeLauncher) $(FrameworkBuildDir)\nunitlite.tests.exe"></Exec>
</Target>
<Target Name="SelfTest" Label="Runs harness tests">
<Message Text="Testing test-harness $(Framework) - $(Configuration)"></Message>
<Exec WorkingDirectory="$(FrameworkBuildDir)" Command="$(ManagedExeLauncher) $(FrameworkBuildDir)\$(TestRunnerProgram) $(HarnessSelfTestArgs)"></Exec>
</Target>
<Target Name="TestCoverage">
<CallTarget Targets="_NUnitCoverage" Condition="'$(Runtime)' != 'netcf'"></CallTarget>
<CallTarget Targets="_NUnitLiteCoverage"></CallTarget>
</Target>
<Target Name="_NUnitCoverage">
<Error Condition="'$(Runtime)' == 'netcf'" Text="The full NUnit framework cannot be tested under $(Runtime)"></Error>
<Exec WorkingDirectory="$(FrameworkBuildDir)"
Command='$(ManagedExeLauncher) $(PartCoverDir)\PartCover.exe --target "$(TestRunnerProgram)" --target-args "$(TestRunnerArgs)" --include [nunit.framework]* --output NUnitTestCoverage.xml'>
</Exec>
</Target>
<Target Name="_NUnitLiteCoverage">
<Exec WorkingDirectory="$(FrameworkBuildDir)"
Command='$(ManagedExeLauncher) $(PartCoverDir)\PartCover.exe --target "$(nunitlite.tests.exe)" --include [nunitlite]* --output NUnitLiteTestCoverage.xml'>
</Exec>
</Target>
<Target Name="Package" Label="Packages the source code and binaries already built" DependsOnTargets="_CreatePackageImage">
<Exec Command='git init "$(PackageWorkingDir)"' />
<Exec WorkingDirectory='$(PackageWorkingDir)' Command='git add -A' />
<Exec WorkingDirectory='$(PackageWorkingDir)' Command='git config user.name "temp"' />
<Exec WorkingDirectory='$(PackageWorkingDir)' Command='git config user.email "[email protected]"' />
<Exec WorkingDirectory='$(PackageWorkingDir)' Command='git commit -m "Export"' />
<Exec WorkingDirectory='$(PackageWorkingDir)' Command='git archive -o "$(ProjectPackageDir)\$(PackageName).zip" HEAD'></Exec>
</Target>
<Target Name="_CleanPackageWorkingDir">
<Exec Command="$(RemoveDir) $(PackageWorkingDir)" Condition="Exists('$(PackageWorkingDir)')"></Exec>
<MakeDir Directories="$(PackageWorkingDir)"></MakeDir>
</Target>
<ItemGroup Label="Files for packaging">
<BinFiles Include="$(ConfigurationBuildDir)\**\*.*"></BinFiles>
<TxtFiles Include="LICENSE.txt;NOTICES.txt"></TxtFiles>
</ItemGroup>
<Target Name="_CreatePackageImage" DependsOnTargets="_CleanPackageWorkingDir">
<!-- Copy root txt files -->
<Copy DestinationFolder="$(PackageWorkingDir)" SourceFiles="@(TxtFiles)"></Copy>
<!-- Copy source in zip format already -->
<Exec Command="git archive -o $(PackageWorkingDir)\src.zip HEAD"></Exec>
<!-- Copy all available binaries -->
<Copy DestinationFiles="@(BinFiles->'$(PackageBinDir)\%(RecursiveDir)%(Filename)%(Extension)')"
SourceFiles="@(BinFiles)"></Copy>
</Target>
<!-- Multiple frameworks -->
<ItemGroup>
<SupportedFrameworks Include="net-4.5"></SupportedFrameworks>
<SupportedFrameworks Include="net-4.0"></SupportedFrameworks>
<SupportedFrameworks Include="net-3.5"></SupportedFrameworks>
<SupportedFrameworks Include="net-2.0"></SupportedFrameworks>
<SupportedFrameworks Include="mono-4.5"></SupportedFrameworks>
<SupportedFrameworks Include="mono-4.0"></SupportedFrameworks>
<SupportedFrameworks Include="mono-3.5"></SupportedFrameworks>
<SupportedFrameworks Include="mono-2.0"></SupportedFrameworks>
<SupportedFrameworks Include="netcf-3.5"></SupportedFrameworks>
<SupportedFrameworks Include="netcf-2.0"></SupportedFrameworks>
<SupportedFrameworks Include="silverlight-5.0"></SupportedFrameworks>
</ItemGroup>
<Target Name="BuildAll">
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="Build" Properties="Framework=%(SupportedFrameworks.Identity)" ContinueOnError="true"></MSBuild>
</Target>
<Target Name="TestAll">
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="Test" Properties="Framework=%(SupportedFrameworks.Identity)" ContinueOnError="true"></MSBuild>
</Target>
<Target Name="CleanAll" DependsOnTargets="Clean">
<Exec Command="$(RemoveDir) $(ProjectBuildDir)" Condition="Exists('$(ProjectBuildDir)')" ></Exec>
</Target>
</Project>