Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
	*   '$RCSfile$'
4
	*     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
	*   Copyright: 2000 Regents of the University of California and the
6
	*              National Center for Ecological Analysis and Synthesis
7
	* For Details: http://www.nceas.ucsb.edu/
8
	*
9
	*    '$Author: leinfelder $'
10
	*    '$Date: 2013-09-18 14:56:00 -0700 (Wed, 18 Sep 2013) $'
11
	*    '$Revision: 8236 $'
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|documentation]
17
	*
18
	* This program is free software; you can redistribute it and/or modify
19
	* it under the terms of the GNU General Public License as published by
20
	* the Free Software Foundation; either version 2 of the License, or
21
	* (at your option) any later version.
22
	*
23
	* This program is distributed in the hope that it will be useful,
24
	* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
	* GNU General Public License for more details.
27
	*
28
	* You should have received a copy of the GNU General Public License
29
	* along with this program; if not, write to the Free Software
30
	* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
-->
32
<project name="metacat" default="jar" basedir="."
33
         xmlns:artifact="antlib:org.apache.maven.artifact.ant">
34
	<property environment="env" />
35
	<property file="build.properties" /><!-- USER SPECIFIC PROPS -->
36

    
37

    
38
    <!-- Configure the maven2 ant tasks -->
39
    <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.0.jar" />
40
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
41
             uri="antlib:org.apache.maven.artifact.ant"
42
             classpathref="maven-ant-tasks.classpath" />
43
	
44
	<!-- defining the axis tasks -->
45
	<path id="axis.ant.classpath">
46
		<fileset dir="lib/lsid_lib">
47
			<include name="*.jar" />
48
		</fileset>
49
	</path>
50
	
51
	<!-- Allow integration with Git projects -->
52
	<macrodef name = "git">
53
	    <attribute name = "command" />
54
	    <attribute name = "dir" default = "" />
55
	    <element name = "args" optional = "true" />
56
	    <sequential>
57
	        <echo message = "git @{command}" />
58
	        <exec executable = "git" dir = "@{dir}">
59
	            <arg value = "@{command}" />
60
	            <args/>
61
	        </exec>
62
	    </sequential>
63
	</macrodef>
64
	<macrodef name = "git-clone-pull">
65
	    <attribute name = "repository" />
66
	    <attribute name = "dest" />
67
	    <sequential>
68
	        <git command = "clone">
69
	            <args>
70
	                <arg value = "@{repository}" />
71
	                <arg value = "@{dest}" />
72
	            </args>
73
	        </git>
74
	        <git command = "pull" dir = "@{dest}" />
75
	    </sequential>
76
	</macrodef>
77
	
78
	<!-- get metacatUI project -->
79
	<target name="getMetacatUI" depends="init">
80
		<git-clone-pull repository="${metacatui.git.repository.url}" dest="${metacatui.build.dir}" />
81
	</target>
82
	
83
	<target name="build-metacat-ui" description="Calls the Maven build for metacatUI war" depends="getMetacatUI" unless="build-metacat-ui-called">
84
		<artifact:mvn pom="${metacatui.build.dir}/metacatui/pom.xml" mavenhome="${maven.home}" fork="true">
85
			<arg value="clean"/>
86
		</artifact:mvn>
87
		<artifact:mvn pom="${metacatui.build.dir}/metacatui/pom.xml" mavenhome="${maven.home}" fork="true">
88
		   <arg value="package"/>
89
		</artifact:mvn>
90
		<property name="build-metacat-ui-called" value="true"/>
91
	</target>
92
	
93
	<target name="dist-metacat-ui" depends="build-metacat-ui">
94
		<copy tofile="${dist.dir}/metacatui.war" >
95
			<fileset dir="${metacatui.build.dir}/metacatui/target" includes="*.war"></fileset>
96
		</copy>	
97
	</target>
98
    	
99
	<taskdef resource="axis-tasks.properties"
100
		classpathref="axis.ant.classpath" />
101
	
102
	<!-- Determine if ecogrid should be installed-->
103
	<condition property="enable.ecogrid">
104
		<equals arg1="${install.ecogrid}" arg2="true" />
105
	</condition>
106

    
107
	<!-- Determine if perl should be built-->
108
	<condition property="build.perl">
109
		<equals arg1="${make.perl.code}" arg2="true" />
110
	</condition>
111

    
112
	<available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
113
			property="tomcat.common.exists" />
114

    
115
	<target name="config" depends="setTomcatCommon, setTomcatNoCommon">
116
		<!-- usr for client testing, generally you don't need change-->
117
		<property name="mcuser"
118
			value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
119
		<property name="mcpassword" value="kepler" />
120
		<property name="mcanotheruser"
121
			value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org" />
122
		<property name="mcanotherpassword" value="yourpass" />
123
		<property name="piscouser"
124
			value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org" />
125
		<property name="piscopassword" value="yourpass" />
126
		<property name="lteruser"
127
			value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org" />
128
		<property name="lterpassword" value="yourpass" />
129

    
130
		<property name="debug" value="on" />
131
		<property name="morphosourcedir" value="../morpho" />
132
		<property name="utilitiesdir" value="../utilities" />
133
		<property name="installdir"
134
			value="${app.deploy.dir}/${metacat.context}" />
135

    
136
		<echo>*********** set jsdk to ${jsdk}</echo>
137
	</target>
138
	
139
	<target name="setTomcatCommon" if="tomcat.common.exists" >
140
		<property name="jsdk"
141
			value="${build.tomcat.dir}/common/lib/servlet-api.jar" />
142
	</target>
143
	
144
	<target name="setTomcatNoCommon" unless="tomcat.common.exists" >
145
		<property name="jsdk"
146
			value="${build.tomcat.dir}/lib/servlet-api.jar" />
147
	</target>
148
	
149
	<target name="init" depends="config, build-metacat-common" unless="init.called">
150
		
151
	    <property name="libdir.mvn" value="lib/maven" />
152
		<mkdir dir="${libdir.mvn}"/>
153
		
154
		<path id="base.classpath">
155
			<pathelement location="${jsdk}" />
156
            <pathelement location="lib" />
157
			
158
			<fileset dir="lib">
159
				<include name="*.jar" />
160
			</fileset>
161
			
162
			<fileset dir="lib/lsid_lib">
163
				<include name="*.jar" />
164
			</fileset>
165

    
166
			<!-- Include everything from maven -->
167
			<fileset dir="${libdir.mvn}">
168
				<include name="*.jar" />
169
			</fileset>
170

    
171
		</path>
172
		
173
		<path id="test.classpath">
174
			<pathelement location="${jsdk}" />
175
			<pathelement location="lib" />
176
			<fileset dir="lib">
177
				<include name="*.jar" />
178
				<exclude name="maven-ant-tasks-2.1.0.jar" />
179
			</fileset>
180
			<fileset dir="lib/lsid_lib">
181
				<include name="*.jar" />
182
			</fileset>
183
			<!-- Include maven -->
184
			<fileset dir="${libdir.mvn}">
185
				<include name="*.jar" />
186
			</fileset>
187
		</path>
188
		
189
		<!-- define the maven tasks -->
190
		<taskdef uri="antlib:org.apache.maven.artifact.ant"
191
			       resource="org/apache/maven/artifact/ant/antlib.xml"
192
			       classpathref="base.classpath" />
193

    
194
	   	<!-- Resolve maven dependencies -->
195
		<artifact:pom id="metacatPom" file="pom.xml" />
196
		<artifact:dependencies filesetId="dependency.fileset" pomrefid="metacatPom" usescope="runtime"/>
197
		<artifact:dependencies pathId="dependency.classpath" pomrefid="metacatPom"/>
198
	   		   	
199
	   	<!-- combine base and dependencies for the classpath -->
200
	   	<path id="compile.classpath">
201
	   		<path refid="base.classpath" />	
202
	   		<path refid="dependency.classpath" />	
203
		</path>
204

    
205
		<!-- It is less likely you'll need to make any changes from here down,
206
			but customization is possible -->
207
		<property name="name" value="metacat" />
208
		<property name="Name" value="MetaCat" />
209
		<property name="debugprefix" value="${Name}:" />
210
		<property name="release" value="${metacat.version}" />
211
		<tstamp>
212
		    <format property="copyrightyear" pattern="yyyy" locale="en,US"/>
213
		</tstamp>
214
		<property name="copyright" value="${copyrightyear} Regents of the University of California" />
215
		<property name="style-common-relpath" value="/style/common" />
216
		<property name="style-shared-relpath" value="/style/shared" />
217
		<property name="schema-relpath" value="/schema" />
218
		<property name="style-common-cvsrelpath"
219
			value="lib${style-common-relpath}" />
220
		<property name="schema-cvsrelpath" value="lib${schema-relpath}" />
