Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
	*   '$RCSfile$'
4
	*     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
	*   Copyright: 2000 Regents of the University of California and the
6
	*              National Center for Ecological Analysis and Synthesis
7
	* For Details: http://www.nceas.ucsb.edu/
8
	*
9
	*    '$Author: leinfelder $'
10
	*    '$Date: 2013-11-05 14:31:09 -0800 (Tue, 05 Nov 2013) $'
11
	*    '$Revision: 8365 $'
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_RC3" />
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 file="lib/solrQueryFieldDescriptions.properties" todir="${war.webinf}"/>
1014
		<copy file="lib/metacat.properties.metadata.xml"
1015
			todir="${war.webinf}" filtering="no" />
1016
		<copy file="lib/org.properties.metadata.xml"
1017
			todir="${war.webinf}" filtering="no" />
1018
		<copy file="lib/auth.properties.metadata.xml"
1019
			todir="${war.webinf}" filtering="no" />
1020
		<copy todir="${war.webinf}" filtering="yes">
1021
			<fileset dir="lib">
1022
				<include name="skin.configs/**" />
1023
			</fileset>
1024
		</copy>
1025
		<copy file="lib/log4j.properties" todir="${war.webinf}"
1026
			filtering="yes" />
1027
		<copy file="lib/hazelcast.xml" todir="${war.webinf}"
1028
			filtering="yes" />
1029
		<copy file="lib/oa4mp_client.xml" todir="${war.webinf}"
1030
			filtering="yes" />
1031
		<copy todir="${war.context}" filtering="no">
1032
			<fileset dir="lib">
1033
				<include name="**/*.jpg" />
1034
				<include name="**/*.png" />
1035
				<include name="**/*.gif" />
1036
				<include name="LiveMap_30/**" />
1037
				<include name="oaipmh/**" />
1038
			</fileset>
1039
		</copy>
1040
		<copy todir="${war.context}" filtering="yes">
1041
			<fileset dir="lib">
1042
				<exclude name="*.jar" />
1043
				<exclude name="*.properties" />
1044
				<exclude name="*.metadata.xml" />
1045
				<exclude name="web.xml" />
1046
				<exclude name="**/*.jpg" />
1047
				<exclude name="**/*.png" />
1048
				<exclude name="**/*.gif" />
1049
				<exclude name="lsid_lib/**" />
1050
				<exclude name="lsid_conf/**" />
1051
				<exclude name="LiveMap_30/**" />
1052
				<exclude name="oaipmh/**" />
1053
				<exclude name="maven/**" />
1054
				<exclude name="skin.configs/**" />
1055
				<exclude name="spatial/geoserver/**" />
1056
			</fileset>
1057
		</copy>
1058
		<copy todir="${war.context}" filtering="no">
1059
			<fileset dir="lib">
1060
				<include name="spatial/geoserver/data/**" />
1061
			</fileset>
1062
		</copy>
1063
		<copy todir="${war.context.docs}" filtering="no">
1064
			<fileset dir="${build.docs}" />
1065
		</copy>
1066
		<copy todir="${war.webinf.sql}" filtering="yes">
1067
			<fileset dir="src">
1068
				<include name="**/*.sql" />
1069
			</fileset>
1070
		</copy>
1071
		<copy todir="${war.webinf.scripts}" filtering="yes">
1072
			<fileset dir="src/scripts" />
1073
		</copy>
1074
		<copy todir="${war.webinf.scripts}"
1075
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
1076
			failonerror="false" />
1077

    
1078
		<copy file="src/perl/register-dataset.cgi"
1079
			todir="${war.context.cgi}" />
1080
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1081
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1082

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

    
1096
		<!-- ldap cgi section -->
1097
		<copy todir="${war.context.templates}">
1098
			<fileset dir="lib/style/common/templates">
1099
				<!-- SCW: Copy all files -->
1100
			</fileset>
1101
		</copy>
1102
	</target>
1103

    
1104
	<target name="cgiPrepare" if="build.perl">
1105
		<exec dir="src/perl/Metacat/" executable="make">
