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: 2014-05-29 15:47:06 -0700 (Thu, 29 May 2014) $'
11
	*    '$Revision: 8803 $'
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 = "checkout" dir = "@{dest}">
76
	        	<args>
77
	                <arg value = "@{refname}" />
78
	            </args>
79
	        </git>
80
	    	<git command = "pull" dir = "@{dest}" >
81
	        	<args>
82
	                <arg value = "@{repository}" />
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="installdir"
144
			value="${app.deploy.dir}/${metacat.context}" />
145

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

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

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

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

    
215
		<!-- It is less likely you'll need to make any changes from here down,
216
			but customization is possible -->
217
		<property name="name" value="metacat" />
218
		<property name="Name" value="MetaCat" />
219
		<property name="debugprefix" value="${Name}:" />
220
		<property name="release" value="${metacat.version}" />
221
		<tstamp>
222
		    <format property="copyrightyear" pattern="yyyy" locale="en,US"/>
223
		</tstamp>
224
		<property name="copyright" value="${copyrightyear} Regents of the University of California" />
225
		<property name="style-common-relpath" value="/style/common" />
226
		<property name="style-shared-relpath" value="/style/shared" />
227
		<property name="schema-relpath" value="/schema" />
228
		<property name="style-common-cvsrelpath"
229
			value="lib${style-common-relpath}" />
230
		<property name="schema-cvsrelpath" value="lib${schema-relpath}" />
231
		<property name="style-skins-relpath" value="/style/skins" />
232
		<property name="seek-tag" value="branches/ECOGRID_1_2_3" />
233
		<property name="eml-module" value="eml" />
234
		<property name="eml-version" value="2.0.0beta6" />
235
		<property name="eml-beta4-version" value="2.0.0beta4" />
236
		<property name="eml-beta-tag"
237
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
238
		<property name="eml-beta4-tag"
239
					value="RELEASE_EML_2_BETA_4" />
240
		<property name="eml2_0_0-schema-tag"
241
			value="RELEASE_EML_2_0_0_UPDATE_1" />
242
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
243
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
244
		<property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1" />
245
		<!--<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_7" />-->
246
		<property name="eml2-style-tag" value="trunk" />
247

    
248
		<property name="eml2_0_0namespace"
249
			value="eml://ecoinformatics.org/eml-2.0.0" />
250
		<property name="eml2_0_1namespace"
251
			value="eml://ecoinformatics.org/eml-2.0.1" />
252
		<property name="eml2_1_0namespace"
253
			value="eml://ecoinformatics.org/eml-2.1.0" />
254
		<property name="eml2_1_1namespace"
255
			value="eml://ecoinformatics.org/eml-2.1.1" />
256
		<property name="stmmlnamespace"
257
			value="http://www.xml-cml.org/schema/stmml" />
258
		<property name="stmml11namespace"
259
			value="http://www.xml-cml.org/schema/stmml-1.1" />
260
		<property name="eml-css" value="eml_xsl.css" />
261
		<property name="eml-module.default.css" value="default.css" />
262
		<property name="systemidserver" value="" />
263
		<property name="html-path" value="" />
264
		<property name ="metacat-properties-file" value="build/war/WEB-INF/metacat.properties"/>
265

    
266

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

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

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

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

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

    
335

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

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

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

    
384
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
385

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

    
431
		<condition property="eml.required">
432
			<or>
433
				<not>
434
					<available file="lib/schema/eml-2.0.1/eml.xsd" />
435
				</not>
436
				<not>
437
					<available file="lib/schema/eml-2.0.0/eml.xsd" />
438
				</not>
439
				<not>
440
					<available file="lib/schema/eml-2.1.0/eml.xsd" />
441
				</not>
442
				<not>
443
					<available
444
						file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
445
				</not>
446
			</or>
447
		</condition>
448

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

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

    
477
	<target name="prepare" depends="init, resolveDependencies">
478
		<mkdir dir="${build.dir}" />
479
		<mkdir dir="${build.src}" />
480
		<mkdir dir="${build.dest}" />
481
		<mkdir dir="${build.docs}" />
482
		<mkdir dir="${build.javadocs}" />
483
		<mkdir dir="${build.tmp}" />
484

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

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

    
508
	<target name="compile" depends="prepare"
509
		description="Compiles java code to build dir, and copies metacat props files there">
510

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

    
520
	<target name="jar" depends="compile,geteml"
521
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
522

    
523
		<delete file="${build.dir}/${name}.jar" />
524
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
525
			excludes="**/protocols/ **/harvesterClient/" />
526
	</target>
527

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

    
535

    
536
	<target name="client" depends="prepare"
537
		description="Compiles metacat-client java code to build dir">
538
		<javac srcdir="${build.src}" destdir="${build.dest}"
539
			includes="edu/ucsb/nceas/metacat/client/*">
540
			<classpath>
541
				<path refid="compile.classpath" />
542
			</classpath>
543
		</javac>
544
	</target>
545

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

    
553
	<target name="advancedsearchjar" depends="compile"
554
		description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
555
		<delete file="${build.dir}/advancedsearch.jar" />
556
		<jar jarfile="${build.dir}/advancedsearch.jar"
557
			basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
558
	</target>
559

    
560
	<target name="harvester" depends="client"
561
		description="Compiles harvester java code to build dir">
562
		<javac srcdir="${build.src}" destdir="${build.dest}"
563
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
564
			<classpath>
565
				<path refid="compile.classpath" />
566
			</classpath>
567
		</javac>
568
	</target>
569
		
570
	<target name="harvesterjar" depends="harvester"
571
		description="Compiles and jars harvester java code to harvester.jar in build dir">
572
		<delete file="${build.dir}/harvester.jar" />
573
		<jar jarfile="${build.dir}/harvester.jar"
574
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
575
	</target>
576

    
577
	<target name="harvestListEditorDist" depends="harvesterjar"
578
		description="Prepares a distribution of the Harvest List Editor tool">
579
		<mkdir dir="${dist.dir.hle}" />
580
		<delete dir="${ver.dir.hle}" />
581
		<mkdir dir="${ver.dir.hle}" />
582
		<copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
583
		<copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
584
		<copy todir="${ver.dir.hle}"
585
			file="lib/harvester/harvestList.xsd" />
586
		<copy todir="${ver.dir.hle}"
