blob: 166568eb3fbaf2027ed81df975a623d6603d06a3 [file] [log] [blame]
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +00001<project name="common">
fabbott@google.com25305472009-06-10 21:39:00 +00002 <!-- it's okay for this not to exist, but it gives a place to store
fabbott@fabbott-svned59d7c2010-01-21 12:26:27 +00003 personal property settings, if any, persistently. For example, you
fabbott@google.com25305472009-06-10 21:39:00 +00004 might use it to set gwt.junit.testcase.includes to a narrower subset
5 of test cases to exercise. -->
6 <property file="local.ant.properties" />
7
fabbott@google.com0e2dc6282008-08-22 16:09:01 +00008 <!-- gwt.build.iscasesensitivefs is true if the filesystem of the
9 build machine is case-sensitive, false otherwise. Update with
10 new lines for any supported platforms with case-insensitive
11 filesystems
12 -->
13 <condition property="gwt.build.iscasesensitivefs" else="false">
14 <not>
15 <or>
16 <os family="windows"/>
17 </or>
18 </not>
19 </condition>
gwt.team.jatceab1ec2006-12-28 22:48:49 +000020
fabbott@google.com0e2dc6282008-08-22 16:09:01 +000021 <property name="test.ant.file" location="${gwt.root}/${project.tail}/build.xml" />
22 <condition property="project.valid">
23 <equals arg1="${ant.file}" arg2="${test.ant.file}"
24 casesensitive="${gwt.build.iscasesensitivefs}"/>
25 </condition>
26 <fail unless="project.valid" message="This build file is in an inconsistent state (${ant.file} != ${test.ant.file})." />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000027
fabbott@google.com0e2dc6282008-08-22 16:09:01 +000028 <!-- Global Properties -->
29 <property environment="env" />
30 <condition property="gwt.version" value="${env.GWT_VERSION}" else="0.0.0">
31 <isset property="env.GWT_VERSION" />
32 </condition>
33 <condition property="gwt.tools.check" value="${env.GWT_TOOLS}" else="${gwt.root}/../tools">
34 <isset property="env.GWT_TOOLS" />
35 </condition>
36 <property name="gwt.tools" location="${gwt.tools.check}" />
37 <property name="gwt.tools.lib" location="${gwt.tools}/lib" />
38 <property name="gwt.tools.antlib" location="${gwt.tools}/antlib" />
39 <property name="gwt.tools.redist" location="${gwt.tools}/redist" />
40 <property name="gwt.build" location="${gwt.root}/build" />
41 <property name="gwt.build.out" location="${gwt.build}/out" />
42 <property name="gwt.build.lib" location="${gwt.build}/lib" />
43 <property name="gwt.build.jni" location="${gwt.build}/jni" />
44 <property name="gwt.build.staging" location="${gwt.build}/staging" />
45 <property name="gwt.build.dist" location="${gwt.build}/dist" />
jlabanca@google.com481db2d2009-10-19 17:28:15 +000046 <!-- gwt.threadsPerProcessor supercedes gwt.threadCount unless set to 0 -->
bobv@google.comb2bd3f52009-02-19 23:38:40 +000047 <property name="gwt.threadsPerProcessor" value="1" />
jlabanca@google.com481db2d2009-10-19 17:28:15 +000048 <property name="gwt.threadCount" value="1" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +000049 <property name="project.build" location="${gwt.build.out}/${project.tail}" />
50 <property name="project.lib" location="${gwt.build.lib}/gwt-${ant.project.name}.jar" />
51 <property name="project.jni" location="${gwt.build}/${project.tail}" />
52 <property name="javac.out" location="${project.build}/bin" />
53 <property name="javac.junit.out" location="${project.build}/bin-test" />
jlabanca@google.com81244562009-08-05 19:55:36 +000054 <property name="javac.emma.out" location="${project.build}/bin-emma" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +000055 <property name="javac.debug" value="true" />
56 <property name="javac.debuglevel" value="lines,vars,source" />
57 <property name="javac.encoding" value="utf-8" />
58 <property name="javac.source" value="1.5" />
59 <property name="javac.target" value="1.5" />
60 <property name="javac.nowarn" value="true" />
61 <property name="junit.out" location="${project.build}/test" />
jlabanca@google.com81244562009-08-05 19:55:36 +000062 <property name="emma.dir" value="${gwt.tools.redist}/emma" />
63 <property name="emma.filter.exclude" value="" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +000064
65 <!-- Sanity check -->
66 <available file="${gwt.tools}" type="dir" property="gwt.tools.exists" />
67 <fail unless="gwt.tools.exists" message="Cannot find '${gwt.tools}' tools directory; perhaps you should define the GWT_TOOLS environment variable" />
gwt.team.scottb193a3b92006-12-11 22:24:38 +000068
fabbott@google.com0e2dc6282008-08-22 16:09:01 +000069 <!-- Platform identification -->
70 <condition property="build.host.islinux">
71 <and>
72 <os family="unix" />
73 <not>
74 <contains string="${os.name}" substring="mac" casesensitive="false" />
75 </not>
76 </and>
77 </condition>
78 <condition property="build.host.platform" value="linux">
79 <isset property="build.host.islinux" />
80 </condition>
gwt.team.scottb193a3b92006-12-11 22:24:38 +000081
fabbott@google.com0e2dc6282008-08-22 16:09:01 +000082 <condition property="build.host.ismac">
83 <and>
84 <os family="unix" />
85 <contains string="${os.name}" substring="mac" casesensitive="false" />
86 </and>
87 </condition>
88 <condition property="build.host.platform" value="mac">
89 <isset property="build.host.ismac" />
90 </condition>
gwt.team.scottb193a3b92006-12-11 22:24:38 +000091
fabbott@google.com0e2dc6282008-08-22 16:09:01 +000092 <condition property="build.host.iswindows">
93 <os family="windows" />
94 </condition>
95 <condition property="build.host.platform" value="windows">
96 <isset property="build.host.iswindows" />
97 </condition>
98 <fail unless="build.host.platform" message="Building on ${os.name} is not supported" />
nchalko@google.comb980e6a2010-10-07 14:43:12 +000099
100 <!-- JVM -->
101 <condition property="build.jvm.is15">
102 <equals arg1="${ant.java.version}" arg2="1.5"/>
103 </condition>
gwt.team.scottb193a3b92006-12-11 22:24:38 +0000104
nchalko@google.comb980e6a2010-10-07 14:43:12 +0000105 <condition property="build.jvm.is16">
106 <equals arg1="${ant.java.version}" arg2="1.6"/>
107 </condition>
108
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000109 <!-- JUnit support -->
jat@google.com0b1619e2009-09-20 19:33:31 +0000110 <property name="gwt.dev.staging.jar" location="${gwt.build.staging}/gwt-${gwt.version}/gwt-dev.jar" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000111 <property name="gwt.junit.port" value="8888" />
112 <property name="gwt.junit.testcase.includes" value="**/*Suite.class"/>
gwt.team.zundel910448e2008-04-26 13:56:28 +0000113
gwt.mirrorbot@gmail.comd54a4bd2010-06-07 19:20:31 +0000114 <!-- Benchmark support -->
115 <property name="gwt.benchmark.testcase.includes" value="**/*SuiteBenchmark.class"/>
116
jlabanca@google.com81244562009-08-05 19:55:36 +0000117 <!-- Shared class paths -->
118 <path id="project.classpath.class">
119 <pathelement location="${javac.out}" />
120 </path>
121 <path id="project.classpath.src">
122 <pathelement location="${gwt.root}/${project.tail}/src" />
123 </path>
124
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000125 <!-- Pulls in tasks defined in ant-contrib, i.e. foreach -->
126 <taskdef resource="net/sf/antcontrib/antlib.xml">
127 <classpath>
128 <pathelement location="${gwt.tools.antlib}/ant-contrib-1.0b3.jar" />
129 </classpath>
130 </taskdef>
nchalko@google.comad61f1d2011-01-17 17:08:08 +0000131
132
133 <!-- Pulls in tasks defined in antcount, i.e. countfilter -->
134 <taskdef resource="net/sf/antcount/antlib.xml">
135 <classpath>
136 <pathelement location="${gwt.tools.antlib}/antcount-1.2.jar" />
137 </classpath>
138 </taskdef>
139
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000140
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000141 <!-- Global Custom Tasks -->
142 <presetdef name="gwt.ant">
143 <ant inheritall="false" target="${target}">
144 <propertyset>
145 <propertyref name="gwt.version" />
146 <propertyref name="gwt.junit.port" />
147 <propertyref name="gwt.remote.browsers" />
jlabanca@google.com81244562009-08-05 19:55:36 +0000148 <propertyref name="emma.enabled" />
jlabanca@google.comd93fa542009-08-24 17:44:29 +0000149 <propertyref name="emma.compiled" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000150 </propertyset>
151 </ant>
152 </presetdef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000153
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000154 <presetdef name="gwt.javac">
kjin@google.com4a205a42010-10-06 15:16:40 +0000155 <javac srcdir="src" destdir="${javac.out}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="${javac.source}" target="${javac.target}" nowarn="${javac.nowarn}" encoding="${javac.encoding}" fork="true" memoryMaximumSize="1024m" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000156 </presetdef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000157
fabbott@google.com25305472009-06-10 21:39:00 +0000158 <macrodef name="gwt.jar">
159 <attribute name="destfile" default="${project.lib}"/>
160 <attribute name="duplicate" default="fail"/>
161 <attribute name="update" default="true"/>
162 <element name="jarcontents" implicit="true"/>
163 <sequential>
164 <taskdef name="jar.bydate"
165 classname="com.google.gwt.ant.taskdefs.LatestTimeJar"
166 classpath="${gwt.build.lib}/ant-gwt.jar" />
167
168 <jar.bydate destfile="@{destfile}" duplicate="@{duplicate}" filesonly="false"
169 index="true" update="@{update}">
170 <jarcontents/>
171 </jar.bydate>
172 </sequential>
173 </macrodef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000174
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000175 <macrodef name="gwt.junit">
fabbott@google.comc0e9c9f2009-09-28 15:46:02 +0000176 <!-- TODO: Because dev has core, oophm splits, the "common pattern" here doesn't work
177 for it (and we use extraclasspaths entries instead). Once we lose SWT, we can
178 consolidate dev/core and dev/oophm, and that can instead more to the normal
fabbott@google.com415e5a92009-09-28 20:22:48 +0000179 pattern. Note also special casing regarding (dev/) core/test. -->
amitmanjhi@google.comcc68e232009-07-22 17:25:37 +0000180 <attribute name="test.args" default="" />
kjin@google.combdabce32010-09-08 22:25:08 +0000181 <attribute name="test.jvmargs" default="" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000182 <attribute name="test.out" default="" />
183 <attribute name="test.reports" default="@{test.out}/reports" />
jlabanca@google.com81244562009-08-05 19:55:36 +0000184 <attribute name="test.emma.coverage" default="@{test.out}/emma-coverage" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000185 <attribute name="test.cases" default="" />
jlabanca@google.com2707b142009-11-04 17:47:36 +0000186 <attribute name="test.name" default="" />
gwt.mirrorbot@gmail.comd54a4bd2010-06-07 19:20:31 +0000187 <attribute name="test.extra.jvmargs" default="" />
fabbott@google.comafd5f3a2009-09-03 19:14:51 +0000188 <attribute name="haltonfailure" default="true" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000189 <element name="extraclasspaths" optional="true" />
190 <sequential>
191 <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
192 <classpath>
fabbott@google.com618aafc2011-03-08 16:22:05 +0000193 <pathelement location="${gwt.tools.lib}/junit/junit-4.8.2.jar" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000194 <pathelement location="${gwt.tools.antlib}/ant-junit-1.6.5.jar" />
195 <pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" />
196 </classpath>
197 </taskdef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000198
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000199 <echo message="Writing test results to @{test.reports} for @{test.cases}" />
200 <mkdir dir="@{test.reports}" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000201
jlabanca@google.com875439d2009-10-02 14:37:34 +0000202 <antcall target="-create.emma.coverage.if.enabled">
jlabanca@google.com81244562009-08-05 19:55:36 +0000203 <param name="test.emma.coverage" value="@{test.emma.coverage}"/>
204 </antcall>
fabbott@google.comd84693b2009-11-12 20:28:34 +0000205 <condition property="emma.lib" value="${emma.dir}/emma-2.0.5312-patched.jar"
206 else="${emma.dir}/no-emma-requested">
jlabanca@google.com81244562009-08-05 19:55:36 +0000207 <isset property="emma.enabled" />
208 </condition>
209
fabbott@google.comf87faf12009-06-17 15:33:38 +0000210 <junit dir="@{test.out}" fork="yes" printsummary="yes"
jlabanca@google.com718da3a2009-08-07 11:58:23 +0000211 failureproperty="junit.failure" tempdir="@{test.out}">
jat@google.com633cf172009-03-27 06:08:37 +0000212 <jvmarg line="-Xmx768m" />
jbrosenberg@google.com27a09ae2011-03-03 18:45:25 +0000213 <jvmarg line="-Xss4M" />
jlabanca@google.com81244562009-08-05 19:55:36 +0000214 <jvmarg value="-Demma.coverage.out.file=@{test.emma.coverage}/coverage.emma" />
215 <jvmarg value="-Demma.coverage.out.merge=true" />
gwt.mirrorbot@gmail.comd54a4bd2010-06-07 19:20:31 +0000216 <jvmarg value="-Dcom.google.gwt.junit.reportPath=reports" />
kjin@google.combdabce32010-09-08 22:25:08 +0000217 <jvmarg line="@{test.jvmargs}" />
amitmanjhi@google.comb62c3102009-09-24 20:55:42 +0000218 <sysproperty key="gwt.args" value="@{test.args}" />
219 <sysproperty key="java.awt.headless" value="true" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000220 <classpath>
jlabanca@google.com81244562009-08-05 19:55:36 +0000221 <path refid="project.classpath.src" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000222 <pathelement location="${gwt.root}/${project.tail}/super" />
223 <pathelement location="${gwt.root}/${project.tail}/test" />
fabbott@google.com415e5a92009-09-28 20:22:48 +0000224 <!-- TODO: this is here because e.g. ClassPathEntryTest otherwise fails,
225 expecting the src entry (core/test) to be earlier than the bin entry
226 (${javac.junit.out}). -->
227 <pathelement location="${gwt.root}/${project.tail}/core/test" />
jlabanca@google.comf92c0d02010-02-01 15:18:28 +0000228 <!-- Emma compiled classes must appear before non-emma compiled
229 classes to generate code coverage stats. javac.emma.out is
230 empty unless emma is enabled. -->
jlabanca@google.com81244562009-08-05 19:55:36 +0000231 <pathelement location="${javac.emma.out}" />
jlabanca@google.comf92c0d02010-02-01 15:18:28 +0000232 <pathelement location="${javac.junit.out}" />
jlabanca@google.com81244562009-08-05 19:55:36 +0000233 <path refid="project.classpath.class" />
234 <pathelement location="${emma.lib}" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000235 <pathelement location="${gwt.dev.staging.jar}" />
fabbott@google.com618aafc2011-03-08 16:22:05 +0000236 <pathelement location="${gwt.tools.lib}/junit/junit-4.8.2.jar" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000237 <pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" />
bobv@google.coma933c8b2009-03-26 02:12:25 +0000238 <pathelement location="${gwt.tools.lib}/w3c/sac/sac-1.3.jar" />
unnurg@google.com48d73ec2011-05-05 15:11:08 +0000239 <pathelement location="${gwt.tools.lib}/w3c/flute/flute-1.3-gg2.jar" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000240 <extraclasspaths />
241 </classpath>
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000242
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000243 <formatter type="plain" />
244 <formatter type="xml" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000245
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000246 <batchtest todir="@{test.reports}">
247 <fileset refid="@{test.cases}" />
248 </batchtest>
249 </junit>
jlabanca@google.com81244562009-08-05 19:55:36 +0000250
251 <emma enabled="${emma.enabled}">
252 <report sourcepath="${project.classpath.src}">
253 <fileset file="${javac.emma.out}/metadata.emma" />
254 <fileset dir="@{test.emma.coverage}">
255 <include name="*.emma" />
256 </fileset>
257 <txt outfile="@{test.emma.coverage}/coverage.txt" />
258 <html outfile="@{test.emma.coverage}/coverage.html" />
259 <xml outfile="@{test.emma.coverage}/coverage.xml" />
260 </report>
261 </emma>
262
fabbott@google.comafd5f3a2009-09-03 19:14:51 +0000263 <condition property="junit.stop.build" value="true">
264 <and>
265 <istrue value="@{haltonfailure}"/>
fabbott@google.combe8c74e2009-09-28 19:14:04 +0000266 <isset property="junit.failure"/>
fabbott@google.comafd5f3a2009-09-03 19:14:51 +0000267 </and>
268 </condition>
jlabanca@google.comb2432d72009-11-05 14:46:58 +0000269 <fail
270 message="One or more junit tests failed for target: @{test.name} @{test.args}"
jlabanca@google.com73bda9d2010-01-05 18:03:42 +0000271 if="junit.stop.build" status="2" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000272 </sequential>
273 </macrodef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000274
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000275 <macrodef name="gwt.tgz.cat">
276 <attribute name="destfile" />
277 <attribute name="compression" default="gzip" />
278 <element name="tar.elements" implicit="true" optional="true" />
279 <sequential>
280 <taskdef name="tar.cat" classname="com.google.gwt.ant.taskdefs.TarCat" classpath="${gwt.build.lib}/ant-gwt.jar" />
281 <tar.cat destfile="@{destfile}" compression="@{compression}" longfile="gnu">
282 <tar.elements />
283 </tar.cat>
284 </sequential>
285 </macrodef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000286
fabbott@google.com3b1edcc2008-09-11 03:19:19 +0000287 <macrodef name="gwt.getsvninfo" description="Identifies the SVN info of a workspace">
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000288 <sequential>
fabbott@google.com66b79062008-09-20 05:44:47 +0000289 <taskdef name="svninfo"
290 classname="com.google.gwt.ant.taskdefs.SvnInfo"
291 classpath="${gwt.build.lib}/ant-gwt.jar" />
fabbott@google.com4e4f3632008-09-23 01:15:55 +0000292 <svninfo directory="${gwt.root}" outputproperty="gwt.svnrev"
fabbott@google.com66b79062008-09-20 05:44:47 +0000293 outputfileproperty="gwt.svnrev.filename" />
fabbott@google.com3b1edcc2008-09-11 03:19:19 +0000294 <!-- Generally, filtering requires a sentinel file so that changes to svn rev will
295 be noticed as invalidating the previously-generated filter output. This property
296 names where such a sentinel lives; it is tested with <available/> and created
297 with <touch/> -->
298 <mkdir dir="${project.build}/sentinels" />
299 <property name="filter.sentinel"
300 location="${project.build}/sentinels/gwt-${gwt.version}-svn-${gwt.svnrev.filename}" />
301 </sequential>
302 </macrodef>
303
304 <macrodef name="gwt.revfilter" description="Filters files for versioning">
305 <attribute name="todir" description="Destination for the filtered copy"/>
306
307 <element name="src.fileset" implicit="true"
308 description="Source for the filtered copy"/>
309 <sequential>
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000310 <!-- These files must be filtered for versioning -->
fabbott@google.com3b1edcc2008-09-11 03:19:19 +0000311 <echo message="Branding as GWT version ${gwt.version}, SVN rev ${gwt.svnrev}"/>
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000312 <mkdir dir="@{todir}" />
313 <copy todir="@{todir}" overwrite="true">
314 <src.fileset/>
315 <filterset>
316 <filter token="GWT_VERSION" value="${gwt.version}" />
317 <filter token="GWT_SVNREV" value="${gwt.svnrev}" />
318 </filterset>
319 </copy>
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000320 </sequential>
321 </macrodef>
fabbott@google.com4a87ea12008-08-20 21:02:23 +0000322
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000323 <macrodef name="gwt.timer">
324 <attribute name="name"/>
325 <element name="timer.elements" implicit="true" optional="false"/>
326 <sequential>
327 <taskdef name="timer"
328 classname="com.google.gwt.ant.taskdefs.Timer"
329 classpath="${gwt.build.lib}/ant-gwt.jar" />
330 <timer name="@{name}">
331 <timer.elements/>
332 </timer>
333 </sequential>
334 </macrodef>
fabbott@google.comf8284cd2008-05-09 20:14:51 +0000335
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000336 <macrodef name="gwt.checkstyle">
fabbott@google.com615a29b2009-06-23 16:20:54 +0000337 <attribute name="outputdirectory" default="${project.build}"/>
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000338 <element name="sourcepath" implicit="yes" optional="true" />
339 <sequential>
340 <taskdef resource="checkstyletask.properties" classpath="${gwt.tools.antlib}/checkstyle-all-4.2.jar;${gwt.build.lib}/gwt-customchecks.jar" />
fabbott@google.com61094352009-07-11 02:18:10 +0000341 <mkdir dir="@{outputdirectory}"/>
fabbott@google.com615a29b2009-06-23 16:20:54 +0000342 <checkstyle config="${gwt.root}/eclipse/settings/code-style/gwt-checkstyle.xml" maxErrors="0" failOnViolation="false" failureProperty="gwt.checkstyle.failed">
scottb@google.com6de97562009-11-03 21:04:24 +0000343 <formatter type="xml" toFile="@{outputdirectory}/checkstyle_log.xml"/>
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000344 <property key="checkstyle.header.file" file="${gwt.root}/eclipse/settings/code-style/google.header" />
345 <sourcepath />
346 </checkstyle>
scottb@google.com6de97562009-11-03 21:04:24 +0000347 <fail message="Checkstyle errors exist, and are reported at @{outputdirectory}/checkstyle_log.xml" if="gwt.checkstyle.failed" />
348 </sequential>
349 </macrodef>
350
351 <macrodef name="gwt.checkstyle.tests">
352 <attribute name="outputdirectory" default="${project.build}"/>
353 <element name="sourcepath" implicit="yes" optional="true" />
354 <sequential>
355 <taskdef resource="checkstyletask.properties" classpath="${gwt.tools.antlib}/checkstyle-all-4.2.jar;${gwt.build.lib}/gwt-customchecks.jar" />
356 <mkdir dir="@{outputdirectory}"/>
357 <checkstyle config="${gwt.root}/eclipse/settings/code-style/gwt-checkstyle-tests.xml" maxErrors="0" failOnViolation="false" failureProperty="gwt.checkstyle-tests.failed">
358 <formatter type="xml" toFile="@{outputdirectory}/checkstyle_tests_log.xml"/>
359 <property key="checkstyle.header.file" file="${gwt.root}/eclipse/settings/code-style/google.header" />
360 <sourcepath />
361 </checkstyle>
362 <fail message="Checkstyle errors exist in tests, and are reported at @{outputdirectory}/checkstyle_tests_log.xml" if="gwt.checkstyle-tests.failed" />
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000363 </sequential>
364 </macrodef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000365
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000366 <macrodef name="property.ensure">
367 <attribute name="name" />
368 <attribute name="location" />
369 <attribute name="message" default="Cannot find dependency ${@{name}}" />
370 <attribute name="unless" default="__nonexistent_property__" />
371 <sequential>
372 <property name="@{name}" location="@{location}" />
373 <condition property="@{name}.exists">
374 <or>
375 <available file="${@{name}}" />
376 <isset property="@{unless}" />
377 </or>
378 </condition>
379 <fail unless="@{name}.exists" message="@{message}" />
380 </sequential>
381 </macrodef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000382
jlabanca@google.com81244562009-08-05 19:55:36 +0000383 <!-- Targets for emma support. To run tests with emma enabled, use
384 ant <test-target> -Demma.enabled=true -->
385 <path id="emma.taskdef.lib">
386 <pathelement location="${emma.dir}/emma-2.0.5312-patched.jar" />
387 <pathelement location="${emma.dir}/emma_ant-2.0.5312.jar" />
388 </path>
389
390 <taskdef resource="emma_ant.properties" classpathref="emma.taskdef.lib" />
391
jat@google.com57b69402009-10-14 18:08:29 +0000392 <!-- Instruments emma classes -->
393 <target name="compile.emma.if.enabled" unless="emma.compiled">
jlabanca@google.com81244562009-08-05 19:55:36 +0000394 <delete dir="${javac.emma.out}" />
395 <property name="emma.compiled" value="true" />
396 <antcall target="-compile.emma.if.enabled" />
397 </target>
398
jat@google.com57b69402009-10-14 18:08:29 +0000399 <!-- Instruments emma classes -->
400 <target name="-compile.emma.if.enabled" if="emma.enabled">
jlabanca@google.com81244562009-08-05 19:55:36 +0000401 <mkdir dir="${javac.emma.out}" />
402 <path id="emma.classpath">
403 <pathelement location="${javac.out}" />
404 </path>
405 <emma enabled="${emma.enabled}" >
406 <instr instrpathref="emma.classpath" destdir="${javac.emma.out}" metadatafile="${javac.emma.out}/metadata.emma" merge="false">
407 <filter includes="com.google.*" />
408 <filter excludes="${emma.filter.exclude}" />
409 </instr>
410 </emma>
411 </target>
412
jat@google.com57b69402009-10-14 18:08:29 +0000413 <!-- Create the emma coverage directory -->
414 <target name="-create.emma.coverage.if.enabled" if="emma.enabled">
jlabanca@google.com81244562009-08-05 19:55:36 +0000415 <delete dir="${test.emma.coverage}" />
416 <mkdir dir="${test.emma.coverage}" />
417 </target>
418
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000419 <!-- Default implementations of the required targets; projects should
420 override the ones that matter -->
421 <target name="all" depends="verify" />
jat@google.com57b69402009-10-14 18:08:29 +0000422 <target name="verify" depends="checkstyle, test"
423 description="Runs tests and checkstyle static analysis" />
fabbott@google.com71e72af2009-06-13 02:28:21 +0000424 <target name="checkstyle" />
425 <target name="test" depends="build" />
426 <target name="build" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000427
fabbott@google.com71e72af2009-06-13 02:28:21 +0000428 <target name="clean">
fabbott@google.com0e2dc6282008-08-22 16:09:01 +0000429 <delete dir="${project.build}" />
430 </target>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000431
432</project>