Project

General

Profile

1 113 jones
<?xml version="1.0"?>
2 1311 berkley
<!--
3 670 jones
  *   '$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 113 jones
  *
9 670 jones
  *    '$Author$'
10 1292 tao
  *    '$Date$'
11
  *    '$Revision$'
12 666 jones
  *
13 670 jones
  * Build file for the Ant cross-platform build system for metacat
14
  * See http://jakarta.apache.org for details on Ant
15 113 jones
  *
16 303 jones
  * usage: ant [compile|jar|install|jdoc]
17 666 jones
  *
18
  * This program is free software; you can redistribute it and/or modify
19
  * it under the terms of the GNU General Public License as published by
20
  * the Free Software Foundation; either version 2 of the License, or
21
  * (at your option) any later version.
22
  *
23
  * This program is distributed in the hope that it will be useful,
24
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
  * GNU General Public License for more details.
27
  *
28
  * You should have received a copy of the GNU General Public License
29
  * along with this program; if not, write to the Free Software
30
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31 1311 berkley
-->
32 329 jones
<project name="metacat" default="jar" basedir=".">
33 2277 jones
  <property environment="env"/>
34 1929 brooke
  <property file="build.properties"/>  <!-- USER SPECIFIC PROPS -->
35 2957 tao
36 4098 daigle
37
38 2957 tao
  <!-- Determine if installed ecogrid -->
39
  <condition property="enable.ecogrid">
40
    <equals arg1="${install.ecogrid}" arg2="true" />
41
  </condition>
42 3034 perry
43 4098 daigle
   <target name="config">
44
   	  <property name="jsdk" value="${build.tomcat.dir}/common/lib/servlet-api.jar"/>
45 1814 tao
      <!-- usr for client testing, generally you don't need change-->
46 4098 daigle
      <property name="mcuser"              value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org"/>
47
      <property name="mcpassword"          value="kepler"/>
48
      <property name="mcanotheruser"       value="uid=tao,o=NCEAS,dc=ecoinformatics,dc=org"/>
49
      <property name="mcanotherpassword"   value="yourpass"/>
50
   	  <property name="piscouser"           value="uid=tao,o=PISCO,dc=ecoinformatics,dc=org"/>
51
   	  <property name="piscopassword"       value="yourpass"/>
52
   	  <property name="lteruser"            value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org"/>
53
   	  <property name="lterpassword"        value="yourpass"/>
54 1801 tao
55 4098 daigle
      <property name="debug"               value="on" />
56 4179 daigle
      <!-- MCD BYE in metacat.properties property name="debuglevel"          value="55" / -->
57 1716 berkley
58 4098 daigle
      <property name="morphosourcedir"     value="../morpho" />
59 4179 daigle
      <!-- MCD BYE in metacat.properties property name="defaultcontenttype"  value="application/octet-stream" / -->
60 4098 daigle
      <property name="utilitiesdir"        value="../utilities" />
61 2175 tao
62 1941 brooke
      <echo>*********** set jsdk to ${jsdk}</echo>
63 1103 tao
  </target>
64
65 931 jones
   <target name="init" depends="config">
66 2631 tao
      <path id="compile.classpath">
67
        <pathelement location="${jsdk}"/>
68 4080 daigle
        <pathelement location="lib"/>
69 2631 tao
        <fileset dir="lib">
70
          <include name="*.jar"/>
71
        </fileset>
72 4121 daigle
	    <fileset dir="lib">
73 3059 berkley
           <include name="xalan.jar"/>
74 3030 sgarg
         </fileset>
75 2631 tao
       <fileset dir="lib/lsid_lib">
76
         <include name="*.jar"/>
77 4098 daigle
       </fileset>
78 3034 perry
79
        <!-- Include geoserver, geotools, et. al. -->
80
        <fileset dir="lib/spatial/geoserver/WEB-INF/lib">
81
          <include name="*.jar"/>
82 2631 tao
        </fileset>
83 3034 perry
        <pathelement location="lib/spatial/geoserver/WEB-INF/classes"/>
84
85 4121 daigle
      </path>
86 2631 tao
87 931 jones
      <!-- It is less likely you'll need to make any changes from here down,
88
           but customization is possible -->
89 1929 brooke
      <property name="name"                value="metacat"/>
90
      <property name="Name"                value="MetaCat"/>
91
      <property name="debugprefix"         value="${Name}:"/>
92 4080 daigle
      <property name="release"             value="${metacat.version}"/>
93 3095 cjones
      <property name="style-common-relpath" value="/style/common"/>
94
      <property name="style-shared-relpath" value="/style/shared"/>
95 4098 daigle
      <property name="schema-relpath"      value="/schema"/>
96 3095 cjones
      <property name="style-common-cvsrelpath" value="lib${style-common-relpath}"/>
97 4098 daigle
   	  <property name="schema-cvsrelpath"   value="lib${schema-relpath}"/>
98 1929 brooke
      <property name="style-skins-relpath" value="/style/skins"/>
99 2461 sgarg
      <property name="util-module"         value="utilities" />
100 1929 brooke
      <property name="eml-module"          value="eml" />
101
      <property name="eml-version"         value="2.0.0beta6" />
102
      <property name="eml-tag"             value="EML_2_0_0_BETA_6_FOR_METACAT" />
103 2232 sgarg
      <property name="eml2_0_0-tag"        value="RELEASE_EML_2_0_0_UPDATE_1" />
104 3994 berkley
      <property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" />
105 3807 tao
      <property name="eml2_0_1-style-tag"  value="RELEASE_EML_2_0_1_UPDATE_6" />
106 2228 sgarg
      <property name="eml2_0_0namespace"   value="eml://ecoinformatics.org/eml-2.0.0" />
107
      <property name="eml2_0_1namespace"   value="eml://ecoinformatics.org/eml-2.0.1" />
108
      <property name="eml2_1_0namespace"   value="eml://ecoinformatics.org/eml-2.1.0" />
109 1929 brooke
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
110 1933 brooke
      <property name="eml-css"             value="eml_xsl.css"/>
111
      <property name="eml-module.default.css"
112
                                           value="default.css"/>
113 2965 tao
114 1929 brooke
      <!-- Config for registry variables -->
115 4080 daigle
      <!-- TODO: SCW remove these, covered in metacat.properties or in skin.properties -->
116 1933 brooke
      <property name="scope"               value="obfs"/>
117
      <property name="responseForm"        value="genericResponse.tmpl"/>
118
      <property name="entryForm"           value="entryForm.tmpl"/>
119
      <property name="guide"               value="genericGuide.tmpl"/>
120 2781 sgarg
      <property name="loginForm"           value="loginForm.tmpl"/>
121 2343 sgarg
      <property name="confirmData"         value="confirmData.tmpl"/>
122
      <property name="deleteData"          value="deleteData.tmpl"/>
123
      <property name="genericHeader"       value="genericHeader.tmpl"/>
124
      <property name="genericFooter"       value="genericFooter.tmpl"/>
125 1929 brooke
126 2343 sgarg
      <filter token="scope"                value="${scope}"/>
127
      <filter token="responseForm"         value="${responseForm}"/>
128
      <filter token="entryForm"            value="${entryForm}"/>
129
      <filter token="guide"                value="${guide}"/>
130 2781 sgarg
      <filter token="loginForm"            value="${loginForm}"/>
131 2343 sgarg
      <filter token="confirmData"          value="${confirmData}"/>
132
      <filter token="deleteData"           value="${deleteData}"/>
133
      <filter token="genericHeader"        value="${genericHeader}"/>
134
      <filter token="genericFooter"        value="${genericFooter}"/>
135
      <filter token="adminname"            value="${adminname}"/>
136
      <filter token="recipient"            value="${recipient}"/>
137 4080 daigle
   	  <filter token="metacatVersion"       value="${metacat.version}"/>
