Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
	*   '$RCSfile$'
4
	*     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
	*   Copyright: 2000 Regents of the University of California and the
6
	*              National Center for Ecological Analysis and Synthesis
7
	* For Details: http://www.nceas.ucsb.edu/
8
	*
9
	*    '$Author: tao $'
10
	*    '$Date: 2016-07-29 17:09:35 -0700 (Fri, 29 Jul 2016) $'
11
	*    '$Revision: 9875 $'
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
	<property name="java.target.version" value="1.7" /> <!-- the target version for java compilation-->
37
	<property name="java.source.version" value="1.7" /> <!-- the source code version for java compilation-->
38

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

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

    
126
	<available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
127
			property="tomcat.common.exists" />
128

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

    
144
		<property name="debug" value="on" />
145
		<property name="morphosourcedir" value="../morpho" />
146
		<property name="installdir"
147
			value="${app.deploy.dir}/${metacat.context}" />
148

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

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

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

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

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

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

    
267

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

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

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

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

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

    
336

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

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

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

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

    
387
		<!-- set up svn -->
388
		<property name="svnant.lib" value="lib" />
389
		<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
390
		<property name="svnClientAdapter.jar"
391
			value="${svnant.lib}/svnClientAdapter.jar" />
392
		<property name="svnjavahl.jar"
393
			value="${svnant.lib}/svnjavahl.jar" />
394
		<property name="svn.ecogridUrl"
395
			value="https://code.ecoinformatics.org/code/seek/${seek-tag}/projects/ecogrid/" />
396
		
397
		<!-- the git repo for metacatUI-->
398
		<property name="metacatui.git.repository.url"
399
					value="https://github.com/NCEAS/metacatui.git" />
400
		<property name="metacatui.git.repository.refname"
401
							value="METACATUI_1_11_3" />
402
		<!--<property name="metacatui.git.repository.refname"
403
									value="master" />-->
404
		<property name="metacatui.build.dir"
405
					value="metacatui_build" />
406
		<property name="metacatui.resources.dir"
407
					value="${metacatui.build.dir}/metacatui/src/main/webapp" />
408
		
409
		<!-- load the svn task -->
410
		<path id="svn.classpath">
411
			<pathelement location="${svnjavahl.jar}" />
412
			<pathelement location="${svnant.jar}" />
413
			<pathelement location="${svnClientAdapter.jar}" />
414
		</path>
415
		<taskdef resource="svntask.properties"
416
			classpathref="svn.classpath" />
417

    
418
		<condition property="eml.required">
419
			<or>
420
				<not>
421
					<available file="lib/schema/eml-2.1.1/eml.xsd" />
422
				</not>
423
				<not>
424
					<available file="lib/schema/eml-2.1.0/eml.xsd" />
425
				</not>
426
				<not>
427
					<available file="lib/schema/eml-2.0.1/eml.xsd" />
428
				</not>
429
				<not>
430
					<available file="lib/schema/eml-2.0.0/eml.xsd" />
431
				</not>
432
				<not>
433
					<available
434
						file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
435
				</not>
436
			</or>
437
		</condition>
438

    
439
		<condition property="ecogrid.required">
440
			<or>
441
				<not>
442
					<available file="${ecogrid-dir}/build.properties" />
443
				</not>
444
				<not>
445
					<available
446
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
447
				</not>
448
			</or>
449
		</condition>
450
		
451
		<property name="init.called" value="true" />
452

    
453
	</target>
454
	
455
	<target name="resolveDependencies" depends="init" description="retrieve dependencies with maven">
456
			<echo>Moving Maven dependencies (${dependency.fileset}) to ${libdir.mvn} </echo>
457
			<!-- Clear out mvn dir -->
458
			<delete dir="${libdir.mvn}"></delete>
459
			<!-- Copy all dependencies to the correct location. -->
460
			<copy todir="${libdir.mvn}">
461
				<fileset refid="dependency.fileset" />
462
				<!-- This mapper strips off all leading directory information -->
463
				<mapper type="flatten" />
464
			</copy>
465
		</target>
466

    
467
	<target name="prepare" depends="init, resolveDependencies">
468
		<mkdir dir="${build.dir}" />
469
		<mkdir dir="${build.src}" />
470
		<mkdir dir="${build.dest}" />
471
		<mkdir dir="${build.docs}" />
472
		<mkdir dir="${build.javadocs}" />
473
		<mkdir dir="${build.tmp}" />
474

    
475
		<copy todir="${build.src}" filtering="yes">
476
			<fileset dir="${srcdir}">
477
				<include name="edu/**" />
478
				<include name="com/**" />
479
				<include name="org/**" />
480
				<!-- include name="java/**" / -->
481
				<include name="**/*.sql" />
482
				<exclude name="**/CVS*" />
483
				<exclude name="**/.#*" />
484
				<exclude name="edu/ucsb/nceas/workflowscheduler/**" />
485
			</fileset>
486
		</copy>
487
		<available file="lib/style/common/emlb6toeml2" type="dir"
488
			property="styles.not.needed" />
489
	</target>
490

    
491
	<target name="generateStubs" depends="prepare">
492
		<echo
493
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
494
		<axis-wsdl2java verbose="true" output="${srcdir}"
495
			url="/tmp/KeplerWebService.wsdl" />
496
	</target>
497

    
498
	<target name="compile" depends="prepare"
499
		description="Compiles java code to build dir, and copies metacat props files there">
500

    
501
		<javac srcdir="${build.src}" destdir="${build.dest}"
502
			target="${java.target.version}"
503
			source="${java.source.version}"
504
			debug="${debug}"
505
			excludes="**/*.sql **/client/*.java **/harvesterClient/*.java">
506
			<classpath>
507
				<path refid="compile.classpath" />
508
			</classpath>
509
		</javac>
510
	</target>
511

    
512
	<target name="jar" depends="compile,geteml"
513
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
514

    
515
		<delete file="${build.dir}/${name}.jar" />
516
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
517
			excludes="**/protocols/ **/harvesterClient/" />
518
	</target>
519

    
520
	<target name="protocol" depends="compile"
521
		description="Compiles and jars protocol java code to protocol.jar in build dir">
522
		<delete file="${build.dir}/protocol.jar" />
523
		<jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
524
			includes="**/protocols/" />