221
		<property name="style-skins-relpath" value="/style/skins" />
222
		<property name="util-module" value="utilities" />
223
		<!--<property name="utilities-tag" value="trunk" />-->
224
		<property name="utilities-tag" value="tags/UTILITIES_1_3_0" />
225
		<property name="seek-tag" value="tags/ECOGRID_1_2_2" />
226
		<property name="eml-module" value="eml" />
227
		<property name="eml-version" value="2.0.0beta6" />
228
		<property name="eml-beta4-version" value="2.0.0beta4" />
229
		<property name="eml-beta-tag"
230
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
231
		<property name="eml-beta4-tag"
232
					value="RELEASE_EML_2_BETA_4" />
233
		<property name="eml2_0_0-schema-tag"
234
			value="RELEASE_EML_2_0_0_UPDATE_1" />
235
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
236
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
237
		<property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1" />
238
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_7" />
239
		<property name="eml2_0_0namespace"
240
			value="eml://ecoinformatics.org/eml-2.0.0" />
241
		<property name="eml2_0_1namespace"
242
			value="eml://ecoinformatics.org/eml-2.0.1" />
243
		<property name="eml2_1_0namespace"
244
			value="eml://ecoinformatics.org/eml-2.1.0" />
245
		<property name="eml2_1_1namespace"
246
			value="eml://ecoinformatics.org/eml-2.1.1" />
247
		<property name="stmmlnamespace"
248
			value="http://www.xml-cml.org/schema/stmml" />
249
		<property name="stmml11namespace"
250
			value="http://www.xml-cml.org/schema/stmml-1.1" />
251
		<property name="eml-css" value="eml_xsl.css" />
252
		<property name="eml-module.default.css" value="default.css" />
253
		<property name="systemidserver" value="" />
254
		<property name="html-path" value="" />
255
		<property name ="metacat-properties-file" value="build/war/WEB-INF/metacat.properties"/>
256

    
257

    
258
		<!-- Config for registry variables -->
259
		<!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
260
		<property name="scope" value="obfs" />
261
		<property name="responseForm" value="genericResponse.tmpl" />
262
		<property name="entryForm" value="entryForm.tmpl" />
263
		<property name="guide" value="genericGuide.tmpl" />
264
		<property name="loginForm" value="loginForm.tmpl" />
265
		<property name="confirmData" value="confirmData.tmpl" />
266
		<property name="deleteData" value="deleteData.tmpl" />
267
		<property name="genericHeader" value="genericHeader.tmpl" />
268
		<property name="genericFooter" value="genericFooter.tmpl" />
269

    
270
		<filter token="scope" value="${scope}" />
271
		<filter token="responseForm" value="${responseForm}" />
272
		<filter token="entryForm" value="${entryForm}" />
273
		<filter token="guide" value="${guide}" />
274
		<filter token="loginForm" value="${loginForm}" />
275
		<filter token="confirmData" value="${confirmData}" />
276
		<filter token="deleteData" value="${deleteData}" />
277
		<filter token="genericHeader" value="${genericHeader}" />
278
		<filter token="genericFooter" value="${genericFooter}" />
279
		<filter token="adminname" value="${adminname}" />
280
		<filter token="recipient" value="${recipient}" />
281
		<filter token="metacatVersion" value="${metacat.version}" />
282
		<filter token="metacatRC" value="${metacat.releaseCandidate}" />
283
		<filter token="build.context" value="${metacat.context}" />
284

    
285
		<filter token="docrooturl" value="./" />
286
		<filter token="mcuser" value="${mcuser}" />
287
		<filter token="mcpassword" value="${mcpassword}" />
288
		<filter token="mcanotheruser" value="${mcanotheruser}" />
289
		<filter token="mcanotherpassword" value="${mcanotherpassword}" />
290
		<filter token="eml-css" value="${eml-css}" />
291
		<filter token="style-skins-relpath"
292
			value="${style-skins-relpath}" />
293
		<filter token="style-common-relpath"
294
			value="${style-common-relpath}" />
295

    
296
		<filter token="eml-version" value="${eml-version}" />
297
		<filter token="eml-beta4-version" value="${eml-beta4-version}" />
298
		<filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
299
		<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
300
		<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
301
		<filter token="eml2_1_1namespace" value="${eml2_1_1namespace}" />
302
		<filter token="stmmlnamespace" value="${stmmlnamespace}" />
303
		<filter token="stmml11namespace" value="${stmml11namespace}" />
304
		<filter token="debugprefix" value="${debugprefix}" />
305

    
306
		<filter token="defaultStage" value="${defaultStage}" />
307
		<filter token="defaultHeader" value="${defaultHeader}" />
308
		<filter token="defaultFooter" value="${defaultFooter}" />
309
		<filter token="defaultChangePass" value="${defaultChangePass}" />
310
		<filter token="defaultResetPass" value="${defaultResetPass}" />
311
		<filter token="changePassSuccess" value="${changePassSuccess}" />
312
		<filter token="resetPassSuccess" value="${resetPassSuccess}" />
313
		<filter token="registerFailed" value="${registerFailed}" />
314
		<filter token="registerLter" value="${registerLter}" />
315
		<filter token="registerMatch" value="${registerMatch}" />
316
		<filter token="registerSuccess" value="${registerSuccess}" />
317
		<filter token="register" value="${register}" />
318
		<filter token="searchResults" value="${searchResults}" />
319
		<filter token="ldapMainServerFailure"
320
			value="${ldapMainServerFailure}" />
321
		<filter token="lter-user" value="${lteruser}" />
322
		<filter token="lter-pass" value="${lterpassword}" />
323
		<filter token="pisco-user" value="${piscouser}" />
324
		<filter token="pisco-pass" value="${piscopassword}" />
325

    
326

    
327
		<!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
328
		<!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
329
		<!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
330

    
331
		<property name="srcdir" value="./src" />
332
		<property name="lib.dir" value="./lib" />
333
		<property name="docdir" value="./docs" />
334
		<property name="cgidir" value="./cgi-bin" />
335
		<property name="testdir" value="./test" />
336
		<property name="testtorun" value="MNodeServiceTest" />
337
		<property name="junittestsdir"
338
			value="./test/edu/ucsb/nceas/metacattest" />
339
		<property name="junitnettestsdir"
340
			value="./test/edu/ucsb/nceas/metacatnettest" />
341
		<property name="classtorun" value="edu.ucsb.nceas.metacat.admin.upgrade.dataone.GenerateSystemMetadata" />
342
		<property name="build.dir" value="./build" />
343
		<property name="build.src" value="${build.dir}/src" />
344
		<property name="build.dest" value="${build.dir}/classes" />
345
		<property name="build.samples" value="${build.dir}/samples" />
346
		<property name="build.tests" value="${build.dir}/tests" />
347
		<property name="build.tmp" value="${build.dir}/tmp" />
348
		<property name="build.metacattest"
349
			value="${build.tests}/metacattest" />
350
		<property name="build.metacatnettest"
351
			value="${build.tests}/metacatnettest" />
352
		<property name="build.data" value="${build.dir}/data" />
353
		<property name="build.docs" value="${build.dir}/docs" />
354
		<property name="build.javadocs" value="${build.docs}/api" />
355
		<property name="build.war" value="${build.dir}/war" />
356
		<property name="dist.dir" value="dist" />
357
		<property name="ver.dir" value="${dist.dir}/${name}-${release}" />
358
		<property name="ver.src" value="${ver.dir}/src" />
359
		<property name="util.dir" value="${dist.dir}/${util-module}" />
360
		<property name="test.dir" value="${dist.dir}/test" />
361
		<!-- directories for creating a Harvest List Editor distribution -->
362
		<property name="dist.dir.hle" value="disthle" />
363
		<property name="ver.dir.hle"
364
			value="${dist.dir.hle}/harvest-list-editor-${release}" />
365
		<property name="pkg.dir" value="./package" />
366
		<property name="deb.pkg.dir" value="${pkg.dir}/debian" />
367

    
368
		<property name="ecogrid-target-name" value="metacatImpl" />
369
		<property name="ecogrid-module-dest-dir" value=".." />
370
		<property name="ecogrid-module" value="seek/projects/ecogrid" />
371
		<property name="ecogrid-dist-dir"
372
			value="${dist.dir}/${ecogrid-module}" />
373
		<property name="ecogrid-dir"
374
			value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
375

    
376
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
377

    
378
		<!-- set up svn -->
379
		<property name="svnant.lib" value="lib" />
380
		<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
381
		<property name="svnClientAdapter.jar"
382
			value="${svnant.lib}/svnClientAdapter.jar" />
383
		<property name="svnjavahl.jar"
384
			value="${svnant.lib}/svnjavahl.jar" />
385
		<property name="svn.utilitiesUrl"