138 2343 sgarg
139 4098 daigle
      <filter token="docrooturl"           value="./" />
140
      <filter token="mcuser"               value="${mcuser}"/>
141
      <filter token="mcpassword"           value="${mcpassword}"/>
142
      <filter token="mcanotheruser"        value="${mcanotheruser}"/>
143
      <filter token="mcanotherpassword"    value="${mcanotherpassword}"/>
144
      <filter token="eml-css"              value="${eml-css}"/>
145
      <filter token="style-skins-relpath"  value="${style-skins-relpath}"/>
146 1929 brooke
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
147 2343 sgarg
148 4098 daigle
      <filter token="eml-version"          value="${eml-version}"/>
149
      <filter token="eml2_0_0namespace"    value="${eml2_0_0namespace}"/>
150
      <filter token="eml2_0_1namespace"    value="${eml2_0_1namespace}"/>
151
      <filter token="eml2_1_0namespace"    value="${eml2_1_0namespace}"/>
152
      <filter token="stmmlnamespace"       value="${stmmlnamespace}"/>
153 4179 daigle
      <!-- MCD BYE filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" / -->
154
      <!-- MCD BYE filter filter token="debuglevel"           value="${debuglevel}" / -->
155
      <!-- MCD BYE filter token="defaultcontenttype"   value="${defaultcontenttype}" / -->
156 4098 daigle
      <filter token="debugprefix"          value="${debugprefix}"/>
157
      <filter token="indexPaths"           value="${indexPaths}"/>
158 1487 tao
159 4098 daigle
      <filter token="defaultStage"         value="${defaultStage}"/>
160
      <filter token="defaultHeader"        value="${defaultHeader}"/>
161
      <filter token="defaultFooter"        value="${defaultFooter}"/>
162
      <filter token="defaultChangePass"    value="${defaultChangePass}"/>
163
      <filter token="defaultResetPass"     value="${defaultResetPass}"/>
164
      <filter token="changePassSuccess"    value="${changePassSuccess}"/>
165
      <filter token="resetPassSuccess"     value="${resetPassSuccess}"/>
166
      <filter token="registerFailed"       value="${registerFailed}"/>
167
      <filter token="registerLter"         value="${registerLter}"/>
168
      <filter token="registerMatch"        value="${registerMatch}"/>
169
      <filter token="registerSuccess"      value="${registerSuccess}"/>
170
      <filter token="register"             value="${register}"/>
171
      <filter token="searchResults"        value="${searchResults}"/>
172 3174 tao
   	  <filter token="ldapMainServerFailure" value="${ldapMainServerFailure}"/>
173 4098 daigle
   	  <filter token="lter-user"            value="${lteruser}"/>
174
   	  <filter token="lter-pass"            value="${lterpassword}"/>
175
      <filter token="pisco-user"           value="${piscouser}"/>
176
      <filter token="pisco-pass"           value="${piscopassword}"/>
177 3575 tao
178 2549 tao
179 4179 daigle
   	  <!-- MCD BYE filter token="timedreplication"     value="${timedreplication}" / -->
180
   	  <!-- MCD BYE filter token="firsttimedreplication" value="${firsttimedreplication}" / -->
181
   	  <!-- MCD BYE filter token="timedreplicationinterval" value="${timedreplicationinterval}" / -->
182 2549 tao
183 4098 daigle
   	  <property name="srcdir"              value="./src" />
184
   	  <property name="lib.dir"             value="./lib" />
185
   	  <property name="docdir"              value="./docs" />
186
      <property name="testdir"             value="./test" />
187
      <property name="testtorun"           value="BuildIndexTest" />
188
      <property name="junittestsdir"       value="./test/edu/ucsb/nceas/metacattest" />
189
      <property name="junitnettestsdir"    value="./test/edu/ucsb/nceas/metacatnettest" />
190
      <property name="build.dir"           value="./build"/>
191
      <property name="build.src"           value="${build.dir}/src"/>
192
      <property name="build.dest"          value="${build.dir}/classes"/>
193
      <property name="build.samples"       value="${build.dir}/samples"/>
194
      <property name="build.tests"         value="${build.dir}/tests"/>
195
      <property name="build.tmp"           value="${build.dir}/tmp"/>
196
      <property name="build.metacattest"   value="${build.tests}/metacattest"/>
197 1116 tao
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
198 4098 daigle
      <property name="build.data"          value="${build.dir}/data"/>
199
      <property name="build.javadocs"      value="${build.dir}/docs/api"/>
200
      <property name="build.war"           value="${build.dir}/war"/>
201
      <property name="dist.dir"            value="dist"/>
202
      <property name="ver.dir"             value="${dist.dir}/${name}-${release}"/>
203
      <property name="ver.src"             value="${ver.dir}/src"/>
204
      <property name="util.dir"            value="${dist.dir}/${util-module}"/>
205 2401 costa
	  <!-- directories for creating a Harvest List Editor distribution -->
206 4098 daigle
      <property name="dist.dir.hle"        value="disthle"/>
207
      <property name="ver.dir.hle"         value="${dist.dir.hle}/harvest-list-editor-${release}"/>
208
209 2965 tao
   	  <property name="ecogrid-target-name" value="metacatImpl"/>
210
   	  <property name="ecogrid-module-dest-dir" value =".."/>
211 4098 daigle
   	  <property name="ecogrid-module"      value="seek/projects/ecogrid"/>
212
   	  <property name="ecogrid-dist-dir"    value="${dist.dir}/${ecogrid-module}"/>
213
   	  <property name="ecogrid-dir"         value="${ecogrid-module-dest-dir}/${ecogrid-module}"/>
214 806 jones
215 4098 daigle
      <property name="package.home"        value="edu/ucsb/nceas/metacat" />
216 2317 jones
      <condition property="utilities.required">
217
        <or>
218
          <not><available file="lib/httpclient.jar"/></not>
219
          <not><available file="lib/utilities.jar"/></not>
220
        </or>
221
      </condition>
222 2318 jones
      <condition property="eml.required">
223
        <or>
224
          <not><available file="lib/schema/eml-2.0.1/eml.xsd"/></not>
225
          <not><available file="lib/schema/eml-2.0.0/eml.xsd"/></not>
226
          <not><available file="lib/dtd/eml-dataset-2.0.0beta6.dtd"/></not>
227
        </or>
228
      </condition>
229 2965 tao
230
      <condition property="ecogrid.required">
231
      	   <or>
232
             <not><available file="${ecogrid-dir}/build.properties"/></not>
233
             <not><available file="${ecogrid-dir}/buildfiles/metacatImpl.xml"/></not>
234
           </or>
235
      </condition>
236 2599 jones
237 113 jones
   </target>
238 1311 berkley
239 348 jones
   <target name="prepare" depends="init">
240
      <mkdir dir="${build.dir}"/>
241
      <mkdir dir="${build.src}"/>
242
      <mkdir dir="${build.dest}"/>
243 516 jones
      <mkdir dir="${build.javadocs}"/>
244 1778 tao
      <mkdir dir="${build.tmp}"/>
245 348 jones
246 822 jones
      <copy todir="${build.src}" filtering="yes">
247
        <fileset dir="${srcdir}">
248
          <include name="edu/**"/>
249
          <include name="com/**"/>
250 3194 berkley
          <include name="org/**"/>
251 877 jones
          <include name="**/*.sql"/>
252 822 jones
          <exclude name="**/CVS*"/>
253
          <exclude name="**/.#*"/>
254
        </fileset>
255
      </copy>
256 2344 sgarg
      <available file="lib/style/common/emlb6toeml2" type="dir"
257 1954 jones
                 property="styles.not.needed"/>
258 348 jones
   </target>
259
260 1939 brooke
   <target name="compile" depends="prepare,utilities"
261 1986 jones
    description="Compiles java code to build dir, and copies metacat props files there">
