Project

General

Profile

1 113 jones
<?xml version="1.0"?>
2 1311 berkley
<!--
3 4969 daigle
	*   '$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$'
10
	*    '$Date$'
11
	*    '$Revision$'
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 6897 jones
	* usage: ant [compile|jar|install|documentation]
17 4969 daigle
	*
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 1311 berkley
-->
32 5295 jones
<project name="metacat" default="jar" basedir="."
33
         xmlns:artifact="antlib:org.apache.maven.artifact.ant">
34 4969 daigle
	<property environment="env" />
35
	<property file="build.properties" /><!-- USER SPECIFIC PROPS -->
36 3034 perry
37 1801 tao
38 5295 jones
    <!-- Configure the maven2 ant tasks -->
39
    <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.0.jar" />
40
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
41
             uri="antlib:org.apache.maven.artifact.ant"
42
             classpathref="maven-ant-tasks.classpath" />
43 7561 leinfelder
44 5815 leinfelder
	<!-- defining the axis tasks -->
45
	<path id="axis.ant.classpath">
46
		<fileset dir="lib/lsid_lib">
47
			<include name="*.jar" />
48
		</fileset>
49
	</path>
50 8021 leinfelder
51
	<!-- Allow integration with Git projects -->
52
	<macrodef name = "git">
53
	    <attribute name = "command" />
54
	    <attribute name = "dir" default = "" />
55
	    <element name = "args" optional = "true" />
56
	    <sequential>
57
	        <echo message = "git @{command}" />
58
	        <exec executable = "git" dir = "@{dir}">
59
	            <arg value = "@{command}" />
60
	            <args/>
61
	        </exec>
62
	    </sequential>
63
	</macrodef>
64
	<macrodef name = "git-clone-pull">
65
	    <attribute name = "repository" />
66
	    <attribute name = "dest" />
67 8242 leinfelder
	    <attribute name = "refname" />
68 8021 leinfelder
	    <sequential>
69
	        <git command = "clone">
70
	            <args>
71
	                <arg value = "@{repository}" />
72
	                <arg value = "@{dest}" />
73
	            </args>
74
	        </git>
75 8242 leinfelder
	        <git command = "pull" dir = "@{dest}" >
76
	        	<args>
77
	                <arg value = "@{repository}" />
78
	                <arg value = "@{refname}" />
79
	            </args>
80
	        </git>
81
	        <git command = "checkout" dir = "@{dest}">
82
	        	<args>
83
	                <arg value = "@{refname}" />
84
	            </args>
85
	        </git>
86 8021 leinfelder
	    </sequential>
87
	</macrodef>
88 8174 leinfelder
89
	<!-- get metacatUI project -->
90
	<target name="getMetacatUI" depends="init">
91 8242 leinfelder
		<git-clone-pull repository="${metacatui.git.repository.url}" dest="${metacatui.build.dir}" refname="${metacatui.git.repository.refname}" />
92 8174 leinfelder
	</target>
93
94 8183 leinfelder
	<target name="build-metacat-ui" description="Calls the Maven build for metacatUI war" depends="getMetacatUI" unless="build-metacat-ui-called">
95 8174 leinfelder
		<artifact:mvn pom="${metacatui.build.dir}/metacatui/pom.xml" mavenhome="${maven.home}" fork="true">
96
			<arg value="clean"/>
97
		</artifact:mvn>
98
		<artifact:mvn pom="${metacatui.build.dir}/metacatui/pom.xml" mavenhome="${maven.home}" fork="true">
99
		   <arg value="package"/>
100
		</artifact:mvn>
101 8183 leinfelder
		<property name="build-metacat-ui-called" value="true"/>
102 8174 leinfelder
	</target>
103
104
	<target name="dist-metacat-ui" depends="build-metacat-ui">
105
		<copy tofile="${dist.dir}/metacatui.war" >
106
			<fileset dir="${metacatui.build.dir}/metacatui/target" includes="*.war"></fileset>
107
		</copy>
108
	</target>
109 6003 cjones
110 5815 leinfelder
	<taskdef resource="axis-tasks.properties"
111
		classpathref="axis.ant.classpath" />
112
113 4969 daigle
	<!-- Determine if ecogrid should be installed-->
114
	<condition property="enable.ecogrid">
115
		<equals arg1="${install.ecogrid}" arg2="true" />
116
	</condition>
117 3034 perry
118 4969 daigle
	<!-- Determine if perl should be built-->
119
	<condition property="build.perl">
120
		<equals arg1="${make.perl.code}" arg2="true" />
121
	</condition>
122 3034 perry
123 5311 daigle
	<available file="${build.tomcat.dir}/common/lib/servlet-api.jar"
124
			property="tomcat.common.exists" />
125 5294 jones
126 5311 daigle
	<target name="config" depends="setTomcatCommon, setTomcatNoCommon">
127 4969 daigle
		<!-- usr for client testing, generally you don't need change-->
128
		<property name="mcuser"
129
			value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
130
		<property name="mcpassword" value="kepler" />
131
		<property name="mcanotheruser"
132
			value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org" />
133
		<property name="mcanotherpassword" value="yourpass" />
134
		<property name="piscouser"
135
			value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org" />
136
		<property name="piscopassword" value="yourpass" />
137
		<property name="lteruser"
138
			value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org" />
139
		<property name="lterpassword" value="yourpass" />
140 4943 costa
141 4969 daigle
		<property name="debug" value="on" />
142
		<property name="morphosourcedir" value="../morpho" />
143
		<property name="utilitiesdir" value="../utilities" />
144
		<property name="installdir"
145
			value="${app.deploy.dir}/${metacat.context}" />
146 1929 brooke
147 4969 daigle
		<echo>*********** set jsdk to ${jsdk}</echo>
148
	</target>
149 5311 daigle
150
	<target name="setTomcatCommon" if="tomcat.common.exists" >
151
		<property name="jsdk"
152
			value="${build.tomcat.dir}/common/lib/servlet-api.jar" />
153
	</target>
154
155
	<target name="setTomcatNoCommon" unless="tomcat.common.exists" >
156
		<property name="jsdk"
157
			value="${build.tomcat.dir}/lib/servlet-api.jar" />
158
	</target>
159
160 7775 tao
	<target name="init" depends="config, build-metacat-common" unless="init.called">
161 7622 leinfelder
162 7624 leinfelder
	    <property name="libdir.mvn" value="lib/maven" />
163
		<mkdir dir="${libdir.mvn}"/>
164
165 7622 leinfelder
		<path id="base.classpath">
166 4969 daigle
			<pathelement location="${jsdk}" />
167 7491 hahn
            <pathelement location="lib" />
168 7622 leinfelder
169 4969 daigle
			<fileset dir="lib">
170
				<include name="*.jar" />
171
			</fileset>
172 7622 leinfelder
173 4969 daigle
			<fileset dir="lib/lsid_lib">
174
				<include name="*.jar" />
175
			</fileset>
176 2343 sgarg
177 7622 leinfelder
			<!-- Include everything from maven -->
178 7624 leinfelder
			<fileset dir="${libdir.mvn}">
179 4969 daigle
				<include name="*.jar" />
180
			</fileset>
181 1487 tao
182 4969 daigle
		</path>
183 5311 daigle
184
		<path id="test.classpath">
185
			<pathelement location="${jsdk}" />
186
			<pathelement location="lib" />
187
			<fileset dir="lib">
188
				<include name="*.jar" />
189
				<exclude name="maven-ant-tasks-2.1.0.jar" />
190
			</fileset>
191
			<fileset dir="lib/lsid_lib">
192
				<include name="*.jar" />
193
			</fileset>
194 7622 leinfelder
			<!-- Include maven -->
195 7624 leinfelder
			<fileset dir="${libdir.mvn}">
196 5311 daigle
				<include name="*.jar" />
197
			</fileset>
198 7622 leinfelder
		</path>
199 5829 leinfelder
200 7622 leinfelder
		<!-- define the maven tasks -->
201
		<taskdef uri="antlib:org.apache.maven.artifact.ant"
202
			       resource="org/apache/maven/artifact/ant/antlib.xml"
203
			       classpathref="base.classpath" />
204 5311 daigle
205 7622 leinfelder
	   	<!-- Resolve maven dependencies -->
206
		<artifact:pom id="metacatPom" file="pom.xml" />
207
		<artifact:dependencies filesetId="dependency.fileset" pomrefid="metacatPom" usescope="runtime"/>
208
		<artifact:dependencies pathId="dependency.classpath" pomrefid="metacatPom"/>
209 7624 leinfelder
210 7622 leinfelder
	   	<!-- combine base and dependencies for the classpath -->
211
	   	<path id="compile.classpath">
212
	   		<path refid="base.classpath" />
213
	   		<path refid="dependency.classpath" />
214 5311 daigle
		</path>
215
216 4969 daigle
		<!-- It is less likely you'll need to make any changes from here down,
217
			but customization is possible -->
218
		<property name="name" value="metacat" />
219
		<property name="Name" value="MetaCat" />
220
		<property name="debugprefix" value="${Name}:" />
221
		<property name="release" value="${metacat.version}" />
222 6897 jones
		<tstamp>
223
		    <format property="copyrightyear" pattern="yyyy" locale="en,US"/>
224
		</tstamp>
225
		<property name="copyright" value="${copyrightyear} Regents of the University of California" />
226 4969 daigle
		<property name="style-common-relpath" value="/style/common" />
227
		<property name="style-shared-relpath" value="/style/shared" />
228
		<property name="schema-relpath" value="/schema" />
229
		<property name="style-common-cvsrelpath"
230
			value="lib${style-common-relpath}" />
231
		<property name="schema-cvsrelpath" value="lib${schema-relpath}" />
232
		<property name="style-skins-relpath" value="/style/skins" />
233
		<property name="util-module" value="utilities" />
234 7497 leinfelder
		<!--<property name="utilities-tag" value="trunk" />-->
235 7502 leinfelder
		<property name="utilities-tag" value="tags/UTILITIES_1_3_0" />
236 6913 leinfelder
		<property name="seek-tag" value="tags/ECOGRID_1_2_2" />
