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-05-20 15:31:09 -0700 (Fri, 20 May 2016) $'
11
	*    '$Revision: 9803 $'
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-module" value="eml" />
237
		<property name="eml-version" value="2.0.0beta6" />
238
		<property name="eml-beta4-version" value="2.0.0beta4" />
239
		<property name="eml-beta-tag"
240
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
241
		<property name="eml-beta4-tag"
242
					value="RELEASE_EML_2_BETA_4" />
243
		<property name="eml2_0_0-schema-tag"
244
			value="RELEASE_EML_2_0_0_UPDATE_1" />
245
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
246
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
247
		<property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1" />
248
		<!--<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_7" />-->
249
		<property name="eml2-style-tag" value="trunk" />
250

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

    
269

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

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

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

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

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

    
338

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

    
343
		<property name="srcdir" value="./src" />
344
		<property name="lib.dir" value="./lib" />
345
		<property name="docdir" value="./docs" />
346
		<property name="cgidir" value="./cgi-bin" />
347
		<property name="testdir" value="./test" />
348
		<property name="testtorun" value="MNodeServiceTest" />
349
		<property name="junittestsdir"
350
			value="./test/edu/ucsb/nceas/metacattest" />
351
		<property name="junitnettestsdir"
352
			value="./test/edu/ucsb/nceas/metacatnettest" />
353
		<property name="classtorun" value="edu.ucsb.nceas.metacat.admin.upgrade.dataone.GenerateSystemMetadata" />
354
		<property name="build.dir" value="./build" />
355
		<property name="build.src" value="${build.dir}/src" />
356
		<property name="build.dest" value="${build.dir}/classes" />
357
		<property name="build.samples" value="${build.dir}/samples" />
358
		<property name="build.tests" value="${build.dir}/tests" />
359
		<property name="build.tmp" value="${build.dir}/tmp" />
360
		<property name="build.metacattest"
361
			value="${build.tests}/metacattest" />
362
		<property name="build.metacatnettest"
363
			value="${build.tests}/metacatnettest" />
364
		<property name="build.data" value="${build.dir}/data" />
365
		<property name="build.docs" value="${build.dir}/docs" />
366
		<property name="build.javadocs" value="${build.docs}/api" />
367
		<property name="build.war" value="${build.dir}/war" />
368
		<property name="dist.dir" value="dist" />
369
		<property name="ver.dir" value="${dist.dir}/${name}-${release}" />
370
		<property name="ver.src" value="${ver.dir}/src" />
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.ecogridUrl"
397
			value="https://code.ecoinformatics.org/code/seek/${seek-tag}/projects/ecogrid/" />
398
		<property name="svn.emlBetaUrl"
399
			value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
400
		<property name="svn.emlBeta4Url"
401
					value="https://code.ecoinformatics.org/code/eml/tags/${eml-beta4-tag}" />
402
		<property name="svn.eml200SchemaUrl"
403
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
404
		<property name="svn.eml201SchemaUrl"
405
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
406
		<property name="svn.eml210SchemaUrl"
407
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
408
		<property name="svn.eml211SchemaUrl"
409
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_1-schema-tag}" />
410
		<property name="svn.eml2StyleUrl"
411
			value="https://code.ecoinformatics.org/code/eml/${eml2-style-tag}" />
412
		
413
		<!-- the git repo -->
414
		<property name="metacatui.git.repository.url"
415
					value="https://github.com/NCEAS/metacatui.git" />
416
		<property name="metacatui.git.repository.refname"
417
							value="METACATUI_1_11_3" />
418
		<!--<property name="metacatui.git.repository.refname"
419
									value="master" />-->
420
		<property name="metacatui.build.dir"
421
					value="metacatui_build" />
422
		<property name="metacatui.resources.dir"
423
					value="${metacatui.build.dir}/metacatui/src/main/webapp" />
424
		
425
		<!-- load the svn task -->
426
		<path id="svn.classpath">
427
			<pathelement location="${svnjavahl.jar}" />
428
			<pathelement location="${svnant.jar}" />
429
			<pathelement location="${svnClientAdapter.jar}" />
430
		</path>
431
		<taskdef resource="svntask.properties"
432
			classpathref="svn.classpath" />
433

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

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

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

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

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

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

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

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

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

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

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

    
540

    
541
	<target name="client" depends="prepare"
542
		description="Compiles metacat-client java code to build dir">
543
		<javac srcdir="${build.src}" destdir="${build.dest}"
544
			target="${java.target.version}"
545
			source="${java.source.version}"
546
			includes="edu/ucsb/nceas/metacat/client/*">
547
			<classpath>
548
				<path refid="compile.classpath" />
549
			</classpath>
550
		</javac>
