Project

General

Profile

1 113 jones
<?xml version="1.0"?>
2 1311 berkley
<!--
3 4969 daigle
	*   '$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$'
10
	*    '$Date$'
11
	*    '$Revision$'
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 1311 berkley
-->
32 329 jones
<project name="metacat" default="jar" basedir=".">
33 4969 daigle
	<property environment="env" />
34
	<property file="build.properties" /><!-- USER SPECIFIC PROPS -->
35 3034 perry
36 1801 tao
37 2175 tao
38 1103 tao
39 4969 daigle
	<!-- Determine if ecogrid should be installed-->
40
	<condition property="enable.ecogrid">
41
		<equals arg1="${install.ecogrid}" arg2="true" />
42
	</condition>
43 3034 perry
44 4969 daigle
	<!-- Determine if perl should be built-->
45
	<condition property="build.perl">
46
		<equals arg1="${make.perl.code}" arg2="true" />
47
	</condition>
48 3034 perry
49 4969 daigle
	<target name="config">
50
		<property name="jsdk"
51
			value="${build.tomcat.dir}/common/lib/servlet-api.jar" />
52
		<!-- usr for client testing, generally you don't need change-->
53
		<property name="mcuser"
54
			value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
55
		<property name="mcpassword" value="kepler" />
56
		<property name="mcanotheruser"
57
			value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org" />
58
		<property name="mcanotherpassword" value="yourpass" />
59
		<property name="piscouser"
60
			value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org" />
61
		<property name="piscopassword" value="yourpass" />
62
		<property name="lteruser"
63
			value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org" />
64
		<property name="lterpassword" value="yourpass" />
65 4943 costa
66 4969 daigle
		<property name="debug" value="on" />
67
		<property name="morphosourcedir" value="../morpho" />
68
		<property name="utilitiesdir" value="../utilities" />
69
		<property name="installdir"
70
			value="${app.deploy.dir}/${metacat.context}" />
71 1929 brooke
72 4969 daigle
		<echo>*********** set jsdk to ${jsdk}</echo>
73
	</target>
74 2343 sgarg
75 4969 daigle
	<target name="init" depends="config">
76
		<path id="compile.classpath">
77
			<pathelement location="${jsdk}" />
78
			<pathelement location="lib" />
79
			<fileset dir="lib">
80
				<include name="*.jar" />
81
			</fileset>
82
			<fileset dir="lib">
83
				<include name="xalan.jar" />
84
			</fileset>
85
			<fileset dir="lib/lsid_lib">
86
				<include name="*.jar" />
87
			</fileset>
88 2343 sgarg
89 4969 daigle
			<!-- Include geoserver, geotools, et. al. -->
90
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
91
				<include name="*.jar" />
92
			</fileset>
93
			<pathelement
94
				location="lib/spatial/geoserver/WEB-INF/classes" />
95 1487 tao
96 4969 daigle
			<!-- Include OAI-PMH -->
97
			<fileset dir="lib/oaipmh">
98
				<include name="*.jar" />
99
			</fileset>
100 806 jones
101 4969 daigle
		</path>
102 2599 jones
103 4969 daigle
		<!-- It is less likely you'll need to make any changes from here down,
104
			but customization is possible -->
105
		<property name="name" value="metacat" />
106
		<property name="Name" value="MetaCat" />
107
		<property name="debugprefix" value="${Name}:" />
108
		<property name="release" value="${metacat.version}" />
109
		<property name="style-common-relpath" value="/style/common" />
110
		<property name="style-shared-relpath" value="/style/shared" />
111
		<property name="schema-relpath" value="/schema" />
112
		<property name="style-common-cvsrelpath"
113
			value="lib${style-common-relpath}" />
114
		<property name="schema-cvsrelpath" value="lib${schema-relpath}" />
115
		<property name="style-skins-relpath" value="/style/skins" />
116
		<property name="util-module" value="utilities" />
117 4972 daigle
		<property name="utilities-tag" value="UTILITIES_1_0_1_RC1" />
118 4969 daigle
		<property name="eml-module" value="eml" />
119
		<property name="eml-version" value="2.0.0beta6" />
120
		<property name="eml-beta-tag"
121
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
122
		<property name="eml2_0_0-schema-tag"
123
			value="RELEASE_EML_2_0_0_UPDATE_1" />
124
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
125
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
126
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_0_9_0" />
127
		<property name="eml2_0_0namespace"
128
			value="eml://ecoinformatics.org/eml-2.0.0" />
129
		<property name="eml2_0_1namespace"
130
			value="eml://ecoinformatics.org/eml-2.0.1" />
131
		<property name="eml2_1_0namespace"
132
			value="eml://ecoinformatics.org/eml-2.1.0" />
133
		<property name="stmmlnamespace"
134
			value="http://www.xml-cml.org/schema/stmml" />
135
		<property name="eml-css" value="eml_xsl.css" />
136
		<property name="eml-module.default.css" value="default.css" />
137
		<property name="systemidserver" value="" />
138
		<property name="html-path" value="" />
139 1311 berkley
140 348 jones
141 4969 daigle
		<!-- Config for registry variables -->
142
		<!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
143
		<property name="scope" value="obfs" />
144
		<property name="responseForm" value="genericResponse.tmpl" />
145
		<property name="entryForm" value="entryForm.tmpl" />
146
		<property name="guide" value="genericGuide.tmpl" />
147
		<property name="loginForm" value="loginForm.tmpl" />
148
		<property name="confirmData" value="confirmData.tmpl" />
149
		<property name="deleteData" value="deleteData.tmpl" />
150
		<property name="genericHeader" value="genericHeader.tmpl" />
151
		<property name="genericFooter" value="genericFooter.tmpl" />
152 348 jones
153 4969 daigle
		<filter token="scope" value="${scope}" />
154
		<filter token="responseForm" value="${responseForm}" />
155
		<filter token="entryForm" value="${entryForm}" />
156
		<filter token="guide" value="${guide}" />
157
		<filter token="loginForm" value="${loginForm}" />
158
		<filter token="confirmData" value="${confirmData}" />
159
		<filter token="deleteData" value="${deleteData}" />
160
		<filter token="genericHeader" value="${genericHeader}" />
161
		<filter token="genericFooter" value="${genericFooter}" />
162
		<filter token="adminname" value="${adminname}" />
163
		<filter token="recipient" value="${recipient}" />
164
		<filter token="metacatVersion" value="${metacat.version}" />
165
		<filter token="metacatRC" value="${metacat.releaseCandidate}" />
166
		<filter token="build.context" value="${metacat.context}" />
167
168
		<filter token="docrooturl" value="./" />
169
		<filter token="mcuser" value="${mcuser}" />
170
		<filter token="mcpassword" value="${mcpassword}" />
171
		<filter token="mcanotheruser" value="${mcanotheruser}" />
172
		<filter token="mcanotherpassword" value="${mcanotherpassword}" />
173
		<filter token="eml-css" value="${eml-css}" />
174
		<filter token="style-skins-relpath"
175
			value="${style-skins-relpath}" />
176
		<filter token="style-common-relpath"
177
			value="${style-common-relpath}" />
178
179
		<filter token="eml-version" value="${eml-version}" />
180
		<filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
181
		<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
182
		<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
183
		<filter token="stmmlnamespace" value="${stmmlnamespace}" />
184
		<filter token="debugprefix" value="${debugprefix}" />
185
186
		<filter token="defaultStage" value="${defaultStage}" />
187
		<filter token="defaultHeader" value="${defaultHeader}" />
188
		<filter token="defaultFooter" value="${defaultFooter}" />
189
		<filter token="defaultChangePass" value="${defaultChangePass}" />