237 4969 daigle
		<property name="eml-module" value="eml" />
238
		<property name="eml-version" value="2.0.0beta6" />
239 7194 leinfelder
		<property name="eml-beta4-version" value="2.0.0beta4" />
240 4969 daigle
		<property name="eml-beta-tag"
241
			value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
242 7194 leinfelder
		<property name="eml-beta4-tag"
243
					value="RELEASE_EML_2_BETA_4" />
244 4969 daigle
		<property name="eml2_0_0-schema-tag"
245
			value="RELEASE_EML_2_0_0_UPDATE_1" />
246
		<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
247
		<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
248 6922 leinfelder
		<property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1" />
249 7543 leinfelder
		<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_7" />
250 4969 daigle
		<property name="eml2_0_0namespace"
251
			value="eml://ecoinformatics.org/eml-2.0.0" />
252
		<property name="eml2_0_1namespace"
253
			value="eml://ecoinformatics.org/eml-2.0.1" />
254
		<property name="eml2_1_0namespace"
255
			value="eml://ecoinformatics.org/eml-2.1.0" />
256 5709 leinfelder
		<property name="eml2_1_1namespace"
257
			value="eml://ecoinformatics.org/eml-2.1.1" />
258 4969 daigle
		<property name="stmmlnamespace"
259
			value="http://www.xml-cml.org/schema/stmml" />
260 7109 leinfelder
		<property name="stmml11namespace"
261
			value="http://www.xml-cml.org/schema/stmml-1.1" />
262 4969 daigle
		<property name="eml-css" value="eml_xsl.css" />
263
		<property name="eml-module.default.css" value="default.css" />
264
		<property name="systemidserver" value="" />
265
		<property name="html-path" value="" />
266 5919 tao
		<property name ="metacat-properties-file" value="build/war/WEB-INF/metacat.properties"/>
267 1311 berkley
268 348 jones
269 4969 daigle
		<!-- Config for registry variables -->
270
		<!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
271
		<property name="scope" value="obfs" />
272
		<property name="responseForm" value="genericResponse.tmpl" />
273
		<property name="entryForm" value="entryForm.tmpl" />
274
		<property name="guide" value="genericGuide.tmpl" />
275
		<property name="loginForm" value="loginForm.tmpl" />
276
		<property name="confirmData" value="confirmData.tmpl" />
277
		<property name="deleteData" value="deleteData.tmpl" />
278
		<property name="genericHeader" value="genericHeader.tmpl" />
279
		<property name="genericFooter" value="genericFooter.tmpl" />
280 348 jones
281 4969 daigle
		<filter token="scope" value="${scope}" />
282
		<filter token="responseForm" value="${responseForm}" />
283
		<filter token="entryForm" value="${entryForm}" />
284
		<filter token="guide" value="${guide}" />
285
		<filter token="loginForm" value="${loginForm}" />
286
		<filter token="confirmData" value="${confirmData}" />
287
		<filter token="deleteData" value="${deleteData}" />
288
		<filter token="genericHeader" value="${genericHeader}" />
289
		<filter token="genericFooter" value="${genericFooter}" />
290
		<filter token="adminname" value="${adminname}" />
291
		<filter token="recipient" value="${recipient}" />
292
		<filter token="metacatVersion" value="${metacat.version}" />
293
		<filter token="metacatRC" value="${metacat.releaseCandidate}" />
294
		<filter token="build.context" value="${metacat.context}" />
295
296
		<filter token="docrooturl" value="./" />
297
		<filter token="mcuser" value="${mcuser}" />
298
		<filter token="mcpassword" value="${mcpassword}" />
299
		<filter token="mcanotheruser" value="${mcanotheruser}" />
300
		<filter token="mcanotherpassword" value="${mcanotherpassword}" />
301
		<filter token="eml-css" value="${eml-css}" />
302
		<filter token="style-skins-relpath"
303
			value="${style-skins-relpath}" />
304
		<filter token="style-common-relpath"
305
			value="${style-common-relpath}" />
306
307
		<filter token="eml-version" value="${eml-version}" />
308 7194 leinfelder
		<filter token="eml-beta4-version" value="${eml-beta4-version}" />
309 4969 daigle
		<filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
310
		<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
311
		<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
312 5709 leinfelder
		<filter token="eml2_1_1namespace" value="${eml2_1_1namespace}" />
313 4969 daigle
		<filter token="stmmlnamespace" value="${stmmlnamespace}" />
314 7110 leinfelder
		<filter token="stmml11namespace" value="${stmml11namespace}" />
315 4969 daigle
		<filter token="debugprefix" value="${debugprefix}" />
316
317
		<filter token="defaultStage" value="${defaultStage}" />
318
		<filter token="defaultHeader" value="${defaultHeader}" />
319
		<filter token="defaultFooter" value="${defaultFooter}" />
320
		<filter token="defaultChangePass" value="${defaultChangePass}" />
321
		<filter token="defaultResetPass" value="${defaultResetPass}" />
322
		<filter token="changePassSuccess" value="${changePassSuccess}" />
323
		<filter token="resetPassSuccess" value="${resetPassSuccess}" />
324
		<filter token="registerFailed" value="${registerFailed}" />
325
		<filter token="registerLter" value="${registerLter}" />
326
		<filter token="registerMatch" value="${registerMatch}" />
327
		<filter token="registerSuccess" value="${registerSuccess}" />
328
		<filter token="register" value="${register}" />
329
		<filter token="searchResults" value="${searchResults}" />
330
		<filter token="ldapMainServerFailure"
331
			value="${ldapMainServerFailure}" />
332
		<filter token="lter-user" value="${lteruser}" />
333
		<filter token="lter-pass" value="${lterpassword}" />
334
		<filter token="pisco-user" value="${piscouser}" />
335
		<filter token="pisco-pass" value="${piscopassword}" />
336
337
338
		<!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
339
		<!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
340
		<!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
341
342
		<property name="srcdir" value="./src" />
343
		<property name="lib.dir" value="./lib" />
344
		<property name="docdir" value="./docs" />
345
		<property name="cgidir" value="./cgi-bin" />
346
		<property name="testdir" value="./test" />
347 7194 leinfelder
		<property name="testtorun" value="MNodeServiceTest" />
348 4969 daigle
		<property name="junittestsdir"
349
			value="./test/edu/ucsb/nceas/metacattest" />
350
		<property name="junitnettestsdir"
351
			value="./test/edu/ucsb/nceas/metacatnettest" />
352 6999 leinfelder
		<property name="classtorun" value="edu.ucsb.nceas.metacat.admin.upgrade.dataone.GenerateSystemMetadata" />
353 4969 daigle
		<property name="build.dir" value="./build" />
354
		<property name="build.src" value="${build.dir}/src" />
355
		<property name="build.dest" value="${build.dir}/classes" />
356
		<property name="build.samples" value="${build.dir}/samples" />
357
		<property name="build.tests" value="${build.dir}/tests" />
358
		<property name="build.tmp" value="${build.dir}/tmp" />
359
		<property name="build.metacattest"
360
			value="${build.tests}/metacattest" />
361
		<property name="build.metacatnettest"
362
			value="${build.tests}/metacatnettest" />
363
		<property name="build.data" value="${build.dir}/data" />
364 6898 jones
		<property name="build.docs" value="${build.dir}/docs" />
365
		<property name="build.javadocs" value="${build.docs}/api" />
366 4969 daigle
		<property name="build.war" value="${build.dir}/war" />
367
		<property name="dist.dir" value="dist" />
368
		<property name="ver.dir" value="${dist.dir}/${name}-${release}" />
369
		<property name="ver.src" value="${ver.dir}/src" />
370
		<property name="util.dir" value="${dist.dir}/${util-module}" />
371
		<property name="test.dir" value="${dist.dir}/test" />
372
		<!-- directories for creating a Harvest List Editor distribution -->
373
		<property name="dist.dir.hle" value="disthle" />
374
		<property name="ver.dir.hle"
375
			value="${dist.dir.hle}/harvest-list-editor-${release}" />
376
		<property name="pkg.dir" value="./package" />
377
		<property name="deb.pkg.dir" value="${pkg.dir}/debian" />
378
379
		<property name="ecogrid-target-name" value="metacatImpl" />
380
		<property name="ecogrid-module-dest-dir" value=".." />
381
		<property name="ecogrid-module" value="seek/projects/ecogrid" />
382
		<property name="ecogrid-dist-dir"
383
			value="${dist.dir}/${ecogrid-module}" />
384
		<property name="ecogrid-dir"
385
			value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
386
387
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
388
389
		<!-- set up svn -->
390
		<property name="svnant.lib" value="lib" />
391
		<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
392
		<property name="svnClientAdapter.jar"
393
			value="${svnant.lib}/svnClientAdapter.jar" />
394
		<property name="svnjavahl.jar"
395
			value="${svnant.lib}/svnjavahl.jar" />
396
		<property name="svn.utilitiesUrl"
397 5051 daigle
			value="https://code.ecoinformatics.org/code/utilities/${utilities-tag}" />
398 4969 daigle
		<property name="svn.ecogridUrl"
399 5809 leinfelder
			value="https://code.ecoinformatics.org/code/seek/${seek-tag}/projects/ecogrid/" />
400 5176 daigle
		<property name="svn.emlBetaUrl"
401
			value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
402 7194 leinfelder
		<property name="svn.emlBeta4Url"
403
					value="https://code.ecoinformatics.org/code/eml/tags/${eml-beta4-tag}" />
404 5176 daigle
		<property name="svn.eml200SchemaUrl"
405
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
406
		<property name="svn.eml201SchemaUrl"
407
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
408
		<property name="svn.eml210SchemaUrl"
409
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
410 5709 leinfelder
		<property name="svn.eml211SchemaUrl"
411
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_1-schema-tag}" />
412 5176 daigle
		<property name="svn.eml2StyleUrl"
413
			value="https://code.ecoinformatics.org/code/eml/tags/${eml2-style-tag}" />
414 8021 leinfelder
415
		<!-- the git repo -->
416
		<property name="metacatui.git.repository.url"