551
	</target>
552

    
553
	<target name="clientjar" depends="client"
554
		description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
555
		<delete file="${build.dir}/${name}-client.jar" />
556
		<jar jarfile="${build.dir}/${name}-client.jar"
557
			basedir="${build.dest}" includes="**/metacat/client/" />
558
	</target>
559

    
560
	<target name="advancedsearchjar" depends="compile"
561
		description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
562
		<delete file="${build.dir}/advancedsearch.jar" />
563
		<jar jarfile="${build.dir}/advancedsearch.jar"
564
			basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
565
	</target>
566

    
567
	<target name="harvester" depends="client"
568
		description="Compiles harvester java code to build dir">
569
		<javac srcdir="${build.src}" destdir="${build.dest}"
570
			target="${java.target.version}"
571
			source="${java.source.version}"
572
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
573
			<classpath>
574
				<path refid="compile.classpath" />
575
			</classpath>
576
		</javac>
577
	</target>
578
		
579
	<target name="harvesterjar" depends="harvester"
580
		description="Compiles and jars harvester java code to harvester.jar in build dir">
581
		<delete file="${build.dir}/harvester.jar" />
582
		<jar jarfile="${build.dir}/harvester.jar"
583
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
584
	</target>
585

    
586
	<target name="harvestListEditorDist" depends="harvesterjar"
587
		description="Prepares a distribution of the Harvest List Editor tool">
588
		<mkdir dir="${dist.dir.hle}" />
589
		<delete dir="${ver.dir.hle}" />
590
		<mkdir dir="${ver.dir.hle}" />
591
		<copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
592
		<copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
593
		<copy todir="${ver.dir.hle}"
594
			file="lib/harvester/harvestList.xsd" />
595
		<copy todir="${ver.dir.hle}"
596
			file="lib/harvester/harvestListEditor.bat" />
597
		<copy todir="${ver.dir.hle}"
598
			file="lib/harvester/harvestListEditor.sh" />
599
		<delete file="./harvest-list-editor-${release}.zip" />
600
		<zip zipfile="./harvest-list-editor-${release}.zip"
601
			basedir="${ver.dir.hle}" />
602
		<delete file="./harvest-list-editor-${release}.tar.gz" />
603
		<tar tarfile="./harvest-list-editor-${release}.tar"
604
			basedir="${ver.dir.hle}" />
605
		<gzip zipfile="./harvest-list-editor-${release}.tar.gz"
606
			src="./harvest-list-editor-${release}.tar" />
607
		<delete file="./harvest-list-editor-${release}.tar" />
608
	</target>
609

    
610
	<target name="geteml" depends="getemlpre2,getemlpre2beta4,geteml2+,getConversionXSL"
611
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
612

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

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

    
653
			<!--
654
			<copy todir="${style-common-cvsrelpath}" filtering="yes">
655
				<fileset
656
					dir="${build.tmp}/eml_${eml-beta4-tag}/style">
657
					<include name="**/*.xsl" />
658
				</fileset>
659
			</copy>
660
			-->
661
		</target>
662

    
663
	<target name="geteml2+" depends="prepare" if="eml.required"
664
		description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
665
		<svn>
666
			<export srcUrl="${svn.eml200SchemaUrl}"
667
				destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
668
		</svn>
669
		<mkdir dir="lib/schema/eml-2.0.0" />
670
		<copy todir="lib/schema/eml-2.0.0" filtering="yes">
671
			<fileset
672
				dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
673
				<include name="*.xsd" />
674
			</fileset>
675

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

    
682
		</copy>
683
		<!-- <antcall target="copyxsl">
684
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
685
			<param name="dirname" value="eml-2.0.0" />
686
			</antcall> -->
687

    
688
		<!-- Checkout eml201 for given schema tag-->
689
		<svn>
690
			<export srcUrl="${svn.eml201SchemaUrl}"
691
				destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
692
		</svn>
693
		<mkdir dir="lib/schema/eml-2.0.1" />
694
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
695
			<fileset
696
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
697
				<include name="*.xsd" />
698
			</fileset>
699
		</copy>
700

    
701
		<!-- Checkout eml201 again for given style sheet tag-->
702
		<!-- echo>Enter CVS password: </echo>
703
			<cvs cvsRoot="${cvsroot}"
704
			package="${eml-module}"
705
			tag="${eml2_0_1-style-tag}"
706
			dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
707
			<antcall target="copyxsl">
708
			<param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
709
			<param name="dirname" value="eml-2.0.1" />
710
			</antcall -->
711

    
712
		<!-- Checkout eml210 for given schema tag-->
713
		<svn>
714
			<export srcUrl="${svn.eml210SchemaUrl}"
