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: tao $'
10
	*    '$Date: 2013-11-18 15:07:45 -0800 (Mon, 18 Nov 2013) $'
11
	*    '$Revision: 8401 $'
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
	    <attribute name = "refname" />
68
	    <sequential>
69
	        <git command = "clone">
70
	            <args>
71
	                <arg value = "@{repository}" />
72
	                <arg value = "@{dest}" />
73
	            </args>
74
	        </git>
75
	        <git command = "pull" dir = "@{dest}" >
76
	        	<args>
77
	                <arg value = "@{repository}" />
78
	                <arg value = "@{refname}" />
79
	            </args>
80
	        </git>
81
	        <git command = "checkout" dir = "@{dest}">
82
	        	<args>
83
	                <arg value = "@{refname}" />
84
	            </args>
85
	        </git>
86
	    </sequential>
87
	</macrodef>
88
	
89
	<!-- get metacatUI project -->
90
	<target name="getMetacatUI" depends="init">
91
		<git-clone-pull repository="${metacatui.git.repository.url}" dest="${metacatui.build.dir}" refname="${metacatui.git.repository.refname}" />
92
	</target>
93
	
94
	<target name="build-metacat-ui" description="Calls the Maven build for metacatUI war" depends="getMetacatUI" unless="build-metacat-ui-called">
95
		<artifact:mvn pom="${metacatui.build.dir}/metacatui/pom.xml" mavenhome="${maven.home}" fork="true">
96
			<arg value="clean"/>
97
		</artifact:mvn>
98
		<artifact:mvn pom="${metacatui.build.dir}/metacatui/pom.xml" mavenhome="${maven.home}" fork="true">
99
		   <arg value="package"/>
100
		</artifact:mvn>
101
		<property name="build-metacat-ui-called" value="true"/>
102
	</target>
103
	
104
	<target name="dist-metacat-ui" depends="build-metacat-ui">
105
		<copy tofile="${dist.dir}/metacatui.war" >
106
			<fileset dir="${metacatui.build.dir}/metacatui/target" includes="*.war"></fileset>
107
		</copy>	
108
	</target>
109
    	
110
	<taskdef resource="axis-tasks.properties"
111
		classpathref="axis.ant.classpath" />
112
	
113
	<!-- Determine if ecogrid should be installed-->
114
	<condition property="enable.ecogrid">
115
		<equals arg1="${install.ecogrid}" arg2="true" />
116
	</condition>
117

    
118
	<!-- Determine if perl should be built-->
119
	<condition property="build.perl">
120
		<equals arg1="${make.perl.code}" arg2="true" />
121
	</condition>
122

    
123
	<available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
124
			property="tomcat.common.exists" />
125

    
126
	<target name="config" depends="setTomcatCommon, setTomcatNoCommon">
127
		<!-- usr for client testing, generally you don't need change-->
128
		<property name="mcuser"
129
			value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
130
		<property name="mcpassword" value="kepler" />
131
		<property name="mcanotheruser"
132
			value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org" />
133
		<property name="mcanotherpassword" value="yourpass" />
134
		<property name="piscouser"
135
			value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org" />
136
		<property name="piscopassword" value="yourpass" />
137
		<property name="lteruser"
138
			value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org" />
139
		<property name="lterpassword" value="yourpass" />
140

    
141
		<property name="debug" value="on" />
142
		<property name="morphosourcedir" value="../morpho" />
143
		<property name="utilitiesdir" value="../utilities" />
144
		<property name="installdir"
145
			value="${app.deploy.dir}/${metacat.context}" />
146

    
147
		<echo>*********** set jsdk to ${jsdk}</echo>
148
	</target>
149
	
150
	<target name="setTomcatCommon" if="tomcat.common.exists" >
151
		<property name="jsdk"
152
			value="${build.tomcat.dir}/common/lib/servlet-api.jar" />
153
	</target>
154
	
155
	<target name="setTomcatNoCommon" unless="tomcat.common.exists" >
156
		<property name="jsdk"
157
			value="${build.tomcat.dir}/lib/servlet-api.jar" />
158
	</target>
159
	
160
	<target name="init" depends="config, build-metacat-common" unless="init.called">
161
		
162
	    <property name="libdir.mvn" value="lib/maven" />
163
		<mkdir dir="${libdir.mvn}"/>
164
		
165
		<path id="base.classpath">
166
			<pathelement location="${jsdk}" />
167
            <pathelement location="lib" />
168
			
169
			<fileset dir="lib">
170
				<include name="*.jar" />
171
			</fileset>
172
			
173
			<fileset dir="lib/lsid_lib">
174
				<include name="*.jar" />
175
			</fileset>
176

    
177
			<!-- Include everything from maven -->
178
			<fileset dir="${libdir.mvn}">
179
				<include name="*.jar" />
180
			</fileset>
181

    
182
		</path>
183
		
184
		<path id="test.classpath">
185
			<pathelement location="${jsdk}" />
186
			<pathelement location="lib" />
187
			<fileset dir="lib">
188
				<include name="*.jar" />
189
				<exclude name="maven-ant-tasks-2.1.0.jar" />
190
			</fileset>
191
			<fileset dir="lib/lsid_lib">
192
				<include name="*.jar" />
193
			</fileset>
194
			<!-- Include maven -->
195
			<fileset dir="${libdir.mvn}">
196
				<include name="*.jar" />
197
			</fileset>
198
		</path>
199
		
200
		<!-- define the maven tasks -->
201
		<taskdef uri="antlib:org.apache.maven.artifact.ant"
202
			       resource="org/apache/maven/artifact/ant/antlib.xml"
203
			       classpathref="base.classpath" />
204

    
205
	   	<!-- Resolve maven dependencies -->
206
		<artifact:pom id="metacatPom" file="pom.xml" />
207
		<artifact:dependencies filesetId="dependency.fileset" pomrefid="metacatPom" usescope="runtime"/>
208
		<artifact:dependencies pathId="dependency.classpath" pomrefid="metacatPom"/>
209
	   		   	
210
	   	<!-- combine base and dependencies for the classpath -->
211
	   	<path id="compile.classpath">
212
	   		<path refid="base.classpath" />	
213
	   		<path refid="dependency.classpath" />	
214
		</path>
215

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

    
268

    
269
		<!-- Config for registry variables -->
270
		<!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
271
		<property name="scope" value="obfs" />
272
		<property name="responseForm" value="genericResponse.tmpl" />
273
		<property name="entryForm" value="entryForm.tmpl" />
274
		<property name="guide" value="genericGuide.tmpl" />
275
		<property name="loginForm" value="loginForm.tmpl" />
276
		<property name="confirmData" value="confirmData.tmpl" />
277
		<property name="deleteData" value="deleteData.tmpl" />
278
		<property name="genericHeader" value="genericHeader.tmpl" />
279
		<property name="genericFooter" value="genericFooter.tmpl" />
280

    
281
		<filter token="scope" value="${scope}" />
282
		<filter token="responseForm" value="${responseForm}" />
283
		<filter token="entryForm" value="${entryForm}" />
284
		<filter token="guide" value="${guide}" />
285
		<filter token="loginForm" value="${loginForm}" />
286
		<filter token="confirmData" value="${confirmData}" />
287
		<filter token="deleteData" value="${deleteData}" />
288
		<filter token="genericHeader" value="${genericHeader}" />
289
		<filter token="genericFooter" value="${genericFooter}" />
290
		<filter token="adminname" value="${adminname}" />
291
		<filter token="recipient" value="${recipient}" />
292
		<filter token="metacatVersion" value="${metacat.version}" />
293
		<filter token="metacatRC" value="${metacat.releaseCandidate}" />
294
		<filter token="build.context" value="${metacat.context}" />
295

    
296
		<filter token="docrooturl" value="./" />
297
		<filter token="mcuser" value="${mcuser}" />
298
		<filter token="mcpassword" value="${mcpassword}" />
299
		<filter token="mcanotheruser" value="${mcanotheruser}" />
300
		<filter token="mcanotherpassword" value="${mcanotherpassword}" />
