blob: 154997d34957b26aa243d9a1d452b644fe627853 [file] [log] [blame]
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +00001<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.mmendez99f280b2006-12-08 23:11:29 +00007
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +00008 <!-- 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.mmendez99f280b2006-12-08 23:11:29 +000029 <property name="javac.out" location="${project.build}/bin" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +000030 <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.mmendez14e28a22006-12-11 04:34:27 +000033 <property name="javac.encoding" value="utf-8" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +000034 <property name="javac.source" value="1.4" />
35 <property name="javac.nowarn" value="true" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000036 <property name="junit.out" location="${project.build}/test" />
gwt.team.scottba4f285c2006-12-09 02:11:15 +000037
gwt.team.scottb193a3b92006-12-11 22:24:38 +000038 <!-- 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
gwt.team.scottb428b2632006-12-12 22:40:34 +000042 <!-- Platform identification -->
43 <condition property="build.host.islinux">
gwt.team.scottb193a3b92006-12-11 22:24:38 +000044 <and>
45 <os family="unix" />
46 <not>
47 <contains string="${os.name}" substring="mac" casesensitive="false" />
48 </not>
49 </and>
50 </condition>
gwt.team.scottb428b2632006-12-12 22:40:34 +000051 <condition property="build.host.platform" value="linux">
52 <isset property="build.host.islinux" />
53 </condition>
gwt.team.scottb193a3b92006-12-11 22:24:38 +000054
gwt.team.scottb428b2632006-12-12 22:40:34 +000055 <condition property="build.host.ismac">
gwt.team.scottb193a3b92006-12-11 22:24:38 +000056 <and>
57 <os family="unix" />
58 <contains string="${os.name}" substring="mac" casesensitive="false" />
59 </and>
60 </condition>
gwt.team.scottb428b2632006-12-12 22:40:34 +000061 <condition property="build.host.platform" value="mac">
62 <isset property="build.host.ismac" />
63 </condition>
gwt.team.scottb193a3b92006-12-11 22:24:38 +000064
gwt.team.scottb428b2632006-12-12 22:40:34 +000065 <condition property="build.host.iswindows">
gwt.team.scottb193a3b92006-12-11 22:24:38 +000066 <os family="windows" />
67 </condition>
gwt.team.scottb428b2632006-12-12 22:40:34 +000068 <condition property="build.host.platform" value="windows">
69 <isset property="build.host.iswindows" />
70 </condition>
gwt.team.scottb193a3b92006-12-11 22:24:38 +000071 <fail unless="build.host.platform" message="Building on ${os.name} is not supported" />
72
73 <condition property="junit.platform.args" value="-XstartOnFirstThread" else="">
74 <equals arg1="${build.host.platform}" arg2="mac" casesensitive="false" />
75 </condition>
76
gwt.team.scottb428b2632006-12-12 22:40:34 +000077 <!-- JUnit support -->
gwt.team.scottba4f285c2006-12-09 02:11:15 +000078 <property name="gwt.dev.staging.jar" location="${gwt.build.staging}/gwt-${build.host.platform}-${gwt.version}/gwt-dev-${build.host.platform}.jar" />
79 <property name="gwt.junit.port" value="8888" />
80
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000081 <!--
82 Comma delimited list of host and path components on which to run remote browser testing.
83 -->
gwt.team.scottba4f285c2006-12-09 02:11:15 +000084 <property name="gwt.remote.browsers" value="" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000085
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +000086
87 <!-- Pulls in tasks defined in ant-contrib, i.e. foreach -->
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000088 <taskdef resource="net/sf/antcontrib/antlib.xml">
gwt.team.scottba4f285c2006-12-09 02:11:15 +000089 <classpath>
90 <pathelement location="${gwt.tools.antlib}/ant-contrib-1.0b3.jar" />
91 </classpath>
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000092 </taskdef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +000093
94 <!-- Global Custom Tasks -->
95 <presetdef name="gwt.ant">
96 <ant inheritall="false" target="${target}">
97 <propertyset>
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000098 <propertyref name="gwt.version" />
99 <propertyref name="gwt.junit.port" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000100 <propertyref name="gwt.remote.browsers" />
101 </propertyset>
102 </ant>
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000103 </presetdef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000104
105 <presetdef name="gwt.javac">
gwt.team.scottbc4700b82006-12-12 11:23:41 +0000106 <javac srcdir="src" destdir="${javac.out}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="${javac.source}" nowarn="${javac.nowarn}" encoding="${javac.encoding}" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000107 </presetdef>
108
109 <presetdef name="gwt.jar">
110 <jar destfile="${project.lib}" update="true" duplicate="preserve" index="true" />
111 </presetdef>
112
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000113 <macrodef name="gwt.junit">
114 <attribute name="test.args" default="" />
115 <attribute name="test.out" default="" />
116 <attribute name="test.reports" default="@{test.out}/reports" />
117 <attribute name="test.cases" default="" />
gwt.team.scottba4f285c2006-12-09 02:11:15 +0000118 <sequential>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000119 <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
120 <classpath>
121 <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" />
122 <pathelement location="${gwt.tools.antlib}/ant-junit-1.6.5.jar" />
123 </classpath>
124 </taskdef>
125
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000126 <echo message="Writing test results to @{test.reports} for @{test.cases}" />
gwt.team.scottba4f285c2006-12-09 02:11:15 +0000127 <mkdir dir="@{test.reports}" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000128
gwt.team.scottba4f285c2006-12-09 02:11:15 +0000129 <echo message="${javac.out} ${javac.junit.out}" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000130 <junit dir="@{test.out}" fork="yes" printsummary="yes" haltonfailure="true">
gwt.team.scottb193a3b92006-12-11 22:24:38 +0000131 <jvmarg line="${junit.platform.args}" />
gwt.team.scottba4f285c2006-12-09 02:11:15 +0000132 <sysproperty key="gwt.args" value="@{test.args}" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000133 <sysproperty key="gwt.devjar" value="${gwt.dev.staging.jar}" />
134 <sysproperty key="java.awt.headless" value="true" />
135
136 <classpath>
137 <pathelement location="${gwt.root}/${project.tail}/src" />
138 <pathelement location="${gwt.root}/${project.tail}/super" />
139 <pathelement location="${gwt.root}/${project.tail}/test" />
140 <pathelement location="${javac.junit.out}" />
141 <pathelement location="${javac.out}" />
142 <pathelement location="${gwt.dev.staging.jar}" />
143 </classpath>
144
145 <formatter type="plain" />
146 <formatter type="xml" />
147
148 <batchtest todir="@{test.reports}">
149 <fileset refid="@{test.cases}" />
150 </batchtest>
151 </junit>
152 </sequential>
153 </macrodef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000154
gwt.team.scottbb05c9002006-12-12 09:53:31 +0000155 <macrodef name="gwt.tgz.cat">
156 <attribute name="destfile" />
157 <element name="tar.elements" implicit="true" optional="true" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000158 <sequential>
gwt.team.scottbb05c9002006-12-12 09:53:31 +0000159 <taskdef name="tar.cat" classname="com.google.gwt.ant.taskdefs.TarCat" classpath="${gwt.build.lib}/ant-gwt.jar" />
160 <tar.cat destfile="${project.dist}" compression="gzip" longfile="gnu">
161 <tar.elements />
162 </tar.cat>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000163 </sequential>
164 </macrodef>
165
gwt.team.scottbc4700b82006-12-12 11:23:41 +0000166 <macrodef name="gwt.checkstyle">
167 <element name="sourcepath" implicit="yes" optional="true" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000168 <sequential>
gwt.team.scottbc4700b82006-12-12 11:23:41 +0000169 <taskdef resource="checkstyletask.properties" classpath="${gwt.tools.antlib}/checkstyle-all-4.2.jar;${gwt.build.lib}/gwt-customchecks.jar" />
170 <checkstyle config="${gwt.root}/eclipse/settings/code-style/gwt-checkstyle.xml" maxWarnings="0">
171 <property key="checkstyle.header.file" file="${gwt.root}/eclipse/settings/code-style/google.header" />
172 <sourcepath />
173 </checkstyle>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000174 </sequential>
175 </macrodef>
176
177 <macrodef name="property.ensure">
178 <attribute name="name" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000179 <attribute name="location" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000180 <attribute name="message" default="Cannot find dependency ${@{name}}" />
gwt.team.scottb428b2632006-12-12 22:40:34 +0000181 <attribute name="unless" default="__nonexistent_property__" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000182 <sequential>
183 <property name="@{name}" location="@{location}" />
gwt.team.scottb428b2632006-12-12 22:40:34 +0000184 <condition property="@{name}.exists">
185 <or>
186 <available file="${@{name}}" />
187 <isset property="@{unless}" />
188 </or>
189 </condition>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000190 <fail unless="@{name}.exists" message="@{message}" />
191 </sequential>
192 </macrodef>
193
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000194 <!-- Default implementations of the required targets; projects should
195 override the ones that matter -->
196 <target name="all" depends="verify" />
197 <target name="verify" depends="checkstyle, test" description="Verify this project" />
198 <target name="checkstyle" description="Static analysis of source" />
199 <target name="test" depends="build" description="Test this project" />
200 <target name="build" description="Build and (maybe) package this project" />
201
202 <target name="clean" description="Cleans this project's intermediate and output files">
203 <delete dir="${project.build}" />
204 </target>
205
206</project>