blob: d2a3797f1823ffccabfc21b6f592fe1c7d037e78 [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
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.scottba4f285c2006-12-09 02:11:15 +000068 <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.mmendez99f280b2006-12-08 23:11:29 +000071 <!--
72 Comma delimited list of host and path components on which to run remote browser testing.
73 -->
gwt.team.scottba4f285c2006-12-09 02:11:15 +000074 <property name="gwt.remote.browsers" value="" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000075
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +000076
77 <!-- Pulls in tasks defined in ant-contrib, i.e. foreach -->
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000078 <taskdef resource="net/sf/antcontrib/antlib.xml">
gwt.team.scottba4f285c2006-12-09 02:11:15 +000079 <classpath>
80 <pathelement location="${gwt.tools.antlib}/ant-contrib-1.0b3.jar" />
81 </classpath>
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000082 </taskdef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +000083
84 <!-- Global Custom Tasks -->
85 <presetdef name="gwt.ant">
86 <ant inheritall="false" target="${target}">
87 <propertyset>
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000088 <propertyref name="gwt.version" />
89 <propertyref name="gwt.junit.port" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +000090 <propertyref name="gwt.remote.browsers" />
91 </propertyset>
92 </ant>
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000093 </presetdef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +000094
95 <presetdef name="gwt.javac">
gwt.team.scottbc4700b82006-12-12 11:23:41 +000096 <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 +000097 </presetdef>
98
99 <presetdef name="gwt.jar">
100 <jar destfile="${project.lib}" update="true" duplicate="preserve" index="true" />
101 </presetdef>
102
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000103 <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.scottba4f285c2006-12-09 02:11:15 +0000108 <sequential>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000109 <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.mmendez99f280b2006-12-08 23:11:29 +0000116 <echo message="Writing test results to @{test.reports} for @{test.cases}" />
gwt.team.scottba4f285c2006-12-09 02:11:15 +0000117 <mkdir dir="@{test.reports}" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000118
gwt.team.scottba4f285c2006-12-09 02:11:15 +0000119 <echo message="${javac.out} ${javac.junit.out}" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000120 <junit dir="@{test.out}" fork="yes" printsummary="yes" haltonfailure="true">
gwt.team.scottb193a3b92006-12-11 22:24:38 +0000121 <jvmarg line="${junit.platform.args}" />
gwt.team.scottba4f285c2006-12-09 02:11:15 +0000122 <sysproperty key="gwt.args" value="@{test.args}" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000123 <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.scottb14c5b9d2006-12-10 06:06:08 +0000144
gwt.team.scottbb05c9002006-12-12 09:53:31 +0000145 <macrodef name="gwt.tgz.cat">
146 <attribute name="destfile" />
147 <element name="tar.elements" implicit="true" optional="true" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000148 <sequential>
gwt.team.scottbb05c9002006-12-12 09:53:31 +0000149 <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.scottb14c5b9d2006-12-10 06:06:08 +0000153 </sequential>
154 </macrodef>
155
gwt.team.scottbc4700b82006-12-12 11:23:41 +0000156 <macrodef name="gwt.checkstyle">
157 <element name="sourcepath" implicit="yes" optional="true" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000158 <sequential>
gwt.team.scottbc4700b82006-12-12 11:23:41 +0000159 <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.scottb14c5b9d2006-12-10 06:06:08 +0000164 </sequential>
165 </macrodef>
166
167 <macrodef name="property.ensure">
168 <attribute name="name" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000169 <attribute name="location" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000170 <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.scottb14c5b9d2006-12-10 06:06:08 +0000178 <!-- 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>