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