forked from ccnet/CruiseControl.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ccnet.build
277 lines (234 loc) · 14.3 KB
/
ccnet.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
<?xml version="1.0" encoding="utf-8"?>
<project name="CruiseControl.NET" default="showHelp" xmlns="http://nant.sf.net/release/0.86-beta1/nant.xsd">
<!-- properties -->
<property name="nant.verbosity" overwrite="false" value="false" />
<property name="build.configuration" overwrite="false" value="Build" />
<property name="build.target" overwrite="false" value="Build" />
<property name="build.project" overwrite="false" value="ccnet.sln" />
<property name="build.target.framework" overwrite="false" value="4.0" />
<property name="CCNetLabel" overwrite="false" value="0.0.0.0" />
<property name="codemetrics.output.type" overwrite="false" value="XmlFile" />
<!-- common path properties -->
<property name="src.dir" readonly="true" value="${path::get-full-path('project')}" />
<property name="build.dir" readonly="true" value="${path::get-full-path('Build')}" />
<property name="build.metrics.dir" readonly="true" value="${path::get-full-path('BuildMetrics')}" />
<property name="publish.dir" readonly="true" value="${path::get-full-path('Publish')}" />
<property name="dist.dir" readonly="true" value="${path::get-full-path('Dist')}" />
<property name="tools.dir" readonly="true" value="${path::get-full-path('Tools')}" />
<property name="gendarme.project" overwrite="false" value="${path::combine(src.dir, 'gendarme.assemblies.txt')}" />
<property name="ndepend.project" overwrite="false" value="${path::combine(src.dir, 'NDependProject.xml')}" />
<property name="fxcop.project" overwrite="false" value="${path::combine(src.dir, 'CruiseControl.NET.FxCop')}" />
<!-- tool path properties -->
<property name="nauckit.nant.assembly" readonly="true" value="${path::combine( path::combine(tools.dir, 'NAnt'), 'NauckIT.NAnt.dll')}" />
<property name="ra.nant.assembly" readonly="true" value="${path::combine( path::combine(tools.dir, 'NAnt'), 'Ra.Build.Tasks.dll')}" />
<property name="gendarme.executable" readonly="true" value="${path::combine( path::combine(tools.dir, 'Gendarme'), 'gendarme.exe')}" />
<property name="ndepend.executable" readonly="true" value="${path::combine( path::combine(tools.dir, 'NDepend'), 'NDepend.Console.exe')}" />
<property name="fxcop.executable" readonly="true" value="${path::combine( path::combine(tools.dir, 'FxCop'), 'FxCopCmd.exe')}" />
<property name="nunit.executable" readonly="true" value="${path::combine( path::combine(tools.dir, 'NUnit'), 'nunit-console.exe')}" />
<property name="nsis.executable" readonly="true" value="${path::combine( path::combine(tools.dir, 'NSIS'), 'makensis.exe')}" />
<!-- common assembly info properties -->
<property name="assembly.company" readonly="true" value="ThoughtWorks Inc." />
<property name="assembly.product" readonly="true" value="CruiseControl.NET" />
<property name="assembly.copyright" readonly="true" value="Copyright © 2003 - ${datetime::get-year(datetime::now())} ${assembly.company}" />
<property name="assembly.trademark" readonly="true" value="" />
<property name="assembly.version" readonly="true" value="${CCNetLabel}" />
<property name="assembly.fileversion" readonly="true" value="${CCNetLabel}" />
<property name="LastChangeNumber" unless="${property::exists('LastChangeNumber')}" value="0000000000000000000000000000000000000000" />
<!-- Framework Support
http://nant.sourceforge.net/faq.html#framework-support
-->
<property name="nant.settings.currentframework" value="${framework::get-family(nant.settings.currentframework)}-${build.target.framework}" />
<!-- Includes -->
<include buildfile="${path::combine(tools.dir, 'ccnet-packaging.inc.build')}" />
<include buildfile="${path::combine(tools.dir, 'ccnet-help.inc.build')}" />
<include buildfile="${path::combine(tools.dir, 'ccnet-utils.inc.build')}" />
<include buildfile="${path::combine(tools.dir, 'ccnet-packaging-webdashboard-packages.inc.build')}" />
<!-- Targets -->
<target name="all" depends="clean, init, build, runTests, runCodeMetrics, package" description="" />
<target name="ClearDocFolders" description="Clearing doc folder of all existing files.">
<echo message="Clearing doc folder of all existing files ... " />
<delete includeemptydirs="false" >
<fileset>
<patternset >
<include name="doc/CCNET/**" />
<exclude name="**/.svn/**" />
<exclude name="**/_svn/**" />
</patternset>
</fileset>
</delete>
</target>
<target name="clean" description="Clean up">
<delete dir="${build.dir}" if="${directory::exists(build.dir)}" verbose="${nant.verbosity}" />
<delete dir="${publish.dir}" if="${directory::exists(publish.dir)}" verbose="${nant.verbosity}" />
<delete dir="${dist.dir}" if="${directory::exists(dist.dir)}" verbose="${nant.verbosity}" />
<delete verbose="${nant.verbosity}">
<fileset basedir="." failonempty="false">
<include name="*.nsi"/>
</fileset>
</delete>
</target>
<target name="init" description="Initial compilation setup">
<mkdir dir="${build.dir}" unless="${directory::exists(build.dir)}" verbose="${nant.verbosity}" />
<mkdir dir="${build.metrics.dir}" unless="${directory::exists(build.metrics.dir)}" verbose="${nant.verbosity}" />
<mkdir dir="${publish.dir}" unless="${directory::exists(publish.dir)}" verbose="${nant.verbosity}" />
<mkdir dir="${dist.dir}" unless="${directory::exists(dist.dir)}" verbose="${nant.verbosity}" />
</target>
<target name="createAssemblyInfo" description="Create an assembly info file with the current build number">
<asminfo language="CSharp" output="${path::combine(src.dir, 'CommonAssemblyInfo.cs')}" verbose="${nant.verbosity}">
<imports>
<import namespace="System.Reflection" />
</imports>
<attributes>
<attribute type="AssemblyCompanyAttribute" value="${assembly.company}" />
<attribute type="AssemblyProductAttribute" value="${assembly.product}" />
<attribute type="AssemblyCopyrightAttribute" value="${assembly.copyright}" />
<attribute type="AssemblyTrademarkAttribute" value="${assembly.trademark}" />
<attribute type="AssemblyVersionAttribute" value="${assembly.version}" />
<attribute type="AssemblyFileVersionAttribute" value="${assembly.fileversion}" />
<attribute type="AssemblyInformationalVersionAttribute" value="Git hash : ${LastChangeNumber}" />
</attributes>
</asminfo>
</target>
<target name="build" depends="init, createAssemblyInfo" description="Compilation of the build project">
<loadtasks assembly="${nauckit.nant.assembly}" />
<echo message="Build configuration: ${build.configuration}" />
<echo message="Source Directory: ${src.dir}" />
<echo message="Build Directory: ${build.dir}" />
<msbuild projectFile="${path::combine(src.dir, build.project)}" targets="${build.target}" verbosity="Minimal">
<property name="Configuration" value="${build.configuration}" />
<!-- This is a hack until CCTrayLib uses plugins for Windows only stuff -->
<property name="DISABLE_COM" value="${platform::is-unix()}" />
<!-- Microsoft.JScript was deprecated and removed in mono in 2010 -->
<!-- https://github.com/mono/mono/commit/2d66a50bc6df7497e1426d693395906d31f0e490 -->
<property name="DISABLE_JSCRIPT" value="${framework::get-family(nant.settings.currentframework) == 'mono'}" />
<!-- Hack for current xbuild issues on Mono 2.5 -->
<environment>
<variable name="MONO_IOMAP" value="all" if="${framework::get-family(nant.settings.currentframework) == 'mono'}" />
<variable name="MONO_PATH" value="${path::get-full-path('lib')}" if="${framework::get-family(nant.settings.currentframework) == 'mono'}" />
</environment>
</msbuild>
<!-- copy ccnet.config into the server dictionary -->
<copy file="${path::combine( path::combine(src.dir, 'service'), 'ccnet.config')}" tofile="${path::combine( path::combine(build.dir, 'Server'), 'ccnet.config')}" verbose="${nant.verbosity}"/>
</target>
<!-- Test targets -->
<target name="runTests" depends="build" description="Run unit tests">
<call target="runNUnitTests" cascade="false" />
</target>
<target name="runNUnitTests" depends="build" description="Run the NUnit tests">
<loadtasks assembly="${nauckit.nant.assembly}" />
<!-- Hack to copy all required files into the UnitTest dictionary until xbuild on Mono 2.5 is fixed -->
<if test="${framework::get-family(nant.settings.currentframework) == 'mono'}">
<copy todir ="${path::combine(build.dir, 'UnitTests')}" overwrite="true" verbose="${nant.verbosity}">
<fileset basedir="${path::combine(build.dir, 'CCTray')}" failonempty="true">
<include name="*/**" />
</fileset>
</copy>
<copy todir ="${path::combine(build.dir, 'UnitTests')}" overwrite="true" verbose="${nant.verbosity}">
<fileset basedir="${path::combine(build.dir, 'Core')}" failonempty="true">
<include name="*/**" />
</fileset>
</copy>
<copy todir ="${path::combine(build.dir, 'UnitTests')}" overwrite="true" verbose="${nant.verbosity}">
<fileset basedir="${path::combine(build.dir, 'Objection')}" failonempty="true">
<include name="*/**" />
</fileset>
</copy>
<copy todir ="${path::combine(build.dir, 'UnitTests')}" overwrite="true" verbose="${nant.verbosity}">
<fileset basedir="${path::combine(build.dir, 'Remote')}" failonempty="true">
<include name="*/**" />
</fileset>
</copy>
<copy todir ="${path::combine(build.dir, 'UnitTests')}" overwrite="true" verbose="${nant.verbosity}">
<fileset basedir="${path::combine(build.dir, 'Server')}" failonempty="true">
<include name="*/**" />
</fileset>
</copy>
<copy todir ="${path::combine(build.dir, 'UnitTests')}" overwrite="true" verbose="${nant.verbosity}">
<fileset basedir="${path::combine(build.dir, 'WebDashboard')}" failonempty="true">
<include name="*/**" />
</fileset>
</copy>
<copy todir ="${path::combine(build.dir, 'UnitTests')}" overwrite="true" verbose="${nant.verbosity}">
<fileset basedir="${path::combine(tools.dir, 'NUnit')}" failonempty="true">
<include name="nunit.framework.dll" />
</fileset>
</copy>
<copy todir ="${path::combine(build.dir, 'UnitTests')}" overwrite="true" verbose="${nant.verbosity}">
<fileset basedir="${tools.dir}" failonempty="true">
<include name="sleeper.exe" />
</fileset>
</copy>
<copy todir ="${path::combine(build.dir, 'UnitTests')}" overwrite="true" verbose="${nant.verbosity}">
<fileset basedir="${src.dir}" failonempty="true">
<include name="xsl/**" />
</fileset>
</copy>
<copy todir ="${path::combine(build.dir, 'UnitTests')}" overwrite="true" verbose="${nant.verbosity}">
<fileset basedir="${path::combine( path::combine(src.dir, 'UnitTests'), 'resources')}" failonempty="true">
<include name="*/**" />
</fileset>
</copy>
<copy file="${path::combine( path::combine(src.dir, 'UnitTests'), 'test.config')}" tofile="${path::combine( path::combine(build.dir, 'UnitTests'), 'ThoughtWorks.CruiseControl.UnitTests.dll.config')}" verbose="${nant.verbosity}" />
</if>
<nunitTest executable="${nunit.executable}" workingDirectory="${path::combine(build.dir, 'UnitTests')}" outputFile="${path::combine(build.metrics.dir, 'nunit-result.xml')}" commandLineParameterFlag="-" showLabels="true" verbose="${nant.verbosity}">
<assemblies>
<include name="${path::combine( path::combine(build.dir, 'UnitTests'), 'ThoughtWorks.CruiseControl.UnitTests.dll')}" />
</assemblies>
<!-- Hack for current xbuild issues on Mono 2.5 -->
<environment>
<variable name="MONO_PATH" value="${path::get-full-path('lib')}" if="${framework::get-family(nant.settings.currentframework) == 'mono'}" />
</environment>
</nunitTest>
</target>
<!-- Code analyze metric targets -->
<target name="runCodeMetrics" depends="build" description="Analyze and collect code metrics of the compiled assemblies">
<call target="runGendarme" cascade="false" />
<!-- Execute Windows only code metric tools -->
<if test="${platform::is-windows()}">
<!-- Check for NDepend installation -->
<if test="${not file::exists(ndepend.executable)}">
<echo level="Warning" message="NDepend installation not found at '${ndepend.executable}'. Please install NDepend! Target canceled." />
</if>
<if test="${file::exists(ndepend.executable)}">
<call target="runNdepend" cascade="false" />
</if>
<!-- Run FxCop -->
<call target="runFxCop" cascade="false" />
</if>
</target>
<target name="runGendarme" depends="build" description="Analyze the compiled assemblies with Mono's Gendarme">
<loadtasks assembly="${nauckit.nant.assembly}" />
<if test="${codemetrics.output.type == 'LogFile'}">
<property name="gendarme.output.file" value="gendarme-result.log" />
</if>
<if test="${codemetrics.output.type == 'XmlFile'}">
<property name="gendarme.output.file" value="gendarme-result.xml" />
</if>
<if test="${codemetrics.output.type == 'HtmlFile'}">
<property name="gendarme.output.file" value="gendarme-result.html" />
</if>
<gendarme executable="${gendarme.executable}" outputType="${codemetrics.output.type}" outputFile="${path::combine(build.metrics.dir, gendarme.output.file)}"
workingDirectory="${build.dir}" assemblyListFile="${gendarme.project}" />
</target>
<target name="runNdepend" depends="build" description="Analyze and collect code metrics of the compiled assemblies with NDepend">
<loadtasks assembly="${nauckit.nant.assembly}" />
<ndepend executable="${ndepend.executable}" projectFile="${ndepend.project}" />
</target>
<target name="runFxCop" depends="build" description="Analyze the compiled assemblies with FxCop">
<loadtasks assembly="${nauckit.nant.assembly}" />
<if test="${codemetrics.output.type == 'LogFile'}">
<property name="fxcop.output.file" value="fxcop-result.html" />
<property name="fxcop.output.xsl" value="true" />
</if>
<if test="${codemetrics.output.type == 'XmlFile'}">
<property name="fxcop.output.file" value="fxcop-result.xml" />
<property name="fxcop.output.xsl" value="false" />
</if>
<if test="${codemetrics.output.type == 'HtmlFile'}">
<property name="fxcop.output.file" value="fxcop-result.html" />
<property name="fxcop.output.xsl" value="true" />
</if>
<fxcop executable="${fxcop.executable}" projectFile="${fxcop.project}" outputFile="${path::combine(build.metrics.dir, fxcop.output.file)}"
xslFile="${path::combine(build.metrics.dir, 'fxcop-report.xsl')}" applyXsl="${fxcop.output.xsl} "/>
</target>
</project>