Project

General

Profile

metacat / build.xml @ 8026

1
<?xml version="1.0"?>
2
<!--
3
        *   '$RCSfile$'
4
        *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
        *   Copyright: 2000 Regents of the University of California and the
6
        *              National Center for Ecological Analysis and Synthesis
7
        * For Details: http://www.nceas.ucsb.edu/
8
        *
9
        *    '$Author: leinfelder $'
10
        *    '$Date: 2013-07-17 12:03:17 -0700 (Wed, 17 Jul 2013) $'
11
        *    '$Revision: 8021 $'
12
        *
13
        * Build file for the Ant cross-platform build system for metacat
14
        * See http://jakarta.apache.org for details on Ant
15
        *
16
        * usage: ant [compile|jar|install|documentation]
17
        *
18
        * This program is free software; you can redistribute it and/or modify
19
        * it under the terms of the GNU General Public License as published by
20
        * the Free Software Foundation; either version 2 of the License, or
21
        * (at your option) any later version.
22
        *
23
        * This program is distributed in the hope that it will be useful,
24
        * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
        * GNU General Public License for more details.
27
        *
28
        * You should have received a copy of the GNU General Public License
29
        * along with this program; if not, write to the Free Software
30
        * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31
-->
32
<project name="metacat" default="jar" basedir="."
33
         xmlns:artifact="antlib:org.apache.maven.artifact.ant">
34
        <property environment="env" />
35
        <property file="build.properties" /><!-- USER SPECIFIC PROPS -->
36

    
37

    
38
    <!-- Configure the maven2 ant tasks -->
39
    <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.0.jar" />
40
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
41
             uri="antlib:org.apache.maven.artifact.ant"
42
             classpathref="maven-ant-tasks.classpath" />
43
        
44
        <!-- defining the axis tasks -->
45
        <path id="axis.ant.classpath">
46
                <fileset dir="lib/lsid_lib">
47
                        <include name="*.jar" />
48
                </fileset>
49
        </path>
50
        
51
        <!-- Allow integration with Git projects -->
52
        <macrodef name = "git">
53
            <attribute name = "command" />
54
            <attribute name = "dir" default = "" />
55
            <element name = "args" optional = "true" />
56
            <sequential>
57
                <echo message = "git @{command}" />
58
                <exec executable = "git" dir = "@{dir}">
59
                    <arg value = "@{command}" />
60
                    <args/>
61
                </exec>
62
            </sequential>
63
        </macrodef>
64
        <macrodef name = "git-clone-pull">
65
            <attribute name = "repository" />
66
            <attribute name = "dest" />
67
            <sequential>
68
                <git command = "clone">
69
                    <args>
70
                        <arg value = "@{repository}" />
71
                        <arg value = "@{dest}" />
72
                    </args>
73
                </git>
74
                <git command = "pull" dir = "@{dest}" />
75
            </sequential>
76
        </macrodef>
77
            
78
        <taskdef resource="axis-tasks.properties"
79
                classpathref="axis.ant.classpath" />
80
        
81
        <!-- Determine if ecogrid should be installed-->
82
        <condition property="enable.ecogrid">
83
                <equals arg1="${install.ecogrid}" arg2="true" />
84
        </condition>
85

    
86
        <!-- Determine if perl should be built-->
87
        <condition property="build.perl">
88
                <equals arg1="${make.perl.code}" arg2="true" />
89
        </condition>
90

    
91
        <available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
92
                        property="tomcat.common.exists" />
93

    
94
        <target name="config" depends="setTomcatCommon, setTomcatNoCommon">
95
                <!-- usr for client testing, generally you don't need change-->
96
                <property name="mcuser"
97
                        value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
98
                <property name="mcpassword" value="kepler" />
99
                <property name="mcanotheruser"
100
                        value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org" />
101
                <property name="mcanotherpassword" value="yourpass" />
102
                <property name="piscouser"
103
                        value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org" />
104
                <property name="piscopassword" value="yourpass" />
105
                <property name="lteruser"
106
                        value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org" />
107
                <property name="lterpassword" value="yourpass" />
108

    
109
                <property name="debug" value="on" />
110
                <property name="morphosourcedir" value="../morpho" />
111
                <property name="utilitiesdir" value="../utilities" />
112
                <property name="installdir"
113
                        value="${app.deploy.dir}/${metacat.context}" />
114

    
115
                <echo>*********** set jsdk to ${jsdk}</echo>
116
        </target>
117
        
118
        <target name="setTomcatCommon" if="tomcat.common.exists" >
119
                <property name="jsdk"
120
                        value="${build.tomcat.dir}/common/lib/servlet-api.jar" />
121
        </target>
122
        
123
        <target name="setTomcatNoCommon" unless="tomcat.common.exists" >
124
                <property name="jsdk"
125
                        value="${build.tomcat.dir}/lib/servlet-api.jar" />
126
        </target>
127
        
128
        <target name="init" depends="config, build-metacat-common" unless="init.called">
129
                
130
            <property name="libdir.mvn" value="lib/maven" />
131
                <mkdir dir="${libdir.mvn}"/>
132
                
133
                <path id="base.classpath">
134
                        <pathelement location="${jsdk}" />
135
            <pathelement location="lib" />
136
                        
137
                        <fileset dir="lib">
138
                                <include name="*.jar" />
139
                        </fileset>
140
                        
141
                        <fileset dir="lib/lsid_lib">
142
                                <include name="*.jar" />
143
                        </fileset>
144

    
145
                        <!-- Include everything from maven -->
146
                        <fileset dir="${libdir.mvn}">
147
                                <include name="*.jar" />
148
                        </fileset>
149

    
150
                </path>
151
                
152
                <path id="test.classpath">
153
                        <pathelement location="${jsdk}" />
154
                        <pathelement location="lib" />
155
                        <fileset dir="lib">
156
                                <include name="*.jar" />
157
                                <exclude name="maven-ant-tasks-2.1.0.jar" />
158
                        </fileset>
159
                        <fileset dir="lib/lsid_lib">
160
                                <include name="*.jar" />
161
                        </fileset>
162
                        <!-- Include maven -->
163
                        <fileset dir="${libdir.mvn}">
164
                                <include name="*.jar" />
165
                        </fileset>
166
                </path>
167
                
168
                <!-- define the maven tasks -->
169
                <taskdef uri="antlib:org.apache.maven.artifact.ant"
170
                               resource="org/apache/maven/artifact/ant/antlib.xml"
171
                               classpathref="base.classpath" />
172

    
173
                   <!-- Resolve maven dependencies -->
174
                <artifact:pom id="metacatPom" file="pom.xml" />
175
                <artifact:dependencies filesetId="dependency.fileset" pomrefid="metacatPom" usescope="runtime"/>
176
                <artifact:dependencies pathId="dependency.classpath" pomrefid="metacatPom"/>
177
                                      
178
                   <!-- combine base and dependencies for the classpath -->
179
                   <path id="compile.classpath">
180
                           <path refid="base.classpath" />        
181
                           <path refid="dependency.classpath" />        
182
                </path>