417
					value="https://github.com/NCEAS/metacatui.git" />
418 8242 leinfelder
		<property name="metacatui.git.repository.refname"
419
							value="master" />
420 8021 leinfelder
		<property name="metacatui.build.dir"
421 8236 leinfelder
					value="metacatui_build" />
422 8021 leinfelder
		<property name="metacatui.resources.dir"
423
					value="${metacatui.build.dir}/metacatui/src/main/webapp" />
424
425 4969 daigle
		<!-- 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="utilities.required">
435 7623 leinfelder
			<not>
436
				<available file="lib/utilities.jar" />
437
			</not>
438 4969 daigle
		</condition>
439
		<!-- peer.utilities.required is used when there is no utilities
440
			directory at ${utilitiesdir} -->
441
		<condition property="peer.utilities.required">
442
			<or>
443
				<not>
444
					<available file="${utilitiesdir}" type="dir" />
445
				</not>
446
			</or>
447
		</condition>
448
		<condition property="eml.required">
449
			<or>
450
				<not>
451
					<available file="lib/schema/eml-2.0.1/eml.xsd" />
452
				</not>
453
				<not>
454
					<available file="lib/schema/eml-2.0.0/eml.xsd" />
455
				</not>
456
				<not>
457
					<available file="lib/schema/eml-2.1.0/eml.xsd" />
458
				</not>
459
				<not>
460
					<available
461
						file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
462
				</not>
463
			</or>
464
		</condition>
465
466
		<condition property="ecogrid.required">
467
			<or>
468
				<not>
469
					<available file="${ecogrid-dir}/build.properties" />
470
				</not>
471
				<not>
472
					<available
473
						file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
474
				</not>
475
			</or>
476
		</condition>
477 7622 leinfelder
478
		<property name="init.called" value="true" />
479 4969 daigle
480
	</target>
481 7622 leinfelder
482
	<target name="resolveDependencies" depends="init" description="retrieve dependencies with maven">
483
			<echo>Moving Maven dependencies (${dependency.fileset}) to ${libdir.mvn} </echo>
484
			<!-- Clear out mvn dir -->
485
			<delete dir="${libdir.mvn}"></delete>
486
			<!-- Copy all dependencies to the correct location. -->
487
			<copy todir="${libdir.mvn}">
488
				<fileset refid="dependency.fileset" />
489
				<!-- This mapper strips off all leading directory information -->
490
				<mapper type="flatten" />
491
			</copy>
492
		</target>
493 4969 daigle
494 7622 leinfelder
	<target name="prepare" depends="init, resolveDependencies">
495 4969 daigle
		<mkdir dir="${build.dir}" />
496
		<mkdir dir="${build.src}" />
497
		<mkdir dir="${build.dest}" />
498 6898 jones
		<mkdir dir="${build.docs}" />
499 4969 daigle
		<mkdir dir="${build.javadocs}" />
500
		<mkdir dir="${build.tmp}" />
501
502
		<copy todir="${build.src}" filtering="yes">
503
			<fileset dir="${srcdir}">
504
				<include name="edu/**" />
505
				<include name="com/**" />
506
				<include name="org/**" />
507
				<!-- include name="java/**" / -->
508
				<include name="**/*.sql" />
509
				<exclude name="**/CVS*" />
510
				<exclude name="**/.#*" />
511 5034 daigle
				<exclude name="edu/ucsb/nceas/workflowscheduler/**" />
512 4969 daigle
			</fileset>
513
		</copy>
514
		<available file="lib/style/common/emlb6toeml2" type="dir"
515
			property="styles.not.needed" />
516
	</target>
517
518 4962 leinfelder
	<target name="generateStubs" depends="prepare">
519 4969 daigle
		<echo
520
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
521
		<axis-wsdl2java verbose="true" output="${srcdir}"
522
			url="/tmp/KeplerWebService.wsdl" />
523 4962 leinfelder
	</target>
524 1939 brooke
525 7775 tao
	<target name="compile" depends="prepare, utilities"
526 4969 daigle
		description="Compiles java code to build dir, and copies metacat props files there">
527 113 jones
528 4969 daigle
		<javac srcdir="${build.src}" destdir="${build.dest}"
529
			debug="${debug}"
530 6053 leinfelder
			excludes="**/*.sql **/client/*.java **/harvesterClient/*.java">
531 4969 daigle
			<classpath>
532
				<path refid="compile.classpath" />
533
			</classpath>
534
		</javac>
535
	</target>
536 1939 brooke
537 6438 leinfelder
	<target name="jar" depends="compile,geteml"
538 4969 daigle
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
539 1311 berkley
540 4969 daigle
		<delete file="${build.dir}/${name}.jar" />
541
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
542
			excludes="**/protocols/ **/harvesterClient/" />
543
	</target>
544 113 jones
545 4969 daigle
	<target name="protocol" depends="compile"
546
		description="Compiles and jars protocol java code to protocol.jar in build dir">
547
		<delete file="${build.dir}/protocol.jar" />
548
		<jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
549
			includes="**/protocols/" />
550
	</target>
551 4959 daigle
552 4969 daigle
	<target name="utilities" depends="config,getpeerutilities"
553
		if="utilities.required">
554
		<ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
555
		<ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
556
		<copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
557
	</target>
558 1780 jones
559 4969 daigle
	<target name="getpeerutilities" depends="prepare"
560
		if="peer.utilities.required"
561
		description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
562 5176 daigle
		<echo message="Exporting utilities files from svn repository:" />
563 4969 daigle
		<svn>
564
			<export srcUrl="${svn.utilitiesUrl}"
565
				destPath="${utilitiesdir}" />
566
		</svn>
567 2461 sgarg
568 4969 daigle
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
569
	</target>
570 8021 leinfelder
571 4969 daigle
	<target name="getutilities" depends="prepare"
572 5176 daigle
		description="Checks utility out of svn and copies it to your metacat sandbox">
573 5051 daigle
		<svn>
574
			<export srcUrl="${svn.utilitiesUrl}"
575 5866 leinfelder
				destPath="${utilitiesdir}" force="true" />
576 5051 daigle
		</svn>
577 4969 daigle
	</target>
578 1780 jones
579 4969 daigle
	<target name="client" depends="utilities, prepare"
580
		description="Compiles metacat-client java code to build dir">
581
		<javac srcdir="${build.src}" destdir="${build.dest}"
582
			includes="edu/ucsb/nceas/metacat/client/*">
583
			<classpath>
584
				<path refid="compile.classpath" />
585
			</classpath>
586
		</javac>
587
	</target>
588 2748 costa
589 4969 daigle
	<target name="clientjar" depends="client"
590
		description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
591
		<delete file="${build.dir}/${name}-client.jar" />
592
		<jar jarfile="${build.dir}/${name}-client.jar"
593
			basedir="${build.dest}" includes="**/metacat/client/" />
594
	</target>
595 1950 costa
596 4969 daigle
	<target name="advancedsearchjar" depends="compile"
597
		description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
598
		<delete file="${build.dir}/advancedsearch.jar" />
599
		<jar jarfile="${build.dir}/advancedsearch.jar"
600
			basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
601
	</target>
602 1950 costa
603 4969 daigle
	<target name="harvester" depends="client"
604
		description="Compiles harvester java code to build dir">
605
		<javac srcdir="${build.src}" destdir="${build.dest}"
606
			includes="edu/ucsb/nceas/metacat/harvesterClient/*">
607
			<classpath>
608
				<path refid="compile.classpath" />
609
			</classpath>
610
		</javac>
611
	</target>
612 6003 cjones
613 4969 daigle
	<target name="harvesterjar" depends="harvester"
614
		description="Compiles and jars harvester java code to harvester.jar in build dir">
615
		<delete file="${build.dir}/harvester.jar" />
616
		<jar jarfile="${build.dir}/harvester.jar"
617
			basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
618
	</target>
619 2228 sgarg
620 4969 daigle
	<target name="harvestListEditorDist" depends="harvesterjar"
621
		description="Prepares a distribution of the Harvest List Editor tool">
622
		<mkdir dir="${dist.dir.hle}" />
623
		<delete dir="${ver.dir.hle}" />
624
		<mkdir dir="${ver.dir.hle}" />
625
		<copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
626
		<copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
627
		<copy todir="${ver.dir.hle}"
628
			file="lib/harvester/harvestList.xsd" />
629
		<copy todir="${ver.dir.hle}"
630
			file="lib/harvester/harvestListEditor.bat" />
631
		<copy todir="${ver.dir.hle}"
632
			file="lib/harvester/harvestListEditor.sh" />
633
		<delete file="./harvest-list-editor-${release}.zip" />
634
		<zip zipfile="./harvest-list-editor-${release}.zip"
635
			basedir="${ver.dir.hle}" />
636
		<delete file="./harvest-list-editor-${release}.tar.gz" />
637
		<tar tarfile="./harvest-list-editor-${release}.tar"
638
			basedir="${ver.dir.hle}" />
639
		<gzip zipfile="./harvest-list-editor-${release}.tar.gz"
640
			src="./harvest-list-editor-${release}.tar" />
641
		<delete file="./harvest-list-editor-${release}.tar" />
642
	</target>
643 1939 brooke
644 7194 leinfelder
	<target name="geteml" depends="getemlpre2,getemlpre2beta4,geteml2+,getConversionXSL"
645 4969 daigle
		if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
646 2175 tao
647 4969 daigle
	<target name="getemlpre2" depends="prepare" if="eml.required"
648 5176 daigle
		description="Checks EML-beta6 out of svn and copies dtds and xsl to your metacat sandbox">
649
		<svn>
650
			<export srcUrl="${svn.emlBetaUrl}"
651
				destPath="${build.tmp}/eml_${eml-beta-tag}" />
652
		</svn>
653 4969 daigle
		<mkdir dir="lib/dtd" />
654
		<copy todir="lib/dtd" filtering="yes">
655
			<fileset
656 5176 daigle
				dir="${build.tmp}/eml_${eml-beta-tag}">
657 4969 daigle
				<include name="*.dtd" />
658
			</fileset>
