Project

General

Profile

metacat / build.xml @ 10342

1
<?xml version="1.0"?>
2
<!--
3
        *   '$RCSfile$'
4
        *     Authors: Matt Jones, Chad Berkley, Jivka Bojilova
5
        *   Copyright: 2000 Regents of the University of California and the
6
        *              National Center for Ecological Analysis and Synthesis
7
        * For Details: http://www.nceas.ucsb.edu/
8
        *
9
        *    '$Author: tao $'
10
        *    '$Date: 2017-06-06 13:28:04 -0700 (Tue, 06 Jun 2017) $'
11
        *    '$Revision: 10342 $'
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
        
35
        <property name="metacatui-tag" value="METACATUI_1_14_2" />
36
    <property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_1_2" />
37
    <property name="seek-tag" value="tags/ECOGRID_1_2_3" />
38
        
39
        <property environment="env" />
40
        <property file="build.properties" /><!-- USER SPECIFIC PROPS -->
41
        <property name="java.target.version" value="1.7" /> <!-- the target version for java compilation-->
42
        <property name="java.source.version" value="1.7" /> <!-- the source code version for java compilation-->
43

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

    
126
        <!-- Determine if perl should be built-->
127
        <condition property="build.perl">
128
                <equals arg1="${make.perl.code}" arg2="true" />
129
        </condition>
130

    
131
        <available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
132
                        property="tomcat.common.exists" />
133

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

    
149
                <property name="debug" value="on" />
150
                <property name="morphosourcedir" value="../morpho" />
151
                <property name="installdir"
152
                        value="${app.deploy.dir}/${metacat.context}" />
153

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

    
184
                        <!-- Include everything from maven -->
185
                        <fileset dir="${libdir.mvn}">
186
                                <include name="*.jar" />
187
                        </fileset>
188

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

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

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

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

    
271

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

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

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

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

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

    
340

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

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

    
381
                <property name="ecogrid-target-name" value="metacatImpl" />
382
                <property name="ecogrid-module-dest-dir" value="${build.dir}" />
383
                <property name="ecogrid-module" value="seek/projects/ecogrid" />
384
                <property name="ecogrid-dist-dir"
385
                        value="${dist.dir}/${ecogrid-module}" />
386
                <property name="ecogrid-dir"
387
                        value="${ecogrid-module-dest-dir}/${ecogrid-module}" />
388

    
389
                <property name="package.home" value="edu/ucsb/nceas/metacat" />
390

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

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

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

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

    
471
        <target name="prepare" depends="init, resolveDependencies">
472
                <mkdir dir="${build.dir}" />
473
                <mkdir dir="${build.src}" />
474
                <mkdir dir="${build.dest}" />
475
                <mkdir dir="${build.docs}" />
476
                <mkdir dir="${build.javadocs}" />
477
                <mkdir dir="${build.tmp}" />
478

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

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

    
502
        <target name="compile" depends="prepare"
503
                description="Compiles java code to build dir, and copies metacat props files there">
504

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

    
516
        <target name="jar" depends="compile,geteml"
517
                description="Compiles and jars metacat java code to metacat.jar in build dir ">
518

    
519
                <delete file="${build.dir}/${name}.jar" />
520
                <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
521
                        excludes="**/protocols/ **/harvesterClient/" />
522
        </target>
523

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

    
531

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

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

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

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

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

    
601
        <target name="geteml" depends="getemlpre2,getemlpre2beta4,geteml2+,getConversionXSL"
602
                if="eml.required" description="Calls getemlpre2 and geteml2+ targets" />
603

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

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

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

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

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

    
671
                </copy>
672

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

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

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

    
708
        <target name="copyxsl"
709
                description="Copies xsl stylesheets from checkout in build/tmp to your metacat sandbox">
710

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

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

    
721

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

    
728
        </target>
729

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

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

    
752
        </target>
753

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

    
774
        <target name="build-metacat" depends="install-ecogrid, install-spatial, dist-metacat-index, dist-metacat-ui"
775
                description="Build Metacat">
776
        </target>
777

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

    
799

    
800
        </target>