183

    
184
                <!-- It is less likely you'll need to make any changes from here down,
185
                        but customization is possible -->
186
                <property name="name" value="metacat" />
187
                <property name="Name" value="MetaCat" />
188
                <property name="debugprefix" value="${Name}:" />
189
                <property name="release" value="${metacat.version}" />
190
                <tstamp>
191
                    <format property="copyrightyear" pattern="yyyy" locale="en,US"/>
192
                </tstamp>
193
                <property name="copyright" value="${copyrightyear} Regents of the University of California" />
194
                <property name="style-common-relpath" value="/style/common" />
195
                <property name="style-shared-relpath" value="/style/shared" />
196
                <property name="schema-relpath" value="/schema" />
197
                <property name="style-common-cvsrelpath"
198
                        value="lib${style-common-relpath}" />
199
                <property name="schema-cvsrelpath" value="lib${schema-relpath}" />
200
                <property name="style-skins-relpath" value="/style/skins" />
201
                <property name="util-module" value="utilities" />
202
                <!--<property name="utilities-tag" value="trunk" />-->
203
                <property name="utilities-tag" value="tags/UTILITIES_1_3_0" />
204
                <property name="seek-tag" value="tags/ECOGRID_1_2_2" />
205
                <property name="eml-module" value="eml" />
206
                <property name="eml-version" value="2.0.0beta6" />
207
                <property name="eml-beta4-version" value="2.0.0beta4" />
208
                <property name="eml-beta-tag"
209
                        value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
210
                <property name="eml-beta4-tag"
211
                                        value="RELEASE_EML_2_BETA_4" />
212
                <property name="eml2_0_0-schema-tag"
213
                        value="RELEASE_EML_2_0_0_UPDATE_1" />
214
                <property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
215
                <property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" />
216
                <property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1" />
217
                <property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_7" />
218
                <property name="eml2_0_0namespace"
219
                        value="eml://ecoinformatics.org/eml-2.0.0" />
220
                <property name="eml2_0_1namespace"
221
                        value="eml://ecoinformatics.org/eml-2.0.1" />
222
                <property name="eml2_1_0namespace"
223
                        value="eml://ecoinformatics.org/eml-2.1.0" />
224
                <property name="eml2_1_1namespace"
225
                        value="eml://ecoinformatics.org/eml-2.1.1" />
226
                <property name="stmmlnamespace"
227
                        value="http://www.xml-cml.org/schema/stmml" />
228
                <property name="stmml11namespace"
229
                        value="http://www.xml-cml.org/schema/stmml-1.1" />
230
                <property name="eml-css" value="eml_xsl.css" />
231
                <property name="eml-module.default.css" value="default.css" />
232
                <property name="systemidserver" value="" />
233
                <property name="html-path" value="" />
234
                <property name ="metacat-properties-file" value="build/war/WEB-INF/metacat.properties"/>
235

    
236

    
237
                <!-- Config for registry variables -->
238
                <!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
239
                <property name="scope" value="obfs" />
240
                <property name="responseForm" value="genericResponse.tmpl" />
241
                <property name="entryForm" value="entryForm.tmpl" />
242
                <property name="guide" value="genericGuide.tmpl" />
243
                <property name="loginForm" value="loginForm.tmpl" />
244
                <property name="confirmData" value="confirmData.tmpl" />
245
                <property name="deleteData" value="deleteData.tmpl" />
246
                <property name="genericHeader" value="genericHeader.tmpl" />
247
                <property name="genericFooter" value="genericFooter.tmpl" />
248

    
249
                <filter token="scope" value="${scope}" />
250
                <filter token="responseForm" value="${responseForm}" />
251
                <filter token="entryForm" value="${entryForm}" />
252
                <filter token="guide" value="${guide}" />
253
                <filter token="loginForm" value="${loginForm}" />
254
                <filter token="confirmData" value="${confirmData}" />
255
                <filter token="deleteData" value="${deleteData}" />
256
                <filter token="genericHeader" value="${genericHeader}" />
257
                <filter token="genericFooter" value="${genericFooter}" />
258
                <filter token="adminname" value="${adminname}" />
259
                <filter token="recipient" value="${recipient}" />
260
                <filter token="metacatVersion" value="${metacat.version}" />
261
                <filter token="metacatRC" value="${metacat.releaseCandidate}" />
262
                <filter token="build.context" value="${metacat.context}" />
263

    
264
                <filter token="docrooturl" value="./" />
265
                <filter token="mcuser" value="${mcuser}" />
266
                <filter token="mcpassword" value="${mcpassword}" />
267
                <filter token="mcanotheruser" value="${mcanotheruser}" />
268
                <filter token="mcanotherpassword" value="${mcanotherpassword}" />
269
                <filter token="eml-css" value="${eml-css}" />
270
                <filter token="style-skins-relpath"
271
                        value="${style-skins-relpath}" />
272
                <filter token="style-common-relpath"
273
                        value="${style-common-relpath}" />
274

    
275
                <filter token="eml-version" value="${eml-version}" />
276
                <filter token="eml-beta4-version" value="${eml-beta4-version}" />
277
                <filter token="eml2_0_0namespace" value="${eml2_0_0namespace}" />
278
                <filter token="eml2_0_1namespace" value="${eml2_0_1namespace}" />
279
                <filter token="eml2_1_0namespace" value="${eml2_1_0namespace}" />
280
                <filter token="eml2_1_1namespace" value="${eml2_1_1namespace}" />
281
                <filter token="stmmlnamespace" value="${stmmlnamespace}" />
282
                <filter token="stmml11namespace" value="${stmml11namespace}" />
283
                <filter token="debugprefix" value="${debugprefix}" />
284

    
285
                <filter token="defaultStage" value="${defaultStage}" />
286
                <filter token="defaultHeader" value="${defaultHeader}" />
287
                <filter token="defaultFooter" value="${defaultFooter}" />
288
                <filter token="defaultChangePass" value="${defaultChangePass}" />
289
                <filter token="defaultResetPass" value="${defaultResetPass}" />
290
                <filter token="changePassSuccess" value="${changePassSuccess}" />
291
                <filter token="resetPassSuccess" value="${resetPassSuccess}" />
292
                <filter token="registerFailed" value="${registerFailed}" />
293
                <filter token="registerLter" value="${registerLter}" />
294
                <filter token="registerMatch" value="${registerMatch}" />
295
                <filter token="registerSuccess" value="${registerSuccess}" />
296
                <filter token="register" value="${register}" />
297
                <filter token="searchResults" value="${searchResults}" />
298
                <filter token="ldapMainServerFailure"
299
                        value="${ldapMainServerFailure}" />
300
                <filter token="lter-user" value="${lteruser}" />
301
                <filter token="lter-pass" value="${lterpassword}" />
302
                <filter token="pisco-user" value="${piscouser}" />
303
                <filter token="pisco-pass" value="${piscopassword}" />
304

    
305

    
306
                <!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
307
                <!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
308
                <!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
309

    
310
                <property name="srcdir" value="./src" />
311
                <property name="lib.dir" value="./lib" />