190
		<filter token="defaultResetPass" value="${defaultResetPass}" />
191
		<filter token="changePassSuccess" value="${changePassSuccess}" />
192
		<filter token="resetPassSuccess" value="${resetPassSuccess}" />
193
		<filter token="registerFailed" value="${registerFailed}" />
194
		<filter token="registerLter" value="${registerLter}" />
195
		<filter token="registerMatch" value="${registerMatch}" />
196
		<filter token="registerSuccess" value="${registerSuccess}" />
197
		<filter token="register" value="${register}" />
198
		<filter token="searchResults" value="${searchResults}" />
199
		<filter token="ldapMainServerFailure"
200
			value="${ldapMainServerFailure}" />
201
		<filter token="lter-user" value="${lteruser}" />
202
		<filter token="lter-pass" value="${lterpassword}" />
203
		<filter token="pisco-user" value="${piscouser}" />
204
		<filter token="pisco-pass" value="${piscopassword}" />
205
206
207
		<!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
208
		<!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
209
		<!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
210
211
		<property name="srcdir" value="./src" />
212
		<property name="lib.dir" value="./lib" />
213
		<property name="docdir" value="./docs" />
214
		<property name="cgidir" value="./cgi-bin" />
215
		<property name="testdir" value="./test" />
216
		<property name="testtorun" value="BuildIndexTest" />
217
		<property name="junittestsdir"
218
			value="./test/edu/ucsb/nceas/metacattest" />
219
		<property name="junitnettestsdir"
220
			value="./test/edu/ucsb/nceas/metacatnettest" />
221
		<property name="build.dir" value="./build" />
222
		<property name="build.src" value="${build.dir}/src" />
223
		<property name="build.dest" value="${build.dir}/classes" />
224
		<property name="build.samples" value="${build.dir}/samples" />
225
		<property name="build.tests" value="${build.dir}/tests" />
226
		<property name="build.tmp" value="${build.dir}/tmp" />
227
		<property name="build.metacattest"
228
			value="${build.tests}/metacattest" />
229
		<property name="build.metacatnettest"
230
			value="${build.tests}/metacatnettest" />
231
		<property name="build.data" value="${build.dir}/data" />
232
		<property name="build.javadocs" value="${build.dir}/docs/api" />
233
		<property name="build.war" value="${build.dir}/war" />
234
		<property name="dist.dir" value="dist" />
235
		<property name="ver.dir" value="${dist.dir}/${name}-${release}" />
236
		<property name="ver.src" value="${ver.dir}/src" />
237
		<property name="util.dir" value="${dist.dir}/${util-module}" />
238
		<property name="test.dir" value="${dist.dir}/test" />
239
		<!-- directories for creating a Harvest List Editor distribution -->
240
		<property name="dist.dir.hle" value="disthle" />
241
		<property name="ver.dir.hle"
242
			value="${dist.dir.hle}/harvest-list-editor-${release}" />
243
		<property name="pkg.dir" value="./package" />
244
		<property name="deb.pkg.dir" value="${pkg.dir}/debian" />
245
246
		<property name="ecogrid-target-name" value="metacatImpl" />
247
		<property name="ecogrid-module-dest-dir" value=".." />
248
		<property name="ecogrid-module" value="seek/projects/ecogrid" />
249
		<property name="ecogrid-dist-dir"
250
			value="${dist.dir}/${ecogrid-module}" />
251
		<property name="ecogrid-dir"
252
			value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
253
254
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
255
256
		<!-- set up svn -->
257
		<property name="svnant.lib" value="lib" />
258
		<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
259
		<property name="svnClientAdapter.jar"
260
			value="${svnant.lib}/svnClientAdapter.jar" />
261
		<property name="svnjavahl.jar"
262
			value="${svnant.lib}/svnjavahl.jar" />
263
		<property name="svn.utilitiesUrl"
264
			value="https://code.ecoinformatics.org/code/utilities/tags/${utilities-tag}" />
265
		<property name="svn.ecogridUrl"
266
			value="https://code.ecoinformatics.org/code/seek/trunk/projects/ecogrid/" />
267
		<!--  property name="svn.utilitiesExportPath" value="${knbdir}" / -->
268
269
		<!-- load the svn task -->
270
		<path id="svn.classpath">
271
			<pathelement location="${svnjavahl.jar}" />
272
			<pathelement location="${svnant.jar}" />
273
			<pathelement location="${svnClientAdapter.jar}" />
274
		</path>
275
		<taskdef resource="svntask.properties"
276
			classpathref="svn.classpath" />
277
278
		<condition property="utilities.required">
279
			<or>
280
				<not>
281
					<available file="lib/httpclient.jar" />
282
				</not>
283
				<not>
284
					<available file="lib/utilities.jar" />
285
				</not>
286
				<not>
287
					<available file="${utilitiesdir}" type="dir" />
288
				</not>
289
			</or>
290
		</condition>
291
		<!-- peer.utilities.required is used when there is no utilities
292
			directory at ${utilitiesdir} -->
293
		<condition property="peer.utilities.required">
294
			<or>
295
				<not>
296
					<available file="${utilitiesdir}" type="dir" />
297
				</not>
298
			</or>
299
		</condition>
300
		<condition property="eml.required">
301
			<or>
302
				<not>
303
					<available file="lib/schema/eml-2.0.1/eml.xsd" />
304
				</not>
305
				<not>
306
					<available file="lib/schema/eml-2.0.0/eml.xsd" />
307
				</not>
308
				<not>
309
					<available file="lib/schema/eml-2.1.0/eml.xsd" />
310
				</not>
311
				<not>
312
					<available
313
						file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
314
				</not>
315
			</or>
316
		</condition>
317
318
		<condition property="ecogrid.required">
319
			<or>
320
				<not>
321
					<available file="${ecogrid-dir}/build.properties" />
322
				</not>
323
				<not>
324
					<available
325
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
326
				</not>
327
			</or>
328
		</condition>
329
330
	</target>
331
332
	<target name="prepare" depends="init">
333
		<mkdir dir="${build.dir}" />
334
		<mkdir dir="${build.src}" />
335
		<mkdir dir="${build.dest}" />
336
		<mkdir dir="${build.javadocs}" />
337
		<mkdir dir="${build.tmp}" />
338
339
		<copy todir="${build.src}" filtering="yes">
340
			<fileset dir="${srcdir}">
341
				<include name="edu/**" />
342
				<include name="com/**" />
343
				<include name="org/**" />
344
				<!-- include name="java/**" / -->
345
				<include name="**/*.sql" />
346
				<exclude name="**/CVS*" />
347
				<exclude name="**/.#*" />
348
			</fileset>
349
		</copy>
350
		<available file="lib/style/common/emlb6toeml2" type="dir"
351
			property="styles.not.needed" />
352
	</target>
353
354
	<taskdef resource="axis-tasks.properties"
355
		classpathref="compile.classpath" />
356
357 4962 leinfelder
	<target name="generateStubs" depends="prepare">
358 4969 daigle
		<echo
359
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
360
		<axis-wsdl2java verbose="true" output="${srcdir}"
361
			url="/tmp/KeplerWebService.wsdl" />
362 4962 leinfelder
	</target>
363 1939 brooke
364 4969 daigle
	<target name="compile" depends="prepare,utilities"
365
		description="Compiles java code to build dir, and copies metacat props files there">
366 113 jones
367 4969 daigle
		<javac srcdir="${build.src}" destdir="${build.dest}"
368
			debug="${debug}"
369
			excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
370
			<classpath>
371
				<path refid="compile.classpath" />
372
			</classpath>
373
		</javac>
374
	</target>
375 1939 brooke
376 4969 daigle
	<target name="jar" depends="compile,geteml"
