gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 1 | <project name="common"> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 2 | <!-- gwt.build.iscasesensitivefs is true if the filesystem of the |
| 3 | build machine is case-sensitive, false otherwise. Update with |
| 4 | new lines for any supported platforms with case-insensitive |
| 5 | filesystems |
| 6 | --> |
| 7 | <condition property="gwt.build.iscasesensitivefs" else="false"> |
| 8 | <not> |
| 9 | <or> |
| 10 | <os family="windows"/> |
| 11 | </or> |
| 12 | </not> |
| 13 | </condition> |
gwt.team.jat | ceab1ec | 2006-12-28 22:48:49 +0000 | [diff] [blame] | 14 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 15 | <property name="test.ant.file" location="${gwt.root}/${project.tail}/build.xml" /> |
| 16 | <condition property="project.valid"> |
| 17 | <equals arg1="${ant.file}" arg2="${test.ant.file}" |
| 18 | casesensitive="${gwt.build.iscasesensitivefs}"/> |
| 19 | </condition> |
| 20 | <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] | 21 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 22 | <!-- Global Properties --> |
| 23 | <property environment="env" /> |
| 24 | <condition property="gwt.version" value="${env.GWT_VERSION}" else="0.0.0"> |
| 25 | <isset property="env.GWT_VERSION" /> |
| 26 | </condition> |
| 27 | <condition property="gwt.tools.check" value="${env.GWT_TOOLS}" else="${gwt.root}/../tools"> |
| 28 | <isset property="env.GWT_TOOLS" /> |
| 29 | </condition> |
| 30 | <property name="gwt.tools" location="${gwt.tools.check}" /> |
| 31 | <property name="gwt.tools.lib" location="${gwt.tools}/lib" /> |
| 32 | <property name="gwt.tools.antlib" location="${gwt.tools}/antlib" /> |
| 33 | <property name="gwt.tools.redist" location="${gwt.tools}/redist" /> |
| 34 | <property name="gwt.build" location="${gwt.root}/build" /> |
| 35 | <property name="gwt.build.out" location="${gwt.build}/out" /> |
| 36 | <property name="gwt.build.lib" location="${gwt.build}/lib" /> |
| 37 | <property name="gwt.build.jni" location="${gwt.build}/jni" /> |
| 38 | <property name="gwt.build.staging" location="${gwt.build}/staging" /> |
| 39 | <property name="gwt.build.dist" location="${gwt.build}/dist" /> |
bobv@google.com | b2bd3f5 | 2009-02-19 23:38:40 +0000 | [diff] [blame] | 40 | <property name="gwt.threadsPerProcessor" value="1" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 41 | <property name="project.build" location="${gwt.build.out}/${project.tail}" /> |
| 42 | <property name="project.lib" location="${gwt.build.lib}/gwt-${ant.project.name}.jar" /> |
| 43 | <property name="project.jni" location="${gwt.build}/${project.tail}" /> |
| 44 | <property name="javac.out" location="${project.build}/bin" /> |
| 45 | <property name="javac.junit.out" location="${project.build}/bin-test" /> |
| 46 | <property name="javac.debug" value="true" /> |
| 47 | <property name="javac.debuglevel" value="lines,vars,source" /> |
| 48 | <property name="javac.encoding" value="utf-8" /> |
| 49 | <property name="javac.source" value="1.5" /> |
| 50 | <property name="javac.target" value="1.5" /> |
| 51 | <property name="javac.nowarn" value="true" /> |
| 52 | <property name="junit.out" location="${project.build}/test" /> |
| 53 | |
| 54 | <!-- Sanity check --> |
| 55 | <available file="${gwt.tools}" type="dir" property="gwt.tools.exists" /> |
| 56 | <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] | 57 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 58 | <!-- Platform identification --> |
| 59 | <condition property="build.host.islinux"> |
| 60 | <and> |
| 61 | <os family="unix" /> |
| 62 | <not> |
| 63 | <contains string="${os.name}" substring="mac" casesensitive="false" /> |
| 64 | </not> |
| 65 | </and> |
| 66 | </condition> |
| 67 | <condition property="build.host.platform" value="linux"> |
| 68 | <isset property="build.host.islinux" /> |
| 69 | </condition> |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 70 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 71 | <condition property="build.host.ismac"> |
| 72 | <and> |
| 73 | <os family="unix" /> |
| 74 | <contains string="${os.name}" substring="mac" casesensitive="false" /> |
| 75 | </and> |
| 76 | </condition> |
| 77 | <condition property="build.host.platform" value="mac"> |
| 78 | <isset property="build.host.ismac" /> |
| 79 | </condition> |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 80 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 81 | <condition property="build.host.iswindows"> |
| 82 | <os family="windows" /> |
| 83 | </condition> |
| 84 | <condition property="build.host.platform" value="windows"> |
| 85 | <isset property="build.host.iswindows" /> |
| 86 | </condition> |
| 87 | <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] | 88 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 89 | <condition property="junit.platform.args" value="-XstartOnFirstThread" else=""> |
| 90 | <isset property="build.host.ismac" /> |
| 91 | </condition> |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 92 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 93 | <!-- JUnit support --> |
| 94 | <property name="gwt.dev.staging.jar" location="${gwt.build.staging}/gwt-${build.host.platform}-${gwt.version}/gwt-dev-${build.host.platform}.jar" /> |
| 95 | <property name="gwt.junit.port" value="8888" /> |
| 96 | <property name="gwt.junit.testcase.includes" value="**/*Suite.class"/> |
gwt.team.zundel | 910448e | 2008-04-26 13:56:28 +0000 | [diff] [blame] | 97 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 98 | <!-- Headless mode keeps the hosted mode browser and log window |
| 99 | from popping up during a unit test run. This is usually desirable, |
| 100 | but the WebKit layout engine performs some optimizations in |
| 101 | headless mode that causes some GWT unit tests to break. The |
| 102 | solution for the time being is to turn off headless mode on |
| 103 | the mac. |
| 104 | --> |
| 105 | <condition property="junit.headless"> |
| 106 | <not> |
| 107 | <isset property="build.host.ismac" /> |
| 108 | </not> |
| 109 | </condition> |
| 110 | <condition property="junit.notheadless.arg" value="-notHeadless" else=""> |
| 111 | <not> |
| 112 | <isset property="junit.headless" /> |
| 113 | </not> |
| 114 | </condition> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 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" /> |
| 130 | </propertyset> |
| 131 | </ant> |
| 132 | </presetdef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 133 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 134 | <presetdef name="gwt.javac"> |
| 135 | <javac srcdir="src" destdir="${javac.out}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="${javac.source}" target="${javac.target}" nowarn="${javac.nowarn}" encoding="${javac.encoding}" /> |
| 136 | </presetdef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 137 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 138 | <presetdef name="gwt.jar"> |
| 139 | <jar destfile="${project.lib}" update="true" duplicate="preserve" index="true" /> |
| 140 | </presetdef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 141 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 142 | <macrodef name="gwt.junit"> |
| 143 | <!-- TODO: make this more generic / refactor so it can be used from dev/core --> |
| 144 | <attribute name="test.args" default="" /> |
| 145 | <attribute name="test.out" default="" /> |
| 146 | <attribute name="test.reports" default="@{test.out}/reports" /> |
| 147 | <attribute name="test.cases" default="" /> |
| 148 | <element name="extraclasspaths" optional="true" /> |
| 149 | <sequential> |
| 150 | <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"> |
| 151 | <classpath> |
| 152 | <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> |
| 153 | <pathelement location="${gwt.tools.antlib}/ant-junit-1.6.5.jar" /> |
| 154 | <pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" /> |
| 155 | </classpath> |
| 156 | </taskdef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 157 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 158 | <echo message="Writing test results to @{test.reports} for @{test.cases}" /> |
| 159 | <mkdir dir="@{test.reports}" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 160 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 161 | <echo message="${javac.out} ${javac.junit.out}" /> |
| 162 | <junit dir="@{test.out}" fork="yes" printsummary="yes" failureproperty="junit.failure" > |
| 163 | <jvmarg line="${junit.platform.args}" /> |
| 164 | <jvmarg line="-Xmx512m" /> |
| 165 | <sysproperty key="gwt.args" value="${junit.notheadless.arg} @{test.args}" /> |
| 166 | <sysproperty key="java.awt.headless" value="${junit.headless}" /> |
| 167 | <sysproperty key="gwt.devjar" value="${gwt.dev.staging.jar}" /> |
| 168 | <classpath> |
| 169 | <pathelement location="${gwt.root}/${project.tail}/src" /> |
| 170 | <pathelement location="${gwt.root}/${project.tail}/super" /> |
| 171 | <pathelement location="${gwt.root}/${project.tail}/test" /> |
| 172 | <pathelement location="${javac.junit.out}" /> |
| 173 | <pathelement location="${javac.out}" /> |
| 174 | <pathelement location="${gwt.dev.staging.jar}" /> |
| 175 | <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> |
| 176 | <pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" /> |
| 177 | <extraclasspaths /> |
| 178 | </classpath> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 179 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 180 | <formatter type="plain" /> |
| 181 | <formatter type="xml" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 182 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 183 | <batchtest todir="@{test.reports}"> |
| 184 | <fileset refid="@{test.cases}" /> |
| 185 | </batchtest> |
| 186 | </junit> |
| 187 | <fail message="One or more junit tests failed" if="junit.failure" /> |
| 188 | </sequential> |
| 189 | </macrodef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 190 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 191 | <macrodef name="gwt.tgz.cat"> |
| 192 | <attribute name="destfile" /> |
| 193 | <attribute name="compression" default="gzip" /> |
| 194 | <element name="tar.elements" implicit="true" optional="true" /> |
| 195 | <sequential> |
| 196 | <taskdef name="tar.cat" classname="com.google.gwt.ant.taskdefs.TarCat" classpath="${gwt.build.lib}/ant-gwt.jar" /> |
| 197 | <tar.cat destfile="@{destfile}" compression="@{compression}" longfile="gnu"> |
| 198 | <tar.elements /> |
| 199 | </tar.cat> |
| 200 | </sequential> |
| 201 | </macrodef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 202 | |
fabbott@google.com | 3b1edcc | 2008-09-11 03:19:19 +0000 | [diff] [blame] | 203 | <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] | 204 | <sequential> |
fabbott@google.com | 66b7906 | 2008-09-20 05:44:47 +0000 | [diff] [blame] | 205 | <taskdef name="svninfo" |
| 206 | classname="com.google.gwt.ant.taskdefs.SvnInfo" |
| 207 | classpath="${gwt.build.lib}/ant-gwt.jar" /> |
fabbott@google.com | 4e4f363 | 2008-09-23 01:15:55 +0000 | [diff] [blame] | 208 | <svninfo directory="${gwt.root}" outputproperty="gwt.svnrev" |
fabbott@google.com | 66b7906 | 2008-09-20 05:44:47 +0000 | [diff] [blame] | 209 | outputfileproperty="gwt.svnrev.filename" /> |
fabbott@google.com | 3b1edcc | 2008-09-11 03:19:19 +0000 | [diff] [blame] | 210 | <!-- Generally, filtering requires a sentinel file so that changes to svn rev will |
| 211 | be noticed as invalidating the previously-generated filter output. This property |
| 212 | names where such a sentinel lives; it is tested with <available/> and created |
| 213 | with <touch/> --> |
| 214 | <mkdir dir="${project.build}/sentinels" /> |
| 215 | <property name="filter.sentinel" |
| 216 | location="${project.build}/sentinels/gwt-${gwt.version}-svn-${gwt.svnrev.filename}" /> |
| 217 | </sequential> |
| 218 | </macrodef> |
| 219 | |
| 220 | <macrodef name="gwt.revfilter" description="Filters files for versioning"> |
| 221 | <attribute name="todir" description="Destination for the filtered copy"/> |
| 222 | |
| 223 | <element name="src.fileset" implicit="true" |
| 224 | description="Source for the filtered copy"/> |
| 225 | <sequential> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 226 | <!-- These files must be filtered for versioning --> |
fabbott@google.com | 3b1edcc | 2008-09-11 03:19:19 +0000 | [diff] [blame] | 227 | <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] | 228 | <mkdir dir="@{todir}" /> |
| 229 | <copy todir="@{todir}" overwrite="true"> |
| 230 | <src.fileset/> |
| 231 | <filterset> |
| 232 | <filter token="GWT_VERSION" value="${gwt.version}" /> |
| 233 | <filter token="GWT_SVNREV" value="${gwt.svnrev}" /> |
| 234 | </filterset> |
| 235 | </copy> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 236 | </sequential> |
| 237 | </macrodef> |
fabbott@google.com | 4a87ea1 | 2008-08-20 21:02:23 +0000 | [diff] [blame] | 238 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 239 | <macrodef name="gwt.timer"> |
| 240 | <attribute name="name"/> |
| 241 | <element name="timer.elements" implicit="true" optional="false"/> |
| 242 | <sequential> |
| 243 | <taskdef name="timer" |
| 244 | classname="com.google.gwt.ant.taskdefs.Timer" |
| 245 | classpath="${gwt.build.lib}/ant-gwt.jar" /> |
| 246 | <timer name="@{name}"> |
| 247 | <timer.elements/> |
| 248 | </timer> |
| 249 | </sequential> |
| 250 | </macrodef> |
fabbott@google.com | f8284cd | 2008-05-09 20:14:51 +0000 | [diff] [blame] | 251 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 252 | <macrodef name="gwt.checkstyle"> |
| 253 | <element name="sourcepath" implicit="yes" optional="true" /> |
| 254 | <sequential> |
| 255 | <taskdef resource="checkstyletask.properties" classpath="${gwt.tools.antlib}/checkstyle-all-4.2.jar;${gwt.build.lib}/gwt-customchecks.jar" /> |
jgw@google.com | a3509e2 | 2009-02-06 21:06:24 +0000 | [diff] [blame] | 256 | <checkstyle config="${gwt.root}/eclipse/settings/code-style/gwt-checkstyle.xml" maxErrors="0"> |
| 257 | <formatter type="xml" toFile="${project.build}/checkstyle_log.xml"/> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 258 | <property key="checkstyle.header.file" file="${gwt.root}/eclipse/settings/code-style/google.header" /> |
| 259 | <sourcepath /> |
| 260 | </checkstyle> |
jgw@google.com | a3509e2 | 2009-02-06 21:06:24 +0000 | [diff] [blame] | 261 | <echo message="Checkstyle messages are reported in checkstyle_log.xml located at ${project.build}" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 262 | </sequential> |
| 263 | </macrodef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 264 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 265 | <macrodef name="property.ensure"> |
| 266 | <attribute name="name" /> |
| 267 | <attribute name="location" /> |
| 268 | <attribute name="message" default="Cannot find dependency ${@{name}}" /> |
| 269 | <attribute name="unless" default="__nonexistent_property__" /> |
| 270 | <sequential> |
| 271 | <property name="@{name}" location="@{location}" /> |
| 272 | <condition property="@{name}.exists"> |
| 273 | <or> |
| 274 | <available file="${@{name}}" /> |
| 275 | <isset property="@{unless}" /> |
| 276 | </or> |
| 277 | </condition> |
| 278 | <fail unless="@{name}.exists" message="@{message}" /> |
| 279 | </sequential> |
| 280 | </macrodef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 281 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 282 | <!-- Default implementations of the required targets; projects should |
| 283 | override the ones that matter --> |
| 284 | <target name="all" depends="verify" /> |
| 285 | <target name="verify" depends="checkstyle, test" description="Verify this project" /> |
| 286 | <target name="checkstyle" description="Static analysis of source" /> |
| 287 | <target name="test" depends="build" description="Test this project" /> |
| 288 | <target name="build" description="Build and (maybe) package this project" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 289 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 290 | <target name="clean" description="Cleans this project's intermediate and output files"> |
| 291 | <delete dir="${project.build}" /> |
| 292 | </target> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 293 | |
| 294 | </project> |