312
                <property name="docdir" value="./docs" />
313
                <property name="cgidir" value="./cgi-bin" />
314
                <property name="testdir" value="./test" />
315
                <property name="testtorun" value="MNodeServiceTest" />
316
                <property name="junittestsdir"
317
                        value="./test/edu/ucsb/nceas/metacattest" />
318
                <property name="junitnettestsdir"
319
                        value="./test/edu/ucsb/nceas/metacatnettest" />
320
                <property name="classtorun" value="edu.ucsb.nceas.metacat.admin.upgrade.dataone.GenerateSystemMetadata" />
321
                <property name="build.dir" value="./build" />
322
                <property name="build.src" value="${build.dir}/src" />
323
                <property name="build.dest" value="${build.dir}/classes" />
324
                <property name="build.samples" value="${build.dir}/samples" />
325
                <property name="build.tests" value="${build.dir}/tests" />
326
                <property name="build.tmp" value="${build.dir}/tmp" />
327
                <property name="build.metacattest"
328
                        value="${build.tests}/metacattest" />
329
                <property name="build.metacatnettest"
330
                        value="${build.tests}/metacatnettest" />
331
                <property name="build.data" value="${build.dir}/data" />
332
                <property name="build.docs" value="${build.dir}/docs" />
333
                <property name="build.javadocs" value="${build.docs}/api" />
334
                <property name="build.war" value="${build.dir}/war" />
335
                <property name="dist.dir" value="dist" />
336
                <property name="ver.dir" value="${dist.dir}/${name}-${release}" />
337
                <property name="ver.src" value="${ver.dir}/src" />
338
                <property name="util.dir" value="${dist.dir}/${util-module}" />
339
                <property name="test.dir" value="${dist.dir}/test" />
340
                <!-- directories for creating a Harvest List Editor distribution -->
341
                <property name="dist.dir.hle" value="disthle" />
342
                <property name="ver.dir.hle"
343
                        value="${dist.dir.hle}/harvest-list-editor-${release}" />
344
                <property name="pkg.dir" value="./package" />
345
                <property name="deb.pkg.dir" value="${pkg.dir}/debian" />
346

    
347
                <property name="ecogrid-target-name" value="metacatImpl" />
348
                <property name="ecogrid-module-dest-dir" value=".." />
349
                <property name="ecogrid-module" value="seek/projects/ecogrid" />
350
                <property name="ecogrid-dist-dir"
351
                        value="${dist.dir}/${ecogrid-module}" />
352
                <property name="ecogrid-dir"
353
                        value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
354

    
355
                <property name="package.home" value="edu/ucsb/nceas/metacat" />
356

    
357
                <!-- set up svn -->
358
                <property name="svnant.lib" value="lib" />
359
                <property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
360
                <property name="svnClientAdapter.jar"
361
                        value="${svnant.lib}/svnClientAdapter.jar" />
362
                <property name="svnjavahl.jar"
363
                        value="${svnant.lib}/svnjavahl.jar" />
364
                <property name="svn.utilitiesUrl"
365
                        value="https://code.ecoinformatics.org/code/utilities/${utilities-tag}" />
366
                <property name="svn.ecogridUrl"
367
                        value="https://code.ecoinformatics.org/code/seek/${seek-tag}/projects/ecogrid/" />
368
                <property name="svn.emlBetaUrl"
369
                        value="https://code.ecoinformatics.org/code/eml/branches/${eml-beta-tag}" />
370
                <property name="svn.emlBeta4Url"
371
                                        value="https://code.ecoinformatics.org/code/eml/tags/${eml-beta4-tag}" />
372
                <property name="svn.eml200SchemaUrl"
373
                        value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_0-schema-tag}" />
374
                <property name="svn.eml201SchemaUrl"
375
                        value="https://code.ecoinformatics.org/code/eml/tags/${eml2_0_1-schema-tag}" />
376
                <property name="svn.eml210SchemaUrl"
377
                        value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_0-schema-tag}" />
378
                <property name="svn.eml211SchemaUrl"
379
                        value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_1-schema-tag}" />
380
                <property name="svn.eml2StyleUrl"
381
                        value="https://code.ecoinformatics.org/code/eml/tags/${eml2-style-tag}" />
382
                
383
                <!-- the git repo -->
384
                <property name="metacatui.git.repository.url"
385
                                        value="https://github.com/NCEAS/metacatui.git" />
386
                <property name="metacatui.build.dir"
387
                                        value="${build.dir}/metacatui" />
388
                <property name="metacatui.resources.dir"
389
                                        value="${metacatui.build.dir}/metacatui/src/main/webapp" />
390
                
391
                <!-- load the svn task -->
392
                <path id="svn.classpath">
393
                        <pathelement location="${svnjavahl.jar}" />
394
                        <pathelement location="${svnant.jar}" />
395
                        <pathelement location="${svnClientAdapter.jar}" />
396
                </path>
397
                <taskdef resource="svntask.properties"
398
                        classpathref="svn.classpath" />
399

    
400
                <condition property="utilities.required">
401
                        <not>
402
                                <available file="lib/utilities.jar" />
403
                        </not>                                
404
                </condition>
405
                <!-- peer.utilities.required is used when there is no utilities 
406
                        directory at ${utilitiesdir} -->
407
                <condition property="peer.utilities.required">
408
                        <or>
409
                                <not>
410
                                        <available file="${utilitiesdir}" type="dir" />
411
                                </not>
412
                        </or>
413
                </condition>
414
                <condition property="eml.required">
415
                        <or>
416
                                <not>
417
                                        <available file="lib/schema/eml-2.0.1/eml.xsd" />
418
                                </not>
419
                                <not>
420
                                        <available file="lib/schema/eml-2.0.0/eml.xsd" />
421
                                </not>
422
                                <not>
423
                                        <available file="lib/schema/eml-2.1.0/eml.xsd" />
424
                                </not>
425
                                <not>
426
                                        <available
427
                                                file="lib/dtd/eml-dataset-2.0.0beta6.dtd" />
428
                                </not>
429
                        </or>
430
                </condition>
431

    
432
                <condition property="ecogrid.required">
433
                        <or>
434
                                <not>
435
                                        <available file="${ecogrid-dir}/build.properties" />
436
                                </not>
437
                                <not>
438
                                        <available
439
                                                file="${ecogrid-dir}/buildfiles/metacatImpl.xml" />
440
                                </not>
441
                        </or>
442
                </condition>
443
                
444
                <property name="init.called" value="true" />
445

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

    
460
        <target name="prepare" depends="init, resolveDependencies">
461
                <mkdir dir="${build.dir}" />
462
                <mkdir dir="${build.src}" />
463
                <mkdir dir="${build.dest}" />
464
                <mkdir dir="${build.docs}" />
465
                <mkdir dir="${build.javadocs}" />
466
                <mkdir dir="${build.tmp}" />
467

    
468
                <copy todir="${build.src}" filtering="yes">
469
                        <fileset dir="${srcdir}">
470
                                <include name="edu/**" />
471
                                <include name="com/**" />
