forked from jahertor/gwt-ext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.ant.xml
236 lines (206 loc) · 9.75 KB
/
common.ant.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<project name="common">
<!-- gwt.build.iscasesensitivefs is true if the filesystem of the
build machine is case-sensitive, false otherwise. Update with
new lines for any supported platforms with case-insensitive
filesystems
-->
<condition property="gwt.build.iscasesensitivefs" else="false">
<not>
<or>
<os family="windows"/>
</or>
</not>
</condition>
<property name="test.ant.file" location="${gwtext.root}/${project.tail}/build.xml" />
<condition property="project.valid">
<equals arg1="${ant.file}" arg2="${test.ant.file}"
casesensitive="${gwt.build.iscasesensitivefs}"/>
</condition>
<fail unless="project.valid" message="This build file is in an inconsistent state." />
<!-- Global Properties -->
<property environment="env" />
<condition property="gwtext.version" value="${env.GWTEXT_VERSION}" else="2.0.6">
<isset property="env.GWTEXT_VERSION" />
</condition>
<condition property="ext.version" value="${env.EXT_VERSION}" else="2.0.2">
<isset property="env.EXT_VERSION" />
</condition>
<condition property="gwtext.tools.check" value="${env.GWTEXT_TOOLS}" else="${gwtext.root}/../tools">
<isset property="env.GWTEXT_TOOLS" />
</condition>
<property name="gwtext.tools" location="${gwtext.tools.check}" />
<property name="gwtext.tools.lib" location="${gwtext.tools}/lib" />
<property name="gwtext.tools.lib.ext" location="${gwtext.tools}/lib/ext/${ext.version}" />
<property name="gwtext.tools.antlib" location="${gwtext.tools}/antlib" />
<property name="gwtext.tools.redist" location="${gwtext.tools}/redist" />
<property name="gwtext.build" location="${gwtext.root}/build" />
<property name="gwtext.build.out" location="${gwtext.build}/out" />
<property name="gwtext.build.lib" location="${gwtext.build}/lib" />
<property name="gwtext.build.staging" location="${gwtext.build}/staging" />
<property name="gwtext.build.dist" location="${gwtext.build}/dist" />
<property name="project.build" location="${gwtext.build.out}/${project.tail}" />
<property name="project.lib" location="${gwtext.build.lib}/${ant.project.name}.jar" />
<property name="javac.out" location="${project.build}/bin" />
<property name="javac.junit.out" location="${project.build}/bin-test" />
<property name="javac.debug" value="true" />
<property name="javac.debuglevel" value="lines,vars,source" />
<property name="javac.encoding" value="utf-8" />
<property name="javac.source" value="1.5" />
<property name="javac.nowarn" value="true" />
<property name="junit.out" location="${project.build}/test" />
<property name="gwt.doctool.jar" location="${gwtext.tools.lib}/gwt-build-tools/gwt-doctool.jar" />
<!-- Sanity check -->
<available file="${gwtext.tools}" type="dir" property="gwt.tools.exists" />
<fail unless="gwt.tools.exists" message="Cannot find '${gwtext.tools}' tools directory; perhaps you should define the GWT_TOOLS environment variable" />
<!-- Platform identification -->
<condition property="build.host.islinux">
<and>
<os family="unix" />
<not>
<contains string="${os.name}" substring="mac" casesensitive="false" />
</not>
</and>
</condition>
<condition property="build.host.platform" value="linux">
<isset property="build.host.islinux" />
</condition>
<condition property="build.host.ismac">
<and>
<os family="unix" />
<contains string="${os.name}" substring="mac" casesensitive="false" />
</and>
</condition>
<condition property="build.host.platform" value="mac">
<isset property="build.host.ismac" />
</condition>
<condition property="build.host.iswindows">
<os family="windows" />
</condition>
<condition property="build.host.platform" value="windows">
<isset property="build.host.iswindows" />
</condition>
<fail unless="build.host.platform" message="Building on ${os.name} is not supported" />
<condition property="junit.platform.args" value="-XstartOnFirstThread" else="">
<equals arg1="${build.host.platform}" arg2="mac" casesensitive="false" />
</condition>
<!--GWT jars location-->
<property name="gwt.version" value="1.5RC1" />
<property name="gwt.user.jar" location="${gwtext.tools.lib}/gwt/${gwt.version}/${build.host.platform}/gwt-user.jar" />
<property name="gwt.dev.jar" location="${gwtext.tools.lib}/gwt/${gwt.version}/${build.host.platform}/gwt-dev-${build.host.platform}.jar" />
<!-- JUnit support -->
<property name="gwtext.dev.staging.jar" location="${gwtext.build.staging}/gwtext-${gwtext.version}/gwtext.jar" />
<property name="gwtext.junit.port" value="8889" />
<property name="gwtext.junit.testcase.includes" value="**/*Test.class"/>
<!--
Comma delimited list of host and path components on which to run remote browser testing.
-->
<property name="gwtext.remote.browsers" value="" />
<!-- Pulls in tasks defined in ant-contrib, i.e. foreach -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${gwtext.tools.antlib}/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
<!-- Global Custom Tasks -->
<presetdef name="gwt.ant">
<ant inheritall="false" target="${target}">
<propertyset>
<propertyref name="gwtext.version" />
<propertyref name="gwtext.junit.port" />
<propertyref name="gwtext.remote.browsers" />
</propertyset>
</ant>
</presetdef>
<presetdef name="gwt.javac">
<javac srcdir="src" destdir="${javac.out}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="${javac.source}" nowarn="${javac.nowarn}" encoding="${javac.encoding}" />
</presetdef>
<presetdef name="gwt.jar">
<jar destfile="${project.lib}" update="true" duplicate="preserve" index="true" />
</presetdef>
<macrodef name="gwt.junit">
<!-- TODO: make this more generic / refactor so it can be used from dev/core -->
<attribute name="test.args" default="" />
<attribute name="test.out" default="" />
<attribute name="test.reports" default="@{test.out}/reports" />
<attribute name="test.cases" default="" />
<sequential>
<taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
<classpath>
<pathelement location="${gwtext.tools.lib}/junit/junit-3.8.1.jar" />
<pathelement location="${gwtext.tools.antlib}/ant-junit-1.6.5.jar" />
</classpath>
</taskdef>
<echo message="Writing test results to @{test.reports} for @{test.cases}" />
<mkdir dir="@{test.reports}" />
<echo message="${javac.out} ${javac.junit.out}" />
<junit dir="@{test.out}" fork="yes" printsummary="yes" haltonfailure="false">
<jvmarg line="${junit.platform.args}" />
<sysproperty key="gwt.args" value="@{test.args}" />
<!--the hosted mode library is searched based on the path of this library-->
<sysproperty key="gwt.devjar" value="${gwt.dev.jar}" />
<sysproperty key="java.awt.headless" value="true" />
<classpath>
<pathelement location="${gwtext.root}/${project.tail}/src" />
<pathelement location="${gwtext.root}/${project.tail}/test" />
<pathelement location="${javac.junit.out}" />
<pathelement location="${javac.out}" />
<pathelement location="${gwtext.dev.staging.jar}" />
<pathelement location="${gwt.user.jar}" />
<pathelement location="${gwt.dev.jar}" />
<pathelement location="${gwtext.tools.lib}/junit/junit-3.8.1.jar" />
</classpath>
<formatter type="plain" />
<formatter type="xml" />
<batchtest todir="@{test.reports}">
<fileset refid="@{test.cases}" />
</batchtest>
</junit>
</sequential>
</macrodef>
<macrodef name="gwt.tgz.cat">
<attribute name="destfile" />
<element name="tar.elements" implicit="true" optional="true" />
<sequential>
<taskdef name="tar.cat" classname="com.google.gwt.ant.taskdefs.TarCat" classpath="${gwtext.build.lib}/ant-gwt.jar" />
<tar.cat destfile="${project.dist}" compression="gzip" longfile="gnu">
<tar.elements />
</tar.cat>
</sequential>
</macrodef>
<macrodef name="gwt.checkstyle">
<element name="sourcepath" implicit="yes" optional="true" />
<sequential>
<taskdef resource="checkstyletask.properties" classpath="${gwtext.tools.antlib}/checkstyle-all-4.2.jar;${gwt.build.lib}/gwt-customchecks.jar" />
<checkstyle config="${gwtext.root}/eclipse/settings/code-style/gwt-checkstyle.xml" maxWarnings="0">
<property key="checkstyle.header.file" file="${gwtext.root}/eclipse/settings/code-style/google.header" />
<sourcepath />
</checkstyle>
</sequential>
</macrodef>
<macrodef name="property.ensure">
<attribute name="name" />
<attribute name="location" />
<attribute name="message" default="Cannot find dependency ${@{name}}" />
<attribute name="unless" default="__nonexistent_property__" />
<sequential>
<property name="@{name}" location="@{location}" />
<condition property="@{name}.exists">
<or>
<available file="${@{name}}" />
<isset property="@{unless}" />
</or>
</condition>
<fail unless="@{name}.exists" message="@{message}" />
</sequential>
</macrodef>
<!-- Default implementations of the required targets; projects should
override the ones that matter -->
<target name="all" depends="verify" />
<target name="verify" depends="checkstyle, test" description="Verify this project" />
<target name="checkstyle" description="Static analysis of source" />
<target name="test" depends="build" description="Test this project" />
<target name="build" description="Build and (maybe) package this project" />
<target name="clean" description="Cleans this project's intermediate and output files">
<delete dir="${project.build}" />
</target>
</project>