301
		<filter token="eml-css" value="${eml-css}" />
302
		<filter token="style-skins-relpath"
303
			value="${style-skins-relpath}" />
304
		<filter token="style-common-relpath"
305
			value="${style-common-relpath}" />
306

    
307
		<filter token="eml-version" value="${eml-version}" />
308
		<filter token="eml-beta4-version" value="${eml-beta4-version}" />
309
		<filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
310
		<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
311
		<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
312
		<filter token="eml2_1_1namespace" value="${eml2_1_1namespace}" />
313
		<filter token="stmmlnamespace" value="${stmmlnamespace}" />
314
		<filter token="stmml11namespace" value="${stmml11namespace}" />
315
		<filter token="debugprefix" value="${debugprefix}" />
316

    
317
		<filter token="defaultStage" value="${defaultStage}" />
318
		<filter token="defaultHeader" value="${defaultHeader}" />
319
		<filter token="defaultFooter" value="${defaultFooter}" />
320
		<filter token="defaultChangePass" value="${defaultChangePass}" />
321
		<filter token="defaultResetPass" value="${defaultResetPass}" />
322
		<filter token="changePassSuccess" value="${changePassSuccess}" />
323
		<filter token="resetPassSuccess" value="${resetPassSuccess}" />
324
		<filter token="registerFailed" value="${registerFailed}" />
325
		<filter token="registerLter" value="${registerLter}" />
326
		<filter token="registerMatch" value="${registerMatch}" />
327
		<filter token="registerSuccess" value="${registerSuccess}" />
328
		<filter token="register" value="${register}" />
329
		<filter token="searchResults" value="${searchResults}" />
330
		<filter token="ldapMainServerFailure"
331
			value="${ldapMainServerFailure}" />
332
		<filter token="lter-user" value="${lteruser}" />
333
		<filter token="lter-pass" value="${lterpassword}" />
334
		<filter token="pisco-user" value="${piscouser}" />
335
		<filter token="pisco-pass" value="${piscopassword}" />
336

    
337

    
338
		<!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
339
		<!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
340
		<!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
341

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

    
379
		<property name="ecogrid-target-name" value="metacatImpl" />
380
		<property name="ecogrid-module-dest-dir" value=".." />
381
		<property name="ecogrid-module" value="seek/projects/ecogrid" />
382
		<property name="ecogrid-dist-dir"
383
			value="${dist.dir}/${ecogrid-module}" />
384
		<property name="ecogrid-dir"
385
			value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
386

    
387
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
388

    
389
		<!-- set up svn -->
390
		<property name="svnant.lib" value="lib" />
391
		<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
392
		<property name="svnClientAdapter.jar"
393
			value="${svnant.lib}/svnClientAdapter.jar" />
394
		<property name="svnjavahl.jar"
395
			value="${svnant.lib}/svnjavahl.jar" />
396
		<property name="svn.utilitiesUrl"
397
			value="https://code.ecoinformatics.org/code/utilities/${utilities-tag}" />
398
		<property name="svn.ecogridUrl"
399
			value="https://code.ecoinformatics.org/code/seek/${seek-tag}/projects/ecogrid/" />
400
		<property name="svn.emlBetaUrl"
401
			value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
402
		<property name="svn.emlBeta4Url"
403
					value="https://code.ecoinformatics.org/code/eml/tags/${eml-beta4-tag}" />
404
		<property name="svn.eml200SchemaUrl"
405
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
406
		<property name="svn.eml201SchemaUrl"
407
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
408
		<property name="svn.eml210SchemaUrl"
409
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
410
		<property name="svn.eml211SchemaUrl"
411
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_1-schema-tag}" />
412
		<property name="svn.eml2StyleUrl"
413
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2-style-tag}" />
414
		
415
		<!-- the git repo -->
416
		<property name="metacatui.git.repository.url"
417
					value="https://github.com/NCEAS/metacatui.git" />
418
		<property name="metacatui.git.repository.refname"
419
							value="METACATUI_1_2_0" />
420
		<!--<property name="metacatui.git.repository.refname"
421
									value="master" /> -->
422
		<property name="metacatui.build.dir"
423
					value="metacatui_build" />
424
		<property name="metacatui.resources.dir"
425
					value="${metacatui.build.dir}/metacatui/src/main/webapp" />
426
		
427
		<!-- load the svn task -->
428
		<path id="svn.classpath">
429
			<pathelement location="${svnjavahl.jar}" />
430
			<pathelement location="${svnant.jar}" />
431
			<pathelement location="${svnClientAdapter.jar}" />
432
		</path>
433
		<taskdef resource="svntask.properties"
434
			classpathref="svn.classpath" />
435

    
436
		<condition property="utilities.required">
437
			<not>
438
				<available file="lib/utilities.jar" />
439
			</not>				
440
		</condition>
441
		<!-- peer.utilities.required is used when there is no utilities 
442
			directory at ${utilitiesdir} -->
443
		<condition property="peer.utilities.required">
444
			<or>
445
				<not>
446
					<available file="${utilitiesdir}" type="dir" />
447
				</not>
448
			</or>
449
		</condition>
450
		<condition property="eml.required">
451
			<or>
452
				<not>
453
					<available file="lib/schema/eml-2.0.1/eml.xsd" />
454
				</not>
455
				<not>
456
					<available file="lib/schema/eml-2.0.0/eml.xsd" />
457
				</not>
458
				<not>
459
					<available file="lib/schema/eml-2.1.0/eml.xsd" />
460
				</not>
461
				<not>
462
					<available
463
						file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
464
				</not>
465
			</or>
466
		</condition>
467

    
468
		<condition property="ecogrid.required">
469
			<or>
470
				<not>
471
					<available file="${ecogrid-dir}/build.properties" />
472
				</not>
473
				<not>
474
					<available
475
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
476
				</not>
477
			</or>
478
		</condition>
479
		
480
		<property name="init.called" value="true" />
481

    
482
	</target>
483
	
484
	<target name="resolveDependencies" depends="init" description="retrieve dependencies with maven">
485
			<echo>Moving Maven dependencies (${dependency.fileset}) to ${libdir.mvn} </echo>
486
			<!-- Clear out mvn dir -->
487
			<delete dir="${libdir.mvn}"></delete>
488
			<!-- Copy all dependencies to the correct location. -->
489
			<copy todir="${libdir.mvn}">
490
				<fileset refid="dependency.fileset" />
491
				<!-- This mapper strips off all leading directory information -->
492
				<mapper type="flatten" />
493
			</copy>
494
		</target>
495

    
496
	<target name="prepare" depends="init, resolveDependencies">
497
		<mkdir dir="${build.dir}" />
498
		<mkdir dir="${build.src}" />
499
		<mkdir dir="${build.dest}" />
500
		<mkdir dir="${build.docs}" />
501
		<mkdir dir="${build.javadocs}" />
502
		<mkdir dir="${build.tmp}" />
503

    
504
		<copy todir="${build.src}" filtering="yes">
505
			<fileset dir="${srcdir}">
506
				<include name="edu/**" />
507
				<include name="com/**" />
508
				<include name="org/**" />
509
				<!-- include name="java/**" / -->
510
				<include name="**/*.sql" />
511
				<exclude name="**/CVS*" />
512
				<exclude name="**/.#*" />
513
				<exclude name="edu/ucsb/nceas/workflowscheduler/**" />
514
			</fileset>
515
		</copy>
516
		<available file="lib/style/common/emlb6toeml2" type="dir"
517
			property="styles.not.needed" />
518
	</target>
519

    
520
	<target name="generateStubs" depends="prepare">
521
		<echo
522
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
523
		<axis-wsdl2java verbose="true" output="${srcdir}"
524
			url="/tmp/KeplerWebService.wsdl" />
525
	</target>
526

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

    
530
		<javac srcdir="${build.src}" destdir="${build.dest}"
531
			debug="${debug}"
532
			excludes="**/*.sql **/client/*.java **/harvesterClient/*.java">
533
			<classpath>
534
				<path refid="compile.classpath" />
535
			</classpath>
536
		</javac>
