-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
287 lines (254 loc) · 11.1 KB
/
build.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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<?xml version="1.0" encoding="utf-8" ?>
<project name="Geo2tag" default="build" basedir=".">
<!--<property name="version" value="" /> -->
<target name="getversion" >
<exec executable="sh" outputproperty="version">
<arg value="-c"/>
<arg value="git tag | head -n 1" />
</exec>
</target>
<!--
* Copyright 2011-2012 OSLL
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* The advertising clause requiring mention in adverts must never be included.
-->
<!-- ==============================================================
* PROJ: OSLL/geo2tag
* ================================================================ -->
<property file="local.properties" />
<property file="mail.properties" />
<!-- Arguments to gwtc and devmode targets -->
<property name="gwt.args" value="" />
<path id="project.class.path">
<pathelement location="war/WEB-INF/classes" />
<pathelement location="${gwt.sdk}/gwt-user.jar" />
<pathelement location="${junit.jar}" />
<pathelement location="${openlayers.jar}" />
<fileset dir="${gwt.sdk}" includes="gwt-dev*.jar" />
<!-- Add any additional non-server libs (such as JUnit) -->
<fileset dir="war/WEB-INF/lib" includes="**/*.jar" />
</path>
<!-- Configure path to Tomcat -->
<property environment="env" />
<property name="tom.dir" value="${env.CATALINA_HOME}" />
<property name="geo.dir" value="${env.WEBGEO_HOME}" />
<property name="deploy.dir" location="${tom.dir}/webapps" />
<property name="app.name" value="geo2tag" />
<target name="deploy" depends="war" description="Deploy the war file">
<delete dir="${deploy.dir}/${app.name}" />
<delete dir="${deploy.dir}/${app.name}.war" />
<copy todir="${deploy.dir}">
<fileset dir="${basedir}" includes="${app.name}.war" />
</copy>
</target>
<!-- deploy/undeploy app on remote server depends="war" -->
<path id="tomcat.class.path">
<fileset dir="${tom.dir}/lib" includes="*.jar" />
</path>
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask">
<classpath refid="tomcat.class.path" />
</taskdef>
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask">
<classpath refid="tomcat.class.path" />
</taskdef>
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
<classpath refid="tomcat.class.path" />
</taskdef>
<property name="url" value="${server.url}/manager/text" />
<property name="username" value="${server.username}" />
<property name="password" value="${server.password}" />
<property name="path" value="/${app.name}" />
<target name="deploy-release" depends="war" description="Install web application on remote server" >
<deploy
url="${url}"
username="${username}"
password="${password}"
path="${path}"
war="file:${app.name}.war"/>
</target>
<target name="undeploy-release" description="Remove web application from remote server">
<undeploy url="${url}" username="${username}" password="${password}" path="${path}"/>
</target>
<target name="reload-release" depends="war" description="Reload web application on remote server">
<reload url="${url}" username="${username}" password="${password}" path="${path}"/>
</target>
<!-- deploy/undeploy app on remote server -->
<target name="clean" depends="jgeo-clean" description="Cleans this project">
<delete dir="war/WEB-INF/classes" failonerror="false" />
<delete dir="war/WEB-INF/lib" failonerror="false" />
<delete dir="war/${app.name}" failonerror="false" />
<delete dir="bin" failonerror="false" />
<delete dir="reports" failonerror="false" />
<delete file="${app.name}.war" failonerror="false" />
</target>
<target name="libs" description="Copy libs to WEB-INF/lib">
<mkdir dir="war/WEB-INF/lib" />
<copy todir="war/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet.jar" />
<copy todir="war/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet-deps.jar" />
<copy todir="war/WEB-INF/lib" file="lib/log4j-1.2.16.jar" />
<copy todir="war/WEB-INF/lib" file="lib/postgresql-9.0-801.jdbc4.jar" />
<copy todir="war/WEB-INF/lib" file="lib/gwt_i18n_server_1.0.jar" />
<copy todir="war/WEB-INF/lib" file="lib/commons-logging-1.1.1.jar" />
<copy todir="war/WEB-INF/lib" file="lib/httpclient-4.1.3.jar" />
<copy todir="war/WEB-INF/lib" file="lib/httpcore-4.1.4.jar" />
<copy todir="war/WEB-INF/lib" file="lib/jgeo.jar" />
<!-- Add any additional server libs that need to be copied -->
</target>
<target name="javac" depends="libs" description="Compile java source to bytecode">
<mkdir dir="war/WEB-INF/classes" />
<javac includeantruntime="false" srcdir="src" includes="**" encoding="utf-8" destdir="war/WEB-INF/classes" source="1.5" target="1.5" nowarn="true" debug="true" debuglevel="lines,vars,source">
<classpath refid="project.class.path" />
</javac>
<copy todir="war/WEB-INF/classes">
<fileset dir="src" excludes="**/*.java" />
</copy>
</target>
<target name="gwtc" depends="javac" description="GWT compile to JavaScript (production mode)">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="src" />
<path refid="project.class.path" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" />
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx256M" />
<arg line="-war" />
<arg value="war" />
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}" />
<arg value="ru.spb.osll.web.Geo2tag" />
</java>
</target>
<target name="devmode" depends="javac" description="Run development mode">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
<classpath>
<pathelement location="src" />
<path refid="project.class.path" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" />
</classpath>
<jvmarg value="-Xmx256M" />
<arg value="-startupUrl" />
<arg value="Geo2tag.html" />
<arg line="-war" />
<arg value="war" />
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}" />
<arg value="ru.spb.osll.web.Geo2tag" />
</java>
</target>
<target name="hosted" depends="devmode" description="Run development mode (NOTE: the 'hosted' target is deprecated)" />
<target name="build" depends="gwtc" description="Build this project" />
<target name="war" depends="build" description="Create a war file">
<zip destfile="${app.name}.war" basedir="war" />
</target>
<!-- TESTING -->
<target name="javac.tests" depends="javac" description="Compiles test code">
<javac srcdir="test" includes="**" encoding="utf-8" source="1.5" target="1.5" nowarn="true" destdir="war/WEB-INF/classes" debug="true" debuglevel="lines,vars,source">
<classpath location="${junit.jar}" />
<classpath refid="project.class.path" />
</javac>
</target>
<path id="test.classpath">
<pathelement location="src" />
<pathelement location="test" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" />
<pathelement location="${junit.jar}" />
</path>
<target name="test" depends="javac.tests" description="Test this project">
<mkdir dir="reports" />
<junit fork="yes">
<classpath refid="project.class.path" />
<classpath refid="test.classpath" />
<batchtest todir="reports">
<fileset dir="test">
<include name="**/*Test.java" />
</fileset>
</batchtest>
<formatter type="plain" />
</junit>
</target>
<!-- TARGET FOR ECLIPSE IDE -->
<target name="eclipse.generate" depends="libs" description="Generate eclipse project">
<java failonerror="true" fork="true" classname="com.google.gwt.user.tools.WebAppCreator">
<classpath>
<path refid="project.class.path"/>
<path refid="test.classpath" />
</classpath>
<arg value="-XonlyEclipse"/>
<arg value="-ignore"/>
<arg value="-junit"/>
<arg value="${junit.jar}"/>
<arg value="ru.spb.osll.web.Geo2tag" />
</java>
</target>
<!-- SEND MAIL REPORT -->
<target name="send-report" description="Send mail with reports">
<mail mailhost="smtp.gmail.com" mailport="465" ssl="true"
user="osll.spb" password="${MailLogger.password}"
subject="${subject}"
from="osll.spb@gmail.com"
tolist="${MailLogger.success.to}">
<message>${subject}</message>
<attachments>
<fileset dir="${geo.dir}/sandbox/webside_logs">
<include name="**/*.txt" />
</fileset>
<fileset dir="reports">
<include name="**/*.txt" />
</fileset>
</attachments>
</mail>
</target>
<target name="deploy-refresh-info" depends="getversion,deploy">
<tstamp>
<format property="NOW" pattern="yyyy MMMM dd HH:mm:ss" locale="en"/>
</tstamp>
<echo message="version='${version}'${line.separator}" file="${tom.dir}/geo2tag-build"/>
<echo message="deployDate='${NOW}'${line.separator}" append="true" file="${tom.dir}/geo2tag-build"/>
</target>
<!-- JGEO CORE -->
<target name="jgeo">
<ant antfile="build.xml" dir="../jgeo/" target="all"/>
<copy todir="lib" file="../jgeo/jgeo.jar" />
</target>
<target name="jgeo-clean">
<ant antfile="build.xml" dir="../jgeo/" target="clean"/>
</target>
<target name = "prepare-libs">
<echo message="Loading 3rdparty libs to default location"/>
<copy tofile="./local.properties" file="../../conf/webside.local.properties.default"/>
<mkdir dir="/opt/libs"/>
<get src="http://download.geo2tag.org/libs/gwt-openlayers-client-0.5.jar" dest="/opt/libs/"/>
<get src="http://download.geo2tag.org/libs/gwt-visualization.jar" dest="/opt/libs/"/>
<get src="http://download.geo2tag.org/libs/gwt_i18n_server_1.0.jar" dest="/opt/libs/"/>
<get src="http://download.geo2tag.org/libs/junit-4.9b3.jar" dest="/opt/libs/"/>
</target>
</project>