472
                                <include name="org/**" />
473
                                <!-- include name="java/**" / -->
474
                                <include name="**/*.sql" />
475
                                <exclude name="**/CVS*" />
476
                                <exclude name="**/.#*" />
477
                                <exclude name="edu/ucsb/nceas/workflowscheduler/**" />
478
                        </fileset>
479
                </copy>
480
                <available file="lib/style/common/emlb6toeml2" type="dir"
481
                        property="styles.not.needed" />
482
        </target>
483

    
484
        <target name="generateStubs" depends="prepare">
485
                <echo
486
                        message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
487
                <axis-wsdl2java verbose="true" output="${srcdir}"
488
                        url="/tmp/KeplerWebService.wsdl" />
489
        </target>
490

    
491
        <target name="compile" depends="prepare, utilities"
492
                description="Compiles java code to build dir, and copies metacat props files there">
493

    
494
                <javac srcdir="${build.src}" destdir="${build.dest}"
495
                        debug="${debug}"
496
                        excludes="**/*.sql **/client/*.java **/harvesterClient/*.java">
497
                        <classpath>
498
                                <path refid="compile.classpath" />
499
                        </classpath>
500
                </javac>
501
        </target>
502

    
503
        <target name="jar" depends="compile,geteml"
504
                description="Compiles and jars metacat java code to metacat.jar in build dir ">
505

    
506
                <delete file="${build.dir}/${name}.jar" />
507
                <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
508
                        excludes="**/protocols/ **/harvesterClient/" />
509
        </target>
510

    
511
        <target name="protocol" depends="compile"
512
                description="Compiles and jars protocol java code to protocol.jar in build dir">
513
                <delete file="${build.dir}/protocol.jar" />
514
                <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
515
                        includes="**/protocols/" />
516
        </target>
517

    
518
        <target name="utilities" depends="config,getpeerutilities"
519
                if="utilities.required">
520
                <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
521
                <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
522
                <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
523
        </target>
524

    
525
        <target name="getpeerutilities" depends="prepare"
526
                if="peer.utilities.required"
527
                description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
528
                <echo message="Exporting utilities files from svn repository:" />
529
                <svn>
530
                        <export srcUrl="${svn.utilitiesUrl}"
531
                                destPath="${utilitiesdir}" />
532
                </svn>
533

    
534
                <!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
535
        </target>
536
        
537
        <!-- get metacatUI project -->
538
        <target name="getMetacatUI" depends="init">
539
                <git-clone-pull repository="${metacatui.git.repository.url}" dest="${metacatui.build.dir}" />
540
        </target>
541
        
542
        <target name="copyMetacatUI" depends="getMetacatUI">
543
                <copy todir="${lib.dir}${style-skins-relpath}/metacatui">
544
                        <fileset dir="${metacatui.resources.dir}" includes="**/*">
545
                        </fileset>
546
                </copy>
547
        </target>
548

    
549
        <target name="getutilities" depends="prepare"
550
                description="Checks utility out of svn and copies it to your metacat sandbox">
551
                <svn>
552
                        <export srcUrl="${svn.utilitiesUrl}"
553
                                destPath="${utilitiesdir}" force="true" />
554
                </svn>
555
        </target>
556

    
557
        <target name="client" depends="utilities, prepare"
558
                description="Compiles metacat-client java code to build dir">
559
                <javac srcdir="${build.src}" destdir="${build.dest}"
560
                        includes="edu/ucsb/nceas/metacat/client/*">
561
                        <classpath>
562
                                <path refid="compile.classpath" />
563
                        </classpath>
564
                </javac>
565
        </target>
566

    
567
        <target name="clientjar" depends="client"
568
                description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
569
                <delete file="${build.dir}/${name}-client.jar" />
570
                <jar jarfile="${build.dir}/${name}-client.jar"
571
                        basedir="${build.dest}" includes="**/metacat/client/" />
572
        </target>
573

    
574
        <target name="advancedsearchjar" depends="compile"
575
                description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
576
                <delete file="${build.dir}/advancedsearch.jar" />
577
                <jar jarfile="${build.dir}/advancedsearch.jar"
578
                        basedir="${build.dest}" includes="**/metacat/advancedsearch/" />
579
        </target>
580

    
581
        <target name="harvester" depends="client"
582
                description="Compiles harvester java code to build dir">
583
                <javac srcdir="${build.src}" destdir="${build.dest}"
584
                        includes="edu/ucsb/nceas/metacat/harvesterClient/*">
585
                        <classpath>
586
                                <path refid="compile.classpath" />
587
                        </classpath>
588
                </javac>
589
        </target>
590
                
591
        <target name="harvesterjar" depends="harvester"
592
                description="Compiles and jars harvester java code to harvester.jar in build dir">
593
                <delete file="${build.dir}/harvester.jar" />
594
                <jar jarfile="${build.dir}/harvester.jar"
595
                        basedir="${build.dest}" includes="**/metacat/harvesterClient/" />
596
        </target>
597

    
598
        <target name="harvestListEditorDist" depends="harvesterjar"
599
                description="Prepares a distribution of the Harvest List Editor tool">
600
                <mkdir dir="${dist.dir.hle}" />
601
                <delete dir="${ver.dir.hle}" />
602
                <mkdir dir="${ver.dir.hle}" />
603
                <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar" />
604
                <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar" />
605
                <copy todir="${ver.dir.hle}"
606
                        file="lib/harvester/harvestList.xsd" />
607
                <copy todir="${ver.dir.hle}"
608
                        file="lib/harvester/harvestListEditor.bat" />
609
                <copy todir="${ver.dir.hle}"
610
                        file="lib/harvester/harvestListEditor.sh" />
611
                <delete file="./harvest-list-editor-${release}.zip" />
612
                <zip zipfile="./harvest-list-editor-${release}.zip"
613
                        basedir="${ver.dir.hle}" />
614
                <delete file="./harvest-list-editor-${release}.tar.gz" />
615
                <tar tarfile="./harvest-list-editor-${release}.tar"
616
                        basedir="${ver.dir.hle}" />
617
                <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
618
                        src="./harvest-list-editor-${release}.tar" />
619
                <delete file="./harvest-list-editor-${release}.tar" />
620
        </target>
621

    
622
        <target name="geteml" depends="getemlpre2,getemlpre2beta4,geteml2+,getConversionXSL"
623
                if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
624

    
625
        <target name="getemlpre2" depends="prepare" if="eml.required"
626
                description="Checks EML-beta6 out of svn and copies dtds and xsl to your metacat sandbox">
627
                <svn>
628
                        <export srcUrl="${svn.emlBetaUrl}"
629
                                destPath="${build.tmp}/eml_${eml-beta-tag}" />
630
                </svn>
631
                <mkdir dir="lib/dtd" />
632
                <copy todir="lib/dtd" filtering="yes">
633
                        <fileset
634
                                dir="${build.tmp}/eml_${eml-beta-tag}">
635
                                <include name="*.dtd" />
636
                        </fileset>
637
                        <mapper type="glob" from="eml-*.dtd"
