gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 1 | <project name="common"> |
fabbott@google.com | 2530547 | 2009-06-10 21:39:00 +0000 | [diff] [blame] | 2 | <!-- it's okay for this not to exist, but it gives a place to store |
fabbott@fabbott-svn | ed59d7c | 2010-01-21 12:26:27 +0000 | [diff] [blame] | 3 | personal property settings, if any, persistently. For example, you |
fabbott@google.com | 2530547 | 2009-06-10 21:39:00 +0000 | [diff] [blame] | 4 | 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.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 8 | <!-- 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.jat | ceab1ec | 2006-12-28 22:48:49 +0000 | [diff] [blame] | 20 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 21 | <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.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 27 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 28 | <!-- 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.com | 481db2d | 2009-10-19 17:28:15 +0000 | [diff] [blame] | 46 | <!-- gwt.threadsPerProcessor supercedes gwt.threadCount unless set to 0 --> |
bobv@google.com | b2bd3f5 | 2009-02-19 23:38:40 +0000 | [diff] [blame] | 47 | <property name="gwt.threadsPerProcessor" value="1" /> |
jlabanca@google.com | 481db2d | 2009-10-19 17:28:15 +0000 | [diff] [blame] | 48 | <property name="gwt.threadCount" value="1" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 49 | <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.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 54 | <property name="javac.emma.out" location="${project.build}/bin-emma" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 55 | <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.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 62 | <property name="emma.dir" value="${gwt.tools.redist}/emma" /> |
| 63 | <property name="emma.filter.exclude" value="" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 64 | |
| 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.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 68 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 69 | <!-- 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.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 81 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 82 | <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.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 91 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 92 | <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" /> |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 99 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 100 | <!-- JUnit support --> |
jat@google.com | 0b1619e | 2009-09-20 19:33:31 +0000 | [diff] [blame] | 101 | <property name="gwt.dev.staging.jar" location="${gwt.build.staging}/gwt-${gwt.version}/gwt-dev.jar" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 102 | <property name="gwt.junit.port" value="8888" /> |
| 103 | <property name="gwt.junit.testcase.includes" value="**/*Suite.class"/> |
gwt.team.zundel | 910448e | 2008-04-26 13:56:28 +0000 | [diff] [blame] | 104 | |
gwt.mirrorbot@gmail.com | d54a4bd | 2010-06-07 19:20:31 +0000 | [diff] [blame] | 105 | <!-- Benchmark support --> |
| 106 | <property name="gwt.benchmark.testcase.includes" value="**/*SuiteBenchmark.class"/> |
| 107 | |
jlabanca@google.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 108 | <!-- Shared class paths --> |
| 109 | <path id="project.classpath.class"> |
| 110 | <pathelement location="${javac.out}" /> |
| 111 | </path> |
| 112 | <path id="project.classpath.src"> |
| 113 | <pathelement location="${gwt.root}/${project.tail}/src" /> |
| 114 | </path> |
| 115 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 116 | <!-- Pulls in tasks defined in ant-contrib, i.e. foreach --> |
| 117 | <taskdef resource="net/sf/antcontrib/antlib.xml"> |
| 118 | <classpath> |
| 119 | <pathelement location="${gwt.tools.antlib}/ant-contrib-1.0b3.jar" /> |
| 120 | </classpath> |
| 121 | </taskdef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 122 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 123 | <!-- Global Custom Tasks --> |
| 124 | <presetdef name="gwt.ant"> |
| 125 | <ant inheritall="false" target="${target}"> |
| 126 | <propertyset> |
| 127 | <propertyref name="gwt.version" /> |
| 128 | <propertyref name="gwt.junit.port" /> |
| 129 | <propertyref name="gwt.remote.browsers" /> |
jlabanca@google.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 130 | <propertyref name="emma.enabled" /> |
jlabanca@google.com | d93fa54 | 2009-08-24 17:44:29 +0000 | [diff] [blame] | 131 | <propertyref name="emma.compiled" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 132 | </propertyset> |
| 133 | </ant> |
| 134 | </presetdef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 135 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 136 | <presetdef name="gwt.javac"> |
| 137 | <javac srcdir="src" destdir="${javac.out}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="${javac.source}" target="${javac.target}" nowarn="${javac.nowarn}" encoding="${javac.encoding}" /> |
| 138 | </presetdef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 139 | |
fabbott@google.com | 2530547 | 2009-06-10 21:39:00 +0000 | [diff] [blame] | 140 | <macrodef name="gwt.jar"> |
| 141 | <attribute name="destfile" default="${project.lib}"/> |
| 142 | <attribute name="duplicate" default="fail"/> |
| 143 | <attribute name="update" default="true"/> |
| 144 | <element name="jarcontents" implicit="true"/> |
| 145 | <sequential> |
| 146 | <taskdef name="jar.bydate" |
| 147 | classname="com.google.gwt.ant.taskdefs.LatestTimeJar" |
| 148 | classpath="${gwt.build.lib}/ant-gwt.jar" /> |
| 149 | |
| 150 | <jar.bydate destfile="@{destfile}" duplicate="@{duplicate}" filesonly="false" |
| 151 | index="true" update="@{update}"> |
| 152 | <jarcontents/> |
| 153 | </jar.bydate> |
| 154 | </sequential> |
| 155 | </macrodef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 156 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 157 | <macrodef name="gwt.junit"> |
fabbott@google.com | c0e9c9f | 2009-09-28 15:46:02 +0000 | [diff] [blame] | 158 | <!-- TODO: Because dev has core, oophm splits, the "common pattern" here doesn't work |
| 159 | for it (and we use extraclasspaths entries instead). Once we lose SWT, we can |
| 160 | consolidate dev/core and dev/oophm, and that can instead more to the normal |
fabbott@google.com | 415e5a9 | 2009-09-28 20:22:48 +0000 | [diff] [blame] | 161 | pattern. Note also special casing regarding (dev/) core/test. --> |
amitmanjhi@google.com | cc68e23 | 2009-07-22 17:25:37 +0000 | [diff] [blame] | 162 | <attribute name="test.args" default="" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 163 | <attribute name="test.out" default="" /> |
| 164 | <attribute name="test.reports" default="@{test.out}/reports" /> |
jlabanca@google.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 165 | <attribute name="test.emma.coverage" default="@{test.out}/emma-coverage" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 166 | <attribute name="test.cases" default="" /> |
jlabanca@google.com | 2707b14 | 2009-11-04 17:47:36 +0000 | [diff] [blame] | 167 | <attribute name="test.name" default="" /> |
gwt.mirrorbot@gmail.com | d54a4bd | 2010-06-07 19:20:31 +0000 | [diff] [blame] | 168 | <attribute name="test.extra.jvmargs" default="" /> |
fabbott@google.com | afd5f3a | 2009-09-03 19:14:51 +0000 | [diff] [blame] | 169 | <attribute name="haltonfailure" default="true" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 170 | <element name="extraclasspaths" optional="true" /> |
| 171 | <sequential> |
| 172 | <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"> |
| 173 | <classpath> |
| 174 | <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> |
| 175 | <pathelement location="${gwt.tools.antlib}/ant-junit-1.6.5.jar" /> |
| 176 | <pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" /> |
| 177 | </classpath> |
| 178 | </taskdef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 179 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 180 | <echo message="Writing test results to @{test.reports} for @{test.cases}" /> |
| 181 | <mkdir dir="@{test.reports}" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 182 | |
jlabanca@google.com | 875439d | 2009-10-02 14:37:34 +0000 | [diff] [blame] | 183 | <antcall target="-create.emma.coverage.if.enabled"> |
jlabanca@google.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 184 | <param name="test.emma.coverage" value="@{test.emma.coverage}"/> |
| 185 | </antcall> |
fabbott@google.com | d84693b | 2009-11-12 20:28:34 +0000 | [diff] [blame] | 186 | <condition property="emma.lib" value="${emma.dir}/emma-2.0.5312-patched.jar" |
| 187 | else="${emma.dir}/no-emma-requested"> |
jlabanca@google.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 188 | <isset property="emma.enabled" /> |
| 189 | </condition> |
| 190 | |
fabbott@google.com | f87faf1 | 2009-06-17 15:33:38 +0000 | [diff] [blame] | 191 | <junit dir="@{test.out}" fork="yes" printsummary="yes" |
jlabanca@google.com | 718da3a | 2009-08-07 11:58:23 +0000 | [diff] [blame] | 192 | failureproperty="junit.failure" tempdir="@{test.out}"> |
jat@google.com | 633cf17 | 2009-03-27 06:08:37 +0000 | [diff] [blame] | 193 | <jvmarg line="-Xmx768m" /> |
jlabanca@google.com | 83258f7 | 2009-12-01 23:21:09 +0000 | [diff] [blame] | 194 | <jvmarg line="-Xss512k" /> |
jlabanca@google.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 195 | <jvmarg value="-Demma.coverage.out.file=@{test.emma.coverage}/coverage.emma" /> |
| 196 | <jvmarg value="-Demma.coverage.out.merge=true" /> |
gwt.mirrorbot@gmail.com | d54a4bd | 2010-06-07 19:20:31 +0000 | [diff] [blame] | 197 | <jvmarg value="-Dcom.google.gwt.junit.reportPath=reports" /> |
amitmanjhi@google.com | b62c310 | 2009-09-24 20:55:42 +0000 | [diff] [blame] | 198 | <sysproperty key="gwt.args" value="@{test.args}" /> |
| 199 | <sysproperty key="java.awt.headless" value="true" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 200 | <classpath> |
jlabanca@google.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 201 | <path refid="project.classpath.src" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 202 | <pathelement location="${gwt.root}/${project.tail}/super" /> |
| 203 | <pathelement location="${gwt.root}/${project.tail}/test" /> |
fabbott@google.com | 415e5a9 | 2009-09-28 20:22:48 +0000 | [diff] [blame] | 204 | <!-- TODO: this is here because e.g. ClassPathEntryTest otherwise fails, |
| 205 | expecting the src entry (core/test) to be earlier than the bin entry |
| 206 | (${javac.junit.out}). --> |
| 207 | <pathelement location="${gwt.root}/${project.tail}/core/test" /> |
jlabanca@google.com | f92c0d0 | 2010-02-01 15:18:28 +0000 | [diff] [blame] | 208 | <!-- Emma compiled classes must appear before non-emma compiled |
| 209 | classes to generate code coverage stats. javac.emma.out is |
| 210 | empty unless emma is enabled. --> |
jlabanca@google.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 211 | <pathelement location="${javac.emma.out}" /> |
jlabanca@google.com | f92c0d0 | 2010-02-01 15:18:28 +0000 | [diff] [blame] | 212 | <pathelement location="${javac.junit.out}" /> |
jlabanca@google.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 213 | <path refid="project.classpath.class" /> |
| 214 | <pathelement location="${emma.lib}" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 215 | <pathelement location="${gwt.dev.staging.jar}" /> |
| 216 | <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> |
| 217 | <pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" /> |
bobv@google.com | a933c8b | 2009-03-26 02:12:25 +0000 | [diff] [blame] | 218 | <pathelement location="${gwt.tools.lib}/w3c/sac/sac-1.3.jar" /> |
bobv@google.com | 9356917 | 2010-01-15 19:17:28 +0000 | [diff] [blame] | 219 | <pathelement location="${gwt.tools.lib}/w3c/flute/flute-1.3-gg1.jar" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 220 | <extraclasspaths /> |
| 221 | </classpath> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 222 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 223 | <formatter type="plain" /> |
| 224 | <formatter type="xml" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 225 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 226 | <batchtest todir="@{test.reports}"> |
| 227 | <fileset refid="@{test.cases}" /> |
| 228 | </batchtest> |
| 229 | </junit> |
jlabanca@google.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 230 | |
| 231 | <emma enabled="${emma.enabled}"> |
| 232 | <report sourcepath="${project.classpath.src}"> |
| 233 | <fileset file="${javac.emma.out}/metadata.emma" /> |
| 234 | <fileset dir="@{test.emma.coverage}"> |
| 235 | <include name="*.emma" /> |
| 236 | </fileset> |
| 237 | <txt outfile="@{test.emma.coverage}/coverage.txt" /> |
| 238 | <html outfile="@{test.emma.coverage}/coverage.html" /> |
| 239 | <xml outfile="@{test.emma.coverage}/coverage.xml" /> |
| 240 | </report> |
| 241 | </emma> |
| 242 | |
fabbott@google.com | afd5f3a | 2009-09-03 19:14:51 +0000 | [diff] [blame] | 243 | <condition property="junit.stop.build" value="true"> |
| 244 | <and> |
| 245 | <istrue value="@{haltonfailure}"/> |
fabbott@google.com | be8c74e | 2009-09-28 19:14:04 +0000 | [diff] [blame] | 246 | <isset property="junit.failure"/> |
fabbott@google.com | afd5f3a | 2009-09-03 19:14:51 +0000 | [diff] [blame] | 247 | </and> |
| 248 | </condition> |
jlabanca@google.com | b2432d7 | 2009-11-05 14:46:58 +0000 | [diff] [blame] | 249 | <fail |
| 250 | message="One or more junit tests failed for target: @{test.name} @{test.args}" |
jlabanca@google.com | 73bda9d | 2010-01-05 18:03:42 +0000 | [diff] [blame] | 251 | if="junit.stop.build" status="2" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 252 | </sequential> |
| 253 | </macrodef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 254 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 255 | <macrodef name="gwt.tgz.cat"> |
| 256 | <attribute name="destfile" /> |
| 257 | <attribute name="compression" default="gzip" /> |
| 258 | <element name="tar.elements" implicit="true" optional="true" /> |
| 259 | <sequential> |
| 260 | <taskdef name="tar.cat" classname="com.google.gwt.ant.taskdefs.TarCat" classpath="${gwt.build.lib}/ant-gwt.jar" /> |
| 261 | <tar.cat destfile="@{destfile}" compression="@{compression}" longfile="gnu"> |
| 262 | <tar.elements /> |
| 263 | </tar.cat> |
| 264 | </sequential> |
| 265 | </macrodef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 266 | |
fabbott@google.com | 3b1edcc | 2008-09-11 03:19:19 +0000 | [diff] [blame] | 267 | <macrodef name="gwt.getsvninfo" description="Identifies the SVN info of a workspace"> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 268 | <sequential> |
fabbott@google.com | 66b7906 | 2008-09-20 05:44:47 +0000 | [diff] [blame] | 269 | <taskdef name="svninfo" |
| 270 | classname="com.google.gwt.ant.taskdefs.SvnInfo" |
| 271 | classpath="${gwt.build.lib}/ant-gwt.jar" /> |
fabbott@google.com | 4e4f363 | 2008-09-23 01:15:55 +0000 | [diff] [blame] | 272 | <svninfo directory="${gwt.root}" outputproperty="gwt.svnrev" |
fabbott@google.com | 66b7906 | 2008-09-20 05:44:47 +0000 | [diff] [blame] | 273 | outputfileproperty="gwt.svnrev.filename" /> |
fabbott@google.com | 3b1edcc | 2008-09-11 03:19:19 +0000 | [diff] [blame] | 274 | <!-- Generally, filtering requires a sentinel file so that changes to svn rev will |
| 275 | be noticed as invalidating the previously-generated filter output. This property |
| 276 | names where such a sentinel lives; it is tested with <available/> and created |
| 277 | with <touch/> --> |
| 278 | <mkdir dir="${project.build}/sentinels" /> |
| 279 | <property name="filter.sentinel" |
| 280 | location="${project.build}/sentinels/gwt-${gwt.version}-svn-${gwt.svnrev.filename}" /> |
| 281 | </sequential> |
| 282 | </macrodef> |
| 283 | |
| 284 | <macrodef name="gwt.revfilter" description="Filters files for versioning"> |
| 285 | <attribute name="todir" description="Destination for the filtered copy"/> |
| 286 | |
| 287 | <element name="src.fileset" implicit="true" |
| 288 | description="Source for the filtered copy"/> |
| 289 | <sequential> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 290 | <!-- These files must be filtered for versioning --> |
fabbott@google.com | 3b1edcc | 2008-09-11 03:19:19 +0000 | [diff] [blame] | 291 | <echo message="Branding as GWT version ${gwt.version}, SVN rev ${gwt.svnrev}"/> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 292 | <mkdir dir="@{todir}" /> |
| 293 | <copy todir="@{todir}" overwrite="true"> |
| 294 | <src.fileset/> |
| 295 | <filterset> |
| 296 | <filter token="GWT_VERSION" value="${gwt.version}" /> |
| 297 | <filter token="GWT_SVNREV" value="${gwt.svnrev}" /> |
| 298 | </filterset> |
| 299 | </copy> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 300 | </sequential> |
| 301 | </macrodef> |
fabbott@google.com | 4a87ea1 | 2008-08-20 21:02:23 +0000 | [diff] [blame] | 302 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 303 | <macrodef name="gwt.timer"> |
| 304 | <attribute name="name"/> |
| 305 | <element name="timer.elements" implicit="true" optional="false"/> |
| 306 | <sequential> |
| 307 | <taskdef name="timer" |
| 308 | classname="com.google.gwt.ant.taskdefs.Timer" |
| 309 | classpath="${gwt.build.lib}/ant-gwt.jar" /> |
| 310 | <timer name="@{name}"> |
| 311 | <timer.elements/> |
| 312 | </timer> |
| 313 | </sequential> |
| 314 | </macrodef> |
fabbott@google.com | f8284cd | 2008-05-09 20:14:51 +0000 | [diff] [blame] | 315 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 316 | <macrodef name="gwt.checkstyle"> |
fabbott@google.com | 615a29b | 2009-06-23 16:20:54 +0000 | [diff] [blame] | 317 | <attribute name="outputdirectory" default="${project.build}"/> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 318 | <element name="sourcepath" implicit="yes" optional="true" /> |
| 319 | <sequential> |
| 320 | <taskdef resource="checkstyletask.properties" classpath="${gwt.tools.antlib}/checkstyle-all-4.2.jar;${gwt.build.lib}/gwt-customchecks.jar" /> |
fabbott@google.com | 6109435 | 2009-07-11 02:18:10 +0000 | [diff] [blame] | 321 | <mkdir dir="@{outputdirectory}"/> |
fabbott@google.com | 615a29b | 2009-06-23 16:20:54 +0000 | [diff] [blame] | 322 | <checkstyle config="${gwt.root}/eclipse/settings/code-style/gwt-checkstyle.xml" maxErrors="0" failOnViolation="false" failureProperty="gwt.checkstyle.failed"> |
scottb@google.com | 6de9756 | 2009-11-03 21:04:24 +0000 | [diff] [blame] | 323 | <formatter type="xml" toFile="@{outputdirectory}/checkstyle_log.xml"/> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 324 | <property key="checkstyle.header.file" file="${gwt.root}/eclipse/settings/code-style/google.header" /> |
| 325 | <sourcepath /> |
| 326 | </checkstyle> |
scottb@google.com | 6de9756 | 2009-11-03 21:04:24 +0000 | [diff] [blame] | 327 | <fail message="Checkstyle errors exist, and are reported at @{outputdirectory}/checkstyle_log.xml" if="gwt.checkstyle.failed" /> |
| 328 | </sequential> |
| 329 | </macrodef> |
| 330 | |
| 331 | <macrodef name="gwt.checkstyle.tests"> |
| 332 | <attribute name="outputdirectory" default="${project.build}"/> |
| 333 | <element name="sourcepath" implicit="yes" optional="true" /> |
| 334 | <sequential> |
| 335 | <taskdef resource="checkstyletask.properties" classpath="${gwt.tools.antlib}/checkstyle-all-4.2.jar;${gwt.build.lib}/gwt-customchecks.jar" /> |
| 336 | <mkdir dir="@{outputdirectory}"/> |
| 337 | <checkstyle config="${gwt.root}/eclipse/settings/code-style/gwt-checkstyle-tests.xml" maxErrors="0" failOnViolation="false" failureProperty="gwt.checkstyle-tests.failed"> |
| 338 | <formatter type="xml" toFile="@{outputdirectory}/checkstyle_tests_log.xml"/> |
| 339 | <property key="checkstyle.header.file" file="${gwt.root}/eclipse/settings/code-style/google.header" /> |
| 340 | <sourcepath /> |
| 341 | </checkstyle> |
| 342 | <fail message="Checkstyle errors exist in tests, and are reported at @{outputdirectory}/checkstyle_tests_log.xml" if="gwt.checkstyle-tests.failed" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 343 | </sequential> |
| 344 | </macrodef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 345 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 346 | <macrodef name="property.ensure"> |
| 347 | <attribute name="name" /> |
| 348 | <attribute name="location" /> |
| 349 | <attribute name="message" default="Cannot find dependency ${@{name}}" /> |
| 350 | <attribute name="unless" default="__nonexistent_property__" /> |
| 351 | <sequential> |
| 352 | <property name="@{name}" location="@{location}" /> |
| 353 | <condition property="@{name}.exists"> |
| 354 | <or> |
| 355 | <available file="${@{name}}" /> |
| 356 | <isset property="@{unless}" /> |
| 357 | </or> |
| 358 | </condition> |
| 359 | <fail unless="@{name}.exists" message="@{message}" /> |
| 360 | </sequential> |
| 361 | </macrodef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 362 | |
jlabanca@google.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 363 | <!-- Targets for emma support. To run tests with emma enabled, use |
| 364 | ant <test-target> -Demma.enabled=true --> |
| 365 | <path id="emma.taskdef.lib"> |
| 366 | <pathelement location="${emma.dir}/emma-2.0.5312-patched.jar" /> |
| 367 | <pathelement location="${emma.dir}/emma_ant-2.0.5312.jar" /> |
| 368 | </path> |
| 369 | |
| 370 | <taskdef resource="emma_ant.properties" classpathref="emma.taskdef.lib" /> |
| 371 | |
jat@google.com | 57b6940 | 2009-10-14 18:08:29 +0000 | [diff] [blame] | 372 | <!-- Instruments emma classes --> |
| 373 | <target name="compile.emma.if.enabled" unless="emma.compiled"> |
jlabanca@google.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 374 | <delete dir="${javac.emma.out}" /> |
| 375 | <property name="emma.compiled" value="true" /> |
| 376 | <antcall target="-compile.emma.if.enabled" /> |
| 377 | </target> |
| 378 | |
jat@google.com | 57b6940 | 2009-10-14 18:08:29 +0000 | [diff] [blame] | 379 | <!-- Instruments emma classes --> |
| 380 | <target name="-compile.emma.if.enabled" if="emma.enabled"> |
jlabanca@google.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 381 | <mkdir dir="${javac.emma.out}" /> |
| 382 | <path id="emma.classpath"> |
| 383 | <pathelement location="${javac.out}" /> |
| 384 | </path> |
| 385 | <emma enabled="${emma.enabled}" > |
| 386 | <instr instrpathref="emma.classpath" destdir="${javac.emma.out}" metadatafile="${javac.emma.out}/metadata.emma" merge="false"> |
| 387 | <filter includes="com.google.*" /> |
| 388 | <filter excludes="${emma.filter.exclude}" /> |
| 389 | </instr> |
| 390 | </emma> |
| 391 | </target> |
| 392 | |
jat@google.com | 57b6940 | 2009-10-14 18:08:29 +0000 | [diff] [blame] | 393 | <!-- Create the emma coverage directory --> |
| 394 | <target name="-create.emma.coverage.if.enabled" if="emma.enabled"> |
jlabanca@google.com | 8124456 | 2009-08-05 19:55:36 +0000 | [diff] [blame] | 395 | <delete dir="${test.emma.coverage}" /> |
| 396 | <mkdir dir="${test.emma.coverage}" /> |
| 397 | </target> |
| 398 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 399 | <!-- Default implementations of the required targets; projects should |
| 400 | override the ones that matter --> |
| 401 | <target name="all" depends="verify" /> |
jat@google.com | 57b6940 | 2009-10-14 18:08:29 +0000 | [diff] [blame] | 402 | <target name="verify" depends="checkstyle, test" |
| 403 | description="Runs tests and checkstyle static analysis" /> |
fabbott@google.com | 71e72af | 2009-06-13 02:28:21 +0000 | [diff] [blame] | 404 | <target name="checkstyle" /> |
| 405 | <target name="test" depends="build" /> |
| 406 | <target name="build" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 407 | |
fabbott@google.com | 71e72af | 2009-06-13 02:28:21 +0000 | [diff] [blame] | 408 | <target name="clean"> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 409 | <delete dir="${project.build}" /> |
| 410 | </target> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 411 | |
| 412 | </project> |