537
	</target>
538

    
539
	<target name="jar" depends="compile,geteml"
540
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
541

    
542
		<delete file="${build.dir}/${name}.jar" />
543
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
544
			excludes="**/protocols/ **/harvesterClient/" />
545
	</target>
546

    
547
	<target name="protocol" depends="compile"
548
		description="Compiles and jars protocol java code to protocol.jar in build dir">
549
		<delete file="${build.dir}/protocol.jar" />
550
		<jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
551
			includes="**/protocols/" />
552
	</target>
553

    
554
	<target name="utilities" depends="config,getpeerutilities"
555
		if="utilities.required">
556
		<ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
557
		<ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
558
		<copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
559
	</target>
560

    
561
	<target name="getpeerutilities" depends="prepare"
562
		if="peer.utilities.required"
563
		description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
564
		<echo message="Exporting utilities files from svn repository:" />
565
		<svn>
566
			<export srcUrl="${svn.utilitiesUrl}"
567
				destPath="${utilitiesdir}" />
568
		</svn>
569

    
570
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
571
	</target>
572
	
573
	<target name="getutilities" depends="prepare"
574
		description="Checks utility out of svn and copies it to your metacat sandbox">
575
		<svn>
576
			<export srcUrl="${svn.utilitiesUrl}"
577
				destPath="${utilitiesdir}" force="true" />
578
		</svn>
579
	</target>
580

    
581
	<target name="client" depends="utilities, prepare"
582
		description="Compiles metacat-client java code to build dir">
583
		<javac srcdir="${build.src}" destdir="${build.dest}"
584
			includes="edu/ucsb/nceas/metacat/client/*">
585
			<classpath>
586
				<path refid="compile.classpath" />
587
			</classpath>
588
		</javac>
589
	</target>
590

    
591
	<target name="clientjar" depends="client"
592
		description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
593
		<delete file="${build.dir}/${name}-client.jar" />
594
		<jar jarfile="${build.dir}/${name}-client.jar"
595
			basedir="${build.dest}" includes="**/metacat/client/" />
596
	</target>
597

    
598
	<target name="advancedsearchjar" depends="compile"
599
		description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
600
		<delete file="${build.dir}/advancedsearch.jar" />
601
		<jar jarfile="${build.dir}/advancedsearch.jar"
602
			basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
603
	</target>
604

    
605
	<target name="harvester" depends="client"
606
		description="Compiles harvester java code to build dir">
607
		<javac srcdir="${build.src}" destdir="${build.dest}"
608
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
609
			<classpath>
610
				<path refid="compile.classpath" />
611
			</classpath>
612
		</javac>
613
	</target>
614
		
615
	<target name="harvesterjar" depends="harvester"
616
		description="Compiles and jars harvester java code to harvester.jar in build dir">
617
		<delete file="${build.dir}/harvester.jar" />
618
		<jar jarfile="${build.dir}/harvester.jar"
619
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
620
	</target>
621

    
622
	<target name="harvestListEditorDist" depends="harvesterjar"
623
		description="Prepares a distribution of the Harvest List Editor tool">
624
		<mkdir dir="${dist.dir.hle}" />
625
		<delete dir="${ver.dir.hle}" />
626
		<mkdir dir="${ver.dir.hle}" />
627
		<copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
628
		<copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
629
		<copy todir="${ver.dir.hle}"
630
			file="lib/harvester/harvestList.xsd" />
631
		<copy todir="${ver.dir.hle}"
632
			file="lib/harvester/harvestListEditor.bat" />
633
		<copy todir="${ver.dir.hle}"
634
			file="lib/harvester/harvestListEditor.sh" />
635
		<delete file="./harvest-list-editor-${release}.zip" />
636
		<zip zipfile="./harvest-list-editor-${release}.zip"
637
			basedir="${ver.dir.hle}" />
638
		<delete file="./harvest-list-editor-${release}.tar.gz" />
639
		<tar tarfile="./harvest-list-editor-${release}.tar"
640
			basedir="${ver.dir.hle}" />
641
		<gzip zipfile="./harvest-list-editor-${release}.tar.gz"
642
			src="./harvest-list-editor-${release}.tar" />
643
		<delete file="./harvest-list-editor-${release}.tar" />
644
	</target>
645

    
646
	<target name="geteml" depends="getemlpre2,getemlpre2beta4,geteml2+,getConversionXSL"
647
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
648

    
649
	<target name="getemlpre2" depends="prepare" if="eml.required"
650
		description="Checks EML-beta6 out of svn and copies dtds and xsl to your metacat sandbox">
651
		<svn>
652
			<export srcUrl="${svn.emlBetaUrl}"
653
				destPath="${build.tmp}/eml_${eml-beta-tag}" />
654
		</svn>
655
		<mkdir dir="lib/dtd" />
656
		<copy todir="lib/dtd" filtering="yes">
657
			<fileset
658
				dir="${build.tmp}/eml_${eml-beta-tag}">
659
				<include name="*.dtd" />
660
			</fileset>
661
			<mapper type="glob" from="eml-*.dtd"
662
				to="eml-*-${eml-version}.dtd" />
663
		</copy>
664

    
665
		<copy todir="${style-common-cvsrelpath}" filtering="yes">
666
			<fileset
667
				dir="${build.tmp}/eml_${eml-beta-tag}/style">
668
				<include name="**/*.xsl" />
669
			</fileset>
670
		</copy>
671
	</target>
672
	
673
	<target name="getemlpre2beta4" depends="prepare" if="eml.required"
674
			description="Checks EML-beta4 out of svn and copies dtds to your metacat sandbox">
675
			<svn>
676
				<export srcUrl="${svn.emlBeta4Url}"
677
					destPath="${build.tmp}/eml_${eml-beta4-tag}" />
678
			</svn>
679
			<mkdir dir="lib/dtd" />
680
			<copy todir="lib/dtd" filtering="yes">
681
				<fileset
682
					dir="${build.tmp}/eml_${eml-beta4-tag}">
683
					<include name="*.dtd" />
684
				</fileset>
685
				<mapper type="glob" from="eml-*.dtd"
686
					to="eml-*-${eml-beta4-version}.dtd" />
687
			</copy>
688

    
689
			<!--
690
			<copy todir="${style-common-cvsrelpath}" filtering="yes">
691
				<fileset
692
					dir="${build.tmp}/eml_${eml-beta4-tag}/style">
693
					<include name="**/*.xsl" />
694
				</fileset>
695
			</copy>
696
			-->
697
		</target>
698

    
699
	<target name="geteml2+" depends="prepare" if="eml.required"
700
		description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
701
		<svn>
702
			<export srcUrl="${svn.eml200SchemaUrl}"
703
				destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
704
		</svn>
705
		<mkdir dir="lib/schema/eml-2.0.0" />
706
		<copy todir="lib/schema/eml-2.0.0" filtering="yes">
707
			<fileset
708
				dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
709
				<include name="*.xsd" />
710
			</fileset>
711

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

    
718
		</copy>
719
		<!-- <antcall target="copyxsl">
720
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
721
			<param name="dirname" value="eml-2.0.0" />
722
			</antcall> -->
723

    
724
		<!-- Checkout eml201 for given schema tag-->
725
		<svn>
726
			<export srcUrl="${svn.eml201SchemaUrl}"
727
				destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
728
		</svn>
729
		<mkdir dir="lib/schema/eml-2.0.1" />
730
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
731
			<fileset
732
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
733
				<include name="*.xsd" />
734
			</fileset>
735
		</copy>
736

    
737
		<!-- Checkout eml201 again for given style sheet tag-->
738
		<!-- echo>Enter CVS password: </echo>
739
			<cvs cvsRoot="${cvsroot}"
740
			package="${eml-module}"
741
			tag="${eml2_0_1-style-tag}"
742
			dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
743
			<antcall target="copyxsl">
744
			<param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
745
			<param name="dirname" value="eml-2.0.1" />
746
			</antcall -->
747

    
748
		<!-- Checkout eml210 for given schema tag-->
749
		<svn>
