forked from sidecut/log4net
/
default.build
506 lines (490 loc) · 24.1 KB
/
default.build
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
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
<?xml version="1.0" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="log4net" default="compile-all" xmlns="http://tempuri.org/nant-vs.xsd">
<!-- Global project settings -->
<property name="log4net.basedir" value="." />
<property name="project.build.config" value="debug" />
<property name="project.build.package" value="false" />
<property name="package.version" value="1.3.0"/>
<property name="current.assembly" value="log4net"/>
<!-- Include log4net helpers -->
<include buildfile="${log4net.basedir}/src/buildsupport/log4net.include" />
<!-- Targets that should always be executed -->
<call target="set-build-configuration" />
<call target="set-framework-configuration" />
<!-- Targets that check settings -->
<target name="check-htmlhelp-compiler">
<if test="${not property::exists('htmlhelp.compiler')}">
<readregistry
property="htmlhelp.workshop.installroot"
key="SOFTWARE\Microsoft\HTML Help Workshop\InstallDir"
hive="CurrentUser"
failonerror="false" />
<if test="${property::exists('htmlhelp.workshop.installroot')}">
<property
name="htmlhelp.compiler"
value="${htmlhelp.workshop.installroot}/hhc.exe" />
</if>
</if>
<if test="${not property::exists('htmlhelp.compiler')}">
<!-- sysinfo task fails under x64 due to invalid property names - https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1213185&group_id=31650 -->
<sysinfo failonerror="false" />
<property
name="htmlhelp.compiler"
value="${sys.os.folder.programfiles}/HTML Help Worshop/hhc.exe" />
</if>
</target>
<!-- Displays configuration info, usefull for working out why log4net doesn't build -->
<target name="display-setup" depends="check-htmlhelp-compiler">
<!-- .NET Framework 2.0 -->
<if test="${framework::exists('net-2.0')}">
<property name="nant.settings.currentframework" value="net-2.0" />
<call target="display-target-framework" />
</if>
<if test="${not framework::exists('net-2.0')}">
<echo message=".NET Framework 2.0 runtime is not available." />
</if>
<!-- .NET Framework 3.5 -->
<if test="${framework::exists('net-3.5')}">
<property name="nant.settings.currentframework" value="net-3.5" />
<call target="display-target-framework" />
</if>
<if test="${not framework::exists('net-3.5')}">
<echo message=".NET Framework 3.5 runtime is not available." />
</if>
<!-- .NET Framework 4.0 -->
<if test="${framework::exists('net-4.0')}">
<property name="nant.settings.currentframework" value="net-4.0" />
<call target="display-target-framework" />
</if>
<if test="${not framework::exists('net-4.0')}">
<echo message=".NET Framework 4.0 runtime is not available." />
</if>
<!-- .NET Compact Framework 2.0 -->
<if test="${framework::exists('netcf-2.0')}">
<property name="nant.settings.currentframework" value="netcf-2.0" />
<call target="display-target-framework" />
</if>
<if test="${not framework::exists('netcf-2.0')}">
<echo message=".NET Compact Framework 2.0 runtime is not available." />
</if>
<!-- Mono 2.0 -->
<if test="${framework::exists('mono-2.0')}">
<property name="nant.settings.currentframework" value="mono-2.0" />
<call target="display-target-framework" />
</if>
<if test="${not framework::exists('mono-2.0')}">
<echo message="Mono 2.0 runtime is not available." />
</if>
<!-- HTML Help Compiler -->
<echo message="htmlhelp.compiler: ${htmlhelp.compiler}" />
</target>
<target name="display-target-framework">
<echo message="" />
<echo message="----------------------------------------------------------" />
<echo message=" ${framework::get-description(framework::get-target-framework())}" />
<echo message="----------------------------------------------------------" />
<echo message="" />
<echo message="framework : ${framework::get-target-framework()}" />
<echo message="description : ${framework::get-description(framework::get-target-framework())}" />
<if test="${framework::sdk-exists(framework::get-target-framework())}">
<echo message="sdk directory : ${framework::get-sdk-directory(framework::get-target-framework())}" />
</if>
<if test="${not framework::sdk-exists(framework::get-target-framework())}">
<echo message="sdk directory : <not configured/available>" />
</if>
<echo message="framework directory : ${framework::get-framework-directory(framework::get-target-framework())}" />
<echo message="assembly directory : ${framework::get-assembly-directory(framework::get-target-framework())}" />
<echo message="" />
</target>
<!-- Target for setting the package configuration -->
<target name="set-package-configuration">
<property name="current.package.name" value="${project::get-name()}-${package.version}" />
<property name="current.package.src.dir" value="build/${current.package.name}-src" />
<property name="current.package.src.zipfile" value="${project::get-name()}-${package.version}-src.zip" />
<delete dir="${current.package.src.dir}" if="${directory::exists(current.package.src.dir)}" />
<mkdir dir="${current.package.src.dir}" />
<property name="current.package.bin.dir" value="build/${current.package.name}-bin" />
<property name="current.package.bin.zipfile" value="${project::get-name()}-${package.version}-bin.zip" />
<delete dir="${current.package.bin.dir}" if="${directory::exists(current.package.bin.dir)}" />
<mkdir dir="${current.package.bin.dir}" />
</target>
<!-- Target for compiling all build configurations for all runtime configurations -->
<target name="compile-all" description="Compile all build configurations for all runtime configurations"
depends="generate-assembly-description">
<echo message="Compiling all build configurations for all runtime configurations." />
<call target="set-debug-build-configuration" />
<call target="compile-build" />
<call target="set-release-build-configuration" />
<call target="compile-build" />
</target>
<!-- Target for compiling all build configurations for the current runtime configurations -->
<target name="compile-runtime" description="Compile all build configurations for the current target framework">
<echo message="Compiling all build configurations for ${framework::get-description(framework::get-target-framework())}." />
<call target="set-debug-build-configuration" />
<!-- make sure that the runtime properties that rely on build configuration information are refreshed -->
<call target="set-runtime-configuration" />
<call target="compile-${framework::get-target-framework()}" />
<call target="set-release-build-configuration" />
<!-- make sure that the runtime properties that rely on build configuration information are refreshed -->
<call target="set-runtime-configuration" />
<call target="compile-${framework::get-target-framework()}" />
</target>
<!-- Target for compiling all runtime configurations in the current build configuration -->
<target name="compile-build" description="Compile current build configurations for all runtime configurations">
<echo message="Compiling all framework versions for the ${current.build.config} build configuration." />
<!-- NETCF_2_0 -->
<if test="${framework::exists('netcf-2.0')}">
<call target="compile-netcf-2.0" />
</if>
<!-- NET_2_0 -->
<property name="required.target" value="net-2.0"/>
<property name="required.target.name" value=".NET Framework 2.0"/>
<property name="required.target.dir" value="net/2.0"/>
<call target="-compile-or-fail"/>
<!-- NET_3_5 -->
<property name="required.target" value="net-3.5"/>
<property name="required.target.name" value=".NET Framework 3.5"/>
<property name="required.target.dir" value="net/3.5"/>
<call target="-compile-or-fail"/>
<if test="${framework::exists('net-3.5')}">
<call target="compile-net-3.5-cp" />
</if>
<!-- NET_4_0 -->
<property name="required.target" value="net-4.0"/>
<property name="required.target.name" value=".NET Framework 4.0"/>
<property name="required.target.dir" value="net/4.0"/>
<call target="-compile-or-fail"/>
<if test="${framework::exists('net-4.0')}">
<call target="compile-net-4.0-cp" />
</if>
<!-- MONO_2_0 -->
<property name="required.target" value="mono-2.0"/>
<property name="required.target.name" value="Mono 2.0"/>
<property name="required.target.dir" value="mono/2.0"/>
<call target="-compile-or-fail"/>
</target>
<!-- Oh, how I wish NAnt had macros -->
<target name="-compile-or-fail">
<if test="${framework::exists(required.target)}">
<call target="compile-${required.target}" />
</if>
<if test="${not framework::exists(required.target)}">
<if test="${property::exists('project.build.package') and project.build.package and not(directory::exists(path::combine(bin.dir, required.target.dir + '/debug')) and directory::exists(path::combine(bin.dir, required.target.dir + '/release')) and directory::exists(path::combine(bin.dir, required.target.dir + '/oldkey')))}">
<fail message="The ${required.target.name} is not available." />
</if>
<if test="${not(property::exists('project.build.package') and project.build.package)}">
<echo message="The ${required.target.name} is not available. Build skipped." />
</if>
</if>
</target>
<target name="compile" description="Builds the current build configuration for the current target framework." depends="check-current-build-config">
<call target="compile-${framework::get-target-framework()}" />
</target>
<target name="compile-netcf-2.0" description="Builds .NET Compact Framework 2.0 version" depends="set-netcf-2.0-runtime-configuration,-compile-specific-build"/>
<target name="compile-net-2.0" description="Builds .NET Framework 2.0 version" depends="set-net-2.0-runtime-configuration,-compile-specific-build"/>
<target name="compile-net-3.5" description="Builds .NET Framework 3.5 version" depends="set-net-3.5-runtime-configuration,-compile-specific-build"/>
<target name="compile-net-3.5-cp" description="Builds .NET Framework 3.5 Client Profile version" depends="set-net-3.5-cp-runtime-configuration,-compile-specific-build"/>
<target name="compile-net-4.0" description="Builds .NET Framework 4.0 version" depends="set-net-4.0-runtime-configuration,-compile-specific-build"/>
<target name="compile-net-4.0-cp" description="Builds .NET Framework 4.0 Client Profile version" depends="set-net-4.0-cp-runtime-configuration,-compile-specific-build"/>
<target name="compile-mono-2.0" description="Builds Mono 2.0 version" depends="set-mono-2.0-runtime-configuration,-compile-specific-build"/>
<target name="-compile-specific-build" depends="check-log4net-basedir, clean-current-bin-dir">
<property name="current.sources" value="log4net"/>
<property name="current.keyfile" value="log4net.snk"/>
<property name="current.bin.subdir" value=""/>
<property name="warnaserror" value="true"/>
<property name="with.generated.assemblyinfo" value="true"/>
<call target="parameterized-compilation" />
<!-- initialize the temp.build.skip property to false -->
<property name="temp.build.skip" value="false" />
<if test="${current.build.config.release}">
<!-- check if the old log4net key file is available -->
<if test="${not file::exists(log4net.basedir + '/old-log4net.snk')}">
<if test="${property::exists('project.build.package') and project.build.package}">
<fail message="Old key file not found." />
</if>
<if test="${not(property::exists('project.build.package') and project.build.package)}">
<echo message="Old key file not found."/>
<echo message="The release build using the old key will be skipped." />
<property name="temp.build.skip" value="true" />
</if>
</if>
</if>
<if test="${not temp.build.skip}">
<property name="current.keyfile" value="old-log4net.snk"/>
<property name="current.bin.subdir" value="../oldkey/"/>
<call target="parameterized-compilation" />
</if>
</target>
<!-- Target for generating docs for all runtime configurations -->
<target name="generate-sdkdoc-all" depends="check-current-build-config">
<echo message="Generating SDK documentation temporarily disabled." />
<!--
<echo message="Generating SDK documentation based on the ${current.build.config} build configuration for all runtime configurations." />
<if test="${framework::exists('netcf-1.0')}">
<call target="set-netcf-1.0-runtime-configuration" />
<call target="generate-sdkdoc" />
</if>
<if test="${framework::exists('netcf-2.0')}">
<call target="set-netcf-2.0-runtime-configuration" />
<call target="generate-sdkdoc" />
</if>
<if test="${framework::exists('net-1.0')}">
<call target="set-net-1.0-runtime-configuration" />
<call target="generate-sdkdoc" />
</if>
<if test="${framework::exists('net-1.1')}">
<call target="set-net-1.1-runtime-configuration" />
<call target="generate-sdkdoc" />
</if>
-->
<!-- NAnt doesn't yet come with a version of NDoc that can handle .NET 2.0 assemblies -->
<!-- Mono 1.0 does not support extracting xml documentation -->
<!-- SSCLI 1.0 does not support extracting xml documentation -->
</target>
<!-- Target for generating docs for build configurations -->
<target name="generate-sdkdoc-step1" depends="compile, check-htmlhelp-compiler, check-current-sdkdoc-dir, check-current-sdkdoc-debug, clean-current-sdkdoc-dir">
<ndoc>
<assemblies basedir="${current.bin.dir}">
<include name="log4net.dll" />
</assemblies>
<documenters>
<documenter name="MSDN">
<property name="OutputDirectory" value="${current.sdkdoc.dir}" />
<property name="HtmlHelpName" value="log4net-sdk-${framework::get-target-framework()}" />
<!--property name="HtmlHelpCompilerFilename" value="${htmlhelp.compiler}" /-->
<property name="IncludeFavorites" value="true" />
<property name="IncludeHierarchy" value="true" />
<property name="Title" value="Apache log4net™ SDK Documentation - ${framework::get-description(framework::get-target-framework())}" />
<property name="SplitTOCs" value="false" />
<property name="DefaulTOC" value="" />
<property name="ShowVisualBasic" value="true" />
<property name="OmitObjectTags" value="false" />
<property name="RootPageContainsNamespaces" value="false" />
<property name="SortTOCByNamespace" value="true" />
<property name="ShowMissingSummaries" value="${current.sdkdoc.debug}" />
<property name="ShowMissingRemarks" value="${current.sdkdoc.debug}" />
<property name="ShowMissingParams" value="${current.sdkdoc.debug}" />
<property name="ShowMissingReturns" value="${current.sdkdoc.debug}" />
<property name="ShowMissingValues" value="${current.sdkdoc.debug}" />
<property name="DocumentAttributes" value="false" />
<property name="DocumentedAttributes" value="" />
<property name="DocumentInternals" value="false" />
<property name="DocumentPrivates" value="false" />
<property name="DocumentProtected" value="true" />
<property name="DocumentEmptyNamespaces" value="false" />
<property name="SkipNamespacesWithoutSummaries" value="false" />
<property name="AutoPropertyBackerSummaries" value="false" />
<property name="AutoDocumentConstructors" value="true" />
<property name="GetExternalSummaries" value="true" />
<property name="IncludeAssemblyVersion" value="false" />
<property name="FooterHtml" value="<a href='http://logging.apache.org/log4net/'>Copyright 2004-2013 The Apache Software Foundation.</a><br></br>Apache log4net, Apache and log4net are trademarks of The Apache Software Foundation."/>
</documenter>
</documenters>
</ndoc>
</target>
<!-- Remove everything except the help file itself from the current SDK documentation directory -->
<target name="generate-sdkdoc" depends="generate-sdkdoc-step1">
<delete>
<fileset basedir="${current.sdkdoc.dir}">
<include name="**/*" />
<exclude name="**/*.chm" />
</fileset>
</delete>
</target>
<!-- Build the SDK documentation for the website -->
<target name="generate-sdkdoc-for-site"
depends="set-release-build-configuration,generate-sdkdoc-step1">
<mkdir dir="target/site/release/sdk"/>
<copy todir="target/site/release/sdk">
<fileset basedir="${current.sdkdoc.dir}">
<include name="**/*" />
<exclude name="**/*.chm" />
<exclude name="**/*.hh?" />
<exclude name="**/*.log" />
</fileset>
</copy>
</target>
<target name="generate-site">
<property name="mvn" value="mvn"/>
<if test="${platform::is-windows()}">
<property name="mvn" value="mvn.bat"/>
</if>
<exec program="${mvn}" commandline="site:site install"/>
</target>
<target name="package" description="Build and Package distribution">
<!-- set flag to indicating that this is a package build -->
<property name="project.build.package" value="true" />
<call target="set-package-configuration" />
<!-- copies the sources to the current package directory -->
<call target="package-src" />
<!-- compile all build configurations for all runtime configurations -->
<call target="compile-all" />
<!-- generate the sdk docs using the release build configuration for all runtime configuration -->
<call target="set-release-build-configuration" />
<call target="package-bin" />
</target>
<target name="package-src">
<copy todir="${current.package.src.dir}">
<fileset basedir=".">
<include name="KEYS"/>
<include name="LICENSE"/>
<include name="NOTICE"/>
<include name="README.txt"/>
<include name="STATUS.txt"/>
<include name="build.cmd"/>
<include name="log4net.build"/>
<include name="log4net.include"/>
<include name="log4net.snk"/>
<include name="log4net.snk.readme"/>
<include name="old-log4net.snk.gpg"/>
<include name="pom.xml"/>
<include name="examples/**" />
<include name="extensions/**" />
<include name="src/**" />
<include name="tests/**" />
<exclude name="**/*.suo" />
<exclude name="**/bin/**" />
<exclude name="**/build/**" />
<exclude name="**/log4net*.xml" />
<exclude name="**/obj/**" />
<exclude name="**/*.csproj.user" />
<exclude name="**/*.vbproj.user" />
<exclude name="tests/doc/**" />
<exclude name="tests/lib/net/**" />
<exclude name="tests/lib/mono/**" />
<exclude name="tests/lib/netcf/**" />
</fileset>
</copy>
<!-- delete the specified zipfile if it already exists -->
<delete>
<fileset basedir="build">
<include name="${current.package.src.zipfile}" />
</fileset>
</delete>
<zip zipfile="build/${current.package.src.zipfile}" ziplevel="9"
includeemptydirs="true">
<fileset basedir="${current.package.src.dir}"
prefix="${current.package.name}">
<include name="**"/>
</fileset>
</zip>
</target>
<target name="package-bin" depends="generate-sdkdoc-step1,generate-site">
<copy todir="${current.package.bin.dir}">
<fileset basedir=".">
<include name="KEYS"/>
<include name="LICENSE"/>
<include name="NOTICE"/>
<include name="README.txt"/>
<include name="STATUS.txt"/>
<include name="bin/**/release/**"/>
</fileset>
</copy>
<copy todir="${current.package.bin.dir}">
<fileset basedir="${current.sdkdoc.dir}">
<include name="**/*.chm" />
</fileset>
</copy>
<property name="current.package.doc.dir"
value="${current.package.bin.dir}/doc"/>
<mkdir dir="${current.package.doc.dir}/release/sdk"/>
<copy todir="${current.package.doc.dir}/release/sdk">
<fileset basedir="${current.sdkdoc.dir}">
<include name="**/*" />
<exclude name="**/*.chm" />
<exclude name="**/*.hh?" />
<exclude name="**/*.log" />
</fileset>
</copy>
<copy todir="${current.package.doc.dir}">
<fileset basedir="target/site">
<include name="**"/>
</fileset>
</copy>
<delete>
<fileset basedir="build">
<include name="${current.package.bin.dir}-*key.zip" />
</fileset>
</delete>
<zip zipfile="${current.package.bin.dir}-newkey.zip" ziplevel="9">
<fileset basedir="${current.package.bin.dir}"
prefix="${current.package.name}">
<include name="**"/>
</fileset>
</zip>
<!-- binary dist with old strong name key -->
<foreach item="Folder" property="platform-and-version">
<in>
<items>
<include name="bin/*/*"/>
</items>
</in>
<do>
<copy todir="${current.package.bin.dir}/${string::replace(platform-and-version, project::get-base-directory(), '')}/release"
overwrite="true">
<fileset basedir="${platform-and-version}/oldkey">
<include name="**"/>
</fileset>
</copy>
</do>
</foreach>
<zip zipfile="${current.package.bin.dir}-oldkey.zip" ziplevel="9">
<fileset basedir="${current.package.bin.dir}"
prefix="${current.package.name}">
<include name="**"/>
</fileset>
</zip>
</target>
<target name="generate-assembly-description">
<if test="${not(property::exists('source.svn.revision'))}">
<property name="source.svn.revision" value="0"/>
<property name="source.svn.url" value=""/>
<property name="assembly.description"
value="The Apache Software Foundation log4net Logging Framework"/>
<if test="${directory::exists('.svn') or directory::exists('../.svn') or directory::exists('../../.svn')}">
<exec program="svn" workingdir="." verbose="false"
output="_svnrevision.xml" failonerror="true" >
<arg value="info" />
<arg line="--xml" />
</exec>
<sleep milliseconds="500" />
<xmlpeek file="_svnrevision.xml"
xpath="/info/entry/@revision"
property="source.svn.revision"
failonerror="true"/>
<xmlpeek file="_svnrevision.xml"
xpath="/info/entry/url"
property="source.svn.url"
failonerror="true"/>
<delete file="_svnrevision.xml"/>
<property name="assembly.description"
value="The Apache Software Foundation log4net Logging Framework built from svn revision ${source.svn.revision} of ${source.svn.url}"/>
</if>
<delete file="${generated.src.dir}/GeneratedAssemblyInfo.cs"/>
<mkdir dir="${generated.src.dir}"/>
<asminfo language="CSharp" output="${generated.src.dir}/GeneratedAssemblyInfo.cs">
<imports>
<import namespace="System.Reflection"/>
</imports>
<attributes>
<attribute type="AssemblyDescriptionAttribute"
value="${assembly.description}"/>
</attributes>
</asminfo>
</if>
</target>
</project>