525
	</target>
526

    
527

    
528
	<target name="client" depends="prepare"
529
		description="Compiles metacat-client java code to build dir">
530
		<javac srcdir="${build.src}" destdir="${build.dest}"
531
			target="${java.target.version}"
532
			source="${java.source.version}"
533
			includes="edu/ucsb/nceas/metacat/client/*">
534
			<classpath>
535
				<path refid="compile.classpath" />
536
			</classpath>
537
		</javac>
538
	</target>
539

    
540
	<target name="clientjar" depends="client"
541
		description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
542
		<delete file="${build.dir}/${name}-client.jar" />
543
		<jar jarfile="${build.dir}/${name}-client.jar"
544
			basedir="${build.dest}" includes="**/metacat/client/" />
545
	</target>
546

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

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

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

    
597
	<target name="geteml" depends="getemlpre2,getemlpre2beta4,geteml2+,getConversionXSL"
598
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
599

    
600
	<target name="getemlpre2" depends="prepare,giteml" if="eml.required"
601
		description="Checks EML-beta6 out of svn and copies dtds and xsl to your metacat sandbox">
602
		<mkdir dir="lib/dtd" />
603
		<copy todir="lib/dtd" filtering="yes">
604
			<fileset
605
				dir="${build.tmp}/eml_${eml-beta-tag}">
606
				<include name="*.dtd" />
607
			</fileset>
608
			<mapper type="glob" from="eml-*.dtd"
609
				to="eml-*-${eml-version}.dtd" />
610
		</copy>
611

    
612
		<copy todir="${style-common-cvsrelpath}" filtering="yes">
613
			<fileset
614
				dir="${build.tmp}/eml_${eml-beta-tag}/style">
615
				<include name="**/*.xsl" />
616
			</fileset>
617
		</copy>
618
	</target>
619
	
620
	<target name="getemlpre2beta4" depends="prepare" if="eml.required"
621
			description="Checks EML-beta4 out of svn and copies dtds to your metacat sandbox">
622
			<mkdir dir="lib/dtd" />
623
			<copy todir="lib/dtd" filtering="yes">
624
				<fileset
625
					dir="${build.tmp}/eml_${eml-beta4-tag}">
626
					<include name="*.dtd" />
627
				</fileset>
628
				<mapper type="glob" from="eml-*.dtd"
629
					to="eml-*-${eml-beta4-version}.dtd" />
630
			</copy>
631
	</target>
632

    
633
    <target name="giteml" depends="prepare" if="eml.required"
634
            description="Git clone EML code from various tagged releases of the EML git repository">
635
        <git-clone-pull repository="${eml.git.repository.url}" 
636
                        dest="${build.tmp}/eml_${eml-beta4-tag}" refname="${eml-beta4-tag}" />
637
        <git-clone-pull repository="${eml.git.repository.url}" 
638
                        dest="${build.tmp}/eml_${eml-beta-tag}" refname="${eml-beta-tag}" />
639
        <git-clone-pull repository="${eml.git.repository.url}" 
640
                        dest="${build.tmp}/eml_${eml2_0_0-schema-tag}" refname="${eml2_0_0-schema-tag}" />
641
        <git-clone-pull repository="${eml.git.repository.url}" 
642
                        dest="${build.tmp}/eml_${eml2_0_1-schema-tag}" refname="${eml2_0_1-schema-tag}" />
643
        <git-clone-pull repository="${eml.git.repository.url}" 
644
                        dest="${build.tmp}/eml_${eml2_1_0-schema-tag}" refname="${eml2_1_0-schema-tag}" />
645
        <git-clone-pull repository="${eml.git.repository.url}" 
646
                        dest="${build.tmp}/eml_${eml2_1_1-schema-tag}" refname="${eml2_1_1-schema-tag}" />
647
        <git-clone-pull repository="${eml.git.repository.url}" 
648
                        dest="${build.tmp}/eml_${eml2-style-tag}" refname="master" />
649
    </target>
650

    
651
	<target name="geteml2+" depends="prepare,giteml" if="eml.required"
652
		description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
653
		<!-- Checkout eml200 for given schema tag-->
654
		<mkdir dir="lib/schema/eml-2.0.0" />
655
		<copy todir="lib/schema/eml-2.0.0" filtering="yes">
656
			<fileset
657
				dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
658
				<include name="*.xsd" />
659
			</fileset>
660

    
661
			<!-- shouldn't we have a mapper here like this??
662
				<mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
663
				
664
				Jing's code didn't have one - does it need to be added?
665
				NOTE that eml-version is set to beta 6, so this would need changing -->
666

    
667
		</copy>
668

    
669
		<!-- Checkout eml201 for given schema tag-->
670
		<mkdir dir="lib/schema/eml-2.0.1" />
671
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
672
			<fileset
673
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
674
				<include name="*.xsd" />
675
			</fileset>
676
		</copy>
677

    
678
		<!-- Checkout eml210 for given schema tag-->
679
		<mkdir dir="lib/schema/eml-2.1.0" />
680
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
681
			<fileset
682
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
683
				<include name="*.xsd" />
684
			</fileset>
685
		</copy>
686

    
687
		<!-- Checkout eml210 for given style sheet tag-->
688
		<antcall target="copyxsl">
689
			<param name="cvs.tagname" value="${eml2-style-tag}" />
690
			<!-- param name="dirname" value="eml-2.1.0" / -->
691
			<param name="dirname" value="eml-2" />
692
		</antcall>
693
		
694
		<!-- Checkout eml211 for given schema tag-->
695
		<mkdir dir="lib/schema/eml-2.1.1" />
696
		<copy todir="lib/schema/eml-2.1.1" filtering="yes">
697
			<fileset
698
				dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
699
				<include name="*.xsd" />
700
			</fileset>
701
		</copy>
702
	</target>
703

    
704
	<target name="copyxsl"
705
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
706

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

    
709
		<copy todir="${style-common-cvsrelpath}/${dirname}"
710
			filtering="yes">
711
			<fileset
712
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
713
				<include name="**/*.xsl" />
714
			</fileset>
715
		</copy>
716

    
717

    
718
		<!-- now copy default css from eml module and put it in style-common-path
719
			dir with a new name, so other skin-specific css can import it if reqd -->