587
			file="lib/harvester/harvestListEditor.bat" />
588
		<copy todir="${ver.dir.hle}"
589
			file="lib/harvester/harvestListEditor.sh" />
590
		<delete file="./harvest-list-editor-${release}.zip" />
591
		<zip zipfile="./harvest-list-editor-${release}.zip"
592
			basedir="${ver.dir.hle}" />
593
		<delete file="./harvest-list-editor-${release}.tar.gz" />
594
		<tar tarfile="./harvest-list-editor-${release}.tar"
595
			basedir="${ver.dir.hle}" />
596
		<gzip zipfile="./harvest-list-editor-${release}.tar.gz"
597
			src="./harvest-list-editor-${release}.tar" />
598
		<delete file="./harvest-list-editor-${release}.tar" />
599
	</target>
600

    
601
	<target name="geteml" depends="getemlpre2,getemlpre2beta4,geteml2+,getConversionXSL"
602
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
603

    
604
	<target name="getemlpre2" depends="prepare" if="eml.required"
605
		description="Checks EML-beta6 out of svn and copies dtds and xsl to your metacat sandbox">
606
		<svn>
607
			<export srcUrl="${svn.emlBetaUrl}"
608
				destPath="${build.tmp}/eml_${eml-beta-tag}" />
609
		</svn>
610
		<mkdir dir="lib/dtd" />
611
		<copy todir="lib/dtd" filtering="yes">
612
			<fileset
613
				dir="${build.tmp}/eml_${eml-beta-tag}">
614
				<include name="*.dtd" />
615
			</fileset>
616
			<mapper type="glob" from="eml-*.dtd"
617
				to="eml-*-${eml-version}.dtd" />
618
		</copy>
619

    
620
		<copy todir="${style-common-cvsrelpath}" filtering="yes">
621
			<fileset
622
				dir="${build.tmp}/eml_${eml-beta-tag}/style">
623
				<include name="**/*.xsl" />
624
			</fileset>
625
		</copy>
626
	</target>
627
	
628
	<target name="getemlpre2beta4" depends="prepare" if="eml.required"
629
			description="Checks EML-beta4 out of svn and copies dtds to your metacat sandbox">
630
			<svn>
631
				<export srcUrl="${svn.emlBeta4Url}"
632
					destPath="${build.tmp}/eml_${eml-beta4-tag}" />
633
			</svn>
634
			<mkdir dir="lib/dtd" />
635
			<copy todir="lib/dtd" filtering="yes">
636
				<fileset
637
					dir="${build.tmp}/eml_${eml-beta4-tag}">
638
					<include name="*.dtd" />
639
				</fileset>
640
				<mapper type="glob" from="eml-*.dtd"
641
					to="eml-*-${eml-beta4-version}.dtd" />
642
			</copy>
643

    
644
			<!--
645
			<copy todir="${style-common-cvsrelpath}" filtering="yes">
646
				<fileset
647
					dir="${build.tmp}/eml_${eml-beta4-tag}/style">
648
					<include name="**/*.xsl" />
649
				</fileset>
650
			</copy>
651
			-->
652
		</target>
653

    
654
	<target name="geteml2+" depends="prepare" if="eml.required"
655
		description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
656
		<svn>
657
			<export srcUrl="${svn.eml200SchemaUrl}"
658
				destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
659
		</svn>
660
		<mkdir dir="lib/schema/eml-2.0.0" />
661
		<copy todir="lib/schema/eml-2.0.0" filtering="yes">
662
			<fileset
663
				dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
664
				<include name="*.xsd" />
665
			</fileset>
666

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

    
673
		</copy>
674
		<!-- <antcall target="copyxsl">
675
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
676
			<param name="dirname" value="eml-2.0.0" />
677
			</antcall> -->
678

    
679
		<!-- Checkout eml201 for given schema tag-->
680
		<svn>
681
			<export srcUrl="${svn.eml201SchemaUrl}"
682
				destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
683
		</svn>
684
		<mkdir dir="lib/schema/eml-2.0.1" />
685
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
686
			<fileset
687
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
688
				<include name="*.xsd" />
689
			</fileset>
690
		</copy>
691

    
692
		<!-- Checkout eml201 again for given style sheet tag-->
693
		<!-- echo>Enter CVS password: </echo>
694
			<cvs cvsRoot="${cvsroot}"
695
			package="${eml-module}"
696
			tag="${eml2_0_1-style-tag}"
697
			dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
698
			<antcall target="copyxsl">
699
			<param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
700
			<param name="dirname" value="eml-2.0.1" />
701
			</antcall -->
702

    
703
		<!-- Checkout eml210 for given schema tag-->
704
		<svn>
705
			<export srcUrl="${svn.eml210SchemaUrl}"
706
				destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
707
		</svn>
708
		<mkdir dir="lib/schema/eml-2.1.0" />
709
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
710
			<fileset
711
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
712
				<include name="*.xsd" />
713
			</fileset>
714
		</copy>
715

    
716
		<!-- Checkout eml210 for given style sheet tag-->
717
		<svn>
718
			<export srcUrl="${svn.eml2StyleUrl}"
719
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
720
		</svn>
721
		<antcall target="copyxsl">
722
			<param name="cvs.tagname" value="${eml2-style-tag}" />
723
			<!-- param name="dirname" value="eml-2.1.0" / -->
724
			<param name="dirname" value="eml-2" />
725
		</antcall>
726
		
727
		<!-- Checkout eml210 for given schema tag-->
728
		<svn>
729
			<export srcUrl="${svn.eml211SchemaUrl}"
730
				destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
731
		</svn>
732
		<mkdir dir="lib/schema/eml-2.1.1" />
733
		<copy todir="lib/schema/eml-2.1.1" filtering="yes">
734
			<fileset
735
				dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
736
				<include name="*.xsd" />
737
			</fileset>
738
		</copy>
739
	</target>
740

    
741
	<target name="copyxsl"
742
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
743

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

    
746
		<copy todir="${style-common-cvsrelpath}/${dirname}"
747
			filtering="yes">
748
			<fileset
749
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
750
				<include name="**/*.xsl" />
751
			</fileset>
752
		</copy>
753

    
754

    
755
		<!-- now copy default css from eml module and put it in style-common-path