659
			<mapper type="glob" from="eml-*.dtd"
660
				to="eml-*-${eml-version}.dtd" />
661
		</copy>
662 2175 tao
663 4969 daigle
		<copy todir="${style-common-cvsrelpath}" filtering="yes">
664
			<fileset
665 5176 daigle
				dir="${build.tmp}/eml_${eml-beta-tag}/style">
666 4969 daigle
				<include name="**/*.xsl" />
667
			</fileset>
668
		</copy>
669
	</target>
670 7194 leinfelder
671
	<target name="getemlpre2beta4" depends="prepare" if="eml.required"
672
			description="Checks EML-beta4 out of svn and copies dtds to your metacat sandbox">
673
			<svn>
674
				<export srcUrl="${svn.emlBeta4Url}"
675
					destPath="${build.tmp}/eml_${eml-beta4-tag}" />
676
			</svn>
677
			<mkdir dir="lib/dtd" />
678
			<copy todir="lib/dtd" filtering="yes">
679
				<fileset
680
					dir="${build.tmp}/eml_${eml-beta4-tag}">
681
					<include name="*.dtd" />
682
				</fileset>
683
				<mapper type="glob" from="eml-*.dtd"
684
					to="eml-*-${eml-beta4-version}.dtd" />
685
			</copy>
686 2175 tao
687 7194 leinfelder
			<!--
688
			<copy todir="${style-common-cvsrelpath}" filtering="yes">
689
				<fileset
690
					dir="${build.tmp}/eml_${eml-beta4-tag}/style">
691
					<include name="**/*.xsl" />
692
				</fileset>
693
			</copy>
694
			-->
695
		</target>
696
697 4969 daigle
	<target name="geteml2+" depends="prepare" if="eml.required"
698 5176 daigle
		description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
699
		<svn>
700
			<export srcUrl="${svn.eml200SchemaUrl}"
701
				destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
702
		</svn>
703 4969 daigle
		<mkdir dir="lib/schema/eml-2.0.0" />
704
		<copy todir="lib/schema/eml-2.0.0" filtering="yes">
705
			<fileset
706 5176 daigle
				dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
707 4969 daigle
				<include name="*.xsd" />
708
			</fileset>
709 1939 brooke
710 4969 daigle
			<!-- shouldn't we have a mapper here like this??
711
				<mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
712
713
				Jing's code didn't nave one - does it need to be added?
714
				NOTE that eml-version is set to beta 6, so this would need changing -->
715 4080 daigle
716 4969 daigle
		</copy>
717
		<!-- <antcall target="copyxsl">
718
			<param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
719
			<param name="dirname" value="eml-2.0.0" />
720
			</antcall> -->
721 2175 tao
722 4969 daigle
		<!-- Checkout eml201 for given schema tag-->
723 5176 daigle
		<svn>
724
			<export srcUrl="${svn.eml201SchemaUrl}"
725
				destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
726
		</svn>
727 4969 daigle
		<mkdir dir="lib/schema/eml-2.0.1" />
728
		<copy todir="lib/schema/eml-2.0.1" filtering="yes">
729
			<fileset
730 5176 daigle
				dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
731 4969 daigle
				<include name="*.xsd" />
732
			</fileset>
733
		</copy>
734 1939 brooke
735 4969 daigle
		<!-- Checkout eml201 again for given style sheet tag-->
736
		<!-- echo>Enter CVS password: </echo>
737
			<cvs cvsRoot="${cvsroot}"
738
			package="${eml-module}"
739
			tag="${eml2_0_1-style-tag}"
740
			dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
741
			<antcall target="copyxsl">
742
			<param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
743
			<param name="dirname" value="eml-2.0.1" />
744
			</antcall -->
745 2175 tao
746 4969 daigle
		<!-- Checkout eml210 for given schema tag-->
747 5176 daigle
		<svn>
748
			<export srcUrl="${svn.eml210SchemaUrl}"
749
				destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
750
		</svn>
751 4969 daigle
		<mkdir dir="lib/schema/eml-2.1.0" />
752
		<copy todir="lib/schema/eml-2.1.0" filtering="yes">
753
			<fileset
754 5176 daigle
				dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
755 4969 daigle
				<include name="*.xsd" />
756
			</fileset>
757
		</copy>
758 1612 tao
759 4969 daigle
		<!-- Checkout eml210 for given style sheet tag-->
760 5176 daigle
		<svn>
761
			<export srcUrl="${svn.eml2StyleUrl}"
762
				destPath="${build.tmp}/eml_${eml2-style-tag}" />
763
		</svn>
764 4969 daigle
		<antcall target="copyxsl">
765
			<param name="cvs.tagname" value="${eml2-style-tag}" />
766
			<!-- param name="dirname" value="eml-2.1.0" / -->
767
			<param name="dirname" value="eml-2" />
768
		</antcall>
769 5709 leinfelder
770
		<!-- Checkout eml210 for given schema tag-->
771
		<svn>
772
			<export srcUrl="${svn.eml211SchemaUrl}"
773
				destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
774
		</svn>
775
		<mkdir dir="lib/schema/eml-2.1.1" />
776
		<copy todir="lib/schema/eml-2.1.1" filtering="yes">
777
			<fileset
778
				dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
779
				<include name="*.xsd" />
780
			</fileset>
781
		</copy>
782 4969 daigle
	</target>
783 2353 sgarg
784 4969 daigle
	<target name="copyxsl"
785 5176 daigle
		description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
786 3034 perry
787 4969 daigle
		<delete file="${style-common-cvsrelpath}/${eml-css}" />
788 3034 perry
789 4969 daigle
		<copy todir="${style-common-cvsrelpath}/${dirname}"
790
			filtering="yes">
791
			<fileset
792 5176 daigle
				dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
793 4969 daigle
				<include name="**/*.xsl" />
794
			</fileset>
795
		</copy>
796 3034 perry
797
798 4969 daigle
		<!-- now copy default css from eml module and put it in style-common-path
799
			dir with a new name, so other skin-specific css can import it if reqd -->
800
		<copy
801 5176 daigle
			file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
802 4969 daigle
			tofile="${style-common-cvsrelpath}/${eml-css}" />
803 3034 perry
804 4969 daigle
	</target>
805 3034 perry
806 4969 daigle
	<target name="correctEML201Docs" depends="jar"
807
		description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
808
		<copy todir="${build.dir}" file="lib/metacat.properties"
809
			filtering="yes" />
810
		<java
811
			classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
812
			<classpath>
813
				<path refid="compile.classpath" />
814
				<fileset dir="${build.dir}">
815
					<include name="${name}.jar" />
816
				</fileset>
817
			</classpath>
818
		</java>
819
	</target>
820 3034 perry
821 4969 daigle
	<target name="install-spatial" depends="jar,clientjar,harvesterjar"
822
		description="Installs spatial option for metacat">
823 5872 leinfelder
824
		<copy todir="${dist.dir}">
825
			<fileset dir="./lib/spatial/geoserver" includes="*.war" />
826
		</copy>
827 1952 jones
828 4969 daigle
	</target>
829 4080 daigle
830 4969 daigle
	<target name="install" depends="build-metacat"
831 8265 leinfelder
		description="* Install Metacat For Development *">
832 4969 daigle
		<copy file="${dist.dir}/${metacat.context}.war"
833
			todir="${app.deploy.dir}" />
834
		<delete dir="${app.deploy.dir}/${metacat.context}" />
835 5872 leinfelder
		<copy file="${dist.dir}/geoserver.war"
836
					todir="${app.deploy.dir}" />
837 8265 leinfelder
		<delete dir="${app.deploy.dir}/geoserver" />
838 7568 leinfelder
		<copy file="${dist.dir}/metacat-index.war"
839
					todir="${app.deploy.dir}" />
840 8265 leinfelder
		<delete dir="${app.deploy.dir}/metacat-index" />
841
		<copy file="${dist.dir}/metacatui.war"
842
					todir="${app.deploy.dir}" />
843
		<delete dir="${app.deploy.dir}/metacatui" />
844 4969 daigle
		<tstamp>
845
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
846
		</tstamp>
847
		<echo>Dev install completed at ${NOW}</echo>
848
	</target>
849 2343 sgarg
850 8174 leinfelder
	<target name="build-metacat" depends="install-ecogrid, install-spatial, dist-metacat-index, dist-metacat-ui"
851 4969 daigle
		description="Build Metacat">
852
	</target>
853 2343 sgarg
854 4969 daigle
	<target name="install-ecogrid" depends="warPrepare, get-ecogrid"
855
		if="enable.ecogrid" description="Install Ecogrid Compentent">
856
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
857
			inheritall="false">
858
			<property name="context" value="${metacat.context}" />
859
			<property name="target" value="${ecogrid-target-name}" />
860
		</ant>
861
		<ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
862
			inheritall="false">
863
			<property name="context" value="${metacat.context}" />
864
			<property name="target" value="${ecogrid-target-name}" />
865 5473 berkley
			<property name="metacat.dir" value="${basedir}"/>
866 4969 daigle
		</ant>
867
		<!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
868
			<webinf dir="${ecogrid-dir}/lib">
869
			<include name="server-config.wsdd"/>
870
			</webinf>
871
			</war -->
872
		<copy file="${ecogrid-dir}/build/${metacat.context}.war"
873
			todir="${dist.dir}" overwrite="true" />
874 2052 sgarg
875
876 4969 daigle
	</target>
877 2052 sgarg
878 4969 daigle
	<target name="get-ecogrid" depends="init"
879
		description="Check out ecogrid module" if="ecogrid.required">
880
		<svn>
881 5709 leinfelder
			<export srcUrl="${svn.ecogridUrl}" force="true"
882 4969 daigle
				destPath="${ecogrid-dir}" />
883
		</svn>
884
	</target>
885 2052 sgarg
886 4969 daigle
	<!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
887
		<ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
888
		<property name="context" value="${metacat.context}"/>
889
		<property name="target" value="${ecogrid-target-name}"/>
890
		<property name="metacat.dir" value="."/>
891
		<property name="hostname" value="${ecogrid.hostname}"/>