262 1939 brooke
263 1311 berkley
       <javac srcdir="${build.src}"
264
              destdir="${build.dest}"
265 1827 jones
              debug="${debug}"
266 3994 berkley
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
267 2599 jones
        <classpath>
268
          <path refid="compile.classpath"/>
269
        </classpath>
270
      </javac>
271 1311 berkley
   </target>
272 113 jones
273 2322 jones
   <target name="jar" depends="compile,geteml"
274 1939 brooke
    description="Compiles and jars metacat java code to metacat.jar in build dir">
275
276 353 jones
       <delete file="${build.dir}/${name}.jar" />
277 635 jones
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
278 2135 costa
            excludes="**/protocols/ **/harvesterClient/" />
279 1311 berkley
   </target>
280
281 1939 brooke
   <target name="protocol" depends="compile"
282
    description="Compiles and jars protocol java code to protocol.jar in build dir">
283 635 jones
       <delete file="${build.dir}/protocol.jar" />
284
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
285
            includes="**/protocols/" />
286 1311 berkley
   </target>
287 113 jones
288 2317 jones
   <target name="utilities" depends="config" if="utilities.required">
289 1796 jones
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
290
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
291 1780 jones
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
292
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
293
   </target>
294
295 2461 sgarg
   <target name="getutilities" depends="prepare"
296
   description="Checks utility out of cvs and copies it to your metacat cvs sandbox">
297
     <echo>Enter CVS password: </echo>
298
     <cvs cvsRoot="${cvsroot}"
299 2468 sgarg
          package="${util-module}"
300 2461 sgarg
          dest="${build.tmp}" />
301
   </target>
302
303 1939 brooke
   <target name="client" depends="utilities, prepare"
304
    description="Compiles metacat-client java code to build dir">
305 1780 jones
       <javac srcdir="${build.src}"
306
              destdir="${build.dest}"
307 2599 jones
              includes="edu/ucsb/nceas/metacat/client/*">
308
          <classpath>
309
            <path refid="compile.classpath"/>
310
          </classpath>
311
        </javac>
312 1780 jones
   </target>
313
314 1939 brooke
   <target name="clientjar" depends="client"
315
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
316 1780 jones
       <delete file="${build.dir}/${name}-client.jar" />
317
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
318
            includes="**/metacat/client/" />
319
   </target>
320
321 2748 costa
    <target name="advancedsearchjar" depends="compile"
322
            description="Compiles and jars advanced search Java code to advancedsearch.jar in build dir">
323
        <delete file="${build.dir}/advancedsearch.jar" />
324
        <jar jarfile="${build.dir}/advancedsearch.jar" basedir="${build.dest}"
325
             includes="**/metacat/advancedsearch/" />
326
    </target>
327
328 2059 costa
   <target name="harvester" depends="client"
329 1950 costa
           description="Compiles harvester java code to build dir">
330
       <javac srcdir="${build.src}"
331
              destdir="${build.dest}"
332 2599 jones
              includes="edu/ucsb/nceas/metacat/harvesterClient/*">
333
          <classpath>
334
            <path refid="compile.classpath"/>
335
          </classpath>
336
        </javac>
337 1950 costa
   </target>
338
339
   <target name="harvesterjar" depends="harvester"
340 2059 costa
           description="Compiles and jars harvester java code to harvester.jar in build dir">
341
       <delete file="${build.dir}/harvester.jar" />
342
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
343 1950 costa
            includes="**/metacat/harvesterClient/" />
344
   </target>
345
346 2369 costa
   <target name="harvestListEditorDist" depends="harvesterjar"
347
           description="Prepares a distribution of the Harvest List Editor tool">
348 2401 costa
       <mkdir dir="${dist.dir.hle}"/>
349
       <delete dir="${ver.dir.hle}" />
350
       <mkdir dir="${ver.dir.hle}"/>
351
       <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar"/>
352
       <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar"/>
353
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestList.xsd"/>
354
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.bat"/>
355
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.sh"/>
356
       <delete file="./harvest-list-editor-${release}.zip"/>
357
       <zip zipfile="./harvest-list-editor-${release}.zip" basedir="${ver.dir.hle}" />
358
       <delete file="./harvest-list-editor-${release}.tar.gz" />
359
       <tar tarfile="./harvest-list-editor-${release}.tar" basedir="${ver.dir.hle}" />
360
       <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
361
             src="./harvest-list-editor-${release}.tar"/>
362
       <delete file="./harvest-list-editor-${release}.tar" />
363 2369 costa
   </target>
364
365 2318 jones
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
366 1939 brooke
            description="Calls getemlpre2 and geteml2+ targets" />
367
368 2318 jones
   <target name="getemlpre2" depends="prepare" if="eml.required"
369 1939 brooke
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
370 1612 tao
     <echo>Enter CVS password: </echo>
371
     <cvs cvsRoot="${cvsroot}"
372
          package="${eml-module}"
373
          tag="${eml-tag}"
374 1939 brooke
          dest="${build.tmp}/eml_${eml-tag}" />
375 1612 tao
     <mkdir dir="lib/dtd" />
376
     <copy todir="lib/dtd" filtering="yes">
377 1939 brooke
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
378 1612 tao
         <include name="*.dtd"/>
379
       </fileset>
380
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
381
     </copy>
382 2228 sgarg
383
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
384
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
385
       <include name="**/*.xsl"/>
386
     </fileset>
387
     </copy>
388 1939 brooke
   </target>
389
390 2318 jones
   <target name="geteml2+" depends="prepare" if="eml.required"
391 1939 brooke
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
392
     <echo>Enter CVS password: </echo>
393 1612 tao
     <cvs cvsRoot="${cvsroot}"
394
          package="${eml-module}"
395 2228 sgarg
          tag="${eml2_0_0-tag}"
396
          dest="${build.tmp}/eml_${eml2_0_0-tag}" />
397
     <mkdir dir="lib/schema/eml-2.0.0" />
398
     <copy todir="lib/schema/eml-2.0.0" filtering="yes">
399
       <fileset dir="${build.tmp}/eml_${eml2_0_0-tag}/${eml-module}">
400 1612 tao
         <include name="*.xsd"/>
401
       </fileset>
402 2175 tao
403 1939 brooke
       <!-- shouldn't we have a mapper here like this??
404
       <mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
405 2175 tao
406
       Jing's code didn't nave one - does it need to be added?
407 1939 brooke
       NOTE that eml-version is set to beta 6, so this would need changing -->
408 2175 tao
409 1612 tao
     </copy>
410 3018 sgarg
     <!-- <antcall target="copyxsl">
411 2228 sgarg
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
412
        <param name="dirname" value="eml-2.0.0" />
413 3018 sgarg
     </antcall> -->
414 3807 tao
415
   	<!-- Checkout eml201 for given schema tag-->
416 2228 sgarg
     <echo>Enter CVS password: </echo>
417
     <cvs cvsRoot="${cvsroot}"
418
          package="${eml-module}"
419 3807 tao
          tag="${eml2_0_1-schema-tag}"
420
          dest="${build.tmp}/eml_${eml2_0_1-schema-tag}" />
421 2228 sgarg
     <mkdir dir="lib/schema/eml-2.0.1" />
422
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
423 3807 tao
       <fileset dir="${build.tmp}/eml_${eml2_0_1-schema-tag}/${eml-module}">
424 2228 sgarg
         <include name="*.xsd"/>
425
       </fileset>
426
     </copy>
427 3807 tao
428
   	<!-- Checkout eml201 again for given style sheet tag-->
429
   	<echo>Enter CVS password: </echo>
430
   	     <cvs cvsRoot="${cvsroot}"
431
   	          package="${eml-module}"
432
   	          tag="${eml2_0_1-style-tag}"
433
   	          dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
434 2228 sgarg
     <antcall target="copyxsl">