756
			dir with a new name, so other skin-specific css can import it if reqd -->
757
		<copy
758
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
759
			tofile="${style-common-cvsrelpath}/${eml-css}" />
760

    
761
	</target>
762

    
763
	<target name="correctEML201Docs" depends="jar"
764
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
765
		<copy todir="${build.dir}" file="lib/metacat.properties"
766
			filtering="yes" />
767
		<java
768
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
769
			<classpath>
770
				<path refid="compile.classpath" />
771
				<fileset dir="${build.dir}">
772
					<include name="${name}.jar" />
773
				</fileset>
774
			</classpath>
775
		</java>
776
	</target>
777

    
778
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
779
		description="Installs spatial option for metacat">
780
		
781
		<copy todir="${dist.dir}">
782
			<fileset dir="./lib/spatial/geoserver" includes="*.war" />
783
		</copy>
784

    
785
	</target>
786

    
787
	<target name="install" depends="build-metacat"
788
		description="* Install Metacat For Development *">
789
		<copy file="${dist.dir}/${metacat.context}.war"
790
			todir="${app.deploy.dir}" />
791
		<delete dir="${app.deploy.dir}/${metacat.context}" />
792
		<copy file="${dist.dir}/geoserver.war"
793
					todir="${app.deploy.dir}" />
794
		<delete dir="${app.deploy.dir}/geoserver" />
795
		<copy file="${dist.dir}/metacat-index.war"
796
					todir="${app.deploy.dir}" />
797
		<delete dir="${app.deploy.dir}/metacat-index" />
798
		<copy file="${dist.dir}/metacatui.war"
799
					todir="${app.deploy.dir}" />
800
		<delete dir="${app.deploy.dir}/metacatui" />
801
		<tstamp>
802
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
803
		</tstamp>
804
		<echo>Dev install completed at ${NOW}</echo>
805
	</target>
806

    
807
	<target name="build-metacat" depends="install-ecogrid, install-spatial, dist-metacat-index, dist-metacat-ui"
808
		description="Build Metacat">
809
	</target>
810

    
811
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
812
		if="enable.ecogrid" description="Install Ecogrid Compentent">
813
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
814
			inheritall="false">
815
			<property name="context" value="${metacat.context}" />
816
			<property name="target" value="${ecogrid-target-name}" />
817
		</ant>
818
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
819
			inheritall="false">
820
			<property name="context" value="${metacat.context}" />
821
			<property name="target" value="${ecogrid-target-name}" />
822
			<property name="metacat.dir" value="${basedir}"/>
823
		</ant>
824
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
825
			<webinf dir="${ecogrid-dir}/lib">
826
			<include name="server-config.wsdd"/>
827
			</webinf>
828
			</war -->
829
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
830
			todir="${dist.dir}" overwrite="true" />
831

    
832

    
833
	</target>
834

    
835
	<target name="get-ecogrid" depends="init"
836
		description="Check out ecogrid module" if="ecogrid.required">
837
		<svn>
838
			<export srcUrl="${svn.ecogridUrl}" force="true"
839
				destPath="${ecogrid-dir}" />
840
		</svn>
841
	</target>
842

    
843
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
844
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
845
		<property name="context" value="${metacat.context}"/>
846
		<property name="target" value="${ecogrid-target-name}"/>
847
		<property name="metacat.dir" value="."/>
848
		<property name="hostname" value="${ecogrid.hostname}"/>
849
		<property name="port" value="${config.port}"/>
850
		</ant>
851
		</target -->
852

    
853
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
854
		description="Automately generate wsdd for ecogrid service">
855
		<delete
856
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
857
	</target>
858

    
859
	<target name="install-skin" depends="init"
860
		description="Install a Skin">
861

    
862
		<input message="Please enter name of the skin"
863
			addproperty="skin-name" />
864

    
865
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
866
		<copy todir="${installdir}/style/skins/${skin-name}"
867
			filtering="yes">
868
			<fileset dir="lib/style/skins/${skin-name}">
869
				<exclude name="**/*.png" />
870
				<exclude name="**/*.gif" />
871
				<exclude name="**/*.jpg" />
872
				<exclude name="**/CVS*" />
873
				<exclude name="**/.#*" />
874
			</fileset>
875
		</copy>
876
		<copy todir="${installdir}/style/skins/${skin-name}"
877
			filtering="no">
878
			<fileset dir="lib/style/skins/${skin-name}">
879
				<include name="**/*.png" />
880
				<include name="**/*.gif" />
881
				<include name="**/*.jpg" />
882
				<exclude name="**/CVS*" />
883
				<exclude name="**/.#*" />
884
			</fileset>
885
		</copy>
886
		<copy todir="${installdir}/style/common" filtering="yes">
887
			<fileset dir="lib/style/common">
888
				<include name="*.js" />
889
				<include name="*.jsp" />
890
				<include name="*.css" />
891
				<exclude name="*.png" />
892
				<exclude name="*.gif" />
893
				<exclude name="*.jpg" />
894
				<exclude name="**/CVS*" />
895
				<exclude name="**/.#*" />
896
			</fileset>
897
		</copy>
898
		<!--
899
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
900
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
901
			<fileset dir="lib/style/skins/${skin-name}/images">
902
			<include name="*.png"/>
903
			<include name="*.gif"/>
904
			<include name="*.jpg"/>
905
			</fileset>
906
			</copy>
907
		-->
908

    
909
		<echo message="Install Skin completed." />
910
	</target>
911

    
912
	<target name="war" depends="warPrepare,install-spatial"
913
		description="Create a web archive (WAR) for servlet deployment">
914
		<mkdir dir="${dist.dir}" />
915
		<war destfile="${dist.dir}/${metacat.context}.war"
916
			webxml="${build.war}/web.xml">
917
			<fileset dir="${war.context}" />
918
			<lib dir="${war.lib}" />
919
			<webinf dir="${war.webinf}" />
920
		</war>
921
	</target>
922

    
923
	<target name="warPrepare"
924
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare,documentation"
925
		description="Prepare files for creating a web archive (WAR)">
926

    
927
		<property name="war.lib" value="${build.war}/lib" />
928
		<property name="war.webinf" value="${build.war}/WEB-INF" />
929
		<property name="war.context"
930
			value="${build.war}/${metacat.context}" />
931
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
932
		<property name="war.webinf.scripts"