892
		<property name="port" value="${config.port}"/>
893
		</ant>
894
		</target -->
895 1952 jones
896 4969 daigle
	<target name="clean-ecogrid-server-config-wsdd" depends="init"
897
		description="Automately generate wsdd for ecogrid service">
898
		<delete
899
			file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
900
	</target>
901
902
	<target name="install-skin" depends="init"
903
		description="Install a Skin">
904
905
		<input message="Please enter name of the skin"
906
			addproperty="skin-name" />
907
908
		<mkdir dir="${installdir}/style/skins/${skin-name}" />
909
		<copy todir="${installdir}/style/skins/${skin-name}"
910
			filtering="yes">
911
			<fileset dir="lib/style/skins/${skin-name}">
912
				<exclude name="**/*.png" />
913
				<exclude name="**/*.gif" />
914
				<exclude name="**/*.jpg" />
915
				<exclude name="**/CVS*" />
916
				<exclude name="**/.#*" />
917
			</fileset>
918
		</copy>
919
		<copy todir="${installdir}/style/skins/${skin-name}"
920
			filtering="no">
921
			<fileset dir="lib/style/skins/${skin-name}">
922
				<include name="**/*.png" />
923
				<include name="**/*.gif" />
924
				<include name="**/*.jpg" />
925
				<exclude name="**/CVS*" />
926
				<exclude name="**/.#*" />
927
			</fileset>
928
		</copy>
929
		<copy todir="${installdir}/style/common" filtering="yes">
930
			<fileset dir="lib/style/common">
931
				<include name="*.js" />
932
				<include name="*.jsp" />
933
				<include name="*.css" />
934
				<exclude name="*.png" />
935
				<exclude name="*.gif" />
936
				<exclude name="*.jpg" />
937
				<exclude name="**/CVS*" />
938
				<exclude name="**/.#*" />
939
			</fileset>
940
		</copy>
941
		<!--
942
			<mkdir dir="${installdir}/style/skins/${skin-name}/images" />
943
			<copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
944
			<fileset dir="lib/style/skins/${skin-name}/images">
945
			<include name="*.png"/>
946
			<include name="*.gif"/>
947
			<include name="*.jpg"/>
948
			</fileset>
949
			</copy>
950
		-->
951
952
		<echo message="Install Skin completed." />
953
	</target>
954
955 8183 leinfelder
	<target name="war" depends="warPrepare,install-spatial"
956 4969 daigle
		description="Create a web archive (WAR) for servlet deployment">
957
		<mkdir dir="${dist.dir}" />
958
		<war destfile="${dist.dir}/${metacat.context}.war"
959
			webxml="${build.war}/web.xml">
960
			<fileset dir="${war.context}" />
961
			<lib dir="${war.lib}" />
962
			<webinf dir="${war.webinf}" />
963
		</war>
964
	</target>
965
966
	<target name="warPrepare"
967 8100 leinfelder
		depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare,documentation"
968 4969 daigle
		description="Prepare files for creating a web archive (WAR)">
969
970
		<property name="war.lib" value="${build.war}/lib" />
971
		<property name="war.webinf" value="${build.war}/WEB-INF" />
972
		<property name="war.context"
973
			value="${build.war}/${metacat.context}" />
974
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
975
		<property name="war.webinf.scripts"
976
			value="${war.webinf}/scripts" />
977
		<property name="war.context.cgi" value="${war.context}/cgi-bin" />
978
		<property name="war.context.docs" value="${war.context}/docs" />
979
		<property name="war.context.temp" value="${war.context}/temp" />
980
		<property name="war.context.templates"
981
			value="${war.context}${style-common-relpath}/templates" />
982
		<mkdir dir="${war.lib}" />
983
		<mkdir dir="${war.webinf}" />
984
		<mkdir dir="${war.context}" />
985
		<mkdir dir="${war.webinf.sql}" />
986
		<mkdir dir="${war.context.cgi}" />
987
		<mkdir dir="${war.context.docs}" />
988
		<mkdir dir="${war.context.temp}" />
989
		<mkdir dir="${war.context.templates}" />
990
991
		<!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
992
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
993
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
994
		<!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
995
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
996
		<copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
997
		<copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
998
		<copy todir="${war.lib}" filtering="no">
999
			<fileset dir="lib">
1000
				<include name="*.jar" />
1001 5297 jones
				<exclude name="maven-ant-tasks*.jar" />
1002 4969 daigle
			</fileset>
1003 7624 leinfelder
			<fileset dir="${libdir.mvn}" />
1004 4969 daigle
		</copy>
1005
		<!-- MCD copy file="lib/web.xml.${tomcatversion}"
1006
			tofile="${build.war}/web.xml" / -->
1007
		<!-- MCD added next - Remove the tomcat5 reference-->
1008 6559 leinfelder
		<copy file="lib/web.xml.tomcat6" tofile="${build.war}/web.xml" />
1009 4969 daigle
		<copy file="lib/metacat.properties" todir="${war.webinf}"
1010
			filtering="yes" />
1011 7661 tao
		<copy file="lib/solrQueryFieldDescriptions.properties" todir="${war.webinf}"/>
1012 4969 daigle
		<copy file="lib/metacat.properties.metadata.xml"
1013
			todir="${war.webinf}" filtering="no" />
1014
		<copy file="lib/org.properties.metadata.xml"
1015
			todir="${war.webinf}" filtering="no" />
1016
		<copy file="lib/auth.properties.metadata.xml"
1017
			todir="${war.webinf}" filtering="no" />
1018
		<copy todir="${war.webinf}" filtering="yes">
1019
			<fileset dir="lib">
1020
				<include name="skin.configs/**" />
1021
			</fileset>
1022
		</copy>
1023
		<copy file="lib/log4j.properties" todir="${war.webinf}"
1024
			filtering="yes" />
1025 6486 leinfelder
		<copy file="lib/hazelcast.xml" todir="${war.webinf}"
1026
			filtering="yes" />
1027 7737 leinfelder
		<copy file="lib/oa4mp_client.xml" todir="${war.webinf}"
1028
			filtering="yes" />
1029 4969 daigle
		<copy todir="${war.context}" filtering="no">
1030
			<fileset dir="lib">
1031
				<include name="**/*.jpg" />
1032
				<include name="**/*.png" />
1033
				<include name="**/*.gif" />
1034
				<include name="LiveMap_30/**" />
1035
				<include name="oaipmh/**" />
1036
			</fileset>
1037
		</copy>
1038
		<copy todir="${war.context}" filtering="yes">
1039
			<fileset dir="lib">
1040
				<exclude name="*.jar" />
1041
				<exclude name="*.properties" />
1042
				<exclude name="*.metadata.xml" />
1043
				<exclude name="web.xml" />
1044
				<exclude name="**/*.jpg" />
1045
				<exclude name="**/*.png" />
1046
				<exclude name="**/*.gif" />
1047
				<exclude name="lsid_lib/**" />
1048
				<exclude name="lsid_conf/**" />
1049
				<exclude name="LiveMap_30/**" />
1050
				<exclude name="oaipmh/**" />
1051 7770 leinfelder
				<exclude name="maven/**" />
1052 4969 daigle
				<exclude name="skin.configs/**" />
1053 5865 leinfelder
				<exclude name="spatial/geoserver/**" />
1054 4969 daigle
			</fileset>
1055
		</copy>
1056 5865 leinfelder
		<copy todir="${war.context}" filtering="no">
1057
			<fileset dir="lib">
1058
				<include name="spatial/geoserver/data/**" />
1059
			</fileset>
1060
		</copy>
1061 4969 daigle
		<copy todir="${war.context.docs}" filtering="no">
1062 6898 jones
			<fileset dir="${build.docs}" />
1063 4969 daigle
		</copy>
1064
		<copy todir="${war.webinf.sql}" filtering="yes">
1065
			<fileset dir="src">
1066
				<include name="**/*.sql" />
1067
			</fileset>
1068
		</copy>
1069
		<copy todir="${war.webinf.scripts}" filtering="yes">
1070
			<fileset dir="src/scripts" />
1071
		</copy>
1072
		<copy todir="${war.webinf.scripts}"
1073
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
1074
			failonerror="false" />
1075
1076
		<copy file="src/perl/register-dataset.cgi"
1077
			todir="${war.context.cgi}" />
1078
		<copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1079
		<copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1080
1081
		<!-- registry cgi section -->
1082
		<!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
1083
			used in readDocumentFromMetacat -->
1084
		<!-- TODO MCD copy temp files to actual location using config util?? -->
1085
		<copy todir="${war.context.temp}" filtering="yes">
1086
			<fileset dir="lib/style/common/emlb6toeml2">
1087
				<include name="*.xsl" />
1088
				<include name="*.xml" />
1089
			</fileset>
1090
		</copy>
1091
		<available file="lib/style/common/emlb6toeml2" type="dir"
1092
			property="styles.not.needed" />
1093
1094
		<!-- ldap cgi section -->
1095
		<copy todir="${war.context.templates}">
1096
			<fileset dir="lib/style/common/templates">
1097
				<!-- SCW: Copy all files -->
1098
			</fileset>
1099
		</copy>
1100
	</target>
1101
1102
	<target name="cgiPrepare" if="build.perl">
1103
		<exec dir="src/perl/Metacat/" executable="make">
1104 4820 daigle
			<arg value="clean" />
1105 4969 daigle
		</exec>
1106
		<exec dir="src/perl/Metacat/" executable="perl">
1107 4369 daigle
			<arg value="Makefile.PL" />
1108
		</exec>
1109 4820 daigle
		<exec dir="src/perl/Metacat/" executable="make" />
1110 4369 daigle
	</target>
1111 4969 daigle
1112 4550 daigle
	<target name="testPrepare"
1113 4435 daigle
		description="Copies test files into the war directories">
1114
		<echo>in testPrepare</echo>
1115 4969 daigle
		<property name="war.context.test"
1116
			value="${build.war}/${metacat.context}/test" />
1117 4435 daigle
		<mkdir dir="${war.context.test}" />
1118 4969 daigle
		<copy todir="${war.context.test}" filtering="yes">