386
			value="https://code.ecoinformatics.org/code/utilities/${utilities-tag}" />
387
		<property name="svn.ecogridUrl"
388
			value="https://code.ecoinformatics.org/code/seek/${seek-tag}/projects/ecogrid/" />
389
		<property name="svn.emlBetaUrl"
390
			value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
391
		<property name="svn.emlBeta4Url"
392
					value="https://code.ecoinformatics.org/code/eml/tags/${eml-beta4-tag}" />
393
		<property name="svn.eml200SchemaUrl"
394
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
395
		<property name="svn.eml201SchemaUrl"
396
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
397
		<property name="svn.eml210SchemaUrl"
398
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
399
		<property name="svn.eml211SchemaUrl"
400
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_1-schema-tag}" />
401
		<property name="svn.eml2StyleUrl"
402
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2-style-tag}" />
403
		
404
		<!-- the git repo -->
405
		<property name="metacatui.git.repository.url"
406
					value="https://github.com/NCEAS/metacatui.git" />
407
		<property name="metacatui.build.dir"
408
					value="metacatui_build" />
409
		<property name="metacatui.resources.dir"
410
					value="${metacatui.build.dir}/metacatui/src/main/webapp" />
411
		
412
		<!-- load the svn task -->
413
		<path id="svn.classpath">
414
			<pathelement location="${svnjavahl.jar}" />
415
			<pathelement location="${svnant.jar}" />
416
			<pathelement location="${svnClientAdapter.jar}" />
417
		</path>
418
		<taskdef resource="svntask.properties"
419
			classpathref="svn.classpath" />
420

    
421
		<condition property="utilities.required">
422
			<not>
423
				<available file="lib/utilities.jar" />
424
			</not>				
425
		</condition>
426
		<!-- peer.utilities.required is used when there is no utilities 
427
			directory at ${utilitiesdir} -->
428
		<condition property="peer.utilities.required">
429
			<or>
430
				<not>
431
					<available file="${utilitiesdir}" type="dir" />
432
				</not>
433
			</or>
434
		</condition>
435
		<condition property="eml.required">
436
			<or>
437
				<not>
438
					<available file="lib/schema/eml-2.0.1/eml.xsd" />
439
				</not>
440
				<not>
441
					<available file="lib/schema/eml-2.0.0/eml.xsd" />
442
				</not>
443
				<not>
444
					<available file="lib/schema/eml-2.1.0/eml.xsd" />
445
				</not>
446
				<not>
447
					<available
448
						file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
449
				</not>
450
			</or>
451
		</condition>
452

    
453
		<condition property="ecogrid.required">
454
			<or>
455
				<not>
456
					<available file="${ecogrid-dir}/build.properties" />
457
				</not>
458
				<not>
459
					<available
460
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
461
				</not>
462
			</or>
463
		</condition>
464
		
465
		<property name="init.called" value="true" />
466

    
467
	</target>
468
	
469
	<target name="resolveDependencies" depends="init" description="retrieve dependencies with maven">
470
			<echo>Moving Maven dependencies (${dependency.fileset}) to ${libdir.mvn} </echo>
471
			<!-- Clear out mvn dir -->
472
			<delete dir="${libdir.mvn}"></delete>
473
			<!-- Copy all dependencies to the correct location. -->
474
			<copy todir="${libdir.mvn}">
475
				<fileset refid="dependency.fileset" />
476
				<!-- This mapper strips off all leading directory information -->
477
				<mapper type="flatten" />
478
			</copy>
479
		</target>
480

    
481
	<target name="prepare" depends="init, resolveDependencies">
482
		<mkdir dir="${build.dir}" />
483
		<mkdir dir="${build.src}" />
484
		<mkdir dir="${build.dest}" />
485
		<mkdir dir="${build.docs}" />
486
		<mkdir dir="${build.javadocs}" />
487
		<mkdir dir="${build.tmp}" />
488

    
489
		<copy todir="${build.src}" filtering="yes">
490
			<fileset dir="${srcdir}">
491
				<include name="edu/**" />
492
				<include name="com/**" />
493
				<include name="org/**" />
494
				<!-- include name="java/**" / -->
495
				<include name="**/*.sql" />
496
				<exclude name="**/CVS*" />
497
				<exclude name="**/.#*" />
498
				<exclude name="edu/ucsb/nceas/workflowscheduler/**" />
499
			</fileset>
500
		</copy>
501
		<available file="lib/style/common/emlb6toeml2" type="dir"
502
			property="styles.not.needed" />
503
	</target>
504

    
505
	<target name="generateStubs" depends="prepare">
506
		<echo
507
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
508
		<axis-wsdl2java verbose="true" output="${srcdir}"
509
			url="/tmp/KeplerWebService.wsdl" />
510
	</target>
511

    
512
	<target name="compile" depends="prepare, utilities"
513
		description="Compiles java code to build dir, and copies metacat props files there">
514

    
515
		<javac srcdir="${build.src}" destdir="${build.dest}"
516
			debug="${debug}"
517
			excludes="**/*.sql **/client/*.java **/harvesterClient/*.java">
518
			<classpath>
519
				<path refid="compile.classpath" />
520
			</classpath>
521
		</javac>
522
	</target>
523

    
524
	<target name="jar" depends="compile,geteml"
525
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
526

    
527
		<delete file="${build.dir}/${name}.jar" />
528
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
529
			excludes="**/protocols/ **/harvesterClient/" />
530
	</target>
531

    
532
	<target name="protocol" depends="compile"
533
		description="Compiles and jars protocol java code to protocol.jar in build dir">
534
		<delete file="${build.dir}/protocol.jar" />
535
		<jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
536
			includes="**/protocols/" />
537
	</target>
538

    
539
	<target name="utilities" depends="config,getpeerutilities"
540
		if="utilities.required">
541
		<ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
542
		<ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
543
		<copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
544
	</target>
545

    
546
	<target name="getpeerutilities" depends="prepare"
547
		if="peer.utilities.required"
548
		description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
549
		<echo message="Exporting utilities files from svn repository:" />
550
		<svn>
551
			<export srcUrl="${svn.utilitiesUrl}"
552
				destPath="${utilitiesdir}" />
553
		</svn>
554

    
555
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
556
	</target>
557
	
558
	<target name="getutilities" depends="prepare"
559
		description="Checks utility out of svn and copies it to your metacat sandbox">
560
		<svn>
561
			<export srcUrl="${svn.utilitiesUrl}"
562
				destPath="${utilitiesdir}" force="true" />
563
		</svn>
564
	</target>
565

    
566
	<target name="client" depends="utilities, prepare"
567
		description="Compiles metacat-client java code to build dir">
568
		<javac srcdir="${build.src}" destdir="${build.dest}"
569
			includes="edu/ucsb/nceas/metacat/client/*">
570
			<classpath>
571
				<path refid="compile.classpath" />
572
			</classpath>
573
		</javac>
574
	</target>
575

    
576
	<target name="clientjar" depends="client"
577
		description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
578
		<delete file="${build.dir}/${name}-client.jar" />
579
		<jar jarfile="${build.dir}/${name}-client.jar"
580
			basedir="${build.dest}" includes="**/metacat/client/" />
581
	</target>
582

    
583
	<target name="advancedsearchjar" depends="compile"
584
		description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
585
		<delete file="${build.dir}/advancedsearch.jar" />
586
		<jar jarfile="${build.dir}/advancedsearch.jar"
587
			basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
588
	</target>
589

    
590
	<target name="harvester" depends="client"
591
		description="Compiles harvester java code to build dir">
592
		<javac srcdir="${build.src}" destdir="${build.dest}"
593
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
594
			<classpath>
595
				<path refid="compile.classpath" />
596
			</classpath>
597
		</javac>
598
	</target>
599
		
600
	<target name="harvesterjar" depends="harvester"
601
		description="Compiles and jars harvester java code to harvester.jar in build dir">
602
		<delete file="${build.dir}/harvester.jar" />
603
		<jar jarfile="${build.dir}/harvester.jar"
604
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
605
	</target>
606

    
607
	<target name="harvestListEditorDist" depends="harvesterjar"
608
		description="Prepares a distribution of the Harvest List Editor tool">
609
		<mkdir dir="${dist.dir.hle}" />
610
		<delete dir="${ver.dir.hle}" />
611
		<mkdir dir="${ver.dir.hle}" />
612
		<copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
613
		<copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
614
		<copy todir="${ver.dir.hle}"
615
			file="lib/harvester/harvestList.xsd" />
616
		<copy todir="${ver.dir.hle}"
617
			file="lib/harvester/harvestListEditor.bat" />
618
		<copy todir="${ver.dir.hle}"
619
			file="lib/harvester/harvestListEditor.sh" />
620
		<delete file="./harvest-list-editor-${release}.zip" />