933
			value="${war.webinf}/scripts" />
934
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
935
		<property name="war.context.docs" value="${war.context}/docs" />
936
		<property name="war.context.temp" value="${war.context}/temp" />
937
		<property name="war.context.templates"
938
			value="${war.context}${style-common-relpath}/templates" />
939
		<mkdir dir="${war.lib}" />
940
		<mkdir dir="${war.webinf}" />
941
		<mkdir dir="${war.context}" />
942
		<mkdir dir="${war.webinf.sql}" />
943
		<mkdir dir="${war.context.cgi}" />
944
		<mkdir dir="${war.context.docs}" />
945
		<mkdir dir="${war.context.temp}" />
946
		<mkdir dir="${war.context.templates}" />
947

    
948
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
949
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
950
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
951
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
952
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
953
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
954
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
955
		<copy todir="${war.lib}" filtering="no">
956
			<fileset dir="lib">
957
				<include name="*.jar" />
958
				<exclude name="maven-ant-tasks*.jar" />
959
			</fileset>
960
			<fileset dir="${libdir.mvn}" />			
961
		</copy>
962
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
963
			tofile="${build.war}/web.xml" / -->
964
		<!-- MCD added next - Remove the tomcat5 reference-->
965
		<copy file="lib/web.xml.tomcat6" tofile="${build.war}/web.xml" />
966
		<copy file="lib/metacat.properties" todir="${war.webinf}"
967
			filtering="yes" />
968
		<copy todir="${war.webinf}" filtering="yes">
969
		    <fileset dir="lib/account-web-info">
970
		       <exclude name="web.xml" />
971
		    </fileset>
972
		</copy>
973
		<copy file="lib/solrQueryFieldDescriptions.properties" todir="${war.webinf}"/>
974
		<copy file="lib/metacat.properties.metadata.xml"
975
			todir="${war.webinf}" filtering="no" />
976
		<copy file="lib/org.properties.metadata.xml"
977
			todir="${war.webinf}" filtering="no" />
978
		<copy file="lib/auth.properties.metadata.xml"
979
			todir="${war.webinf}" filtering="no" />
980
		<copy todir="${war.webinf}" filtering="yes">
981
			<fileset dir="lib">
982
				<include name="skin.configs/**" />
983
			</fileset>
984
		</copy>
985
		<copy file="lib/log4j.properties" todir="${war.webinf}"
986
			filtering="yes" />
987
		<copy file="lib/hazelcast.xml" todir="${war.webinf}"
988
			filtering="yes" />
989
		<copy file="lib/oa4mp_client.xml" todir="${war.webinf}"
990
			filtering="yes" />
991
		<copy todir="${war.context}" filtering="no">
992
			<fileset dir="lib">
993
				<include name="**/*.jpg" />
994
				<include name="**/*.png" />
995
				<include name="**/*.gif" />
996
				<include name="LiveMap_30/**" />
997
				<include name="oaipmh/**" />
998
			</fileset>
999
		</copy>
1000
		<copy todir="${war.context}" filtering="yes">
1001
			<fileset dir="lib">
1002
				<exclude name="*.jar" />
1003
				<exclude name="*.properties" />
1004
				<exclude name="*.metadata.xml" />
1005
				<exclude name="web.xml" />
1006
				<exclude name="**/*.jpg" />
1007
				<exclude name="**/*.png" />
1008
				<exclude name="**/*.gif" />
1009
				<exclude name="lsid_lib/**" />
1010
				<exclude name="lsid_conf/**" />
1011
				<exclude name="LiveMap_30/**" />
1012
				<exclude name="oaipmh/**" />
1013
				<exclude name="maven/**" />
1014
				<exclude name="skin.configs/**" />
1015
				<exclude name="spatial/geoserver/**" />
1016
			</fileset>
1017
		</copy>
1018
		<copy todir="${war.context}" filtering="no">
1019
			<fileset dir="lib">
1020
				<include name="spatial/geoserver/data/**" />
1021
			</fileset>
1022
		</copy>
1023
		<copy todir="${war.context.docs}" filtering="no">
1024
			<fileset dir="${build.docs}" />
1025
		</copy>
1026
		<copy todir="${war.webinf.sql}" filtering="yes">
1027
			<fileset dir="src">
1028
				<include name="**/*.sql" />
1029
			</fileset>
1030
		</copy>
1031
		<copy todir="${war.webinf.scripts}" filtering="yes">
1032
			<fileset dir="src/scripts" />
1033
		</copy>
1034
		<copy todir="${war.webinf.scripts}"
1035
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
1036
			failonerror="false" />
1037

    
1038
		<copy file="src/perl/register-dataset.cgi"
1039
			todir="${war.context.cgi}" />
1040
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1041
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1042

    
1043
		<!-- registry cgi section -->
1044
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
1045
			used in readDocumentFromMetacat -->
1046
		<!-- TODO MCD copy temp files to actual location using config util?? -->
1047
		<copy todir="${war.context.temp}" filtering="yes">
1048
			<fileset dir="lib/style/common/emlb6toeml2">
1049
				<include name="*.xsl" />
1050
				<include name="*.xml" />
1051
			</fileset>
1052
		</copy>
1053
		<available file="lib/style/common/emlb6toeml2" type="dir"
1054
			property="styles.not.needed" />
1055

    
1056
		<!-- ldap cgi section -->
1057
		<copy todir="${war.context.templates}">
1058
			<fileset dir="lib/style/common/templates">
1059
				<!-- SCW: Copy all files -->
1060
			</fileset>
1061
		</copy>
1062
	</target>
1063

    
1064
	<target name="cgiPrepare" if="build.perl">
1065
		<exec dir="src/perl/Metacat/" executable="make">
1066
			<arg value="clean" />
1067
		</exec>
1068
		<exec dir="src/perl/Metacat/" executable="perl">
1069
			<arg value="Makefile.PL" />
1070
		</exec>
1071
		<exec dir="src/perl/Metacat/" executable="make" />
1072
	</target>
1073

    
1074
	<target name="testPrepare"
1075
		description="Copies test files into the war directories">
1076
		<echo>in testPrepare</echo>
1077
		<property name="war.context.test"
1078
			value="${build.war}/${metacat.context}/test" />
1079
		<mkdir dir="${war.context.test}" />