750
			<export srcUrl="${svn.eml210SchemaUrl}"
751
				destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
752
		</svn>
753
		<mkdir dir="lib/schema/eml-2.1.0" />
754
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
755
			<fileset
756
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
757
				<include name="*.xsd" />
758
			</fileset>
759
		</copy>
760

    
761
		<!-- Checkout eml210 for given style sheet tag-->
762
		<svn>
763
			<export srcUrl="${svn.eml2StyleUrl}"
764
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
765
		</svn>
766
		<antcall target="copyxsl">
767
			<param name="cvs.tagname" value="${eml2-style-tag}" />
768
			<!-- param name="dirname" value="eml-2.1.0" / -->
769
			<param name="dirname" value="eml-2" />
770
		</antcall>
771
		
772
		<!-- Checkout eml210 for given schema tag-->
773
		<svn>
774
			<export srcUrl="${svn.eml211SchemaUrl}"
775
				destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
776
		</svn>
777
		<mkdir dir="lib/schema/eml-2.1.1" />
778
		<copy todir="lib/schema/eml-2.1.1" filtering="yes">
779
			<fileset
780
				dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
781
				<include name="*.xsd" />
782
			</fileset>
783
		</copy>
784
	</target>
785

    
786
	<target name="copyxsl"
787
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
788

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

    
791
		<copy todir="${style-common-cvsrelpath}/${dirname}"
792
			filtering="yes">
793
			<fileset
794
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
795
				<include name="**/*.xsl" />
796
			</fileset>
797
		</copy>
798

    
799

    
800
		<!-- now copy default css from eml module and put it in style-common-path
801
			dir with a new name, so other skin-specific css can import it if reqd -->
802
		<copy
803
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
804
			tofile="${style-common-cvsrelpath}/${eml-css}" />
805

    
806
	</target>
807

    
808
	<target name="correctEML201Docs" depends="jar"
809
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
810
		<copy todir="${build.dir}" file="lib/metacat.properties"
811
			filtering="yes" />
812
		<java
813
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
814
			<classpath>
815
				<path refid="compile.classpath" />
816
				<fileset dir="${build.dir}">
817
					<include name="${name}.jar" />
818
				</fileset>
819
			</classpath>
820
		</java>
821
	</target>
822

    
823
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
824
		description="Installs spatial option for metacat">
825
		
826
		<copy todir="${dist.dir}">
827
			<fileset dir="./lib/spatial/geoserver" includes="*.war" />
828
		</copy>
829

    
830
	</target>
831

    
832
	<target name="install" depends="build-metacat"
833
		description="* Install Metacat For Development *">
834
		<copy file="${dist.dir}/${metacat.context}.war"
835
			todir="${app.deploy.dir}" />
836
		<delete dir="${app.deploy.dir}/${metacat.context}" />
837
		<copy file="${dist.dir}/geoserver.war"
838
					todir="${app.deploy.dir}" />
839
		<delete dir="${app.deploy.dir}/geoserver" />
840
		<copy file="${dist.dir}/metacat-index.war"
841
					todir="${app.deploy.dir}" />
842
		<delete dir="${app.deploy.dir}/metacat-index" />
843
		<copy file="${dist.dir}/metacatui.war"
844
					todir="${app.deploy.dir}" />
845
		<delete dir="${app.deploy.dir}/metacatui" />
846
		<tstamp>
847
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
848
		</tstamp>
849
		<echo>Dev install completed at ${NOW}</echo>
850
	</target>
851

    
852
	<target name="build-metacat" depends="install-ecogrid, install-spatial, dist-metacat-index, dist-metacat-ui"
853
		description="Build Metacat">
854
	</target>
855

    
856
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
857
		if="enable.ecogrid" description="Install Ecogrid Compentent">
858
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
859
			inheritall="false">
860
			<property name="context" value="${metacat.context}" />
861
			<property name="target" value="${ecogrid-target-name}" />
862
		</ant>
863
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
864
			inheritall="false">
865
			<property name="context" value="${metacat.context}" />
866
			<property name="target" value="${ecogrid-target-name}" />
867
			<property name="metacat.dir" value="${basedir}"/>
868
		</ant>
869
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
870
			<webinf dir="${ecogrid-dir}/lib">
871
			<include name="server-config.wsdd"/>
872
			</webinf>
873
			</war -->
874
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
875
			todir="${dist.dir}" overwrite="true" />
876

    
877

    
878
	</target>
879

    
880
	<target name="get-ecogrid" depends="init"
881
		description="Check out ecogrid module" if="ecogrid.required">
882
		<svn>
883
			<export srcUrl="${svn.ecogridUrl}" force="true"
884
				destPath="${ecogrid-dir}" />
885
		</svn>
886
	</target>
887

    
888
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
889
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
890
		<property name="context" value="${metacat.context}"/>
891
		<property name="target" value="${ecogrid-target-name}"/>
892
		<property name="metacat.dir" value="."/>
893
		<property name="hostname" value="${ecogrid.hostname}"/>
894
		<property name="port" value="${config.port}"/>
895
		</ant>
896
		</target -->
897

    
898
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
899
		description="Automately generate wsdd for ecogrid service">
900
		<delete
901
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
902
	</target>
903

    
904
	<target name="install-skin" depends="init"
905
		description="Install a Skin">
906

    
907
		<input message="Please enter name of the skin"
908
			addproperty="skin-name" />
909

    
910
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
911
		<copy todir="${installdir}/style/skins/${skin-name}"
912
			filtering="yes">
913
			<fileset dir="lib/style/skins/${skin-name}">
914
				<exclude name="**/*.png" />
915
				<exclude name="**/*.gif" />
916
				<exclude name="**/*.jpg" />
917
				<exclude name="**/CVS*" />
918
				<exclude name="**/.#*" />
919
			</fileset>
920
		</copy>
921
		<copy todir="${installdir}/style/skins/${skin-name}"
922
			filtering="no">
923
			<fileset dir="lib/style/skins/${skin-name}">
924
				<include name="**/*.png" />
925
				<include name="**/*.gif" />
926
				<include name="**/*.jpg" />
927
				<exclude name="**/CVS*" />
928
				<exclude name="**/.#*" />
929
			</fileset>
930
		</copy>
931
		<copy todir="${installdir}/style/common" filtering="yes">
932
			<fileset dir="lib/style/common">
933
				<include name="*.js" />
934
				<include name="*.jsp" />
935
				<include name="*.css" />
936
				<exclude name="*.png" />
937
				<exclude name="*.gif" />
938
				<exclude name="*.jpg" />
939
				<exclude name="**/CVS*" />
940
				<exclude name="**/.#*" />
941
			</fileset>
942
		</copy>
943
		<!--
944
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
945
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
946
			<fileset dir="lib/style/skins/${skin-name}/images">
947
			<include name="*.png"/>
948
			<include name="*.gif"/>
949
			<include name="*.jpg"/>
950
			</fileset>
951
			</copy>
952
		-->
953

    
954
		<echo message="Install Skin completed." />
955
	</target>
956

    
957
	<target name="war" depends="warPrepare,install-spatial"
958
		description="Create a web archive (WAR) for servlet deployment">
959
		<mkdir dir="${dist.dir}" />
960
		<war destfile="${dist.dir}/${metacat.context}.war"
961
			webxml="${build.war}/web.xml">
962
			<fileset dir="${war.context}" />
963
			<lib dir="${war.lib}" />
964
			<webinf dir="${war.webinf}" />
965
		</war>
966
	</target>
967

    
968
	<target name="warPrepare"
969
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare,documentation"
970
		description="Prepare files for creating a web archive (WAR)">
971

    
972
		<property name="war.lib" value="${build.war}/lib" />
973
		<property name="war.webinf" value="${build.war}/WEB-INF" />
974
		<property name="war.context"
975
			value="${build.war}/${metacat.context}" />
976
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
977
		<property name="war.webinf.scripts"
978
			value="${war.webinf}/scripts" />
979
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
980
		<property name="war.context.docs" value="${war.context}/docs" />
981
		<property name="war.context.temp" value="${war.context}/temp" />
