forked from tractionsoftware/gwt-traction
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.ant.xml
232 lines (196 loc) · 8.34 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
<project name="common">
<!--##########################
Detect current build configuration.
-->
<!-- 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="gwt.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="gwt.platform" value="mac">
<isset property="build.host.ismac" />
</condition>
<condition property="build.host.iswindows">
<os family="windows" />
</condition>
<condition property="gwt.platform" value="windows">
<isset property="build.host.iswindows" />
</condition>
<fail unless="gwt.platform" message="Building on ${os.name} is not supported" />
<condition property="junit.platform.args" value="-XstartOnFirstThread" else="">
<isset property="build.host.ismac" />
</condition>
<!--##########################
Set up properties.
-->
<!-- Global Properties -->
<property environment="env" />
<!-- All the project specific locations-->
<property name="project.build" location="${project.root}/build" />
<property name="project.out" location="${project.build}/out" />
<property name="project.dist" location="${project.build}/dist" />
<property name="project.demos" location="${project.build}/out/demos" />
<property name="project.src" location="${project.root}/src/main" />
<!-- GWT specific properties -->
<property name="gwt.threadsPerProcessor" value="1" />
<property name="gwt.threadCount" value="1" />
<condition property="gwt.tools" value="${env.GWT_TOOLS}">
<isset property="env.GWT_TOOLS" />
</condition>
<condition property="gwt.home" value="${env.GWT_HOME}">
<isset property="env.GWT_HOME" />
</condition>
<!-- If not set, try to set tools to a sibling of the project root -->
<property name="gwt.tools" value="${project.root}/../tools" />
<property name="gwt.tools.lib" location="${gwt.tools}/lib" />
<property name="gwt.tools.antlib" location="${gwt.tools}/antlib" />
<property name="gwt.dev.jar" location="${gwt.home}/gwt-dev.jar" />
<property name="gwt.user.jar" location="${gwt.home}/gwt-user.jar" />
<property name="gwt.validation.api.sources.jar" location="${gwt.home}/validation-api-1.0.0.GA-sources.jar" />
<property name="gwt.validation.api.jar" location="${gwt.home}/validation-api-1.0.0.GA.jar" />
<!-- Sanity checks -->
<available file="${gwt.tools}" type="dir" property="gwt.tools.exists" />
<fail unless="gwt.tools.exists"
message="can't find gwt tools, please set gwt.tools property (ant -Dgwt.tools=...) or define the GWT_TOOLS environment variable" />
<available file="${gwt.tools.lib}" type="dir" property="gwt.tools.lib.exists" />
<fail unless="gwt.tools.lib.exists"
message="can't find gwt tools lib, check your gwt tools directory '${gwt.tools}'" />
<fail unless="gwt.home"
message="can't find gwt home, please set gwt.home property (ant -Dgwt.home=...) or define the GWT_HOME environment variable" />
<available file="${gwt.user.jar}" type="file" property="gwt.user.exists" />
<fail unless="gwt.user.exists"
message="gwt user jar does not appear to exist, check your gwt home directory '${gwt.home}'" />
<!-- Javac properties used to invoke java-->
<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.target" value="1.5" />
<property name="javac.nowarn" value="true" />
<!-- Java properties used to run java -->
<property name="java.stackSize" value="1m" />
<!--##########################
Junit Support
-->
<!-- Headless mode keeps the hosted mode browser and log window
from popping up during a unit test run. This is usually desirable,
but the WebKit layout engine performs some optimizations in
headless mode that causes some GWT unit tests to break. The
solution for the time being is to turn off headless mode on
the mac.
-->
<condition property="junit.headless">
<not>
<isset property="build.host.ismac" />
</not>
</condition>
<condition property="junit.notheadless.arg" value="-notHeadless" else="">
<not>
<isset property="junit.headless" />
</not>
</condition>
<!-- Project specific junit properties -->
<property name="project.test" location="${project.build}/test" />
<property name="project.test.bin" location="${project.test}/bin" />
<property name="project.test.results" location="${project.test}/results" />
<!-- GWT Junit testing support -->
<property name="gwt.junit.port" value="auto" />
<property name="gwt.junit.testcase.includes" value="**/*Test.class" />
<!-- Pulls in tasks defined in ant-contrib, i.e. foreach -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${gwt.tools.antlib}/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
<!-- Global Custom Tasks -->
<presetdef name="gwt.ant">
<ant inheritall="false" target="${project.target}">
<propertyset>
<propertyref name="gwt.junit.port" />
<propertyref name="gwt.remote.browsers" />
</propertyset>
</ant>
</presetdef>
<presetdef name="gwt.javac">
<javac srcdir="${project.src}"
destdir="${project.bin}"
debug="${javac.debug}"
debuglevel="${javac.debuglevel}"
source="${javac.source}"
target="${javac.target}"
nowarn="${javac.nowarn}"
encoding="${javac.encoding}" />
</presetdef>
<macrodef name="gwt.junit">
<attribute name="test.args" default="" />
<attribute name="test.out" default="" />
<attribute name="test.reports" default="@{test.out}/reports" />
<attribute name="test.cases" default="" />
<attribute name="test.heap" default="512M" />
<element name="extraclasspaths" optional="true" />
<sequential>
<taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
<classpath>
<pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" />
<pathelement location="${gwt.tools.antlib}/ant-junit-1.6.5.jar" />
</classpath>
</taskdef>
<echo message="Writing test results to @{test.reports}" />
<mkdir dir="@{test.reports}" />
<junit dir="@{test.out}"
fork="yes"
printsummary="withOutAndErr"
failureproperty="junit.failure"
tempdir="@{test.out}">
<jvmarg line="${junit.platform.args}" />
<jvmarg line="-Xmx@{test.heap} -Xss${java.stackSize}" />
<sysproperty key="gwt.args" value="${junit.notheadless.arg} @{test.args}" />
<sysproperty key="java.awt.headless" value="${junit.headless}" />
<classpath>
<pathelement location="${project.test.jar}" />
<pathelement location="${project.jar}" />
<pathelement location="${gwt.user.jar}" />
<pathelement location="${gwt.dev.jar}" />
<pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" />
<pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" />
<extraclasspaths />
</classpath>
<formatter type="plain" />
<formatter type="xml" />
<batchtest todir="@{test.reports}">
<fileset refid="@{test.cases}" />
</batchtest>
</junit>
</sequential>
</macrodef>
<!-- Generally useful validation macros-->
<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>
</project>