801

    
802
        <target name="get-ecogrid" depends="init"
803
                description="Check out ecogrid module">
804
                <svn>
805
                        <export srcUrl="${svn.ecogridUrl}" force="true"
806
                                destPath="${ecogrid-dir}" />
807
                </svn>
808
        </target>
809

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

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

    
826
        <target name="install-skin" depends="init"
827
                description="Install a Skin">
828

    
829
                <input message="Please enter name of the skin"
830
                        addproperty="skin-name" />
831

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

    
876
                <echo message="Install Skin completed." />
877
        </target>
878

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

    
890
        <target name="warPrepare"
891
                depends="cgiPrepare,jar,clientjar,harvesterjar,testPrepare,documentation"
892
                description="Prepare files for creating a web archive (WAR)">
893

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

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

    
1005
                <copy file="src/perl/register-dataset.cgi"
1006
                        todir="${war.context.cgi}" />
1007
                <copy file="src/perl/ldapweb.cgi" todir="${war.context.cgi}" />
1008
                <copy file="src/perl/Metacat/Metacat.pm" todir="${war.lib}" />
1009

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

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

    
1031
        <target name="cgiPrepare" if="build.perl">
1032
                <exec dir="src/perl/Metacat/" executable="make">
1033
                        <arg value="clean" />
1034
                </exec>
1035
                <exec dir="src/perl/Metacat/" executable="perl">
1036
                        <arg value="Makefile.PL" />
1037
                </exec>
1038
                <exec dir="src/perl/Metacat/" executable="make" />
1039
        </target>
1040

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

    
1054
        <target name="getConversionXSL" depends="prepare,giteml"
1055
                unless="styles.not.needed"
1056
                description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
1057

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

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

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

    
1100
                <jar jarfile="${build.dir}/${name}-junittests.jar"
1101
                        basedir="${build.tests}" >
1102
                        <include name="**/*.class"/>
1103
                        <include name="**/*.xml"/>
1104
                </jar>        
1105
                
1106
        </target>
1107

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

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

    
1143
                        <formatter type="plain" />
1144

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

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

    
1167
                <echo>testtorun: ${testtorun}</echo>
1168

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

    
1183
                        <formatter type="plain" />
1184

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

    
1196
                        <echo>testtorun: ${testtorun}</echo>
1197

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

    
1212
                                <formatter type="plain" />
1213

    
1214
                                <batchtest fork="yes" todir="${build.dir}">
1215
                                        <fileset dir="${build.tests}">
1216
                                                <include name="**/${testtorun}.class" />
1217
                                        </fileset>
1218
                                </batchtest>
1219
                        </junit>
1220
                </target>
1221

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

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

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

    
1264
                <jar jarfile="${build.dir}/${name}-junitnettests.jar"
1265
                        basedir="${build.metacatnettest}" includes="**/*.class" />
1266

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

    
1279
                        <formatter type="plain" />
1280

    
1281
                        <batchtest fork="yes" todir="${build.dir}">
1282
                                <fileset dir="${build.metacatnettest}">
1283
                                        <include name="**/*.class" />
1284
                                </fileset>
1285
                        </batchtest>
1286
                </junit>
1287
        </target>
1288

    
1289
        <target name="cleanweb" depends="clean"
1290
                description="deletes tomcat web context dir and all its contents">
1291
                <delete dir="${installdir}" />
1292
        </target>
1293

    
1294

    
1295
        <target name="clean" depends="init"
1296
                description="deletes build dir and files that can be regenerated form the release">
1297
                <delete dir="${build.dir}" />
1298
                <delete dir="${dist.dir}" />
1299
                <delete dir="${metacatui.build.dir}" />
1300
        </target>
1301

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

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

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

    
1373
                <copy todir="${ver.dir}/docs" filtering="yes">
1374
                        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1375
                </copy>
1376
                <copy todir="${ver.dir}/docs" filtering="no">
1377
                        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1378
                </copy>
1379
                <copy todir="${ver.dir}/docs/dev">
1380
                        <fileset dir="${build.dir}/docs" />
1381
                </copy>
1382
                <copy todir="${ver.dir}/src">
