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