638
                                to="eml-*-${eml-version}.dtd" />
639
                </copy>
640

    
641
                <copy todir="${style-common-cvsrelpath}" filtering="yes">
642
                        <fileset
643
                                dir="${build.tmp}/eml_${eml-beta-tag}/style">
644
                                <include name="**/*.xsl" />
645
                        </fileset>
646
                </copy>
647
        </target>
648
        
649
        <target name="getemlpre2beta4" depends="prepare" if="eml.required"
650
                        description="Checks EML-beta4 out of svn and copies dtds to your metacat sandbox">
651
                        <svn>
652
                                <export srcUrl="${svn.emlBeta4Url}"
653
                                        destPath="${build.tmp}/eml_${eml-beta4-tag}" />
654
                        </svn>
655
                        <mkdir dir="lib/dtd" />
656
                        <copy todir="lib/dtd" filtering="yes">
657
                                <fileset
658
                                        dir="${build.tmp}/eml_${eml-beta4-tag}">
659
                                        <include name="*.dtd" />
660
                                </fileset>
661
                                <mapper type="glob" from="eml-*.dtd"
662
                                        to="eml-*-${eml-beta4-version}.dtd" />
663
                        </copy>
664

    
665
                        <!--
666
                        <copy todir="${style-common-cvsrelpath}" filtering="yes">
667
                                <fileset
668
                                        dir="${build.tmp}/eml_${eml-beta4-tag}/style">
669
                                        <include name="**/*.xsl" />
670
                                </fileset>
671
                        </copy>
672
                        -->
673
                </target>
674

    
675
        <target name="geteml2+" depends="prepare" if="eml.required"
676
                description="Checks eml-2 out of svn and copies schema and xsl to your metacat sandbox">
677
                <svn>
678
                        <export srcUrl="${svn.eml200SchemaUrl}"
679
                                destPath="${build.tmp}/eml_${eml2_0_0-schema-tag}" />
680
                </svn>
681
                <mkdir dir="lib/schema/eml-2.0.0" />
682
                <copy todir="lib/schema/eml-2.0.0" filtering="yes">
683
                        <fileset
684
                                dir="${build.tmp}/eml_${eml2_0_0-schema-tag}">
685
                                <include name="*.xsd" />
686
                        </fileset>
687

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

    
694
                </copy>
695
                <!-- <antcall target="copyxsl">
696
                        <param name="cvs.tagname" value="${eml2_0_0-schema-tag}" />
697
                        <param name="dirname" value="eml-2.0.0" />
698
                        </antcall> -->
699

    
700
                <!-- Checkout eml201 for given schema tag-->
701
                <svn>
702
                        <export srcUrl="${svn.eml201SchemaUrl}"
703
                                destPath="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
704
                </svn>
705
                <mkdir dir="lib/schema/eml-2.0.1" />
706
                <copy todir="lib/schema/eml-2.0.1" filtering="yes">
707
                        <fileset
708
                                dir="${build.tmp}/eml_${eml2_0_1-schema-tag}">
709
                                <include name="*.xsd" />
710
                        </fileset>
711
                </copy>
712

    
713
                <!-- Checkout eml201 again for given style sheet tag-->
714
                <!-- echo>Enter CVS password: </echo>
715
                        <cvs cvsRoot="${cvsroot}"
716
                        package="${eml-module}"
717
                        tag="${eml2_0_1-style-tag}"
718
                        dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
719
                        <antcall target="copyxsl">
720
                        <param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
721
                        <param name="dirname" value="eml-2.0.1" />
722
                        </antcall -->
723

    
724
                <!-- Checkout eml210 for given schema tag-->
725
                <svn>
726
                        <export srcUrl="${svn.eml210SchemaUrl}"
727
                                destPath="${build.tmp}/eml_${eml2_1_0-schema-tag}" />
728
                </svn>
729
                <mkdir dir="lib/schema/eml-2.1.0" />
730
                <copy todir="lib/schema/eml-2.1.0" filtering="yes">
731
                        <fileset
732
                                dir="${build.tmp}/eml_${eml2_1_0-schema-tag}">
733
                                <include name="*.xsd" />
734
                        </fileset>
735
                </copy>
736

    
737
                <!-- Checkout eml210 for given style sheet tag-->
738
                <svn>
739
                        <export srcUrl="${svn.eml2StyleUrl}"
740
                                destPath="${build.tmp}/eml_${eml2-style-tag}" />
741
                </svn>
742
                <antcall target="copyxsl">
743
                        <param name="cvs.tagname" value="${eml2-style-tag}" />
744
                        <!-- param name="dirname" value="eml-2.1.0" / -->
745
                        <param name="dirname" value="eml-2" />
746
                </antcall>
747
                
748
                <!-- Checkout eml210 for given schema tag-->
749
                <svn>
750
                        <export srcUrl="${svn.eml211SchemaUrl}"
751
                                destPath="${build.tmp}/eml_${eml2_1_1-schema-tag}" />
752
                </svn>
753
                <mkdir dir="lib/schema/eml-2.1.1" />
754
                <copy todir="lib/schema/eml-2.1.1" filtering="yes">
755
                        <fileset
756
                                dir="${build.tmp}/eml_${eml2_1_1-schema-tag}">
757
                                <include name="*.xsd" />
758
                        </fileset>
759
                </copy>
760
        </target>
761

    
762
        <target name="copyxsl"
763
                description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
764

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

    
767
                <copy todir="${style-common-cvsrelpath}/${dirname}"
768
                        filtering="yes">
769
                        <fileset
770
                                dir="${build.tmp}/eml_${cvs.tagname}/style/eml">
771
                                <include name="**/*.xsl" />
772
                        </fileset>
773
                </copy>
774

    
775

    
776
                <!-- now copy default css from eml module and put it in style-common-path
777
                        dir with a new name, so other skin-specific css can import it if reqd -->
778
                <copy
779
                        file="${build.tmp}/eml_${cvs.tagname}/${eml-module.default.css}"
780
                        tofile="${style-common-cvsrelpath}/${eml-css}" />
781

    
782
        </target>
783

    
784
        <target name="correctEML201Docs" depends="jar"
785
                description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
786
                <copy todir="${build.dir}" file="lib/metacat.properties"
787
                        filtering="yes" />
788
                <java
789
                        classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector">
790
                        <classpath>
791
                                <path refid="compile.classpath" />
792
                                <fileset dir="${build.dir}">
793
                                        <include name="${name}.jar" />
794
                                </fileset>
795
                        </classpath>
796
                </java>
797
        </target>
798

    
799
        <target name="install-spatial" depends="jar,clientjar,harvesterjar"
800
                description="Installs spatial option for metacat">
801
                
802
                <copy todir="${dist.dir}">
803
                        <fileset dir="./lib/spatial/geoserver" includes="*.war" />
804
                </copy>
805

    
806
        </target>
807

    
808
        <target name="install" depends="build-metacat"
809
                description="* Full Install For Development *">
810
                <copy file="${dist.dir}/${metacat.context}.war"
811
                        todir="${app.deploy.dir}" />