621
		<zip zipfile="./harvest-list-editor-${release}.zip"
622
			basedir="${ver.dir.hle}" />
623
		<delete file="./harvest-list-editor-${release}.tar.gz" />
624
		<tar tarfile="./harvest-list-editor-${release}.tar"
625
			basedir="${ver.dir.hle}" />
626
		<gzip zipfile="./harvest-list-editor-${release}.tar.gz"
627
			src="./harvest-list-editor-${release}.tar" />
628
		<delete file="./harvest-list-editor-${release}.tar" />
629
	</target>
630

    
631
	<target name="geteml" depends="getemlpre2,getemlpre2beta4,geteml2+,getConversionXSL"
632
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
633

    
634
	<target name="getemlpre2" depends="prepare" if="eml.required"
635
		description="Checks EML-beta6 out of svn and copies dtds and xsl to your metacat sandbox">
636
		<svn>
637
			<export srcUrl="${svn.emlBetaUrl}"
638
				destPath="${build.tmp}/eml_${eml-beta-tag}" />
639
		</svn>
640
		<mkdir dir="lib/dtd" />
641
		<copy todir="lib/dtd" filtering="yes">
642
			<fileset
643
				dir="${build.tmp}/eml_${eml-beta-tag}">
644
				<include name="*.dtd" />
645
			</fileset>
646
			<mapper type="glob" from="eml-*.dtd"
647
				to="eml-*-${eml-version}.dtd" />
648
		</copy>
649

    
650
		<copy todir="${style-common-cvsrelpath}" filtering="yes">
651
			<fileset
652
				dir="${build.tmp}/eml_${eml-beta-tag}/style">
653
				<include name="**/*.xsl" />
654
			</fileset>
655
		</copy>
656
	</target>
657
	
658
	<target name="getemlpre2beta4" depends="prepare" if="eml.required"
659
			description="Checks EML-beta4 out of svn and copies dtds to your metacat sandbox">
660
			<svn>
661
				<export srcUrl="${svn.emlBeta4Url}"
662
					destPath="${build.tmp}/eml_${eml-beta4-tag}" />
663
			</svn>
664
			<mkdir dir="lib/dtd" />
665
			<copy todir="lib/dtd" filtering="yes">
666
				<fileset
667
					dir="${build.tmp}/eml_${eml-beta4-tag}">
668
					<include name="*.dtd" />
669
				</fileset>
670
				<mapper type="glob" from="eml-*.dtd"
671
					to="eml-*-${eml-beta4-version}.dtd" />
672
			</copy>
673

    
674
			<!--
675
			<copy todir="${style-common-cvsrelpath}" filtering="yes">
676
				<fileset
677
					dir="${build.tmp}/eml_${eml-beta4-tag}/style">
678
					<include name="**/*.xsl" />
679
				</fileset>
680
			</copy>
681
			-->
682
		</target>
683

    
684
	<target name="geteml2+" depends="prepare" if="eml.required"
685
		description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
686
		<svn>
687
			<export srcUrl="${svn.eml200SchemaUrl}"
688
				destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
689
		</svn>
690
		<mkdir dir="lib/schema/eml-2.0.0" />
691
		<copy todir="lib/schema/eml-2.0.0" filtering="yes">
692
			<fileset
693
				dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
694
				<include name="*.xsd" />
695
			</fileset>
696

    
697
			<!-- shouldn't we have a mapper here like this??
698
				<mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
699
				
700
				Jing's code didn't nave one - does it need to be added?
701
				NOTE that eml-version is set to beta 6, so this would need changing -->
702

    
703
		</copy>
704
		<!-- <antcall target="copyxsl">
705
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
706
			<param name="dirname" value="eml-2.0.0" />
707
			</antcall> -->
708

    
709
		<!-- Checkout eml201 for given schema tag-->
710
		<svn>
711
			<export srcUrl="${svn.eml201SchemaUrl}"
712
				destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
713
		</svn>
714
		<mkdir dir="lib/schema/eml-2.0.1" />
715
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
716
			<fileset
717
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
718
				<include name="*.xsd" />
719
			</fileset>
720
		</copy>
721

    
722
		<!-- Checkout eml201 again for given style sheet tag-->
723
		<!-- echo>Enter CVS password: </echo>
724
			<cvs cvsRoot="${cvsroot}"
725
			package="${eml-module}"
726
			tag="${eml2_0_1-style-tag}"
727
			dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
728
			<antcall target="copyxsl">
729
			<param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
730
			<param name="dirname" value="eml-2.0.1" />
731
			</antcall -->
732

    
733
		<!-- Checkout eml210 for given schema tag-->
734
		<svn>
735
			<export srcUrl="${svn.eml210SchemaUrl}"
736
				destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
737
		</svn>
738
		<mkdir dir="lib/schema/eml-2.1.0" />
739
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
740
			<fileset
741
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
742
				<include name="*.xsd" />
743
			</fileset>
744
		</copy>
745

    
746
		<!-- Checkout eml210 for given style sheet tag-->
747
		<svn>
748
			<export srcUrl="${svn.eml2StyleUrl}"
749
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
750
		</svn>
751
		<antcall target="copyxsl">
752
			<param name="cvs.tagname" value="${eml2-style-tag}" />
753
			<!-- param name="dirname" value="eml-2.1.0" / -->
754
			<param name="dirname" value="eml-2" />
755
		</antcall>
756
		
757
		<!-- Checkout eml210 for given schema tag-->
758
		<svn>
759
			<export srcUrl="${svn.eml211SchemaUrl}"
760
				destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
761
		</svn>
762
		<mkdir dir="lib/schema/eml-2.1.1" />
763
		<copy todir="lib/schema/eml-2.1.1" filtering="yes">
764
			<fileset
765
				dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
766
				<include name="*.xsd" />
767
			</fileset>
768
		</copy>
769
	</target>
770

    
771
	<target name="copyxsl"
772
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
773

    
774
		<delete file="${style-common-cvsrelpath}/${eml-css}" />
775

    
776
		<copy todir="${style-common-cvsrelpath}/${dirname}"
777
			filtering="yes">
778
			<fileset
779
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
780
				<include name="**/*.xsl" />
781
			</fileset>
782
		</copy>
783

    
784

    
785
		<!-- now copy default css from eml module and put it in style-common-path
786
			dir with a new name, so other skin-specific css can import it if reqd -->
787
		<copy
788
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
789
			tofile="${style-common-cvsrelpath}/${eml-css}" />
790

    
791
	</target>
792

    
793
	<target name="correctEML201Docs" depends="jar"
794
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
795
		<copy todir="${build.dir}" file="lib/metacat.properties"
796
			filtering="yes" />
797
		<java
798
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
799
			<classpath>
800
				<path refid="compile.classpath" />
801
				<fileset dir="${build.dir}">
802
					<include name="${name}.jar" />
803
				</fileset>
804
			</classpath>
805
		</java>
806
	</target>
807

    
808
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
809
		description="Installs spatial option for metacat">
810
		
811
		<copy todir="${dist.dir}">
812
			<fileset dir="./lib/spatial/geoserver" includes="*.war" />
813
		</copy>
814

    
815
	</target>
816

    
817
	<target name="install" depends="build-metacat"
818
		description="* Full Install For Development *">
819
		<copy file="${dist.dir}/${metacat.context}.war"
820
			todir="${app.deploy.dir}" />
821
               <!-- <copy file="${dist.dir}/${metacat.context}.war"
822
                        todir="${app.deploy.dir2}" />-->
823
		<delete dir="${app.deploy.dir}/${metacat.context}" />
824
		<!--<delete dir="${app.deploy.dir2}/${metacat.context}" />-->
825
		<copy file="${dist.dir}/geoserver.war"
826
					todir="${app.deploy.dir}" />
827
		<copy file="${dist.dir}/metacat-index.war"
828
					todir="${app.deploy.dir}" />
829
		<tstamp>
830
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
831
		</tstamp>
832
		<echo>Dev install completed at ${NOW}</echo>
833
	</target>
834

    
835
	<target name="build-metacat" depends="install-ecogrid, install-spatial, dist-metacat-index, dist-metacat-ui"
836
		description="Build Metacat">
837
	</target>
838

    
839
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
840
		if="enable.ecogrid" description="Install Ecogrid Compentent">
841
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
842
			inheritall="false">
843
			<property name="context" value="${metacat.context}" />
844
			<property name="target" value="${ecogrid-target-name}" />
845
		</ant>
846
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
847
			inheritall="false">
848
			<property name="context" value="${metacat.context}" />
849
			<property name="target" value="${ecogrid-target-name}" />
850
			<property name="metacat.dir" value="${basedir}"/>
851
		</ant>
852
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
853
			<webinf dir="${ecogrid-dir}/lib">