720
		<copy
721
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
722
			tofile="${style-common-cvsrelpath}/${eml-css}" />
723

    
724
	</target>
725

    
726
	<target name="correctEML201Docs" depends="jar"
727
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
728
		<copy todir="${build.dir}" file="lib/metacat.properties"
729
			filtering="yes" />
730
		<java
731
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
732
			<classpath>
733
				<path refid="compile.classpath" />
734
				<fileset dir="${build.dir}">
735
					<include name="${name}.jar" />
736
				</fileset>
737
			</classpath>
738
		</java>
739
	</target>
740

    
741
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
742
		description="Installs spatial option for metacat">
743
		
744
		<copy todir="${dist.dir}">
745
			<fileset dir="./lib/spatial/geoserver" includes="*.war" />
746
		</copy>
747

    
748
	</target>
749

    
750
	<target name="install" depends="build-metacat"
751
		description="* Install Metacat For Development *">
752
		<copy file="${dist.dir}/${metacat.context}.war"
753
			todir="${app.deploy.dir}" />
754
		<delete dir="${app.deploy.dir}/${metacat.context}" />
755
		<copy file="${dist.dir}/geoserver.war"
756
					todir="${app.deploy.dir}" />
757
		<delete dir="${app.deploy.dir}/geoserver" />
758
		<copy file="${dist.dir}/metacat-index.war"
759
					todir="${app.deploy.dir}" />
760
		<delete dir="${app.deploy.dir}/metacat-index" />
761
		<copy file="${dist.dir}/metacatui.war"
762
					todir="${app.deploy.dir}" />
763
		<delete dir="${app.deploy.dir}/metacatui" />
764
		<tstamp>
765
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
766
		</tstamp>
767
		<echo>Dev install completed at ${NOW}</echo>
768
	</target>
769

    
770
	<target name="build-metacat" depends="install-ecogrid, install-spatial, dist-metacat-index, dist-metacat-ui"
771
		description="Build Metacat">
772
	</target>
773

    
774
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
775
		if="enable.ecogrid" description="Install Ecogrid Compentent">
776
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
777
			inheritall="false">
778
			<property name="context" value="${metacat.context}" />
779
			<property name="target" value="${ecogrid-target-name}" />
780
		</ant>
781
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
782
			inheritall="false">
783
			<property name="context" value="${metacat.context}" />
784
			<property name="target" value="${ecogrid-target-name}" />
785
			<property name="metacat.dir" value="${basedir}"/>
786
		</ant>
787
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
788
			<webinf dir="${ecogrid-dir}/lib">
789
			<include name="server-config.wsdd"/>
790
			</webinf>
791
			</war -->
792
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
793
			todir="${dist.dir}" overwrite="true" />
794

    
795

    
796
	</target>
797

    
798
	<target name="get-ecogrid" depends="init"
799
		description="Check out ecogrid module" if="ecogrid.required">
800
		<svn>
801
			<export srcUrl="${svn.ecogridUrl}" force="true"
802
				destPath="${ecogrid-dir}" />
803
		</svn>
804
	</target>
805

    
806
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
807
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
808
		<property name="context" value="${metacat.context}"/>
809
		<property name="target" value="${ecogrid-target-name}"/>
810
		<property name="metacat.dir" value="."/>
811
		<property name="hostname" value="${ecogrid.hostname}"/>
812
		<property name="port" value="${config.port}"/>
813
		</ant>
814
		</target -->
815

    
816
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
817
		description="Automately generate wsdd for ecogrid service">
818
		<delete
819
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
820
	</target>
821

    
822
	<target name="install-skin" depends="init"
823
		description="Install a Skin">
824

    
825
		<input message="Please enter name of the skin"
826
			addproperty="skin-name" />
827

    
828
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
829
		<copy todir="${installdir}/style/skins/${skin-name}"
830
			filtering="yes">
831
			<fileset dir="lib/style/skins/${skin-name}">
832
				<exclude name="**/*.png" />
833
				<exclude name="**/*.gif" />
834
				<exclude name="**/*.jpg" />
835
				<exclude name="**/CVS*" />
836
				<exclude name="**/.#*" />
837
			</fileset>
838
		</copy>
839
		<copy todir="${installdir}/style/skins/${skin-name}"
840
			filtering="no">
841
			<fileset dir="lib/style/skins/${skin-name}">
842
				<include name="**/*.png" />
843
				<include name="**/*.gif" />
844
				<include name="**/*.jpg" />
845
				<exclude name="**/CVS*" />
846
				<exclude name="**/.#*" />
847
			</fileset>
848
		</copy>
849
		<copy todir="${installdir}/style/common" filtering="yes">
850
			<fileset dir="lib/style/common">
851
				<include name="*.js" />
852
				<include name="*.jsp" />
853
				<include name="*.css" />
854
				<exclude name="*.png" />
855
				<exclude name="*.gif" />
856
				<exclude name="*.jpg" />
857
				<exclude name="**/CVS*" />
858
				<exclude name="**/.#*" />
859
			</fileset>
860
		</copy>
861
		<!--
862
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
863
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
864
			<fileset dir="lib/style/skins/${skin-name}/images">
865
			<include name="*.png"/>
866
			<include name="*.gif"/>
867
			<include name="*.jpg"/>
868
			</fileset>
869
			</copy>
870
		-->
871

    
872
		<echo message="Install Skin completed." />
873
	</target>
874

    
875
	<target name="war" depends="warPrepare,install-spatial"
876
		description="Create a web archive (WAR) for servlet deployment">
877
		<mkdir dir="${dist.dir}" />
878
		<war destfile="${dist.dir}/${metacat.context}.war"
879
			webxml="${build.war}/web.xml">
880
			<fileset dir="${war.context}" />
881
			<lib dir="${war.lib}" />
882
			<webinf dir="${war.webinf}" />
883
		</war>
884
	</target>
885

    
886
	<target name="warPrepare"
887
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare,documentation"
888
		description="Prepare files for creating a web archive (WAR)">
889

    
890
		<property name="war.lib" value="${build.war}/lib" />
891
		<property name="war.webinf" value="${build.war}/WEB-INF" />
892
		<property name="war.context"
893
			value="${build.war}/${metacat.context}" />
894
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
895
		<property name="war.webinf.scripts"