715
				destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
716
		</svn>
717
		<mkdir dir="lib/schema/eml-2.1.0" />
718
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
719
			<fileset
720
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
721
				<include name="*.xsd" />
722
			</fileset>
723
		</copy>
724

    
725
		<!-- Checkout eml210 for given style sheet tag-->
726
		<svn>
727
			<export srcUrl="${svn.eml2StyleUrl}"
728
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
729
		</svn>
730
		<antcall target="copyxsl">
731
			<param name="cvs.tagname" value="${eml2-style-tag}" />
732
			<!-- param name="dirname" value="eml-2.1.0" / -->
733
			<param name="dirname" value="eml-2" />
734
		</antcall>
735
		
736
		<!-- Checkout eml210 for given schema tag-->
737
		<svn>
738
			<export srcUrl="${svn.eml211SchemaUrl}"
739
				destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
740
		</svn>
741
		<mkdir dir="lib/schema/eml-2.1.1" />
742
		<copy todir="lib/schema/eml-2.1.1" filtering="yes">
743
			<fileset
744
				dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
745
				<include name="*.xsd" />
746
			</fileset>
747
		</copy>
748
	</target>
749

    
750
	<target name="copyxsl"
751
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
752

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

    
755
		<copy todir="${style-common-cvsrelpath}/${dirname}"
756
			filtering="yes">
757
			<fileset
758
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
759
				<include name="**/*.xsl" />
760
			</fileset>
761
		</copy>
762

    
763

    
764
		<!-- now copy default css from eml module and put it in style-common-path
765
			dir with a new name, so other skin-specific css can import it if reqd -->
766
		<copy
767
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
768
			tofile="${style-common-cvsrelpath}/${eml-css}" />
769

    
770
	</target>
771

    
772
	<target name="correctEML201Docs" depends="jar"
773
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
774
		<copy todir="${build.dir}" file="lib/metacat.properties"
775
			filtering="yes" />
776
		<java
777
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
778
			<classpath>
779
				<path refid="compile.classpath" />
780
				<fileset dir="${build.dir}">
781
					<include name="${name}.jar" />
782
				</fileset>
783
			</classpath>
784
		</java>
785
	</target>
786

    
787
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
788
		description="Installs spatial option for metacat">
789
		
790
		<copy todir="${dist.dir}">
791
			<fileset dir="./lib/spatial/geoserver" includes="*.war" />
792
		</copy>
793

    
794
	</target>
795

    
796
	<target name="install" depends="build-metacat"
797
		description="* Install Metacat For Development *">
798
		<copy file="${dist.dir}/${metacat.context}.war"
799
			todir="${app.deploy.dir}" />
800
		<delete dir="${app.deploy.dir}/${metacat.context}" />
801
		<copy file="${dist.dir}/geoserver.war"
802
					todir="${app.deploy.dir}" />
803
		<delete dir="${app.deploy.dir}/geoserver" />
804
		<copy file="${dist.dir}/metacat-index.war"
805
					todir="${app.deploy.dir}" />
806
		<delete dir="${app.deploy.dir}/metacat-index" />
807
		<copy file="${dist.dir}/metacatui.war"
808
					todir="${app.deploy.dir}" />
809
		<delete dir="${app.deploy.dir}/metacatui" />
810
		<tstamp>
811
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
812
		</tstamp>
813
		<echo>Dev install completed at ${NOW}</echo>
814
	</target>
815

    
816
	<target name="build-metacat" depends="install-ecogrid, install-spatial, dist-metacat-index, dist-metacat-ui"
817
		description="Build Metacat">
818
	</target>
819

    
820
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
821
		if="enable.ecogrid" description="Install Ecogrid Compentent">
822
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
823
			inheritall="false">
824
			<property name="context" value="${metacat.context}" />
825
			<property name="target" value="${ecogrid-target-name}" />
826
		</ant>
827
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
828
			inheritall="false">
829
			<property name="context" value="${metacat.context}" />
830
			<property name="target" value="${ecogrid-target-name}" />
831
			<property name="metacat.dir" value="${basedir}"/>
832
		</ant>
833
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
834
			<webinf dir="${ecogrid-dir}/lib">
835
			<include name="server-config.wsdd"/>
836
			</webinf>
837
			</war -->
838
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
839
			todir="${dist.dir}" overwrite="true" />
840

    
841

    
842
	</target>
843

    
844
	<target name="get-ecogrid" depends="init"
845
		description="Check out ecogrid module" if="ecogrid.required">
846
		<svn>
847
			<export srcUrl="${svn.ecogridUrl}" force="true"
848
				destPath="${ecogrid-dir}" />
849
		</svn>
850
	</target>