982
		<property name="war.context.templates"
983
			value="${war.context}${style-common-relpath}/templates" />
984
		<mkdir dir="${war.lib}" />
985
		<mkdir dir="${war.webinf}" />
986
		<mkdir dir="${war.context}" />
987
		<mkdir dir="${war.webinf.sql}" />
988
		<mkdir dir="${war.context.cgi}" />
989
		<mkdir dir="${war.context.docs}" />
990
		<mkdir dir="${war.context.temp}" />
991
		<mkdir dir="${war.context.templates}" />
992

    
993
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
994
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
995
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
996
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
997
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
998
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
999
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
1000
		<copy todir="${war.lib}" filtering="no">
1001
			<fileset dir="lib">
1002
				<include name="*.jar" />
1003
				<exclude name="maven-ant-tasks*.jar" />
1004
			</fileset>
1005
			<fileset dir="${libdir.mvn}" />			
1006
		</copy>
1007
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
1008
			tofile="${build.war}/web.xml" / -->
1009
		<!-- MCD added next - Remove the tomcat5 reference-->
1010
		<copy file="lib/web.xml.tomcat6" tofile="${build.war}/web.xml" />
1011
		<copy file="lib/metacat.properties" todir="${war.webinf}"
1012
			filtering="yes" />
1013
		<copy todir="${war.webinf}" filtering="yes">
1014
		    <fileset dir="lib/account-web-info">
1015
		       <exclude name="web.xml" />
1016
		    </fileset>
1017
		</copy>
1018
		<copy file="lib/solrQueryFieldDescriptions.properties" todir="${war.webinf}"/>
1019
		<copy file="lib/metacat.properties.metadata.xml"
1020
			todir="${war.webinf}" filtering="no" />
1021
		<copy file="lib/org.properties.metadata.xml"
1022
			todir="${war.webinf}" filtering="no" />
1023
		<copy file="lib/auth.properties.metadata.xml"
1024
			todir="${war.webinf}" filtering="no" />
1025
		<copy todir="${war.webinf}" filtering="yes">
1026
			<fileset dir="lib">
1027
				<include name="skin.configs/**" />
1028
			</fileset>
1029
		</copy>
1030
		<copy file="lib/log4j.properties" todir="${war.webinf}"
1031
			filtering="yes" />
1032
		<copy file="lib/hazelcast.xml" todir="${war.webinf}"
1033
			filtering="yes" />
1034
		<copy file="lib/oa4mp_client.xml" todir="${war.webinf}"
1035
			filtering="yes" />
1036
		<copy todir="${war.context}" filtering="no">
1037
			<fileset dir="lib">
1038
				<include name="**/*.jpg" />
1039
				<include name="**/*.png" />
1040
				<include name="**/*.gif" />
1041
				<include name="LiveMap_30/**" />
1042
				<include name="oaipmh/**" />
1043
			</fileset>
1044
		</copy>
1045
		<copy todir="${war.context}" filtering="yes">
1046
			<fileset dir="lib">
1047
				<exclude name="*.jar" />
1048
				<exclude name="*.properties" />
1049
				<exclude name="*.metadata.xml" />
1050
				<exclude name="web.xml" />
1051
				<exclude name="**/*.jpg" />
1052
				<exclude name="**/*.png" />
1053
				<exclude name="**/*.gif" />
1054
				<exclude name="lsid_lib/**" />
1055
				<exclude name="lsid_conf/**" />
1056
				<exclude name="LiveMap_30/**" />
1057
				<exclude name="oaipmh/**" />
1058
				<exclude name="maven/**" />
1059
				<exclude name="skin.configs/**" />
1060
				<exclude name="spatial/geoserver/**" />
1061
			</fileset>
1062
		</copy>
1063
		<copy todir="${war.context}" filtering="no">
1064
			<fileset dir="lib">
1065
				<include name="spatial/geoserver/data/**" />
1066
			</fileset>
1067
		</copy>
1068
		<copy todir="${war.context.docs}" filtering="no">
1069
			<fileset dir="${build.docs}" />
1070
		</copy>
1071
		<copy todir="${war.webinf.sql}" filtering="yes">
1072
			<fileset dir="src">
1073
				<include name="**/*.sql" />
1074
			</fileset>
1075
		</copy>
1076
		<copy todir="${war.webinf.scripts}" filtering="yes">
1077
			<fileset dir="src/scripts" />
1078
		</copy>
1079
		<copy todir="${war.webinf.scripts}"
1080
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
1081
			failonerror="false" />
1082

    
1083
		<copy file="src/perl/register-dataset.cgi"
1084
			todir="${war.context.cgi}" />
1085
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1086
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1087

    
1088
		<!-- registry cgi section -->
1089
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
1090
			used in readDocumentFromMetacat -->
1091
		<!-- TODO MCD copy temp files to actual location using config util?? -->
1092
		<copy todir="${war.context.temp}" filtering="yes">
1093
			<fileset dir="lib/style/common/emlb6toeml2">
1094
				<include name="*.xsl" />
1095
				<include name="*.xml" />
1096
			</fileset>
1097
		</copy>
1098
		<available file="lib/style/common/emlb6toeml2" type="dir"
1099
			property="styles.not.needed" />
1100

    
1101
		<!-- ldap cgi section -->
1102
		<copy todir="${war.context.templates}">
1103
			<fileset dir="lib/style/common/templates">
1104
				<!-- SCW: Copy all files -->
1105
			</fileset>
1106
		</copy>
1107
	</target>
1108

    
1109
	<target name="cgiPrepare" if="build.perl">
1110
		<exec dir="src/perl/Metacat/" executable="make">
1111
			<arg value="clean" />
1112
		</exec>
1113
		<exec dir="src/perl/Metacat/" executable="perl">
1114
			<arg value="Makefile.PL" />
1115
		</exec>
1116
		<exec dir="src/perl/Metacat/" executable="make" />
1117
	</target>
1118

    
1119
	<target name="testPrepare"
1120
		description="Copies test files into the war directories">
1121
		<echo>in testPrepare</echo>
1122
		<property name="war.context.test"
1123
			value="${build.war}/${metacat.context}/test" />
1124
		<mkdir dir="${war.context.test}" />
1125
		<copy todir="${war.context.test}" filtering="yes">
1126
			<fileset dir="test/servertestfiles">
1127
				<include name="*/**" />
1128
			</fileset>
1129
		</copy>
1130
	</target>
1131

    
1132
	<target name="getConversionXSL" depends="prepare"
1133
		unless="styles.not.needed"
1134
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1135

    
1136
		<svn>
1137
			<export srcUrl="${svn.eml2StyleUrl}"
1138
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1139
		</svn>
1140

    
1141
		<mkdir dir="lib/style/common/emlb6toeml2" />
1142
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1143
			<fileset
1144
				dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1145
				<include name="*.xsl" />
1146
				<include name="*.xml" />
1147
			</fileset>
1148
		</copy>
1149
	</target>
1150

    
1151
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1152
		<mkdir dir="${build.tests}" />
1153
		<copy todir="${build.tests}" encoding="UTF-8">
1154
			<fileset dir="${testdir}">
1155
				<include name="edu/**" />
1156
			</fileset>
1157
		</copy>
1158
		<copy todir="${build.tests}" file="${testdir}/test.properties" />
1159

    
1160
		<path id="test.classpath">
1161
			<path refid="compile.classpath" />
1162
			<fileset dir="${build.dir}">
1163
				<include name="${name}.jar" />
1164
				<include name="${name}-client.jar" />
1165
				<include name="harvester.jar" />
1166
			</fileset>
1167
		</path>
1168
		
1169
		<pathconvert pathsep="${line.separator}|  |--" 
1170
		             property="echo.test.classpath"
1171
		             refid="test.classpath">
1172
		</pathconvert>
1173
		<echo message="|--test classpath" />
1174
		<echo message="|  |" />
1175
		<echo message="|  |-- ${echo.test.classpath}" />
1176
		
1177
		<!-- copy and compile the tests into a jar file -->