1080
		<copy todir="${war.context.test}" filtering="yes">
1081
			<fileset dir="test/servertestfiles">
1082
				<include name="*/**" />
1083
			</fileset>
1084
		</copy>
1085
	</target>
1086

    
1087
	<target name="getConversionXSL" depends="prepare"
1088
		unless="styles.not.needed"
1089
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1090

    
1091
		<svn>
1092
			<export srcUrl="${svn.eml2StyleUrl}"
1093
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1094
		</svn>
1095

    
1096
		<mkdir dir="lib/style/common/emlb6toeml2" />
1097
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1098
			<fileset
1099
				dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1100
				<include name="*.xsl" />
1101
				<include name="*.xml" />
1102
			</fileset>
1103
		</copy>
1104
	</target>
1105

    
1106
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1107
		<mkdir dir="${build.tests}" />
1108
		<copy todir="${build.tests}" encoding="UTF-8">
1109
			<fileset dir="${testdir}">
1110
				<include name="edu/**" />
1111
			</fileset>
1112
		</copy>
1113
		<copy todir="${build.tests}" file="${testdir}/test.properties" />
1114

    
1115
		<path id="test.classpath">
1116
			<path refid="compile.classpath" />
1117
			<fileset dir="${build.dir}">
1118
				<include name="${name}.jar" />
1119
				<include name="${name}-client.jar" />
1120
				<include name="harvester.jar" />
1121
			</fileset>
1122
		</path>
1123
		
1124
		<pathconvert pathsep="${line.separator}|  |--" 
1125
		             property="echo.test.classpath"
1126
		             refid="test.classpath">
1127
		</pathconvert>
1128
		<echo message="|--test classpath" />
1129
		<echo message="|  |" />
1130
		<echo message="|  |-- ${echo.test.classpath}" />
1131
		
1132
		<!-- copy and compile the tests into a jar file -->
1133
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1134
			debug="on" includes="**/*.java" encoding="UTF-8">
1135
			<classpath refid="test.classpath" />
1136
		</javac>
1137

    
1138
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1139
			basedir="${build.tests}" >
1140
			<include name="**/*.class"/>
1141
			<include name="**/*.xml"/>
1142
		</jar>	
1143
		
1144
	</target>
1145

    
1146
	<target name="runoneclass" depends="testprep"
1147
		description="Uses the ant to run a class">
1148
		
1149
		<java classname="${classtorun}" fork="true">
1150
			<arg line="${args}" />
1151
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1152
			<classpath>
1153
				<path refid="test.classpath" />
1154
				<fileset dir="${build.dir}">
1155
					<include name="${name}.jar" />
1156
					<include name="${name}-client.jar" />
1157
					<include name="harvester.jar" />
1158
					<include name="${name}-junittests.jar" />
1159
				</fileset>
1160
			</classpath>
1161
		</java>
1162
	</target>
1163
	
1164
	<target name="test" depends="testprep"
1165
		description="Uses the ant junit task to run all JUnit tests">
1166

    
1167
		<!-- use the ant "junit" task to run JUnit tests. -->
1168
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1169
			haltonerror="no">
1170
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1171
			<classpath>
1172
				<path refid="test.classpath" />
1173
				<fileset dir="${build.dir}">
1174
					<include name="${name}.jar" />
1175
					<include name="${name}-client.jar" />
1176
					<include name="harvester.jar" />
1177
					<include name="${name}-junittests.jar" />
1178
				</fileset>
1179
			</classpath>
1180

    
1181
			<formatter type="plain" />
1182

    
1183
			<batchtest fork="yes" todir="${build.dir}">
1184
				<fileset dir="${build.tests}">
1185
					<include name="**/*.class" />
1186
					<exclude name="**/MCTestCase.class" />
1187
					<exclude name="**/ClientViewHelperTest.class" />
1188
					<!-- these are not test cases -->
1189
					<exclude name="**/MockCNode.class" />
1190
					<exclude name="**/D1NodeServiceTest.class" />
1191
					<exclude name="**/QueryRunner.class" />
1192
					<exclude name="**/MockObjectPathMap.class" />
1193
					<exclude name="**/HzObjectPathMapTest$1.class" />
1194
					<exclude name="**/HzObjectPathMapTest$2.class" />
1195
				</fileset>
1196
			</batchtest>
1197
		</junit>
1198
	</target>
1199

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

    
1203
		<echo>testtorun: ${testtorun}</echo>
1204

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

    
1219
			<formatter type="plain" />
1220

    
1221
			<batchtest fork="yes" todir="${build.dir}">
1222
				<fileset dir="${build.tests}">
1223
					<include name="**/${testtorun}.class" />
1224
				</fileset>
1225
			</batchtest>
1226
		</junit>
1227
	</target>
1228
	
1229
	<target name="run" depends="testprep"
1230
			description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1231

    
1232
			<echo>testtorun: ${testtorun}</echo>
1233

    
1234
			<!-- use the ant "junit" task to run JUnit tests. -->
1235
			<junit printsummary="yes" haltonfailure="no" fork="yes"
1236
				haltonerror="no" showoutput="yes">
1237
				<jvmarg value="-Dfile.encoding=UTF-8"/>
1238
				<classpath>
1239
					<path refid="test.classpath" />
1240
					<fileset dir="${build.dir}">
1241
						<include name="${name}.jar" />
1242
						<include name="${name}-client.jar" />
1243
						<include name="harvester.jar" />
1244
						<include name="${name}-junittests.jar" />
1245
					</fileset>
1246
				</classpath>
1247

    
1248
				<formatter type="plain" />
1249

    
1250
				<batchtest fork="yes" todir="${build.dir}">
1251
					<fileset dir="${build.tests}">
1252
						<include name="**/${testtorun}.class" />
1253
					</fileset>
1254
				</batchtest>
1255
			</junit>
1256
		</target>
1257

    
1258
	<target name="testharvester" depends="testprep"
1259
		description="Uses the ant junit task to test only the Harvester code">
1260
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1261
			haltonerror="off">
1262
			<classpath>
1263
				<path refid="compile.classpath" />
1264
				<fileset dir="${build.dir}">
1265
					<include name="${name}.jar" />
1266
					<include name="${name}-client.jar" />
1267
					<include name="harvester.jar" />
1268
					<include name="${name}-junittests.jar" />