851

    
852
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
853
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
854
		<property name="context" value="${metacat.context}"/>
855
		<property name="target" value="${ecogrid-target-name}"/>
856
		<property name="metacat.dir" value="."/>
857
		<property name="hostname" value="${ecogrid.hostname}"/>
858
		<property name="port" value="${config.port}"/>
859
		</ant>
860
		</target -->
861

    
862
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
863
		description="Automately generate wsdd for ecogrid service">
864
		<delete
865
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
866
	</target>
867

    
868
	<target name="install-skin" depends="init"
869
		description="Install a Skin">
870

    
871
		<input message="Please enter name of the skin"
872
			addproperty="skin-name" />
873

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

    
918
		<echo message="Install Skin completed." />
919
	</target>
920

    
921
	<target name="war" depends="warPrepare,install-spatial"
922
		description="Create a web archive (WAR) for servlet deployment">
923
		<mkdir dir="${dist.dir}" />
924
		<war destfile="${dist.dir}/${metacat.context}.war"
925
			webxml="${build.war}/web.xml">
926
			<fileset dir="${war.context}" />
927
			<lib dir="${war.lib}" />
928
			<webinf dir="${war.webinf}" />
929
		</war>
930
	</target>
931

    
932
	<target name="warPrepare"
933
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare,documentation"
934
		description="Prepare files for creating a web archive (WAR)">
935

    
936
		<property name="war.lib" value="${build.war}/lib" />
937
		<property name="war.webinf" value="${build.war}/WEB-INF" />
938
		<property name="war.context"
939
			value="${build.war}/${metacat.context}" />
940
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
941
		<property name="war.webinf.scripts"
942
			value="${war.webinf}/scripts" />
943
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
944
		<property name="war.context.docs" value="${war.context}/docs" />
945
		<property name="war.context.temp" value="${war.context}/temp" />
946
		<property name="war.context.templates"
947
			value="${war.context}${style-common-relpath}/templates" />
948
		<mkdir dir="${war.lib}" />
949
		<mkdir dir="${war.webinf}" />
950
		<mkdir dir="${war.context}" />
951
		<mkdir dir="${war.webinf.sql}" />
952
		<mkdir dir="${war.context.cgi}" />
953
		<mkdir dir="${war.context.docs}" />
954
		<mkdir dir="${war.context.temp}" />
955
		<mkdir dir="${war.context.templates}" />
956

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

    
1047
		<copy file="src/perl/register-dataset.cgi"
1048
			todir="${war.context.cgi}" />
1049
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1050
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1051

    
1052
		<!-- registry cgi section -->
1053
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
1054
			used in readDocumentFromMetacat -->
1055
		<!-- TODO MCD copy temp files to actual location using config util?? -->
1056
		<copy todir="${war.context.temp}" filtering="yes">
1057
			<fileset dir="lib/style/common/emlb6toeml2">
1058
				<include name="*.xsl" />
1059
				<include name="*.xml" />
1060
			</fileset>
1061
		</copy>
1062
		<available file="lib/style/common/emlb6toeml2" type="dir"
1063
			property="styles.not.needed" />
1064

    
1065
		<!-- ldap cgi section -->
1066
		<copy todir="${war.context.templates}">
1067
			<fileset dir="lib/style/common/templates">
1068
				<!-- SCW: Copy all files -->
1069
			</fileset>
1070
		</copy>
1071
	</target>
1072

    
1073
	<target name="cgiPrepare" if="build.perl">
1074
		<exec dir="src/perl/Metacat/" executable="make">
1075
			<arg value="clean" />
1076
		</exec>
1077
		<exec dir="src/perl/Metacat/" executable="perl">
1078
			<arg value="Makefile.PL" />
1079
		</exec>
1080
		<exec dir="src/perl/Metacat/" executable="make" />
1081
	</target>
1082

    
1083
	<target name="testPrepare"
1084
		description="Copies test files into the war directories">
1085
		<echo>in testPrepare</echo>
1086
		<property name="war.context.test"
1087
			value="${build.war}/${metacat.context}/test" />
1088
		<mkdir dir="${war.context.test}" />
1089
		<copy todir="${war.context.test}" filtering="yes">
1090
			<fileset dir="test/servertestfiles">
1091
				<include name="*/**" />
1092
			</fileset>
1093
		</copy>
1094
	</target>
1095

    
1096
	<target name="getConversionXSL" depends="prepare"
1097
		unless="styles.not.needed"
1098
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1099

    
1100
		<svn>
1101
			<export srcUrl="${svn.eml2StyleUrl}"
1102
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1103
		</svn>
1104

    
1105
		<mkdir dir="lib/style/common/emlb6toeml2" />