1119
			<fileset dir="test/servertestfiles">
1120
				<include name="*/**" />
1121
			</fileset>
1122 4435 daigle
		</copy>
1123
	</target>
1124 1929 brooke
1125 4969 daigle
	<target name="getConversionXSL" depends="prepare"
1126
		unless="styles.not.needed"
1127
		description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1128 2497 sgarg
1129 5176 daigle
		<svn>
1130
			<export srcUrl="${svn.eml2StyleUrl}"
1131
				destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1132
		</svn>
1133 2343 sgarg
1134 4969 daigle
		<mkdir dir="lib/style/common/emlb6toeml2" />
1135
		<copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1136
			<fileset
1137 5176 daigle
				dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1138 4969 daigle
				<include name="*.xsl" />
1139
				<include name="*.xml" />
1140
			</fileset>
1141
		</copy>
1142
	</target>
1143 1929 brooke
1144 4969 daigle
	<target name="testprep" depends="jar,clientjar,harvesterjar">
1145
		<mkdir dir="${build.tests}" />
1146 5753 leinfelder
		<copy todir="${build.tests}" encoding="UTF-8">
1147 4969 daigle
			<fileset dir="${testdir}">
1148
				<include name="edu/**" />
1149
			</fileset>
1150
		</copy>
1151 5753 leinfelder
		<copy todir="${build.tests}" file="${testdir}/test.properties" />
1152 4121 daigle
1153 6003 cjones
		<path id="test.classpath">
1154
			<path refid="compile.classpath" />
1155
			<fileset dir="${build.dir}">
1156
				<include name="${name}.jar" />
1157
				<include name="${name}-client.jar" />
1158
				<include name="harvester.jar" />
1159
			</fileset>
1160
		</path>
1161
1162
		<pathconvert pathsep="${line.separator}|  |--"
1163
		             property="echo.test.classpath"
1164
		             refid="test.classpath">
1165
		</pathconvert>
1166
		<echo message="|--test classpath" />
1167
		<echo message="|  |" />
1168
		<echo message="|  |-- ${echo.test.classpath}" />
1169
1170 4969 daigle
		<!-- copy and compile the tests into a jar file -->
1171
		<javac srcdir="${build.tests}" destdir="${build.tests}"
1172 5753 leinfelder
			debug="on" includes="**/*.java" encoding="UTF-8">
1173 6003 cjones
			<classpath refid="test.classpath" />
1174 4969 daigle
		</javac>
1175 204 jones
1176 4969 daigle
		<jar jarfile="${build.dir}/${name}-junittests.jar"
1177 6565 leinfelder
			basedir="${build.tests}" >
1178
			<include name="**/*.class"/>
1179
			<include name="**/*.xml"/>
1180
		</jar>
1181 6003 cjones
1182 4969 daigle
	</target>
1183 971 tao
1184 6966 leinfelder
	<target name="runoneclass" depends="testprep"
1185
		description="Uses the ant to run a class">
1186
1187
		<java classname="${classtorun}" fork="true">
1188 5753 leinfelder
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1189 4969 daigle
			<classpath>
1190 5311 daigle
				<path refid="test.classpath" />
1191 4969 daigle
				<fileset dir="${build.dir}">
1192
					<include name="${name}.jar" />
1193
					<include name="${name}-client.jar" />
1194
					<include name="harvester.jar" />
1195
					<include name="${name}-junittests.jar" />
1196
				</fileset>
1197
			</classpath>
1198 6966 leinfelder
		</java>
1199 4969 daigle
	</target>
1200 7011 leinfelder
1201
	<target name="test" depends="testprep"
1202
		description="Uses the ant junit task to run all JUnit tests">
1203 1103 tao
1204 7011 leinfelder
		<!-- use the ant "junit" task to run JUnit tests. -->
1205
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1206
			haltonerror="no">
1207
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1208
			<classpath>
1209
				<path refid="test.classpath" />
1210
				<fileset dir="${build.dir}">
1211
					<include name="${name}.jar" />
1212
					<include name="${name}-client.jar" />
1213
					<include name="harvester.jar" />
1214
					<include name="${name}-junittests.jar" />
1215
				</fileset>
1216
			</classpath>
1217
1218
			<formatter type="plain" />
1219
1220
			<batchtest fork="yes" todir="${build.dir}">
1221
				<fileset dir="${build.tests}">
1222
					<include name="**/*.class" />
1223
					<exclude name="**/MCTestCase.class" />
1224
					<exclude name="**/ClientViewHelperTest.class" />
1225
					<!-- these are not test cases -->
1226
					<exclude name="**/MockCNode.class" />
1227
					<exclude name="**/D1NodeServiceTest.class" />
1228 7237 tao
					<exclude name="**/QueryRunner.class" />
1229 7238 tao
					<exclude name="**/MockObjectPathMap.class" />
1230 7267 tao
					<exclude name="**/HzObjectPathMapTest$1.class" />
1231
					<exclude name="**/HzObjectPathMapTest$2.class" />
1232 7011 leinfelder
				</fileset>
1233
			</batchtest>
1234
		</junit>
1235
	</target>
1236
1237 4969 daigle
	<target name="runonetest" depends="testprep"
1238
		description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1239 1500 tao
1240 4969 daigle
		<echo>testtorun: ${testtorun}</echo>
1241 1939 brooke
1242 4969 daigle
		<!-- use the ant "junit" task to run JUnit tests. -->
1243
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1244
			haltonerror="no" showoutput="yes">
1245 5753 leinfelder
			<jvmarg value="-Dfile.encoding=UTF-8"/>
1246 4969 daigle
			<classpath>
1247 5311 daigle
				<path refid="test.classpath" />
1248 4969 daigle
				<fileset dir="${build.dir}">
1249
					<include name="${name}.jar" />
1250
					<include name="${name}-client.jar" />
1251
					<include name="harvester.jar" />
1252
					<include name="${name}-junittests.jar" />
1253
				</fileset>
1254
			</classpath>
1255 1500 tao
1256 4969 daigle
			<formatter type="plain" />
1257 1500 tao
1258 4969 daigle
			<batchtest fork="yes" todir="${build.dir}">
1259
				<fileset dir="${build.tests}">
1260
					<include name="**/${testtorun}.class" />
1261
				</fileset>
1262
			</batchtest>
1263
		</junit>
1264
	</target>
1265 6966 leinfelder
1266
	<target name="run" depends="testprep"
1267
			description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1268 1500 tao
1269 6966 leinfelder
			<echo>testtorun: ${testtorun}</echo>
1270
1271
			<!-- use the ant "junit" task to run JUnit tests. -->
1272
			<junit printsummary="yes" haltonfailure="no" fork="yes"
1273
				haltonerror="no" showoutput="yes">
1274
				<jvmarg value="-Dfile.encoding=UTF-8"/>
1275
				<classpath>
1276
					<path refid="test.classpath" />
1277
					<fileset dir="${build.dir}">
1278
						<include name="${name}.jar" />
1279
						<include name="${name}-client.jar" />
1280
						<include name="harvester.jar" />
1281
						<include name="${name}-junittests.jar" />
1282
					</fileset>
1283
				</classpath>
1284
1285
				<formatter type="plain" />
1286
1287
				<batchtest fork="yes" todir="${build.dir}">
1288
					<fileset dir="${build.tests}">
1289
						<include name="**/${testtorun}.class" />
1290
					</fileset>
1291
				</batchtest>
1292
			</junit>
1293
		</target>
1294
1295 4969 daigle
	<target name="testharvester" depends="testprep"
1296
		description="Uses the ant junit task to test only the Harvester code">
1297
		<junit printsummary="yes" haltonfailure="off" fork="yes"
1298
			haltonerror="off">
1299
			<classpath>
1300
				<path refid="compile.classpath" />
1301
				<fileset dir="${build.dir}">
1302
					<include name="${name}.jar" />
1303
					<include name="${name}-client.jar" />
1304
					<include name="harvester.jar" />
1305
					<include name="${name}-junittests.jar" />
1306
				</fileset>
1307
			</classpath>
1308
			<formatter type="plain" />
1309
			<batchtest fork="yes" todir="${build.dir}">
1310
				<fileset dir="${build.tests}">
1311
					<include name="**/harvesterClient/*.class" />
1312
				</fileset>
1313
			</batchtest>
1314
		</junit>
1315
	</target>
1316 2135 costa
1317 4969 daigle
	<!-- run this target, we need to check out a another morpho souce dir was checked out. -->
1318
	<target name="nettest" depends="install"
1319
		description="compiles and runs the metacatnettest code">
1320 2175 tao
1321 4969 daigle
		<echo>
1322
			*********************************** Please run ant
1323
			gethttpclient first! ***********************************
1324
		</echo>
1325
		<!-- copy and compile the tests into a jar file -->
1326
		<mkdir dir="${build.metacatnettest}" />
1327
		<javac srcdir="${junitnettestsdir}"
1328
			destdir="${build.metacatnettest}" includes="**/*.java">
1329
			<classpath>
1330
				<path refid="compile.classpath" />
1331
				<fileset dir="${build.dir}">
1332
					<include name="${name}.jar" />
1333
				</fileset>
1334
			</classpath>
1335
		</javac>
1336 1103 tao
1337 4969 daigle
		<jar jarfile="${build.dir}/${name}-junitnettests.jar"
1338
			basedir="${build.metacatnettest}" includes="**/*.class" />
1339 1103 tao
1340 4969 daigle
		<!-- use the ant "junit" task to run JUnit tests. -->
1341
		<junit printsummary="yes" haltonfailure="no" fork="yes"
1342
			haltonerror="no">
1343
			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
1344
			<classpath>
1345
				<path refid="compile.classpath" />
1346
				<fileset dir="${build.dir}">
1347
					<include name="${name}.jar" />
1348
					<include name="${name}-junitnettests.jar" />
1349
				</fileset>
1350
			</classpath>
1351 1103 tao
1352 4969 daigle
			<formatter type="plain" />
1353 1103 tao
1354 4969 daigle
			<batchtest fork="yes" todir="${build.dir}">