377
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
378 1311 berkley
379 4969 daigle
		<delete file="${build.dir}/${name}.jar" />
380
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
381
			excludes="**/protocols/ **/harvesterClient/" />
382
	</target>
383 113 jones
384 4969 daigle
	<target name="protocol" depends="compile"
385
		description="Compiles and jars protocol java code to protocol.jar in build dir">
386
		<delete file="${build.dir}/protocol.jar" />
387
		<jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
388
			includes="**/protocols/" />
389
	</target>
390 4959 daigle
391 4969 daigle
	<target name="utilities" depends="config,getpeerutilities"
392
		if="utilities.required">
393
		<ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
394
		<ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
395
		<copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
396
		<copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
397
	</target>
398 1780 jones
399 4969 daigle
	<target name="getpeerutilities" depends="prepare"
400
		if="peer.utilities.required"
401
		description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
402
		<echo message="Exporting utiities files from svn repository:" />
403
		<!-- input message="Please enter svn repo username:" addproperty="svn.username" / -->
404
		<!-- input message="Please enter svn repo password:" addproperty="svn.password" / -->
405
		<!--  svn username="${svn.username}" password="${svn.password}" -->
406
		<svn>
407
			<export srcUrl="${svn.utilitiesUrl}"
408
				destPath="${utilitiesdir}" />
409
		</svn>
410 2461 sgarg
411 4969 daigle
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
412
	</target>
413 1780 jones
414 4969 daigle
	<target name="getutilities" depends="prepare"
415
		description="Checks utility out of svn and copies it to your metacat cvs sandbox">
416
		<echo>Enter CVS password:</echo>
417
		<cvs cvsRoot="${cvsroot}" package="${util-module}"
418
			tag="${utilities-tag}" dest="${build.tmp}" />
419
	</target>
420 1780 jones
421 4969 daigle
	<target name="client" depends="utilities, prepare"
422
		description="Compiles metacat-client java code to build dir">
423
		<javac srcdir="${build.src}" destdir="${build.dest}"
424
			includes="edu/ucsb/nceas/metacat/client/*">
425
			<classpath>
426
				<path refid="compile.classpath" />
427
			</classpath>
428
		</javac>
429
	</target>
430 2748 costa
431 4969 daigle
	<target name="clientjar" depends="client"
432
		description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
433
		<delete file="${build.dir}/${name}-client.jar" />
434
		<jar jarfile="${build.dir}/${name}-client.jar"
435
			basedir="${build.dest}" includes="**/metacat/client/" />
436
	</target>
437 1950 costa
438 4969 daigle
	<target name="advancedsearchjar" depends="compile"
439
		description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
440
		<delete file="${build.dir}/advancedsearch.jar" />
441
		<jar jarfile="${build.dir}/advancedsearch.jar"
442
			basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
443
	</target>
444 1950 costa
445 4969 daigle
	<target name="harvester" depends="client"
446
		description="Compiles harvester java code to build dir">
447
		<javac srcdir="${build.src}" destdir="${build.dest}"
448
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
449
			<classpath>
450
				<path refid="compile.classpath" />
451
			</classpath>
452
		</javac>
453
	</target>
454 1939 brooke
455 4969 daigle
	<target name="harvesterjar" depends="harvester"
456
		description="Compiles and jars harvester java code to harvester.jar in build dir">
457
		<delete file="${build.dir}/harvester.jar" />
458
		<jar jarfile="${build.dir}/harvester.jar"
459
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
460
	</target>
461 2228 sgarg
462 4969 daigle
	<target name="harvestListEditorDist" depends="harvesterjar"
463
		description="Prepares a distribution of the Harvest List Editor tool">
464
		<mkdir dir="${dist.dir.hle}" />
465
		<delete dir="${ver.dir.hle}" />
466
		<mkdir dir="${ver.dir.hle}" />
467
		<copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
468
		<copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
469
		<copy todir="${ver.dir.hle}"
470
			file="lib/harvester/harvestList.xsd" />
471
		<copy todir="${ver.dir.hle}"
472
			file="lib/harvester/harvestListEditor.bat" />
473
		<copy todir="${ver.dir.hle}"
474
			file="lib/harvester/harvestListEditor.sh" />
475
		<delete file="./harvest-list-editor-${release}.zip" />
476
		<zip zipfile="./harvest-list-editor-${release}.zip"
477
			basedir="${ver.dir.hle}" />
478
		<delete file="./harvest-list-editor-${release}.tar.gz" />
479
		<tar tarfile="./harvest-list-editor-${release}.tar"
480
			basedir="${ver.dir.hle}" />
481
		<gzip zipfile="./harvest-list-editor-${release}.tar.gz"
482
			src="./harvest-list-editor-${release}.tar" />
483
		<delete file="./harvest-list-editor-${release}.tar" />
484
	</target>
485 1939 brooke
486 4969 daigle
	<target name="geteml" depends="getemlpre2,geteml2+,getConversionXSL"
487
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
488 2175 tao
489 4969 daigle
	<target name="getemlpre2" depends="prepare" if="eml.required"
490
		description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
491
		<echo>Enter CVS password:</echo>
492
		<cvs cvsRoot="${cvsroot}" package="${eml-module}"
493
			tag="${eml-beta-tag}" dest="${build.tmp}/eml_${eml-beta-tag}" />
494
		<mkdir dir="lib/dtd" />
495
		<copy todir="lib/dtd" filtering="yes">
496
			<fileset
497
				dir="${build.tmp}/eml_${eml-beta-tag}/${eml-module}">
498
				<include name="*.dtd" />
499
			</fileset>
500
			<mapper type="glob" from="eml-*.dtd"
501
				to="eml-*-${eml-version}.dtd" />
502
		</copy>
503 2175 tao
504 4969 daigle
		<copy todir="${style-common-cvsrelpath}" filtering="yes">
505
			<fileset
506
				dir="${build.tmp}/eml_${eml-beta-tag}/${eml-module}/style">
507
				<include name="**/*.xsl" />
508
			</fileset>
509
		</copy>
510
	</target>
511 2175 tao
512 4969 daigle
	<target name="geteml2+" depends="prepare" if="eml.required"
513
		description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
514
		<echo>Enter CVS password:</echo>
515
		<cvs cvsRoot="${cvsroot}" package="${eml-module}"
516
			tag="${eml2_0_0-schema-tag}"
517
			dest="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
518
		<mkdir dir="lib/schema/eml-2.0.0" />
519
		<copy todir="lib/schema/eml-2.0.0" filtering="yes">
520
			<fileset
521
				dir="${build.tmp}/eml_${eml2_0_0-schema-tag}/${eml-module}">
522
				<include name="*.xsd" />
523
			</fileset>
524 1939 brooke
525 4969 daigle
			<!-- shouldn't we have a mapper here like this??
526
				<mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
527
528
				Jing's code didn't nave one - does it need to be added?
529
				NOTE that eml-version is set to beta 6, so this would need changing -->
530 4080 daigle
531 4969 daigle
		</copy>
532
		<!-- <antcall target="copyxsl">
533
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
534
			<param name="dirname" value="eml-2.0.0" />
535
			</antcall> -->
536 2175 tao
537 4969 daigle
		<!-- Checkout eml201 for given schema tag-->
538
		<echo>Enter CVS password:</echo>
539
		<cvs cvsRoot="${cvsroot}" package="${eml-module}"
540
			tag="${eml2_0_1-schema-tag}"
541
			dest="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
542
		<mkdir dir="lib/schema/eml-2.0.1" />
543
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
544
			<fileset
545
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}/${eml-module}">
546
				<include name="*.xsd" />
547
			</fileset>
548
		</copy>
