blob: 2e88fb074e560911a1a133bf30d5912c76e13f1e [file] [log] [blame]
gwt.team.scottbab0aa682006-12-06 23:14:19 +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
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.scottbab0aa682006-12-06 23:14:19 +000020
21 <!-- Global Properties -->
22 <property environment="env" />
gwt.team.scottbd07fbcf2006-12-08 21:12:32 +000023 <condition property="gwt.version" value="${env.GWT_VERSION}" else="0.0.0">
24 <isset property="env.GWT_VERSION" />
25 </condition>
gwt.team.scottb6db89592006-12-08 22:32:26 +000026 <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.scottbab0aa682006-12-06 23:14:19 +000030 <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.mmendez99f280b2006-12-08 23:11:29 +000043 <property name="javac.out" location="${project.build}/bin" />
44 <property name="javac.junit.out" location="${project.build}/bin-test" />
gwt.team.scottbab0aa682006-12-06 23:14:19 +000045 <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.mmendez99f280b2006-12-08 23:11:29 +000049 <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.scottb35e9b0e2006-12-06 23:38:46 +000059 <!-- 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.mmendez99f280b2006-12-08 23:11:29 +000062
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.scottbab0aa682006-12-06 23:14:19 +000070 <!-- Global Custom Tasks -->
gwt.team.scottbd07fbcf2006-12-08 21:12:32 +000071 <presetdef name="gwt.ant">
72 <ant inheritall="false" target="${target}">
73 <propertyset>
gwt.team.mmendez99f280b2006-12-08 23:11:29 +000074 <propertyref name="gwt.version" />
75 <propertyref name="gwt.junit.port" />
76 <propertyref name="gwt.remote.browsers" />
gwt.team.scottbd07fbcf2006-12-08 21:12:32 +000077 </propertyset>
78 </ant>
79 </presetdef>
80
gwt.team.scottbab0aa682006-12-06 23:14:19 +000081 <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.mmendez99f280b2006-12-08 23:11:29 +000087 </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.scottbab0aa682006-12-06 23:14:19 +0000130
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.scottb35e9b0e2006-12-06 23:38:46 +0000145 <target name="antcall.unjar.maybe" unless="unjar.upToDate">
gwt.team.scottbab0aa682006-12-06 23:14:19 +0000146 <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.mmendez99f280b2006-12-08 23:11:29 +0000170 <attribute name="location" />
171 <attribute name="message" default="Cannot find dependency ${@{name}}" />
gwt.team.scottbab0aa682006-12-06 23:14:19 +0000172 <sequential>
173 <property name="@{name}" location="@{location}" />
174 <available file="${@{name}}" property="@{name}.exists" />
gwt.team.mmendez99f280b2006-12-08 23:11:29 +0000175 <fail unless="@{name}.exists" message="@{message}" />
gwt.team.scottbab0aa682006-12-06 23:14:19 +0000176 </sequential>
177 </macrodef>
178
gwt.team.bruce672efb52006-12-08 15:38:58 +0000179 <macrodef name="gwt.checkstyle">
gwt.team.scottbd07fbcf2006-12-08 21:12:32 +0000180 <element name="sourcepath" implicit="yes" optional="true" />
gwt.team.bruce672efb52006-12-08 15:38:58 +0000181 <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.scottb36f322f2006-12-07 19:49:22 +0000189
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.scottbab0aa682006-12-06 23:14:19 +0000202</project>