gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 1 | <project name="common"> |
| 2 | <property name="test.ant.file" location="${gwt.root}/${project.tail}/build.xml" /> |
| 3 | <condition property="project.valid"> |
| 4 | <equals arg1="${ant.file}" arg2="${test.ant.file}" /> |
| 5 | </condition> |
| 6 | <fail unless="project.valid" message="This build file is in an inconsistent state." /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 7 | |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 8 | <!-- Global Properties --> |
| 9 | <property environment="env" /> |
| 10 | <condition property="gwt.version" value="${env.GWT_VERSION}" else="0.0.0"> |
| 11 | <isset property="env.GWT_VERSION" /> |
| 12 | </condition> |
| 13 | <condition property="gwt.tools.check" value="${env.GWT_TOOLS}" else="${gwt.root}/../tools"> |
| 14 | <isset property="env.GWT_TOOLS" /> |
| 15 | </condition> |
| 16 | <property name="gwt.tools" location="${gwt.tools.check}" /> |
| 17 | <property name="gwt.tools.lib" location="${gwt.tools}/lib" /> |
| 18 | <property name="gwt.tools.antlib" location="${gwt.tools}/antlib" /> |
| 19 | <property name="gwt.tools.redist" location="${gwt.tools}/redist" /> |
| 20 | <property name="gwt.build" location="${gwt.root}/build" /> |
| 21 | <property name="gwt.build.out" location="${gwt.build}/out" /> |
| 22 | <property name="gwt.build.lib" location="${gwt.build}/lib" /> |
| 23 | <property name="gwt.build.jni" location="${gwt.build}/jni" /> |
| 24 | <property name="gwt.build.staging" location="${gwt.build}/staging" /> |
| 25 | <property name="gwt.build.dist" location="${gwt.build}/dist" /> |
| 26 | <property name="project.build" location="${gwt.build.out}/${project.tail}" /> |
| 27 | <property name="project.lib" location="${gwt.build.lib}/gwt-${ant.project.name}.jar" /> |
| 28 | <property name="project.jni" location="${gwt.build}/${project.tail}" /> |
| 29 | <property name="unjar.out" location="${project.build}/unjar" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 30 | <property name="javac.out" location="${project.build}/bin" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 31 | <property name="javac.junit.out" location="${project.build}/bin-test" /> |
| 32 | <property name="javac.debug" value="true" /> |
| 33 | <property name="javac.debuglevel" value="lines,vars,source" /> |
gwt.team.mmendez | 14e28a2 | 2006-12-11 04:34:27 +0000 | [diff] [blame] | 34 | <property name="javac.encoding" value="utf-8" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 35 | <property name="javac.source" value="1.4" /> |
| 36 | <property name="javac.nowarn" value="true" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 37 | <property name="junit.out" location="${project.build}/test" /> |
gwt.team.scottb | a4f285c | 2006-12-09 02:11:15 +0000 | [diff] [blame] | 38 | |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 39 | <!-- Sanity check --> |
| 40 | <available file="${gwt.tools}" type="dir" property="gwt.tools.exists" /> |
| 41 | <fail unless="gwt.tools.exists" message="Cannot find '${gwt.tools}' tools directory; perhaps you should define the GWT_TOOLS environment variable" /> |
| 42 | |
| 43 | <!-- JUnit support --> |
| 44 | <condition property="build.host.platform" value="linux"> |
| 45 | <and> |
| 46 | <os family="unix" /> |
| 47 | <not> |
| 48 | <contains string="${os.name}" substring="mac" casesensitive="false" /> |
| 49 | </not> |
| 50 | </and> |
| 51 | </condition> |
| 52 | |
| 53 | <condition property="build.host.platform" value="mac"> |
| 54 | <and> |
| 55 | <os family="unix" /> |
| 56 | <contains string="${os.name}" substring="mac" casesensitive="false" /> |
| 57 | </and> |
| 58 | </condition> |
| 59 | |
| 60 | <condition property="build.host.platform" value="windows"> |
| 61 | <os family="windows" /> |
| 62 | </condition> |
| 63 | <fail unless="build.host.platform" message="Building on ${os.name} is not supported" /> |
| 64 | |
| 65 | <condition property="junit.platform.args" value="-XstartOnFirstThread" else=""> |
| 66 | <equals arg1="${build.host.platform}" arg2="mac" casesensitive="false" /> |
| 67 | </condition> |
| 68 | |
gwt.team.scottb | a4f285c | 2006-12-09 02:11:15 +0000 | [diff] [blame] | 69 | <property name="gwt.dev.staging.jar" location="${gwt.build.staging}/gwt-${build.host.platform}-${gwt.version}/gwt-dev-${build.host.platform}.jar" /> |
| 70 | <property name="gwt.junit.port" value="8888" /> |
| 71 | |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 72 | <!-- |
| 73 | Comma delimited list of host and path components on which to run remote browser testing. |
| 74 | --> |
gwt.team.scottb | a4f285c | 2006-12-09 02:11:15 +0000 | [diff] [blame] | 75 | <property name="gwt.remote.browsers" value="" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 76 | |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 77 | |
| 78 | <!-- Pulls in tasks defined in ant-contrib, i.e. foreach --> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 79 | <taskdef resource="net/sf/antcontrib/antlib.xml"> |
gwt.team.scottb | a4f285c | 2006-12-09 02:11:15 +0000 | [diff] [blame] | 80 | <classpath> |
| 81 | <pathelement location="${gwt.tools.antlib}/ant-contrib-1.0b3.jar" /> |
| 82 | </classpath> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 83 | </taskdef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 84 | |
| 85 | <!-- Global Custom Tasks --> |
| 86 | <presetdef name="gwt.ant"> |
| 87 | <ant inheritall="false" target="${target}"> |
| 88 | <propertyset> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 89 | <propertyref name="gwt.version" /> |
| 90 | <propertyref name="gwt.junit.port" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 91 | <propertyref name="gwt.remote.browsers" /> |
| 92 | </propertyset> |
| 93 | </ant> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 94 | </presetdef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 95 | |
| 96 | <presetdef name="gwt.javac"> |
gwt.team.mmendez | 14e28a2 | 2006-12-11 04:34:27 +0000 | [diff] [blame] | 97 | <javac srcdir="src" destdir="${javac.out}" classpath="${unjar.out}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="${javac.source}" nowarn="${javac.nowarn}" encoding="${javac.encoding}" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 98 | </presetdef> |
| 99 | |
| 100 | <presetdef name="gwt.jar"> |
| 101 | <jar destfile="${project.lib}" update="true" duplicate="preserve" index="true" /> |
| 102 | </presetdef> |
| 103 | |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 104 | <macrodef name="gwt.junit"> |
| 105 | <attribute name="test.args" default="" /> |
| 106 | <attribute name="test.out" default="" /> |
| 107 | <attribute name="test.reports" default="@{test.out}/reports" /> |
| 108 | <attribute name="test.cases" default="" /> |
gwt.team.scottb | a4f285c | 2006-12-09 02:11:15 +0000 | [diff] [blame] | 109 | <sequential> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 110 | <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"> |
| 111 | <classpath> |
| 112 | <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> |
| 113 | <pathelement location="${gwt.tools.antlib}/ant-junit-1.6.5.jar" /> |
| 114 | </classpath> |
| 115 | </taskdef> |
| 116 | |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 117 | <echo message="Writing test results to @{test.reports} for @{test.cases}" /> |
gwt.team.scottb | a4f285c | 2006-12-09 02:11:15 +0000 | [diff] [blame] | 118 | <mkdir dir="@{test.reports}" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 119 | |
gwt.team.scottb | a4f285c | 2006-12-09 02:11:15 +0000 | [diff] [blame] | 120 | <echo message="${javac.out} ${javac.junit.out}" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 121 | <junit dir="@{test.out}" fork="yes" printsummary="yes" haltonfailure="true"> |
gwt.team.scottb | 193a3b9 | 2006-12-11 22:24:38 +0000 | [diff] [blame] | 122 | <jvmarg line="${junit.platform.args}" /> |
gwt.team.scottb | a4f285c | 2006-12-09 02:11:15 +0000 | [diff] [blame] | 123 | <sysproperty key="gwt.args" value="@{test.args}" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 124 | <sysproperty key="gwt.devjar" value="${gwt.dev.staging.jar}" /> |
| 125 | <sysproperty key="java.awt.headless" value="true" /> |
| 126 | |
| 127 | <classpath> |
| 128 | <pathelement location="${gwt.root}/${project.tail}/src" /> |
| 129 | <pathelement location="${gwt.root}/${project.tail}/super" /> |
| 130 | <pathelement location="${gwt.root}/${project.tail}/test" /> |
| 131 | <pathelement location="${javac.junit.out}" /> |
| 132 | <pathelement location="${javac.out}" /> |
| 133 | <pathelement location="${gwt.dev.staging.jar}" /> |
| 134 | </classpath> |
| 135 | |
| 136 | <formatter type="plain" /> |
| 137 | <formatter type="xml" /> |
| 138 | |
| 139 | <batchtest todir="@{test.reports}"> |
| 140 | <fileset refid="@{test.cases}" /> |
| 141 | </batchtest> |
| 142 | </junit> |
| 143 | </sequential> |
| 144 | </macrodef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 145 | |
| 146 | <macrodef name="gwt.untar"> |
| 147 | <attribute name="src" /> |
| 148 | <attribute name="dest" /> |
| 149 | <sequential> |
| 150 | <!-- GNU tar handles permissions and symlinks correctly --> |
| 151 | <exec executable="tar" failonerror="true"> |
| 152 | <arg value="-xpzf" /> |
| 153 | <arg file="@{src}" /> |
| 154 | <arg value="-C" /> |
| 155 | <arg file="@{dest}" /> |
| 156 | </exec> |
| 157 | </sequential> |
| 158 | </macrodef> |
| 159 | |
gwt.team.scottb | b5aba97 | 2006-12-10 06:07:09 +0000 | [diff] [blame] | 160 | <target name="-unjar.maybe" unless="unjar.upToDate"> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 161 | <mkdir dir="${unjar.out}" /> |
| 162 | <unjar src="${unjar.path}" dest="${unjar.out}" overwrite="true" /> |
| 163 | <touch file="${unjar.flagFile}" /> |
| 164 | </target> |
| 165 | |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 166 | <macrodef name="gwt.unjar"> |
| 167 | <attribute name="toollib" default="" /> |
| 168 | <attribute name="path" default="${gwt.tools.lib}/@{toollib}" /> |
| 169 | <sequential> |
gwt.team.scottb | b5aba97 | 2006-12-10 06:07:09 +0000 | [diff] [blame] | 170 | <basename property="@{path}.unjar.name" file="@{path}" /> |
| 171 | <property name="@{path}.unjar.flagFile" value="${project.build}/${@{path}.unjar.name}.unjar" /> |
| 172 | <uptodate property="@{path}.unjar.upToDate" value="unjar.upToDate" srcfile="@{path}" targetfile="${@{path}.unjar.flagFile}" /> |
| 173 | <antcall target="-unjar.maybe"> |
| 174 | <param name="${@{path}.unjar.upToDate}" value="true" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 175 | <param name="unjar.path" value="@{path}" /> |
gwt.team.scottb | b5aba97 | 2006-12-10 06:07:09 +0000 | [diff] [blame] | 176 | <param name="unjar.flagFile" value="${@{path}.unjar.flagFile}" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 177 | </antcall> |
| 178 | </sequential> |
| 179 | </macrodef> |
| 180 | |
| 181 | <macrodef name="property.ensure"> |
| 182 | <attribute name="name" /> |
gwt.team.mmendez | 99f280b | 2006-12-08 23:11:29 +0000 | [diff] [blame] | 183 | <attribute name="location" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 184 | <attribute name="message" default="Cannot find dependency ${@{name}}" /> |
| 185 | <sequential> |
| 186 | <property name="@{name}" location="@{location}" /> |
| 187 | <available file="${@{name}}" property="@{name}.exists" /> |
| 188 | <fail unless="@{name}.exists" message="@{message}" /> |
| 189 | </sequential> |
| 190 | </macrodef> |
| 191 | |
| 192 | <macrodef name="gwt.checkstyle"> |
| 193 | <element name="sourcepath" implicit="yes" optional="true" /> |
| 194 | <sequential> |
| 195 | <taskdef resource="checkstyletask.properties" classpath="${gwt.tools.antlib}/checkstyle-all-4.2.jar;${gwt.build.lib}/gwt-customchecks.jar" /> |
| 196 | <checkstyle config="${gwt.root}/eclipse/settings/code-style/gwt-checkstyle.xml" maxWarnings="0"> |
| 197 | <property key="checkstyle.header.file" file="${gwt.root}/eclipse/settings/code-style/google.header" /> |
| 198 | <sourcepath /> |
| 199 | </checkstyle> |
| 200 | </sequential> |
| 201 | </macrodef> |
| 202 | |
| 203 | <!-- Default implementations of the required targets; projects should |
| 204 | override the ones that matter --> |
| 205 | <target name="all" depends="verify" /> |
| 206 | <target name="verify" depends="checkstyle, test" description="Verify this project" /> |
| 207 | <target name="checkstyle" description="Static analysis of source" /> |
| 208 | <target name="test" depends="build" description="Test this project" /> |
| 209 | <target name="build" description="Build and (maybe) package this project" /> |
| 210 | |
| 211 | <target name="clean" description="Cleans this project's intermediate and output files"> |
| 212 | <delete dir="${project.build}" /> |
| 213 | </target> |
| 214 | |
| 215 | </project> |