435 3807 tao
        <param name="cvs.tagname" value="${eml2_0_1-style-tag}" />
436 2228 sgarg
        <param name="dirname" value="eml-2.0.1" />
437
     </antcall>
438 1939 brooke
   </target>
439
440 2175 tao
   <target  name="copyxsl"
441 1939 brooke
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
442 4080 daigle
443 1939 brooke
     <delete file="${style-common-cvsrelpath}/${eml-css}"/>
444 2175 tao
445 2228 sgarg
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
446
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
447 1929 brooke
       <include name="**/*.xsl"/>
448 1612 tao
     </fileset>
449
     </copy>
450 1939 brooke
451 2175 tao
452
     <!-- now copy default css from eml module and put it in style-common-path
453 1933 brooke
          dir with a new name, so other skin-specific css can import it if reqd -->
454 1939 brooke
     <copy file="${build.tmp}/eml_${cvs.tagname}/${eml-module}/${eml-module.default.css}"
455 1938 brooke
           tofile="${style-common-cvsrelpath}/${eml-css}" />
456 1612 tao
457 1463 tao
   </target>
458 3335 tao
459 3817 tao
   <target name="correctEML201Docs" depends="jar"
460
		            description="Uses the ant  task to run a JAVA patch class to correct invalide eml201 documents which were generated by wrong schema">
461
	   	<copy todir="${build.dir}" file="lib/metacat.properties" filtering="yes"/>
462
	   	 <java classname="edu.ucsb.nceas.metacat.EML201DocumentCorrector" >
463
		         <classpath>
464
		          <path refid="compile.classpath"/>
465
		          <fileset dir="${build.dir}">
466
		            <include name="${name}.jar"/>
467
		          </fileset>
468
		        </classpath>
469
		      </java>
470
   </target>
471 2353 sgarg
472 3072 perry
   <target name="install-spatial" depends="jar,clientjar,harvesterjar"
473 3034 perry
           description="Installs spatial option for metacat">
474
475
      <property name="spatial.dir" value="./lib/spatial"/>
476
      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
477
      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
478
479
      <!-- Copy geoserver libs into ${war.lib} -->
480
      <copy todir="${war.lib}" filtering="no">
481
        <fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
482
          <include name="**"/>
483
        </fileset>
484
      </copy>
485
486
      <!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
487
      <copy todir="${war.webinf}" filtering="no">
488
        <fileset dir="${spatial.geoserver.dir}/WEB-INF">
489
          <exclude name="lib/**"/>
490
          <exclude name="web.xml"/>
491
        </fileset>
492
      </copy>
493
494
      <!-- Copy the rest of the geoserver codebase into ${war.context} -->
495
      <copy todir="${war.context}" filtering="no">
496
        <fileset dir="${spatial.geoserver.dir}">
497
          <exclude name="WEB-INF/**"/>
498
          <exclude name="index.jsp"/>
499
        </fileset>
500
      </copy>
501
502
      <!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
503
     <copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
504
          tofile="${war.context}/geoserver.jsp"
505
          overwrite="true"
506
          filtering="no"/>
507
508
      <!-- Copy the rest of the modified geoserver web-inf files
509
      <copy todir="${war.webinf}" filtering="no">
510
        <fileset dir="${spatial.webinf-mods}">
511
          <exclude name="web.xml.combined"/>
512
        </fileset>
513
      </copy> -->
514
515
    </target>
516
517 4080 daigle
   <target name="dev-install" depends="clean, install-ecogrid" description="* Full Install For Development *">
518
     <copy file="${dist.dir}/${metacat.context}.war" todir="${dev.deploy.dir}"/>
519
   	 <delete dir="${dev.deploy.dir}/${metacat.context}" />
520
   	   <tstamp>
521
   	   	 <format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa"/>
522
   	   </tstamp>
523
   	 <echo>Dev install completed at ${NOW}</echo>
524
   </target>
525 3034 perry
526 4080 daigle
<!--
527 2957 tao
   <target name="install" depends="install-ecogrid" description="* Full Install *">
528 1079 tao
       <mkdir dir="${datafilepath}" />
529 1455 tao
       <mkdir dir="${inlinedatafilepath}" />
530 1079 tao
       <chmod dir="${datafilepath}" perm="ug+w" />
531 1929 brooke
       <mkdir dir="${temp-dir}"/>
532
       <chmod dir="${temp-dir}" perm="ug+w" />
533 2737 jones
       <copy file="${dist.dir}/${metacat.context}.war" todir="${deploy.dir}"/>
534 2993 tao
   	   <echo>If you enable ecogrid installation, please run "ant deploy-ecogrid" when installation or upgrade is done</echo>
535 1952 jones
   </target>
536 4080 daigle
-->
537 2957 tao
538 2965 tao
   <target name="install-ecogrid" depends="war, get-ecogrid" if="enable.ecogrid"
539 2957 tao
			    description="Install Ecogrid Compentent">
540 2965 tao
   	  <copyfile src="lib/metacat.url" dest="${ecogrid-dir}/conf/MetacatImpl/classes/metacat.properties" forceoverwrite="true" filtering="yes"/>
541 2991 berkley
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="clean" inheritall="false">
542 2977 tao
   	         <property name="context" value="${metacat.context}"/>
543
   	   	     <property name="target" value="${ecogrid-target-name}"/>
544
   	   	     <property name="metacat.dir" value="${metacat.dir}"/>
545
   	  </ant>
546 2991 berkley
   	  <ant antfile="build.xml" dir="${ecogrid-dir}" target ="war" inheritall="false">
547 2957 tao
   	     <property name="context" value="${metacat.context}"/>
548
   	     <property name="target" value="${ecogrid-target-name}"/>
549 2965 tao
   	     <property name="metacat.dir" value="${metacat.dir}"/>
550 2957 tao
   	  </ant>
551 2978 tao
   	  <war destfile="${ecogrid-dir}/build/${metacat.context}.war" update="true">
552
  	      <webinf dir="${ecogrid-dir}/lib">
553
   	        <include name="server-config.wsdd"/>
554
   	      </webinf>
555
   	  </war>
556 2965 tao
   	  <copy file="${ecogrid-dir}/build/${metacat.context}.war" todir="${dist.dir}" overwrite="true"/>
557 2978 tao
558
559 2957 tao
   </target>
560 2965 tao
561
   <target name="get-ecogrid" depends="init" if="ecogrid.required" description="Check out ecogrid module">
562
	<echo>Enter CVS password: </echo>
563
	     <cvs cvsRoot="${cvsroot}"
564
	          package="${ecogrid-module}" dest="${ecogrid-module-dest-dir}"/>
565 4098 daigle
   </target>
566 2965 tao
567 2978 tao
   <target name="deploy-ecogrid" depends="clean-ecogrid-server-config-wsdd" if="enable.ecogrid" description="Automately generate wsdd for ecogrid service">
568 2991 berkley
   	 <ant antfile="build.xml" dir="${ecogrid-dir}" target ="deploy" inheritall="false">
569 2957 tao
   	   	 <property name="context" value="${metacat.context}"/>
570
   	   	 <property name="target" value="${ecogrid-target-name}"/>
571 2965 tao
   	     <property name="metacat.dir" value="${metacat.dir}"/>
572 3467 tao
   	     <property name="hostname" value="localhost"/>
573 2977 tao
   	     <property name="port" value="${config.port}"/>
574 2957 tao
   	 </ant>
575
   </target>
576 2978 tao
577
   <target name="clean-ecogrid-server-config-wsdd" depends="init" description="Automately generate wsdd for ecogrid service">
578 4080 daigle
      <delete file="${dev.deploy.dir}/${metacat.context}/WEB-INF/server-config.wsdd"/>
579 2978 tao
   </target>
580 1952 jones
581 2175 tao
   <target name="install-registry" depends="init,getConversionXSL"
