-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
362 lines (287 loc) · 13.2 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="google-gin" default="all" basedir=".">
<property file="build.properties"/>
<property environment="env"/>
<!-- Used for distribution naming. -->
<property name="gin.version" value="2.1.2" />
<!-- Mac GWT requires -XstartOnFirstThread -->
<condition property="mac">
<os name="Mac OS X"/>
</condition>
<condition property="macJvmArgs" value="-XstartOnFirstThread" else="">
<isset property="mac"/>
</condition>
<!-- Compiler options -->
<property name="compiler.debug" value="on"/>
<property name="compiler.generate.no.warnings" value="off"/>
<property name="compiler.args" value=""/>
<property name="compiler.max.memory" value="128m"/>
<property name="test.max.memory" value="256m"/>
<!-- GWT installation directory; can be passed as Ant property gwt.home,
or can be provided by system property GWT_HOME. -->
<property name="gwt.home" value="${env.GWT_HOME}"/>
<patternset id="compiler.resources">
<include name="**/?*.xml"/>
</patternset>
<!-- Project Libraries -->
<path id="library.guice.classpath">
<pathelement location="${basedir}/lib/guice-3.0.jar"/>
</path>
<path id="library.gwt-user.classpath">
<pathelement location="${gwt.home}/gwt-user.jar"/>
</path>
<path id="library.gwt-dev.classpath">
<fileset dir="${gwt.home}" includes="gwt-dev*.jar"/>
</path>
<path id="library.junit.classpath">
<pathelement location="${basedir}/lib/test/junit.jar"/>
</path>
<path id="library.easymock.classpath">
<pathelement location="${basedir}/lib/test/easymock.jar"/>
</path>
<path id="library.objenesis.classpath">
<pathelement location="${basedir}/lib/test/objenesis.jar"/>
</path>
<path id="library.cglib.classpath">
<pathelement location="${basedir}/lib/test/cglib.jar"/>
</path>
<path id="library.aopalliance.classpath">
<pathelement location="${basedir}/lib/aopalliance.jar"/>
</path>
<path id="library.javax.inject.classpath">
<pathelement location="${basedir}/lib/javax.inject.jar"/>
</path>
<path id="library.assistedinject.classpath">
<pathelement location="${basedir}/lib/guice-assistedinject-3.0.jar"/>
</path>
<dirname property="gin.basedir" file="${ant.file}"/>
<property name="gin.source.dir" value="${gin.basedir}/src"/>
<property name="gin.output.base" value="${gin.basedir}/out"/>
<property name="gin.output.dir" value="${gin.output.base}/production"/>
<property name="gin.dist.dir" value="${gin.output.base}/dist"/>
<property name="gin.javadoc.dir" value="${gin.output.base}/javadoc"/>
<property name="gin.testoutput.dir" value="${gin.output.base}/test"/>
<property name="gin.testrun.base" value="${gin.output.base}/testrun"/>
<path id="gin.classpath">
<path refid="library.guice.classpath"/>
<path refid="library.gwt-user.classpath"/>
<path refid="library.gwt-dev.classpath"/>
<path refid="library.aopalliance.classpath"/>
<path refid="library.assistedinject.classpath"/>
<path refid="library.javax.inject.classpath"/>
</path>
<path id="gin.test.libs.classpath">
<path refid="gin.classpath"/>
<path refid="library.junit.classpath"/>
<path refid="library.easymock.classpath"/>
<path refid="library.objenesis.classpath"/>
<path refid="library.cglib.classpath"/>
</path>
<path id="gin.test.classpath">
<pathelement location="${gin.output.dir}"/>
<pathelement location="${gin.testoutput.dir}"/>
<path refid="gin.test.libs.classpath" />
<!-- Put test sources on test classpath so GWT compiler can see them -->
<path refid="gin.test.sourcepath"/>
</path>
<path id="gin.test.jars.classpath">
<pathelement location="${gin.testoutput.dir}"/>
<pathelement location="${gin.dist.dir}/gin-${gin.version}.jar" />
<path refid="gin.test.libs.classpath" />
<!-- Put test sources on test classpath so GWT compiler can see them -->
<path refid="gin.test.sourcepath"/>
</path>
<path id="gin.sourcepath" path="${gin.basedir}/src"/>
<path id="gin.test.sourcepath" location="${gin.basedir}/test"/>
<!-- Compilation -->
<target name="compile" depends="compile.production, compile.tests.client, compile.tests.rebind"/>
<target name="compile.production" description="Compile module gin; production classes">
<mkdir dir="${gin.output.dir}"/>
<javac destdir="${gin.output.dir}" debug="${compiler.debug}" fork="true" target="1.5" source="1.5"
nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}">
<compilerarg line="${compiler.args}"/>
<classpath refid="gin.classpath"/>
<src refid="gin.sourcepath"/>
<!-- Don't compile the fake Guice API classes; they are just for
the GWT compiler to see. Compiling them with javac breaks the
generator because it then sees the wrong versions of the Guice
classes (it needs the real ones). -->
<exclude name="com/google/gwt/inject/guiceapi/**" />
</javac>
<copy todir="${gin.output.dir}">
<fileset dir="${gin.basedir}/src">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
</copy>
<!-- Also include client and guiceapi .java files in the output, for GWT -->
<copy todir="${gin.output.dir}">
<fileset dir="${gin.basedir}/src">
<include name="com/google/gwt/inject/client/**/*.java" />
<include name="com/google/gwt/inject/guiceapi/**/*.java" />
</fileset>
</copy>
</target>
<target name="compile.tests.rebind" depends="compile.production"
description="Compile rebind tests.">
<mkdir dir="${gin.testoutput.dir}"/>
<javac destdir="${gin.testoutput.dir}" debug="${compiler.debug}" fork="true"
nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}">
<compilerarg line="${compiler.args}"/>
<classpath refid="gin.test.classpath"/>
<classpath location="${gin.output.dir}"/>
<src refid="gin.test.sourcepath"/>
<exclude name="com/google/gwt/inject/client/" />
<exclude name="com/google/gwt/inject/superclient/" />
<exclude name="com/google/gwt/inject/generated/" />
<exclude name="com/google/gwt/inject/super/" />
</javac>
<!-- Required to run the tests in IntelliJ under GWT 2.0. -->
<copy todir="${gin.testoutput.dir}">
<fileset dir="${gin.basedir}/test" includes="**/?*.java"/>
</copy>
</target>
<target name="compile.tests.client" depends="compile.production"
description="Compile client tests.">
<mkdir dir="${gin.testoutput.dir}"/>
<javac destdir="${gin.testoutput.dir}" debug="${compiler.debug}" fork="true"
nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}">
<compilerarg line="${compiler.args}"/>
<classpath refid="gin.test.classpath"/>
<classpath location="${gin.output.dir}"/>
<src refid="gin.test.sourcepath"/>
<exclude name="com/google/gwt/inject/rebind/" />
<exclude name="com/google/gwt/inject/super/" />
</javac>
<copy todir="${gin.testoutput.dir}">
<fileset dir="${gin.basedir}/test">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
</copy>
<!-- Also include client and guiceapi .java files in the output, for GWT -->
<copy todir="${gin.testoutput.dir}">
<fileset dir="${gin.basedir}/test">
<include name="com/google/gwt/inject/client/**/*.java" />
<include name="com/google/gwt/inject/superclient/**/*.java" />
<include name="com/google/gwt/inject/generated/client/**/*.java" />
<include name="com/google/gwt/inject/super/**/*.java" />
</fileset>
</copy>
</target>
<!-- Testing -->
<target name="test" depends="test.client, test.rebind" description="Run all tests."/>
<target name="test.client" depends="test.web, test.hosted" description="Run client tests." />
<macrodef name="test-macro">
<attribute name="extragwtargs" default="" />
<attribute name="outputbase" />
<attribute name="classpath" default="gin.test.classpath" />
<sequential>
<mkdir dir="@{outputbase}/out"/>
<mkdir dir="@{outputbase}/gen"/>
<mkdir dir="@{outputbase}/reports"/>
<junit printsummary="yes" fork="yes" showoutput="true" maxmemory="${test.max.memory}"
haltonerror="true" failureproperty="junit.failure" dir="@{outputbase}">
<jvmarg line="${macJvmArgs}"/>
<formatter type="brief" />
<formatter type="xml"/>
<!-- Add -logLevel TRACE to get more debug output -->
<sysproperty key="gwt.args" value="@{extragwtargs} -gen gen -war out" />
<classpath refid="@{classpath}"/>
<batchtest todir="@{outputbase}/reports">
<fileset dir="${gin.testoutput.dir}" includes="com/google/gwt/inject/*TestSuite.class"/>
</batchtest>
</junit>
<junitreport todir="@{outputbase}/reports">
<fileset dir="@{outputbase}/reports"/>
<report todir="@{outputbase}/reports/html"/>
</junitreport>
<fail if="junit.failure" message="Tests failed. See reports in @{outputbase}/reports"/>
</sequential>
</macrodef>
<target name="test.web" depends="compile.tests.client">
<!-- Use -prod with GWT 2.0+, otherwise run -web. -->
<test-macro extragwtargs="-prod -style PRETTY" outputbase="${gin.testrun.base}/web" />
</target>
<target name="test.hosted" depends="compile.tests.client">
<test-macro outputbase="${gin.testrun.base}/hosted" />
</target>
<target name="test.rebind" depends="compile.tests.rebind" description="Run rebind tests.">
<sequential>
<mkdir dir="${gin.testrun.base}/rebind/reports"/>
<junit printsummary="yes" fork="yes" showoutput="true" maxmemory="${test.max.memory}"
haltonerror="true" failureproperty="junit.failure" dir="${gin.testrun.base}/rebind">
<formatter type="brief" />
<formatter type="xml"/>
<classpath refid="gin.test.classpath"/>
<batchtest todir="${gin.testrun.base}/rebind/reports">
<fileset dir="${gin.testoutput.dir}">
<include name="com/google/gwt/inject/rebind/**/*Test.class"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${gin.testrun.base}/rebind/reports">
<fileset dir="${gin.testrun.base}/rebind/reports"/>
<report todir="${gin.testrun.base}/rebind/reports/html"/>
</junitreport>
<fail if="junit.failure"
message="Tests failed. See reports in ${gin.testrun.base}/rebind/reports"/>
</sequential>
</target>
<!-- Distribution -->
<target name="jars" depends="compile.production" description="Creates distribution jars.">
<mkdir dir="${gin.dist.dir}"/>
<jar destfile="${gin.dist.dir}/gin-${gin.version}.jar">
<fileset dir="${gin.output.dir}" />
</jar>
<zip destfile="${gin.dist.dir}/gin-${gin.version}-src.jar">
<fileset dir="${gin.source.dir}"/>
<fileset file="${gin.basedir}/LICENSE"/>
</zip>
</target>
<target name="test.jars" depends="jars, compile.tests.client, compile.tests.rebind">
<mkdir dir="${gin.testrun.base}/rebind"/>
<test-macro extragwtargs="-prod -style PRETTY" outputbase="${gin.testrun.base}/web"
classpath="gin.test.jars.classpath" />
<test-macro outputbase="${gin.testrun.base}/hosted" classpath="gin.test.jars.classpath" />
<junit printsummary="yes" fork="yes" showoutput="true" maxmemory="${test.max.memory}"
haltonerror="true" dir="${gin.testrun.base}/rebind">
<classpath refid="gin.test.classpath"/>
<batchtest>
<fileset dir="${gin.testoutput.dir}">
<include name="com/google/gwt/inject/rebind/**/*Test.class"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- Output contains:
* bare gin-x.x.jar (all you should need to run)
* gin-x.x-src.jar (sources for easier importing in IDEs)
* gin-x.x.zip (sources/classes, javadoc, license, guice dependencies)
* gin-x.x-src.zip (all project contents) -->
<target name="dist" depends="jars, javadoc" description="Creates distributable archives.">
<mkdir dir="${gin.dist.dir}"/>
<zip destfile="${gin.dist.dir}/gin-${gin.version}.zip">
<fileset dir="${gin.basedir}/lib" includes="*.jar" />
<fileset file="${gin.basedir}/LICENSE"/>
<fileset file="${gin.dist.dir}/gin-${gin.version}.jar"/>
<zipfileset dir="${gin.javadoc.dir}" prefix="javadoc"/>
</zip>
<zip destfile="${gin.dist.dir}/gin-${gin.version}-src.zip">
<fileset dir="${gin.basedir}"
excludes="out/**/*,out,.svn,.svn/**/*,**/.svn,tomcat,tomcat/**/*,build.properties" />
<zipfileset dir="${gin.javadoc.dir}" prefix="javadoc"/>
</zip>
</target>
<target name="clean" description="Cleanup module.">
<delete dir="${gin.output.base}"/>
</target>
<target name="init" description="Build initialization" />
<target name="javadoc" description="Creates javadoc">
<javadoc sourcepath="${gin.source.dir}" destdir="${gin.javadoc.dir}"
classpathref="gin.classpath">
<link href="http://google-guice.googlecode.com/svn/trunk/javadoc" />
</javadoc>
</target>
<target name="all" depends="init, clean, compile, test, dist" description="build all"/>
</project>