forked from playframework/play1
/
build.xml
407 lines (362 loc) · 17.7 KB
/
build.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="play! framework" default="jar" basedir=".">
<property name="baseversion" value="master" />
<path id="project.classpath">
<fileset dir=".">
<include name="play-*.jar"/>
</fileset>
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
</path>
<path id="classpath.test">
<pathelement location="classes" />
<pathelement location="test-classes" />
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<fileset dir="lib-test">
<include name="*.jar"/>
</fileset>
</path>
<target name="clean" description="clean resources">
<delete dir="classes" />
<delete dir="dist" />
<delete dir="tests-results" />
<delete dir="tests-tmp" />
<delete file="src/play/version" />
<delete includeemptydirs="true">
<fileset dir=".">
<include name="play-*.jar" />
</fileset>
<fileset dir="pym">
<include name="**/*.pyc"/>
</fileset>
<fileset dir="../samples-and-tests">
<include name="**/test-result/**"/>
<include name="**/tmp/**"/>
<include name="**/db/**"/>
<include name="**/attachments/**"/>
<include name="**/nbproject/**"/>
<include name="**/data/**"/>
<include name="**/logs/**"/>
<include name="**/i-am-working-here/**"/>
</fileset>
</delete>
<antcall target="clean-unittest"/>
</target>
<target name="version" unless="version">
<exec executable="git" outputproperty="gitversion" errorproperty="giterror" failonerror="false" failifexecutionfails="false">
<arg value="describe" />
<arg value="--always" />
</exec>
<condition property="version" value="${baseversion}-${gitversion}" else="${baseversion}-localbuild">
<equals arg1="" arg2="${giterror}" trim="true" />
</condition>
<echo message="Version ${version}"></echo>
</target>
<target name="compile" description="compile without cleaning">
<mkdir dir="classes"/>
<javac encoding="utf-8" srcdir="src" destdir="classes" debug="true" source="1.6" target="1.6">
<classpath refid="project.classpath" />
</javac>
<copy todir="classes">
<fileset dir="src">
<include name="**/*.properties"/>
<include name="**/*.xml"/>
<include name="**/play.plugins"/>
</fileset>
</copy>
</target>
<target name="javadoc" description="Generate the Javadoc" depends="version">
<delete dir="../documentation/api" />
<javadoc packagenames="play.*"
sourcepath="src"
defaultexcludes="yes"
destdir="../documentation/api"
author="false"
version="true"
use="true"
windowtitle="Play! API"
Encoding="UTF-8"
docencoding="UTF-8"
charset="UTF-8"
>
<classpath refid="project.classpath"/>
<classpath refid="classpath.test"/>
<doctitle><![CDATA[<h1>Play! ${version}</h1>]]></doctitle>
<bottom><![CDATA[<a href="http://guillaume.bort.fr">Guillaume Bort</a> & <a href="http://www.zenexity.fr">zenexity</a> - Distributed under <a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache 2 licence</a>, without any warrantly]]></bottom>
<tag name="todo" scope="all" description="To do:"/>
<group title="Libs" packages="play.libs.*"/>
<link offline="false" href="http://docs.oracle.com/javaee/7/api/" />
<link offline="false" href="http://docs.oracle.com/javase/7/docs/api/" />
<link offline="false" href="http://commons.apache.org/proper/commons-fileupload/apidocs/" />
<link offline="false" href="http://google-gson.googlecode.com/svn/tags/gson-2.2.4/docs/javadocs/" />
<link offline="false" href="https://docs.jboss.org/hibernate/orm/4.2/javadocs/" />
<link offline="false" href="http://www.mchange.com/projects/c3p0/apidocs/" />
</javadoc>
</target>
<target name="jar" depends="clean,version,compile,modules" description="create play.jar">
<echo message="${version}" file="src/play/version" />
<echo message="${version}" file="classes/play/version" />
<jar destfile="play-${version}.jar" basedir="classes">
<manifest>
<attribute name="Premain-Class" value="play.classloading.HotswapAgent"/>
<attribute name="Can-Redefine-Classes" value="true" />
<section name="Play">
<attribute name="Specification-Title" value="Play! framework"/>
<attribute name="Specification-Version" value="${version}"/>
<attribute name="Specification-Vendor" value="zenexity"/>
</section>
</manifest>
</jar>
</target>
<target name="support">
<zip destfile="../support/textmate.zip" comment="Textmate bundle for Play! - ${version}" update="false">
<zipfileset dir="../support/textmate" includes="**/**" />
</zip>
</target>
<target name="modules">
<property name="play.path" value="../.."/>
<ant antfile="build.xml" target="build" dir="../modules/testrunner" />
<ant antfile="build.xml" target="build" dir="../modules/grizzly" />
<ant antfile="build.xml" target="build" dir="../modules/docviewer" />
</target>
<!-- Netbeans support -->
<target name="nb-profile-application">
<property name="application.path" value="" />
<loadfile property="version" srcFile="src/play/version"/>
<loadfile property="play.id" srcFile="../id" failonerror="false" quiet="true" />
<loadproperties srcfile="${application.path}/conf/application.conf" />
<property name="jpda.port" value="8000" />
<nbprofiledirect>
<classpath>
<pathelement path="${application.path}/conf"/>
<path refid="project.classpath"/>
</classpath>
</nbprofiledirect>
<java classname="play.server.Server" dir="${basedir}" fork="true" jvm="${profiler.info.jvm}">
<classpath>
<pathelement path="${application.path}/conf"/>
<path refid="project.classpath"/>
</classpath>
<sysproperty key="application.path" value="${application.path}" />
<sysproperty key="play.id" value="${play.id}" />
<sysproperty key="java.endorsed.dirs" value="${basedir}/endorsed" />
<sysproperty key="play.debug" value="true" />
<jvmarg value="-javaagent:${basedir}/play-${version}.jar" />
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.port},server=y,suspend=n"/>
<jvmarg value="${profiler.info.jvmargs.agent}"/>
<jvmarg value="${jvm.memory}"/>
</java>
</target>
<target name="nb-run-application">
<loadfile property="version" srcFile="src/play/version"/>
<loadfile property="play.id" srcFile="../id" failonerror="false" quiet="true" />
<loadproperties srcfile="${application.path}/conf/application.conf" />
<property name="jpda.port" value="8000" />
<java classname="play.server.Server" dir="${basedir}" fork="true">
<classpath>
<pathelement path="${application.path}/conf"/>
<fileset dir="${application.path}/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${application.path}/modules">
<include name="**/*.jar"/>
</fileset>
<path refid="project.classpath"/>
</classpath>
<sysproperty key="application.path" value="${application.path}" />
<sysproperty key="play.id" value="${play.id}" />
<sysproperty key="java.endorsed.dirs" value="${basedir}/endorsed" />
<sysproperty key="play.debug" value="true" />
<jvmarg value="-javaagent:${basedir}/play-${version}.jar" />
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.port},server=y,suspend=n"/>
<jvmarg value="${jvm.memory}"/>
</java>
</target>
<target name="nb-debug">
<loadproperties srcfile="${application.path}/conf/application.conf" />
<property name="jpda.port" value="8000" />
<nbjpdaconnect name="${application.name}" address="${jpda.port}" transport="dt_socket" />
</target>
<target name="test-application">
<loadfile property="version" srcFile="src/play/version"/>
<loadproperties srcfile="${application.path}/conf/application.conf" />
<property name="jpda.port" value="8000" />
<java classname="play.server.Server" dir="${basedir}" fork="true">
<classpath>
<pathelement path="${application.path}/conf"/>
<fileset dir="${basedir}/../modules/testrunner/lib">
<include name="play-testrunner.jar"/>
</fileset>
<fileset dir="${application.path}/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${application.path}/modules">
<include name="**/*.jar"/>
</fileset>
<path refid="project.classpath"/>
</classpath>
<sysproperty key="application.path" value="${application.path}" />
<sysproperty key="play.id" value="test" />
<sysproperty key="java.endorsed.dirs" value="${basedir}/endorsed" />
<sysproperty key="play.debug" value="true" />
<jvmarg value="-javaagent:${basedir}/play-${version}.jar" />
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.port},server=y,suspend=n"/>
</java>
</target>
<target name="test-in-nb" depends="test">
<nbbrowse file="tests-results/html/index.html"/>
</target>
<!-- Tests -->
<target name="compile-tests" depends="compile">
<javac encoding="utf-8" nowarn="${compile.nowarn}" debug="true" destdir="classes" classpathref="project.classpath" srcdir="tests/src" >
<include name="**/*.java"/>
</javac>
</target>
<target name="build-test-modules">
<ant antfile="build.xml" target="build" dir="../samples-and-tests/modules/testModule" >
<property name="play.path" value="../../../"/>
</ant>
</target>
<!-- Launch all *Test.java -->
<target name="test" depends="clean,jar,build-test-modules" description="run tests suite">
<condition property="playExtension" value=".bat">
<and><os family="windows"/></and>
</condition>
<condition property="playExtension" value="">
<and><os family="unix"/></and>
</condition>
<echo message="Testing unittests" />
<antcall target="unittest" />
<echo message="Testing development lifecycle (wait ...)" />
<exec executable="python" failonerror="true">
<arg value="${basedir}/../samples-and-tests/i-am-a-developer/tests.py" />
</exec>
<echo message="Using ${basedir}/../play${playExtension}" />
<antcall target="play-test">
<param name="testAppPath" value="${basedir}/../samples-and-tests/just-test-cases"/>
</antcall>
<antcall target="play-test">
<param name="testAppPath" value="${basedir}/../samples-and-tests/forum"/>
</antcall>
<antcall target="play-test">
<param name="testAppPath" value="${basedir}/../samples-and-tests/zencontact"/>
</antcall>
<antcall target="play-test">
<param name="testAppPath" value="${basedir}/../samples-and-tests/jobboard"/>
</antcall>
<antcall target="play-test">
<param name="testAppPath" value="${basedir}/../samples-and-tests/yabe"/>
</antcall>
<antcall target="test-success" />
</target>
<target name="test-success">
<echo message="*****************" />
<echo message="All test passed !" />
<echo message="*****************" />
</target>
<target name="check-dependencies-file">
<available file="${testAppPath}/conf/dependencies.yml" property="dependencies.present"/>
</target>
<target name="do-deps" depends="check-dependencies-file" if="dependencies.present">
<exec executable="${basedir}/../play${playExtension}" failonerror="false" spawn="false">
<arg value="deps"/>
<arg value="${testAppPath}"/>
</exec>
</target>
<target name="play-test">
<antcall target="do-deps">
<param name="testAppPath" value="${testAppPath}"/>
</antcall>
<echo message="play auto-test ${testAppPath} (wait)" />
<exec executable="${basedir}/../play${playExtension}" failonerror="true">
<arg value="auto-test"/>
<arg value="${testAppPath}"/>
</exec>
<available file="${testAppPath}/test-result/result.passed" property="${testAppPath}testPassed" />
<fail message="Last test has failed ! (Check results in file://${testAppPath}/test-result)">
<condition>
<not>
<isset property="${testAppPath}testPassed"/>
</not>
</condition>
</fail>
</target>
<target name="debug-test-single" depends="compile-tests" description="debug a single test">
<nbjpdastart addressproperty="jpda.address" name="Play! framework" transport="dt_socket">
<classpath refid="project.classpath"/>
</nbjpdastart>
<mkdir dir="tests-results" />
<mkdir dir="${basedir}/tests-tmp" />
<junit errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${basedir}/tests-tmp">
<test name="${testclass}" todir="tests-results" />
<classpath>
<pathelement path="classes"/>
<path refid="project.classpath"/>
</classpath>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg value="-javaagent:${basedir}/play-${version}.jar" />
<sysproperty key="tests-tmp" value="${basedir}/tests-tmp" />
</junit>
<delete dir="${basedir}/tests-tmp" />
</target>
<target name="test-single" depends="compile-tests" description="run a single test">
<mkdir dir="tests-results" />
<mkdir dir="${basedir}/tests-tmp" />
<junit errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${basedir}/tests-tmp" >
<test name="${testclass}" todir="tests-results" />
<classpath>
<pathelement path="classes"/>
<path refid="project.classpath"/>
</classpath>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg value="-javaagent:${basedir}/play-${version}.jar" />
<sysproperty key="tests-tmp" value="${basedir}/tests-tmp" />
</junit>
<delete dir="${basedir}/tests-tmp" />
</target>
<target name="compile-unittest" depends="compile">
<mkdir dir="test-classes"/>
<javac encoding="utf-8" srcdir="test-src" destdir="test-classes" debug="true" source="1.6" target="1.6">
<classpath refid="classpath.test" />
</javac>
<copy todir="test-classes">
<fileset dir="test-src">
<include name="**/*.properties"/>
<include name="**/*.sql"/>
<include name="**/*.yml"/>
<include name="**/*.xml"/>
<include name="**/*.plugins"/>
</fileset>
</copy>
</target>
<target name="clean-unittest">
<delete dir="test-classes" />
</target>
<target name="unittest" depends="compile-unittest">
<junit errorproperty="junit.failure" failureproperty="junit.failure">
<classpath refid="classpath.test" />
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="test-classes" includes="**/*Test.class" />
</batchtest>
</junit>
<fail if="junit.failure" message="Unit test(s) failed. See reports!"/>
</target>
<target name="package" depends="clean,version,jar,javadoc">
<mkdir dir="dist" />
<zip destfile="dist/play-${version}.zip" comment="Play! ${version}" update="false">
<zipfileset prefix="play-${version}" dir=".." includes="**/*" excludes="**/cobertura.ser,**/*.pyc,hs_err*,.*,.*/*,framework/dist/**,id,play,nbproject/**,**/.bzr/**,**/.git/**,*.bzrignore,support/textmate/**,framework/classes/**,framework/tests-results/**,samples-and-tests/**/test-result,samples-and-tests/**/i-am-working-here,samples-and-tests/**/data,samples-and-tests/**/logs,samples-and-tests/**/tmp,samples-and-tests/**/db,samples-and-tests/**/attachments,modules/**" />
<zipfileset prefix="play-${version}" dir=".." includes="play" filemode="777" />
<zipfileset prefix="play-${version}" dir=".." includes="modules/grizzly/**,modules/crud/**,modules/secure/**,modules/docviewer/**,modules/testrunner/**" excludes="**/*.pyc" />
</zip>
</target>
</project>