1178
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1179
			debug="on" includes="**/*.java" encoding="UTF-8">
1180
			<classpath refid="test.classpath" />
1181
		</javac>
1182

    
1183
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1184
			basedir="${build.tests}" >
1185
			<include name="**/*.class"/>
1186
			<include name="**/*.xml"/>
1187
		</jar>	
1188
		
1189
	</target>
1190

    
1191
	<target name="runoneclass" depends="testprep"
1192
		description="Uses the ant to run a class">
1193
		
1194
		<java classname="${classtorun}" fork="true">
1195
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1196
			<classpath>
1197
				<path refid="test.classpath" />
1198
				<fileset dir="${build.dir}">
1199
					<include name="${name}.jar" />
1200
					<include name="${name}-client.jar" />
1201
					<include name="harvester.jar" />
1202
					<include name="${name}-junittests.jar" />
1203
				</fileset>
1204
			</classpath>
1205
		</java>
1206
	</target>
1207
	
1208
	<target name="test" depends="testprep"
1209
		description="Uses the ant junit task to run all JUnit tests">
1210

    
1211
		<!-- use the ant "junit" task to run JUnit tests. -->
1212
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1213
			haltonerror="no">
1214
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1215
			<classpath>
1216
				<path refid="test.classpath" />
1217
				<fileset dir="${build.dir}">
1218
					<include name="${name}.jar" />
1219
					<include name="${name}-client.jar" />
1220
					<include name="harvester.jar" />
1221
					<include name="${name}-junittests.jar" />
1222
				</fileset>
1223
			</classpath>
1224

    
1225
			<formatter type="plain" />
1226

    
1227
			<batchtest fork="yes" todir="${build.dir}">
1228
				<fileset dir="${build.tests}">
1229
					<include name="**/*.class" />
1230
					<exclude name="**/MCTestCase.class" />
1231
					<exclude name="**/ClientViewHelperTest.class" />
1232
					<!-- these are not test cases -->
1233
					<exclude name="**/MockCNode.class" />
1234
					<exclude name="**/D1NodeServiceTest.class" />
1235
					<exclude name="**/QueryRunner.class" />
1236
					<exclude name="**/MockObjectPathMap.class" />
1237
					<exclude name="**/HzObjectPathMapTest$1.class" />
1238
					<exclude name="**/HzObjectPathMapTest$2.class" />
1239
				</fileset>
1240
			</batchtest>
1241
		</junit>
1242
	</target>
1243

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

    
1247
		<echo>testtorun: ${testtorun}</echo>
1248

    
1249
		<!-- use the ant "junit" task to run JUnit tests. -->
1250
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1251
			haltonerror="no" showoutput="yes">
1252
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1253
			<classpath>
1254
				<path refid="test.classpath" />
1255
				<fileset dir="${build.dir}">
1256
					<include name="${name}.jar" />
1257
					<include name="${name}-client.jar" />
1258
					<include name="harvester.jar" />
1259
					<include name="${name}-junittests.jar" />
1260
				</fileset>
1261
			</classpath>
1262

    
1263
			<formatter type="plain" />
1264

    
1265
			<batchtest fork="yes" todir="${build.dir}">
1266
				<fileset dir="${build.tests}">
1267
					<include name="**/${testtorun}.class" />
1268
				</fileset>
1269
			</batchtest>
1270
		</junit>
1271
	</target>
1272
	
1273
	<target name="run" depends="testprep"
1274
			description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1275

    
1276
			<echo>testtorun: ${testtorun}</echo>
1277

    
1278
			<!-- use the ant "junit" task to run JUnit tests. -->
1279
			<junit printsummary="yes" haltonfailure="no" fork="yes"
1280
				haltonerror="no" showoutput="yes">
1281
				<jvmarg value="-Dfile.encoding=UTF-8"/>
1282
				<classpath>
1283
					<path refid="test.classpath" />
1284
					<fileset dir="${build.dir}">
1285
						<include name="${name}.jar" />
1286
						<include name="${name}-client.jar" />
1287
						<include name="harvester.jar" />
1288
						<include name="${name}-junittests.jar" />
1289
					</fileset>
1290
				</classpath>
1291

    
1292
				<formatter type="plain" />
1293

    
1294
				<batchtest fork="yes" todir="${build.dir}">
1295
					<fileset dir="${build.tests}">
1296
						<include name="**/${testtorun}.class" />
1297
					</fileset>
1298
				</batchtest>
1299
			</junit>
1300
		</target>
1301

    
1302
	<target name="testharvester" depends="testprep"
1303
		description="Uses the ant junit task to test only the Harvester code">
1304
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1305
			haltonerror="off">
1306
			<classpath>
1307
				<path refid="compile.classpath" />
1308
				<fileset dir="${build.dir}">
1309
					<include name="${name}.jar" />
1310
					<include name="${name}-client.jar" />
1311
					<include name="harvester.jar" />
1312
					<include name="${name}-junittests.jar" />
1313
				</fileset>
1314
			</classpath>
1315
			<formatter type="plain" />
1316
			<batchtest fork="yes" todir="${build.dir}">
1317
				<fileset dir="${build.tests}">
1318
					<include name="**/harvesterClient/*.class" />
1319
				</fileset>
1320
			</batchtest>
1321
		</junit>
1322
	</target>
1323

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

    
1328
		<echo>
1329
			*********************************** Please run ant
1330
			gethttpclient first! ***********************************
1331
		</echo>
1332
		<!-- copy and compile the tests into a jar file -->
1333
		<mkdir dir="${build.metacatnettest}" />
1334
		<javac srcdir="${junitnettestsdir}"
1335
			destdir="${build.metacatnettest}" includes="**/*.java">
1336
			<classpath>
1337
				<path refid="compile.classpath" />
1338
				<fileset dir="${build.dir}">
1339
					<include name="${name}.jar" />
1340
				</fileset>
1341
			</classpath>
1342
		</javac>
1343

    
1344
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1345
			basedir="${build.metacatnettest}" includes="**/*.class" />
1346

    
1347
		<!-- use the ant "junit" task to run JUnit tests. -->
1348
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1349
			haltonerror="no">
1350
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1351
			<classpath>
1352
				<path refid="compile.classpath" />
1353
				<fileset dir="${build.dir}">
1354
					<include name="${name}.jar" />
1355
					<include name="${name}-junitnettests.jar" />
1356
				</fileset>
1357
			</classpath>
1358

    
1359
			<formatter type="plain" />
1360

    
1361
			<batchtest fork="yes" todir="${build.dir}">
1362
				<fileset dir="${build.metacatnettest}">
1363
					<include name="**/*.class" />
1364
				</fileset>
1365
			</batchtest>
1366
		</junit>
1367
	</target>
1368

    
1369
	<target name="cleanweb" depends="clean"
1370
		description="deletes tomcat web context dir and all its contents">
1371
		<delete dir="${installdir}" />
1372
	</target>
1373

    
1374

    
1375
	<target name="clean" depends="init"
1376
		description="deletes build dir and files that can be regenerated form the release">
1377
		<delete dir="${build.dir}" />
1378
		<delete dir="${dist.dir}" />
1379
	</target>
1380

    
1381
	<target name="localclean" depends="clean"
1382
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1383
		<delete file="lib/utilities.jar" />
1384
	</target>
1385

    
1386
	<target name="fullclean" depends="localclean"
1387
		description="deletes code and eml">
1388
		<delete includeEmptyDirs="true" failonerror="false">
1389
			<fileset dir="${style-common-cvsrelpath}">
1390
				<include name="${eml-css}" />
1391
				<include name="eml-*/*.xsl" />
1392
				<include name="eml-*" />
1393
			</fileset>
1394
			<fileset dir="${schema-cvsrelpath}">
1395
				<include name="eml-*/*.xsd" />
1396
			</fileset>
1397
			<fileset dir="${ecogrid-dir}"/>
1398
			<fileset dir="lib/style/common/emlb6toeml2"/>
1399
			<fileset dir="lib/dtd"/>
1400
			<fileset dir="lib/schema"/>
1401
			<fileset dir="${utilitiesdir}"/>