812
               <!-- <copy file="${dist.dir}/${metacat.context}.war"
813
                        todir="${app.deploy.dir2}" />-->
814
                <delete dir="${app.deploy.dir}/${metacat.context}" />
815
                <!--<delete dir="${app.deploy.dir2}/${metacat.context}" />-->
816
                <copy file="${dist.dir}/geoserver.war"
817
                                        todir="${app.deploy.dir}" />
818
                <copy file="${dist.dir}/metacat-index.war"
819
                                        todir="${app.deploy.dir}" />
820
                <tstamp>
821
                        <format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
822
                </tstamp>
823
                <echo>Dev install completed at ${NOW}</echo>
824
        </target>
825

    
826
        <target name="build-metacat" depends="install-ecogrid, install-spatial, install-metacat-index"
827
                description="Build Metacat">
828
        </target>
829

    
830
        <target name="install-ecogrid" depends="warPrepare, get-ecogrid"
831
                if="enable.ecogrid" description="Install Ecogrid Compentent">
832
                <ant antfile="build.xml" dir="${ecogrid-dir}" target="clean"
833
                        inheritall="false">
834
                        <property name="context" value="${metacat.context}" />
835
                        <property name="target" value="${ecogrid-target-name}" />
836
                </ant>
837
                <ant antfile="build.xml" dir="${ecogrid-dir}" target="war"
838
                        inheritall="false">
839
                        <property name="context" value="${metacat.context}" />
840
                        <property name="target" value="${ecogrid-target-name}" />
841
                        <property name="metacat.dir" value="${basedir}"/>
842
                </ant>
843
                <!-- war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
844
                        <webinf dir="${ecogrid-dir}/lib">
845
                        <include name="server-config.wsdd"/>
846
                        </webinf>
847
                        </war -->
848
                <copy file="${ecogrid-dir}/build/${metacat.context}.war"
849
                        todir="${dist.dir}" overwrite="true" />
850

    
851

    
852
        </target>
853

    
854
        <target name="get-ecogrid" depends="init"
855
                description="Check out ecogrid module" if="ecogrid.required">
856
                <svn>
857
                        <export srcUrl="${svn.ecogridUrl}" force="true"
858
                                destPath="${ecogrid-dir}" />
859
                </svn>
860
        </target>
861

    
862
        <!-- target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
863
                <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
864
                <property name="context" value="${metacat.context}"/>
865
                <property name="target" value="${ecogrid-target-name}"/>
866
                <property name="metacat.dir" value="."/>
867
                <property name="hostname" value="${ecogrid.hostname}"/>
868
                <property name="port" value="${config.port}"/>
869
                </ant>
870
                </target -->
871

    
872
        <target name="clean-ecogrid-server-config-wsdd" depends="init"
873
                description="Automately generate wsdd for ecogrid service">
874
                <delete
875
                        file="${app.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd" />
876
        </target>
877

    
878
        <target name="install-skin" depends="init"
879
                description="Install a Skin">
880

    
881
                <input message="Please enter name of the skin"
882
                        addproperty="skin-name" />
883

    
884
                <mkdir dir="${installdir}/style/skins/${skin-name}" />
885
                <copy todir="${installdir}/style/skins/${skin-name}"
886
                        filtering="yes">
887
                        <fileset dir="lib/style/skins/${skin-name}">
888
                                <exclude name="**/*.png" />
889
                                <exclude name="**/*.gif" />
890
                                <exclude name="**/*.jpg" />
891
                                <exclude name="**/CVS*" />
892
                                <exclude name="**/.#*" />
893
                        </fileset>
894
                </copy>
895
                <copy todir="${installdir}/style/skins/${skin-name}"
896
                        filtering="no">
897
                        <fileset dir="lib/style/skins/${skin-name}">
898
                                <include name="**/*.png" />
899
                                <include name="**/*.gif" />
900
                                <include name="**/*.jpg" />
901
                                <exclude name="**/CVS*" />
902
                                <exclude name="**/.#*" />
903
                        </fileset>
904
                </copy>
905
                <copy todir="${installdir}/style/common" filtering="yes">
906
                        <fileset dir="lib/style/common">
907
                                <include name="*.js" />
908
                                <include name="*.jsp" />
909
                                <include name="*.css" />
910
                                <exclude name="*.png" />
911
                                <exclude name="*.gif" />
912
                                <exclude name="*.jpg" />
913
                                <exclude name="**/CVS*" />
914
                                <exclude name="**/.#*" />
915
                        </fileset>
916
                </copy>
917
                <!--
918
                        <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
919
                        <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
920
                        <fileset dir="lib/style/skins/${skin-name}/images">
921
                        <include name="*.png"/>
922
                        <include name="*.gif"/>
923
                        <include name="*.jpg"/>
924
                        </fileset>
925
                        </copy>
926
                -->
927

    
928
                <echo message="Install Skin completed." />
929
        </target>
930

    
931
        <target name="war" depends="warPrepare,install-spatial, dist-metacat-index"
932
                description="Create a web archive (WAR) for servlet deployment">
933
                <mkdir dir="${dist.dir}" />
934
                <war destfile="${dist.dir}/${metacat.context}.war"
935
                        webxml="${build.war}/web.xml">
936
                        <fileset dir="${war.context}" />
937
                        <lib dir="${war.lib}" />
938
                        <webinf dir="${war.webinf}" />
939
                </war>
940
        </target>
941

    
942
        <target name="warPrepare"
943
                depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare,documentation,copyMetacatUI"
944
                description="Prepare files for creating a web archive (WAR)">
945

    
946
                <property name="war.lib" value="${build.war}/lib" />
947
                <property name="war.webinf" value="${build.war}/WEB-INF" />
948
                <property name="war.context"
949
                        value="${build.war}/${metacat.context}" />
950
                <property name="war.webinf.sql" value="${war.webinf}/sql" />
951
                <property name="war.webinf.scripts"
952
                        value="${war.webinf}/scripts" />
953
                <property name="war.context.cgi" value="${war.context}/cgi-bin" />
954
                <property name="war.context.docs" value="${war.context}/docs" />
955
                <property name="war.context.temp" value="${war.context}/temp" />
956
                <property name="war.context.templates"
957
                        value="${war.context}${style-common-relpath}/templates" />
958
                <mkdir dir="${war.lib}" />
959
                <mkdir dir="${war.webinf}" />
960
                <mkdir dir="${war.context}" />
961
                <mkdir dir="${war.webinf.sql}" />
962
                <mkdir dir="${war.context.cgi}" />
963
                <mkdir dir="${war.context.docs}" />
964
                <mkdir dir="${war.context.temp}" />
965
                <mkdir dir="${war.context.templates}" />
966

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

    
1052
                <copy file="src/perl/register-dataset.cgi"
1053
                        todir="${war.context.cgi}" />
1054
                <copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1055
                <copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1056

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

    
1070
                <!-- ldap cgi section -->
1071
                <copy todir="${war.context.templates}">
1072
                        <fileset dir="lib/style/common/templates">
1073
                                <!-- SCW: Copy all files -->