1355
				<fileset dir="${build.metacatnettest}">
1356
					<include name="**/*.class" />
1357
				</fileset>
1358
			</batchtest>
1359
		</junit>
1360
	</target>
1361 1103 tao
1362 4969 daigle
	<target name="cleanweb" depends="clean"
1363
		description="deletes tomcat web context dir and all its contents">
1364
		<delete dir="${installdir}" />
1365
	</target>
1366 1522 berkley
1367
1368 4969 daigle
	<target name="clean" depends="init"
1369
		description="deletes build dir and files that can be regenerated form the release">
1370
		<delete dir="${build.dir}" />
1371
		<delete dir="${dist.dir}" />
1372
	</target>
1373 2320 jones
1374 4098 daigle
	<target name="localclean" depends="clean"
1375 4969 daigle
		description="deletes even jars that depend on external sources such as stylesheets and jars">
1376
		<delete file="lib/utilities.jar" />
1377
	</target>
1378 113 jones
1379 4969 daigle
	<target name="fullclean" depends="localclean"
1380
		description="deletes code and eml">
1381
		<delete includeEmptyDirs="true" failonerror="false">
1382
			<fileset dir="${style-common-cvsrelpath}">
1383
				<include name="${eml-css}" />
1384
				<include name="eml-*/*.xsl" />
1385
				<include name="eml-*" />
1386
			</fileset>
1387
			<fileset dir="${schema-cvsrelpath}">
1388
				<include name="eml-*/*.xsd" />
1389
			</fileset>
1390 5841 tao
			<fileset dir="${ecogrid-dir}"/>
1391 5809 leinfelder
			<fileset dir="lib/style/common/emlb6toeml2"/>
1392
			<fileset dir="lib/dtd"/>
1393
			<fileset dir="lib/schema"/>
1394 6184 tao
			<fileset dir="${utilitiesdir}"/>
1395 8236 leinfelder
			<fileset dir="${metacatui.build.dir}"/>
1396 7624 leinfelder
			<fileset dir="${libdir.mvn}"/>
1397 4969 daigle
		</delete>
1398 7250 leinfelder
		<!-- clean up the distribution files if they exist-->
1399
		<delete file="./${name}-bin-${release}.tar.gz" />
1400
		<delete file="./${name}-src-${release}.tar.gz" />
1401
		<delete file="./${name}-bin-${release}.zip" />
1402
		<delete file="./${name}-src-${release}.zip" />
1403 4969 daigle
	</target>
1404 6897 jones
1405
	<target name="documentation" depends="javadoc,admindoc"
1406
	    description="generates Javadoc API documentation and Admin Guide">
1407
    </target>
1408
1409
	<target name="admindoc" depends="prepare">
1410
		<!-- Build the administrator's guide, which is a Sphinx RST project
1411
		     For this to succeed, you must have Sphinx installed on your machine
1412
		     See: http://sphinx.pocoo.org/ for details
1413
		     And you must also have the 'make' build tool installed
1414
		-->
1415
		<exec dir="${docdir}/user/metacat" executable="make">
1416 7521 leinfelder
		        <arg value="plantuml"/>
1417
		</exec>
1418
1419
		<exec dir="${docdir}/user/metacat" executable="make">
1420 6897 jones
		        <arg value="html"/>
1421
		</exec>
1422 7521 leinfelder
1423 6897 jones
    </target>
1424 113 jones
1425 6897 jones
	<target name="javadoc" depends="prepare"
1426
		description="generates Javadoc API documentation">
1427 4969 daigle
		<javadoc packagenames="edu.ucsb.nceas.*"
1428
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
1429
			version="true" use="true" windowtitle="${Name} API"
1430
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1431 6897 jones
			bottom="&lt;i&gt;Copyright &#169; ${copyright}. All Rights Reserved.&lt;/i&gt;">
1432 4969 daigle
			<classpath>
1433
				<path refid="compile.classpath" />
1434
			</classpath>
1435
		</javadoc>
1436
	</target>
1437 882 jones
1438 4969 daigle
	<target name="dist"
1439 6897 jones
		depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL,getutilities"
1440 4969 daigle
		description="prepares a full release distribution">
1441
		<mkdir dir="${dist.dir}" />
1442
		<delete dir="${ver.dir}" />
1443
		<mkdir dir="${ver.dir}" />
1444
		<copy todir="${ver.dir}">
1445
			<fileset dir="."
1446
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1447
		</copy>
1448
		<copy todir="${ver.dir}" file="build.xml" />
1449
		<copy todir="${ver.dir}" file="build.properties" />
1450 806 jones
1451 4969 daigle
		<copy todir="${ver.dir}/docs" filtering="yes">
1452
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1453
		</copy>
1454
		<copy todir="${ver.dir}/docs" filtering="no">
1455
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1456
		</copy>
1457
		<copy todir="${ver.dir}/docs/dev">
1458
			<fileset dir="${build.dir}/docs" />
1459
		</copy>
1460
		<copy todir="${ver.dir}/src">
1461
			<fileset dir="${build.dir}/src" />
1462
		</copy>
1463
1464
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
1465
		<copy todir="${ver.dir}/test/servertestfiles">
1466
			<fileset dir="./test/servertestfiles" />
1467
		</copy>
1468
	</target>
1469
1470 7257 leinfelder
	<target name="fulldist" depends="distbin, distsrc"
1471
			description="full distribution - source and bin"/>
1472
1473 4969 daigle
	<target name="distbin" depends="build-metacat,war-lsid"
1474
		description="prepares a binary distribution">
1475 4372 daigle
		<copy todir="${dist.dir}">
1476 4969 daigle
			<fileset dir="./src/scripts" />
1477
		</copy>
1478 4372 daigle
		<delete file="./${name}-bin-${release}.zip" />
1479 4969 daigle
		<zip zipfile="./${name}-bin-${release}.zip"
1480 8146 leinfelder
			basedir="${dist.dir}" />
1481 4372 daigle
		<delete file="./${name}-bin-${release}.tar.gz" />
1482 4969 daigle
		<tar tarfile="./${name}-bin-${release}.tar"
1483 8146 leinfelder
			basedir="${dist.dir}" />
1484 4969 daigle
		<gzip zipfile="./${name}-bin-${release}.tar.gz"
1485
			src="./${name}-bin-${release}.tar" />
1486 4372 daigle
		<delete file="./${name}-bin-${release}.tar" />
1487
	</target>
1488 806 jones
1489 4969 daigle
	<target name="distsrc" depends="dist"
1490
		description="prepares a source distribution">
1491
		<mkdir dir="${ver.src}" />
1492
		<copy todir="${ver.src}">
1493
			<fileset dir="./src" />
1494
		</copy>
1495
		<mkdir dir="${util.dir}" />
1496
		<copy todir="${util.dir}">
1497 7248 leinfelder
			<fileset dir="${utilitiesdir}" excludes="**/CVS*" />
1498 4969 daigle
		</copy>
1499 3131 perry
1500 4969 daigle
		<mkdir dir="${ecogrid-dist-dir}" />
1501
		<copy todir="${ecogrid-dist-dir}">
1502
			<fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1503
		</copy>
1504 806 jones
1505 4969 daigle
		<delete file="${ver.dir}/lib/utilities.jar" />
1506 2175 tao
1507 4969 daigle
		<delete file="./${name}-src-${release}.zip" />
1508
		<zip zipfile="./${name}-src-${release}.zip"
1509
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1510
		<delete file="./${name}-src-${release}.tar.gz" />
1511
		<tar tarfile="./${name}-src-${release}.tar"
1512
			basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1513
		<gzip zipfile="./${name}-src-${release}.tar.gz"
1514
			src="./${name}-src-${release}.tar" />
1515
		<delete file="./${name}-src-${release}.tar" />
1516
		<!--delete dir="${dist.dir}"/ -->
1517
	</target>
1518 2175 tao
1519 4969 daigle
	<target name="deb-package" depends="distbin"
1520
		description="create a debian installation package">
1521
		<delete dir="${deb.pkg.dir}" />
1522
		<mkdir dir="${deb.pkg.dir}/DEBIAN" />
1523
		<copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1524
			<fileset dir="./src/scripts/debian"
1525
				includes="control postinst" />
1526
		</copy>
1527 2598 harris
1528 4969 daigle
		<mkdir
1529
			dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1530
		<copy
1531
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1532
			filtering="yes">
1533
			<fileset dir="./src/scripts/debian"
1534
				excludes="control postinst" />
1535
		</copy>
1536
		<chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1537 2598 harris
1538 8265 leinfelder
		<copy file="${dist.dir}/${metacat.context}.war"
1539 4969 daigle
			todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1540
		<copy file="./metacat-bin-${metacat.version}.tar.gz"
1541
			tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1542 2737 jones
1543 4969 daigle
		<exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1544
			failonerror="true">
1545
			<arg line="--build debian" />
1546
		</exec>
1547 2737 jones
1548 4969 daigle
		<move file="${pkg.dir}/debian.deb"
1549
			tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1550
	</target>
1551
1552
	<target name="stylesheettest">
1553
		<xslt in="${input}" out="eml.html"
1554
			style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1555
			<param name="displaymodule" expression="${displaymodule}" />
1556
			<param name="docid" expression="${input}" />
1557
			<param name="entitytype" expression="${entitytype}" />
1558
			<param name="entityindex" expression="${entityindex}" />
1559
			<outputproperty name="method" value="html" />
1560
			<outputproperty name="standalone" value="yes" />
1561
			<outputproperty name="encoding" value="iso8859_1" />
1562
			<outputproperty name="indent" value="yes" />
1563
		</xslt>
1564
	</target>
1565
1566
	<target name="spatial_option" depends="prepare"
1567
		description=" -- compiles code for the spatial option">
1568
1569
		<echo message="Compiling the metatcat shapefile creator" />
1570
		<echo message="using the shapelib at: ${shapelib.dir}" />
1571
		<exec dir="." executable="g++" os="Linux, Unix"
1572
			failonerror="true">
1573
			<arg
1574
				line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1575
		</exec>
1576
1577
		<exec dir="." executable="g++" os="Linux, Unix"
