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