549 1939 brooke
550 4969 daigle
		<!-- Checkout eml201 again for given style sheet tag-->
551
		<!-- echo>Enter CVS password: </echo>
552
			<cvs cvsRoot="${cvsroot}"
553
			package="${eml-module}"
554
			tag="${eml2_0_1-style-tag}"
555
			dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
556
			<antcall target="copyxsl">
557
			<param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
558
			<param name="dirname" value="eml-2.0.1" />
559
			</antcall -->
560 2175 tao
561 4969 daigle
		<!-- Checkout eml210 for given schema tag-->
562
		<echo>Enter CVS password:</echo>
563
		<cvs cvsRoot="${cvsroot}" package="${eml-module}"
564
			tag="${eml2_1_0-schema-tag}"
565
			dest="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
566
		<mkdir dir="lib/schema/eml-2.1.0" />
567
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
568
			<fileset
569
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}/${eml-module}">
570
				<include name="*.xsd" />
571
			</fileset>
572
		</copy>
573 1612 tao
574 4969 daigle
		<!-- Checkout eml210 for given style sheet tag-->
575
		<echo>Enter CVS password:</echo>
576
		<cvs cvsRoot="${cvsroot}" package="${eml-module}"
577
			tag="${eml2-style-tag}" dest="${build.tmp}/eml_${eml2-style-tag}" />
578
		<antcall target="copyxsl">
579
			<param name="cvs.tagname" value="${eml2-style-tag}" />
580
			<!-- param name="dirname" value="eml-2.1.0" / -->
581
			<param name="dirname" value="eml-2" />
582
		</antcall>
583
	</target>
584 2353 sgarg
585 4969 daigle
	<target name="copyxsl"
586
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
587 3034 perry
588 4969 daigle
		<delete file="${style-common-cvsrelpath}/${eml-css}" />
589 3034 perry
590 4969 daigle
		<copy todir="${style-common-cvsrelpath}/${dirname}"
591
			filtering="yes">
592
			<fileset
593
				dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
594
				<include name="**/*.xsl" />
595
			</fileset>
596
		</copy>
597 3034 perry
598
599 4969 daigle
		<!-- now copy default css from eml module and put it in style-common-path
600
			dir with a new name, so other skin-specific css can import it if reqd -->
601
		<copy
602
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module}/${eml-module.default.css}"
603
			tofile="${style-common-cvsrelpath}/${eml-css}" />
604 3034 perry
605 4969 daigle
	</target>
606 3034 perry
607 4969 daigle
	<target name="correctEML201Docs" depends="jar"
608
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
609
		<copy todir="${build.dir}" file="lib/metacat.properties"
610
			filtering="yes" />
611
		<java
612
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
613
			<classpath>
614
				<path refid="compile.classpath" />
615
				<fileset dir="${build.dir}">
616
					<include name="${name}.jar" />
617
				</fileset>
618
			</classpath>
619
		</java>
620
	</target>
621 3034 perry
622 4969 daigle
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
623
		description="Installs spatial option for metacat">
624 3034 perry
625 4969 daigle
		<property name="spatial.dir" value="./lib/spatial" />
626
		<property name="spatial.geoserver.dir"
627
			value="${spatial.dir}/geoserver" />
628
		<property name="spatial.webinf-mods"
629
			value="${spatial.dir}/WEB-INF" />
630 3034 perry
631 4969 daigle
		<!-- Copy geoserver libs into ${war.lib} -->
632
		<copy todir="${war.lib}" filtering="no">
633
			<fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
634
				<include name="**" />
635
			</fileset>
636
		</copy>
637 1952 jones
638 4969 daigle
		<!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
639
		<copy todir="${war.webinf}" filtering="no">
640
			<fileset dir="${spatial.geoserver.dir}/WEB-INF">
641
				<exclude name="lib/**" />
642
				<exclude name="web.xml" />
643
			</fileset>
644
		</copy>
645 2175 tao
646 4969 daigle
		<!-- Copy the rest of the geoserver codebase into ${war.context} -->
647
		<copy todir="${war.context}" filtering="no">
648
			<fileset dir="${spatial.geoserver.dir}">
649
				<exclude name="WEB-INF/**" />
650
				<exclude name="index.jsp" />
651
			</fileset>
652
		</copy>
653 2175 tao
654 4969 daigle
		<!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
655
		<copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
656
			tofile="${war.context}/geoserver.jsp" overwrite="true"
657
			filtering="no" />
658 1952 jones
659 4969 daigle
		<!-- Copy the rest of the modified geoserver web-inf files
660
			<copy todir="${war.webinf}" filtering="no">
661
			<fileset dir="${spatial.webinf-mods}">
662
			<exclude name="web.xml.combined"/>
663
			</fileset>
664
			</copy> -->
665 1952 jones
666 4969 daigle
	</target>
667 4080 daigle
668 4969 daigle
	<target name="install" depends="build-metacat"
669
		description="* Full Install For Development *">
670
		<copy file="${dist.dir}/${metacat.context}.war"
671
			todir="${app.deploy.dir}" />
672
		<delete dir="${app.deploy.dir}/${metacat.context}" />
673
		<tstamp>
674
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
675
		</tstamp>
676
		<echo>Dev install completed at ${NOW}</echo>
677
	</target>
678 2343 sgarg
679 4969 daigle
	<target name="build-metacat" depends="install-ecogrid"
680
		description="Build Metacat">
681
	</target>
682 2343 sgarg
683 4969 daigle
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
684
		if="enable.ecogrid" description="Install Ecogrid Compentent">
685
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
686
			inheritall="false">
687
			<property name="context" value="${metacat.context}" />
688
			<property name="target" value="${ecogrid-target-name}" />
689
			<!-- property name="metacat.dir" value="."/ -->
690
		</ant>
691
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
692
			inheritall="false">
693
			<property name="context" value="${metacat.context}" />
694
			<property name="target" value="${ecogrid-target-name}" />
695
			<!-- property name="metacat.dir" value="."/ -->
696
		</ant>
697
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
698
			<webinf dir="${ecogrid-dir}/lib">
699
			<include name="server-config.wsdd"/>
700
			</webinf>
701
			</war -->
702
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
703
			todir="${dist.dir}" overwrite="true" />
704 2052 sgarg
705
706 4969 daigle
	</target>
707 2052 sgarg
708 4969 daigle
	<target name="get-ecogrid" depends="init"
709
		description="Check out ecogrid module" if="ecogrid.required">
710
		<svn>
711
			<export srcUrl="${svn.ecogridUrl}"
712
				destPath="${ecogrid-dir}" />
713
		</svn>
714
	</target>
715 2052 sgarg
716 4969 daigle
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
717
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
718
		<property name="context" value="${metacat.context}"/>
719
		<property name="target" value="${ecogrid-target-name}"/>
720
		<property name="metacat.dir" value="."/>
721
		<property name="hostname" value="${ecogrid.hostname}"/>
722
		<property name="port" value="${config.port}"/>
723
		</ant>
724
		</target -->
725 1952 jones
726 4969 daigle
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
727
		description="Automately generate wsdd for ecogrid service">
728
		<delete
729
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
730
	</target>
731
732
	<!-- target name="install-registry" depends="init,getConversionXSL"
733
		description="Install Registry">
734
735
		<mkdir dir="${inst.cgi.dir}" />
736
		<copy file="${srcdir}/perl/register-dataset.cgi"
737
		todir="${inst.cgi.dir}"/>
738
		<chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
739
740
		<! - - TODO SCW: set the permissions on this folder to be writable by the apache user - - >
741
		<mkdir dir="${temp-dir}" />
742
		<! - - TODO SCW: use relative paths to grab these instead of copying to tmp,