896
			value="${war.webinf}/scripts" />
897
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
898
		<property name="war.context.docs" value="${war.context}/docs" />
899
		<property name="war.context.temp" value="${war.context}/temp" />
900
		<property name="war.context.templates"
901
			value="${war.context}${style-common-relpath}/templates" />
902
		<mkdir dir="${war.lib}" />
903
		<mkdir dir="${war.webinf}" />
904
		<mkdir dir="${war.context}" />
905
		<mkdir dir="${war.webinf.sql}" />
906
		<mkdir dir="${war.context.cgi}" />
907
		<mkdir dir="${war.context.docs}" />
908
		<mkdir dir="${war.context.temp}" />
909
		<mkdir dir="${war.context.templates}" />
910

    
911
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
912
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
913
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
914
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
915
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
916
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
917
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
918
		<copy todir="${war.lib}" filtering="no">
919
			<fileset dir="lib">
920
				<include name="*.jar" />
921
				<exclude name="maven-ant-tasks*.jar" />
922
			</fileset>
923
			<fileset dir="${libdir.mvn}" />			
924
		</copy>
925
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
926
			tofile="${build.war}/web.xml" / -->
927
		<!-- MCD added next - Remove the tomcat5 reference-->
928
		<copy file="lib/web.xml.tomcat6" tofile="${build.war}/web.xml" />
929
		<copy file="lib/metacat.properties" todir="${war.webinf}"
930
			filtering="yes" />
931
		<copy todir="${war.webinf}" filtering="yes">
932
		    <fileset dir="lib/account-web-info">
933
		       <exclude name="web.xml" />
934
		    </fileset>
935
		</copy>
936
		<copy file="lib/solrQueryFieldDescriptions.properties" todir="${war.webinf}"/>
937
		<copy file="lib/metacat.properties.metadata.xml"
938
			todir="${war.webinf}" filtering="no" />
939
		<copy file="lib/org.properties.metadata.xml"
940
			todir="${war.webinf}" filtering="no" />
941
		<copy file="lib/auth.properties.metadata.xml"
942
			todir="${war.webinf}" filtering="no" />
943
		<copy todir="${war.webinf}" filtering="yes">
944
			<fileset dir="lib">
945
				<include name="skin.configs/**" />
946
			</fileset>
947
		</copy>
948
		<copy file="lib/log4j.properties" todir="${war.webinf}"
949
			filtering="yes" /> 
950
		<copy file="lib/hazelcast.xml" todir="${war.webinf}"
951
			filtering="yes" />
952
		<!--<copy file="lib/oa4mp_client.xml" todir="${war.webinf}"
953
			filtering="yes" /> -->
954
		<copy todir="${war.context}" filtering="no">
955
			<fileset dir="lib">
956
				<include name="**/*.jpg" />
957
				<include name="**/*.png" />
958
				<include name="**/*.gif" />
959
				<include name="LiveMap_30/**" />
960
				<include name="oaipmh/**" />
961
			</fileset>
962
		</copy>
963
		<copy todir="${war.context}" filtering="yes">
964
			<fileset dir="lib">
965
				<exclude name="*.jar" />
966
				<exclude name="*.properties" />
967
				<exclude name="*.metadata.xml" />
968
				<exclude name="web.xml" />
969
				<exclude name="**/*.jpg" />
970
				<exclude name="**/*.png" />
971
				<exclude name="**/*.gif" />
972
				<exclude name="lsid_lib/**" />
973
				<exclude name="lsid_conf/**" />
974
				<exclude name="LiveMap_30/**" />
975
				<exclude name="oaipmh/**" />
976
				<exclude name="maven/**" />
977
				<exclude name="skin.configs/**" />
978
				<exclude name="spatial/geoserver/**" />
979
			</fileset>
980
		</copy>
981
		<copy todir="${war.context}" filtering="no">
982
			<fileset dir="lib">
983
				<include name="spatial/geoserver/data/**" />
984
			</fileset>
985
		</copy>
986
		<copy todir="${war.context.docs}" filtering="no">
987
			<fileset dir="${build.docs}" />
988
		</copy>
989
		<copy todir="${war.webinf.sql}" filtering="yes">
990
			<fileset dir="src">
991
				<include name="**/*.sql" />
992
			</fileset>
993
		</copy>
994
		<copy todir="${war.webinf.scripts}" filtering="yes">
995
			<fileset dir="src/scripts" />
996
		</copy>
997
		<copy todir="${war.webinf.scripts}"
998
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
999
			failonerror="false" />
1000

    
1001
		<copy file="src/perl/register-dataset.cgi"
1002
			todir="${war.context.cgi}" />
1003
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1004
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1005

    
1006
		<!-- registry cgi section -->
1007
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
1008
			used in readDocumentFromMetacat -->
1009
		<!-- TODO MCD copy temp files to actual location using config util?? -->
1010
		<copy todir="${war.context.temp}" filtering="yes">
1011
			<fileset dir="lib/style/common/emlb6toeml2">
1012
				<include name="*.xsl" />
1013
				<include name="*.xml" />
1014
			</fileset>
1015
		</copy>
1016
		<available file="lib/style/common/emlb6toeml2" type="dir"
1017
			property="styles.not.needed" />
1018

    
1019
		<!-- ldap cgi section -->
1020
		<copy todir="${war.context.templates}">
1021
			<fileset dir="lib/style/common/templates">
1022
				<!-- SCW: Copy all files -->
1023
			</fileset>
1024
		</copy>
1025
	</target>
1026

    
1027
	<target name="cgiPrepare" if="build.perl">
1028
		<exec dir="src/perl/Metacat/" executable="make">
1029
			<arg value="clean" />
1030
		</exec>
1031
		<exec dir="src/perl/Metacat/" executable="perl">
1032
			<arg value="Makefile.PL" />
1033
		</exec>
1034
		<exec dir="src/perl/Metacat/" executable="make" />
1035
	</target>
1036

    
1037
	<target name="testPrepare"
1038
		description="Copies test files into the war directories">
1039
		<echo>in testPrepare</echo>
1040
		<property name="war.context.test"
1041
			value="${build.war}/${metacat.context}/test" />
1042
		<mkdir dir="${war.context.test}" />
1043
		<copy todir="${war.context.test}" filtering="yes">