854
			<include name="server-config.wsdd"/>
855
			</webinf>
856
			</war -->
857
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
858
			todir="${dist.dir}" overwrite="true" />
859

    
860

    
861
	</target>
862

    
863
	<target name="get-ecogrid" depends="init"
864
		description="Check out ecogrid module" if="ecogrid.required">
865
		<svn>
866
			<export srcUrl="${svn.ecogridUrl}" force="true"
867
				destPath="${ecogrid-dir}" />
868
		</svn>
869
	</target>
870

    
871
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
872
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
873
		<property name="context" value="${metacat.context}"/>
874
		<property name="target" value="${ecogrid-target-name}"/>
875
		<property name="metacat.dir" value="."/>
876
		<property name="hostname" value="${ecogrid.hostname}"/>
877
		<property name="port" value="${config.port}"/>
878
		</ant>
879
		</target -->
880

    
881
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
882
		description="Automately generate wsdd for ecogrid service">
883
		<delete
884
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
885
	</target>
886

    
887
	<target name="install-skin" depends="init"
888
		description="Install a Skin">
889

    
890
		<input message="Please enter name of the skin"
891
			addproperty="skin-name" />
892

    
893
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
894
		<copy todir="${installdir}/style/skins/${skin-name}"
895
			filtering="yes">
896
			<fileset dir="lib/style/skins/${skin-name}">
897
				<exclude name="**/*.png" />
898
				<exclude name="**/*.gif" />
899
				<exclude name="**/*.jpg" />
900
				<exclude name="**/CVS*" />
901
				<exclude name="**/.#*" />
902
			</fileset>
903
		</copy>
904
		<copy todir="${installdir}/style/skins/${skin-name}"
905
			filtering="no">
906
			<fileset dir="lib/style/skins/${skin-name}">
907
				<include name="**/*.png" />
908
				<include name="**/*.gif" />
909
				<include name="**/*.jpg" />
910
				<exclude name="**/CVS*" />
911
				<exclude name="**/.#*" />
912
			</fileset>
913
		</copy>
914
		<copy todir="${installdir}/style/common" filtering="yes">
915
			<fileset dir="lib/style/common">
916
				<include name="*.js" />
917
				<include name="*.jsp" />
918
				<include name="*.css" />
919
				<exclude name="*.png" />
920
				<exclude name="*.gif" />
921
				<exclude name="*.jpg" />
922
				<exclude name="**/CVS*" />
923
				<exclude name="**/.#*" />
924
			</fileset>
925
		</copy>
926
		<!--
927
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
928
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
929
			<fileset dir="lib/style/skins/${skin-name}/images">
930
			<include name="*.png"/>
931
			<include name="*.gif"/>
932
			<include name="*.jpg"/>
933
			</fileset>
934
			</copy>
935
		-->
936

    
937
		<echo message="Install Skin completed." />
938
	</target>
939

    
940
	<target name="war" depends="warPrepare,install-spatial"
941
		description="Create a web archive (WAR) for servlet deployment">
942
		<mkdir dir="${dist.dir}" />
943
		<war destfile="${dist.dir}/${metacat.context}.war"
944
			webxml="${build.war}/web.xml">
945
			<fileset dir="${war.context}" />
946
			<lib dir="${war.lib}" />
947
			<webinf dir="${war.webinf}" />
948
		</war>
949
	</target>
950

    
951
	<target name="warPrepare"
952
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare,documentation"
953
		description="Prepare files for creating a web archive (WAR)">
954

    
955
		<property name="war.lib" value="${build.war}/lib" />
956
		<property name="war.webinf" value="${build.war}/WEB-INF" />
957
		<property name="war.context"
958
			value="${build.war}/${metacat.context}" />
959
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
960
		<property name="war.webinf.scripts"
961
			value="${war.webinf}/scripts" />
962
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
963
		<property name="war.context.docs" value="${war.context}/docs" />
964
		<property name="war.context.temp" value="${war.context}/temp" />
965
		<property name="war.context.templates"
966
			value="${war.context}${style-common-relpath}/templates" />
967
		<mkdir dir="${war.lib}" />
968
		<mkdir dir="${war.webinf}" />
969
		<mkdir dir="${war.context}" />
970
		<mkdir dir="${war.webinf.sql}" />
971
		<mkdir dir="${war.context.cgi}" />
972
		<mkdir dir="${war.context.docs}" />
973
		<mkdir dir="${war.context.temp}" />
974
		<mkdir dir="${war.context.templates}" />
975

    
976
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
977
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
978
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
979
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
980
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
981
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
982
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
983
		<copy todir="${war.lib}" filtering="no">
984
			<fileset dir="lib">
985
				<include name="*.jar" />
986
				<exclude name="maven-ant-tasks*.jar" />
987
			</fileset>
988
			<fileset dir="${libdir.mvn}" />			
989
		</copy>
990
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
991
			tofile="${build.war}/web.xml" / -->
992
		<!-- MCD added next - Remove the tomcat5 reference-->
993
		<copy file="lib/web.xml.tomcat6" tofile="${build.war}/web.xml" />
994
		<copy file="lib/metacat.properties" todir="${war.webinf}"
995
			filtering="yes" />
996
		<copy file="lib/solrQueryFieldDescriptions.properties" todir="${war.webinf}"/>
997
		<copy file="lib/metacat.properties.metadata.xml"
998
			todir="${war.webinf}" filtering="no" />
999
		<copy file="lib/org.properties.metadata.xml"
1000
			todir="${war.webinf}" filtering="no" />
1001
		<copy file="lib/auth.properties.metadata.xml"
1002
			todir="${war.webinf}" filtering="no" />
1003
		<copy todir="${war.webinf}" filtering="yes">
1004
			<fileset dir="lib">
1005
				<include name="skin.configs/**" />
1006
			</fileset>
1007
		</copy>
1008
		<copy file="lib/log4j.properties" todir="${war.webinf}"
1009
			filtering="yes" />
1010
		<copy file="lib/hazelcast.xml" todir="${war.webinf}"
1011
			filtering="yes" />
1012
		<copy file="lib/oa4mp_client.xml" todir="${war.webinf}"
1013
			filtering="yes" />
1014
		<copy todir="${war.context}" filtering="no">
1015
			<fileset dir="lib">
1016
				<include name="**/*.jpg" />
1017
				<include name="**/*.png" />
1018
				<include name="**/*.gif" />
1019
				<include name="LiveMap_30/**" />
1020
				<include name="oaipmh/**" />
1021
			</fileset>
1022
		</copy>
1023
		<copy todir="${war.context}" filtering="yes">
1024
			<fileset dir="lib">
1025
				<exclude name="*.jar" />
1026
				<exclude name="*.properties" />
1027
				<exclude name="*.metadata.xml" />
1028
				<exclude name="web.xml" />
1029
				<exclude name="**/*.jpg" />
1030
				<exclude name="**/*.png" />
1031
				<exclude name="**/*.gif" />
1032
				<exclude name="lsid_lib/**" />
1033
				<exclude name="lsid_conf/**" />
1034
				<exclude name="LiveMap_30/**" />
1035
				<exclude name="oaipmh/**" />
1036
				<exclude name="maven/**" />
1037
				<exclude name="skin.configs/**" />
1038
				<exclude name="spatial/geoserver/**" />
1039
			</fileset>
1040
		</copy>
1041
		<copy todir="${war.context}" filtering="no">
1042
			<fileset dir="lib">
1043
				<include name="spatial/geoserver/data/**" />
1044
			</fileset>
1045
		</copy>
1046
		<copy todir="${war.context.docs}" filtering="no">
1047
			<fileset dir="${build.docs}" />
1048
		</copy>
1049
		<copy todir="${war.webinf.sql}" filtering="yes">
1050
			<fileset dir="src">
1051
				<include name="**/*.sql" />
1052
			</fileset>
1053
		</copy>
1054
		<copy todir="${war.webinf.scripts}" filtering="yes">
1055
			<fileset dir="src/scripts" />
1056
		</copy>
1057
		<copy todir="${war.webinf.scripts}"
1058
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
1059
			failonerror="false" />
1060

    
1061
		<copy file="src/perl/register-dataset.cgi"
1062
			todir="${war.context.cgi}" />
1063
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1064
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1065

    
1066
		<!-- registry cgi section -->
1067
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
1068
			used in readDocumentFromMetacat -->
1069
		<!-- TODO MCD copy temp files to actual location using config util?? -->
1070
		<copy todir="${war.context.temp}" filtering="yes">
1071
			<fileset dir="lib/style/common/emlb6toeml2">
1072
				<include name="*.xsl" />
1073
				<include name="*.xml" />
1074
			</fileset>
1075
		</copy>
1076
		<available file="lib/style/common/emlb6toeml2" type="dir"
1077
			property="styles.not.needed" />