1106
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1107
			<fileset
1108
				dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1109
				<include name="*.xsl" />
1110
				<include name="*.xml" />
1111
			</fileset>
1112
		</copy>
1113
	</target>
1114

    
1115
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1116
		<mkdir dir="${build.tests}" />
1117
		<copy todir="${build.tests}" encoding="UTF-8">
1118
			<fileset dir="${testdir}">
1119
				<include name="edu/**" />
1120
			</fileset>
1121
		</copy>
1122
		<copy todir="${build.tests}" file="${testdir}/test.properties" />
1123

    
1124
		<path id="test.classpath">
1125
			<path refid="compile.classpath" />
1126
			<fileset dir="${build.dir}">
1127
				<include name="${name}.jar" />
1128
				<include name="${name}-client.jar" />
1129
				<include name="harvester.jar" />
1130
			</fileset>
1131
		</path>
1132
		
1133
		<pathconvert pathsep="${line.separator}|  |--" 
1134
		             property="echo.test.classpath"
1135
		             refid="test.classpath">
1136
		</pathconvert>
1137
		<echo message="|--test classpath" />
1138
		<echo message="|  |" />
1139
		<echo message="|  |-- ${echo.test.classpath}" />
1140
		
1141
		<!-- copy and compile the tests into a jar file -->
1142
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1143
			debug="on" includes="**/*.java" encoding="UTF-8">
1144
			<classpath refid="test.classpath" />
1145
		</javac>
1146

    
1147
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1148
			basedir="${build.tests}" >
1149
			<include name="**/*.class"/>
1150
			<include name="**/*.xml"/>
1151
		</jar>	
1152
		
1153
	</target>
1154

    
1155
	<target name="runoneclass" depends="testprep"
1156
		description="Uses the ant to run a class">
1157
		
1158
		<java classname="${classtorun}" fork="true">
1159
			<arg line="${args}" />
1160
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1161
			<classpath>
1162
				<path refid="test.classpath" />
1163
				<fileset dir="${build.dir}">
1164
					<include name="${name}.jar" />
1165
					<include name="${name}-client.jar" />
1166
					<include name="harvester.jar" />
1167
					<include name="${name}-junittests.jar" />
1168
				</fileset>
1169
			</classpath>
1170
		</java>
1171
	</target>
1172
	
1173
	<target name="test" depends="testprep"
1174
		description="Uses the ant junit task to run all JUnit tests">
1175

    
1176
		<!-- use the ant "junit" task to run JUnit tests. -->
1177
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1178
			haltonerror="no">
1179
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1180
			<classpath>
1181
				<path refid="test.classpath" />
1182
				<fileset dir="${build.dir}">
1183
					<include name="${name}.jar" />
1184
					<include name="${name}-client.jar" />
1185
					<include name="harvester.jar" />
1186
					<include name="${name}-junittests.jar" />
1187
				</fileset>
1188
			</classpath>
1189

    
1190
			<formatter type="plain" />
1191

    
1192
			<batchtest fork="yes" todir="${build.dir}">
1193
				<fileset dir="${build.tests}">
1194
					<include name="**/*.class" />
1195
					<exclude name="**/MCTestCase.class" />
1196
					<exclude name="**/ClientViewHelperTest.class" />
1197
					<!-- these are not test cases -->
1198
					<exclude name="**/MockCNode.class" />
1199
					<exclude name="**/D1NodeServiceTest.class" />
1200
					<exclude name="**/D1NodeServiceTest$1.class" />
1201
					<exclude name="**/QueryRunner.class" />
1202
					<exclude name="**/MockObjectPathMap.class" />
1203
					<exclude name="**/HzObjectPathMapTest$1.class" />
1204
					<exclude name="**/HzObjectPathMapTest$2.class" />
1205
				</fileset>
1206
			</batchtest>
1207
		</junit>
1208
	</target>
1209

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

    
1213
		<echo>testtorun: ${testtorun}</echo>
1214

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

    
1229
			<formatter type="plain" />
1230

    
1231
			<batchtest fork="yes" todir="${build.dir}">
1232
				<fileset dir="${build.tests}">
1233
					<include name="**/${testtorun}.class" />
1234
				</fileset>
1235
			</batchtest>
1236
		</junit>
1237
	</target>
1238
	
1239
	<target name="run" 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="testharvester" depends="testprep"
1269
		description="Uses the ant junit task to test only the Harvester code">
1270
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1271
			haltonerror="off">
1272
			<classpath>
1273
				<path refid="compile.classpath" />
1274
				<fileset dir="${build.dir}">
1275
					<include name="${name}.jar" />
1276
					<include name="${name}-client.jar" />
1277
					<include name="harvester.jar" />