1044
			<fileset dir="test/servertestfiles">
1045
				<include name="*/**" />
1046
			</fileset>
1047
		</copy>
1048
	</target>
1049

    
1050
	<target name="getConversionXSL" depends="prepare,giteml"
1051
		unless="styles.not.needed"
1052
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1053

    
1054
		<mkdir dir="lib/style/common/emlb6toeml2" />
1055
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1056
			<fileset
1057
				dir="${build.tmp}/eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1058
				<include name="*.xsl" />
1059
				<include name="*.xml" />
1060
			</fileset>
1061
		</copy>
1062
	</target>
1063

    
1064
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1065
		<mkdir dir="${build.tests}" />
1066
		<copy todir="${build.tests}" encoding="UTF-8">
1067
			<fileset dir="${testdir}">
1068
				<include name="edu/**" />
1069
			</fileset>
1070
		</copy>
1071
		<copy todir="${build.tests}" file="${testdir}/test.properties" />
1072

    
1073
		<path id="test.classpath">
1074
			<path refid="compile.classpath" />
1075
			<fileset dir="${build.dir}">
1076
				<include name="${name}.jar" />
1077
				<include name="${name}-client.jar" />
1078
				<include name="harvester.jar" />
1079
			</fileset>
1080
		</path>
1081
		
1082
		<pathconvert pathsep="${line.separator}|  |--" 
1083
		             property="echo.test.classpath"
1084
		             refid="test.classpath">
1085
		</pathconvert>
1086
		<echo message="|--test classpath" />
1087
		<echo message="|  |" />
1088
		<echo message="|  |-- ${echo.test.classpath}" />
1089
		
1090
		<!-- copy and compile the tests into a jar file -->
1091
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1092
			debug="on" includes="**/*.java" encoding="UTF-8">
1093
			<classpath refid="test.classpath" />
1094
		</javac>
1095

    
1096
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1097
			basedir="${build.tests}" >
1098
			<include name="**/*.class"/>
1099
			<include name="**/*.xml"/>
1100
		</jar>	
1101
		
1102
	</target>
1103

    
1104
	<target name="runoneclass" depends="testprep"
1105
		description="Uses the ant to run a class">
1106
		
1107
		<java classname="${classtorun}" fork="true">
1108
			<arg line="${args}" />
1109
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1110
			<classpath>
1111
				<path refid="test.classpath" />
1112
				<fileset dir="${build.dir}">
1113
					<include name="${name}.jar" />
1114
					<include name="${name}-client.jar" />
1115
					<include name="harvester.jar" />
1116
					<include name="${name}-junittests.jar" />
1117
				</fileset>
1118
			</classpath>
1119
		</java>
1120
	</target>
1121
	
1122
	<target name="test" depends="testprep"
1123
		description="Uses the ant junit task to run all JUnit tests">
1124

    
1125
		<!-- use the ant "junit" task to run JUnit tests. -->
1126
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1127
			haltonerror="no">
1128
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1129
			<classpath>
1130
				<path refid="test.classpath" />
1131
				<fileset dir="${build.dir}">
1132
					<include name="${name}.jar" />
1133
					<include name="${name}-client.jar" />
1134
					<include name="harvester.jar" />
1135
					<include name="${name}-junittests.jar" />
1136
				</fileset>
1137
			</classpath>
1138

    
1139
			<formatter type="plain" />
1140

    
1141
			<batchtest fork="yes" todir="${build.dir}">
1142
				<fileset dir="${build.tests}">
1143
					<include name="**/*.class" />
1144
					<exclude name="**/MCTestCase.class" />
1145
					<exclude name="**/ClientViewHelperTest.class" />
1146
					<!-- these are not test cases -->
1147
					<exclude name="**/MockCNode.class" />
1148
					<exclude name="**/D1NodeServiceTest.class" />
1149
					<exclude name="**/D1NodeServiceTest$1.class" />
1150
					<exclude name="**/QueryRunner.class" />
1151
					<exclude name="**/MockObjectPathMap.class" />
1152
					<exclude name="**/HzObjectPathMapTest$1.class" />
1153
					<exclude name="**/HzObjectPathMapTest$2.class" />
1154
				</fileset>
1155
			</batchtest>
1156
		</junit>
1157
	</target>
1158

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

    
1162
		<echo>testtorun: ${testtorun}</echo>
1163

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

    
1178
			<formatter type="plain" />
1179

    
1180
			<batchtest fork="yes" todir="${build.dir}">
1181
				<fileset dir="${build.tests}">
1182
					<include name="**/${testtorun}.class" />
1183
				</fileset>
1184
			</batchtest>
1185
		</junit>
1186
	</target>
1187
	
1188
	<target name="run" depends="testprep"
1189
			description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1190

    
1191
			<echo>testtorun: ${testtorun}</echo>
1192

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

    
1207
				<formatter type="plain" />
1208

    
1209
				<batchtest fork="yes" todir="${build.dir}">
1210
					<fileset dir="${build.tests}">
1211
						<include name="**/${testtorun}.class" />
1212
					</fileset>
1213
				</batchtest>
1214
			</junit>
1215
		</target>
1216

    
1217
	<target name="testharvester" depends="testprep"
1218
		description="Uses the ant junit task to test only the Harvester code">
1219
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1220
			haltonerror="off">
1221
			<classpath>
1222
				<path refid="compile.classpath" />
1223
				<fileset dir="${build.dir}">
1224
					<include name="${name}.jar" />
1225
					<include name="${name}-client.jar" />
1226
					<include name="harvester.jar" />
1227
					<include name="${name}-junittests.jar" />
1228
				</fileset>
1229
			</classpath>
1230
			<formatter type="plain" />
1231
			<batchtest fork="yes" todir="${build.dir}">
1232
				<fileset dir="${build.tests}">
1233
					<include name="**/harvesterClient/*.class" />
1234
				</fileset>
1235
			</batchtest>
1236
		</junit>
1237
	</target>
1238

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

    
1243
		<echo>
1244
			*********************************** Please run ant
1245
			gethttpclient first! ***********************************
1246
		</echo>
1247
		<!-- copy and compile the tests into a jar file -->
1248
		<mkdir dir="${build.metacatnettest}" />
1249
		<javac srcdir="${junitnettestsdir}"