1074
                        </fileset>
1075
                </copy>
1076
        </target>
1077

    
1078
        <target name="cgiPrepare" if="build.perl">
1079
                <exec dir="src/perl/Metacat/" executable="make">
1080
                        <arg value="clean" />
1081
                </exec>
1082
                <exec dir="src/perl/Metacat/" executable="perl">
1083
                        <arg value="Makefile.PL" />
1084
                </exec>
1085
                <exec dir="src/perl/Metacat/" executable="make" />
1086
        </target>
1087

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

    
1101
        <target name="getConversionXSL" depends="prepare"
1102
                unless="styles.not.needed"
1103
                description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1104

    
1105
                <svn>
1106
                        <export srcUrl="${svn.eml2StyleUrl}"
1107
                                destPath="${build.tmp}/conv_eml_${eml2-style-tag}" />
1108
                </svn>
1109

    
1110
                <mkdir dir="lib/style/common/emlb6toeml2" />
1111
                <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
1112
                        <fileset
1113
                                dir="${build.tmp}/conv_eml_${eml2-style-tag}/lib/beta6toeml2/xsl">
1114
                                <include name="*.xsl" />
1115
                                <include name="*.xml" />
1116
                        </fileset>
1117
                </copy>
1118
        </target>
1119

    
1120
        <target name="testprep" depends="jar,clientjar,harvesterjar">
1121
                <mkdir dir="${build.tests}" />
1122
                <copy todir="${build.tests}" encoding="UTF-8">
1123
                        <fileset dir="${testdir}">
1124
                                <include name="edu/**" />
1125
                        </fileset>
1126
                </copy>
1127
                <copy todir="${build.tests}" file="${testdir}/test.properties" />
1128

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

    
1152
                <jar jarfile="${build.dir}/${name}-junittests.jar"
1153
                        basedir="${build.tests}" >
1154
                        <include name="**/*.class"/>
1155
                        <include name="**/*.xml"/>
1156
                </jar>        
1157
                
1158
        </target>
1159

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

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

    
1194
                        <formatter type="plain" />
1195

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

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

    
1216
                <echo>testtorun: ${testtorun}</echo>
1217

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

    
1232
                        <formatter type="plain" />
1233

    
1234
                        <batchtest fork="yes" todir="${build.dir}">
1235
                                <fileset dir="${build.tests}">
1236
                                        <include name="**/${testtorun}.class" />
1237
                                </fileset>
1238
                        </batchtest>
1239
                </junit>
1240
        </target>
1241
        
1242
        <target name="run" depends="testprep"
1243
                        description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
1244

    
1245
                        <echo>testtorun: ${testtorun}</echo>
1246

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

    
1261
                                <formatter type="plain" />
1262

    
1263
                                <batchtest fork="yes" todir="${build.dir}">
1264
                                        <fileset dir="${build.tests}">
1265
                                                <include name="**/${testtorun}.class" />
1266
                                        </fileset>
1267
                                </batchtest>
1268
                        </junit>
1269
                </target>
1270

    
1271
        <target name="testharvester" depends="testprep"
1272
                description="Uses the ant junit task to test only the Harvester code">
1273
                <junit printsummary="yes" haltonfailure="off" fork="yes"
1274
                        haltonerror="off">
1275
                        <classpath>
1276
                                <path refid="compile.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
                        <formatter type="plain" />
1285
                        <batchtest fork="yes" todir="${build.dir}">
1286
                                <fileset dir="${build.tests}">
1287
                                        <include name="**/harvesterClient/*.class" />
1288
                                </fileset>
1289
                        </batchtest>
1290
                </junit>
1291
        </target>
1292

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

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

    
1313
                <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1314
                        basedir="${build.metacatnettest}" includes="**/*.class" />
1315

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

    
1328
                        <formatter type="plain" />
1329

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

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

    
1343

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

    
1350
        <target name="localclean" depends="clean"
1351
                description="deletes even jars that depend on external sources such as stylesheets and jars">
1352
                <delete file="lib/utilities.jar" />
1353
        </target>
1354

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

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

    
1413
        <target name="dist"
1414
                depends="geteml,get-ecogrid,jar,protocol,documentation,getConversionXSL,getutilities"
1415
                description="prepares a full release distribution">
1416
                <mkdir dir="${dist.dir}" />
1417
                <delete dir="${ver.dir}" />
1418
                <mkdir dir="${ver.dir}" />
1419
                <copy todir="${ver.dir}">
1420
                        <fileset dir="."
1421
                                excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
1422
                </copy>
1423
                <copy todir="${ver.dir}" file="build.xml" />
1424
                <copy todir="${ver.dir}" file="build.properties" />
1425

    
1426
                <copy todir="${ver.dir}/docs" filtering="yes">
1427
                        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1428
                </copy>
1429
                <copy todir="${ver.dir}/docs" filtering="no">
1430
                        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1431
                </copy>
1432
                <copy todir="${ver.dir}/docs/dev">
1433
                        <fileset dir="${build.dir}/docs" />
1434
                </copy>
1435
                <copy todir="${ver.dir}/src">
1436
                        <fileset dir="${build.dir}/src" />
1437
                </copy>
1438

    
1439
                <mkdir dir="${ver.dir}/tests/servertestfiles" />
1440
                <copy todir="${ver.dir}/test/servertestfiles">
1441
                        <fileset dir="./test/servertestfiles" />
1442
                </copy>
1443
        </target>
1444

    
1445
        <target name="fulldist" depends="distbin, distsrc"
1446
                        description="full distribution - source and bin"/>
1447
                
1448
        <target name="distbin" depends="build-metacat,war-lsid"
1449
                description="prepares a binary distribution">
1450
                <copy todir="${dist.dir}">
1451
                        <fileset dir="./src/scripts" />
1452
                </copy>
1453
                <delete file="./${name}-bin-${release}.zip" />
1454
                <zip zipfile="./${name}-bin-${release}.zip"
1455
                        basedir="${dist.dir}" excludes="metacat-*/**" />
1456
                <delete file="./${name}-bin-${release}.tar.gz" />
1457
                <tar tarfile="./${name}-bin-${release}.tar"
1458
                        basedir="${dist.dir}" excludes="metacat-*/**" />
1459
                <gzip zipfile="./${name}-bin-${release}.tar.gz"
1460
                        src="./${name}-bin-${release}.tar" />
1461
                <delete file="./${name}-bin-${release}.tar" />
1462
        </target>
1463

    
1464
        <target name="distsrc" depends="dist"
1465
                description="prepares a source distribution">
1466
                <mkdir dir="${ver.src}" />
1467
                <copy todir="${ver.src}">
1468
                        <fileset dir="./src" />
1469
                </copy>
1470
                <mkdir dir="${util.dir}" />
1471
                <copy todir="${util.dir}">
1472
                        <fileset dir="${utilitiesdir}" excludes="**/CVS*" />
1473
                </copy>
1474

    
1475
                <mkdir dir="${ecogrid-dist-dir}" />
1476
                <copy todir="${ecogrid-dist-dir}">