1078

    
1079
		<!-- ldap cgi section -->
1080
		<copy todir="${war.context.templates}">
1081
			<fileset dir="lib/style/common/templates">
1082
				<!-- SCW: Copy all files -->
1083
			</fileset>
1084
		</copy>
1085
	</target>
1086

    
1087
	<target name="cgiPrepare" if="build.perl">
1088
		<exec dir="src/perl/Metacat/" executable="make">
1089
			<arg value="clean" />
1090
		</exec>
1091
		<exec dir="src/perl/Metacat/" executable="perl">
1092
			<arg value="Makefile.PL" />
1093
		</exec>
1094
		<exec dir="src/perl/Metacat/" executable="make" />
1095
	</target>
1096

    
1097
	<target name="testPrepare"
1098
		description="Copies test files into the war directories">
1099
		<echo>in testPrepare</echo>
1100
		<property name="war.context.test"
1101
			value="${build.war}/${metacat.context}/test" />
1102
		<mkdir dir="${war.context.test}" />
1103
		<copy todir="${war.context.test}" filtering="yes">
1104
			<fileset dir="test/servertestfiles">
1105
				<include name="*/**" />
1106
			</fileset>
1107
		</copy>
1108
	</target>
1109

    
1110
	<target name="getConversionXSL" depends="prepare"
1111
		unless="styles.not.needed"
1112
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1113

    
1114
		<svn>
1115
			<export srcUrl="${svn.eml2StyleUrl}"
1116
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1117
		</svn>
1118

    
1119
		<mkdir dir="lib/style/common/emlb6toeml2" />
1120
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1121
			<fileset
1122
				dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1123
				<include name="*.xsl" />
1124
				<include name="*.xml" />
1125
			</fileset>
1126
		</copy>
1127
	</target>
1128

    
1129
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1130
		<mkdir dir="${build.tests}" />
1131
		<copy todir="${build.tests}" encoding="UTF-8">
1132
			<fileset dir="${testdir}">
1133
				<include name="edu/**" />
1134
			</fileset>
1135
		</copy>
1136
		<copy todir="${build.tests}" file="${testdir}/test.properties" />
1137

    
1138
		<path id="test.classpath">
1139
			<path refid="compile.classpath" />
1140
			<fileset dir="${build.dir}">
1141
				<include name="${name}.jar" />
1142
				<include name="${name}-client.jar" />
1143
				<include name="harvester.jar" />
1144
			</fileset>
1145
		</path>
1146
		
1147
		<pathconvert pathsep="${line.separator}|  |--" 
1148
		             property="echo.test.classpath"
1149
		             refid="test.classpath">
1150
		</pathconvert>
1151
		<echo message="|--test classpath" />
1152
		<echo message="|  |" />
1153
		<echo message="|  |-- ${echo.test.classpath}" />
1154
		
1155
		<!-- copy and compile the tests into a jar file -->
1156
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1157
			debug="on" includes="**/*.java" encoding="UTF-8">
1158
			<classpath refid="test.classpath" />
1159
		</javac>
1160

    
1161
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1162
			basedir="${build.tests}" >
1163
			<include name="**/*.class"/>
1164
			<include name="**/*.xml"/>
1165
		</jar>	
1166
		
1167
	</target>
1168

    
1169
	<target name="runoneclass" depends="testprep"
1170
		description="Uses the ant to run a class">
1171
		
1172
		<java classname="${classtorun}" fork="true">
1173
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1174
			<classpath>
1175
				<path refid="test.classpath" />
1176
				<fileset dir="${build.dir}">
1177
					<include name="${name}.jar" />
1178
					<include name="${name}-client.jar" />
1179
					<include name="harvester.jar" />
1180
					<include name="${name}-junittests.jar" />
1181
				</fileset>
1182
			</classpath>
1183
		</java>
1184
	</target>
1185
	
1186
	<target name="test" depends="testprep"
1187
		description="Uses the ant junit task to run all JUnit tests">
1188

    
1189
		<!-- use the ant "junit" task to run JUnit tests. -->
1190
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1191
			haltonerror="no">
1192
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1193
			<classpath>
1194
				<path refid="test.classpath" />
1195
				<fileset dir="${build.dir}">
1196
					<include name="${name}.jar" />
1197
					<include name="${name}-client.jar" />
1198
					<include name="harvester.jar" />
1199
					<include name="${name}-junittests.jar" />
1200
				</fileset>
1201
			</classpath>
1202

    
1203
			<formatter type="plain" />
1204

    
1205
			<batchtest fork="yes" todir="${build.dir}">
1206
				<fileset dir="${build.tests}">
1207
					<include name="**/*.class" />
1208
					<exclude name="**/MCTestCase.class" />
1209
					<exclude name="**/ClientViewHelperTest.class" />
1210
					<!-- these are not test cases -->
1211
					<exclude name="**/MockCNode.class" />
1212
					<exclude name="**/D1NodeServiceTest.class" />
1213
					<exclude name="**/QueryRunner.class" />
1214
					<exclude name="**/MockObjectPathMap.class" />
1215
					<exclude name="**/HzObjectPathMapTest$1.class" />
1216
					<exclude name="**/HzObjectPathMapTest$2.class" />
1217
				</fileset>
1218
			</batchtest>
1219
		</junit>
1220
	</target>
1221

    
1222
	<target name="runonetest" depends="testprep"
1223
		description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1224

    
1225
		<echo>testtorun: ${testtorun}</echo>
1226

    
1227
		<!-- use the ant "junit" task to run JUnit tests. -->
1228
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1229
			haltonerror="no" showoutput="yes">
1230
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1231
			<classpath>
1232
				<path refid="test.classpath" />
1233
				<fileset dir="${build.dir}">
1234
					<include name="${name}.jar" />
1235
					<include name="${name}-client.jar" />
1236
					<include name="harvester.jar" />
1237
					<include name="${name}-junittests.jar" />
1238
				</fileset>
1239
			</classpath>
1240

    
1241
			<formatter type="plain" />
1242

    
1243
			<batchtest fork="yes" todir="${build.dir}">
1244
				<fileset dir="${build.tests}">
1245
					<include name="**/${testtorun}.class" />
1246
				</fileset>
1247
			</batchtest>
1248
		</junit>
1249
	</target>
1250
	
1251
	<target name="run" depends="testprep"
1252
			description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1253

    
1254
			<echo>testtorun: ${testtorun}</echo>
1255

    
1256
			<!-- use the ant "junit" task to run JUnit tests. -->
1257
			<junit printsummary="yes" haltonfailure="no" fork="yes"
1258
				haltonerror="no" showoutput="yes">
1259
				<jvmarg value="-Dfile.encoding=UTF-8"/>
1260
				<classpath>
1261
					<path refid="test.classpath" />
1262
					<fileset dir="${build.dir}">
1263
						<include name="${name}.jar" />
1264
						<include name="${name}-client.jar" />
1265
						<include name="harvester.jar" />
1266
						<include name="${name}-junittests.jar" />
1267
					</fileset>
1268
				</classpath>
1269

    
1270
				<formatter type="plain" />
1271

    
1272
				<batchtest fork="yes" todir="${build.dir}">
1273
					<fileset dir="${build.tests}">
1274
						<include name="**/${testtorun}.class" />
1275
					</fileset>
1276
				</batchtest>
1277
			</junit>
1278
		</target>
1279

    
1280
	<target name="testharvester" depends="testprep"
1281
		description="Uses the ant junit task to test only the Harvester code">
1282
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1283
			haltonerror="off">
1284
			<classpath>
1285
				<path refid="compile.classpath" />
1286
				<fileset dir="${build.dir}">
1287
					<include name="${name}.jar" />
1288
					<include name="${name}-client.jar" />
1289
					<include name="harvester.jar" />
1290
					<include name="${name}-junittests.jar" />
1291
				</fileset>
1292
			</classpath>
1293
			<formatter type="plain" />
1294
			<batchtest fork="yes" todir="${build.dir}">
1295
				<fileset dir="${build.tests}">
1296
					<include name="**/harvesterClient/*.class" />
1297
				</fileset>
1298
			</batchtest>
1299
		</junit>
1300
	</target>
1301

    
1302
	<!-- run this target, we need to check out a another morpho souce dir was checked out. -->
1303
	<target name="nettest" depends="install"
1304
		description="compiles and runs the metacatnettest code">
1305

    
1306
		<echo>
1307
			*********************************** Please run ant
1308
			gethttpclient first! ***********************************
1309
		</echo>
1310
		<!-- copy and compile the tests into a jar file -->
1311
		<mkdir dir="${build.metacatnettest}" />
1312
		<javac srcdir="${junitnettestsdir}"
1313
			destdir="${build.metacatnettest}" includes="**/*.java">
1314
			<classpath>