1250
			destdir="${build.metacatnettest}" includes="**/*.java">
1251
			<classpath>
1252
				<path refid="compile.classpath" />
1253
				<fileset dir="${build.dir}">
1254
					<include name="${name}.jar" />
1255
				</fileset>
1256
			</classpath>
1257
		</javac>
1258

    
1259
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1260
			basedir="${build.metacatnettest}" includes="**/*.class" />
1261

    
1262
		<!-- use the ant "junit" task to run JUnit tests. -->
1263
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1264
			haltonerror="no">
1265
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1266
			<classpath>
1267
				<path refid="compile.classpath" />
1268
				<fileset dir="${build.dir}">
1269
					<include name="${name}.jar" />
1270
					<include name="${name}-junitnettests.jar" />
1271
				</fileset>
1272
			</classpath>
1273

    
1274
			<formatter type="plain" />
1275

    
1276
			<batchtest fork="yes" todir="${build.dir}">
1277
				<fileset dir="${build.metacatnettest}">
1278
					<include name="**/*.class" />
1279
				</fileset>
1280
			</batchtest>
1281
		</junit>
1282
	</target>
1283

    
1284
	<target name="cleanweb" depends="clean"
1285
		description="deletes tomcat web context dir and all its contents">
1286
		<delete dir="${installdir}" />
1287
	</target>
1288

    
1289

    
1290
	<target name="clean" depends="init"
1291
		description="deletes build dir and files that can be regenerated form the release">
1292
		<delete dir="${build.dir}" />
1293
		<delete dir="${dist.dir}" />
1294
		<delete dir="${metacatui.build.dir}" />
1295
	</target>
1296

    
1297
	<target name="fullclean" depends="clean"
1298
		description="deletes code and eml">
1299
		<delete includeEmptyDirs="true" failonerror="false">
1300
			<fileset dir="${style-common-cvsrelpath}">
1301
				<include name="${eml-css}" />
1302
				<include name="eml-*/*.xsl" />
1303
				<include name="eml-*" />
1304
			</fileset>
1305
			<fileset dir="${schema-cvsrelpath}">
1306
				<include name="eml-*/*.xsd" />
1307
			</fileset>
1308
			<fileset dir="${ecogrid-dir}"/>
1309
			<fileset dir="lib/style/common/emlb6toeml2"/>
1310
			<fileset dir="lib/dtd"/>
1311
			<fileset dir="${libdir.mvn}"/>
1312
		</delete>
1313
		<!-- remove the entire directory -->
1314
		<delete includeemptydirs="true" dir="${metacatui.build.dir}" />
1315
		<!-- clean up the distribution files if they exist-->
1316
		<delete file="./${name}-bin-${release}.tar.gz" />
1317
		<delete file="./${name}-src-${release}.tar.gz" />
1318
		<delete file="./${name}-bin-${release}.zip" />
1319
		<delete file="./${name}-src-${release}.zip" />
1320
	</target>
1321
	
1322
	<target name="documentation" depends="javadoc,admindoc"
1323
	    description="generates Javadoc API documentation and Admin Guide">
1324
    </target>
1325
	
1326
	<target name="admindoc" depends="prepare">
1327
		<!-- Build the administrator's guide, which is a Sphinx RST project
1328
		     For this to succeed, you must have Sphinx installed on your machine
1329
		     See: http://sphinx.pocoo.org/ for details
1330
		     And you must also have the 'make' build tool installed
1331
		-->
1332
		<exec dir="${docdir}/user/metacat" executable="make"> 
1333
		        <arg value="plantuml"/> 
1334
		</exec>
1335
		
1336
		<exec dir="${docdir}/user/metacat" executable="make"> 
1337
		        <arg value="html"/> 
1338
		</exec>
1339
		
1340
    </target>
1341

    
1342
	<target name="javadoc" depends="prepare"
1343
		description="generates Javadoc API documentation">
1344
		<javadoc packagenames="edu.ucsb.nceas.*"
1345
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1346
			version="true" use="true" windowtitle="${Name} API"
1347
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1348
			bottom="&lt;i&gt;Copyright &#169; ${copyright}. All Rights Reserved.&lt;/i&gt;">
1349
			<classpath>
1350
				<path refid="compile.classpath" />
1351
			</classpath>
1352
		</javadoc>
1353
	</target>
1354

    
1355
	<target name="dist"
1356
		depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL"
1357
		description="prepares a full release distribution">
1358
		<mkdir dir="${dist.dir}" />
1359
		<delete dir="${ver.dir}" />
1360
		<mkdir dir="${ver.dir}" />
1361
		<copy todir="${ver.dir}">
1362
			<fileset dir="."
1363
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1364
		</copy>
1365
		<copy todir="${ver.dir}" file="build.xml" />
1366
		<copy todir="${ver.dir}" file="build.properties" />
1367

    
1368
		<copy todir="${ver.dir}/docs" filtering="yes">
1369
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1370
		</copy>
1371
		<copy todir="${ver.dir}/docs" filtering="no">
1372
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1373
		</copy>
1374
		<copy todir="${ver.dir}/docs/dev">
1375
			<fileset dir="${build.dir}/docs" />
1376
		</copy>
1377
		<copy todir="${ver.dir}/src">
1378
			<fileset dir="${build.dir}/src" />
1379
		</copy>
1380

    
1381
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1382
		<copy todir="${ver.dir}/test/servertestfiles">
1383
			<fileset dir="./test/servertestfiles" />
1384
		</copy>
1385
	</target>
1386

    
1387
	<target name="fulldist" depends="distbin, distsrc"
1388
			description="full distribution - source and bin"/>
1389
		
1390
	<target name="distbin" depends="build-metacat,war-lsid"
1391
		description="prepares a binary distribution">
1392
		<copy todir="${dist.dir}">
1393
			<fileset dir="./src/scripts" />
1394
		</copy>
1395
		<delete file="./${name}-bin-${release}.zip" />
1396
		<zip zipfile="./${name}-bin-${release}.zip"
1397
			basedir="${dist.dir}" />
1398
		<delete file="./${name}-bin-${release}.tar.gz" />
1399
		<tar tarfile="./${name}-bin-${release}.tar"
1400
			basedir="${dist.dir}" />