1578
			failonerror="true">
1579
			<arg
1580
				line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1581
		</exec>
1582
	</target>
1583
1584
	<!-- LSID Authority support -->
1585
	<patternset id="lsid.jars">
1586
		<include name="axis.jar" />
1587
		<include name="commons-discovery-0.2.jar" />
1588
		<include name="jaxrpc.jar" />
1589
		<include name="lsid-client-1.1.1.jar" />
1590
		<include name="lsid-server-1.1.1.jar" />
1591
		<include name="saaj.jar" />
1592
		<include name="wsdl4j-1.5.1.jar" />
1593
		<include name="activation.jar" />
1594
		<include name="castor-0.9.5.jar" />
1595
		<include name="dnsjava-1.3.2.jar" />
1596
		<include name="mail.jar" />
1597
		<include name="commons-logging-1.0.4.jar" />
1598
		<!-- These jars may be needed but seem to not actually be,
1599
			so leaving them out for now
1600
			<include name="axis-ant.jar" />
1601
		-->
1602
		<!--<include name="GenCastor.class" />-->
1603
	</patternset>
1604
	<patternset id="lib.jars">
1605
		<include name="log4j-1.2.12.jar" />
1606
		<include name="utilities.jar" />
1607 5866 leinfelder
		<include name="xerces*.jar" />
1608
		<include name="xalan*.jar" />
1609 7271 leinfelder
		<include name="xml-apis*.jar" />
1610 4969 daigle
	</patternset>
1611
1612
	<path id="lsid.classpath">
1613
		<fileset dir="${lsid.lib.dir}">
1614
			<patternset refid="lsid.jars" />
1615
		</fileset>
1616
		<fileset dir="${lib.dir}">
1617 5866 leinfelder
			<patternset refid="lib.jars" />
1618 4969 daigle
		</fileset>
1619
		<fileset dir="${build.dir}">
1620
			<include name="metacat-client.jar" />
1621 5866 leinfelder
			<include name="metacat.jar" />
1622 4969 daigle
		</fileset>
1623
	</path>
1624
1625
	<filterset id="configFilters">
1626
		<!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1627
			value="${config.hostname}" / -->
1628
		<!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1629
			value="${config.port}" / -->
1630
		<!-- MCD BYE filter token="METADATA_LABELS"
1631
			value="${config.metadataLabelLsid}" / -->
1632
		<!-- MCD BYE filter token="METACAT_SERVER"
1633
			value="${config.metacatserver}" / -->
1634
		<!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1635
			value="${config.lsidauthority}" / -->
1636
	</filterset>
1637
1638
	<target name="prepare-lsid" depends="prepare,utilities,clientjar"
1639
		description="Configure files prior to compilation">
1640
		<mkdir dir="${lsid.build.dir}" />
1641
		<!-- Copy the properties file into the build -->
1642
		<copy file="${conf.dir}/metacat-lsid.properties"
1643
			tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1644
			overwrite="true">
1645
			<filterset refid="configFilters" />
1646
		</copy>
1647
		<copy file="${conf.dir}/log4j.properties"
1648
			tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1649
			overwrite="true">
1650
			<filterset refid="configFilters" />
1651
		</copy>
1652
		<!-- Copy config files into the build -->
1653
		<copy todir="${lsid.build.dir}/WEB-INF">
1654
			<fileset dir="${webinf.dir}" includes="**/*.wsdd" />
1655
		</copy>
1656
		<!-- Copy the metadata configuration files into the build -->
1657
		<mkdir
1658
			dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1659
		<copy
1660
			todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1661
			<fileset dir="${conf.dir}" includes="**/*.xml" />
1662
			<fileset dir="${conf.dir}" includes="**/*.xslt" />
1663
			<filterset refid="configFilters" />
1664
		</copy>
1665
		<!-- Copy services files into the build -->
1666
		<mkdir dir="${lsid.build.dir}/services" />
1667
		<copy todir="${lsid.build.dir}/services">
1668
			<fileset dir="${services.dir}" />
1669
			<filterset refid="configFilters" />
1670
		</copy>
1671
		<!-- Copy axis files into the build -->
1672
		<mkdir dir="${lsid.build.dir}" />
1673
		<copy todir="${lsid.build.dir}">
1674
			<fileset dir="${conf.dir}/axis" excludes="*.properties" />
1675
		</copy>
1676
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1677
		<copy todir="${lsid.build.dir}/WEB-INF/classes">
1678
			<fileset dir="${conf.dir}/axis" includes="*.properties" />
1679
		</copy>
1680
	</target>
1681
1682
	<target name="compile-lsid" depends="prepare-lsid"
1683
		description="Compile Java sources">
1684
		<mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1685
		<javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1686
			destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1687
			deprecation="${compile.deprecation}"
1688
			optimize="${compile.optimize}">
1689 8104 leinfelder
			<classpath>
1690
				<path refid="compile.classpath" />
1691
				<fileset dir="${build.dir}">
1692
					<include name="${name}.jar" />
1693
				</fileset>
1694
			</classpath>
1695 4969 daigle
		</javac>
1696
	</target>
1697
1698
	<target name="war-lsid" depends="compile-lsid"
1699
		description="Create a war file for the application">
1700
		<mkdir dir="${dist.dir}" />
1701
		<war destfile="${dist.dir}/${authority.context}.war"
1702
			webxml="${webinf.dir}/web.xml">
1703
			<fileset dir="${lsid.build.dir}" />
1704
			<lib dir="${lsid.lib.dir}">
1705
				<patternset refid="lsid.jars" />
1706
			</lib>
1707
			<lib dir="${lib.dir}">
1708
				<patternset refid="lib.jars" />
1709
			</lib>
1710
			<lib dir="${lib.dir}">
1711
				<include name="xalan.jar" />
1712
				<include name="xml-apis.jar" />
1713
			</lib>
1714
			<lib dir="${build.dir}">
1715
				<include name="metacat-client.jar" />
1716
			</lib>
1717
		</war>
1718
	</target>
1719
1720
	<target name="deploy-lsid" depends="war-lsid"
1721
		description="Deploy LSID war to servlet container">
1722
		<delete dir="${app.deploy.dir}/${authority.context}" />
1723
		<delete file="${app.deploy.dir}/${authority.context}.war" />
1724
		<mkdir dir="${app.deploy.dir}" />
1725
		<copy todir="${app.deploy.dir}">
1726
			<fileset dir="${dist.dir}" />
1727
		</copy>
1728
	</target>
1729 5919 tao
1730
	<target name="change-metacat-properties" depends="warPrepare"
1731
        description="Chage some default values of metacat.properties">
1732 5924 tao
       <echo file="${metacat-properties-file}" append="true">
1733
		   configutil.propertiesConfigured=true
1734
		   configutil.authConfigured=true
1735
           configutil.skinsConfigured=true
1736
		   configutil.databaseConfigured=true
1737
		   configutil.geoserverConfigured=true
1738
	   </echo>
1739 6003 cjones
  </target>
1740 5919 tao
1741 5925 tao
	<!-- This target will use default values in svn metacat.properties to build a configured
1742
		metacat (except configuti.* properties, they will be set true). Those default settings
1743
		are for a test machine. It may not work on your system-->
1744 5924 tao
	<target name="install-configured-metacat" depends="change-metacat-properties, install"
1745 5919 tao
        description="Install a metacat by the default value in metacat.properties without additional configutaion">
1746
    </target>
1747 7633 tao
1748
	<!-- build metacat-common jar -->
1749 7803 tao
	<target name="build-metacat-common" description="Calls the Maven build for metacat-common jar" unless="build-metacat-common-called" >
1750 7633 tao
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1751
		            <arg value="clean"/>
1752
		</artifact:mvn>
1753
		<artifact:mvn pom="metacat-common/pom.xml" mavenhome="${maven.home}" fork="true">
1754
		   <arg value="install"/>
1755
		</artifact:mvn>
1756 7803 tao
		<property name="build-metacat-common-called" value="true"/>
1757 7633 tao
	</target>
1758 7561 leinfelder
1759
	<!-- build metacat-index war -->
1760
	<target name="build-metacat-index" description="Calls the Maven build for metacat-index.war" >
1761
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1762 7583 leinfelder
			<arg value="clean"/>
1763
		</artifact:mvn>
1764
		<artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1765 7561 leinfelder
			<arg value="package"/>
1766 7583 leinfelder
			<!--<arg value="-Dmaven.test.skip=true"/>-->
1767 7561 leinfelder
		</artifact:mvn>
1768
	</target>
1769 5919 tao
1770 7568 leinfelder
	<target name="dist-metacat-index" depends="init, build-metacat-index" description="Copy metacat-index.war to dist folder" >
1771
		<copy tofile="${dist.dir}/metacat-index.war" >
1772 7561 leinfelder
			<fileset dir="metacat-index/target" includes="metacat-index*.war"></fileset>
1773
		</copy>
1774
	</target>
1775
1776 7568 leinfelder
	<target name="install-metacat-index" depends="dist-metacat-index" description="Copy metacat-index.war to deploy folder" >
1777
		<copy todir="${app.deploy.dir}" file="${dist.dir}/metacat-index.war" />
1778
	</target>
1779
1780 8342 tao
	<!-- Generate a light war file which only is used to manage the ldap user accounts - register a new user, reset and change the password -->
1781
	<target name="war-account" depends="warPrepare" description="Generate a light war file which only is used to manage the ldap user accounts - register a new user, reset and change the password">
1782
		  <property name="war-name" value="account" />
1783
		  <mkdir dir="${dist.dir}" />
1784
		     <war destfile="${dist.dir}/${war-name}.war"
1785
		            webxml="${build.war}/web.xml">
1786
		      <webinf dir="${war.webinf}">
1787
		        <include name="metacat.properties"/>
1788
		      </webinf>
1789
		      <fileset dir="${war.context}">
1790
		        <include name="cgi-bin/**"/>
1791
		      	<include name="style/**"/>
1792
		      </fileset>
1793
1794
		   </war>
1795
	</target>
1796
1797 113 jones
</project>