1269
				</fileset>
1270
			</classpath>
1271
			<formatter type="plain" />
1272
			<batchtest fork="yes" todir="${build.dir}">
1273
				<fileset dir="${build.tests}">
1274
					<include name="**/harvesterClient/*.class" />
1275
				</fileset>
1276
			</batchtest>
1277
		</junit>
1278
	</target>
1279

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

    
1284
		<echo>
1285
			*********************************** Please run ant
1286
			gethttpclient first! ***********************************
1287
		</echo>
1288
		<!-- copy and compile the tests into a jar file -->
1289
		<mkdir dir="${build.metacatnettest}" />
1290
		<javac srcdir="${junitnettestsdir}"
1291
			destdir="${build.metacatnettest}" includes="**/*.java">
1292
			<classpath>
1293
				<path refid="compile.classpath" />
1294
				<fileset dir="${build.dir}">
1295
					<include name="${name}.jar" />
1296
				</fileset>
1297
			</classpath>
1298
		</javac>
1299

    
1300
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1301
			basedir="${build.metacatnettest}" includes="**/*.class" />
1302

    
1303
		<!-- use the ant "junit" task to run JUnit tests. -->
1304
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1305
			haltonerror="no">
1306
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1307
			<classpath>
1308
				<path refid="compile.classpath" />
1309
				<fileset dir="${build.dir}">
1310
					<include name="${name}.jar" />
1311
					<include name="${name}-junitnettests.jar" />
1312
				</fileset>
1313
			</classpath>
1314

    
1315
			<formatter type="plain" />
1316

    
1317
			<batchtest fork="yes" todir="${build.dir}">
1318
				<fileset dir="${build.metacatnettest}">
1319
					<include name="**/*.class" />
1320
				</fileset>
1321
			</batchtest>
1322
		</junit>
1323
	</target>
1324

    
1325
	<target name="cleanweb" depends="clean"
1326
		description="deletes tomcat web context dir and all its contents">
1327
		<delete dir="${installdir}" />
1328
	</target>
1329

    
1330

    
1331
	<target name="clean" depends="init"
1332
		description="deletes build dir and files that can be regenerated form the release">
1333
		<delete dir="${build.dir}" />
1334
		<delete dir="${dist.dir}" />
1335
	</target>
1336

    
1337
	<target name="fullclean" depends="clean"
1338
		description="deletes code and eml">
1339
		<delete includeEmptyDirs="true" failonerror="false">
1340
			<fileset dir="${style-common-cvsrelpath}">
1341
				<include name="${eml-css}" />
1342
				<include name="eml-*/*.xsl" />
1343
				<include name="eml-*" />
1344
			</fileset>
1345
			<fileset dir="${schema-cvsrelpath}">
1346
				<include name="eml-*/*.xsd" />
1347
			</fileset>
1348
			<fileset dir="${ecogrid-dir}"/>
1349
			<fileset dir="lib/style/common/emlb6toeml2"/>
1350
			<fileset dir="lib/dtd"/>
1351
			<fileset dir="${libdir.mvn}"/>
1352
		</delete>
1353
		<!-- remove the entire directory -->
1354
		<delete includeemptydirs="true" dir="${metacatui.build.dir}" />
1355
		<!-- clean up the distribution files if they exist-->
1356
		<delete file="./${name}-bin-${release}.tar.gz" />
1357
		<delete file="./${name}-src-${release}.tar.gz" />
1358
		<delete file="./${name}-bin-${release}.zip" />
1359
		<delete file="./${name}-src-${release}.zip" />
1360
	</target>
1361
	
1362
	<target name="documentation" depends="javadoc,admindoc"
1363
	    description="generates Javadoc API documentation and Admin Guide">
1364
    </target>
1365
	
1366
	<target name="admindoc" depends="prepare">
1367
		<!-- Build the administrator's guide, which is a Sphinx RST project
1368
		     For this to succeed, you must have Sphinx installed on your machine
1369
		     See: http://sphinx.pocoo.org/ for details
1370
		     And you must also have the 'make' build tool installed
1371
		-->
1372
		<exec dir="${docdir}/user/metacat" executable="make"> 
1373
		        <arg value="plantuml"/> 
1374
		</exec>
1375
		
1376
		<exec dir="${docdir}/user/metacat" executable="make"> 
1377
		        <arg value="html"/> 
1378
		</exec>
1379
		
1380
    </target>
1381

    
1382
	<target name="javadoc" depends="prepare"
1383
		description="generates Javadoc API documentation">
1384
		<javadoc packagenames="edu.ucsb.nceas.*"
1385
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1386
			version="true" use="true" windowtitle="${Name} API"
1387
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1388
			bottom="&lt;i&gt;Copyright &#169; ${copyright}. All Rights Reserved.&lt;/i&gt;">
1389
			<classpath>
1390
				<path refid="compile.classpath" />
1391
			</classpath>
1392
		</javadoc>
1393
	</target>
1394

    
1395
	<target name="dist"
1396
		depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL"
1397
		description="prepares a full release distribution">
1398
		<mkdir dir="${dist.dir}" />
1399
		<delete dir="${ver.dir}" />
1400
		<mkdir dir="${ver.dir}" />
1401
		<copy todir="${ver.dir}">
1402
			<fileset dir="."
1403
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1404
		</copy>
1405
		<copy todir="${ver.dir}" file="build.xml" />
1406
		<copy todir="${ver.dir}" file="build.properties" />
1407

    
1408
		<copy todir="${ver.dir}/docs" filtering="yes">
1409
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1410
		</copy>
1411
		<copy todir="${ver.dir}/docs" filtering="no">
1412
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1413
		</copy>
1414
		<copy todir="${ver.dir}/docs/dev">
1415
			<fileset dir="${build.dir}/docs" />
1416
		</copy>
1417
		<copy todir="${ver.dir}/src">
1418
			<fileset dir="${build.dir}/src" />
1419
		</copy>
1420

    
1421
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1422
		<copy todir="${ver.dir}/test/servertestfiles">
1423
			<fileset dir="./test/servertestfiles" />
1424
		</copy>
1425
	</target>
1426

    
1427
	<target name="fulldist" depends="distbin, distsrc"
1428
			description="full distribution - source and bin"/>
1429
		
1430
	<target name="distbin" depends="build-metacat,war-lsid"