1278
					<include name="${name}-junittests.jar" />
1279
				</fileset>
1280
			</classpath>
1281
			<formatter type="plain" />
1282
			<batchtest fork="yes" todir="${build.dir}">
1283
				<fileset dir="${build.tests}">
1284
					<include name="**/harvesterClient/*.class" />
1285
				</fileset>
1286
			</batchtest>
1287
		</junit>
1288
	</target>
1289

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

    
1294
		<echo>
1295
			*********************************** Please run ant
1296
			gethttpclient first! ***********************************
1297
		</echo>
1298
		<!-- copy and compile the tests into a jar file -->
1299
		<mkdir dir="${build.metacatnettest}" />
1300
		<javac srcdir="${junitnettestsdir}"
1301
			destdir="${build.metacatnettest}" includes="**/*.java">
1302
			<classpath>
1303
				<path refid="compile.classpath" />
1304
				<fileset dir="${build.dir}">
1305
					<include name="${name}.jar" />
1306
				</fileset>
1307
			</classpath>
1308
		</javac>
1309

    
1310
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1311
			basedir="${build.metacatnettest}" includes="**/*.class" />
1312

    
1313
		<!-- use the ant "junit" task to run JUnit tests. -->
1314
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1315
			haltonerror="no">
1316
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1317
			<classpath>
1318
				<path refid="compile.classpath" />
1319
				<fileset dir="${build.dir}">
1320
					<include name="${name}.jar" />
1321
					<include name="${name}-junitnettests.jar" />
1322
				</fileset>
1323
			</classpath>
1324

    
1325
			<formatter type="plain" />
1326

    
1327
			<batchtest fork="yes" todir="${build.dir}">
1328
				<fileset dir="${build.metacatnettest}">
1329
					<include name="**/*.class" />
1330
				</fileset>
1331
			</batchtest>
1332
		</junit>
1333
	</target>
1334

    
1335
	<target name="cleanweb" depends="clean"
1336
		description="deletes tomcat web context dir and all its contents">
1337
		<delete dir="${installdir}" />
1338
	</target>
1339

    
1340

    
1341
	<target name="clean" depends="init"
1342
		description="deletes build dir and files that can be regenerated form the release">
1343
		<delete dir="${build.dir}" />
1344
		<delete dir="${dist.dir}" />
1345
		<delete dir="${metacatui.build.dir}" />
1346
	</target>
1347

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

    
1393
	<target name="javadoc" depends="prepare"
1394
		description="generates Javadoc API documentation">
1395
		<javadoc packagenames="edu.ucsb.nceas.*"
1396
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1397
			version="true" use="true" windowtitle="${Name} API"
1398
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1399
			bottom="&lt;i&gt;Copyright &#169; ${copyright}. All Rights Reserved.&lt;/i&gt;">
1400
			<classpath>
1401
				<path refid="compile.classpath" />
1402
			</classpath>
1403
		</javadoc>
1404
	</target>
1405

    
1406
	<target name="dist"
1407
		depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL"
1408
		description="prepares a full release distribution">
1409
		<mkdir dir="${dist.dir}" />
1410
		<delete dir="${ver.dir}" />
1411
		<mkdir dir="${ver.dir}" />
1412
		<copy todir="${ver.dir}">
1413
			<fileset dir="."
1414
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1415
		</copy>
1416
		<copy todir="${ver.dir}" file="build.xml" />
1417
		<copy todir="${ver.dir}" file="build.properties" />
1418

    
1419
		<copy todir="${ver.dir}/docs" filtering="yes">
1420
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1421
		</copy>
1422
		<copy todir="${ver.dir}/docs" filtering="no">
1423
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1424
		</copy>
1425
		<copy todir="${ver.dir}/docs/dev">
1426
			<fileset dir="${build.dir}/docs" />
1427
		</copy>
1428
		<copy todir="${ver.dir}/src">
1429
			<fileset dir="${build.dir}/src" />
1430
		</copy>
1431

    
1432
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1433
		<copy todir="${ver.dir}/test/servertestfiles">
1434
			<fileset dir="./test/servertestfiles" />
1435
		</copy>
1436
	</target>
1437

    
1438
	<target name="fulldist" depends="distbin, distsrc"
1439
			description="full distribution - source and bin"/>
1440
		
1441
	<target name="distbin" depends="build-metacat,war-lsid"
1442
		description="prepares a binary distribution">
1443
		<copy todir="${dist.dir}">
1444
			<fileset dir="./src/scripts" />
1445
		</copy>
1446
		<delete file="./${name}-bin-${release}.zip" />
1447
		<zip zipfile="./${name}-bin-${release}.zip"
1448
			basedir="${dist.dir}" />
