blob: eae088511a715e7237d56f39d2f77f84b7a78c6d [file] [log] [blame]
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +00001<project name="common">
gwt.team.jatceab1ec2006-12-28 22:48:49 +00002 <!-- gwt.build.iscasesensitivefs is true if the filesystem of the
3 build machine is case-sensitive, false otherwise. Update with
4 new lines for any supported platforms with case-insensitive
5 filesystems
6 -->
7 <condition property="gwt.build.iscasesensitivefs" else="false">
8 <not>
9 <or>
10 <os family="windows"/>
11 </or>
12 </not>
13 </condition>
14
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +000015 <property name="test.ant.file" location="${gwt.root}/${project.tail}/build.xml" />
16 <condition property="project.valid">
gwt.team.jatceab1ec2006-12-28 22:48:49 +000017 <equals arg1="${ant.file}" arg2="${test.ant.file}"
18 casesensitive="${gwt.build.iscasesensitivefs}"/>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +000019 </condition>
gwt.team.knorton8d3c2882008-03-05 06:18:35 +000020 <fail unless="project.valid" message="This build file is in an inconsistent state (${ant.file} != ${test.ant.file})." />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000021
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +000022 <!-- Global Properties -->
23 <property environment="env" />
24 <condition property="gwt.version" value="${env.GWT_VERSION}" else="0.0.0">
25 <isset property="env.GWT_VERSION" />
26 </condition>
27 <condition property="gwt.tools.check" value="${env.GWT_TOOLS}" else="${gwt.root}/../tools">
28 <isset property="env.GWT_TOOLS" />
29 </condition>
30 <property name="gwt.tools" location="${gwt.tools.check}" />
31 <property name="gwt.tools.lib" location="${gwt.tools}/lib" />
32 <property name="gwt.tools.antlib" location="${gwt.tools}/antlib" />
33 <property name="gwt.tools.redist" location="${gwt.tools}/redist" />
34 <property name="gwt.build" location="${gwt.root}/build" />
35 <property name="gwt.build.out" location="${gwt.build}/out" />
36 <property name="gwt.build.lib" location="${gwt.build}/lib" />
37 <property name="gwt.build.jni" location="${gwt.build}/jni" />
38 <property name="gwt.build.staging" location="${gwt.build}/staging" />
39 <property name="gwt.build.dist" location="${gwt.build}/dist" />
40 <property name="project.build" location="${gwt.build.out}/${project.tail}" />
41 <property name="project.lib" location="${gwt.build.lib}/gwt-${ant.project.name}.jar" />
42 <property name="project.jni" location="${gwt.build}/${project.tail}" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000043 <property name="javac.out" location="${project.build}/bin" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +000044 <property name="javac.junit.out" location="${project.build}/bin-test" />
45 <property name="javac.debug" value="true" />
46 <property name="javac.debuglevel" value="lines,vars,source" />
gwt.team.mmendez14e28a22006-12-11 04:34:27 +000047 <property name="javac.encoding" value="utf-8" />
gwt.team.scottb452a7e32007-08-21 02:34:57 +000048 <property name="javac.source" value="1.5" />
scottb@google.comc89e2372008-02-11 18:53:40 +000049 <property name="javac.target" value="1.5" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +000050 <property name="javac.nowarn" value="true" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000051 <property name="junit.out" location="${project.build}/test" />
gwt.team.mmendez764ec742007-03-20 19:36:54 +000052
gwt.team.scottb193a3b92006-12-11 22:24:38 +000053 <!-- Sanity check -->
54 <available file="${gwt.tools}" type="dir" property="gwt.tools.exists" />
55 <fail unless="gwt.tools.exists" message="Cannot find '${gwt.tools}' tools directory; perhaps you should define the GWT_TOOLS environment variable" />
56
gwt.team.scottb428b2632006-12-12 22:40:34 +000057 <!-- Platform identification -->
58 <condition property="build.host.islinux">
gwt.team.scottb193a3b92006-12-11 22:24:38 +000059 <and>
60 <os family="unix" />
61 <not>
62 <contains string="${os.name}" substring="mac" casesensitive="false" />
63 </not>
64 </and>
65 </condition>
gwt.team.scottb428b2632006-12-12 22:40:34 +000066 <condition property="build.host.platform" value="linux">
67 <isset property="build.host.islinux" />
68 </condition>
gwt.team.scottb193a3b92006-12-11 22:24:38 +000069
gwt.team.scottb428b2632006-12-12 22:40:34 +000070 <condition property="build.host.ismac">
gwt.team.scottb193a3b92006-12-11 22:24:38 +000071 <and>
72 <os family="unix" />
73 <contains string="${os.name}" substring="mac" casesensitive="false" />
74 </and>
75 </condition>
gwt.team.scottb428b2632006-12-12 22:40:34 +000076 <condition property="build.host.platform" value="mac">
gwt.team.knortoncf244552008-03-20 09:40:25 +000077 <isset property="build.host.ismac" />
gwt.team.scottb428b2632006-12-12 22:40:34 +000078 </condition>
gwt.team.scottb193a3b92006-12-11 22:24:38 +000079
gwt.team.scottb428b2632006-12-12 22:40:34 +000080 <condition property="build.host.iswindows">
gwt.team.scottb193a3b92006-12-11 22:24:38 +000081 <os family="windows" />
82 </condition>
gwt.team.scottb428b2632006-12-12 22:40:34 +000083 <condition property="build.host.platform" value="windows">
84 <isset property="build.host.iswindows" />
85 </condition>
gwt.team.scottb193a3b92006-12-11 22:24:38 +000086 <fail unless="build.host.platform" message="Building on ${os.name} is not supported" />
87
88 <condition property="junit.platform.args" value="-XstartOnFirstThread" else="">
gwt.team.knorton8d3c2882008-03-05 06:18:35 +000089 <isset property="build.host.ismac" />
gwt.team.scottb193a3b92006-12-11 22:24:38 +000090 </condition>
91
gwt.team.scottb428b2632006-12-12 22:40:34 +000092 <!-- JUnit support -->
gwt.team.knortoncf244552008-03-20 09:40:25 +000093 <property name="gwt.dev.staging.jar" location="${gwt.build.staging}/gwt-${build.host.platform}-${gwt.version}/gwt-dev-${build.host.platform}.jar" />
gwt.team.scottba4f285c2006-12-09 02:11:15 +000094 <property name="gwt.junit.port" value="8888" />
gwt.team.bobv799633f2008-02-29 23:58:24 +000095 <property name="gwt.junit.testcase.includes" value="**/*Suite.class"/>
gwt.team.mmendez764ec742007-03-20 19:36:54 +000096
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +000097
98 <!-- Pulls in tasks defined in ant-contrib, i.e. foreach -->
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000099 <taskdef resource="net/sf/antcontrib/antlib.xml">
gwt.team.scottba4f285c2006-12-09 02:11:15 +0000100 <classpath>
101 <pathelement location="${gwt.tools.antlib}/ant-contrib-1.0b3.jar" />
102 </classpath>
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000103 </taskdef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000104
105 <!-- Global Custom Tasks -->
106 <presetdef name="gwt.ant">
107 <ant inheritall="false" target="${target}">
108 <propertyset>
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000109 <propertyref name="gwt.version" />
110 <propertyref name="gwt.junit.port" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000111 <propertyref name="gwt.remote.browsers" />
112 </propertyset>
113 </ant>
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000114 </presetdef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000115
116 <presetdef name="gwt.javac">
scottb@google.comc89e2372008-02-11 18:53:40 +0000117 <javac srcdir="src" destdir="${javac.out}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="${javac.source}" target="${javac.target}" nowarn="${javac.nowarn}" encoding="${javac.encoding}" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000118 </presetdef>
119
120 <presetdef name="gwt.jar">
121 <jar destfile="${project.lib}" update="true" duplicate="preserve" index="true" />
122 </presetdef>
123
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000124 <macrodef name="gwt.junit">
gwt.team.scottb86357042007-03-09 08:00:14 +0000125 <!-- TODO: make this more generic / refactor so it can be used from dev/core -->
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000126 <attribute name="test.args" default="" />
127 <attribute name="test.out" default="" />
128 <attribute name="test.reports" default="@{test.out}/reports" />
129 <attribute name="test.cases" default="" />
gwt.team.scottba4f285c2006-12-09 02:11:15 +0000130 <sequential>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000131 <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
132 <classpath>
133 <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" />
134 <pathelement location="${gwt.tools.antlib}/ant-junit-1.6.5.jar" />
135 </classpath>
136 </taskdef>
137
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000138 <echo message="Writing test results to @{test.reports} for @{test.cases}" />
gwt.team.scottba4f285c2006-12-09 02:11:15 +0000139 <mkdir dir="@{test.reports}" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000140
gwt.team.scottba4f285c2006-12-09 02:11:15 +0000141 <echo message="${javac.out} ${javac.junit.out}" />
gwt.team.bobv799633f2008-02-29 23:58:24 +0000142 <junit dir="@{test.out}" fork="yes" printsummary="yes" failureproperty="junit.failure" >
gwt.team.scottb193a3b92006-12-11 22:24:38 +0000143 <jvmarg line="${junit.platform.args}" />
gwt.team.bobv799633f2008-02-29 23:58:24 +0000144 <jvmarg line="-Xmx512m" />
gwt.team.scottba4f285c2006-12-09 02:11:15 +0000145 <sysproperty key="gwt.args" value="@{test.args}" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000146 <sysproperty key="gwt.devjar" value="${gwt.dev.staging.jar}" />
147 <sysproperty key="java.awt.headless" value="true" />
148
149 <classpath>
150 <pathelement location="${gwt.root}/${project.tail}/src" />
151 <pathelement location="${gwt.root}/${project.tail}/super" />
152 <pathelement location="${gwt.root}/${project.tail}/test" />
153 <pathelement location="${javac.junit.out}" />
154 <pathelement location="${javac.out}" />
155 <pathelement location="${gwt.dev.staging.jar}" />
gwt.team.scottbe18b95c2006-12-21 22:35:49 +0000156 <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000157 </classpath>
158
159 <formatter type="plain" />
160 <formatter type="xml" />
161
162 <batchtest todir="@{test.reports}">
163 <fileset refid="@{test.cases}" />
164 </batchtest>
165 </junit>
gwt.team.bobv799633f2008-02-29 23:58:24 +0000166 <fail message="One or more junit tests failed" if="junit.failure" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000167 </sequential>
168 </macrodef>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000169
gwt.team.scottbb05c9002006-12-12 09:53:31 +0000170 <macrodef name="gwt.tgz.cat">
171 <attribute name="destfile" />
scottb@google.come1f32342008-03-18 16:27:19 +0000172 <attribute name="compression" default="gzip" />
gwt.team.scottbb05c9002006-12-12 09:53:31 +0000173 <element name="tar.elements" implicit="true" optional="true" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000174 <sequential>
gwt.team.scottbb05c9002006-12-12 09:53:31 +0000175 <taskdef name="tar.cat" classname="com.google.gwt.ant.taskdefs.TarCat" classpath="${gwt.build.lib}/ant-gwt.jar" />
scottb@google.come1f32342008-03-18 16:27:19 +0000176 <tar.cat destfile="@{destfile}" compression="@{compression}" longfile="gnu">
gwt.team.scottbb05c9002006-12-12 09:53:31 +0000177 <tar.elements />
178 </tar.cat>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000179 </sequential>
180 </macrodef>
181
gwt.team.scottbc4700b82006-12-12 11:23:41 +0000182 <macrodef name="gwt.checkstyle">
183 <element name="sourcepath" implicit="yes" optional="true" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000184 <sequential>
gwt.team.scottbc4700b82006-12-12 11:23:41 +0000185 <taskdef resource="checkstyletask.properties" classpath="${gwt.tools.antlib}/checkstyle-all-4.2.jar;${gwt.build.lib}/gwt-customchecks.jar" />
186 <checkstyle config="${gwt.root}/eclipse/settings/code-style/gwt-checkstyle.xml" maxWarnings="0">
187 <property key="checkstyle.header.file" file="${gwt.root}/eclipse/settings/code-style/google.header" />
188 <sourcepath />
189 </checkstyle>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000190 </sequential>
191 </macrodef>
192
193 <macrodef name="property.ensure">
194 <attribute name="name" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000195 <attribute name="location" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000196 <attribute name="message" default="Cannot find dependency ${@{name}}" />
gwt.team.scottb428b2632006-12-12 22:40:34 +0000197 <attribute name="unless" default="__nonexistent_property__" />
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000198 <sequential>
199 <property name="@{name}" location="@{location}" />
gwt.team.scottb428b2632006-12-12 22:40:34 +0000200 <condition property="@{name}.exists">
201 <or>
202 <available file="${@{name}}" />
203 <isset property="@{unless}" />
204 </or>
205 </condition>
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000206 <fail unless="@{name}.exists" message="@{message}" />
207 </sequential>
208 </macrodef>
209
gwt.team.scottb14c5b9d2006-12-10 06:06:08 +0000210 <!-- Default implementations of the required targets; projects should
211 override the ones that matter -->
212 <target name="all" depends="verify" />
213 <target name="verify" depends="checkstyle, test" description="Verify this project" />
214 <target name="checkstyle" description="Static analysis of source" />
215 <target name="test" depends="build" description="Test this project" />
216 <target name="build" description="Build and (maybe) package this project" />
217
218 <target name="clean" description="Cleans this project's intermediate and output files">
219 <delete dir="${project.build}" />
220 </target>
221
222</project>