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