1477
                        <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1478
                </copy>
1479

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

    
1482
                <delete file="./${name}-src-${release}.zip" />
1483
                <zip zipfile="./${name}-src-${release}.zip"
1484
                        basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1485
                <delete file="./${name}-src-${release}.tar.gz" />
1486
                <tar tarfile="./${name}-src-${release}.tar"
1487
                        basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1488
                <gzip zipfile="./${name}-src-${release}.tar.gz"
1489
                        src="./${name}-src-${release}.tar" />
1490
                <delete file="./${name}-src-${release}.tar" />
1491
                <!--delete dir="${dist.dir}"/ -->
1492
        </target>
1493

    
1494
        <target name="deb-package" depends="distbin"
1495
                description="create a debian installation package">
1496
                <delete dir="${deb.pkg.dir}" />
1497
                <mkdir dir="${deb.pkg.dir}/DEBIAN" />
1498
                <copy todir="${deb.pkg.dir}/DEBIAN" filtering="yes">
1499
                        <fileset dir="./src/scripts/debian"
1500
                                includes="control postinst" />
1501
                </copy>
1502

    
1503
                <mkdir
1504
                        dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1505
                <copy
1506
                        todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1507
                        filtering="yes">
1508
                        <fileset dir="./src/scripts/debian"
1509
                                excludes="control postinst" />
1510
                </copy>
1511
                <chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1512

    
1513
                <copy file="${dist.dir}/knb.war"
1514
                        todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1515
                <copy file="./metacat-bin-${metacat.version}.tar.gz"
1516
                        tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1517

    
1518
                <exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1519
                        failonerror="true">
1520
                        <arg line="--build debian" />
1521
                </exec>
1522

    
1523
                <move file="${pkg.dir}/debian.deb"
1524
                        tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1525
        </target>
1526

    
1527
        <target name="stylesheettest">
1528
                <xslt in="${input}" out="eml.html"
1529
                        style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1530
                        <param name="displaymodule" expression="${displaymodule}" />
1531
                        <param name="docid" expression="${input}" />
1532
                        <param name="entitytype" expression="${entitytype}" />
1533
                        <param name="entityindex" expression="${entityindex}" />
1534
                        <outputproperty name="method" value="html" />
1535
                        <outputproperty name="standalone" value="yes" />
1536
                        <outputproperty name="encoding" value="iso8859_1" />
1537
                        <outputproperty name="indent" value="yes" />
1538
                </xslt>
1539
        </target>
1540

    
1541
        <target name="spatial_option" depends="prepare"
1542
                description=" -- compiles code for the spatial option">
1543

    
1544
                <echo message="Compiling the metatcat shapefile creator" />
1545
                <echo message="using the shapelib at: ${shapelib.dir}" />
1546
                <exec dir="." executable="g++" os="Linux, Unix"
1547
                        failonerror="true">
1548
                        <arg
1549
                                line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1550
                </exec>
1551

    
1552
                <exec dir="." executable="g++" os="Linux, Unix"
1553
                        failonerror="true">
1554
                        <arg
1555
                                line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1556
                </exec>
1557
        </target>
1558

    
1559
        <!-- LSID Authority support -->
1560
        <patternset id="lsid.jars">
1561
                <include name="axis.jar" />
1562
                <include name="commons-discovery-0.2.jar" />
1563
                <include name="jaxrpc.jar" />
1564
                <include name="lsid-client-1.1.1.jar" />
1565
                <include name="lsid-server-1.1.1.jar" />
1566
                <include name="saaj.jar" />
1567
                <include name="wsdl4j-1.5.1.jar" />
1568
                <include name="activation.jar" />
1569
                <include name="castor-0.9.5.jar" />
1570
                <include name="dnsjava-1.3.2.jar" />
1571
                <include name="mail.jar" />
1572
                <include name="commons-logging-1.0.4.jar" />
1573
                <!-- These jars may be needed but seem to not actually be,
1574
                        so leaving them out for now
1575
                        <include name="axis-ant.jar" />
1576
                -->
1577
                <!--<include name="GenCastor.class" />-->
1578
        </patternset>
1579
        <patternset id="lib.jars">
1580
                <include name="log4j-1.2.12.jar" />
1581
                <include name="utilities.jar" />
1582
                <include name="xerces*.jar" />
1583
                <include name="xalan*.jar" />
1584
                <include name="xml-apis*.jar" />
1585
        </patternset>
1586

    
1587
        <path id="lsid.classpath">
1588
                <fileset dir="${lsid.lib.dir}">
1589
                        <patternset refid="lsid.jars" />
1590
                </fileset>
1591
                <fileset dir="${lib.dir}">
1592
                        <patternset refid="lib.jars" />
1593
                </fileset>
1594
                <fileset dir="${build.dir}">
1595
                        <include name="metacat-client.jar" />
1596
                        <include name="metacat.jar" />
1597
                </fileset>
1598
        </path>
1599

    
1600
        <filterset id="configFilters">
1601
                <!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1602
                        value="${config.hostname}" / -->
1603
                <!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1604
                        value="${config.port}" / -->
1605
                <!-- MCD BYE filter token="METADATA_LABELS"
1606
                        value="${config.metadataLabelLsid}" / -->
1607
                <!-- MCD BYE filter token="METACAT_SERVER"
1608
                        value="${config.metacatserver}" / -->
1609
                <!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1610
                        value="${config.lsidauthority}" / -->
1611
        </filterset>
1612

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

    
1657
        <target name="compile-lsid" depends="prepare-lsid"
1658
                description="Compile Java sources">
1659
                <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1660
                <javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1661
                        destdir="${lsid.build.dir}/WEB-INF/classes" debug="${compile.debug}"
1662
                        deprecation="${compile.deprecation}"
1663
                        optimize="${compile.optimize}">
1664
                        <classpath refid="lsid.classpath" />
1665
                </javac>
1666
        </target>
1667

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

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

    
1729
        <!-- build metacat-index war -->
1730
        <target name="build-metacat-index" description="Calls the Maven build for metacat-index.war" >                
1731
                <artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1732
                        <arg value="clean"/>
1733
                </artifact:mvn>
1734
                <artifact:mvn pom="metacat-index/pom.xml" mavenhome="${maven.home}" fork="true">
1735
                        <arg value="package"/>
1736
                        <!--<arg value="-Dmaven.test.skip=true"/>-->
1737
                </artifact:mvn>
1738
        </target>
1739
        
1740
        <target name="dist-metacat-index" depends="init, build-metacat-index" description="Copy metacat-index.war to dist folder" >                
1741
                <copy tofile="${dist.dir}/metacat-index.war" >
1742
                        <fileset dir="metacat-index/target" includes="metacat-index*.war"></fileset>
1743
                </copy>        
1744
        </target>
1745
        
1746
        <target name="install-metacat-index" depends="dist-metacat-index" description="Copy metacat-index.war to deploy folder" >                
1747
                <copy todir="${app.deploy.dir}" file="${dist.dir}/metacat-index.war" />
1748
        </target>
1749
        
1750
</project>