1402
			<fileset dir="${libdir.mvn}"/>
1403
		</delete>
1404
		<!-- remove the entire directory -->
1405
		<delete includeemptydirs="true" dir="${metacatui.build.dir}" />
1406
		<!-- clean up the distribution files if they exist-->
1407
		<delete file="./${name}-bin-${release}.tar.gz" />
1408
		<delete file="./${name}-src-${release}.tar.gz" />
1409
		<delete file="./${name}-bin-${release}.zip" />
1410
		<delete file="./${name}-src-${release}.zip" />
1411
	</target>
1412
	
1413
	<target name="documentation" depends="javadoc,admindoc"
1414
	    description="generates Javadoc API documentation and Admin Guide">
1415
    </target>
1416
	
1417
	<target name="admindoc" depends="prepare">
1418
		<!-- Build the administrator's guide, which is a Sphinx RST project
1419
		     For this to succeed, you must have Sphinx installed on your machine
1420
		     See: http://sphinx.pocoo.org/ for details
1421
		     And you must also have the 'make' build tool installed
1422
		-->
1423
		<exec dir="${docdir}/user/metacat" executable="make"> 
1424
		        <arg value="plantuml"/> 
1425
		</exec>
1426
		
1427
		<exec dir="${docdir}/user/metacat" executable="make"> 
1428
		        <arg value="html"/> 
1429
		</exec>
1430
		
1431
    </target>
1432

    
1433
	<target name="javadoc" depends="prepare"
1434
		description="generates Javadoc API documentation">
1435
		<javadoc packagenames="edu.ucsb.nceas.*"
1436
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1437
			version="true" use="true" windowtitle="${Name} API"
1438
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1439
			bottom="&lt;i&gt;Copyright &#169; ${copyright}. All Rights Reserved.&lt;/i&gt;">
1440
			<classpath>
1441
				<path refid="compile.classpath" />
1442
			</classpath>
1443
		</javadoc>
1444
	</target>
1445

    
1446
	<target name="dist"
1447
		depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL,getutilities"
1448
		description="prepares a full release distribution">
1449
		<mkdir dir="${dist.dir}" />
1450
		<delete dir="${ver.dir}" />
1451
		<mkdir dir="${ver.dir}" />
1452
		<copy todir="${ver.dir}">
1453
			<fileset dir="."
1454
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1455
		</copy>
1456
		<copy todir="${ver.dir}" file="build.xml" />
1457
		<copy todir="${ver.dir}" file="build.properties" />
1458

    
1459
		<copy todir="${ver.dir}/docs" filtering="yes">
1460
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1461
		</copy>
1462
		<copy todir="${ver.dir}/docs" filtering="no">
1463
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1464
		</copy>
1465
		<copy todir="${ver.dir}/docs/dev">
1466
			<fileset dir="${build.dir}/docs" />
1467
		</copy>
1468
		<copy todir="${ver.dir}/src">
1469
			<fileset dir="${build.dir}/src" />
1470
		</copy>
1471

    
1472
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1473
		<copy todir="${ver.dir}/test/servertestfiles">
1474
			<fileset dir="./test/servertestfiles" />
1475
		</copy>
1476
	</target>
1477

    
1478
	<target name="fulldist" depends="distbin, distsrc"
1479
			description="full distribution - source and bin"/>
1480
		
1481
	<target name="distbin" depends="build-metacat,war-lsid"
1482
		description="prepares a binary distribution">
1483
		<copy todir="${dist.dir}">
1484
			<fileset dir="./src/scripts" />
1485
		</copy>
1486
		<delete file="./${name}-bin-${release}.zip" />
1487
		<zip zipfile="./${name}-bin-${release}.zip"
1488
			basedir="${dist.dir}" />
1489
		<delete file="./${name}-bin-${release}.tar.gz" />
1490
		<tar tarfile="./${name}-bin-${release}.tar"
1491
			basedir="${dist.dir}" />
1492
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1493
			src="./${name}-bin-${release}.tar" />
1494
		<delete file="./${name}-bin-${release}.tar" />
1495
	</target>
1496

    
1497
	<target name="distsrc" depends="dist"
1498
		description="prepares a source distribution">
1499
		<mkdir dir="${ver.src}" />
1500
		<copy todir="${ver.src}">
1501
			<fileset dir="./src" />
1502
		</copy>
1503
		<mkdir dir="${util.dir}" />
1504
		<copy todir="${util.dir}">
1505
			<fileset dir="${utilitiesdir}" excludes="**/CVS*" />
1506
		</copy>
1507

    
1508
		<mkdir dir="${ecogrid-dist-dir}" />
1509
		<copy todir="${ecogrid-dist-dir}">
1510
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1511
		</copy>
1512

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

    
1515
		<delete file="./${name}-src-${release}.zip" />
1516
		<zip zipfile="./${name}-src-${release}.zip"
1517
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1518
		<delete file="./${name}-src-${release}.tar.gz" />
1519
		<tar tarfile="./${name}-src-${release}.tar"
1520
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1521
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1522
			src="./${name}-src-${release}.tar" />
1523
		<delete file="./${name}-src-${release}.tar" />
1524
		<!--delete dir="${dist.dir}"/ -->
1525
	</target>
1526

    
1527
	<target name="deb-package" depends="distbin"
1528
		description="create a debian installation package">
1529
		<delete dir="${deb.pkg.dir}" />
1530
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1531
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1532
			<fileset dir="./src/scripts/debian"
1533
				includes="control postinst" />
1534
		</copy>
1535

    
1536
		<mkdir
1537
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1538
		<copy
1539
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1540
			filtering="yes">
1541
			<fileset dir="./src/scripts/debian"
1542
				excludes="control postinst" />
1543
		</copy>
1544
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1545

    
1546
		<copy file="${dist.dir}/${metacat.context}.war"
1547
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1548
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1549
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1550

    
1551
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1552
			failonerror="true">
1553
			<arg line="--build debian" />
1554
		</exec>
1555

    
1556
		<move file="${pkg.dir}/debian.deb"
1557
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1558
	</target>
1559

    
1560
	<target name="stylesheettest">
1561
		<xslt in="${input}" out="eml.html"
1562
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1563
			<param name="displaymodule" expression="${displaymodule}" />
1564
			<param name="docid" expression="${input}" />
1565
			<param name="entitytype" expression="${entitytype}" />
1566
			<param name="entityindex" expression="${entityindex}" />
1567
			<outputproperty name="method" value="html" />
1568
			<outputproperty name="standalone" value="yes" />
1569
			<outputproperty name="encoding" value="iso8859_1" />
1570
			<outputproperty name="indent" value="yes" />
1571
		</xslt>
1572
	</target>
1573

    
1574
	<target name="spatial_option" depends="prepare"
1575
		description=" -- compiles code for the spatial option">
1576

    
1577
		<echo message="Compiling the metatcat shapefile creator" />
1578
		<echo message="using the shapelib at: ${shapelib.dir}" />
1579
		<exec dir="." executable="g++" os="Linux, Unix"
1580
			failonerror="true">
1581
			<arg
1582
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1583
		</exec>
1584

    
1585
		<exec dir="." executable="g++" os="Linux, Unix"
1586
			failonerror="true">
1587
			<arg
1588
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1589
		</exec>
1590
	</target>
1591

    
1592
	<!-- LSID Authority support -->
1593
	<patternset id="lsid.jars">
1594
		<include name="axis.jar" />
1595
		<include name="commons-discovery-0.2.jar" />
1596
		<include name="jaxrpc.jar" />
1597
		<include name="lsid-client-1.1.1.jar" />
1598
		<include name="lsid-server-1.1.1.jar" />
1599
		<include name="saaj.jar" />
1600
		<include name="wsdl4j-1.5.1.jar" />
1601
		<include name="activation.jar" />
1602
		<include name="castor-0.9.5.jar" />
1603
		<include name="dnsjava-1.3.2.jar" />
1604
		<include name="mail.jar" />
1605
		<include name="commons-logging-1.0.4.jar" />