582 1952 jones
            description="Install Registry">
583 2175 tao
584 4080 daigle
      <mkdir dir="${inst.cgi.dir}" />
585 1952 jones
      <copy file="${srcdir}/perl/register-dataset.cgi"
586 4080 daigle
            todir="${inst.cgi.dir}"/>
587 1952 jones
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
588 2175 tao
589 4080 daigle
      <!-- TODO SCW: set the permissions on this folder to be writable by the apache user -->
590 1952 jones
      <mkdir dir="${temp-dir}" />
591 4080 daigle
      <!-- TODO SCW: use relative paths to grab these instead of copying to tmp,
592
                     used in readDocumentFromMetacat -->
593 2343 sgarg
      <copy todir="${temp-dir}" filtering="yes">
594
       <fileset dir="lib/style/common/emlb6toeml2">
595 1952 jones
         <include name="*.xsl"/>
596
         <include name="*.xml"/>
597
       </fileset>
598 2343 sgarg
      </copy>
599 1952 jones
600
      <echo message="Install Registry completed." />
601
   </target>
602
603 4080 daigle
   <target name="install-ldap" depends="init"
604
            description="Install Metacat LDAP Access">
605
606
      <mkdir dir="${inst.cgi.dir}" />
607 2343 sgarg
      <copy file="${srcdir}/perl/ldapweb.cgi"
608 4080 daigle
            todir="${inst.cgi.dir}" />
609 2343 sgarg
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
610
      <mkdir dir="${templates.dir}" />
611 4080 daigle
      <copy todir="${templates.dir}">
612 2343 sgarg
        <fileset dir="lib/style/common/templates">
613 4080 daigle
			<!-- SCW: Copy all files -->
614 2343 sgarg
        </fileset>
615
      </copy>
616
      <echo message="ldapweb install complete." />
617
   </target>
618
619
620 2175 tao
   <target name="install-skin" depends="init"
621 2052 sgarg
            description="Install a Skin">
622
623 3994 berkley
      <input message="Please enter name of the skin"
624
             addproperty="skin-name"/>
625 2052 sgarg
626
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
627
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
628
       <fileset dir="lib/style/skins/${skin-name}">
629 3014 costa
           <exclude name="**/*.png"/>
630
           <exclude name="**/*.gif"/>
631
           <exclude name="**/*.jpg"/>
632 2277 jones
           <exclude name="**/CVS*"/>
633
           <exclude name="**/.#*"/>
634 2052 sgarg
       </fileset>
635
      </copy>
636 2054 sgarg
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
637
       <fileset dir="lib/style/skins/${skin-name}">
638 3014 costa
           <include name="**/*.png"/>
639 3994 berkley
           <include name="**/*.gif"/>
640 3014 costa
           <include name="**/*.jpg"/>
641 2277 jones
           <exclude name="**/CVS*"/>
642
           <exclude name="**/.#*"/>
643 2054 sgarg
       </fileset>
644
      </copy>
645 2974 jones
      <copy todir="${installdir}/style/common" filtering="yes">
646
       <fileset dir="lib/style/common">
647
           <include name="*.js"/>
648
           <include name="*.jsp"/>
649
           <include name="*.css"/>
650
           <exclude name="*.png"/>
651
           <exclude name="*.gif"/>
652
           <exclude name="*.jpg"/>
653
           <exclude name="**/CVS*"/>
654
           <exclude name="**/.#*"/>
655
       </fileset>
656
      </copy>
657 2277 jones
      <!--
658 2210 jones
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
659
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
660
       <fileset dir="lib/style/skins/${skin-name}/images">
661
           <include name="*.png"/>
662
           <include name="*.gif"/>
663
           <include name="*.jpg"/>
664
       </fileset>
665
      </copy>
666 2277 jones
      -->
667 2052 sgarg
668
      <echo message="Install Skin completed." />
669
   </target>
670
671 4098 daigle
   <target name="war" depends="warPrepare,install-spatial"
672 1952 jones
            description="Create a web archive (WAR) for servlet deployment">
673 2737 jones
       <mkdir dir="${dist.dir}" />
674
       <war destfile="${dist.dir}/${metacat.context}.war"
675 1952 jones
            webxml="${build.war}/web.xml">
676
         <fileset dir="${war.context}"/>
677
         <lib dir="${war.lib}"/>
678
         <webinf dir="${war.webinf}"/>
679
       </war>
680
   </target>
681 2957 tao
682
683 1952 jones
684 2059 costa
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
685 1952 jones
            description="Prepare files for creating a web archive (WAR)">
686
687
       <property name="war.lib" value="${build.war}/lib" />
688
       <property name="war.webinf" value="${build.war}/WEB-INF" />
689 2737 jones
       <property name="war.context" value="${build.war}/${metacat.context}" />
690 4098 daigle
   	   <property name="war.webinf.sql" value="${war.webinf}/sql" />
691 4080 daigle
   	   <property name="war.context.docs" value="${war.context}/docs" />
692 1952 jones
       <mkdir dir="${war.lib}" />
693
       <mkdir dir="${war.webinf}" />
694
       <mkdir dir="${war.context}" />
695 4098 daigle
   	   <mkdir dir="${war.webinf.sql}" />
696 4080 daigle
   	   <mkdir dir="${war.context.docs}" />
697 2610 tao
698 4098 daigle
   	   <!--copy file="${lib.dir}/${jdbc.lib.oracle}" todir="${war.lib}" / -->
699
	   <!--copy file="${lib.dir}/${jdbc.lib.postgres}" todir="${war.lib}" / -->
700
       <!--copy file="${lib.dir}/${jdbc.lib.sqlserver1}" todir="${war.lib}" / -->
701
       <!--copy file="${lib.dir}/${jdbc.lib.sqlserver2}" todir="${war.lib}" / -->
702
       <!--copy file="${lib.dir}/${jdbc.lib.sqlserver3}" todir="${war.lib}" / -->
703 1952 jones
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
704
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
705 2059 costa
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
706 1952 jones
       <copy todir="${war.lib}" filtering="no">
707 1823 jones
         <fileset dir="lib">
708 4098 daigle
<!--
709
         	<not>
710 2610 tao
               <filename name="${jdbc-jar-name}"/>
711
            </not>
712 4098 daigle
-->
713 2610 tao
            <include name="*.jar"/>
714 1823 jones
         </fileset>
715 3059 berkley
         <fileset dir="lib">
716
           <include name="xalan.jar"/>
717 3194 berkley
           <include name="gwt*.jar"/>
718 1823 jones
         </fileset>
719
       </copy>
720 4080 daigle
       <!-- MCD copy file="lib/web.xml.${tomcatversion}"
721
             tofile="${build.war}/web.xml" / -->
722
       <!-- MCD added next - Remove the tomcat5 reference-->
723
   	   <copy file="lib/web.xml.tomcat5"
724
   	             tofile="${build.war}/web.xml"/>
725 1952 jones
       <copy file="lib/metacat.properties" todir="${war.webinf}"
726 1951 jones
             filtering="yes" />
727 4080 daigle
   	   <copy file="lib/metacat.properties.metadata.xml" todir="${war.webinf}"
728 3099 jones
   	             filtering="no" />
729 4080 daigle
	   <copy file="lib/org.properties.metadata.xml" todir="${war.webinf}"
730
	             filtering="no" />
731 4162 daigle
	   <copy file="lib/ldap.properties.metadata.xml" todir="${war.webinf}"
732
	             filtering="no" />
733 2900 sgarg
       <copy todir="${war.webinf}" filtering="yes">
734
	   	  <fileset dir="lib">
735
           <include name="skin.configs/**"/>
736
		  </fileset>
737
	   </copy>
738 2583 sgarg
       <copy file="lib/log4j.properties" todir="${war.webinf}"
739
             filtering="yes" />
