gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 1 | <project name="common"> |
gwt.team.jat | ceab1ec | 2006-12-28 22:48:49 +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> |
| 14 | |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 15 | <property name="test.ant.file" location="${gwt.root}/${project.tail}/build.xml" /> |
| 16 | <condition property="project.valid"> |
gwt.team.jat | ceab1ec | 2006-12-28 22:48:49 +0000 | [diff] [blame] | 17 | <equals arg1="${ant.file}" arg2="${test.ant.file}" |
| 18 | casesensitive="${gwt.build.iscasesensitivefs}"/> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 19 | </condition> |
gwt.team.knorton | 8d3c288 | 2008-03-05 06:18:35 +0000 | [diff] [blame] | 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 | |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +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" /> |
| 40 | <property name="project.build" location="${gwt.build.out}/${project.tail}" /> |
| 41 | <property name="project.lib" location="${gwt.build.lib}/gwt-${ant.project.name}.jar" /> |
| 42 | <property name="project.jni" location="${gwt.build}/${project.tail}" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 43 | <property name="javac.out" location="${project.build}/bin" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 44 | <property name="javac.junit.out" location="${project.build}/bin-test" /> |
| 45 | <property name="javac.debug" value="true" /> |
| 46 | <property name="javac.debuglevel" value="lines,vars,source" /> |
gwt.team.mmendez | 14e28a2 | 2006-12-11 04:34:27 +0000 | [diff] [blame] | 47 | <property name="javac.encoding" value="utf-8" /> |
gwt.team.scottb | 452a7e3 | 2007-08-21 02:34:57 +0000 | [diff] [blame] | 48 | <property name="javac.source" value="1.5" /> |
scottb@google.com | c89e237 | 2008-02-11 18:53:40 +0000 | [diff] [blame] | 49 | <property name="javac.target" value="1.5" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 50 | <property name="javac.nowarn" value="true" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 51 | <property name="junit.out" location="${project.build}/test" /> |
gwt.team.mmendez | 764ec74 | 2007-03-20 19:36:54 +0000 | [diff] [blame] | 52 | |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 53 | <!-- Sanity check --> |
| 54 | <available file="${gwt.tools}" type="dir" property="gwt.tools.exists" /> |
| 55 | <fail unless="gwt.tools.exists" message="Cannot find '${gwt.tools}' tools directory; perhaps you should define the GWT_TOOLS environment variable" /> |
| 56 | |
gwt.team.scottb | 428b263 | 2006-12-12 22:40:34 +0000 | [diff] [blame] | 57 | <!-- Platform identification --> |
| 58 | <condition property="build.host.islinux"> |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 59 | <and> |
| 60 | <os family="unix" /> |
| 61 | <not> |
| 62 | <contains string="${os.name}" substring="mac" casesensitive="false" /> |
| 63 | </not> |
| 64 | </and> |
| 65 | </condition> |
gwt.team.scottb | 428b263 | 2006-12-12 22:40:34 +0000 | [diff] [blame] | 66 | <condition property="build.host.platform" value="linux"> |
| 67 | <isset property="build.host.islinux" /> |
| 68 | </condition> |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 69 | |
gwt.team.scottb | 428b263 | 2006-12-12 22:40:34 +0000 | [diff] [blame] | 70 | <condition property="build.host.ismac"> |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 71 | <and> |
| 72 | <os family="unix" /> |
| 73 | <contains string="${os.name}" substring="mac" casesensitive="false" /> |
| 74 | </and> |
| 75 | </condition> |
gwt.team.scottb | 428b263 | 2006-12-12 22:40:34 +0000 | [diff] [blame] | 76 | <condition property="build.host.platform" value="mac"> |
gwt.team.knorton | 8d3c288 | 2008-03-05 06:18:35 +0000 | [diff] [blame] | 77 | <isset property="build.host.ismac" /> |
| 78 | </condition> |
| 79 | <condition property="build.host.platform.detail" value="mac_10.5"> |
| 80 | <and> |
| 81 | <isset property="build.host.ismac" /> |
| 82 | <contains string="${os.version}" substring="10.5." /> |
| 83 | </and> |
| 84 | </condition> |
| 85 | <condition property="build.host.platform.detail" value="mac_10.4"> |
| 86 | <and> |
| 87 | <isset property="build.host.ismac" /> |
| 88 | <contains string="${os.version}" substring="10.4." /> |
| 89 | </and> |
gwt.team.scottb | 428b263 | 2006-12-12 22:40:34 +0000 | [diff] [blame] | 90 | </condition> |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 91 | |
gwt.team.scottb | 428b263 | 2006-12-12 22:40:34 +0000 | [diff] [blame] | 92 | <condition property="build.host.iswindows"> |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 93 | <os family="windows" /> |
| 94 | </condition> |
gwt.team.scottb | 428b263 | 2006-12-12 22:40:34 +0000 | [diff] [blame] | 95 | <condition property="build.host.platform" value="windows"> |
| 96 | <isset property="build.host.iswindows" /> |
| 97 | </condition> |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 98 | <fail unless="build.host.platform" message="Building on ${os.name} is not supported" /> |
| 99 | |
gwt.team.knorton | 8d3c288 | 2008-03-05 06:18:35 +0000 | [diff] [blame] | 100 | <!-- for OS's that don't need to set a detail revision |
| 101 | (i.e. as of 3mar08, all but MacOS) --> |
| 102 | <property name="build.host.platform.detail" |
| 103 | value="${build.host.platform}" /> |
| 104 | |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 105 | <condition property="junit.platform.args" value="-XstartOnFirstThread" else=""> |
gwt.team.knorton | 8d3c288 | 2008-03-05 06:18:35 +0000 | [diff] [blame] | 106 | <isset property="build.host.ismac" /> |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 107 | </condition> |
| 108 | |
gwt.team.scottb | 428b263 | 2006-12-12 22:40:34 +0000 | [diff] [blame] | 109 | <!-- JUnit support --> |
gwt.team.knorton | 8d3c288 | 2008-03-05 06:18:35 +0000 | [diff] [blame] | 110 | <property name="gwt.dev.staging.jar" location="${gwt.build.staging}/gwt-${build.host.platform.detail}-${gwt.version}/gwt-dev-${build.host.platform}.jar" /> |
gwt.team.scottb | a4f285c | 2006-12-09 02:11:15 +0000 | [diff] [blame] | 111 | <property name="gwt.junit.port" value="8888" /> |
gwt.team.bobv | 799633f | 2008-02-29 23:58:24 +0000 | [diff] [blame] | 112 | <property name="gwt.junit.testcase.includes" value="**/*Suite.class"/> |
gwt.team.mmendez | 764ec74 | 2007-03-20 19:36:54 +0000 | [diff] [blame] | 113 | |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 114 | |
| 115 | <!-- Pulls in tasks defined in ant-contrib, i.e. foreach --> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 116 | <taskdef resource="net/sf/antcontrib/antlib.xml"> |
gwt.team.scottb | a4f285c | 2006-12-09 02:11:15 +0000 | [diff] [blame] | 117 | <classpath> |
| 118 | <pathelement location="${gwt.tools.antlib}/ant-contrib-1.0b3.jar" /> |
| 119 | </classpath> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 120 | </taskdef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 121 | |
| 122 | <!-- Global Custom Tasks --> |
| 123 | <presetdef name="gwt.ant"> |
| 124 | <ant inheritall="false" target="${target}"> |
| 125 | <propertyset> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 126 | <propertyref name="gwt.version" /> |
| 127 | <propertyref name="gwt.junit.port" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 128 | <propertyref name="gwt.remote.browsers" /> |
| 129 | </propertyset> |
| 130 | </ant> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 131 | </presetdef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 132 | |
| 133 | <presetdef name="gwt.javac"> |
scottb@google.com | c89e237 | 2008-02-11 18:53:40 +0000 | [diff] [blame] | 134 | <javac srcdir="src" destdir="${javac.out}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="${javac.source}" target="${javac.target}" nowarn="${javac.nowarn}" encoding="${javac.encoding}" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 135 | </presetdef> |
| 136 | |
| 137 | <presetdef name="gwt.jar"> |
| 138 | <jar destfile="${project.lib}" update="true" duplicate="preserve" index="true" /> |
| 139 | </presetdef> |
| 140 | |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 141 | <macrodef name="gwt.junit"> |
gwt.team.scottb | 8635704 | 2007-03-09 08:00:14 +0000 | [diff] [blame] | 142 | <!-- TODO: make this more generic / refactor so it can be used from dev/core --> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 143 | <attribute name="test.args" default="" /> |
| 144 | <attribute name="test.out" default="" /> |
| 145 | <attribute name="test.reports" default="@{test.out}/reports" /> |
| 146 | <attribute name="test.cases" default="" /> |
gwt.team.scottb | a4f285c | 2006-12-09 02:11:15 +0000 | [diff] [blame] | 147 | <sequential> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 148 | <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"> |
| 149 | <classpath> |
| 150 | <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> |
| 151 | <pathelement location="${gwt.tools.antlib}/ant-junit-1.6.5.jar" /> |
| 152 | </classpath> |
| 153 | </taskdef> |
| 154 | |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 155 | <echo message="Writing test results to @{test.reports} for @{test.cases}" /> |
gwt.team.scottb | a4f285c | 2006-12-09 02:11:15 +0000 | [diff] [blame] | 156 | <mkdir dir="@{test.reports}" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 157 | |
gwt.team.scottb | a4f285c | 2006-12-09 02:11:15 +0000 | [diff] [blame] | 158 | <echo message="${javac.out} ${javac.junit.out}" /> |
gwt.team.bobv | 799633f | 2008-02-29 23:58:24 +0000 | [diff] [blame] | 159 | <junit dir="@{test.out}" fork="yes" printsummary="yes" failureproperty="junit.failure" > |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 160 | <jvmarg line="${junit.platform.args}" /> |
gwt.team.bobv | 799633f | 2008-02-29 23:58:24 +0000 | [diff] [blame] | 161 | <jvmarg line="-Xmx512m" /> |
gwt.team.scottb | a4f285c | 2006-12-09 02:11:15 +0000 | [diff] [blame] | 162 | <sysproperty key="gwt.args" value="@{test.args}" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 163 | <sysproperty key="gwt.devjar" value="${gwt.dev.staging.jar}" /> |
| 164 | <sysproperty key="java.awt.headless" value="true" /> |
| 165 | |
| 166 | <classpath> |
| 167 | <pathelement location="${gwt.root}/${project.tail}/src" /> |
| 168 | <pathelement location="${gwt.root}/${project.tail}/super" /> |
| 169 | <pathelement location="${gwt.root}/${project.tail}/test" /> |
| 170 | <pathelement location="${javac.junit.out}" /> |
| 171 | <pathelement location="${javac.out}" /> |
| 172 | <pathelement location="${gwt.dev.staging.jar}" /> |
gwt.team.scottb | e18b95c | 2006-12-21 22:35:49 +0000 | [diff] [blame] | 173 | <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 174 | </classpath> |
| 175 | |
| 176 | <formatter type="plain" /> |
| 177 | <formatter type="xml" /> |
| 178 | |
| 179 | <batchtest todir="@{test.reports}"> |
| 180 | <fileset refid="@{test.cases}" /> |
| 181 | </batchtest> |
| 182 | </junit> |
gwt.team.bobv | 799633f | 2008-02-29 23:58:24 +0000 | [diff] [blame] | 183 | <fail message="One or more junit tests failed" if="junit.failure" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 184 | </sequential> |
| 185 | </macrodef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 186 | |
gwt.team.scottb | b05c900 | 2006-12-12 09:53:31 +0000 | [diff] [blame] | 187 | <macrodef name="gwt.tgz.cat"> |
| 188 | <attribute name="destfile" /> |
scottb@google.com | e1f3234 | 2008-03-18 16:27:19 +0000 | [diff] [blame^] | 189 | <attribute name="compression" default="gzip" /> |
gwt.team.scottb | b05c900 | 2006-12-12 09:53:31 +0000 | [diff] [blame] | 190 | <element name="tar.elements" implicit="true" optional="true" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 191 | <sequential> |
gwt.team.scottb | b05c900 | 2006-12-12 09:53:31 +0000 | [diff] [blame] | 192 | <taskdef name="tar.cat" classname="com.google.gwt.ant.taskdefs.TarCat" classpath="${gwt.build.lib}/ant-gwt.jar" /> |
scottb@google.com | e1f3234 | 2008-03-18 16:27:19 +0000 | [diff] [blame^] | 193 | <tar.cat destfile="@{destfile}" compression="@{compression}" longfile="gnu"> |
gwt.team.scottb | b05c900 | 2006-12-12 09:53:31 +0000 | [diff] [blame] | 194 | <tar.elements /> |
| 195 | </tar.cat> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 196 | </sequential> |
| 197 | </macrodef> |
| 198 | |
gwt.team.scottb | c4700b8 | 2006-12-12 11:23:41 +0000 | [diff] [blame] | 199 | <macrodef name="gwt.checkstyle"> |
| 200 | <element name="sourcepath" implicit="yes" optional="true" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 201 | <sequential> |
gwt.team.scottb | c4700b8 | 2006-12-12 11:23:41 +0000 | [diff] [blame] | 202 | <taskdef resource="checkstyletask.properties" classpath="${gwt.tools.antlib}/checkstyle-all-4.2.jar;${gwt.build.lib}/gwt-customchecks.jar" /> |
| 203 | <checkstyle config="${gwt.root}/eclipse/settings/code-style/gwt-checkstyle.xml" maxWarnings="0"> |
| 204 | <property key="checkstyle.header.file" file="${gwt.root}/eclipse/settings/code-style/google.header" /> |
| 205 | <sourcepath /> |
| 206 | </checkstyle> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 207 | </sequential> |
| 208 | </macrodef> |
| 209 | |
| 210 | <macrodef name="property.ensure"> |
| 211 | <attribute name="name" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 212 | <attribute name="location" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 213 | <attribute name="message" default="Cannot find dependency ${@{name}}" /> |
gwt.team.scottb | 428b263 | 2006-12-12 22:40:34 +0000 | [diff] [blame] | 214 | <attribute name="unless" default="__nonexistent_property__" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 215 | <sequential> |
| 216 | <property name="@{name}" location="@{location}" /> |
gwt.team.scottb | 428b263 | 2006-12-12 22:40:34 +0000 | [diff] [blame] | 217 | <condition property="@{name}.exists"> |
| 218 | <or> |
| 219 | <available file="${@{name}}" /> |
| 220 | <isset property="@{unless}" /> |
| 221 | </or> |
| 222 | </condition> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 223 | <fail unless="@{name}.exists" message="@{message}" /> |
| 224 | </sequential> |
| 225 | </macrodef> |
| 226 | |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 227 | <!-- Default implementations of the required targets; projects should |
| 228 | override the ones that matter --> |
| 229 | <target name="all" depends="verify" /> |
| 230 | <target name="verify" depends="checkstyle, test" description="Verify this project" /> |
| 231 | <target name="checkstyle" description="Static analysis of source" /> |
| 232 | <target name="test" depends="build" description="Test this project" /> |
| 233 | <target name="build" description="Build and (maybe) package this project" /> |
| 234 | |
| 235 | <target name="clean" description="Cleans this project's intermediate and output files"> |
| 236 | <delete dir="${project.build}" /> |
| 237 | </target> |
| 238 | |
| 239 | </project> |