1449
		<delete file="./${name}-bin-${release}.tar.gz" />
1450
		<tar tarfile="./${name}-bin-${release}.tar"
1451
			basedir="${dist.dir}" />
1452
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1453
			src="./${name}-bin-${release}.tar" />
1454
		<delete file="./${name}-bin-${release}.tar" />
1455
	</target>
1456

    
1457
	<target name="distsrc" depends="dist"
1458
		description="prepares a source distribution">
1459
		<mkdir dir="${ver.src}" />
1460
		<copy todir="${ver.src}">
1461
			<fileset dir="./src" />
1462
		</copy>
1463
		
1464

    
1465
		<mkdir dir="${ecogrid-dist-dir}" />
1466
		<copy todir="${ecogrid-dist-dir}">
1467
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1468
		</copy>
1469

    
1470

    
1471
		<delete file="./${name}-src-${release}.zip" />
1472
		<zip zipfile="./${name}-src-${release}.zip"
1473
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1474
		<delete file="./${name}-src-${release}.tar.gz" />
1475
		<tar tarfile="./${name}-src-${release}.tar"
1476
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1477
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1478
			src="./${name}-src-${release}.tar" />
1479
		<delete file="./${name}-src-${release}.tar" />
1480
		<!--delete dir="${dist.dir}"/ -->
1481
	</target>
1482

    
1483
	<target name="deb-package" depends="distbin"
1484
		description="create a debian installation package">
1485
		<delete dir="${deb.pkg.dir}" />
1486
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1487
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1488
			<fileset dir="./src/scripts/debian"
1489
				includes="control postinst" />
1490
		</copy>
1491

    
1492
		<mkdir
1493
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1494
		<copy
1495
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1496
			filtering="yes">
1497
			<fileset dir="./src/scripts/debian"
1498
				excludes="control postinst" />
1499
		</copy>
1500
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1501

    
1502
		<copy file="${dist.dir}/${metacat.context}.war"
1503
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1504
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1505
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1506

    
1507
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1508
			failonerror="true">
1509
			<arg line="--build debian" />
1510
		</exec>
1511

    
1512
		<move file="${pkg.dir}/debian.deb"
1513
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1514
	</target>
1515

    
1516
	<target name="stylesheettest">
1517
		<xslt in="${input}" out="eml.html"
1518
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1519
			<param name="displaymodule" expression="${displaymodule}" />
1520
			<param name="docid" expression="${input}" />
1521
			<param name="entitytype" expression="${entitytype}" />
1522
			<param name="entityindex" expression="${entityindex}" />
1523
			<outputproperty name="method" value="html" />
1524
			<outputproperty name="standalone" value="yes" />
1525
			<outputproperty name="encoding" value="iso8859_1" />
1526
			<outputproperty name="indent" value="yes" />
1527
		</xslt>
1528
	</target>
1529

    
1530
	<target name="spatial_option" depends="prepare"
1531
		description=" -- compiles code for the spatial option">
1532

    
1533
		<echo message="Compiling the metatcat shapefile creator" />
1534
		<echo message="using the shapelib at: ${shapelib.dir}" />
1535
		<exec dir="." executable="g++" os="Linux, Unix"
1536
			failonerror="true">
1537
			<arg
1538
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1539
		</exec>
1540

    
1541
		<exec dir="." executable="g++" os="Linux, Unix"
1542
			failonerror="true">
1543
			<arg
1544
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1545
		</exec>
1546
	</target>
1547

    
1548
	<!-- LSID Authority support -->
1549
	<patternset id="lsid.jars">
1550
		<include name="axis.jar" />
1551
		<include name="commons-discovery-0.2.jar" />
1552
		<include name="jaxrpc.jar" />
1553
		<include name="lsid-client-1.1.1.jar" />
1554
		<include name="lsid-server-1.1.1.jar" />
1555
		<include name="saaj.jar" />
1556
		<include name="wsdl4j-1.5.1.jar" />
1557
		<include name="activation.jar" />
1558
		<include name="castor-0.9.5.jar" />
1559
		<include name="dnsjava-1.3.2.jar" />
1560
		<include name="mail.jar" />
1561
		<include name="commons-logging-1.0.4.jar" />
1562
		<!-- These jars may be needed but seem to not actually be,
1563
			so leaving them out for now
1564
			<include name="axis-ant.jar" />
1565
		-->
1566
		<!--<include name="GenCastor.class" />-->
1567
	</patternset>
1568
	<patternset id="lib.jars">
1569
		<include name="log4j-1.2.12.jar" />
1570
		<include name="utilities-*.jar" />
1571
		<include name="xerces*.jar" />
1572
		<include name="xalan*.jar" />