740 1952 jones
       <copy todir="${war.context}" filtering="no">
741 822 jones
         <fileset dir="lib">
742
           <include name="**/*.jpg"/>
743
           <include name="**/*.png"/>
744
           <include name="**/*.gif"/>
745 2844 costa
           <include name="LiveMap_30/**"/>
746 822 jones
         </fileset>
747
       </copy>
748 1952 jones
       <copy todir="${war.context}" filtering="yes">
749 822 jones
         <fileset dir="lib">
750
           <exclude name="*.jar"/>
751
           <exclude name="*.properties"/>
752 4080 daigle
         	<exclude name="*.metadata.xml"/>
753 822 jones
           <exclude name="web.xml"/>
754 1437 berkley
           <exclude name="**/*.jpg"/>
755
           <exclude name="**/*.png"/>
756
           <exclude name="**/*.gif"/>
757 2778 jones
           <exclude name="lsid_lib/**"/>
758
           <exclude name="lsid_conf/**"/>
759 2844 costa
           <exclude name="LiveMap_30/**"/>
760 2900 sgarg
           <exclude name="skin.configs/**"/>
761 3034 perry
           <exclude name="spatial/geoserver/**"/>
762
           <exclude name="spatial/WEB-INF/**"/>
763 822 jones
         </fileset>
764
       </copy>
765 4193 daigle
       <copy todir="${war.context.docs}" filtering="yes">
766
          <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
767
       </copy>
768
       <copy todir="${war.context.docs}" filtering="no">
769
          <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
770
       </copy>
771 4098 daigle
	   <copy todir="${war.webinf.sql}" filtering="yes">
772 4080 daigle
	         <fileset dir="src">
773
	           <include name="**/*.sql"/>
774
	         </fileset>
775
	   </copy>
776 1311 berkley
   </target>
777 1929 brooke
778 2175 tao
   <target name="getConversionXSL" depends="prepare"
779 1954 jones
            unless="styles.not.needed"
780 1939 brooke
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
781 2497 sgarg
782 1929 brooke
     <echo>Enter CVS password: </echo>
783 2497 sgarg
     <cvs cvsRoot="${cvsroot}"
784
          package="${eml-module}"
785 3909 tao
          tag="${eml2_0_1-style-tag}"
786
          dest="${build.tmp}/eml_${eml2_0_1-style-tag}" />
787 2343 sgarg
788
     <mkdir dir="lib/style/common/emlb6toeml2" />
789
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
790 3909 tao
       <fileset dir="${build.tmp}/eml_${eml2_0_1-style-tag}/${eml-module}/lib/beta6toeml2/xsl">
791 2343 sgarg
         <include name="*.xsl"/>
792
         <include name="*.xml"/>
793
       </fileset>
794
      </copy>
795 1929 brooke
   </target>
796
797 2135 costa
   <target name="testprep" depends="jar,clientjar,harvesterjar">
798 1783 jones
      <mkdir dir="${build.tests}"/>
799
      <copy todir="${build.tests}" filtering="yes">
800
        <fileset dir="${testdir}">
801
          <include name="edu/**"/>
802
        </fileset>
803
      </copy>
804 4121 daigle
   	  <copy todir="${build.tests}" file="lib/metacat.properties" filtering="yes"/>
805
   	  <copy todir="${build.tests}" file="lib/metacat.properties.metadata.xml" filtering="yes"/>
806
   	  <copy todir="${build.tests}" file="lib/org.properties.metadata.xml" filtering="yes"/>
807
808 971 tao
      <!-- copy and compile the tests into a jar file -->
809 1783 jones
      <javac srcdir="${build.tests}"
810
             destdir="${build.tests}"
811 1612 tao
             debug="on"
812 2982 jones
             includes="**/*.java">
813 2599 jones
        <classpath>
814
          <path refid="compile.classpath"/>
815
          <fileset dir="${build.dir}">
816 2982 jones
            <include name="${name}.jar"/>
817
            <include name="${name}-client.jar"/>
818
            <include name="harvester.jar"/>
819 2599 jones
          </fileset>
820
        </classpath>
821
      </javac>
822 204 jones
823 1311 berkley
      <jar jarfile="${build.dir}/${name}-junittests.jar"
824 1783 jones
        basedir="${build.tests}"
825 1311 berkley
                includes="**/*.class" />
826 1822 jones
   </target>
827 971 tao
828 1939 brooke
   <target name="test" depends="testprep"
829
            description="Uses the ant junit task to run all JUnit tests">
830 1822 jones
831 971 tao
      <!-- use the ant "junit" task to run JUnit tests. -->
832 1783 jones
      <junit printsummary="yes" haltonfailure="no" fork="yes"
833 971 tao
             haltonerror="no">
834 1783 jones
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
835 971 tao
        <classpath>
836 2599 jones
          <path refid="compile.classpath"/>
837
          <fileset dir="${build.dir}">
838 2982 jones
            <include name="${name}.jar"/>
839
            <include name="${name}-client.jar"/>
840
            <include name="harvester.jar"/>
841
            <include name="${name}-junittests.jar"/>
842 2599 jones
          </fileset>
843 971 tao
        </classpath>
844
845
        <formatter type="plain" />
846
847
        <batchtest fork="yes" todir="${build.dir}">
848 1783 jones
          <fileset dir="${build.tests}">
849 1116 tao
            <include name="**/*.class" />
850 4147 daigle
          	<exclude name="**/MCTestCase.class" />
851 4210 daigle
          	<exclude name="**/ClientViewHelperTest.java" />
852 971 tao
          </fileset>
853
        </batchtest>
854
     </junit>
855
   </target>
856 1103 tao
857 1939 brooke
    <target name="runonetest" depends="testprep"
858
            description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
859 1500 tao
860 1939 brooke
              <echo>testtorun: ${testtorun}</echo>
861
862 1500 tao
      <!-- use the ant "junit" task to run JUnit tests. -->
863 1783 jones
      <junit printsummary="yes" haltonfailure="no" fork="yes"
864 3747 tao
             haltonerror="no" showoutput="yes">
865 2044 tao
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
866 1500 tao
        <classpath>
867 2599 jones
          <path refid="compile.classpath"/>
868
          <fileset dir="${build.dir}">
869 2982 jones
            <include name="${name}.jar"/>
870
            <include name="${name}-client.jar"/>
871
            <include name="harvester.jar"/>
872
            <include name="${name}-junittests.jar"/>
873 2599 jones
          </fileset>
874 1500 tao
        </classpath>
875
876
        <formatter type="plain" />
877
878
        <batchtest fork="yes" todir="${build.dir}">
879 1783 jones
          <fileset dir="${build.tests}">
880 1500 tao
            <include name="**/${testtorun}.class" />
881
          </fileset>
882
        </batchtest>
883
     </junit>
884
   </target>
885
886 2175 tao
   <target name="testharvester"
887 2135 costa
           depends="testprep"
888
           description="Uses the ant junit task to test only the Harvester code">
889 2175 tao
     <junit printsummary="yes"
890
            haltonfailure="off"
891 2135 costa
            fork="yes"
892
            haltonerror="off">
893 2599 jones
        <classpath>
894
          <path refid="compile.classpath"/>
895
          <fileset dir="${build.dir}">
896 2982 jones
            <include name="${name}.jar"/>
897
            <include name="${name}-client.jar"/>
898
            <include name="harvester.jar"/>
899
            <include name="${name}-junittests.jar"/>
900 2599 jones
          </fileset>
901
        </classpath>
902 2135 costa
       <formatter type="plain" />
903
       <batchtest fork="yes" todir="${build.dir}">
904
         <fileset dir="${build.tests}">
905
           <include name="**/harvesterClient/*.class" />
906
         </fileset>
907
       </batchtest>
908
     </junit>
909
   </target>