1401
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1402
			src="./${name}-bin-${release}.tar" />
1403
		<delete file="./${name}-bin-${release}.tar" />
1404
	</target>
1405

    
1406
	<target name="distsrc" depends="dist"
1407
		description="prepares a source distribution">
1408
		<mkdir dir="${ver.src}" />
1409
		<copy todir="${ver.src}">
1410
			<fileset dir="./src" />
1411
		</copy>
1412
		
1413

    
1414
		<!--<mkdir dir="${ecogrid-dist-dir}" />
1415
		<copy todir="${ecogrid-dist-dir}">
1416
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1417
		</copy>-->
1418

    
1419

    
1420
		<delete file="./${name}-src-${release}.zip" />
1421
		<zip zipfile="./${name}-src-${release}.zip"
1422
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1423
		<delete file="./${name}-src-${release}.tar.gz" />
1424
		<tar tarfile="./${name}-src-${release}.tar"
1425
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1426
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1427
			src="./${name}-src-${release}.tar" />
1428
		<delete file="./${name}-src-${release}.tar" />
1429
		<!--delete dir="${dist.dir}"/ -->
1430
	</target>
1431

    
1432
	<target name="deb-package" depends="distbin"
1433
		description="create a debian installation package">
1434
		<delete dir="${deb.pkg.dir}" />
1435
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1436
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1437
			<fileset dir="./src/scripts/debian"
1438
				includes="control postinst" />
1439
		</copy>
1440

    
1441
		<mkdir
1442
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1443
		<copy
1444
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1445
			filtering="yes">
1446
			<fileset dir="./src/scripts/debian"
1447
				excludes="control postinst" />
1448
		</copy>
1449
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1450

    
1451
		<copy file="${dist.dir}/${metacat.context}.war"
1452
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1453
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1454
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1455

    
1456
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1457
			failonerror="true">
1458
			<arg line="--build debian" />
1459
		</exec>
1460

    
1461
		<move file="${pkg.dir}/debian.deb"
1462
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1463
	</target>
1464

    
1465
	<target name="stylesheettest">
1466
		<xslt in="${input}" out="eml.html"
1467
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1468
			<param name="displaymodule" expression="${displaymodule}" />
1469
			<param name="docid" expression="${input}" />
1470
			<param name="entitytype" expression="${entitytype}" />
1471
			<param name="entityindex" expression="${entityindex}" />
1472
			<outputproperty name="method" value="html" />
1473
			<outputproperty name="standalone" value="yes" />
1474
			<outputproperty name="encoding" value="iso8859_1" />
1475
			<outputproperty name="indent" value="yes" />
1476
		</xslt>
1477
	</target>
1478

    
1479
	<target name="spatial_option" depends="prepare"
1480
		description=" -- compiles code for the spatial option">
1481

    
1482
		<echo message="Compiling the metatcat shapefile creator" />
1483
		<echo message="using the shapelib at: ${shapelib.dir}" />
1484
		<exec dir="." executable="g++" os="Linux, Unix"
1485
			failonerror="true">
1486
			<arg
1487
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1488
		</exec>
1489

    
1490
		<exec dir="." executable="g++" os="Linux, Unix"
1491
			failonerror="true">
1492
			<arg
1493
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1494
		</exec>
1495
	</target>
1496

    
1497
	<!-- LSID Authority support -->
1498
	<patternset id="lsid.jars">
1499
		<include name="axis.jar" />
1500
		<include name="commons-discovery-0.2.jar" />
1501
		<include name="jaxrpc.jar" />
1502
		<include name="lsid-client-1.1.1.jar" />
1503
		<include name="lsid-server-1.1.1.jar" />
1504
		<include name="saaj.jar" />
1505
		<include name="wsdl4j-1.5.1.jar" />
1506
		<include name="activation.jar" />
1507
		<include name="castor-0.9.5.jar" />
1508
		<include name="dnsjava-1.3.2.jar" />
1509
		<include name="mail.jar" />
1510
		<include name="commons-logging-1.0.4.jar" />
1511
		<!-- These jars may be needed but seem to not actually be,
1512
			so leaving them out for now
1513
			<include name="axis-ant.jar" />
1514
		-->
1515
		<!--<include name="GenCastor.class" />-->
1516
	</patternset>
1517
	<patternset id="lib.jars">
1518
		<include name="log4j-1.2.12.jar" />
1519
		<include name="utilities-*.jar" />
1520
		<include name="xerces*.jar" />
1521
		<include name="xalan*.jar" />
1522
		<include name="xml-apis*.jar" />
1523
	</patternset>
1524

    
1525
	<path id="lsid.classpath">
1526
		<fileset dir="${lsid.lib.dir}">
1527
			<patternset refid="lsid.jars" />
1528
		</fileset>
1529
		<fileset dir="${lib.dir}">
1530
			<patternset refid="lib.jars" />
1531
		</fileset>
1532
		<fileset dir="${build.dir}">
1533
			<include name="metacat-client.jar" />
1534
			<include name="metacat.jar" />
1535
		</fileset>
1536
	</path>
1537

    
1538
	<filterset id="configFilters">
1539
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1540
			value="${config.hostname}" / -->
1541
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1542
			value="${config.port}" / -->
1543
		<!-- MCD BYE filter token="METADATA_LABELS"
1544
			value="${config.metadataLabelLsid}" / -->
1545
		<!-- MCD BYE filter token="METACAT_SERVER"
1546
			value="${config.metacatserver}" / -->
1547
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1548
			value="${config.lsidauthority}" / -->
1549
	</filterset>
1550

    
1551
	<target name="prepare-lsid" depends="prepare,clientjar"
1552
		description="Configure files prior to compilation">
1553
		<mkdir dir="${lsid.build.dir}" />
1554
		<!-- Copy the properties file into the build -->
1555
		<copy file="${conf.dir}/metacat-lsid.properties"
1556
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1557
			overwrite="true">
1558
			<filterset refid="configFilters" />
1559
		</copy>
1560
		<copy file="${conf.dir}/log4j.properties"
1561
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1562
			overwrite="true">
1563
			<filterset refid="configFilters" />
1564
		</copy>
1565
		<!-- Copy config files into the build -->
1566
		<copy todir="${lsid.build.dir}/WEB-INF">