1573
		<include name="xml-apis*.jar" />
1574
	</patternset>
1575

    
1576
	<path id="lsid.classpath">
1577
		<fileset dir="${lsid.lib.dir}">
1578
			<patternset refid="lsid.jars" />
1579
		</fileset>
1580
		<fileset dir="${lib.dir}">
1581
			<patternset refid="lib.jars" />
1582
		</fileset>
1583
		<fileset dir="${build.dir}">
1584
			<include name="metacat-client.jar" />
1585
			<include name="metacat.jar" />
1586
		</fileset>
1587
	</path>
1588

    
1589
	<filterset id="configFilters">
1590
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1591
			value="${config.hostname}" / -->
1592
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1593
			value="${config.port}" / -->
1594
		<!-- MCD BYE filter token="METADATA_LABELS"
1595
			value="${config.metadataLabelLsid}" / -->
1596
		<!-- MCD BYE filter token="METACAT_SERVER"
1597
			value="${config.metacatserver}" / -->
1598
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1599
			value="${config.lsidauthority}" / -->
1600
	</filterset>
1601

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

    
1646
	<target name="compile-lsid" depends="prepare-lsid"
1647
		description="Compile Java sources">
1648
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1649
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1650
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1651
			deprecation="${compile.deprecation}"
1652
			target="${java.target.version}"
1653
			source="${java.source.version}"
1654
			optimize="${compile.optimize}">
1655
			<classpath>
1656
				<path refid="compile.classpath" />
1657
				<fileset dir="${build.dir}">
1658
					<include name="${name}.jar" />
1659
				</fileset>
1660
			</classpath>
1661
		</javac>
1662
	</target>
1663

    
1664
	<target name="war-lsid" depends="compile-lsid"
1665
		description="Create a war file for the application">
1666
		<mkdir dir="${dist.dir}" />
1667
		<war destfile="${dist.dir}/${authority.context}.war"
1668
			webxml="${webinf.dir}/web.xml">
1669
			<fileset dir="${lsid.build.dir}" />
1670
			<lib dir="${lsid.lib.dir}">
1671
				<patternset refid="lsid.jars" />
1672
			</lib>
1673
			<lib dir="${lib.dir}">
1674
				<patternset refid="lib.jars" />
1675
			</lib>
1676
			<lib dir="${lib.dir}">
1677
				<include name="xalan.jar" />
1678
				<include name="xml-apis.jar" />
1679
			</lib>
1680
			<lib dir="${build.dir}">
1681
				<include name="metacat-client.jar" />
1682
			</lib>
1683
		</war>
1684
	</target>
1685

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

    
1727
	<!-- build metacat-index war -->
1728
	<target name="build-metacat-index" description="Calls the Maven build for metacat-index.war" >		
1729
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1730
			<jvmarg value="-Dmaven.multiModuleProjectDirectory=${maven.home}" />
1731
			<arg value="clean"/>
1732
		</artifact:mvn>
1733
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1734
			<jvmarg value="-Dmaven.multiModuleProjectDirectory=${maven.home}" />
1735
			<arg value="package"/>
1736
			<!--<arg value="-Dmaven.test.skip=true"/>-->
1737
		</artifact:mvn>
1738
	</target>
1739
	
1740
	<target name="dist-metacat-index" depends="init, build-metacat-index" description="Copy metacat-index.war to dist folder" >		
1741
		<copy tofile="${dist.dir}/metacat-index.war" >
1742
			<fileset dir="metacat-index/target" includes="metacat-index*.war"></fileset>
1743
		</copy>	
1744
	</target>
1745
	
1746
	<target name="install-metacat-index" depends="dist-metacat-index" description="Copy metacat-index.war to deploy folder" >		
1747
		<copy todir="${app.deploy.dir}" file="${dist.dir}/metacat-index.war" />
1748
	</target>
1749
	
1750
	<!-- Generate a light war file which only is used to manage the ldap user accounts - register a new user, reset and change the password -->
1751
	<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">
1752
		  <property name="war-name" value="identity" />
1753
		  <mkdir dir="${dist.dir}" />
1754
		     <war destfile="${dist.dir}/${war-name}.war"
1755
		            webxml="lib/account-web-info/web.xml">
1756
		      <webinf dir="${war.webinf}">
1757
		        <include name="metacat.properties"/>
1758
		        <include name="gd_intermediate_bundle_nceas_ldap.crt"/>
1759
		      </webinf>
1760
		      <fileset dir="${war.context}">
1761
		        <include name="cgi-bin/**"/>
1762
		      	<include name="style/**"/>  
1763
		      </fileset>
1764
		      
1765
		   </war>
1766
	</target>
1767
	
1768
</project>
(5-5/7)