910
911 1939 brooke
  <target name="gethttpclient" depends="prepare"
912
            description="checks out and compiles morpho httpclient code">
913 1311 berkley
  <!--mkdir dir="${morphosourcedir}" -->
914 1487 tao
        <cvs cvsRoot="${cvsroot}"
915 1103 tao
             package="morpho"
916
             dest="." />
917 1107 tao
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
918 1103 tao
   </target>
919
920
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
921 4080 daigle
   <target name="nettest" depends="dev-install"
922 1939 brooke
            description="compiles and runs the metacatnettest code">
923 2175 tao
924 1103 tao
      <echo>***********************************
925 1311 berkley
      Please run ant gethttpclient first!
926
      ***********************************
927 1103 tao
      </echo>
928
      <!-- copy and compile the tests into a jar file -->
929 1116 tao
      <mkdir dir="${build.metacatnettest}"/>
930 1103 tao
      <javac srcdir="${junitnettestsdir}"
931 1116 tao
             destdir="${build.metacatnettest}"
932 2599 jones
             includes="**/*.java">
933
        <classpath>
934
          <path refid="compile.classpath"/>
935
          <fileset dir="${build.dir}">
936 2982 jones
            <include name="${name}.jar"/>
937 2599 jones
          </fileset>
938
        </classpath>
939
      </javac>
940 1103 tao
941
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
942 1116 tao
                    basedir="${build.metacatnettest}"
943 1103 tao
                    includes="**/*.class" />
944
945
      <!-- use the ant "junit" task to run JUnit tests. -->
946 1107 tao
      <junit printsummary="yes" haltonfailure="no" fork="yes"
947 1103 tao
             haltonerror="no">
948 1107 tao
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
949 1103 tao
        <classpath>
950 2599 jones
          <path refid="compile.classpath"/>
951
          <fileset dir="${build.dir}">
952 2982 jones
            <include name="${name}.jar"/>
953
            <include name="${name}-junitnettests.jar"/>
954 2599 jones
          </fileset>
955 1103 tao
        </classpath>
956
957
        <formatter type="plain" />
958
959
        <batchtest fork="yes" todir="${build.dir}">
960 1116 tao
          <fileset dir="${build.metacatnettest}">
961
            <include name="**/*.class" />
962 1103 tao
          </fileset>
963
        </batchtest>
964
     </junit>
965 1311 berkley
   </target>
966 1103 tao
967 1939 brooke
   <target name="cleanweb" depends="clean"
968
            description="deletes tomcat web context dir and all its contents">
969 1522 berkley
     <delete dir="${installdir}" />
970
   </target>
971
972
973 1939 brooke
   <target name="clean" depends="init"
974 2320 jones
            description="deletes build dir and files that can be regenerated form the release">
975 822 jones
       <delete dir="${build.dir}" />
976 2737 jones
       <delete dir="${dist.dir}" />
977 2320 jones
   </target>
978
979 4098 daigle
	<target name="localclean" depends="clean"
980
	            description="deletes even jars that depend on external sources such as stylesheets and jars">
981
	       <delete file="lib/httpclient.jar" />
982
	       <delete file="lib/utilities.jar" />
983
	</target>
984
985
   <target name="fullclean" depends="localclean"
986
            description="deletes code and eml">
987 1939 brooke
       <delete includeEmptyDirs="true" failonerror="false">
988
         <fileset dir="${style-common-cvsrelpath}">
989
           <include name="${eml-css}" />
990
           <include name="eml-*/*.xsl" />
991
           <include name="eml-*" />
992
         </fileset>
993 4080 daigle
       	 <fileset dir="${schema-cvsrelpath}">
994
       	   <include name="eml-*/*.xsd" />
995
       	 </fileset>
996 2320 jones
       </delete>
997 113 jones
   </target>
998
999 1939 brooke
   <target name="jdoc" depends="prepare"
1000
            description="generates javadoc documentation">
1001 822 jones
       <javadoc packagenames="edu.ucsb.nceas.*"
1002 516 jones
           sourcepath="${build.src}"
1003
           destdir="${build.javadocs}"
1004 113 jones
           author="true"
1005
           version="true"
1006
           use="true"
1007 348 jones
           windowtitle="${Name} API"
1008
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1009 2599 jones
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1010
         <classpath>
1011
           <path refid="compile.classpath"/>
1012
         </classpath>
1013
       </javadoc>
1014 113 jones
   </target>
1015
1016 2461 sgarg
   <target name="dist"
1017 2965 tao
       depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1018 1939 brooke
            description="prepares a full release distribution">
1019 806 jones
      <mkdir dir="${dist.dir}"/>
1020
      <delete dir="${ver.dir}" />
1021
      <mkdir dir="${ver.dir}"/>
1022
      <copy todir="${ver.dir}">
1023 1311 berkley
        <fileset dir="."
1024 2401 costa
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1025 806 jones
      </copy>
1026
      <copy todir="${ver.dir}" file="build.xml"/>
1027 2317 jones
      <copy todir="${ver.dir}" file="build.properties"/>
1028 882 jones
1029
      <copy todir="${ver.dir}/docs" filtering="yes">
1030
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1031
      </copy>
1032
      <copy todir="${ver.dir}/docs" filtering="no">
1033
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1034
      </copy>
1035 806 jones
      <copy todir="${ver.dir}/docs/dev">
1036
        <fileset dir="${build.dir}/docs"/>
1037
      </copy>
1038 917 berkley
      <copy todir="${ver.dir}/src">
1039
        <fileset dir="${build.dir}/src"/>
1040
      </copy>
1041 2391 tao
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1042 4118 daigle
      <!-- copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/ -->
1043
      <!-- copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/ -->
1044 2323 jones
      <!--
1045 992 berkley
      <delete dir="./${ver.dir}/${build.dir}"/>
1046
      <delete dir="./${ver.dir}/dist"/>
1047 2323 jones
      -->
1048 882 jones
      <delete file="./${name}-${release}.zip"/>
1049 1312 tao
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1050 882 jones
      <delete file="./${name}-${release}.tar.gz" />
1051 1312 tao
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1052 1311 berkley
      <gzip zipfile="./${name}-${release}.tar.gz"
1053 882 jones
                src="./${name}-${release}.tar"/>
1054
      <delete file="./${name}-${release}.tar" />
1055 1311 berkley
  </target>
1056 806 jones
1057 1939 brooke
  <target name="distsrc" depends="dist"
1058
            description="prepares a source distribution">
1059 806 jones
      <mkdir dir="${ver.src}"/>
1060
      <copy todir="${ver.src}">
1061
        <fileset dir="./src"/>
1062
      </copy>
1063 2461 sgarg
      <mkdir dir="${util.dir}"/>
1064
      <copy todir="${util.dir}">
1065
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1066
      </copy>
1067 2965 tao
1068
  	  <mkdir dir="${ecogrid-dist-dir}"/>
1069
  	  <copy todir="${ecogrid-dist-dir}">
1070
  	        <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1071
  	  </copy>
1072 806 jones
1073 3131 perry
      <delete file="${ver.dir}/lib/utilities.jar"/>
1074
1075 882 jones
      <delete file="./${name}-src-${release}.zip"/>
1076
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1077
      <delete file="./${name}-src-${release}.tar.gz" />
1078
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1079 1311 berkley
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1080 882 jones
                src="./${name}-src-${release}.tar"/>
1081
      <delete file="./${name}-src-${release}.tar" />
1082 3131 perry
      <delete dir="${dist.dir}"/>
1083 1311 berkley
  </target>
1084 806 jones
1085 1702 tao
   <target name="stylesheettest">
1086 1939 brooke
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1087 1702 tao
      <param name="displaymodule" expression="${displaymodule}"/>
1088
      <param name="docid" expression="${input}"/>
1089
      <param name="entitytype" expression="${entitytype}"/>