1431
		description="prepares a binary distribution">
1432
		<copy todir="${dist.dir}">
1433
			<fileset dir="./src/scripts" />
1434
		</copy>
1435
		<delete file="./${name}-bin-${release}.zip" />
1436
		<zip zipfile="./${name}-bin-${release}.zip"
1437
			basedir="${dist.dir}" />
1438
		<delete file="./${name}-bin-${release}.tar.gz" />
1439
		<tar tarfile="./${name}-bin-${release}.tar"
1440
			basedir="${dist.dir}" />
1441
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1442
			src="./${name}-bin-${release}.tar" />
1443
		<delete file="./${name}-bin-${release}.tar" />
1444
	</target>
1445

    
1446
	<target name="distsrc" depends="dist"
1447
		description="prepares a source distribution">
1448
		<mkdir dir="${ver.src}" />
1449
		<copy todir="${ver.src}">
1450
			<fileset dir="./src" />
1451
		</copy>
1452
		
1453

    
1454
		<mkdir dir="${ecogrid-dist-dir}" />
1455
		<copy todir="${ecogrid-dist-dir}">
1456
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1457
		</copy>
1458

    
1459

    
1460
		<delete file="./${name}-src-${release}.zip" />
1461
		<zip zipfile="./${name}-src-${release}.zip"
1462
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1463
		<delete file="./${name}-src-${release}.tar.gz" />
1464
		<tar tarfile="./${name}-src-${release}.tar"
1465
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1466
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1467
			src="./${name}-src-${release}.tar" />
1468
		<delete file="./${name}-src-${release}.tar" />
1469
		<!--delete dir="${dist.dir}"/ -->
1470
	</target>
1471

    
1472
	<target name="deb-package" depends="distbin"
1473
		description="create a debian installation package">
1474
		<delete dir="${deb.pkg.dir}" />
1475
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1476
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1477
			<fileset dir="./src/scripts/debian"
1478
				includes="control postinst" />
1479
		</copy>
1480

    
1481
		<mkdir
1482
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1483
		<copy
1484
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1485
			filtering="yes">
1486
			<fileset dir="./src/scripts/debian"
1487
				excludes="control postinst" />
1488
		</copy>
1489
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1490

    
1491
		<copy file="${dist.dir}/${metacat.context}.war"
1492
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1493
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1494
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1495

    
1496
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1497
			failonerror="true">
1498
			<arg line="--build debian" />
1499
		</exec>
1500

    
1501
		<move file="${pkg.dir}/debian.deb"
1502
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1503
	</target>
1504

    
1505
	<target name="stylesheettest">
1506
		<xslt in="${input}" out="eml.html"
1507
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1508
			<param name="displaymodule" expression="${displaymodule}" />
1509
			<param name="docid" expression="${input}" />
1510
			<param name="entitytype" expression="${entitytype}" />
1511
			<param name="entityindex" expression="${entityindex}" />
1512
			<outputproperty name="method" value="html" />
1513
			<outputproperty name="standalone" value="yes" />
1514
			<outputproperty name="encoding" value="iso8859_1" />
1515
			<outputproperty name="indent" value="yes" />
1516
		</xslt>
1517
	</target>
1518

    
1519
	<target name="spatial_option" depends="prepare"
1520
		description=" -- compiles code for the spatial option">
1521

    
1522
		<echo message="Compiling the metatcat shapefile creator" />
1523
		<echo message="using the shapelib at: ${shapelib.dir}" />
1524
		<exec dir="." executable="g++" os="Linux, Unix"
1525
			failonerror="true">
1526
			<arg
1527
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1528
		</exec>
1529

    
1530
		<exec dir="." executable="g++" os="Linux, Unix"
1531
			failonerror="true">
1532
			<arg
1533
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1534
		</exec>
1535
	</target>
1536

    
1537
	<!-- LSID Authority support -->
1538
	<patternset id="lsid.jars">
1539
		<include name="axis.jar" />
1540
		<include name="commons-discovery-0.2.jar" />
1541
		<include name="jaxrpc.jar" />
1542
		<include name="lsid-client-1.1.1.jar" />
1543
		<include name="lsid-server-1.1.1.jar" />
1544
		<include name="saaj.jar" />
1545
		<include name="wsdl4j-1.5.1.jar" />
1546
		<include name="activation.jar" />
1547
		<include name="castor-0.9.5.jar" />
1548
		<include name="dnsjava-1.3.2.jar" />
1549
		<include name="mail.jar" />
1550
		<include name="commons-logging-1.0.4.jar" />
1551
		<!-- These jars may be needed but seem to not actually be,
1552
			so leaving them out for now
1553
			<include name="axis-ant.jar" />
1554
		-->
1555
		<!--<include name="GenCastor.class" />-->
1556
	</patternset>
1557
	<patternset id="lib.jars">
1558
		<include name="log4j-1.2.12.jar" />
1559
		<include name="utilities-*.jar" />
1560
		<include name="xerces*.jar" />
1561
		<include name="xalan*.jar" />
1562
		<include name="xml-apis*.jar" />
1563
	</patternset>
1564

    
1565
	<path id="lsid.classpath">
1566
		<fileset dir="${lsid.lib.dir}">
1567
			<patternset refid="lsid.jars" />
1568
		</fileset>
1569
		<fileset dir="${lib.dir}">
1570
			<patternset refid="lib.jars" />
1571
		</fileset>
1572
		<fileset dir="${build.dir}">
1573
			<include name="metacat-client.jar" />
1574
			<include name="metacat.jar" />
1575
		</fileset>
1576
	</path>
1577

    
1578
	<filterset id="configFilters">
1579
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1580
			value="${config.hostname}" / -->
1581
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1582
			value="${config.port}" / -->
1583
		<!-- MCD BYE filter token="METADATA_LABELS"
1584
			value="${config.metadataLabelLsid}" / -->
1585
		<!-- MCD BYE filter token="METACAT_SERVER"
1586
			value="${config.metacatserver}" / -->
1587
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1588
			value="${config.lsidauthority}" / -->
1589
	</filterset>
1590

    
1591
	<target name="prepare-lsid" depends="prepare,clientjar"
1592
		description="Configure files prior to compilation">
1593
		<mkdir dir="${lsid.build.dir}" />
