This repository was archived by the owner on Mar 31, 2023. It is now read-only.
forked from gwtproject/gwt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.ant.xml
executable file
·235 lines (217 loc) · 8.82 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
<project name="samples-common">
<property name="gwt.root" location="../.." />
<property name="project.tail" value="samples/${sample.root}" />
<import file="${gwt.root}/common.ant.xml" />
<!--
Number of localworkers for sample compilation. This depends on your
hardware, so it's a good candidate to specify in local.ant.properties
if this default isn't good for you. Ideally, it should approximate
the number of CPU cores in your machine.
-->
<property name="gwt.samples.localworkers" value="2" />
<property name="sample.lower" value="${sample.root}" />
<property name="sample.upper" value="${sample.module}" />
<property name="gwt.args" value="" />
<property.ensure name="gwt.user.jar" location="${gwt.build.lib}/gwt-user.jar" />
<property.ensure name="gwt.dev.jar" location="${gwt.build.lib}/gwt-dev.jar" />
<property.ensure name="gwt.codeserver.jar" location="${gwt.build.lib}/gwt-codeserver.jar" />
<condition property="type.maven">
<available file="pom.xml" />
</condition>
<!-- In maven projects show a message indicating how to build the project using 'mvn' -->
<target name="check.build.type" if="type.maven">
<echo>
${sample.upper} is a maven project.
- use 'mvn clean package' to build it.
- or use 'mvn gwt:run' to run it in dev mode.
</echo>
</target>
<!-- Mirror directory for scripts; makes building distro easier -->
<property name="samples.scripts" value="${gwt.build.out}/samples-scripts" />
<!-- Use the uppercase name rather than the lowercase name -->
<property name="sample.build" value="${gwt.build.out}/samples/${sample.upper}" />
<path id="gae.extraclasspath">
<pathelement location="${gwt.tools.lib}/appengine/appengine-api-1.0-sdk-1.3.4.jar"/>
<pathelement location="${gwt.tools.lib}/appengine/geronimo-jpa_3.0_spec-1.1.1.jar"/>
<pathelement location="${gwt.tools.lib}/appengine/datanucleus-appengine-1.0.7.final.jar"/>
</path>
<!-- The libraries required by the server that will be copied into WEB-INF/lib. -->
<fileset id="sample.server.libs" dir="${gwt.tools.lib}">
<include name="" />
</fileset>
<target name="source" depends="check.build.type" description="Copy source to the output folder">
<mkdir dir="${sample.build}/src" />
<copy todir="${sample.build}/src">
<fileset dir="src" />
</copy>
<if>
<available file="war" type="dir" />
<then>
<mkdir dir="${sample.build}/war" />
<copy todir="${sample.build}/war">
<fileset dir="war" excludes="WEB-INF/classes/**"/>
</copy>
</then>
</if>
<if>
<available file="pom.xml"/>
<then>
<copy tofile="${sample.build}/pom.xml" file="pom.xml"/>
</then>
</if>
<if>
<available file="README-MAVEN.txt"/>
<then>
<copy tofile="${sample.build}/README-MAVEN.txt" file="README-MAVEN.txt"/>
</then>
</if>
<if>
<available file="README.txt"/>
<then>
<copy tofile="${sample.build}/README.txt" file="README.txt"/>
</then>
</if>
<if>
<available file="user-build.xml"/>
<then>
<copy tofile="${sample.build}/build.xml" file="user-build.xml"/>
</then>
</if>
<if>
<available file="user-project"/>
<then>
<copy tofile="${sample.build}/.project" file="user-project"/>
</then>
</if>
<if>
<available file="user-classpath"/>
<then>
<copy tofile="${sample.build}/.classpath" file="user-classpath"/>
</then>
</if>
<if>
<available file="user-settings"/>
<then>
<copy todir="${sample.build}/.settings">
<fileset dir="user-settings"/>
</copy>
</then>
</if>
</target>
<target name="serverlibs" unless="type.maven" description="Copy server libs to the output folder">
<mkdir dir="${sample.build}/war/WEB-INF/lib" />
<copy todir="${sample.build}/war/WEB-INF/lib/" flatten="true">
<fileset refid="sample.server.libs" />
</copy>
</target>
<target name="compile" unless="type.maven" description="Compile all java files">
<mkdir dir="${sample.build}/war/WEB-INF/classes" />
<gwt.javac destdir="${sample.build}/war/WEB-INF/classes"
excludes="**/super/**">
<classpath>
<pathelement location="${gwt.user.jar}" />
<pathelement location="${gwt.dev.jar}" />
<path refid="sample.extraclasspath" />
</classpath>
</gwt.javac>
</target>
<target name="gwtc" unless="type.maven" description="Compile to JavaScript">
<outofdate>
<sourcefiles>
<fileset dir="${sample.path}" />
<fileset dir="${sample.build}/war/WEB-INF/classes" />
<fileset file="${gwt.user.jar}" />
<fileset file="${gwt.dev.jar}" />
<path refid="sample.extraclasspath" />
</sourcefiles>
<targetfiles path="${sample.build}/war/${sample.lower}/${sample.lower}.nocache.js" />
<sequential>
<mkdir dir="${sample.build}/war" />
<java dir="${sample.build}" classname="com.google.gwt.dev.Compiler"
fork="yes" failonerror="true">
<classpath>
<pathelement path="${sample.path}" />
<path refid="sample.extraclasspath" />
<pathelement location="${sample.build}/war/WEB-INF/classes" />
<pathelement location="${gwt.user.jar}" />
<pathelement location="${gwt.dev.jar}" />
</classpath>
<jvmarg value="-Xmx1g" />
<arg value="-localWorkers" />
<arg value="${gwt.samples.localworkers}" />
<arg value="-war" />
<arg file="${sample.build}/war" />
<arg value="com.google.gwt.sample.${sample.lower}.${sample.upper}" />
</java>
<length property="sample.size">
<fileset dir="${sample.build}/war/${sample.lower}" includes="*.cache.html,*.cache.js"/>
</length>
<echo message="output size for ${sample.upper} is ${sample.size} bytes"/>
</sequential>
</outofdate>
</target>
<macrodef name="webAppCreator">
<attribute name="platform" />
<attribute name="extension" default="" />
<sequential>
<outofdate>
<sourcefiles />
<targetfiles>
<pathelement location="${samples.scripts}/${sample.upper}/build.xml" />
</targetfiles>
<sequential>
<mkdir dir="${samples.scripts}/${sample.upper}" />
<java classname="com.google.gwt.user.tools.WebAppCreator" classpath="${gwt.user.jar}:${gwt.dev.jar}" failonerror="true" fork="true">
<!-- Relative path is important! Paths will be relative in final distro -->
<sysproperty key="gwt.devjar" value="../../gwt-dev.jar" />
<arg value="-XnoEclipse" />
<arg value="-overwrite" />
<arg value="-out" />
<arg file="${samples.scripts}/${sample.upper}" />
<arg value="com.google.gwt.sample.${sample.lower}.${sample.upper}" />
</java>
</sequential>
</outofdate>
</sequential>
</macrodef>
<target name="scripts" unless="type.maven" description="Create launch scripts">
<webAppCreator platform="linux" />
<webAppCreator platform="windows" extension=".cmd" />
<webAppCreator platform="mac" />
</target>
<target name="build" depends="source, serverlibs, compile, gwtc, scripts" description="Build and package this project" />
<target name="checkstyle" description="Static analysis of source">
<gwt.checkstyle outputdirectory="${sample.build}">
<fileset dir="src" >
<!-- ValidationMessages is generated and has funny method names -->
<exclude name="main/java/com/google/gwt/sample/validation*/**/ValidationMessages.java" />
</fileset>
</gwt.checkstyle>
</target>
<target name="clean" description="Cleans this project's intermediate and output files">
<delete dir="${sample.build}" />
<delete includeemptydirs="true">
<fileset dir="${samples.scripts}">
<include name="*/${sample.upper}/**" />
</fileset>
</delete>
</target>
<target name="devmode" depends="source, compile" unless="type.maven"
description="Run Super Dev Mode (pass -Dgwt.args=-nosuperDevMode to fallback to classic DevMode)">
<property name="sample.package" value="com.google.gwt.sample.${sample.root}" />
<java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
<classpath>
<pathelement location="${sample.path}"/>
<pathelement location="${gwt.user.jar}"/>
<pathelement location="${gwt.dev.jar}"/>
<pathelement location="${gwt.codeserver.jar}"/>
<pathelement location="${sample.build}/war/WEB-INF/classes" />
<path refid="sample.extraclasspath" />
</classpath>
<arg line="${gwt.args}"/>
<arg line="-war"/>
<arg value="${sample.build}/war"/>
<arg value="${sample.package}.${sample.module}"/>
</java>
</target>
</project>