743
		used in readDocumentFromMetacat - - >
744
		<copy todir="${temp-dir}" filtering="yes">
745
		<fileset dir="lib/style/common/emlb6toeml2">
746
		<include name="*.xsl"/>
747
		<include name="*.xml"/>
748
		</fileset>
749
		</copy>
750
751
		<echo message="Install Registry completed." />
752
		</target -->
753
754
	<!-- target name="install-ldap" depends="init"
755
		description="Install Metacat LDAP Access">
756
757
		<mkdir dir="${inst.cgi.dir}" />
758
		<copy file="${srcdir}/perl/ldapweb.cgi"
759
		todir="${inst.cgi.dir}" />
760
		<chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
761
		<mkdir dir="${templates.dir}" />
762
		<copy todir="${templates.dir}">
763
		<fileset dir="lib/style/common/templates">
764
		< ! - - SCW: Copy all files - - >
765
		</fileset>
766
		</copy>
767
		<echo message="ldapweb install complete." />
768
		</target -->
769
770
771
	<target name="install-skin" depends="init"
772
		description="Install a Skin">
773
774
		<input message="Please enter name of the skin"
775
			addproperty="skin-name" />
776
777
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
778
		<copy todir="${installdir}/style/skins/${skin-name}"
779
			filtering="yes">
780
			<fileset dir="lib/style/skins/${skin-name}">
781
				<exclude name="**/*.png" />
782
				<exclude name="**/*.gif" />
783
				<exclude name="**/*.jpg" />
784
				<exclude name="**/CVS*" />
785
				<exclude name="**/.#*" />
786
			</fileset>
787
		</copy>
788
		<copy todir="${installdir}/style/skins/${skin-name}"
789
			filtering="no">
790
			<fileset dir="lib/style/skins/${skin-name}">
791
				<include name="**/*.png" />
792
				<include name="**/*.gif" />
793
				<include name="**/*.jpg" />
794
				<exclude name="**/CVS*" />
795
				<exclude name="**/.#*" />
796
			</fileset>
797
		</copy>
798
		<copy todir="${installdir}/style/common" filtering="yes">
799
			<fileset dir="lib/style/common">
800
				<include name="*.js" />
801
				<include name="*.jsp" />
802
				<include name="*.css" />
803
				<exclude name="*.png" />
804
				<exclude name="*.gif" />
805
				<exclude name="*.jpg" />
806
				<exclude name="**/CVS*" />
807
				<exclude name="**/.#*" />
808
			</fileset>
809
		</copy>
810
		<!--
811
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
812
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
813
			<fileset dir="lib/style/skins/${skin-name}/images">
814
			<include name="*.png"/>
815
			<include name="*.gif"/>
816
			<include name="*.jpg"/>
817
			</fileset>
818
			</copy>
819
		-->
820
821
		<echo message="Install Skin completed." />
822
	</target>
823
824
	<target name="war" depends="warPrepare,install-spatial"
825
		description="Create a web archive (WAR) for servlet deployment">
826
		<mkdir dir="${dist.dir}" />
827
		<war destfile="${dist.dir}/${metacat.context}.war"
828
			webxml="${build.war}/web.xml">
829
			<fileset dir="${war.context}" />
830
			<lib dir="${war.lib}" />
831
			<webinf dir="${war.webinf}" />
832
		</war>
833
	</target>
834
835
	<target name="warPrepare"
836
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare"
837
		description="Prepare files for creating a web archive (WAR)">
838
839
		<property name="war.lib" value="${build.war}/lib" />
840
		<property name="war.webinf" value="${build.war}/WEB-INF" />
841
		<property name="war.context"
842
			value="${build.war}/${metacat.context}" />
843
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
844
		<property name="war.webinf.scripts"
845
			value="${war.webinf}/scripts" />
846
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
847
		<property name="war.context.docs" value="${war.context}/docs" />
848
		<property name="war.context.temp" value="${war.context}/temp" />
849
		<property name="war.context.templates"
850
			value="${war.context}${style-common-relpath}/templates" />
851
		<mkdir dir="${war.lib}" />
852
		<mkdir dir="${war.webinf}" />
853
		<mkdir dir="${war.context}" />
854
		<mkdir dir="${war.webinf.sql}" />
855
		<mkdir dir="${war.context.cgi}" />
856
		<mkdir dir="${war.context.docs}" />
857
		<mkdir dir="${war.context.temp}" />
858
		<mkdir dir="${war.context.templates}" />
859
860
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
861
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
862
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
863
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
864
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
865
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
866
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
867
		<copy todir="${war.lib}" filtering="no">
868
			<fileset dir="lib">
869
				<!--
870
					<not>
871
					<filename name="${jdbc-jar-name}"/>
872
					</not>
873
				-->
874
				<include name="*.jar" />
875
			</fileset>
876
			<fileset dir="lib">
877
				<include name="xalan.jar" />
878
				<include name="gwt*.jar" />
879
			</fileset>
880
			<fileset dir="lib/oaipmh">
881
				<include name="oaicat.jar" />
882
			</fileset>
883
		</copy>
884
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
885
			tofile="${build.war}/web.xml" / -->
886
		<!-- MCD added next - Remove the tomcat5 reference-->
887
		<copy file="lib/web.xml.tomcat5" tofile="${build.war}/web.xml" />
888
		<copy file="lib/metacat.properties" todir="${war.webinf}"
889
			filtering="yes" />
890
		<copy file="lib/metacat.properties.metadata.xml"
891
			todir="${war.webinf}" filtering="no" />
892
		<copy file="lib/org.properties.metadata.xml"
893
			todir="${war.webinf}" filtering="no" />
894
		<copy file="lib/auth.properties.metadata.xml"
895
			todir="${war.webinf}" filtering="no" />
896
		<copy todir="${war.webinf}" filtering="yes">
897
			<fileset dir="lib">
898
				<include name="skin.configs/**" />
899
			</fileset>
900
		</copy>
901
		<copy file="lib/log4j.properties" todir="${war.webinf}"
902
			filtering="yes" />
903
		<copy todir="${war.context}" filtering="no">
904
			<fileset dir="lib">
905
				<include name="**/*.jpg" />
906
				<include name="**/*.png" />
907
				<include name="**/*.gif" />
908
				<include name="LiveMap_30/**" />
909
				<include name="oaipmh/**" />
910
			</fileset>
911
		</copy>
912
		<copy todir="${war.context}" filtering="yes">
913
			<fileset dir="lib">
914
				<exclude name="*.jar" />
915
				<exclude name="*.properties" />
916
				<exclude name="*.metadata.xml" />
917
				<exclude name="web.xml" />
918
				<exclude name="**/*.jpg" />
919
				<exclude name="**/*.png" />
920
				<exclude name="**/*.gif" />
921
				<exclude name="lsid_lib/**" />
922
				<exclude name="lsid_conf/**" />
923
				<exclude name="LiveMap_30/**" />
924
				<exclude name="oaipmh/**" />
925
				<exclude name="skin.configs/**" />
926
				<exclude name="spatial/geoserver/**" />
927
				<exclude name="spatial/WEB-INF/**" />
928
			</fileset>
929
		</copy>
930
		<copy todir="${war.context.docs}" filtering="yes">
931
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
932
		</copy>
933
		<copy todir="${war.context.docs}" filtering="no">
934
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
935
		</copy>
936
		<copy todir="${war.webinf.sql}" filtering="yes">
937
			<fileset dir="src">
938
				<include name="**/*.sql" />
939
			</fileset>
940
		</copy>
941
		<copy todir="${war.webinf.scripts}" filtering="yes">
942
			<fileset dir="src/scripts" />
943
		</copy>
944
		<copy todir="${war.webinf.scripts}"
