-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
435 lines (374 loc) · 16.4 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
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
<!--##########################
As an interm solution until we have a formatter that is not tied to an IDE, if you wish to
auto-format incubator ant files you must use eclipse with the following configuration:
Tab size: 2
| | Use tab character instead of spaces
Maximum line width: 100
|x| Wrap long element tags
| | Align final '>' in multi-line element tags
Long term todos:
see if project.external.bin -> project.bin safely
create flag that wipes all test results, by default wipe only current
there exists a [out-of-date] command which may allow us to avoid the .body tasks.
-->
<project name="gwt-incubator" default="build">
<!-- "build" is the default incubator target -->
<property name="project.target" value="build" />
<!-- Set up initial environment -->
<property name="project.root" location="." />
<property name="project.build.properties" value="${project.root}/build.properties" />
<property environment="env" />
<property file="${project.build.properties}" />
<!-- support old variables names -->
<condition property="gwt.hosts.web.remote" value="${gwt.remote.browsers}">
<isset property="gwt.remote.browsers" />
</condition>
<condition property="gwt.hosts.web.selenium" value="${gwt.selenium.hosts}">
<isset property="gwt.selenium.hosts" />
</condition>
<!-- Also check for global-incubator.properties in the directory above -->
<property file="${project.root}/../global-incubator.properties" />
<!-- import common config -->
<import file="${project.root}/common.ant.xml" />
<import file="${project.root}/testsets.ant.xml" />
<!-- Specify project jars -->
<property name="project.jar" value="${project.dist}/gwt-incubator.jar" />
<property name="project.test.jar" location="${project.test}/incubator_tests.jar" />
<!-- With a project.external.bin specified, set project.bin to it -->
<available file="${gwt.tools}" type="dir" property="gwt.tools.exists" />
<!-- Setting up the project bin -->
<condition property="project.bin" value="${project.external.bin}">
<isset property="project.external.bin" />
</condition>
<property name="project.bin" value="${project.build}/bin" />
<!-- Javadoc -->
<property name="project.javadoc" location="${project.out}/javadoc" />
<!-- GWT demo creation properties -->
<property name="demo.src.dir" value="${project.root}/src-demo" />
<property name="demo.out.dir" value="${project.out}/compiled-demos" />
<property name="demo.js.style" value="OBFUSCATED" />
<property name="demo.filter" value="**/*.gwt.xml" />
<!--As the ant task selector puts tasks in the order given by the build file,
we have sorted all common public tasks first-->
<target name="build" depends="checksetup, compile" description="Packages the incubator jar">
<mkdir dir="build" />
<mkdir dir="${project.dist}" />
<jar destfile="${project.jar}">
<zipfileset src="${gwt.tools}/lib/javaswf/javaswf-20050404.jar" />
<zipfileset src="${gwt.tools}/lib/w3c/sac/sac-1.3.jar" />
<zipfileset src="${gwt.tools}/lib/w3c/flute/flute-1.3.jar" />
<fileset dir="src">
<exclude name="**/demos/**" />
<exclude name="**/examples/**" />
</fileset>
<fileset dir="super">
</fileset>
<fileset dir="${project.bin}">
<exclude name="**/demo/**" />
<exclude name="**/demos/**" />
<exclude name="**/examples/**" />
</fileset>
</jar>
</target>
<target name="help" description="Short description of incubator properties and tasks">
<echo>
Incubator properties
gwt.home
The location of the GWT jars you wish to compile and run against.
gwt.tools
The location of your GWT tools dir.
gwt.hosts.dev.remote
list of remote browsers to run while running junit dev tests.
gwt.hosts.web.remote
list of remote browsers to run while running junit web tests.
project.jar
Where should the gwt-incubator jar be created.
project.external.bin
If you a running in a very tight debug loop, you can set this property
so ant won't recompile your source. Instead ant will use the classes
provided by the project.external.bin directory.
Note: No validation checking is done, so only use this flag if you are
absolutely sure that your external.bin is up to date and valid.
project.test.filter
We will run only the tests which match the filter provided when the
user invokes a testing task.
project.build.properties
Where you have defined the above propeties.
Incubator tasks
The incubator tasks are self-documenting. The list of public ones are
build,help,dist,clean,all,test, test.hosted,test.web,test.remoteweb, test.selenium, build.demos.
</echo>
</target>
<target name="dist"
depends="build.demos, createJavadoc"
description="Assembles the full incubator distribution.">
<mkdir dir="${project.out}" />
<mkdir dir="${project.demos}" />
<javac srcdir="${project.root}/src-demo"
destdir="${project.bin}"
debug="${javac.debug}"
debuglevel="${javac.debuglevel}"
source="${javac.source}"
target="${javac.target}"
nowarn="${javac.nowarn}"
encoding="${javac.encoding}">
<classpath>
<pathelement location="${project.jar}" />
<pathelement location="${gwt.user.jar}" />
<pathelement location="${gwt.dev.jar}" />
</classpath>
</javac>
<jar destfile="${project.demos}/incubator-demos.jar">
<fileset dir="${project.src}">
<include name="**/demos/**" />
<include name="**/examples/**" />
</fileset>
<fileset dir="${project.root}/src-demo">
<include name="**/demos/**" />
<include name="**/examples/**" />
</fileset>
<fileset dir="${project.bin}">
<include name="**/demos/**" />
<include name="**/examples/**" />
</fileset>
</jar>
<copy todir="${project.demos}/web">
<fileset dir="demo">
</fileset>
</copy>
<mkdir dir="${project.dist}" />
<zip destfile="${project.dist}/gwt-incubator.zip" includesFile="${project.jar}">
<zipfileset dir="${project.out}" />
<fileset dir="${project.dist}" includes="${project.jar}" />
</zip>
</target>
<target name="apicheck"
depends="build"
description="Checks API compatibility to the reference GWT incubator jar provided below">
<java failonerror="true"
fork="true"
classname="com.google.gwt.tools.apichecker.ApiCompatibilityChecker">
<jvmarg line="-Xmx512m" />
<sysproperty key="gwt.devjar" value="${gwt.dev.jar}" />
<classpath>
<pathelement location="${project.bin}" />
<pathelement location="${gwt.dev.jar}" />
<pathelement location="${gwt.user.jar}" />
<pathelement location="${gwt.home}/gwt-api-checker.jar" />
</classpath>
<arg value="-gwtDevJar" />
<arg file="${gwt.dev.jar}" />
<arg value="-gwtUserJar" />
<arg file="${gwt.user.jar}" />
<arg value="-refJar" />
<arg file="tools/api-checker/reference/gwt-incubator.jar" />
<arg value="-configFile" />
<arg file="tools/api-checker/config/incubator.conf" />
<arg value="-logLevel" />
<arg value="WARN" />
</java>
</target>
<target name="clean" description="Cleans intermediate and output files">
<delete dir="${project.build}" />
</target>
<target name="all"
description=" Cleans, builds,tests, and packages incubator"
depends="clean,build,test,dist" />
<!-- Testing public tasks -->
<target name="test"
depends="build.tests"
description="Run hosted-mode, web-mode, and remoteweb tests for this project.">
<!--
Run hosted and web mode tests for the platform on which this build
is executing
-->
<limit failonerror="true" hours="2">
<parallel threadsPerProcessor="${gwt.threadsPerProcessor}"
threadCount="${gwt.threadCount}">
<!-- remote tests are a no-op unless gwt.hosts.dev.remote is defined -->
<antcall target="test.dev.remote" />
<!-- remote tests are a no-op unless gwt.hosts.web.remote is defined -->
<antcall target="test.web.remote" />
<!-- selenium tests are a no-op unless gwt.hosts.dev.selenium is defined -->
<antcall target="test.dev.selenium" />
<!-- selenium tests are a no-op unless gwt.hosts.web.selenium is defined -->
<antcall target="test.web.selenium" />
</parallel>
</limit>
</target>
<target name="createJavadoc">
<delete dir="${project.javadoc}" />
<mkdir dir="${project.javadoc}" />
<javadoc destdir="${project.javadoc}" windowtitle="Incubator API">
<packageset dir="src">
<include name="com/google/gwt/widgetideas/**" />
<include name="com/google/gwt/libideas/**" />
<include name="com/google/gwt/gen2/**" />
<exclude name="**/impl/**" />
</packageset>
<!-- we have a few impl classes that we don't want javadoc created for that must live in ui-->
<fileset dir="src/com/google/gwt/user/client/ui">
<exclude name="**Impl**" />
</fileset>
<!-- Javadoc has a bug in it that requires the jars on the class path or the index.html will not be created.-->
<classpath>
<pathelement location="${project.jar}" />
<pathelement location="${gwt.user.jar}" />
<pathelement location="${gwt.dev.jar}" />
<pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" />
</classpath>
</javadoc>
</target>
<!-- helper tasks -->
<target name="checksetup">
<fail message="unknown platform" unless="gwt.platform" />
<echo message="gwt.home = ${gwt.home}" />
<echo message="gwt.tools = ${gwt.tools}" />
<echo message="gwt.platform = ${gwt.platform}" />
<if>
<isset property="project.external.bin" />
<then>
<echo message="project.external.bin = ${project.external.bin}" />
</then>
</if>
</target>
<!-- Compile the project, unless project.external.bin is specified -->
<target name="compile" unless="project.external.bin">
<mkdir dir="${project.bin}" />
<echo message="Compiling source..." />
<gwt.javac destdir="${project.bin}">
<classpath>
<pathelement location="${gwt.user.jar}" />
<pathelement location="${gwt.dev.jar}" />
<pathelement location="${gwt.tools}/lib/javaswf/javaswf-20050404.jar" />
<pathelement location="${gwt.tools}/lib/w3c/sac/sac-1.3.jar" />
<pathelement location="${gwt.tools}/lib/w3c/flute/flute-1.3.jar" />
</classpath>
</gwt.javac>
</target>
<!--#############################
Testing helper tasks
-->
<!-- cleans the report dir to avoid confusion when tracking down unit test failures -->
<target name="clean.test.results">
<echo message="cleaning all test results" />
<delete dir="${project.test.results}" />
</target>
<!-- compiles the test code. Even if an exteral bin is set, ant still must compile the tests,
as we want to only include files reachable from the test source directory-->
<target name="compile.tests">
<mkdir dir="${project.test.bin}" />
<gwt.javac destdir="${project.test.bin}">
<classpath>
<pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" />
<pathelement location="${gwt.user.jar}" />
<pathelement location="${gwt.dev.jar}" />
<pathelement location="${project.jar}" />
<pathelement location="${project.bin}" />
<pathelement location="${gwt.tools}/lib/javaswf/javaswf-20050404.jar" />
<pathelement location="${gwt.tools}/lib/w3c/sac/sac-1.3.jar" />
<pathelement location="${gwt.tools}/lib/w3c/flute/flute-1.3.jar" />
<pathelement location="${gwt.tools}/lib/selenium/selenium-java-client-driver.jar" />
</classpath>
<src>
<pathelement location="${project.root}/test" />
</src>
</gwt.javac>
</target>
<!-- compiles the test code for this project -->
<target name="build.tests" depends="clean.test.results,build, compile.tests">
<mkdir dir="${project.test}" />
<jar destfile="${project.test.jar}">
<fileset dir="${project.test.bin}" />
<fileset dir="test" />
</jar>
</target>
<target name="test.dev.selenium" if="gwt.hosts.dev.selenium">
<echo message="Performing remote testing using Selenium RC at ${gwt.hosts.dev.selenium}" />
<gwt.junit test.args='-out www -runStyle "Selenium:${gwt.hosts.dev.selenium}"'
test.out="${project.test.results}/dev-selenium"
test.cases="default.hosted.tests">
</gwt.junit>
<fail message="Selenium tests failed, log should be in '${project.test.results}\dev-selenium' directory"
if="junit.failure" />
</target>
<target name="test.web.selenium" if="gwt.hosts.web.selenium">
<echo message="Performing remote testing using Selenium RC at ${gwt.hosts.web.selenium}" />
<gwt.junit test.args='-web -out www -ea -runStyle "Selenium:${gwt.hosts.web.selenium}"'
test.out="${project.test.results}/web-selenium"
test.cases="default.web.tests">
</gwt.junit>
<fail message="Selenium tests failed, log should be in '${project.test.results}\web-selenium' directory"
if="junit.failure" />
</target>
<target name="test.dev.remote" if="gwt.hosts.dev.remote">
<echo message="Performing remote testing at ${gwt.hosts.dev.remote}" />
<gwt.junit test.args="-out www -runStyle RemoteWeb:${gwt.hosts.dev.remote}"
test.out="${project.test.results}/dev-remote"
test.cases="default.hosted.tests">
</gwt.junit>
<fail message="Selenium tests failed, log should be in '${project.test.results}\dev-remote' directory"
if="junit.failure" />
</target>
<target name="test.web.remote" if="gwt.hosts.web.remote">
<echo message="Performing remote testing at ${gwt.hosts.web.remote}" />
<gwt.junit test.args="-web -out www -ea -runStyle RemoteWeb:${gwt.hosts.web.remote}"
test.out="${project.test.results}/web-remote"
test.cases="default.web.tests">
</gwt.junit>
<fail message="Remote tests failed, log should be in '${project.test.results}\web-remote' directory"
if="junit.failure" />
</target>
<!-- Building the demos -->
<target name="gwtc">
<taskdef name="gwtc" classname="com.google.ant.GwtCompilerTask">
<classpath>
<path path="${project.bin}" />
<pathelement location="${gwt.dev.jar}" />
</classpath>
</taskdef>
<property name="gwtc.vm.maxMemory" value="512m" />
<gwtc src="${gwtc.src.dir}"
war="${gwtc.out.dir}"
moduleFile="${gwtc.module.file}"
style="${gwtc.js.style}"
vmMaxMemory="${gwtc.vm.maxMemory}"
vmStackSize="${java.stackSize}">
<classpath>
<path path="${gwtc.src.dir}" />
<path path="${project.jar}" />
<pathelement location="${gwt.user.jar}" />
<pathelement location="${gwt.dev.jar}" />
<pathelement location="${gwt.tools}/lib/w3c/sac/sac-1.3.jar" />
<pathelement location="${gwt.tools}/lib/w3c/flute/flute-1.3.jar" />
</classpath>
</gwtc>
</target>
<target name="build.demo.helper" depends="gwtc">
<concat destfile="${gwtc.out.dir}/index.html" append="true">
<filterchain>
<replaceregex flags="g" pattern="\\" replace="/" />
<replaceregex pattern="\('.*/src-demo/" replace="('" />
</filterchain>
<script>writeDemoLink('${gwtc.module.file}');</script>
</concat>
</target>
<target name="clean.demos">
<delete dir="${demo.out.dir}" />
</target>
<target name="build.demos" depends="build, clean.demos, build.demos.body" />
<target name="build.demos.body">
<delete dir="${demo.out.dir}" />
<copy file="demoindex.template" tofile="${demo.out.dir}/index.html" />
<foreach target="build.demo.helper" param="gwtc.module.file">
<param name="gwtc.src.dir" value="${demo.src.dir}" />
<param name="gwtc.out.dir" value="${demo.out.dir}" />
<param name="gwtc.js.style" value="${demo.js.style}" />
<path>
<fileset dir="src-demo">
<include name="${demo.filter}" />
</fileset>
</path>
</foreach>
</target>
</project>