1594
		<!-- Copy the properties file into the build -->
1595
		<copy file="${conf.dir}/metacat-lsid.properties"
1596
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1597
			overwrite="true">
1598
			<filterset refid="configFilters" />
1599
		</copy>
1600
		<copy file="${conf.dir}/log4j.properties"
1601
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1602
			overwrite="true">
1603
			<filterset refid="configFilters" />
1604
		</copy>
1605
		<!-- Copy config files into the build -->
1606
		<copy todir="${lsid.build.dir}/WEB-INF">
1607
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1608
		</copy>
1609
		<!-- Copy the metadata configuration files into the build -->
1610
		<mkdir
1611
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1612
		<copy
1613
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1614
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1615
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1616
			<filterset refid="configFilters" />
1617
		</copy>
1618
		<!-- Copy services files into the build -->
1619
		<mkdir dir="${lsid.build.dir}/services" />
1620
		<copy todir="${lsid.build.dir}/services">
1621
			<fileset dir="${services.dir}" />
1622
			<filterset refid="configFilters" />
1623
		</copy>
1624
		<!-- Copy axis files into the build -->
1625
		<mkdir dir="${lsid.build.dir}" />
1626
		<copy todir="${lsid.build.dir}">
1627
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1628
		</copy>
1629
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1630
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1631
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1632
		</copy>
1633
	</target>
1634

    
1635
	<target name="compile-lsid" depends="prepare-lsid"
1636
		description="Compile Java sources">
1637
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1638
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1639
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1640
			deprecation="${compile.deprecation}"
1641
			optimize="${compile.optimize}">
1642
			<classpath>
1643
				<path refid="compile.classpath" />
1644
				<fileset dir="${build.dir}">
1645
					<include name="${name}.jar" />
1646
				</fileset>
1647
			</classpath>
1648
		</javac>
1649
	</target>
1650

    
1651
	<target name="war-lsid" depends="compile-lsid"
1652
		description="Create a war file for the application">
1653
		<mkdir dir="${dist.dir}" />
1654
		<war destfile="${dist.dir}/${authority.context}.war"
1655
			webxml="${webinf.dir}/web.xml">
1656
			<fileset dir="${lsid.build.dir}" />
1657
			<lib dir="${lsid.lib.dir}">
1658
				<patternset refid="lsid.jars" />
1659
			</lib>
1660
			<lib dir="${lib.dir}">
1661
				<patternset refid="lib.jars" />
1662
			</lib>
1663
			<lib dir="${lib.dir}">
1664
				<include name="xalan.jar" />
1665
				<include name="xml-apis.jar" />
1666
			</lib>
1667
			<lib dir="${build.dir}">
1668
				<include name="metacat-client.jar" />
1669
			</lib>
1670
		</war>
1671
	</target>
1672

    
1673
	<target name="deploy-lsid" depends="war-lsid"
1674
		description="Deploy LSID war to servlet container">
1675
		<delete dir="${app.deploy.dir}/${authority.context}" />
1676
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1677
		<mkdir dir="${app.deploy.dir}" />
1678
		<copy todir="${app.deploy.dir}">
1679
			<fileset dir="${dist.dir}" />
1680
		</copy>
1681
	</target>
1682
	
1683
	<target name="change-metacat-properties" depends="warPrepare"
1684
        description="Chage some default values of metacat.properties">
1685
       <echo file="${metacat-properties-file}" append="true">
1686
		   configutil.propertiesConfigured=true
1687
		   configutil.authConfigured=true
1688
           configutil.skinsConfigured=true
1689
		   configutil.databaseConfigured=true
1690
		   configutil.geoserverConfigured=true
1691
	   </echo>
1692
  </target>
1693
	
1694
	<!-- This target will use default values in svn metacat.properties to build a configured 
1695
		metacat (except configuti.* properties, they will be set true). Those default settings
1696
		are for a test machine. It may not work on your system-->
1697
	<target name="install-configured-metacat" depends="change-metacat-properties, install"
1698
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1699
    </target>
1700
	
1701
	<!-- build metacat-common jar -->
1702
	<target name="build-metacat-common" description="Calls the Maven build for metacat-common jar" unless="build-metacat-common-called" >
1703
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1704
		            <arg value="clean"/>
1705
		</artifact:mvn>
1706
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1707
		   <arg value="install"/>
1708
		</artifact:mvn>
1709
		<property name="build-metacat-common-called" value="true"/>
1710
	</target>
1711

    
1712
	<!-- build metacat-index war -->
1713
	<target name="build-metacat-index" description="Calls the Maven build for metacat-index.war" >		
1714
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1715
			<arg value="clean"/>
1716
		</artifact:mvn>
1717
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1718
			<arg value="package"/>
1719
			<!--<arg value="-Dmaven.test.skip=true"/>-->
1720
		</artifact:mvn>
1721
	</target>
1722
	
1723
	<target name="dist-metacat-index" depends="init, build-metacat-index" description="Copy metacat-index.war to dist folder" >		
1724
		<copy tofile="${dist.dir}/metacat-index.war" >
1725
			<fileset dir="metacat-index/target" includes="metacat-index*.war"></fileset>
1726
		</copy>	
1727
	</target>
1728
	
1729
	<target name="install-metacat-index" depends="dist-metacat-index" description="Copy metacat-index.war to deploy folder" >		
1730
		<copy todir="${app.deploy.dir}" file="${dist.dir}/metacat-index.war" />
1731
	</target>
1732
	
1733
	<!-- Generate a light war file which only is used to manage the ldap user accounts - register a new user, reset and change the password -->
1734
	<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">
1735
		  <property name="war-name" value="identity" />
1736
		  <mkdir dir="${dist.dir}" />
1737
		     <war destfile="${dist.dir}/${war-name}.war"
1738
		            webxml="lib/account-web-info/web.xml">
1739
		      <webinf dir="${war.webinf}">
1740
		        <include name="metacat.properties"/>
1741
		        <include name="gd_intermediate_bundle_nceas_ldap.crt"/>
1742
		      </webinf>
1743
		      <fileset dir="${war.context}">
1744
		        <include name="cgi-bin/**"/>
1745
		      	<include name="style/**"/>  
1746
		      </fileset>
1747
		      
1748
		   </war>
1749
	</target>
1750
	
1751
</project>
(5-5/7)