1315
				<path refid="compile.classpath" />
1316
				<fileset dir="${build.dir}">
1317
					<include name="${name}.jar" />
1318
				</fileset>
1319
			</classpath>
1320
		</javac>
1321

    
1322
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1323
			basedir="${build.metacatnettest}" includes="**/*.class" />
1324

    
1325
		<!-- use the ant "junit" task to run JUnit tests. -->
1326
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1327
			haltonerror="no">
1328
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1329
			<classpath>
1330
				<path refid="compile.classpath" />
1331
				<fileset dir="${build.dir}">
1332
					<include name="${name}.jar" />
1333
					<include name="${name}-junitnettests.jar" />
1334
				</fileset>
1335
			</classpath>
1336

    
1337
			<formatter type="plain" />
1338

    
1339
			<batchtest fork="yes" todir="${build.dir}">
1340
				<fileset dir="${build.metacatnettest}">
1341
					<include name="**/*.class" />
1342
				</fileset>
1343
			</batchtest>
1344
		</junit>
1345
	</target>
1346

    
1347
	<target name="cleanweb" depends="clean"
1348
		description="deletes tomcat web context dir and all its contents">
1349
		<delete dir="${installdir}" />
1350
	</target>
1351

    
1352

    
1353
	<target name="clean" depends="init"
1354
		description="deletes build dir and files that can be regenerated form the release">
1355
		<delete dir="${build.dir}" />
1356
		<delete dir="${dist.dir}" />
1357
	</target>
1358

    
1359
	<target name="localclean" depends="clean"
1360
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1361
		<delete file="lib/utilities.jar" />
1362
	</target>
1363

    
1364
	<target name="fullclean" depends="localclean"
1365
		description="deletes code and eml">
1366
		<delete includeEmptyDirs="true" failonerror="false">
1367
			<fileset dir="${style-common-cvsrelpath}">
1368
				<include name="${eml-css}" />
1369
				<include name="eml-*/*.xsl" />
1370
				<include name="eml-*" />
1371
			</fileset>
1372
			<fileset dir="${schema-cvsrelpath}">
1373
				<include name="eml-*/*.xsd" />
1374
			</fileset>
1375
			<fileset dir="${ecogrid-dir}"/>
1376
			<fileset dir="lib/style/common/emlb6toeml2"/>
1377
			<fileset dir="lib/dtd"/>
1378
			<fileset dir="lib/schema"/>
1379
			<fileset dir="${utilitiesdir}"/>
1380
			<fileset dir="${metacatui.build.dir}"/>
1381
			<fileset dir="${libdir.mvn}"/>
1382
		</delete>
1383
		<!-- clean up the distribution files if they exist-->
1384
		<delete file="./${name}-bin-${release}.tar.gz" />
1385
		<delete file="./${name}-src-${release}.tar.gz" />
1386
		<delete file="./${name}-bin-${release}.zip" />
1387
		<delete file="./${name}-src-${release}.zip" />
1388
	</target>
1389
	
1390
	<target name="documentation" depends="javadoc,admindoc"
1391
	    description="generates Javadoc API documentation and Admin Guide">
1392
    </target>
1393
	
1394
	<target name="admindoc" depends="prepare">
1395
		<!-- Build the administrator's guide, which is a Sphinx RST project
1396
		     For this to succeed, you must have Sphinx installed on your machine
1397
		     See: http://sphinx.pocoo.org/ for details
1398
		     And you must also have the 'make' build tool installed
1399
		-->
1400
		<exec dir="${docdir}/user/metacat" executable="make"> 
1401
		        <arg value="plantuml"/> 
1402
		</exec>
1403
		
1404
		<exec dir="${docdir}/user/metacat" executable="make"> 
1405
		        <arg value="html"/> 
1406
		</exec>
1407
		
1408
    </target>
1409

    
1410
	<target name="javadoc" depends="prepare"
1411
		description="generates Javadoc API documentation">
1412
		<javadoc packagenames="edu.ucsb.nceas.*"
1413
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1414
			version="true" use="true" windowtitle="${Name} API"
1415
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1416
			bottom="&lt;i&gt;Copyright &#169; ${copyright}. All Rights Reserved.&lt;/i&gt;">
1417
			<classpath>
1418
				<path refid="compile.classpath" />
1419
			</classpath>
1420
		</javadoc>
1421
	</target>
1422

    
1423
	<target name="dist"
1424
		depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL,getutilities"
1425
		description="prepares a full release distribution">
1426
		<mkdir dir="${dist.dir}" />
1427
		<delete dir="${ver.dir}" />
1428
		<mkdir dir="${ver.dir}" />
1429
		<copy todir="${ver.dir}">
1430
			<fileset dir="."
1431
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1432
		</copy>
1433
		<copy todir="${ver.dir}" file="build.xml" />
1434
		<copy todir="${ver.dir}" file="build.properties" />
1435

    
1436
		<copy todir="${ver.dir}/docs" filtering="yes">
1437
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1438
		</copy>
1439
		<copy todir="${ver.dir}/docs" filtering="no">
1440
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1441
		</copy>
1442
		<copy todir="${ver.dir}/docs/dev">
1443
			<fileset dir="${build.dir}/docs" />
1444
		</copy>
1445
		<copy todir="${ver.dir}/src">
1446
			<fileset dir="${build.dir}/src" />
1447
		</copy>
1448

    
1449
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1450
		<copy todir="${ver.dir}/test/servertestfiles">
1451
			<fileset dir="./test/servertestfiles" />
1452
		</copy>
1453
	</target>
1454

    
1455
	<target name="fulldist" depends="distbin, distsrc"
1456
			description="full distribution - source and bin"/>
1457
		
1458
	<target name="distbin" depends="build-metacat,war-lsid"
1459
		description="prepares a binary distribution">
1460
		<copy todir="${dist.dir}">
1461
			<fileset dir="./src/scripts" />
1462
		</copy>
1463
		<delete file="./${name}-bin-${release}.zip" />
1464
		<zip zipfile="./${name}-bin-${release}.zip"
1465
			basedir="${dist.dir}" />
1466
		<delete file="./${name}-bin-${release}.tar.gz" />
1467
		<tar tarfile="./${name}-bin-${release}.tar"
1468
			basedir="${dist.dir}" />
1469
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1470
			src="./${name}-bin-${release}.tar" />
1471
		<delete file="./${name}-bin-${release}.tar" />
1472
	</target>
1473

    
1474
	<target name="distsrc" depends="dist"
1475
		description="prepares a source distribution">
1476
		<mkdir dir="${ver.src}" />
1477
		<copy todir="${ver.src}">
1478
			<fileset dir="./src" />
1479
		</copy>
1480
		<mkdir dir="${util.dir}" />
1481
		<copy todir="${util.dir}">
1482
			<fileset dir="${utilitiesdir}" excludes="**/CVS*" />
1483
		</copy>
1484

    
1485
		<mkdir dir="${ecogrid-dist-dir}" />
1486
		<copy todir="${ecogrid-dist-dir}">
1487
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1488
		</copy>
1489

    
1490
		<delete file="${ver.dir}/lib/utilities.jar" />
1491

    
1492
		<delete file="./${name}-src-${release}.zip" />
1493
		<zip zipfile="./${name}-src-${release}.zip"
1494
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1495
		<delete file="./${name}-src-${release}.tar.gz" />
1496
		<tar tarfile="./${name}-src-${release}.tar"
1497
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1498
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1499
			src="./${name}-src-${release}.tar" />
1500
		<delete file="./${name}-src-${release}.tar" />
1501
		<!--delete dir="${dist.dir}"/ -->
1502
	</target>
1503

    
1504
	<target name="deb-package" depends="distbin"
1505
		description="create a debian installation package">
1506
		<delete dir="${deb.pkg.dir}" />
1507
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1508
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1509
			<fileset dir="./src/scripts/debian"
1510
				includes="control postinst" />
1511
		</copy>
1512

    
1513
		<mkdir
1514
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1515
		<copy
1516
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1517
			filtering="yes">
1518
			<fileset dir="./src/scripts/debian"
1519
				excludes="control postinst" />
1520
		</copy>
1521
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1522

    
1523
		<copy file="${dist.dir}/knb.war"
1524
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1525
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1526
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1527

    
1528
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1529
			failonerror="true">
1530
			<arg line="--build debian" />
1531
		</exec>
1532

    
1533
		<move file="${pkg.dir}/debian.deb"
1534
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1535
	</target>
1536

    
1537
	<target name="stylesheettest">
1538
		<xslt in="${input}" out="eml.html"
1539
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1540
			<param name="displaymodule" expression="${displaymodule}" />
1541
			<param name="docid" expression="${input}" />
1542
			<param name="entitytype" expression="${entitytype}" />