1383
                        <fileset dir="${build.dir}/src" />
1384
                </copy>
1385

    
1386
                <mkdir dir="${ver.dir}/tests/servertestfiles" />
1387
                <copy todir="${ver.dir}/test/servertestfiles">
1388
                        <fileset dir="./test/servertestfiles" />
1389
                </copy>
1390
        </target>
1391

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

    
1411
        <target name="distsrc" depends="dist"
1412
                description="prepares a source distribution">
1413
                <mkdir dir="${ver.src}" />
1414
                <copy todir="${ver.src}">
1415
                        <fileset dir="./src" />
1416
                </copy>
1417
                
1418

    
1419
                <!--<mkdir dir="${ecogrid-dist-dir}" />
1420
                <copy todir="${ecogrid-dist-dir}">
1421
                        <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1422
                </copy>-->
1423

    
1424

    
1425
                <delete file="./${name}-src-${release}.zip" />
1426
                <zip zipfile="./${name}-src-${release}.zip"
1427
                        basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1428
                <delete file="./${name}-src-${release}.tar.gz" />
1429
                <tar tarfile="./${name}-src-${release}.tar"
1430
                        basedir="${dist.dir}" excludes="metacat*.tar.gz,metacat*.zip" />
1431
                <gzip zipfile="./${name}-src-${release}.tar.gz"
1432
                        src="./${name}-src-${release}.tar" />
1433
                <delete file="./${name}-src-${release}.tar" />
1434
                <!--delete dir="${dist.dir}"/ -->
1435
        </target>
1436

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

    
1446
                <mkdir
1447
                        dir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1448
                <copy
1449
                        todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}"
1450
                        filtering="yes">
1451
                        <fileset dir="./src/scripts/debian"
1452
                                excludes="control postinst" />
1453
                </copy>
1454
                <chmod file="${deb.pkg.dir}/DEBIAN/postinst" perm="755" />
1455

    
1456
                <copy file="${dist.dir}/${metacat.context}.war"
1457
                        todir="${deb.pkg.dir}/usr/share/metacat-${metacat.version}" />
1458
                <copy file="./metacat-bin-${metacat.version}.tar.gz"
1459
                        tofile="${deb.pkg.dir}/metacat_${metacat.version}.orig.tar.gz" />
1460

    
1461
                <exec dir="${pkg.dir}" executable="dpkg" os="Linux, Unix"
1462
                        failonerror="true">
1463
                        <arg line="--build debian" />
1464
                </exec>
1465

    
1466
                <move file="${pkg.dir}/debian.deb"
1467
                        tofile="${pkg.dir}/metacat_${metacat.version}${metacat.releaseCandidate}_all.deb" />
1468
        </target>
1469

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

    
1484
        <target name="spatial_option" depends="prepare"
1485
                description=" -- compiles code for the spatial option">
1486

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

    
1495
                <exec dir="." executable="g++" os="Linux, Unix"
1496
                        failonerror="true">
1497
                        <arg
1498
                                line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1499
                </exec>
1500
        </target>
1501

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

    
1530
        <path id="lsid.classpath">
1531
                <fileset dir="${lsid.lib.dir}">
1532
                        <patternset refid="lsid.jars" />
1533
                </fileset>
1534
                <fileset dir="${lib.dir}">
1535
                        <patternset refid="lib.jars" />
1536
                </fileset>
1537
                <fileset dir="${build.dir}">
1538
                        <include name="metacat-client.jar" />
1539
                        <include name="metacat.jar" />
1540
                </fileset>
1541
        </path>
1542

    
1543
        <filterset id="configFilters">
1544
                <!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1545
                        value="${config.hostname}" / -->
1546
                <!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1547
                        value="${config.port}" / -->
1548
                <!-- MCD BYE filter token="METADATA_LABELS"
1549
                        value="${config.metadataLabelLsid}" / -->
1550
                <!-- MCD BYE filter token="METACAT_SERVER"
1551
                        value="${config.metacatserver}" / -->
1552
                <!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1553
                        value="${config.lsidauthority}" / -->
1554
        </filterset>
1555

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

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

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

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

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