945
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
946
			failonerror="false" />
947
948
		<copy file="src/perl/register-dataset.cgi"
949
			todir="${war.context.cgi}" />
950
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
951
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
952
953
		<!-- registry cgi section -->
954
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
955
			used in readDocumentFromMetacat -->
956
		<!-- TODO MCD copy temp files to actual location using config util?? -->
957
		<copy todir="${war.context.temp}" filtering="yes">
958
			<fileset dir="lib/style/common/emlb6toeml2">
959
				<include name="*.xsl" />
960
				<include name="*.xml" />
961
			</fileset>
962
		</copy>
963
		<available file="lib/style/common/emlb6toeml2" type="dir"
964
			property="styles.not.needed" />
965
966
		<!-- ldap cgi section -->
967
		<copy todir="${war.context.templates}">
968
			<fileset dir="lib/style/common/templates">
969
				<!-- SCW: Copy all files -->
970
			</fileset>
971
		</copy>
972
	</target>
973
974
	<target name="cgiPrepare" if="build.perl">
975
		<exec dir="src/perl/Metacat/" executable="make">
976 4820 daigle
			<arg value="clean" />
977 4969 daigle
		</exec>
978
		<exec dir="src/perl/Metacat/" executable="perl">
979 4369 daigle
			<arg value="Makefile.PL" />
980
		</exec>
981 4820 daigle
		<exec dir="src/perl/Metacat/" executable="make" />
982 4369 daigle
	</target>
983 4969 daigle
984 4550 daigle
	<target name="testPrepare"
985 4435 daigle
		description="Copies test files into the war directories">
986
		<echo>in testPrepare</echo>
987 4969 daigle
		<property name="war.context.test"
988
			value="${build.war}/${metacat.context}/test" />
989 4435 daigle
		<mkdir dir="${war.context.test}" />
990 4969 daigle
		<copy todir="${war.context.test}" filtering="yes">
991
			<fileset dir="test/servertestfiles">
992
				<include name="*/**" />
993
			</fileset>
994 4435 daigle
		</copy>
995
	</target>
996 1929 brooke
997 4969 daigle
	<target name="getConversionXSL" depends="prepare"
998
		unless="styles.not.needed"
999
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1000 2497 sgarg
1001 4969 daigle
		<echo>Enter CVS password:</echo>
1002
		<cvs cvsRoot="${cvsroot}" package="${eml-module}"
1003
			tag="${eml2-style-tag}" dest="${build.tmp}/eml_${eml2-style-tag}" />
1004 2343 sgarg
1005 4969 daigle
		<mkdir dir="lib/style/common/emlb6toeml2" />
1006
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1007
			<fileset
1008
				dir="${build.tmp}/eml_${eml2-style-tag}/${eml-module}/lib/beta6toeml2/xsl">
1009
				<include name="*.xsl" />
1010
				<include name="*.xml" />
1011
			</fileset>
1012
		</copy>
1013
	</target>
1014 1929 brooke
1015 4969 daigle
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1016
		<mkdir dir="${build.tests}" />
1017
		<copy todir="${build.tests}" filtering="yes">
1018
			<fileset dir="${testdir}">
1019
				<include name="edu/**" />
1020
			</fileset>
1021
		</copy>
1022
		<copy todir="${build.tests}" file="${testdir}/test.properties"
1023
			filtering="yes" />
1024 4121 daigle
1025 4969 daigle
		<!-- copy and compile the tests into a jar file -->
1026
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1027
			debug="on" includes="**/*.java">
1028
			<classpath>
1029
				<path refid="compile.classpath" />
1030
				<fileset dir="${build.dir}">
1031
					<include name="${name}.jar" />
1032
					<include name="${name}-client.jar" />
1033
					<include name="harvester.jar" />
1034
				</fileset>
1035
			</classpath>
1036
		</javac>
1037 204 jones
1038 4969 daigle
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1039
			basedir="${build.tests}" includes="**/*.class" />
1040
	</target>
1041 971 tao
1042 4969 daigle
	<target name="test" depends="testprep"
1043
		description="Uses the ant junit task to run all JUnit tests">
1044 1822 jones
1045 4969 daigle
		<!-- use the ant "junit" task to run JUnit tests. -->
1046
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1047
			haltonerror="no">
1048
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1049
			<classpath>
1050
				<path refid="compile.classpath" />
1051
				<fileset dir="${build.dir}">
1052
					<include name="${name}.jar" />
1053
					<include name="${name}-client.jar" />
1054
					<include name="harvester.jar" />
1055
					<include name="${name}-junittests.jar" />
1056
				</fileset>
1057
			</classpath>
1058 971 tao
1059 4969 daigle
			<formatter type="plain" />
1060 971 tao
1061 4969 daigle
			<batchtest fork="yes" todir="${build.dir}">
1062
				<fileset dir="${build.tests}">
1063
					<include name="**/*.class" />
1064
					<exclude name="**/MCTestCase.class" />
1065
					<exclude name="**/ClientViewHelperTest.class" />
1066
				</fileset>
1067
			</batchtest>
1068
		</junit>
1069
	</target>
1070 1103 tao
1071 4969 daigle
	<target name="runonetest" depends="testprep"
1072
		description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1073 1500 tao
1074 4969 daigle
		<echo>testtorun: ${testtorun}</echo>
1075 1939 brooke
1076 4969 daigle
		<!-- use the ant "junit" task to run JUnit tests. -->
1077
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1078
			haltonerror="no" showoutput="yes">
1079
			<!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
1080
			<classpath>
1081
				<path refid="compile.classpath" />
1082
				<fileset dir="${build.dir}">
1083
					<include name="${name}.jar" />
1084
					<include name="${name}-client.jar" />
1085
					<include name="harvester.jar" />
1086
					<include name="${name}-junittests.jar" />
1087
				</fileset>
1088
			</classpath>
1089 1500 tao
1090 4969 daigle
			<formatter type="plain" />
1091 1500 tao
1092 4969 daigle
			<batchtest fork="yes" todir="${build.dir}">
1093
				<fileset dir="${build.tests}">
1094
					<include name="**/${testtorun}.class" />
1095
				</fileset>
1096
			</batchtest>
1097
		</junit>
1098
	</target>
1099 1500 tao
1100 4969 daigle
	<target name="testharvester" depends="testprep"
1101
		description="Uses the ant junit task to test only the Harvester code">
1102
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1103
			haltonerror="off">
1104
			<classpath>
1105
				<path refid="compile.classpath" />
1106
				<fileset dir="${build.dir}">
1107
					<include name="${name}.jar" />
1108
					<include name="${name}-client.jar" />
1109
					<include name="harvester.jar" />
1110
					<include name="${name}-junittests.jar" />
1111
				</fileset>
1112
			</classpath>
1113
			<formatter type="plain" />
1114
			<batchtest fork="yes" todir="${build.dir}">
1115
				<fileset dir="${build.tests}">
1116
					<include name="**/harvesterClient/*.class" />
1117
				</fileset>
1118
			</batchtest>
1119
		</junit>
1120
	</target>
1121 2135 costa
1122 4969 daigle
	<target name="gethttpclient" depends="prepare"
1123
		description="checks out and compiles morpho httpclient code">
1124
		<!--mkdir dir="${morphosourcedir}" -->
1125
		<cvs cvsRoot="${cvsroot}" package="morpho" dest="." />
1126
		<ant dir="${morphosourcedir}" inheritAll="false" target="jar" />
1127
	</target>
1128 1103 tao
1129 4969 daigle
	<!-- run this target, we need to check out a another morpho souce dir was checked out. -->
1130
	<target name="nettest" depends="install"
1131
		description="compiles and runs the metacatnettest code">
