forked from spring-attic/spring-net-rest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpring.Rest.build
More file actions
442 lines (404 loc) · 22.1 KB
/
Spring.Rest.build
File metadata and controls
442 lines (404 loc) · 22.1 KB
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
<?xml version="1.0" ?>
<project name="Spring.Rest" default="build" xmlns="http://nant.sf.net/release/0.91/nant.xsd">
<property name="datetime.now" value="${datetime::now()}" />
<property name="root.dir" value="${project::get-base-directory()}" />
<property name="deploy.dir" value="${root.dir}\..\deploy" />
<property name="build.dir" value="${root.dir}\build" />
<property name="package.dir" value="${build.dir}\package" />
<property name="bin.dir" value="${root.dir}\bin" />
<property name="doc.dir" value="${root.dir}\doc" />
<property name="tools.dir" value="${root.dir}\tools" />
<property name="setup.dir" value="${root.dir}\setup" />
<property name="product.name" value="Spring.NET REST Client Framework" />
<property name="product.company" value="SpringSource" />
<property name="product.copyright" value="Copyright ${datetime::get-year(datetime.now)} ${product.company}" />
<property name="product.url" value="http://www.springframework.net/" />
<property name="product.description" value="Simplifies communication with HTTP servers, and enforces RESTful principles" />
<property name="product.version" value="1.2.0" />
<!-- alpha / beta# / rc# -->
<property name="product.releasetype" value="" />
<property name="product.fullname" value="${product.name} ${product.version}" if="${(product.releasetype == '')}" />
<property name="product.fullname" value="${product.name} ${product.version} (${product.releasetype})" if="${(product.releasetype != '')}" />
<property name="project.buildnumber" value="${math::abs(math::floor(timespan::get-total-days(datetime::now() - datetime::parse('9/01/2012'))))}" />
<property name="project.version" value="${product.version}.${project.buildnumber}" />
<property name="project.buildtype" value="dev" />
<property name="project.sign" value="false" overwrite="false" />
<if test="${project.sign and not(file::exists(root.dir + '/Spring.Net.snk'))}">
<fail message="project.sign='true' but keyfile ${root.dir+'/Spring.Net.snk'} is missing" />
</if>
<readregistry property="net40.install.dir" key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\InstallPath" hive="LocalMachine" failonerror="true" />
<property name="msbuild.exe" value="${net40.install.dir}\msbuild.exe" />
<!-- MAIN TARGETS -->
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${bin.dir}" />
</target>
<target name="ncoverexplorer" depends="clean">
<property name="product.fullname.temp" value="${product.fullname}"/>
<property name="project.buildconfiguration" value="Debug" />
<call target="build-net-3.5" />
<exec program="${tools.dir}/NCoverExplorer/NCoverExplorer.exe" workingdir="${project.buildoutputdir}">
<arg path="${project.buildoutputdir}/Spring.Rest.Tests.dll-TestCoverage.xml" />
</exec>
</target>
<target name="build" depends="clean">
<echo message="NAnt current .NET Framework = ${nant.settings.currentframework}" />
<property name="product.fullname.temp" value="${product.fullname}"/>
<copy file="${root.dir}\src\CommonAssemblyInfo.cs" tofile="${root.dir}\src\CommonAssemblyInfo.cs.temp" />
<property name="project.buildconfiguration" value="Debug" />
<call target="build-all" />
<property name="project.buildconfiguration" value="Release" />
<call target="build-all" />
<copy file="${root.dir}\src\CommonAssemblyInfo.cs.temp" tofile="${root.dir}\src\CommonAssemblyInfo.cs" overwrite="true" />
<delete file="${root.dir}\src\CommonAssemblyInfo.cs.temp" />
</target>
<target name="daily">
<property name="project.buildtype" value="daily" />
<property name="product.fullname" value="${product.name} (Daily build from ${datetime::get-month(datetime.now)}/${datetime::get-day(datetime.now)}/${datetime::get-year(datetime.now)})" />
<property name="project.zip-filename" value="Spring.Rest-${datetime::get-year(datetime.now)}${string::pad-left(datetime::get-month(datetime.now), 2, '0')}${string::pad-left(datetime::get-day(datetime.now), 2, '0')}-${string::pad-left(datetime::get-hour(datetime.now), 2, '0')}${string::pad-left(datetime::get-minute(datetime.now), 2, '0')}.zip" />
<call target="package-deploy"/>
</target>
<target name="release">
<property name="project.buildtype" value="release" />
<property name="project.zip-filename" value="Spring.Rest-${product.version}.zip" if="${(product.releasetype == '')}" />
<property name="project.zip-filename" value="Spring.Rest-${product.version}-${product.releasetype}.zip" if="${(product.releasetype != '')}" />
<call target="package-deploy"/>
<call target="nuget-deploy"/>
</target>
<!-- TARGETS -->
<target name="update-common-assemblyinfo">
<echo message="Generating common AssemblyInfo file..." />
<!-- ensure src/CommonAssemblyInfo.cs is writable if it already exists -->
<attrib file="${root.dir}\src\CommonAssemblyInfo.cs" readonly="false" if="${file::exists('${root.dir}\src\CommonAssemblyInfo.cs')}" />
<!-- generate the source file holding the common assembly-level attributes -->
<asminfo output="${root.dir}\src\CommonAssemblyInfo.cs" language="CSharp">
<imports>
<import namespace="System" />
<import namespace="System.Reflection" />
<import namespace="System.Runtime.InteropServices" />
</imports>
<attributes>
<attribute type="CLSCompliantAttribute" value="true" />
<attribute type="ComVisibleAttribute" value="false" />
<attribute type="AssemblyProductAttribute" value="${product.fullname}" />
<attribute type="AssemblyCompanyAttribute" value="${product.url}" />
<attribute type="AssemblyCopyrightAttribute" value="${product.copyright}" />
<attribute type="AssemblyTrademarkAttribute" value="Apache License, Version 2.0" />
<attribute type="AssemblyCultureAttribute" value="" />
<attribute type="AssemblyVersionAttribute" value="${project.version}" />
<attribute type="AssemblyConfigurationAttribute" value="${project.framework}; ${project.version}; ${project.buildtype}" />
</attributes>
</asminfo>
</target>
<target name="build-all">
<call target="build-net-2.0" />
<call target="build-net-3.5" />
<call target="build-net-4.0" />
<!--<call target="build-net-4.5" />-->
<call target="build-cf-3.5" />
<call target="build-sl-3.0" />
<call target="build-sl-4.0" />
<call target="build-sl-5.0" />
<call target="build-wp-7.0" />
<call target="build-wp-7.1" />
</target>
<target name="build-net-2.0">
<echo message="Building for .NET 2.0 with '${project.buildconfiguration}' configuration" />
<property name="product.fullname" value="${product.fullname.temp} for .NET 2.0" />
<property name="project.framework" value="net-2.0"/>
<property name="project.version" value="${product.version}.${project.buildnumber}20" />
<property name="project.buildoutputdir" value="${bin.dir}\net\2.0\${project.buildconfiguration}" />
<property name="project.buildsolutionfile" value="${root.dir}\Spring.Rest.2008-NET20.sln" />
<call target="update-common-assemblyinfo" />
<call target="rebuild-solution"/>
<call target="test-assemblies"/>
</target>
<target name="build-net-3.5">
<echo message="Building for .NET 3.5 with '${project.buildconfiguration}' configuration" />
<property name="product.fullname" value="${product.fullname.temp} for .NET 3.5" />
<property name="project.framework" value="net-3.5"/>
<property name="project.version" value="${product.version}.${project.buildnumber}35" />
<property name="project.buildoutputdir" value="${bin.dir}\net\3.5\${project.buildconfiguration}" />
<property name="project.buildsolutionfile" value="${root.dir}\Spring.Rest.2008-NET35.sln" />
<call target="update-common-assemblyinfo" />
<call target="rebuild-solution"/>
<call target="testcover-assemblies"/>
</target>
<target name="build-net-4.0">
<echo message="Building for .NET 4.0 with '${project.buildconfiguration}' configuration" />
<property name="product.fullname" value="${product.fullname.temp} for .NET 4.0" />
<property name="project.framework" value="net-4.0"/>
<property name="project.version" value="${product.version}.${project.buildnumber}40" />
<property name="project.buildoutputdir" value="${bin.dir}\net\4.0\${project.buildconfiguration}" />
<property name="project.buildsolutionfile" value="${root.dir}\Spring.Rest.2010-NET40.sln" />
<call target="update-common-assemblyinfo" />
<call target="rebuild-solution"/>
<call target="test-assemblies"/>
</target>
<target name="build-net-4.5">
<echo message="Building for .NET 4.5 with '${project.buildconfiguration}' configuration" />
<property name="product.fullname" value="${product.fullname.temp} for .NET 4.5" />
<property name="project.framework" value="net-4.5"/>
<property name="project.version" value="${product.version}.${project.buildnumber}45" />
<property name="project.buildoutputdir" value="${bin.dir}\net\4.5\${project.buildconfiguration}" />
<property name="project.buildsolutionfile" value="${root.dir}\Spring.Rest.2012-NET45.sln" />
<call target="update-common-assemblyinfo" />
<call target="rebuild-solution"/>
<!--<call target="test-assemblies"/>-->
</target>
<target name="build-cf-3.5">
<echo message="Building for .NET Compact Framework 3.5 with '${project.buildconfiguration}' configuration" />
<property name="product.fullname" value="${product.fullname.temp} for .NET Compact Framework 3.5" />
<property name="project.framework" value="cf-3.5"/>
<property name="project.version" value="${product.version}.${project.buildnumber}35" />
<property name="project.buildoutputdir" value="${bin.dir}\cf\3.5\${project.buildconfiguration}" />
<property name="project.buildsolutionfile" value="${root.dir}\Spring.Rest.2008-CF35.sln" />
<call target="update-common-assemblyinfo" />
<call target="rebuild-solution"/>
<!--<call target="test-assemblies"/>-->
</target>
<target name="build-sl-3.0">
<echo message="Building for Silverlight 3.0 with '${project.buildconfiguration}' configuration" />
<property name="product.fullname" value="${product.fullname.temp} for Silverlight 3.0" />
<property name="project.framework" value="sl-3.0"/>
<property name="project.version" value="${product.version}.${project.buildnumber}30" />
<property name="project.buildoutputdir" value="${bin.dir}\sl\3.0\${project.buildconfiguration}" />
<property name="project.buildsolutionfile" value="${root.dir}\Spring.Rest.2008-SL30.sln" />
<call target="update-common-assemblyinfo" />
<call target="rebuild-solution"/>
<!--<call target="test-assemblies"/>-->
</target>
<target name="build-sl-4.0">
<echo message="Building for Silverlight 4.0 with '${project.buildconfiguration}' configuration" />
<property name="product.fullname" value="${product.fullname.temp} for Silverlight 4.0" />
<property name="project.framework" value="sl-4.0"/>
<property name="project.version" value="${product.version}.${project.buildnumber}40" />
<property name="project.buildoutputdir" value="${bin.dir}\sl\4.0\${project.buildconfiguration}" />
<property name="project.buildsolutionfile" value="${root.dir}\Spring.Rest.2010-SL40.sln" />
<call target="update-common-assemblyinfo" />
<call target="rebuild-solution"/>
<!--<call target="test-assemblies"/>-->
</target>
<target name="build-sl-5.0">
<echo message="Building for Silverlight 5.0 with '${project.buildconfiguration}' configuration" />
<property name="product.fullname" value="${product.fullname.temp} for Silverlight 5.0" />
<property name="project.framework" value="sl-5.0"/>
<property name="project.version" value="${product.version}.${project.buildnumber}50" />
<property name="project.buildoutputdir" value="${bin.dir}\sl\5.0\${project.buildconfiguration}" />
<property name="project.buildsolutionfile" value="${root.dir}\Spring.Rest.2010-SL50.sln" />
<call target="update-common-assemblyinfo" />
<call target="rebuild-solution"/>
<!--<call target="test-assemblies"/>-->
</target>
<target name="build-wp-7.0">
<echo message="Building for Windows Phone 7.0 with '${project.buildconfiguration}' configuration" />
<property name="product.fullname" value="${product.fullname.temp} for Windows Phone 7.0" />
<property name="project.framework" value="wp-7.0"/>
<property name="project.version" value="${product.version}.${project.buildnumber}70" />
<property name="project.buildoutputdir" value="${bin.dir}\wp\7.0\${project.buildconfiguration}" />
<property name="project.buildsolutionfile" value="${root.dir}\Spring.Rest.2010-WP70.sln" />
<call target="update-common-assemblyinfo" />
<call target="rebuild-solution"/>
<!--<call target="test-assemblies"/>-->
</target>
<target name="build-wp-7.1">
<echo message="Building for Windows Phone 7.1 with '${project.buildconfiguration}' configuration" />
<property name="product.fullname" value="${product.fullname.temp} for Windows Phone 7.1" />
<property name="project.framework" value="wp-7.1"/>
<property name="project.version" value="${product.version}.${project.buildnumber}71" />
<property name="project.buildoutputdir" value="${bin.dir}\wp\7.1\${project.buildconfiguration}" />
<property name="project.buildsolutionfile" value="${root.dir}\Spring.Rest.2010-WP71.sln" />
<call target="update-common-assemblyinfo" />
<call target="rebuild-solution"/>
<!--<call target="test-assemblies"/>-->
</target>
<target name="doc">
<echo message="Generating reference documentation" />
<nant buildfile="${doc.dir}/reference/docbook.build" target="all" />
<echo message="Generating API documentation" />
<nant buildfile="${doc.dir}/api/sandcastle.build" target="all" />
</target>
<target name="package" depends="build,doc" description="Builds all modules and documentation">
<!-- Copy release files -->
<!-- Copy binaries -->
<copy todir="${package.dir}\bin">
<fileset basedir="${bin.dir}">
<include name="**\Spring.Rest.dll"/>
<include name="**\Spring.Rest.pdb"/>
<include name="**\Spring.Rest.xml"/>
<include name="**\Spring.Rest.Testing.dll"/>
<include name="**\Spring.Rest.Testing.pdb"/>
<include name="**\Spring.Rest.Testing.xml"/>
<include name="**\Spring.Http.Converters.*.dll"/>
<include name="**\Spring.Http.Converters.*.pdb"/>
<include name="**\Spring.Http.Converters.*.xml"/>
<include name="**\Newtonsoft.Json*.dll"/>
<include name="**\Newtonsoft.Json*.pdb"/>
<include name="**\Newtonsoft.Json*.xml"/>
<include name="**\Common.Logging.dll"/>
<include name="**\Common.Logging.xml"/>
</fileset>
</copy>
<!-- Copy sources -->
<copy todir="${package.dir}">
<fileset basedir="${root.dir}">
<include name="*.sln"/>
<include name="readme.txt"/>
<include name="changelog.txt"/>
<include name="breaking-changes.txt"/>
<include name="license.txt"/>
<include name="examples\**"/>
<include name="lib\**"/>
<include name="src\**"/>
<include name="test\**"/>
<exclude name="*.snk"/>
<exclude name="**\.git*"/>
<exclude name="**\*.build"/>
<exclude name="**\*.bat"/>
<exclude name="**\*.suo"/>
<exclude name="**\*.user"/>
<exclude name="**\*.cache"/>
<exclude name="**\*.xap"/>
<exclude name="src\Spring.Rest\Spring.Rest.xml"/>
<exclude name="src\Spring.Rest.Testing\Spring.Rest.Testing.xml"/>
<exclude name="src\Spring.Http.Converters.*\Spring.Http.Converters.*.xml"/>
<exclude name="src\**\bin\**"/>
<exclude name="src\**\obj\**"/>
<exclude name="test\**\bin\**"/>
<exclude name="test\**\obj\**"/>
<exclude name="examples\**\bin\**"/>
<exclude name="examples\**\obj\**"/>
</fileset>
</copy>
<!-- Copy docs -->
<copy todir="${package.dir}\doc\reference">
<fileset basedir="${doc.dir}\reference\target">
<include name="**\*" />
</fileset>
</copy>
<copy todir="${package.dir}\doc\api">
<fileset basedir="${doc.dir}\api\target">
<include name="**\*.chm" />
</fileset>
</copy>
</target>
<target name="nuget">
<if test="${not(directory::exists(bin.dir))}">
<fail message="'bin' directory is missing. Call 'build', 'daily' or 'release' target first." />
</if>
<echo message="Generating NuGet package..." />
<if test="${property::exists('product.version')}">
<xmlpoke file="${setup.dir}\NuGet\src\Spring.Rest.nuspec" xpath="/n:package/n:metadata/n:version" value="${product.version}">
<namespaces>
<namespace prefix="n" uri="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" />
</namespaces>
</xmlpoke>
<xmlpoke file="${setup.dir}\NuGet\src\Spring.Rest.Testing.nuspec" xpath="/n:package/n:metadata/n:version" value="${product.version}">
<namespaces>
<namespace prefix="n" uri="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" />
</namespaces>
</xmlpoke>
<xmlpoke file="${setup.dir}\NuGet\src\Spring.Http.Converters.NJson.nuspec" xpath="/n:package/n:metadata/n:version" value="${product.version}">
<namespaces>
<namespace prefix="n" uri="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" />
</namespaces>
</xmlpoke>
</if>
<mkdir dir="${build.dir}"/>
<exec program="${setup.dir}\NuGet\lib\NuGet.exe" workingdir="${build.dir}" verbose="true">
<arg value="pack" />
<arg value="${setup.dir}\NuGet\src\Spring.Rest.nuspec" />
</exec>
<exec program="${setup.dir}\NuGet\lib\NuGet.exe" workingdir="${build.dir}" verbose="true">
<arg value="pack" />
<arg value="${setup.dir}\NuGet\src\Spring.Rest.Testing.nuspec" />
</exec>
<exec program="${setup.dir}\NuGet\lib\NuGet.exe" workingdir="${build.dir}" verbose="true">
<arg value="pack" />
<arg value="${setup.dir}\NuGet\src\Spring.Http.Converters.NJson.nuspec" />
</exec>
</target>
<target name="package-deploy" depends="package" description="Deploy Package distribution as .zip file">
<echo message="Zipping package..." />
<zip zipfile="${deploy.dir}\${project.zip-filename}">
<fileset basedir="${package.dir}">
<include name="**\*" />
<exclude name="*.zip" />
</fileset>
</zip>
</target>
<target name="nuget-deploy" depends="nuget">
<copy todir="${deploy.dir}">
<fileset basedir="${build.dir}">
<include name="*.nupkg" />
</fileset>
</copy>
</target>
<target name="rebuild-solution" description="Rebuilds a given solution file">
<echo message="Rebuilding solution '${project.buildsolutionfile}'" />
<exec program="${msbuild.exe}">
<arg value="${project.buildsolutionfile}"/>
<arg value="/nologo" />
<arg value="/target:Rebuild" />
<arg value="/verbosity:minimal" />
<arg value="/property:OutDir=${project.buildoutputdir}/"/>
<arg value="/property:Configuration=${project.buildconfiguration}" />
<arg value="/property:DefineExtraConstants=STRONG" if="${project.sign}" />
<arg value="/property:SignAssembly=true" if="${project.sign}" />
<arg value="/property:AssemblyOriginatorKeyFile=..\..\Spring.Net.snk" if="${project.sign}" />
</exec>
</target>
<target name="test-assemblies" description="Unit tests given assemblies">
<echo message="Unit testing in '${project.buildoutputdir}'" />
<foreach item="File" property="filename">
<in>
<items basedir="${project.buildoutputdir}">
<include name="**\*.Tests.dll" />
</items>
</in>
<do>
<property name="test.assemblyname" value="${path::get-file-name(filename)}" />
<exec program="${tools.dir}\NUnit\bin\net-2.0\nunit-console-x86.exe" workingdir="${project.buildoutputdir}" verbose="true">
<arg line="${test.assemblyname}" />
<arg value="/xml:${test.assemblyname}-TestResults.xml" />
<arg value="/nologo" />
<arg value="/noshadow" />
<arg value="/framework:${project.framework}" />
</exec>
</do>
</foreach>
</target>
<target name="testcover-assemblies" description="Code coverage given assemblies">
<echo message="Coverage Testing in '${project.buildoutputdir}'" />
<foreach item="File" property="filename">
<in>
<items basedir="${project.buildoutputdir}">
<include name="**\*.Tests.dll" />
</items>
</in>
<do>
<property name="test.assemblyname" value="${path::get-file-name(filename)}" />
<property name="src.assemblyname" value="${string::substring(test.assemblyname,0,string::last-index-of(test.assemblyname, '.Tests') )}" />
<exec program="${tools.dir}/NCover/ncover.console.exe" workingdir="${project.buildoutputdir}" verbose="true">
<arg value="//q" />
<arg value="//reg" />
<arg value="//w" />
<arg path="${project.buildoutputdir}" />
<arg value="//x" />
<arg path="${project.buildoutputdir}/${test.assemblyname}-TestCoverage.xml" />
<arg value="//a" />
<arg value="${src.assemblyname}" />
<arg value="//ea" />
<arg value="CoverageExcludeAttribute" />
<arg value="//q" />
<arg path="${tools.dir}\NUnit\bin\net-2.0\nunit-console-x86.exe" />
<arg line="${test.assemblyname}" />
<arg value="/xml:${test.assemblyname}-TestResults.xml" />
<arg value="/nologo" />
<arg value="/noshadow" />
<arg value="/framework:${project.framework}" />
</exec>
</do>
</foreach>
</target>
</project>