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