1567
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1568
		</copy>
1569
		<!-- Copy the metadata configuration files into the build -->
1570
		<mkdir
1571
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1572
		<copy
1573
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1574
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1575
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1576
			<filterset refid="configFilters" />
1577
		</copy>
1578
		<!-- Copy services files into the build -->
1579
		<mkdir dir="${lsid.build.dir}/services" />
1580
		<copy todir="${lsid.build.dir}/services">
1581
			<fileset dir="${services.dir}" />
1582
			<filterset refid="configFilters" />
1583
		</copy>
1584
		<!-- Copy axis files into the build -->
1585
		<mkdir dir="${lsid.build.dir}" />
1586
		<copy todir="${lsid.build.dir}">
1587
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1588
		</copy>
1589
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1590
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1591
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1592
		</copy>
1593
	</target>
1594

    
1595
	<target name="compile-lsid" depends="prepare-lsid"
1596
		description="Compile Java sources">
1597
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1598
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1599
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1600
			deprecation="${compile.deprecation}"
1601
			target="${java.target.version}"
1602
			source="${java.source.version}"
1603
			optimize="${compile.optimize}">
1604
			<classpath>
1605
				<path refid="compile.classpath" />
1606
				<fileset dir="${build.dir}">
1607
					<include name="${name}.jar" />
1608
				</fileset>
1609
			</classpath>
1610
		</javac>
1611
	</target>
1612

    
1613
	<target name="war-lsid" depends="compile-lsid"
1614
		description="Create a war file for the application">
1615
		<mkdir dir="${dist.dir}" />
1616
		<war destfile="${dist.dir}/${authority.context}.war"
1617
			webxml="${webinf.dir}/web.xml">
1618
			<fileset dir="${lsid.build.dir}" />
1619
			<lib dir="${lsid.lib.dir}">
1620
				<patternset refid="lsid.jars" />
1621
			</lib>
1622
			<lib dir="${lib.dir}">
1623
				<patternset refid="lib.jars" />
1624
			</lib>
1625
			<lib dir="${lib.dir}">
1626
				<include name="xalan.jar" />
1627
				<include name="xml-apis.jar" />
1628
			</lib>
1629
			<lib dir="${build.dir}">
1630
				<include name="metacat-client.jar" />
1631
			</lib>
1632
		</war>
1633
	</target>
1634

    
1635
	<target name="deploy-lsid" depends="war-lsid"
1636
		description="Deploy LSID war to servlet container">
1637
		<delete dir="${app.deploy.dir}/${authority.context}" />
1638
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1639
		<mkdir dir="${app.deploy.dir}" />
1640
		<copy todir="${app.deploy.dir}">
1641
			<fileset dir="${dist.dir}" />
1642
		</copy>
1643
	</target>
1644
	
1645
	<target name="change-metacat-properties" depends="warPrepare"
1646
        description="Chage some default values of metacat.properties">
1647
       <echo file="${metacat-properties-file}" append="true">
1648
		   configutil.propertiesConfigured=true
1649
		   configutil.authConfigured=true
1650
           configutil.skinsConfigured=true
1651
		   configutil.databaseConfigured=true
1652
		   configutil.geoserverConfigured=true
1653
	   </echo>
1654
  </target>
1655
	
1656
	<!-- This target will use default values in svn metacat.properties to build a configured 
1657
		metacat (except configuti.* properties, they will be set true). Those default settings
1658
		are for a test machine. It may not work on your system-->
1659
	<target name="install-configured-metacat" depends="change-metacat-properties, install"
1660
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1661
    </target>
1662
	
1663
	<!-- build metacat-common jar -->
1664
	<target name="build-metacat-common" description="Calls the Maven build for metacat-common jar" unless="build-metacat-common-called" >
1665
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1666
			        <jvmarg value="-Dmaven.multiModuleProjectDirectory=${maven.home}" />
1667
		            <arg value="clean"/>
1668
		</artifact:mvn>
1669
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1670
			<jvmarg value="-Dmaven.multiModuleProjectDirectory=${maven.home}" />
1671
		   <arg value="install"/>
1672
		</artifact:mvn>
1673
		<property name="build-metacat-common-called" value="true"/>
1674
	</target>
1675

    
1676
	<!-- build metacat-index war -->
1677
	<target name="build-metacat-index" description="Calls the Maven build for metacat-index.war" >		
1678
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1679
			<jvmarg value="-Dmaven.multiModuleProjectDirectory=${maven.home}" />
1680
			<arg value="clean"/>
1681
		</artifact:mvn>
1682
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1683
			<jvmarg value="-Dmaven.multiModuleProjectDirectory=${maven.home}" />
1684
			<arg value="package"/>
1685
			<!--<arg value="-Dmaven.test.skip=true"/>-->
1686
		</artifact:mvn>
1687
	</target>
1688
	
1689
	<target name="dist-metacat-index" depends="init, build-metacat-index" description="Copy metacat-index.war to dist folder" >		
1690
		<copy tofile="${dist.dir}/metacat-index.war" >
1691
			<fileset dir="metacat-index/target" includes="metacat-index*.war"></fileset>
1692
		</copy>	
1693
	</target>
1694
	
1695
	<target name="install-metacat-index" depends="dist-metacat-index" description="Copy metacat-index.war to deploy folder" >		
1696
		<copy todir="${app.deploy.dir}" file="${dist.dir}/metacat-index.war" />
1697
	</target>
1698
	
1699
	<!-- Generate a light war file which only is used to manage the ldap user accounts - register a new user, reset and change the password -->
1700
	<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">
1701
		  <property name="war-name" value="identity" />
1702
		  <mkdir dir="${dist.dir}" />
1703
		     <war destfile="${dist.dir}/${war-name}.war"
1704
		            webxml="lib/account-web-info/web.xml">
1705
		      <webinf dir="${war.webinf}">
1706
		        <include name="metacat.properties"/>
1707
		        <include name="gd_intermediate_bundle_nceas_ldap.crt"/>
1708
		      </webinf>
1709
		      <fileset dir="${war.context}">
1710
		        <include name="cgi-bin/**"/>
1711
		      	<include name="style/**"/>  
1712
		      </fileset>
1713
		      
1714
		   </war>
1715
	</target>
1716
	
1717
</project>
(5-5/7)