1132 2175 tao
1133 4969 daigle
		<echo>
1134
			*********************************** Please run ant
1135
			gethttpclient first! ***********************************
1136
		</echo>
1137
		<!-- copy and compile the tests into a jar file -->
1138
		<mkdir dir="${build.metacatnettest}" />
1139
		<javac srcdir="${junitnettestsdir}"
1140
			destdir="${build.metacatnettest}" includes="**/*.java">
1141
			<classpath>
1142
				<path refid="compile.classpath" />
1143
				<fileset dir="${build.dir}">
1144
					<include name="${name}.jar" />
1145
				</fileset>
1146
			</classpath>
1147
		</javac>
1148 1103 tao
1149 4969 daigle
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1150
			basedir="${build.metacatnettest}" includes="**/*.class" />
1151 1103 tao
1152 4969 daigle
		<!-- use the ant "junit" task to run JUnit tests. -->
1153
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1154
			haltonerror="no">
1155
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1156
			<classpath>
1157
				<path refid="compile.classpath" />
1158
				<fileset dir="${build.dir}">
1159
					<include name="${name}.jar" />
1160
					<include name="${name}-junitnettests.jar" />
1161
				</fileset>
1162
			</classpath>
1163 1103 tao
1164 4969 daigle
			<formatter type="plain" />
1165 1103 tao
1166 4969 daigle
			<batchtest fork="yes" todir="${build.dir}">
1167
				<fileset dir="${build.metacatnettest}">
1168
					<include name="**/*.class" />
1169
				</fileset>
1170
			</batchtest>
1171
		</junit>
1172
	</target>
1173 1103 tao
1174 4969 daigle
	<target name="cleanweb" depends="clean"
1175
		description="deletes tomcat web context dir and all its contents">
1176
		<delete dir="${installdir}" />
1177
	</target>
1178 1522 berkley
1179
1180 4969 daigle
	<target name="clean" depends="init"
1181
		description="deletes build dir and files that can be regenerated form the release">
1182
		<delete dir="${build.dir}" />
1183
		<delete dir="${dist.dir}" />
1184
	</target>
1185 2320 jones
1186 4098 daigle
	<target name="localclean" depends="clean"
1187 4969 daigle
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1188
		<delete file="lib/httpclient.jar" />
1189
		<delete file="lib/utilities.jar" />
1190
	</target>
1191 113 jones
1192 4969 daigle
	<target name="fullclean" depends="localclean"
1193
		description="deletes code and eml">
1194
		<delete includeEmptyDirs="true" failonerror="false">
1195
			<fileset dir="${style-common-cvsrelpath}">
1196
				<include name="${eml-css}" />
1197
				<include name="eml-*/*.xsl" />
1198
				<include name="eml-*" />
1199
			</fileset>
1200
			<fileset dir="${schema-cvsrelpath}">
1201
				<include name="eml-*/*.xsd" />
1202
			</fileset>
1203
			<fileset dir="${ecogrid-dir}">
1204
				<include name="build.properties" />
1205
				<include name="buildfiles/metacatImpl.xml" />
1206
			</fileset>
1207
		</delete>
1208
	</target>
1209 113 jones
1210 4969 daigle
	<target name="jdoc" depends="prepare"
1211
		description="generates javadoc documentation">
1212
		<javadoc packagenames="edu.ucsb.nceas.*"
1213
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1214
			version="true" use="true" windowtitle="${Name} API"
1215
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1216
			bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1217
			<classpath>
1218
				<path refid="compile.classpath" />
1219
			</classpath>
1220
		</javadoc>
1221
	</target>
1222 882 jones
1223 4969 daigle
	<target name="dist"
1224
		depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1225
		description="prepares a full release distribution">
1226
		<mkdir dir="${dist.dir}" />
1227
		<delete dir="${ver.dir}" />
1228
		<mkdir dir="${ver.dir}" />
1229
		<copy todir="${ver.dir}">
1230
			<fileset dir="."
1231
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1232
		</copy>
1233
		<copy todir="${ver.dir}" file="build.xml" />
1234
		<copy todir="${ver.dir}" file="build.properties" />
1235 806 jones
1236 4969 daigle
		<copy todir="${ver.dir}/docs" filtering="yes">
1237
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1238
		</copy>
1239
		<copy todir="${ver.dir}/docs" filtering="no">
1240
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1241
		</copy>
1242
		<copy todir="${ver.dir}/docs/dev">
1243
			<fileset dir="${build.dir}/docs" />
1244
		</copy>
1245
		<copy todir="${ver.dir}/src">
1246
			<fileset dir="${build.dir}/src" />
1247
		</copy>
1248
1249
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1250
		<copy todir="${ver.dir}/test/servertestfiles">
1251
			<fileset dir="./test/servertestfiles" />
1252
		</copy>
1253
	</target>
1254
1255
	<target name="distbin" depends="build-metacat,war-lsid"
1256
		description="prepares a binary distribution">
1257 4372 daigle
		<copy todir="${dist.dir}">
1258 4969 daigle
			<fileset dir="./src/scripts" />
1259
		</copy>
1260 4372 daigle
		<delete file="./${name}-bin-${release}.zip" />
1261 4969 daigle
		<zip zipfile="./${name}-bin-${release}.zip"
1262
			basedir="${dist.dir}" excludes="metacat-*/**" />
1263 4372 daigle
		<delete file="./${name}-bin-${release}.tar.gz" />
1264 4969 daigle
		<tar tarfile="./${name}-bin-${release}.tar"
1265
			basedir="${dist.dir}" excludes="metacat-*/**" />
1266
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1267
			src="./${name}-bin-${release}.tar" />
1268 4372 daigle
		<delete file="./${name}-bin-${release}.tar" />
1269
	</target>
1270 806 jones
1271 4969 daigle
	<target name="distsrc" depends="dist"
1272
		description="prepares a source distribution">
1273
		<mkdir dir="${ver.src}" />
1274
		<copy todir="${ver.src}">
1275
			<fileset dir="./src" />
1276
		</copy>
1277
		<mkdir dir="${util.dir}" />
1278
		<copy todir="${util.dir}">
1279
			<fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1280
		</copy>
1281 3131 perry
1282 4969 daigle
		<mkdir dir="${ecogrid-dist-dir}" />
1283
		<copy todir="${ecogrid-dist-dir}">
1284
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1285
		</copy>
1286 806 jones
1287 4969 daigle
		<delete file="${ver.dir}/lib/utilities.jar" />
1288 2175 tao
1289 4969 daigle
		<delete file="./${name}-src-${release}.zip" />
1290
		<zip zipfile="./${name}-src-${release}.zip"
1291
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1292
		<delete file="./${name}-src-${release}.tar.gz" />
1293
		<tar tarfile="./${name}-src-${release}.tar"
1294
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1295
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1296
			src="./${name}-src-${release}.tar" />
1297
		<delete file="./${name}-src-${release}.tar" />
1298
		<!--delete dir="${dist.dir}"/ -->
1299
	</target>
1300 2175 tao
1301 4969 daigle
	<target name="deb-package" depends="distbin"
1302
		description="create a debian installation package">
1303
		<delete dir="${deb.pkg.dir}" />
1304
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1305
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1306
			<fileset dir="./src/scripts/debian"
1307
				includes="control postinst" />
1308
		</copy>
1309 2598 harris
1310 4969 daigle
		<mkdir
1311
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1312
		<copy
1313
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1314
			filtering="yes">
1315
			<fileset dir="./src/scripts/debian"
1316
				excludes="control postinst" />
1317
		</copy>
1318
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1319 2598 harris
1320 4969 daigle
		<copy file="${dist.dir}/knb.war"