1606
		<!-- These jars may be needed but seem to not actually be,
1607
			so leaving them out for now
1608
			<include name="axis-ant.jar" />
1609
		-->
1610
		<!--<include name="GenCastor.class" />-->
1611
	</patternset>
1612
	<patternset id="lib.jars">
1613
		<include name="log4j-1.2.12.jar" />
1614
		<include name="utilities.jar" />
1615
		<include name="xerces*.jar" />
1616
		<include name="xalan*.jar" />
1617
		<include name="xml-apis*.jar" />
1618
	</patternset>
1619

    
1620
	<path id="lsid.classpath">
1621
		<fileset dir="${lsid.lib.dir}">
1622
			<patternset refid="lsid.jars" />
1623
		</fileset>
1624
		<fileset dir="${lib.dir}">
1625
			<patternset refid="lib.jars" />
1626
		</fileset>
1627
		<fileset dir="${build.dir}">
1628
			<include name="metacat-client.jar" />
1629
			<include name="metacat.jar" />
1630
		</fileset>
1631
	</path>
1632

    
1633
	<filterset id="configFilters">
1634
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1635
			value="${config.hostname}" / -->
1636
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1637
			value="${config.port}" / -->
1638
		<!-- MCD BYE filter token="METADATA_LABELS"
1639
			value="${config.metadataLabelLsid}" / -->
1640
		<!-- MCD BYE filter token="METACAT_SERVER"
1641
			value="${config.metacatserver}" / -->
1642
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1643
			value="${config.lsidauthority}" / -->
1644
	</filterset>
1645

    
1646
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1647
		description="Configure files prior to compilation">
1648
		<mkdir dir="${lsid.build.dir}" />
1649
		<!-- Copy the properties file into the build -->
1650
		<copy file="${conf.dir}/metacat-lsid.properties"
1651
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1652
			overwrite="true">
1653
			<filterset refid="configFilters" />
1654
		</copy>
1655
		<copy file="${conf.dir}/log4j.properties"
1656
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1657
			overwrite="true">
1658
			<filterset refid="configFilters" />
1659
		</copy>
1660
		<!-- Copy config files into the build -->
1661
		<copy todir="${lsid.build.dir}/WEB-INF">
1662
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1663
		</copy>
1664
		<!-- Copy the metadata configuration files into the build -->
1665
		<mkdir
1666
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1667
		<copy
1668
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1669
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1670
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1671
			<filterset refid="configFilters" />
1672
		</copy>
1673
		<!-- Copy services files into the build -->
1674
		<mkdir dir="${lsid.build.dir}/services" />
1675
		<copy todir="${lsid.build.dir}/services">
1676
			<fileset dir="${services.dir}" />
1677
			<filterset refid="configFilters" />
1678
		</copy>
1679
		<!-- Copy axis files into the build -->
1680
		<mkdir dir="${lsid.build.dir}" />
1681
		<copy todir="${lsid.build.dir}">
1682
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1683
		</copy>
1684
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1685
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1686
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1687
		</copy>
1688
	</target>
1689

    
1690
	<target name="compile-lsid" depends="prepare-lsid"
1691
		description="Compile Java sources">
1692
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1693
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1694
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1695
			deprecation="${compile.deprecation}"
1696
			optimize="${compile.optimize}">
1697
			<classpath>
1698
				<path refid="compile.classpath" />
1699
				<fileset dir="${build.dir}">
1700
					<include name="${name}.jar" />
1701
				</fileset>
1702
			</classpath>
1703
		</javac>
1704
	</target>
1705

    
1706
	<target name="war-lsid" depends="compile-lsid"
1707
		description="Create a war file for the application">
1708
		<mkdir dir="${dist.dir}" />
1709
		<war destfile="${dist.dir}/${authority.context}.war"
1710
			webxml="${webinf.dir}/web.xml">
1711
			<fileset dir="${lsid.build.dir}" />
1712
			<lib dir="${lsid.lib.dir}">
1713
				<patternset refid="lsid.jars" />
1714
			</lib>
1715
			<lib dir="${lib.dir}">
1716
				<patternset refid="lib.jars" />
1717
			</lib>
1718
			<lib dir="${lib.dir}">
1719
				<include name="xalan.jar" />
1720
				<include name="xml-apis.jar" />
1721
			</lib>
1722
			<lib dir="${build.dir}">
1723
				<include name="metacat-client.jar" />
1724
			</lib>
1725
		</war>
1726
	</target>
1727

    
1728
	<target name="deploy-lsid" depends="war-lsid"
1729
		description="Deploy LSID war to servlet container">
1730
		<delete dir="${app.deploy.dir}/${authority.context}" />
1731
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1732
		<mkdir dir="${app.deploy.dir}" />
1733
		<copy todir="${app.deploy.dir}">
1734
			<fileset dir="${dist.dir}" />
1735
		</copy>
1736
	</target>
1737
	
1738
	<target name="change-metacat-properties" depends="warPrepare"
1739
        description="Chage some default values of metacat.properties">
1740
       <echo file="${metacat-properties-file}" append="true">
1741
		   configutil.propertiesConfigured=true
1742
		   configutil.authConfigured=true
1743
           configutil.skinsConfigured=true
1744
		   configutil.databaseConfigured=true
1745
		   configutil.geoserverConfigured=true
1746
	   </echo>
1747
  </target>
1748
	
1749
	<!-- This target will use default values in svn metacat.properties to build a configured 
1750
		metacat (except configuti.* properties, they will be set true). Those default settings
1751
		are for a test machine. It may not work on your system-->
1752
	<target name="install-configured-metacat" depends="change-metacat-properties, install"
1753
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1754
    </target>
1755
	
1756
	<!-- build metacat-common jar -->
1757
	<target name="build-metacat-common" description="Calls the Maven build for metacat-common jar" unless="build-metacat-common-called" >
1758
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1759
		            <arg value="clean"/>
1760
		</artifact:mvn>
1761
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1762
		   <arg value="install"/>
1763
		</artifact:mvn>
1764
		<property name="build-metacat-common-called" value="true"/>
1765
	</target>
1766

    
1767
	<!-- build metacat-index war -->
1768
	<target name="build-metacat-index" description="Calls the Maven build for metacat-index.war" >		
1769
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1770
			<arg value="clean"/>
1771
		</artifact:mvn>
1772
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1773
			<arg value="package"/>
1774
			<!--<arg value="-Dmaven.test.skip=true"/>-->
1775
		</artifact:mvn>
1776
	</target>
1777
	
1778
	<target name="dist-metacat-index" depends="init, build-metacat-index" description="Copy metacat-index.war to dist folder" >		
1779
		<copy tofile="${dist.dir}/metacat-index.war" >
1780
			<fileset dir="metacat-index/target" includes="metacat-index*.war"></fileset>
1781
		</copy>	
1782
	</target>
1783
	
1784
	<target name="install-metacat-index" depends="dist-metacat-index" description="Copy metacat-index.war to deploy folder" >		
1785
		<copy todir="${app.deploy.dir}" file="${dist.dir}/metacat-index.war" />
1786
	</target>
1787
	
1788
	<!-- Generate a light war file which only is used to manage the ldap user accounts - register a new user, reset and change the password -->
1789
	<target name="war-identity" depends="warPrepare" description="Generate a light war file which only is used to manage the ldap user accounts - register a new user, reset and change the password">
1790
		  <property name="war-name" value="identity" />
1791
		  <mkdir dir="${dist.dir}" />
1792
		     <war destfile="${dist.dir}/${war-name}.war"
1793
		            webxml="lib/account-web-info/web.xml">
1794
		      <webinf dir="${war.webinf}">
1795
		        <include name="metacat.properties"/>
1796
		        <include name="gd_intermediate_bundle_ldap_dev.crt"/>
1797
		      </webinf>
1798
		      <fileset dir="${war.context}">
1799
		        <include name="cgi-bin/**"/>
1800
		      	<include name="style/**"/>  
1801
		      </fileset>
1802
		      
1803
		   </war>
1804
	</target>
1805
	
1806
</project>
(5-5/7)