1106
			<arg value="clean" />
1107
		</exec>
1108
		<exec dir="src/perl/Metacat/" executable="perl">
1109
			<arg value="Makefile.PL" />
1110
		</exec>
1111
		<exec dir="src/perl/Metacat/" executable="make" />
1112
	</target>
1113

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

    
1127
	<target name="getConversionXSL" depends="prepare"
1128
		unless="styles.not.needed"
1129
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1130

    
1131
		<svn>
1132
			<export srcUrl="${svn.eml2StyleUrl}"
1133
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1134
		</svn>
1135

    
1136
		<mkdir dir="lib/style/common/emlb6toeml2" />
1137
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1138
			<fileset
1139
				dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1140
				<include name="*.xsl" />
1141
				<include name="*.xml" />
1142
			</fileset>
1143
		</copy>
1144
	</target>
1145

    
1146
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1147
		<mkdir dir="${build.tests}" />
1148
		<copy todir="${build.tests}" encoding="UTF-8">
1149
			<fileset dir="${testdir}">
1150
				<include name="edu/**" />
1151
			</fileset>
1152
		</copy>
1153
		<copy todir="${build.tests}" file="${testdir}/test.properties" />
1154

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

    
1178
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1179
			basedir="${build.tests}" >
1180
			<include name="**/*.class"/>
1181
			<include name="**/*.xml"/>
1182
		</jar>	
1183
		
1184
	</target>
1185

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

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

    
1220
			<formatter type="plain" />
1221

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

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

    
1242
		<echo>testtorun: ${testtorun}</echo>
1243

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

    
1258
			<formatter type="plain" />
1259

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

    
1271
			<echo>testtorun: ${testtorun}</echo>
1272

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

    
1287
				<formatter type="plain" />
1288

    
1289
				<batchtest fork="yes" todir="${build.dir}">
1290
					<fileset dir="${build.tests}">
1291
						<include name="**/${testtorun}.class" />
1292
					</fileset>
1293
				</batchtest>
1294
			</junit>
1295
		</target>
1296

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

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

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

    
1339
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1340
			basedir="${build.metacatnettest}" includes="**/*.class" />
1341

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

    
1354
			<formatter type="plain" />
1355

    
1356
			<batchtest fork="yes" todir="${build.dir}">
1357
				<fileset dir="${build.metacatnettest}">
1358
					<include name="**/*.class" />
1359
				</fileset>
1360
			</batchtest>
1361
		</junit>
1362
	</target>
1363

    
1364
	<target name="cleanweb" depends="clean"
1365
		description="deletes tomcat web context dir and all its contents">
1366
		<delete dir="${installdir}" />
1367
	</target>
1368

    
1369

    
1370
	<target name="clean" depends="init"
1371
		description="deletes build dir and files that can be regenerated form the release">
1372
		<delete dir="${build.dir}" />
1373
		<delete dir="${dist.dir}" />
1374
	</target>
1375

    
1376
	<target name="localclean" depends="clean"
1377
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1378
		<delete file="lib/utilities.jar" />
1379
	</target>
1380

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

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

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

    
1453
		<copy todir="${ver.dir}/docs" filtering="yes">
1454
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1455
		</copy>
1456
		<copy todir="${ver.dir}/docs" filtering="no">
1457
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1458
		</copy>
1459
		<copy todir="${ver.dir}/docs/dev">
1460
			<fileset dir="${build.dir}/docs" />
1461
		</copy>
1462
		<copy todir="${ver.dir}/src">
1463
			<fileset dir="${build.dir}/src" />
1464
		</copy>
1465

    
1466
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1467
		<copy todir="${ver.dir}/test/servertestfiles">
1468
			<fileset dir="./test/servertestfiles" />
1469
		</copy>
1470
	</target>
1471

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

    
1491
	<target name="distsrc" depends="dist"
1492
		description="prepares a source distribution">
1493
		<mkdir dir="${ver.src}" />
1494
		<copy todir="${ver.src}">
1495
			<fileset dir="./src" />
1496
		</copy>
