forked from CruiseControl/cruisecontrol
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
276 lines (238 loc) · 13.4 KB
/
Copy pathbuild.xml
File metadata and controls
276 lines (238 loc) · 13.4 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
<!-- build the release -->
<project name="release" default="release">
<property file="build.properties"/>
<property name="http.proxyHost" value=""/>
<property name="http.proxyPort" value="0"/>
<property name="http.proxyUser" value=""/>
<property name="http.proxyPassword" value=""/>
<!-- use a local variable to make sure that a script that would read the
properties file would still be capable of overidding this one -->
<property name="cc.release.label" value="${cc.version}"/>
<target name="release" depends="clean, build, website, validate-website, zip, bin-zip, add-cc-config, win-installer" description="Create release artifacts"/>
<target name="clean" description="Clean release and subprojects">
<delete dir="target" failonerror="false"/>
<ant inheritAll="false" dir="main" target="clean"/>
<ant inheritAll="false" dir="reporting/jsp" target="clean"/>
<ant inheritAll="false" dir="reporting/dashboard" target="clean"/>
</target>
<target name="checklabel">
<fail unless="cc.release.label" message="label is not defined."/>
<echo>Java: ${java.version} (${java.vm.name})</echo>
<echo> in ${java.home}</echo>
<echo>Ant: ${ant.version}</echo>
<echo> in ${ant.home}</echo>
<echo>CruiseControl: ${cc.release.label}</echo>
</target>
<target name="build" depends="checklabel" description="Create core lib and webapp">
<ant inheritAll="false" dir="main">
<property name="cc.release.label" value="${cc.release.label}"/>
</ant>
<ant inheritAll="false" dir="reporting/jsp">
<property name="user.log.dir" value="logs"/>
<property name="user.build.status.file" value="status.txt"/>
<property name="cruise.build.artifacts.dir" value="artifacts"/>
<property name="cruise.build.jmxport" value="8000"/>
</ant>
<ant inheritAll="false" dir="reporting/dashboard" target="dist" >
<property name="cc.release.label" value="${cc.release.label}"/>
</ant>
</target>
<target name="website" depends="checklabel" description="Create documentation website">
<fixcrlf srcdir="."
eol="lf"
eof="remove"
includes="**/*.sh"
/>
<fixcrlf srcdir="."
eol="crlf"
includes="**/*.bat"
/>
<delete dir="target/website" failonerror="no"/>
<copy todir="target/website">
<fileset dir="documentation"/>
</copy>
<!-- include main javadocs in website, as they are referenced from project docs, eg: main/plugins.html -->
<copy todir="target/website/main/api">
<fileset dir="main/target/javadoc"/>
</copy>
<replace dir="target/website" token="%%VERSION%%" value="${cc.release.label}">
<include name="**/*.html"/>
</replace>
<replace dir="target/website" token="%%APACHE_ANT%%" value="${apache.ant}">
<include name="**/*.html"/>
</replace>
</target>
<target name="validate-website">
<xmlvalidate>
<dtd publicId="-//W3C//DTD XHTML 1.0 Strict//EN" location="xhtml1-strict.dtd"/>
<dtd publicId="-//W3C//DTD XHTML 1.0 Transitional//EN" location="xhtml1-transitional.dtd"/>
<fileset dir="target/website" includes="**/*.html" excludes="main/api/**"/> <!-- don't validate generated javadoc -->
</xmlvalidate>
</target>
<target name="zip" depends="checklabel" description="Create zip files">
<mkdir dir="target/zip"/>
<copy todir="target/zip/documentation" overwrite="true">
<fileset dir="documentation"/>
</copy>
<replace dir="target/zip" token="%%VERSION%%" value="${cc.release.label}">
<include name="**/*.html"/>
</replace>
<property name="cc.zip.prefix" value="cruisecontrol-${cc.release.label}"/>
<zip zipfile="target/cruisecontrol-src-${cc.release.label}.zip" duplicate="fail">
<zipfileset dir="target/zip" prefix="${cc.zip.prefix}"/>
<zipfileset dir="." prefix="${cc.zip.prefix}">
<exclude name="**/target/**"/>
<exclude name="documentation/**/*"/>
<exclude name="reporting/jsp/samplelogs/_cache/**"/>
<exclude name="reporting/jsp/testresults.xml"/>
<exclude name="release*"/>
<exclude name=".pc/**"/>
<exclude name="**/dist/**"/>
</zipfileset>
</zip>
</target>
<target name="bin-zip" description="Create binary zip">
<defaultexcludes remove="**/.svn"/>
<defaultexcludes remove="**/.svn/**"/>
<copy todir="target/binzip">
<fileset file="binaryrelease/README.txt"/>
<fileset file="binaryrelease/config.xml"/>
</copy>
<replace dir="target/binzip" token="%%VERSION%%" value="${cc.release.label}">
<include name="**/*"/>
</replace>
<replace dir="target/binzip" token="%%APACHE_ANT%%" value="${apache.ant}">
<include name="config.xml"/>
</replace>
<property name="cc.bin.zip.prefix" value="cruisecontrol-bin-${cc.release.label}"/>
<zip destfile="target/cruisecontrol-bin-${cc.release.label}.zip" duplicate="preserve">
<zipfileset dir="binaryrelease" prefix="${cc.bin.zip.prefix}">
<exclude name="README.txt"/>
<exclude name="JETTY-WORKDIR-README.txt"/>
<exclude name="cruisecontrol.sh"/>
<exclude name="config.xml"/>
<exclude name="*.zip"/>
<exclude name="**/.svn"/>
<exclude name="**/.svn/**"/>
</zipfileset>
<zipfileset file="binaryrelease/cruisecontrol.sh" filemode="755"
prefix="${cc.bin.zip.prefix}"/>
<zipfileset dir="target/binzip" prefix="${cc.bin.zip.prefix}"/>
<!-- Force file and dir mode as ant has problem copying connectfour.zip's file permissions -->
<zipfileset src="binaryrelease/connectfour.zip" filemode="644" dirmode="755" prefix="${cc.bin.zip.prefix}/projects"/>
<zipfileset src="${apache.ant.zip}" prefix="${cc.bin.zip.prefix}"/>
<zipfileset dir="main/lib" includes="junit*.jar" prefix="${cc.bin.zip.prefix}/${apache.ant}/lib"/>
<zipfileset dir="main/lib" includes="*.jar" prefix="${cc.bin.zip.prefix}/lib" excludes="inmemorysfee*.jar, checkstyle*, **/.svn"/>
<zipfileset dir="main/lib/licenses" includes="*.txt" prefix="${cc.bin.zip.prefix}/lib/licenses"/>
<zipfileset file="main/lib/ant/ant.jar" prefix="${cc.bin.zip.prefix}/lib"/>
<zipfileset file="main/lib/ant/ant-launcher.jar" prefix="${cc.bin.zip.prefix}/lib"/>
<zipfileset dir="main/dist" prefix="${cc.bin.zip.prefix}/lib"/>
<zipfileset src="reporting/jsp/dist/cruisecontrol.war" prefix="${cc.bin.zip.prefix}/webapps/cruisecontrol"/>
<zipfileset file="binaryrelease/JETTY-WORKDIR-README.txt" prefix="${cc.bin.zip.prefix}/webapps/cruisecontrol/WEB-INF/work"/>
<zipfileset src="reporting/dashboard/dist/dashboard.war" prefix="${cc.bin.zip.prefix}/webapps/dashboard"/>
<zipfileset dir="target/website" prefix="${cc.bin.zip.prefix}/webapps/documentation"/>
<zipfileset dir="lib/aspirin/v0.8.3" includes="aspirin.jar" prefix="${cc.bin.zip.prefix}/lib"/>
<zipfileset dir="lib/commons-pool/v1.5.4" includes="commons-pool-1.5.4.jar" prefix="${cc.bin.zip.prefix}/lib"/>
<zipfileset dir="lib/dnsjava/v2.0.8" includes="dnsjava-2.0.8.jar" prefix="${cc.bin.zip.prefix}/lib"/>
</zip>
</target>
<target name="add-cc-config" depends="prep-cc-config" unless="test.skip">
<zip destfile="target/cruisecontrol-bin-${cc.release.label}.zip" update="true">
<zipfileset src="target/cc-config/dist/cc-config.war" prefix="${cc.bin.zip.prefix}/webapps/cc-config" />
</zip>
</target>
<target name="prep-cc-config" unless="test.skip">
<mkdir dir="target"/>
<setproxy proxyhost="${http.proxyHost}" proxyport="${http.proxyPort}" proxyUser="${http.proxyUser}" proxyPassword="${http.proxyPassword}"/>
<!--<get src="http://internap.dl.sourceforge.net/sourceforge/cc-config/cc-config_1.8_build2.zip" dest="${java.io.tmpdir}/cc-config.zip" verbose="on" usetimestamp="true"/>-->
<get src="http://sourceforge.net/projects/cc-config/files/swing-interface/Version%201.8%20Build%202/cc-config_1.8_build2.zip/download" dest="${java.io.tmpdir}/cc-config.zip" verbose="on" usetimestamp="true"/>
<unzip src="${java.io.tmpdir}/cc-config.zip" dest="target/cc-config" />
<ant antfile="build.xml" target="setup" dir="target/cc-config" inheritAll="false">
<property name="main.dir" value="../../main" />
</ant>
<ant antfile="build.xml" target="build.webstart.dist" dir="target/cc-config" inheritAll="false">
<property name="main.dir" value="../../main" />
</ant>
</target>
<target name="check-win-installer">
<condition property="should-create-win-installer">
<and>
<os family="windows"/>
<available file="c:/Program Files/NSIS/makensis.exe"/>
</and>
</condition>
</target>
<target name="win-installer" depends="check-win-installer" if="should-create-win-installer" description="Create win installer">
<property name="win-installer-stage" location="target/windows-install"/>
<mkdir dir="${win-installer-stage}"/>
<unzip src="target/cruisecontrol-bin-${cc.release.label}.zip" dest="${win-installer-stage}"/>
<move todir="${win-installer-stage}/cruisecontrol">
<fileset dir="${win-installer-stage}/${cc.bin.zip.prefix}"/>
</move>
<exec os="Windows XP" executable="c:/Program Files/NSIS/makensis.exe">
<arg value="contrib/windowsInstaller/cruise.nsi" />
</exec>
<move file="target/CruiseControl.exe" tofile="target/CruiseControl-${cc.release.label}.exe"/>
</target>
<target name="compile-webtest">
<mkdir dir="target/webtest-classes"/>
<javac srcdir="webtest" destdir="target/webtest-classes" debug="true">
<classpath>
<pathelement location="reporting/jsp/target/classes"/>
<fileset dir="reporting/jsp/lib" includes="*.jar"/>
<fileset dir="lib" includes="*.jar"/>
<fileset file="main/dist/cruisecontrol.jar"/>
</classpath>
</javac>
</target>
<target name="webtest" depends="compile-webtest">
<parallel>
<daemons>
<antcall target="deploy-server"/>
</daemons>
<sequential>
<waitfor maxwait="3" maxwaitunit="minute" checkevery="500">
<and>
<http url="http://localhost:7854/cruisecontrol"/>
<available file="target/webtest/cruisecontrol-bin-${cc.release.label}/projects/connectfour/target/connectfour.jar"/>
</and>
</waitfor>
<mkdir dir="target/webtest-results"/>
<junit haltonfailure="no" printsummary="on"
failureproperty="junit.failure" fork="yes" forkmode="once"
dir="target\webtest\cruisecontrol-bin-${cc.release.label}">
<classpath>
<pathelement location="reporting/jsp/target/classes"/>
<fileset dir="reporting/jsp/lib" includes="*.jar"/>
<fileset dir="lib" includes="*.jar"/>
<fileset file="main/dist/cruisecontrol.jar"/>
<pathelement location="target/webtest-classes"/>
</classpath>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="target/webtest-results">
<fileset dir="target/webtest-classes" includes="**/*Test.class"/>
</batchtest>
</junit>
<antcall target="kill-server"/>
<fail if="junit.failure" message="There were test failures."/>
</sequential>
</parallel>
</target>
<target name="deploy-server">
<mkdir dir="target/webtest"/>
<unzip src="target/cruisecontrol-bin-${cc.release.label}.zip" dest="target/webtest"/>
<chmod file="target/webtest/cruisecontrol-bin-${cc.release.label}/cruisecontrol.sh" perm="+x"/>
<chmod file="target/webtest/cruisecontrol-bin-${cc.release.label}/${apache.ant}/bin/ant" perm="+x"/>
<exec dir="target/webtest/cruisecontrol-bin-${cc.release.label}" executable="cmd.exe" os="Windows 95, Windows 98, Windows NT, Windows CE, Windows 2000, Windows XP">
<arg line="/c cruisecontrol.bat -webport 7854 -jmxport 7855 -rmiport 7856"/>
</exec>
<exec dir="target/webtest/cruisecontrol-bin-${cc.release.label}" executable="/bin/sh" os="Linux, Solaris, SunOS, Mac OS X">
<arg line="cruisecontrol.sh -webport 7854 -jmxport 7855 -rmiport 7856"/>
</exec>
</target>
<target name="kill-server">
<get src="http://localhost:7855/invoke?operation=halt&objectname=CruiseControl+Manager%3Aid%3Dunique"
dest="target/webtest/.temp" ignoreerrors="true"/>
</target>
</project>