1
|
<?xml version="1.0"?>
|
2
|
<!--
|
3
|
* '$RCSfile$'
|
4
|
* Authors: Matt Jones, Chad Berkley, Jivka Bojilova
|
5
|
* Copyright: 2000 Regents of the University of California and the
|
6
|
* National Center for Ecological Analysis and Synthesis
|
7
|
* For Details: http://www.nceas.ucsb.edu/
|
8
|
*
|
9
|
* '$Author: tao $'
|
10
|
* '$Date: 2003-01-27 13:31:09 -0800 (Mon, 27 Jan 2003) $'
|
11
|
* '$Revision: 1376 $'
|
12
|
*
|
13
|
* Build file for the Ant cross-platform build system for metacat
|
14
|
* See http://jakarta.apache.org for details on Ant
|
15
|
*
|
16
|
* usage: ant [compile|jar|install|jdoc]
|
17
|
*
|
18
|
* This program is free software; you can redistribute it and/or modify
|
19
|
* it under the terms of the GNU General Public License as published by
|
20
|
* the Free Software Foundation; either version 2 of the License, or
|
21
|
* (at your option) any later version.
|
22
|
*
|
23
|
* This program is distributed in the hope that it will be useful,
|
24
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26
|
* GNU General Public License for more details.
|
27
|
*
|
28
|
* You should have received a copy of the GNU General Public License
|
29
|
* along with this program; if not, write to the Free Software
|
30
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
31
|
-->
|
32
|
<project name="metacat" default="jar" basedir=".">
|
33
|
|
34
|
<target name="oracle">
|
35
|
<!-- Customize these properties if you are using oracle -->
|
36
|
<property name="jdbc-connect"
|
37
|
value="jdbc:oracle:thin:@dev.nceas.ucsb.edu:1521:exp"/>
|
38
|
<property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
|
39
|
<property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
|
40
|
<property name="oracle_home" value="/oracle01/app/oracle/product/8.1.6" />
|
41
|
<property name="jdbc" value="${oracle_home}/jdbc/lib/classes111.zip" />
|
42
|
</target>
|
43
|
|
44
|
<target name="postgresql">
|
45
|
<!-- Customize these properties if you are using postgres -->
|
46
|
<property name="jdbc-connect"
|
47
|
value="jdbc:postgresql://localhost/exp"/>
|
48
|
<property name="dbDriver" value="org.postgresql.Driver"/>
|
49
|
<property name="dbAdapter"
|
50
|
value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
|
51
|
<property name="jdbc" value="lib/jdbc7.1-1.2.jar" />
|
52
|
</target>
|
53
|
|
54
|
<target name="config" depends="oracle">
|
55
|
<!-- Change the 'depends' attribute above to 'postgresql' to install
|
56
|
metacat with postgres instead of oracle -->
|
57
|
|
58
|
<!-- Customize these properties for your system -->
|
59
|
<property name="tomcat" value="/usr/local/devtools/jakarta-tomcat" />
|
60
|
<property name="webapps" value="/opt/tomcat/webapps" />
|
61
|
<property name="context" value="tao" />
|
62
|
<property name="user" value="tao"/>
|
63
|
<property name="password" value="tdataint"/>
|
64
|
<property name="server" value="dev.nceas.ucsb.edu"/>
|
65
|
<property name="systemidserver" value="http://dev.nceas.ucsb.edu" />
|
66
|
<property name="datafilepath" value="/opt/tomcat/data/tao/data" />
|
67
|
<property name="debuglevel" value="35" />
|
68
|
<property name="forcereplicationwaitingtime" value="30000"/>
|
69
|
<property name="web-base-url"
|
70
|
value="http://knb.ecoinformatics.org"/>
|
71
|
<property name="default-style" value="knb" />
|
72
|
<property name="morphosourcedir" value="morpho" />
|
73
|
|
74
|
<!-- Make sure these paths match the location of the jar files
|
75
|
on your system, the defaults should usually work -->
|
76
|
<property name="jsdk"
|
77
|
value="${tomcat}/lib/common/servlet.jar" />
|
78
|
<property name="xmlp"
|
79
|
value="lib/xercesImpl.jar" />
|
80
|
<property name="srb"
|
81
|
value="lib/srbrmi" />
|
82
|
<property name="cos"
|
83
|
value="lib/cos.jar" />
|
84
|
<property name="morpho"
|
85
|
value="lib/morpho.jar" />
|
86
|
<property name="xalan"
|
87
|
value="lib/xalan/xalan.jar" />
|
88
|
<property name="apis"
|
89
|
value="lib/xalan/xml-apis.jar" />
|
90
|
<property name="httpclient"
|
91
|
value="${morphosourcedir}/lib/httpclient.jar" />
|
92
|
<property name="itis"
|
93
|
value="${morphosourcedir}/lib/itislib.jar" />
|
94
|
|
95
|
</target>
|
96
|
|
97
|
<target name="init" depends="config">
|
98
|
<!-- It is less likely you'll need to make any changes from here down,
|
99
|
but customization is possible -->
|
100
|
<property name="installdir" value="${webapps}/${context}" />
|
101
|
<property name="name" value="metacat"/>
|
102
|
<property name="Name" value="MetaCat"/>
|
103
|
<property name="release" value="1.2.1"/>
|
104
|
<property name="replication-path"
|
105
|
value="/${context}/servlet/replication"/>
|
106
|
<property name="servlet-path" value="/${context}/servlet/metacat"/>
|
107
|
<property name="html-path" value="/${context}"/>
|
108
|
<property name="image-path" value="/img/${context}" />
|
109
|
<property name="style-path" value="/${context}/style"/>
|
110
|
<property name="replication-log" value="/tmp/metacatreplication.log"/>
|
111
|
<property name="config-dir" value="${installdir}" />
|
112
|
<property name="eml-module" value="eml" />
|
113
|
<property name="eml-version" value="2.0.0beta6" />
|
114
|
<property name="eml-tag" value="RELEASE_EML_2_0_0_BETA_6_REV1" />
|
115
|
<property name="cvsroot"
|
116
|
value=":ext:tao@cvs.ecoinformatics.org:/cvs" />
|
117
|
|
118
|
<property name="cpath"
|
119
|
value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${srb}:${cos}:${morpho}"/>
|
120
|
|
121
|
<filter token="docrooturl" value="./" />
|
122
|
<filter token="jdbc-connect" value="${jdbc-connect}"/>
|
123
|
<filter token="dbDriver" value="${dbDriver}"/>
|
124
|
<filter token="dbAdapter" value="${dbAdapter}"/>
|
125
|
<filter token="install-dir" value="${installdir}"/>
|
126
|
<filter token="server" value="${server}"/>
|
127
|
<filter token="systemidserver" value="${systemidserver}"/>
|
128
|
<filter token="replication-log" value="${replication-log}"/>
|
129
|
<filter token="release" value="${release}"/>
|
130
|
<filter token="servlet-path" value="${servlet-path}"/>
|
131
|
<filter token="html-path" value="${html-path}"/>
|
132
|
<filter token="user" value="${user}"/>
|
133
|
<filter token="password" value="${password}"/>
|
134
|
<filter token="image-path" value="${image-path}"/>
|
135
|
<filter token="style-path" value="${style-path}"/>
|
136
|
<filter token="web-base-url" value="${web-base-url}"/>
|
137
|
<filter token="replication-path" value="${replication-path}"/>
|
138
|
<filter token="config-dir" value="${config-dir}"/>
|
139
|
<filter token="default-style" value="${default-style}"/>
|
140
|
<filter token="eml-version" value="${eml-version}"/>
|
141
|
<filter token="context" value="${context}"/>
|
142
|
<filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
|
143
|
<filter token="debuglevel" value="${debuglevel}" />
|
144
|
<filter token="datafilepath" value="${datafilepath}" />
|
145
|
<property name="srcdir" value="./src" />
|
146
|
<property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
|
147
|
<property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
|
148
|
<property name="build.dir" value="./build"/>
|
149
|
<property name="build.src" value="${build.dir}/src"/>
|
150
|
<property name="build.dest" value="${build.dir}/classes"/>
|
151
|
<property name="build.docs" value="${build.dir}/docs"/>
|
152
|
<property name="build.samples" value="${build.dir}/samples"/>
|
153
|
<property name="build.tests" value="${build.dir}/tests"/>
|
154
|
<property name="build.metacattest" value="${build.tests}/metacattest"/>
|
155
|
<property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
|
156
|
<property name="build.data" value="${build.dir}/data"/>
|
157
|
<property name="build.javadocs" value="${build.dir}/docs/api"/>
|
158
|
<property name="build.img" value="${installdir}/${image-path}"/>
|
159
|
|
160
|
<property name="dist.dir" value="dist"/>
|
161
|
<property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
|
162
|
<property name="ver.src" value="${ver.dir}/src"/>
|
163
|
|
164
|
<property name="package.home" value="edu/ucsb/nceas/metacat" />
|
165
|
|
166
|
</target>
|
167
|
|
168
|
<target name="prepare" depends="init">
|
169
|
<mkdir dir="${build.dir}"/>
|
170
|
<mkdir dir="${build.src}"/>
|
171
|
<mkdir dir="${build.dest}"/>
|
172
|
<mkdir dir="${build.javadocs}"/>
|
173
|
|
174
|
<copy todir="${build.src}" filtering="yes">
|
175
|
<fileset dir="${srcdir}">
|
176
|
<include name="edu/**"/>
|
177
|
<include name="com/**"/>
|
178
|
<include name="**/*.sql"/>
|
179
|
<exclude name="**/CVS*"/>
|
180
|
<exclude name="**/.#*"/>
|
181
|
</fileset>
|
182
|
</copy>
|
183
|
</target>
|
184
|
|
185
|
<target name="compile" depends="prepare">
|
186
|
<javac srcdir="${build.src}"
|
187
|
destdir="${build.dest}"
|
188
|
classpath="${cpath}"
|
189
|
excludes="**/*.sql" />
|
190
|
<copy file="lib/metacat.properties"
|
191
|
tofile="${build.dest}/${package.home}/metacat.properties"
|
192
|
filtering="yes" />
|
193
|
<copy file="lib/srbProps.properties"
|
194
|
tofile="${build.dest}/${package.home}/srbProps.properties"/>
|
195
|
</target>
|
196
|
|
197
|
<target name="jar" depends="compile">
|
198
|
<delete file="${build.dir}/${name}.jar" />
|
199
|
<copy todir="${build.dest}">
|
200
|
<fileset dir="lib/srbrmi"/>
|
201
|
</copy>
|
202
|
<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
|
203
|
excludes="**/protocols/" />
|
204
|
</target>
|
205
|
|
206
|
<target name="protocol" depends="compile">
|
207
|
<delete file="${build.dir}/protocol.jar" />
|
208
|
<jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
|
209
|
includes="**/protocols/" />
|
210
|
</target>
|
211
|
|
212
|
<target name="getdtd" depends="prepare">
|
213
|
<echo>Enter CVS password: </echo>
|
214
|
<cvs cvsRoot="${cvsroot}"
|
215
|
package="${eml-module}"
|
216
|
tag="${eml-tag}"
|
217
|
dest="${build.src}" />
|
218
|
<mkdir dir="lib/dtd" />
|
219
|
<copy todir="lib/dtd" filtering="yes">
|
220
|
<fileset dir="${build.src}/${eml-module}">
|
221
|
<include name="*.dtd"/>
|
222
|
</fileset>
|
223
|
<mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
|
224
|
</copy>
|
225
|
<copy todir="lib/style">
|
226
|
<fileset dir="${build.src}/${eml-module}/style">
|
227
|
<include name="*.xsl"/>
|
228
|
</fileset>
|
229
|
</copy>
|
230
|
</target>
|
231
|
|
232
|
<target name="dtdsql" depends="prepare">
|
233
|
<echo/>
|
234
|
<echo>Registering the DTDs with the new Metacat instance...</echo>
|
235
|
<sql driver="${dbDriver}"
|
236
|
classpath="${jdbc}"
|
237
|
url="${jdbc-connect}"
|
238
|
userid="${user}"
|
239
|
password="${password}"
|
240
|
src="${build.src}/loaddtd.sql" />
|
241
|
</target>
|
242
|
|
243
|
<target name="install" depends="jar">
|
244
|
<mkdir dir="${datafilepath}" />
|
245
|
<chmod dir="${datafilepath}" perm="ug+w" />
|
246
|
<mkdir dir="${installdir}/WEB-INF/lib" />
|
247
|
<copy file="${build.dir}/${name}.jar"
|
248
|
tofile="${installdir}/WEB-INF/lib/${name}.jar" />
|
249
|
<copy file="${xmlp}"
|
250
|
tofile="${installdir}/WEB-INF/lib/xercesImpl.jar" />
|
251
|
<copy file="${xalan}"
|
252
|
tofile="${installdir}/WEB-INF/lib/xalan.jar" />
|
253
|
<copy file="${apis}"
|
254
|
tofile="${installdir}/WEB-INF/lib/xml-apis.jar" />
|
255
|
<copy file="${jdbc}"
|
256
|
tofile="${installdir}/WEB-INF/lib/oracle-jdbc111.jar" />
|
257
|
<copy file="${cos}"
|
258
|
tofile="${installdir}/WEB-INF/lib/cos.jar" />
|
259
|
<copy file="${morpho}"
|
260
|
tofile="${installdir}/WEB-INF/lib/morpho.jar" />
|
261
|
<copy file="lib/web.xml"
|
262
|
tofile="${installdir}/WEB-INF/web.xml" />
|
263
|
<copy todir="${build.img}" filtering="no">
|
264
|
<fileset dir="lib">
|
265
|
<include name="**/*.jpg"/>
|
266
|
<include name="**/*.png"/>
|
267
|
<include name="**/*.gif"/>
|
268
|
</fileset>
|
269
|
</copy>
|
270
|
<copy todir="${installdir}" filtering="yes">
|
271
|
<fileset dir="lib">
|
272
|
<exclude name="*.jar"/>
|
273
|
<exclude name="*.properties"/>
|
274
|
<exclude name="web.xml"/>
|
275
|
<exclude name="**/srbrmi*"/>
|
276
|
</fileset>
|
277
|
</copy>
|
278
|
<echo>
|
279
|
***********************************************************
|
280
|
Remember to register the default DTDs by running the
|
281
|
"${build.src}/loaddtd.sql script". This is most easily
|
282
|
done by using the "ant dtdsql" which will run it for you.
|
283
|
***********************************************************
|
284
|
</echo>
|
285
|
</target>
|
286
|
|
287
|
<target name="test" depends="install">
|
288
|
<!-- copy and compile the tests into a jar file -->
|
289
|
<mkdir dir="${build.metacattest}"/>
|
290
|
<javac srcdir="${junittestsdir}"
|
291
|
destdir="${build.metacattest}"
|
292
|
classpath="${cpath}:${build.dir}/${name}.jar"
|
293
|
includes="**/*.java" />
|
294
|
|
295
|
<jar jarfile="${build.dir}/${name}-junittests.jar"
|
296
|
basedir="${build.metacattest}"
|
297
|
includes="**/*.class" />
|
298
|
|
299
|
<!-- use the ant "junit" task to run JUnit tests. -->
|
300
|
<junit printsummary="yes" haltonfailure="no" fork="no"
|
301
|
haltonerror="no">
|
302
|
<classpath>
|
303
|
<pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
|
304
|
</classpath>
|
305
|
|
306
|
<formatter type="plain" />
|
307
|
|
308
|
<batchtest fork="yes" todir="${build.dir}">
|
309
|
<fileset dir="${build.metacattest}">
|
310
|
<include name="**/*.class" />
|
311
|
</fileset>
|
312
|
</batchtest>
|
313
|
</junit>
|
314
|
</target>
|
315
|
|
316
|
<target name="gethttpclient" depends="prepare">
|
317
|
<!--mkdir dir="${morphosourcedir}" -->
|
318
|
<cvs cvsRoot=":ext:tao@cvs.ecoinformatics.org:/cvs"
|
319
|
package="morpho"
|
320
|
dest="." />
|
321
|
<ant dir="${morphosourcedir}" inheritAll="false" target="jar" />
|
322
|
</target>
|
323
|
|
324
|
<!-- run this target, we need to check out a another morpho souce dir was checked out. -->
|
325
|
<target name="nettest" depends="install">
|
326
|
<echo>***********************************
|
327
|
Please run ant gethttpclient first!
|
328
|
***********************************
|
329
|
</echo>
|
330
|
<!-- copy and compile the tests into a jar file -->
|
331
|
<mkdir dir="${build.metacatnettest}"/>
|
332
|
<javac srcdir="${junitnettestsdir}"
|
333
|
destdir="${build.metacatnettest}"
|
334
|
classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
|
335
|
includes="**/*.java" />
|
336
|
|
337
|
<jar jarfile="${build.dir}/${name}-junitnettests.jar"
|
338
|
basedir="${build.metacatnettest}"
|
339
|
includes="**/*.class" />
|
340
|
|
341
|
<!-- use the ant "junit" task to run JUnit tests. -->
|
342
|
<junit printsummary="yes" haltonfailure="no" fork="yes"
|
343
|
haltonerror="no">
|
344
|
<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
|
345
|
<classpath>
|
346
|
<pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itis}" />
|
347
|
</classpath>
|
348
|
|
349
|
<formatter type="plain" />
|
350
|
|
351
|
<batchtest fork="yes" todir="${build.dir}">
|
352
|
<fileset dir="${build.metacatnettest}">
|
353
|
<include name="**/*.class" />
|
354
|
</fileset>
|
355
|
</batchtest>
|
356
|
</junit>
|
357
|
</target>
|
358
|
|
359
|
<target name="clean" depends="init">
|
360
|
<delete dir="${build.dir}" />
|
361
|
</target>
|
362
|
|
363
|
<target name="jdoc" depends="prepare">
|
364
|
<javadoc packagenames="edu.ucsb.nceas.*"
|
365
|
sourcepath="${build.src}"
|
366
|
destdir="${build.javadocs}"
|
367
|
author="true"
|
368
|
version="true"
|
369
|
use="true"
|
370
|
windowtitle="${Name} API"
|
371
|
doctitle="<h1>${Name}</h1>"
|
372
|
bottom="<i>Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.</i>"
|
373
|
/>
|
374
|
</target>
|
375
|
|
376
|
<target name="dist" depends="jar,protocol,jdoc,getdtd">
|
377
|
<mkdir dir="${dist.dir}"/>
|
378
|
<delete dir="${ver.dir}" />
|
379
|
<mkdir dir="${ver.dir}"/>
|
380
|
<copy todir="${ver.dir}">
|
381
|
<fileset dir="."
|
382
|
excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
|
383
|
</copy>
|
384
|
<copy todir="${ver.dir}" file="build.xml"/>
|
385
|
<copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
|
386
|
<copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
|
387
|
|
388
|
<copy todir="${ver.dir}/docs" filtering="yes">
|
389
|
<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
|
390
|
</copy>
|
391
|
<copy todir="${ver.dir}/docs" filtering="no">
|
392
|
<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
|
393
|
</copy>
|
394
|
<copy todir="${ver.dir}/docs/dev">
|
395
|
<fileset dir="${build.dir}/docs"/>
|
396
|
</copy>
|
397
|
<copy todir="${ver.dir}/src">
|
398
|
<fileset dir="${build.dir}/src"/>
|
399
|
</copy>
|
400
|
|
401
|
<delete dir="./${ver.dir}/${build.dir}"/>
|
402
|
<delete dir="./${ver.dir}/dist"/>
|
403
|
<delete file="./${name}-${release}.zip"/>
|
404
|
<zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
|
405
|
<delete file="./${name}-${release}.tar.gz" />
|
406
|
<tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
|
407
|
<gzip zipfile="./${name}-${release}.tar.gz"
|
408
|
src="./${name}-${release}.tar"/>
|
409
|
<delete file="./${name}-${release}.tar" />
|
410
|
</target>
|
411
|
|
412
|
<target name="distsrc" depends="dist">
|
413
|
<mkdir dir="${ver.src}"/>
|
414
|
<copy todir="${ver.src}">
|
415
|
<fileset dir="./src"/>
|
416
|
</copy>
|
417
|
|
418
|
<delete file="./${name}-src-${release}.zip"/>
|
419
|
<zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
|
420
|
<delete file="./${name}-src-${release}.tar.gz" />
|
421
|
<tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
|
422
|
<gzip zipfile="./${name}-src-${release}.tar.gz"
|
423
|
src="./${name}-src-${release}.tar"/>
|
424
|
<delete file="./${name}-src-${release}.tar" />
|
425
|
<delete dir="${dist.dir}"/>
|
426
|
</target>
|
427
|
|
428
|
</project>
|