This repository has been archived by the owner on Jan 14, 2020. It is now read-only.
forked from protegeproject/webprotege
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
380 lines (306 loc) · 13.7 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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<?xml version = "1.0" encoding = "utf-8"?>
<project name="WebProtege" default="usage" basedir=".">
<!-- Property files -->
<property file="local.properties" />
<property name="build.properties" location="build.properties" file="build.properties" />
<property environment="env" />
<property name="catalina.home" location="${env.CATALINA_HOME}" />
<property name="gwt.args" value="" />
<property name="war.name" value="webprotege" />
<property name="jar.name" value="webprotege-lib.jar" />
<property name="src" location="./src" />
<property name="test.src" location="./test" />
<property name="etc" location="./etc" />
<property name="war.template" location="./war" />
<property name="lib" location="${war.template}/WEB-INF/lib" />
<property name="test.lib" location="./test-lib" />
<property name="build" location="./build" />
<property name="classes" location="${build}/classes" />
<property name="war" location="${build}/war" />
<property name="api.docs" location="./docs" />
<!--
# ********** Finding Libraries *************
-->
<target name="classpathAndCheckLibs">
<condition property="libs.found">
<and>
<available file="${gwt.dir}/gwt-user.jar" type="file" />
<available file="${gwt.dir}/gwt-dev.jar" type="file" />
</and>
</condition>
<path id="project.classpath">
<pathelement location="${gwt.dir}/gwt-user.jar" />
<fileset dir="${gwt.dir}" includes="gwt-dev*.jar" />
<!-- Add any additional non-server libs (such as JUnit) -->
<fileset dir="${lib}" />
</path>
</target>
<target name="checkLibsAndReport" depends="classpathAndCheckLibs" unless="libs.found">
<echo message="Missing GWT libraries. See the readme.txt" />
<echo message="for the location of the GWT libraries and update the" />
<echo message="local.properties file to point to these locations." />
<echo message="Use the -v option to ant to see what jars are missing." />
<fail message="missing GWT libraries" />
</target>
<!--
# ********** Initialization and staging *************
-->
<target name="init">
<tstamp>
<format property="build.time" pattern="MM/dd/yyyy hh:mm aa" />
</tstamp>
<mkdir dir="${build}" />
<mkdir dir="${classes}" />
<condition property="set.if.deploy.in.root">
<equals arg1="${deploy.in.root}" arg2="true" />
</condition>
<available property="alt.war.template.exists" file="${alt.war.template}" type="dir" />
<available property="alt.projects.template.exists" file="${alt.war.template}/projects" type="dir" />
<echo message="******************************************" />
<echo message="Using Java from: JAVA_HOME=${env.JAVA_HOME}" />
<echo message="Java version: ${ant.java.version}" />
<echo message="Using GWT from: ${gwt.dir}" />
<echo message="Additional GWT arguments for the GWT compile.java: ${gwt.args}" />
<echo message="Output WAR file in: ${build}/${war.name}.war" />
<echo message="Build number: ${build.number}" />
<echo message="******************************************" />
</target>
<!--
Workaround for gwt eclipse plugin bug.
It appears that the gwt eclipse plugin writes some files to
the ./war area. These files are dropped from the copy to
ensure a consistent and predictable build. This could cause
trouble later if someone commits some of these files and
they don't get installed.
-->
<target name="copy.war" depends="checkLibsAndReport, init">
<mkdir dir="${war}" />
<copy todir="${war}">
<fileset dir="${war.template}">
<exclude name="webprotege/**" />
<exclude name="webprotege" />
<exclude name="authenticate/**" />
<exclude name="authenticate" />
<exclude name="WEB-INF/classes/**" />
<exclude name="WEB-INF/classes" />
<exclude name="WEB-INF/deploy/**" />
<exclude name="WEB-INF/deploy" />
<exclude name="WEB-INF/lib/gwt-servlet.jar" />
<exclude name="WEB-INF/lib/gwt-servlet-deps.jar" />
</fileset>
</copy>
</target>
<target name="stage.war" depends="copy.war">
<antcall target="replace.projects" />
<antcall target="copy.alt.war.template" />
</target>
<target name="replace.projects" if="alt.projects.template.exists">
<delete dir="${war}/projects" />
</target>
<target name="copy.alt.war.template" if="alt.war.template.exists">
<copy todir="${war}" overwrite="true">
<fileset dir="${alt.war.template}" />
</copy>
</target>
<!--
# ********** Compilation *************
-->
<target name="compile.java" depends="init, checkLibsAndReport" description="Compile java source to bytecode">
<mkdir dir="war/WEB-INF/classes" />
<javac srcdir="${src}" includes="**" encoding="utf-8"
includeAntRuntime="false" destdir="${classes}"
nowarn="true" debug="true" debuglevel="lines,vars,source">
<classpath refid="project.classpath" />
</javac>
<copy todir="${classes}">
<fileset dir="${src}">
<include name="**/*" />
<exclude name="**/*.java" />
<exclude name="**/MANIFEST.MF" />
<exclude name="**/manifest.mf" />
</fileset>
</copy>
</target>
<target name="webprotege.lib" depends="stage.war, compile.java">
<jar file="${war}/WEB-INF/lib/${jar.name}" basedir="${classes}" />
</target>
<target name="check.js.compiled">
<uptodate property="js.up.to.date" targetfile="${war}/BUILT">
<srcfiles dir="${src}" />
</uptodate>
</target>
<target name="compile.js" depends="compile.java,check.js.compiled, stage.war" unless="js.up.to.date" description="GWT compile to JavaScript (production mode)">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="${src}" />
<pathelement location="${classes}" />
<path refid="project.classpath" />
<pathelement location="${gwt.dir}/validation-api-1.0.0.GA.jar" />
<pathelement location="${gwt.dir}/validation-api-1.0.0.GA-sources.jar" />
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx1256M" />
<arg line="-war" />
<arg value="${war}" />
<arg line="-logLevel" />
<arg value="INFO" />
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}" />
<arg value="${gwt.module.1}" />
<arg value="${gwt.module.2}" />
</java>
<touch file="${war}/BUILT" />
<antcall target="copy.rpc.in.war" />
</target>
<target name="copy.rpc.in.war" if="set.if.deploy.in.root">
<echo message="Copying the rpc files in war (workaround for GWT + proxy bug)" />
<copy todir="${war}">
<fileset dir="${war}/${gwt.module.1.short}">
<include name="**/*.rpc" />
</fileset>
</copy>
<copy todir="${war}">
<fileset dir="${war}/${gwt.module.2.short}">
<include name="**/*.rpc" />
</fileset>
</copy>
</target>
<!--
# ********** Build war and deploy *************
-->
<target name="war" depends="webprotege.lib,compile.js">
<delete file="${war}/WEB-INF/lib/gwt-user.jar" />
<copy file="${gwt.dir}/gwt-servlet.jar" todir="${war}/WEB-INF/lib" />
<copy file="${gwt.dir}/gwt-servlet-deps.jar" todir="${war}/WEB-INF/lib" />
<copy file="webprotege.properties" todir="${war}" failonerror="false" />
<copy file="mail.properties" todir="${war}" failonerror="false" />
<copy todir="${war}/etc" failonerror="false">
<fileset dir="${etc}" />
</copy>
<copy file="${build.properties}" todir="${war}" />
<war destfile="${build}/${war.name}.war" basedir="${war}" />
</target>
<target name="deploy">
<echo message="If runnning with sudo, you may need to use the -E option to preserve the environment vars." />
<echo message="Example: sudo -E ant deploy" />
<echo message="Deploying to: ${catalina.home}" />
<delete dir="${catalina.home}/webapps/${war.name}" />
<copy tofile="${catalina.home}/webapps/${war.name}.war" file="${build}/${war.name}.war" />
</target>
<target name="update" depends="webprotege.lib, compile.js">
<copy todir="${catalina.home}/webapps/${war.name}">
<fileset dir="${war}">
<exclude name="projectConfigurations/*" />
<exclude name="projects/**" />
<exclude name="WEB-INF/web.xml" />
</fileset>
</copy>
</target>
<target name="release" depends="war">
<zip destfile="${build}/${war.name}-build-${build.number}.zip">
<fileset file="${build}/${war.name}.war"/>
</zip>
</target>
<!--
# ********** Running *************
-->
<target name="devmode" depends="webprotege.lib,stage.war" description="Run development mode">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
<classpath>
<path refid="project.classpath" />
<pathelement path="${classes}" />
<pathelement path="${src}" />
<pathelement location="/work/tools/gwt-2.5.1/validation-api-1.0.0.GA.jar" />
<pathelement location="/work/tools/gwt-2.5.1/validation-api-1.0.0.GA-sources.jar" />
</classpath>
<jvmarg value="-Xmx1256M" />
<jvmarg value="-agentlib:jdwp=transport=dt_socket,address=8100,server=y,suspend=n" />
<jvmarg value="${extra.devmode.jvm.arg}" />
<arg value="-war" />
<arg value="${war}" />
<arg value="${gwt.module.1}" />
<arg value="-startupUrl" />
<arg value="${gwt.html.target}" />
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}" />
</java>
</target>
<!--
# ********** Test *************
-->
<target name="build-test" depends="stage.war,compile.java" description="test the project">
<javac srcdir="${test.src}" destdir="${classes}" encoding="UTF-8" includeantruntime="false">
<classpath>
<path refid="project.classpath" />
<!-- pull in all jar files in ${test.lib}
this includes JUnit
-->
<fileset dir="${test.lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
</target>
<target name="test" depends="build-test" description="run the project tests">
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<classpath>
<path refid="project.classpath" />
<pathelement path="${classes}" />
<!-- pull in all jar files in ${test.lib}
this includes JUnit
-->
<fileset dir="${test.lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
<formatter type="brief" />
<batchtest>
<fileset dir="${classes}">
<include name="**/*TestCase.class" />
</fileset>
</batchtest>
</junit>
</target>
<!--
# ********** Documentation *************
-->
<target name="doc">
<javadoc packagenames="edu.standford.*"
defaultexcludes="yes"
destdir="${api.docs}"
author="true"
version="true"
use="true"
windowtitle="WebProtege API">
<fileset dir="${src}" casesensitive="yes">
<include name="**/*.java"/>
<exclude name="**/*Test*"/>
</fileset>
<doctitle>
<![CDATA[<h1>WebProtege API</h1>]]></doctitle>
<!-- <bottom><![CDATA[<i>Copyright © 2011&emdash;2013 <a href="http://bmir.stanford.edu/">
Stanford Center for Biomedical Informatics Research</a>.
All Rights Reserved.</i>]]></bottom> -->
</javadoc>
</target>
<!--
# ********** Usage *************
-->
<target name="usage">
<echo message="war - makes the webprotege war file" />
<echo message="release - makes the webprotege-build-no.zip file" />
<echo message="deploy - makes a war file and deploys it to ${CATALINA_HOME}" />
<echo message="devmode - runs webprotege in devMode mode with remote debug support" />
<echo message="stage.war - makes a copy of the war directory in ./build/war" />
<echo message="test - builds and runs all tests" />
<echo message="doc - builds the API documentation" />
<echo message="usage - prints this help message" />
<echo message="clean - cleans the build directory" />
</target>
<!--
# ********** Clean *************
-->
<target name="clean">
<delete dir="${build}" />
</target>
</project>