1321
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1322
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1323
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1324 2737 jones
1325 4969 daigle
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1326
			failonerror="true">
1327
			<arg line="--build debian" />
1328
		</exec>
1329 2737 jones
1330 4969 daigle
		<move file="${pkg.dir}/debian.deb"
1331
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1332
	</target>
1333
1334
	<target name="stylesheettest">
1335
		<xslt in="${input}" out="eml.html"
1336
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1337
			<param name="displaymodule" expression="${displaymodule}" />
1338
			<param name="docid" expression="${input}" />
1339
			<param name="entitytype" expression="${entitytype}" />
1340
			<param name="entityindex" expression="${entityindex}" />
1341
			<outputproperty name="method" value="html" />
1342
			<outputproperty name="standalone" value="yes" />
1343
			<outputproperty name="encoding" value="iso8859_1" />
1344
			<outputproperty name="indent" value="yes" />
1345
		</xslt>
1346
	</target>
1347
1348
1349
	<target name="compilewebclient" depends="prepare">
1350
		<javac srcdir="${build.src}" destdir="${build.dest}"
1351
			includes="**/application/*.java" classpathref="webservicepath" />
1352
	</target>
1353
1354
	<target name="runwebclient" depends="compilewebclient">
1355
		<java
1356
			classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1357
			dir="${build.dest}" fork="yes" classpathref="webservicepath"
1358
			classpath="./lib/utilities.jar" failonerror="true">
1359
			<arg value="${serviceUrl}" />
1360
			<arg value="${docid}" />
1361
		</java>
1362
	</target>
1363
1364
	<target name="spatial_option" depends="prepare"
1365
		description=" -- compiles code for the spatial option">
1366
1367
		<echo message="Compiling the metatcat shapefile creator" />
1368
		<echo message="using the shapelib at: ${shapelib.dir}" />
1369
		<exec dir="." executable="g++" os="Linux, Unix"
1370
			failonerror="true">
1371
			<arg
1372
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1373
		</exec>
1374
1375
		<exec dir="." executable="g++" os="Linux, Unix"
1376
			failonerror="true">
1377
			<arg
1378
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1379
		</exec>
1380
	</target>
1381
1382
	<!-- LSID Authority support -->
1383
	<patternset id="lsid.jars">
1384
		<include name="axis.jar" />
1385
		<include name="commons-discovery-0.2.jar" />
1386
		<include name="jaxrpc.jar" />
1387
		<include name="lsid-client-1.1.1.jar" />
1388
		<include name="lsid-server-1.1.1.jar" />
1389
		<include name="saaj.jar" />
1390
		<include name="wsdl4j-1.5.1.jar" />
1391
		<include name="activation.jar" />
1392
		<include name="castor-0.9.5.jar" />
1393
		<include name="dnsjava-1.3.2.jar" />
1394
		<include name="mail.jar" />
1395
		<include name="commons-logging-1.0.4.jar" />
1396
		<!-- These jars may be needed but seem to not actually be,
1397
			so leaving them out for now
1398
			<include name="axis-ant.jar" />
1399
		-->
1400
		<!--<include name="GenCastor.class" />-->
1401
	</patternset>
1402
	<patternset id="lib.jars">
1403
		<include name="httpclient.jar" />
1404
		<include name="log4j-1.2.12.jar" />
1405
		<include name="utilities.jar" />
1406
		<include name="xercesImpl.jar" />
1407
		<include name="xalan.jar" />
1408
		<include name="xml-apis.jar" />
1409
	</patternset>
1410
1411
	<path id="lsid.classpath">
1412
		<fileset dir="${lsid.lib.dir}">
1413
			<patternset refid="lsid.jars" />
1414
		</fileset>
1415
		<fileset dir="${lib.dir}">
1416
			<patternset refid="lsid.jars" />
1417
		</fileset>
1418
		<fileset dir="${lib.dir}">
1419
			<include name="xalan.jar" />
1420
			<include name="xml-apis.jar" />
1421
		</fileset>
1422
		<fileset dir="${build.dir}">
1423
			<include name="metacat-client.jar" />
1424
		</fileset>
1425
	</path>
1426
1427
	<filterset id="configFilters">
1428
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1429
			value="${config.hostname}" / -->
1430
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1431
			value="${config.port}" / -->
1432
		<!-- MCD BYE filter token="METADATA_LABELS"
1433
			value="${config.metadataLabelLsid}" / -->
1434
		<!-- MCD BYE filter token="METACAT_SERVER"
1435
			value="${config.metacatserver}" / -->
1436
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1437
			value="${config.lsidauthority}" / -->
1438
	</filterset>
1439
1440
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1441
		description="Configure files prior to compilation">
1442
		<mkdir dir="${lsid.build.dir}" />
1443
		<!-- Copy the properties file into the build -->
1444
		<copy file="${conf.dir}/metacat-lsid.properties"
1445
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1446
			overwrite="true">
1447
			<filterset refid="configFilters" />
1448
		</copy>
1449
		<copy file="${conf.dir}/log4j.properties"
1450
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1451
			overwrite="true">
1452
			<filterset refid="configFilters" />
1453
		</copy>
1454
		<!-- Copy config files into the build -->
1455
		<copy todir="${lsid.build.dir}/WEB-INF">
1456
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1457
		</copy>
1458
		<!-- Copy the metadata configuration files into the build -->
1459
		<mkdir
1460
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1461
		<copy
1462
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1463
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1464
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1465
			<filterset refid="configFilters" />
1466
		</copy>
1467
		<!-- Copy services files into the build -->
1468
		<mkdir dir="${lsid.build.dir}/services" />
1469
		<copy todir="${lsid.build.dir}/services">
1470
			<fileset dir="${services.dir}" />
1471
			<filterset refid="configFilters" />
1472
		</copy>
1473
		<!-- Copy axis files into the build -->
1474
		<mkdir dir="${lsid.build.dir}" />
1475
		<copy todir="${lsid.build.dir}">
1476
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1477
		</copy>
1478
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1479
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1480
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1481
		</copy>
1482
	</target>
1483
1484
	<target name="compile-lsid" depends="prepare-lsid"
1485
		description="Compile Java sources">
1486
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1487
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1488
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1489
			deprecation="${compile.deprecation}"
1490
			optimize="${compile.optimize}">
1491
			<classpath refid="lsid.classpath" />
1492
		</javac>
1493
	</target>
1494
1495
	<target name="war-lsid" depends="compile-lsid"
1496
		description="Create a war file for the application">
1497
		<mkdir dir="${dist.dir}" />
1498
		<war destfile="${dist.dir}/${authority.context}.war"
1499
			webxml="${webinf.dir}/web.xml">
1500
			<fileset dir="${lsid.build.dir}" />
1501
			<lib dir="${lsid.lib.dir}">
1502
				<patternset refid="lsid.jars" />
1503
			</lib>
1504
			<lib dir="${lib.dir}">
1505
				<patternset refid="lib.jars" />
1506
			</lib>
1507
			<lib dir="${lib.dir}">
1508
				<include name="xalan.jar" />
1509
				<include name="xml-apis.jar" />
1510
			</lib>
1511
			<lib dir="${build.dir}">
1512
				<include name="metacat-client.jar" />
1513
			</lib>
1514
		</war>
1515
	</target>
1516
1517
	<target name="deploy-lsid" depends="war-lsid"
1518
		description="Deploy LSID war to servlet container">
1519
		<delete dir="${app.deploy.dir}/${authority.context}" />
1520
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1521
		<mkdir dir="${app.deploy.dir}" />
1522
		<copy todir="${app.deploy.dir}">
1523
			<fileset dir="${dist.dir}" />
1524
		</copy>
1525
	</target>
1526 113 jones
</project>