1497
		<mkdir dir="${util.dir}" />
1498
		<copy todir="${util.dir}">
1499
			<fileset dir="${utilitiesdir}" excludes="**/CVS*" />
1500
		</copy>
1501

    
1502
		<mkdir dir="${ecogrid-dist-dir}" />
1503
		<copy todir="${ecogrid-dist-dir}">
1504
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1505
		</copy>
1506

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

    
1509
		<delete file="./${name}-src-${release}.zip" />
1510
		<zip zipfile="./${name}-src-${release}.zip"
1511
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1512
		<delete file="./${name}-src-${release}.tar.gz" />
1513
		<tar tarfile="./${name}-src-${release}.tar"
1514
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1515
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1516
			src="./${name}-src-${release}.tar" />
1517
		<delete file="./${name}-src-${release}.tar" />
1518
		<!--delete dir="${dist.dir}"/ -->
1519
	</target>
1520

    
1521
	<target name="deb-package" depends="distbin"
1522
		description="create a debian installation package">
1523
		<delete dir="${deb.pkg.dir}" />
1524
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1525
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1526
			<fileset dir="./src/scripts/debian"
1527
				includes="control postinst" />
1528
		</copy>
1529

    
1530
		<mkdir
1531
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1532
		<copy
1533
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1534
			filtering="yes">
1535
			<fileset dir="./src/scripts/debian"
1536
				excludes="control postinst" />
1537
		</copy>
1538
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1539

    
1540
		<copy file="${dist.dir}/${metacat.context}.war"
1541
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1542
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1543
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1544

    
1545
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1546
			failonerror="true">
1547
			<arg line="--build debian" />
1548
		</exec>
1549

    
1550
		<move file="${pkg.dir}/debian.deb"
1551
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1552
	</target>
1553

    
1554
	<target name="stylesheettest">
1555
		<xslt in="${input}" out="eml.html"
1556
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1557
			<param name="displaymodule" expression="${displaymodule}" />
1558
			<param name="docid" expression="${input}" />
1559
			<param name="entitytype" expression="${entitytype}" />
1560
			<param name="entityindex" expression="${entityindex}" />
1561
			<outputproperty name="method" value="html" />
1562
			<outputproperty name="standalone" value="yes" />
1563
			<outputproperty name="encoding" value="iso8859_1" />
1564
			<outputproperty name="indent" value="yes" />
1565
		</xslt>
1566
	</target>
1567

    
1568
	<target name="spatial_option" depends="prepare"
1569
		description=" -- compiles code for the spatial option">
1570

    
1571
		<echo message="Compiling the metatcat shapefile creator" />
1572
		<echo message="using the shapelib at: ${shapelib.dir}" />
1573
		<exec dir="." executable="g++" os="Linux, Unix"
1574
			failonerror="true">
1575
			<arg
1576
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1577
		</exec>
1578

    
1579
		<exec dir="." executable="g++" os="Linux, Unix"
1580
			failonerror="true">
1581
			<arg
1582
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1583
		</exec>
1584
	</target>
1585

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

    
1614
	<path id="lsid.classpath">
1615
		<fileset dir="${lsid.lib.dir}">
1616
			<patternset refid="lsid.jars" />
1617
		</fileset>
1618
		<fileset dir="${lib.dir}">
1619
			<patternset refid="lib.jars" />
1620
		</fileset>
1621
		<fileset dir="${build.dir}">
1622
			<include name="metacat-client.jar" />
1623
			<include name="metacat.jar" />
1624
		</fileset>
1625
	</path>
1626

    
1627
	<filterset id="configFilters">
1628
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1629
			value="${config.hostname}" / -->
1630
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1631
			value="${config.port}" / -->
1632
		<!-- MCD BYE filter token="METADATA_LABELS"
1633
			value="${config.metadataLabelLsid}" / -->
1634
		<!-- MCD BYE filter token="METACAT_SERVER"
1635
			value="${config.metacatserver}" / -->
1636
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1637
			value="${config.lsidauthority}" / -->
1638
	</filterset>
1639

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

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

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

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

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