1543
			<param name="entityindex" expression="${entityindex}" />
1544
			<outputproperty name="method" value="html" />
1545
			<outputproperty name="standalone" value="yes" />
1546
			<outputproperty name="encoding" value="iso8859_1" />
1547
			<outputproperty name="indent" value="yes" />
1548
		</xslt>
1549
	</target>
1550

    
1551
	<target name="spatial_option" depends="prepare"
1552
		description=" -- compiles code for the spatial option">
1553

    
1554
		<echo message="Compiling the metatcat shapefile creator" />
1555
		<echo message="using the shapelib at: ${shapelib.dir}" />
1556
		<exec dir="." executable="g++" os="Linux, Unix"
1557
			failonerror="true">
1558
			<arg
1559
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1560
		</exec>
1561

    
1562
		<exec dir="." executable="g++" os="Linux, Unix"
1563
			failonerror="true">
1564
			<arg
1565
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1566
		</exec>
1567
	</target>
1568

    
1569
	<!-- LSID Authority support -->
1570
	<patternset id="lsid.jars">
1571
		<include name="axis.jar" />
1572
		<include name="commons-discovery-0.2.jar" />
1573
		<include name="jaxrpc.jar" />
1574
		<include name="lsid-client-1.1.1.jar" />
1575
		<include name="lsid-server-1.1.1.jar" />
1576
		<include name="saaj.jar" />
1577
		<include name="wsdl4j-1.5.1.jar" />
1578
		<include name="activation.jar" />
1579
		<include name="castor-0.9.5.jar" />
1580
		<include name="dnsjava-1.3.2.jar" />
1581
		<include name="mail.jar" />
1582
		<include name="commons-logging-1.0.4.jar" />
1583
		<!-- These jars may be needed but seem to not actually be,
1584
			so leaving them out for now
1585
			<include name="axis-ant.jar" />
1586
		-->
1587
		<!--<include name="GenCastor.class" />-->
1588
	</patternset>
1589
	<patternset id="lib.jars">
1590
		<include name="log4j-1.2.12.jar" />
1591
		<include name="utilities.jar" />
1592
		<include name="xerces*.jar" />
1593
		<include name="xalan*.jar" />
1594
		<include name="xml-apis*.jar" />
1595
	</patternset>
1596

    
1597
	<path id="lsid.classpath">
1598
		<fileset dir="${lsid.lib.dir}">
1599
			<patternset refid="lsid.jars" />
1600
		</fileset>
1601
		<fileset dir="${lib.dir}">
1602
			<patternset refid="lib.jars" />
1603
		</fileset>
1604
		<fileset dir="${build.dir}">
1605
			<include name="metacat-client.jar" />
1606
			<include name="metacat.jar" />
1607
		</fileset>
1608
	</path>
1609

    
1610
	<filterset id="configFilters">
1611
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1612
			value="${config.hostname}" / -->
1613
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1614
			value="${config.port}" / -->
1615
		<!-- MCD BYE filter token="METADATA_LABELS"
1616
			value="${config.metadataLabelLsid}" / -->
1617
		<!-- MCD BYE filter token="METACAT_SERVER"
1618
			value="${config.metacatserver}" / -->
1619
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1620
			value="${config.lsidauthority}" / -->
1621
	</filterset>
1622

    
1623
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1624
		description="Configure files prior to compilation">
1625
		<mkdir dir="${lsid.build.dir}" />
1626
		<!-- Copy the properties file into the build -->
1627
		<copy file="${conf.dir}/metacat-lsid.properties"
1628
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1629
			overwrite="true">
1630
			<filterset refid="configFilters" />
1631
		</copy>
1632
		<copy file="${conf.dir}/log4j.properties"
1633
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1634
			overwrite="true">
1635
			<filterset refid="configFilters" />
1636
		</copy>
1637
		<!-- Copy config files into the build -->
1638
		<copy todir="${lsid.build.dir}/WEB-INF">
1639
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1640
		</copy>
1641
		<!-- Copy the metadata configuration files into the build -->
1642
		<mkdir
1643
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1644
		<copy
1645
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1646
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1647
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1648
			<filterset refid="configFilters" />
1649
		</copy>
1650
		<!-- Copy services files into the build -->
1651
		<mkdir dir="${lsid.build.dir}/services" />
1652
		<copy todir="${lsid.build.dir}/services">
1653
			<fileset dir="${services.dir}" />
1654
			<filterset refid="configFilters" />
1655
		</copy>
1656
		<!-- Copy axis files into the build -->
1657
		<mkdir dir="${lsid.build.dir}" />
1658
		<copy todir="${lsid.build.dir}">
1659
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1660
		</copy>
1661
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1662
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1663
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1664
		</copy>
1665
	</target>
1666

    
1667
	<target name="compile-lsid" depends="prepare-lsid"
1668
		description="Compile Java sources">
1669
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1670
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1671
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1672
			deprecation="${compile.deprecation}"
1673
			optimize="${compile.optimize}">
1674
			<classpath>
1675
				<path refid="compile.classpath" />
1676
				<fileset dir="${build.dir}">
1677
					<include name="${name}.jar" />
1678
				</fileset>
1679
			</classpath>
1680
		</javac>
1681
	</target>
1682

    
1683
	<target name="war-lsid" depends="compile-lsid"
1684
		description="Create a war file for the application">
1685
		<mkdir dir="${dist.dir}" />
1686
		<war destfile="${dist.dir}/${authority.context}.war"
1687
			webxml="${webinf.dir}/web.xml">
1688
			<fileset dir="${lsid.build.dir}" />
1689
			<lib dir="${lsid.lib.dir}">
1690
				<patternset refid="lsid.jars" />
1691
			</lib>
1692
			<lib dir="${lib.dir}">
1693
				<patternset refid="lib.jars" />
1694
			</lib>
1695
			<lib dir="${lib.dir}">
1696
				<include name="xalan.jar" />
1697
				<include name="xml-apis.jar" />
1698
			</lib>
1699
			<lib dir="${build.dir}">
1700
				<include name="metacat-client.jar" />
1701
			</lib>
1702
		</war>
1703
	</target>
1704

    
1705
	<target name="deploy-lsid" depends="war-lsid"
1706
		description="Deploy LSID war to servlet container">
1707
		<delete dir="${app.deploy.dir}/${authority.context}" />
1708
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1709
		<mkdir dir="${app.deploy.dir}" />
1710
		<copy todir="${app.deploy.dir}">
1711
			<fileset dir="${dist.dir}" />
1712
		</copy>
1713
	</target>
1714
	
1715
	<target name="change-metacat-properties" depends="warPrepare"
1716
        description="Chage some default values of metacat.properties">
1717
       <echo file="${metacat-properties-file}" append="true">
1718
		   configutil.propertiesConfigured=true
1719
		   configutil.authConfigured=true
1720
           configutil.skinsConfigured=true
1721
		   configutil.databaseConfigured=true
1722
		   configutil.geoserverConfigured=true
1723
	   </echo>
1724
  </target>
1725
	
1726
	<!-- This target will use default values in svn metacat.properties to build a configured 
1727
		metacat (except configuti.* properties, they will be set true). Those default settings
1728
		are for a test machine. It may not work on your system-->
1729
	<target name="install-configured-metacat" depends="change-metacat-properties, install"
1730
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1731
    </target>
1732
	
1733
	<!-- build metacat-common jar -->
1734
	<target name="build-metacat-common" description="Calls the Maven build for metacat-common jar" unless="build-metacat-common-called" >
1735
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1736
		            <arg value="clean"/>
1737
		</artifact:mvn>
1738
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1739
		   <arg value="install"/>
1740
		</artifact:mvn>
1741
		<property name="build-metacat-common-called" value="true"/>
1742
	</target>
1743

    
1744
	<!-- build metacat-index war -->
1745
	<target name="build-metacat-index" description="Calls the Maven build for metacat-index.war" >		
1746
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1747
			<arg value="clean"/>
1748
		</artifact:mvn>
1749
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1750
			<arg value="package"/>
1751
			<!--<arg value="-Dmaven.test.skip=true"/>-->
1752
		</artifact:mvn>
1753
	</target>
1754
	
1755
	<target name="dist-metacat-index" depends="init, build-metacat-index" description="Copy metacat-index.war to dist folder" >		
1756
		<copy tofile="${dist.dir}/metacat-index.war" >
1757
			<fileset dir="metacat-index/target" includes="metacat-index*.war"></fileset>
1758
		</copy>	
1759
	</target>
1760
	
1761
	<target name="install-metacat-index" depends="dist-metacat-index" description="Copy metacat-index.war to deploy folder" >		
1762
		<copy todir="${app.deploy.dir}" file="${dist.dir}/metacat-index.war" />
1763
	</target>
1764
	
1765
</project>
(5-5/7)