1090
      <param name="entityindex" expression="${entityindex}"/>
1091
      <outputproperty name="method" value="html"/>
1092
      <outputproperty name="standalone" value="yes"/>
1093
      <outputproperty name="encoding" value="iso8859_1"/>
1094
      <outputproperty name="indent" value="yes"/>
1095
    </xslt>
1096
  </target>
1097 2175 tao
1098 3210 tao
1099 1814 tao
  <target name="compilewebclient" depends="prepare">
1100
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1101
  </target>
1102 2175 tao
1103 1814 tao
  <target name="runwebclient" depends="compilewebclient">
1104 2175 tao
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1105 1814 tao
           dir="${build.dest}" fork="yes"
1106
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1107
         <arg value="${serviceUrl}"/>
1108
         <arg value="${docid}"/>
1109
     </java>
1110
  </target>
1111 2598 harris
1112 2639 harris
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1113 2598 harris
1114
    <echo message="Compiling the metatcat shapefile creator"/>
1115
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1116
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1117
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1118
    </exec>
1119
1120
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1121 2639 harris
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1122 2598 harris
    </exec>
1123
  </target>
1124
1125 2737 jones
    <!-- LSID Authority support -->
1126
    <patternset id="lsid.jars">
1127
        <include name="axis.jar" />
1128 2772 jones
        <include name="commons-discovery-0.2.jar" />
1129 2737 jones
        <include name="jaxrpc.jar" />
1130
        <include name="lsid-client-1.1.1.jar" />
1131
        <include name="lsid-server-1.1.1.jar" />
1132
        <include name="saaj.jar" />
1133 2772 jones
        <include name="wsdl4j-1.5.1.jar" />
1134 2737 jones
        <include name="activation.jar" />
1135
        <include name="castor-0.9.5.jar" />
1136
        <include name="dnsjava-1.3.2.jar" />
1137
        <include name="mail.jar" />
1138 2778 jones
        <include name="commons-logging-1.0.4.jar" />
1139
        <!-- These jars may be needed but seem to not actually be,
1140
             so leaving them out for now
1141
        <include name="axis-ant.jar" />
1142 2737 jones
        -->
1143
        <!--<include name="GenCastor.class" />-->
1144
    </patternset>
1145
    <patternset id="lib.jars">
1146
        <include name="httpclient.jar" />
1147
        <include name="log4j-1.2.12.jar" />
1148
        <include name="utilities.jar" />
1149
        <include name="xercesImpl.jar" />
1150
        <include name="xalan.jar" />
1151
        <include name="xml-apis.jar" />
1152
    </patternset>
1153
1154
    <path id="lsid.classpath">
1155
        <fileset dir="${lsid.lib.dir}">
1156
            <patternset refid="lsid.jars"/>
1157
        </fileset>
1158
        <fileset dir="${lib.dir}">
1159
            <patternset refid="lsid.jars"/>
1160
        </fileset>
1161 3059 berkley
        <fileset dir="${lib.dir}">
1162 2737 jones
            <include name="xalan.jar" />
1163
            <include name="xml-apis.jar" />
1164
        </fileset>
1165
        <fileset dir="${build.dir}">
1166
            <include name="metacat-client.jar" />
1167
        </fileset>
1168
    </path>
1169
1170
    <filterset id="configFilters">
1171 4080 daigle
        <!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1172
                value="${config.hostname}" / -->
1173
        <!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1174
                value="${config.port}" / -->
1175
        <!-- MCD BYE filter token="METADATA_LABELS"
1176
                value="${config.metadataLabelLsid}" / -->
1177
        <!-- MCD BYE filter token="METACAT_SERVER"
1178
                value="${config.metacatserver}" / -->
1179
        <!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1180
                value="${config.lsidauthority}" / -->
1181 2737 jones
    </filterset>
1182
1183
    <target name="prepare-lsid"
1184
            depends="prepare,utilities,clientjar"
1185
            description="Configure files prior to compilation">
1186
        <mkdir dir="${lsid.build.dir}" />
1187
        <!-- Copy the properties file into the build -->
1188
        <copy file="${conf.dir}/metacat-lsid.properties"
1189
              tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1190
              overwrite="true">
1191
            <filterset refid="configFilters" />
1192
        </copy>
1193 2817 jones
        <copy file="${conf.dir}/log4j.properties"
1194
              tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1195
              overwrite="true">
1196
            <filterset refid="configFilters" />
1197
        </copy>
1198 2737 jones
        <!-- Copy config files into the build -->
1199
        <copy todir="${lsid.build.dir}/WEB-INF">
1200
            <fileset dir="${webinf.dir}"
1201
                     includes="**/*.wsdd" />
1202
        </copy>
1203
        <!-- Copy the metadata configuration files into the build -->
1204
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1205
        <copy todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1206
            <fileset dir="${conf.dir}"
1207
                     includes="**/*.xml" />
1208
            <fileset dir="${conf.dir}"
1209
                     includes="**/*.xslt" />
1210
            <filterset refid="configFilters" />
1211
        </copy>
1212
        <!-- Copy services files into the build -->
1213
        <mkdir dir="${lsid.build.dir}/services" />
1214
        <copy todir="${lsid.build.dir}/services">
1215
            <fileset dir="${services.dir}" />
1216
            <filterset refid="configFilters" />
1217
        </copy>
1218 2778 jones
        <!-- Copy axis files into the build -->
1219
        <mkdir dir="${lsid.build.dir}" />
1220
        <copy todir="${lsid.build.dir}">
1221
            <fileset dir="${conf.dir}/axis"
1222
                     excludes="*.properties"/>
1223
        </copy>
1224
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1225
        <copy todir="${lsid.build.dir}/WEB-INF/classes">
1226
            <fileset dir="${conf.dir}/axis"
1227
                     includes="*.properties"/>
1228
        </copy>
1229 2737 jones
    </target>
1230
1231
    <target name="compile-lsid"
1232
            depends="prepare-lsid"
1233
            description="Compile Java sources">
1234
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1235
        <javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1236
               destdir="${lsid.build.dir}/WEB-INF/classes"
1237
               debug="${compile.debug}"
1238
               deprecation="${compile.deprecation}"
1239
               optimize="${compile.optimize}">
1240
            <classpath refid="lsid.classpath" />
1241
        </javac>
1242
    </target>
1243
1244
    <target name="war-lsid"
1245
            depends="compile-lsid"
1246
            description="Create a war file for the application">
1247
        <mkdir dir="${dist.dir}" />
1248
        <war destfile="${dist.dir}/${authority.context}.war"
1249
             webxml="${webinf.dir}/web.xml">
1250
            <fileset dir="${lsid.build.dir}" />
1251
            <lib dir="${lsid.lib.dir}">
1252
                <patternset refid="lsid.jars"/>
1253
            </lib>
1254
            <lib dir="${lib.dir}">
1255
                <patternset refid="lib.jars"/>
1256
            </lib>
1257 3059 berkley
            <lib dir="${lib.dir}">
1258 2737 jones
                <include name="xalan.jar" />
1259
                <include name="xml-apis.jar" />
1260
            </lib>
1261
            <lib dir="${build.dir}">
1262
                <include name="metacat-client.jar" />
1263
            </lib>
1264
        </war>
1265
    </target>
1266
1267
    <target name="deploy-lsid"
1268
            depends="war-lsid"
1269
            description="Deploy LSID war to servlet container">
1270 4080 daigle
        <delete dir="${dev.deploy.dir}/${authority.context}" />
1271
        <delete file="${dev.deploy.dir}/${authority.context}.war" />
1272
        <mkdir dir="${dev.deploy.dir}" />
1273
        <copy todir="${dev.deploy.dir}">
1274 2737 jones
            <fileset dir="${dist.dir}" />
1275
        </copy>
1276
    </target>
1277 113 jones
</project>