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
837 971 tao
      <!-- copy and compile the tests into a jar file -->
838 1783 jones
      <javac srcdir="${build.tests}"
839
             destdir="${build.tests}"
840 1612 tao
             debug="on"
841 2982 jones
             includes="**/*.java">
842 2599 jones
        <classpath>
843
          <path refid="compile.classpath"/>
844
          <fileset dir="${build.dir}">
845 2982 jones
            <include name="${name}.jar"/>
846
            <include name="${name}-client.jar"/>
847
            <include name="harvester.jar"/>
848 2599 jones
          </fileset>
849
        </classpath>
850
      </javac>
851 204 jones
852 1311 berkley
      <jar jarfile="${build.dir}/${name}-junittests.jar"
853 1783 jones
        basedir="${build.tests}"
854 1311 berkley
                includes="**/*.class" />
855 1822 jones
   </target>
856 971 tao
857 1939 brooke
   <target name="test" depends="testprep"
858
            description="Uses the ant junit task to run all JUnit tests">
859 1822 jones
860 971 tao
      <!-- use the ant "junit" task to run JUnit tests. -->
861 1783 jones
      <junit printsummary="yes" haltonfailure="no" fork="yes"
862 971 tao
             haltonerror="no">
863 1783 jones
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
864 971 tao
        <classpath>
865 2599 jones
          <path refid="compile.classpath"/>
866
          <fileset dir="${build.dir}">
867 2982 jones
            <include name="${name}.jar"/>
868
            <include name="${name}-client.jar"/>
869
            <include name="harvester.jar"/>
870
            <include name="${name}-junittests.jar"/>
871 2599 jones
          </fileset>
872 971 tao
        </classpath>
873
874
        <formatter type="plain" />
875
876
        <batchtest fork="yes" todir="${build.dir}">
877 1783 jones
          <fileset dir="${build.tests}">
878 1116 tao
            <include name="**/*.class" />
879 4147 daigle
          	<exclude name="**/MCTestCase.class" />
880 4210 daigle
          	<exclude name="**/ClientViewHelperTest.java" />
881 971 tao
          </fileset>
882
        </batchtest>
883
     </junit>
884
   </target>
885 1103 tao
886 1939 brooke
    <target name="runonetest" depends="testprep"
887
            description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
888 1500 tao
889 1939 brooke
              <echo>testtorun: ${testtorun}</echo>
890
891 1500 tao
      <!-- use the ant "junit" task to run JUnit tests. -->
892 1783 jones
      <junit printsummary="yes" haltonfailure="no" fork="yes"
893 3747 tao
             haltonerror="no" showoutput="yes">
894 2044 tao
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
895 1500 tao
        <classpath>
896 2599 jones
          <path refid="compile.classpath"/>
897
          <fileset dir="${build.dir}">
898 2982 jones
            <include name="${name}.jar"/>
899
            <include name="${name}-client.jar"/>
900
            <include name="harvester.jar"/>
901
            <include name="${name}-junittests.jar"/>
902 2599 jones
          </fileset>
903 1500 tao
        </classpath>
904
905
        <formatter type="plain" />
906
907
        <batchtest fork="yes" todir="${build.dir}">
908 1783 jones
          <fileset dir="${build.tests}">
909 1500 tao
            <include name="**/${testtorun}.class" />
910
          </fileset>
911
        </batchtest>
912
     </junit>
913
   </target>
914
915 2175 tao
   <target name="testharvester"
916 2135 costa
           depends="testprep"
917
           description="Uses the ant junit task to test only the Harvester code">
918 2175 tao
     <junit printsummary="yes"
919
            haltonfailure="off"
920 2135 costa
            fork="yes"
921
            haltonerror="off">
922 2599 jones
        <classpath>
923
          <path refid="compile.classpath"/>
924
          <fileset dir="${build.dir}">
925 2982 jones
            <include name="${name}.jar"/>
926
            <include name="${name}-client.jar"/>
927
            <include name="harvester.jar"/>
928
            <include name="${name}-junittests.jar"/>
929 2599 jones
          </fileset>
930
        </classpath>
931 2135 costa
       <formatter type="plain" />
932
       <batchtest fork="yes" todir="${build.dir}">
933
         <fileset dir="${build.tests}">
934
           <include name="**/harvesterClient/*.class" />
935
         </fileset>
936
       </batchtest>
937
     </junit>
938
   </target>
939
940 1939 brooke
  <target name="gethttpclient" depends="prepare"
941
            description="checks out and compiles morpho httpclient code">
942 1311 berkley
  <!--mkdir dir="${morphosourcedir}" -->
943 1487 tao
        <cvs cvsRoot="${cvsroot}"
944 1103 tao
             package="morpho"
945
             dest="." />
946 1107 tao
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
947 1103 tao
   </target>
948
949
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
950 4080 daigle
   <target name="nettest" depends="dev-install"
951 1939 brooke
            description="compiles and runs the metacatnettest code">
952 2175 tao
953 1103 tao
      <echo>***********************************
954 1311 berkley
      Please run ant gethttpclient first!
955
      ***********************************
956 1103 tao
      </echo>
957
      <!-- copy and compile the tests into a jar file -->
958 1116 tao
      <mkdir dir="${build.metacatnettest}"/>
959 1103 tao
      <javac srcdir="${junitnettestsdir}"
960 1116 tao
             destdir="${build.metacatnettest}"
961 2599 jones
             includes="**/*.java">
962
        <classpath>
963
          <path refid="compile.classpath"/>
964
          <fileset dir="${build.dir}">
965 2982 jones
            <include name="${name}.jar"/>
966 2599 jones
          </fileset>
967
        </classpath>
968
      </javac>
969 1103 tao
970
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
971 1116 tao
                    basedir="${build.metacatnettest}"
972 1103 tao
                    includes="**/*.class" />
973
974
      <!-- use the ant "junit" task to run JUnit tests. -->
975 1107 tao
      <junit printsummary="yes" haltonfailure="no" fork="yes"
976 1103 tao
             haltonerror="no">
977 1107 tao
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
978 1103 tao
        <classpath>
979 2599 jones
          <path refid="compile.classpath"/>
980
          <fileset dir="${build.dir}">
981 2982 jones
            <include name="${name}.jar"/>
982
            <include name="${name}-junitnettests.jar"/>
983 2599 jones
          </fileset>
984 1103 tao
        </classpath>
985
986
        <formatter type="plain" />
987
988
        <batchtest fork="yes" todir="${build.dir}">
989 1116 tao
          <fileset dir="${build.metacatnettest}">
990
            <include name="**/*.class" />
991 1103 tao
          </fileset>
992
        </batchtest>
993
     </junit>
994 1311 berkley
   </target>
995 1103 tao
996 1939 brooke
   <target name="cleanweb" depends="clean"
997
            description="deletes tomcat web context dir and all its contents">
998 1522 berkley
     <delete dir="${installdir}" />
999
   </target>
1000
1001
1002 1939 brooke
   <target name="clean" depends="init"
1003 2320 jones
            description="deletes build dir and files that can be regenerated form the release">
1004 822 jones
       <delete dir="${build.dir}" />
1005 2737 jones
       <delete dir="${dist.dir}" />
1006 2320 jones
   </target>
1007
1008 4098 daigle
	<target name="localclean" depends="clean"
1009
	            description="deletes even jars that depend on external sources such as stylesheets and jars">
1010
	       <delete file="lib/httpclient.jar" />
1011
	       <delete file="lib/utilities.jar" />
1012
	</target>
1013
1014
   <target name="fullclean" depends="localclean"
1015
            description="deletes code and eml">
1016 1939 brooke
       <delete includeEmptyDirs="true" failonerror="false">
1017
         <fileset dir="${style-common-cvsrelpath}">
1018
           <include name="${eml-css}" />
1019
           <include name="eml-*/*.xsl" />
1020
           <include name="eml-*" />
1021
         </fileset>
1022 4080 daigle
       	 <fileset dir="${schema-cvsrelpath}">
1023
       	   <include name="eml-*/*.xsd" />
1024
       	 </fileset>
1025 2320 jones
       </delete>
1026 113 jones
   </target>
1027
1028 1939 brooke
   <target name="jdoc" depends="prepare"
1029
            description="generates javadoc documentation">
1030 822 jones
       <javadoc packagenames="edu.ucsb.nceas.*"
1031 516 jones
           sourcepath="${build.src}"
1032
           destdir="${build.javadocs}"
1033 113 jones
           author="true"
1034
           version="true"
1035
           use="true"
1036 348 jones
           windowtitle="${Name} API"
1037
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
1038 2599 jones
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
1039
         <classpath>
1040
           <path refid="compile.classpath"/>
1041
         </classpath>
1042
       </javadoc>
1043 113 jones
   </target>
1044
1045 2461 sgarg
   <target name="dist"
1046 2965 tao
       depends="geteml,get-ecogrid,jar,protocol,jdoc,getConversionXSL,getutilities"
1047 1939 brooke
            description="prepares a full release distribution">
1048 806 jones
      <mkdir dir="${dist.dir}"/>
1049
      <delete dir="${ver.dir}" />
1050
      <mkdir dir="${ver.dir}"/>
1051
      <copy todir="${ver.dir}">
1052 1311 berkley
        <fileset dir="."
1053 2401 costa
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
1054 806 jones
      </copy>
1055
      <copy todir="${ver.dir}" file="build.xml"/>
1056 2317 jones
      <copy todir="${ver.dir}" file="build.properties"/>
1057 882 jones
1058
      <copy todir="${ver.dir}/docs" filtering="yes">
1059
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
1060
      </copy>
1061
      <copy todir="${ver.dir}/docs" filtering="no">
1062
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
1063
      </copy>
1064 806 jones
      <copy todir="${ver.dir}/docs/dev">
1065
        <fileset dir="${build.dir}/docs"/>
1066
      </copy>
1067 917 berkley
      <copy todir="${ver.dir}/src">
1068
        <fileset dir="${build.dir}/src"/>
1069
      </copy>
1070 2391 tao
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1071 4118 daigle
      <!-- copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/ -->
1072
      <!-- copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/ -->
1073 2323 jones
      <!--
1074 992 berkley
      <delete dir="./${ver.dir}/${build.dir}"/>
1075
      <delete dir="./${ver.dir}/dist"/>
1076 2323 jones
      -->
1077 882 jones
      <delete file="./${name}-${release}.zip"/>
1078 1312 tao
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1079 882 jones
      <delete file="./${name}-${release}.tar.gz" />
1080 1312 tao
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1081 1311 berkley
      <gzip zipfile="./${name}-${release}.tar.gz"
1082 882 jones
                src="./${name}-${release}.tar"/>
1083
      <delete file="./${name}-${release}.tar" />
1084 1311 berkley
  </target>
1085 806 jones
1086 1939 brooke
  <target name="distsrc" depends="dist"
1087
            description="prepares a source distribution">
1088 806 jones
      <mkdir dir="${ver.src}"/>
1089
      <copy todir="${ver.src}">
1090
        <fileset dir="./src"/>
1091
      </copy>
1092 2461 sgarg
      <mkdir dir="${util.dir}"/>
1093
      <copy todir="${util.dir}">
1094
        <fileset dir="${build.tmp}/utilities" excludes="**/CVS*" />
1095
      </copy>
1096 2965 tao
1097
  	  <mkdir dir="${ecogrid-dist-dir}"/>
1098
  	  <copy todir="${ecogrid-dist-dir}">
1099
  	        <fileset dir="${ecogrid-dir}" excludes="**/CVS*" />
1100
  	  </copy>
1101 806 jones
1102 3131 perry
      <delete file="${ver.dir}/lib/utilities.jar"/>
1103
1104 882 jones
      <delete file="./${name}-src-${release}.zip"/>
1105
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1106
      <delete file="./${name}-src-${release}.tar.gz" />
1107
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1108 1311 berkley
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1109 882 jones
                src="./${name}-src-${release}.tar"/>
1110
      <delete file="./${name}-src-${release}.tar" />
1111 3131 perry
      <delete dir="${dist.dir}"/>
1112 1311 berkley
  </target>
1113 806 jones
1114 1702 tao
   <target name="stylesheettest">
1115 1939 brooke
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1116 1702 tao
      <param name="displaymodule" expression="${displaymodule}"/>
1117
      <param name="docid" expression="${input}"/>
1118
      <param name="entitytype" expression="${entitytype}"/>
1119
      <param name="entityindex" expression="${entityindex}"/>
1120
      <outputproperty name="method" value="html"/>
1121
      <outputproperty name="standalone" value="yes"/>
1122
      <outputproperty name="encoding" value="iso8859_1"/>
1123
      <outputproperty name="indent" value="yes"/>
1124
    </xslt>
1125
  </target>
1126 2175 tao
1127 3210 tao
1128 1814 tao
  <target name="compilewebclient" depends="prepare">
1129
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1130
  </target>
1131 2175 tao
1132 1814 tao
  <target name="runwebclient" depends="compilewebclient">
1133 2175 tao
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1134 1814 tao
           dir="${build.dest}" fork="yes"
1135
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1136
         <arg value="${serviceUrl}"/>
1137
         <arg value="${docid}"/>
1138
     </java>
1139
  </target>
1140 2598 harris
1141 2639 harris
  <target name="spatial_option" depends="prepare" description=" -- compiles code for the spatial option">
1142 2598 harris
1143
    <echo message="Compiling the metatcat shapefile creator"/>
1144
    <echo message="using the shapelib at: ${shapelib.dir}"/>
1145
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1146
     <arg line="./src/spatial/cpp/metacat_shapefile.cpp -I ${shapelib.dir} -c -o build/metacat_shapefile.o" />
1147
    </exec>
1148
1149
    <exec dir="." executable="g++" os="Linux, Unix" failonerror="true">
1150 2639 harris
     <arg line="build/metacat_shapefile.o ${shapelib.dir}/.libs/libshp.a -o bin/metacat_shapefile" />
1151 2598 harris
    </exec>
1152
  </target>
1153
1154 2737 jones
    <!-- LSID Authority support -->
1155
    <patternset id="lsid.jars">
1156
        <include name="axis.jar" />
1157 2772 jones
        <include name="commons-discovery-0.2.jar" />
1158 2737 jones
        <include name="jaxrpc.jar" />
1159
        <include name="lsid-client-1.1.1.jar" />
1160
        <include name="lsid-server-1.1.1.jar" />
1161
        <include name="saaj.jar" />
1162 2772 jones
        <include name="wsdl4j-1.5.1.jar" />
1163 2737 jones
        <include name="activation.jar" />
1164
        <include name="castor-0.9.5.jar" />
1165
        <include name="dnsjava-1.3.2.jar" />
1166
        <include name="mail.jar" />
1167 2778 jones
        <include name="commons-logging-1.0.4.jar" />
1168
        <!-- These jars may be needed but seem to not actually be,
1169
             so leaving them out for now
1170
        <include name="axis-ant.jar" />
1171 2737 jones
        -->
1172
        <!--<include name="GenCastor.class" />-->
1173
    </patternset>
1174
    <patternset id="lib.jars">
1175
        <include name="httpclient.jar" />
1176
        <include name="log4j-1.2.12.jar" />
1177
        <include name="utilities.jar" />
1178
        <include name="xercesImpl.jar" />
1179
        <include name="xalan.jar" />
1180
        <include name="xml-apis.jar" />
1181
    </patternset>
1182
1183
    <path id="lsid.classpath">
1184
        <fileset dir="${lsid.lib.dir}">
1185
            <patternset refid="lsid.jars"/>
1186
        </fileset>
1187
        <fileset dir="${lib.dir}">
1188
            <patternset refid="lsid.jars"/>
1189
        </fileset>
1190 3059 berkley
        <fileset dir="${lib.dir}">
1191 2737 jones
            <include name="xalan.jar" />
1192
            <include name="xml-apis.jar" />
1193
        </fileset>
1194
        <fileset dir="${build.dir}">
1195
            <include name="metacat-client.jar" />
1196
        </fileset>
1197
    </path>
1198
1199
    <filterset id="configFilters">
1200 4080 daigle
        <!-- MCD BYE filter token="LSID_AUTHORITY_HOSTNAME"
1201
                value="${config.hostname}" / -->
1202
        <!-- MCD BYE filter token="LSID_AUTHORITY_PORT"
1203
                value="${config.port}" / -->
1204
        <!-- MCD BYE filter token="METADATA_LABELS"
1205
                value="${config.metadataLabelLsid}" / -->
1206
        <!-- MCD BYE filter token="METACAT_SERVER"
1207
                value="${config.metacatserver}" / -->
1208
        <!-- MCD BYE filter token="LSID_AUTHORITY_STRING"
1209
                value="${config.lsidauthority}" / -->
1210 2737 jones
    </filterset>
1211
1212
    <target name="prepare-lsid"
1213
            depends="prepare,utilities,clientjar"
1214
            description="Configure files prior to compilation">
1215
        <mkdir dir="${lsid.build.dir}" />
1216
        <!-- Copy the properties file into the build -->
1217
        <copy file="${conf.dir}/metacat-lsid.properties"
1218
              tofile="${lsid.build.dir}/WEB-INF/classes/metacat-lsid.properties"
1219
              overwrite="true">
1220
            <filterset refid="configFilters" />
1221
        </copy>
1222 2817 jones
        <copy file="${conf.dir}/log4j.properties"
1223
              tofile="${lsid.build.dir}/WEB-INF/classes/log4j.properties"
1224
              overwrite="true">
1225
            <filterset refid="configFilters" />
1226
        </copy>
1227 2737 jones
        <!-- Copy config files into the build -->
1228
        <copy todir="${lsid.build.dir}/WEB-INF">
1229
            <fileset dir="${webinf.dir}"
1230
                     includes="**/*.wsdd" />
1231
        </copy>
1232
        <!-- Copy the metadata configuration files into the build -->
1233
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}" />
1234
        <copy todir="${lsid.build.dir}/WEB-INF/classes/${lsid.classes.dir}">
1235
            <fileset dir="${conf.dir}"
1236
                     includes="**/*.xml" />
1237
            <fileset dir="${conf.dir}"
1238
                     includes="**/*.xslt" />
1239
            <filterset refid="configFilters" />
1240
        </copy>
1241
        <!-- Copy services files into the build -->
1242
        <mkdir dir="${lsid.build.dir}/services" />
1243
        <copy todir="${lsid.build.dir}/services">
1244
            <fileset dir="${services.dir}" />
1245
            <filterset refid="configFilters" />
1246
        </copy>
1247 2778 jones
        <!-- Copy axis files into the build -->
1248
        <mkdir dir="${lsid.build.dir}" />
1249
        <copy todir="${lsid.build.dir}">
1250
            <fileset dir="${conf.dir}/axis"
1251
                     excludes="*.properties"/>
1252
        </copy>
1253
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1254
        <copy todir="${lsid.build.dir}/WEB-INF/classes">
1255
            <fileset dir="${conf.dir}/axis"
1256
                     includes="*.properties"/>
1257
        </copy>
1258 2737 jones
    </target>
1259
1260
    <target name="compile-lsid"
1261
            depends="prepare-lsid"
1262
            description="Compile Java sources">
1263
        <mkdir dir="${lsid.build.dir}/WEB-INF/classes" />
1264
        <javac srcdir="src/edu/ucsb/nceas/metacat/lsid"
1265
               destdir="${lsid.build.dir}/WEB-INF/classes"
1266
               debug="${compile.debug}"
1267
               deprecation="${compile.deprecation}"
1268
               optimize="${compile.optimize}">
1269
            <classpath refid="lsid.classpath" />
1270
        </javac>
1271
    </target>
1272
1273
    <target name="war-lsid"
1274
            depends="compile-lsid"
1275
            description="Create a war file for the application">
1276
        <mkdir dir="${dist.dir}" />
1277
        <war destfile="${dist.dir}/${authority.context}.war"
1278
             webxml="${webinf.dir}/web.xml">
1279
            <fileset dir="${lsid.build.dir}" />
1280
            <lib dir="${lsid.lib.dir}">
1281
                <patternset refid="lsid.jars"/>
1282
            </lib>
1283
            <lib dir="${lib.dir}">
1284
                <patternset refid="lib.jars"/>
1285
            </lib>
1286 3059 berkley
            <lib dir="${lib.dir}">
1287 2737 jones
                <include name="xalan.jar" />
1288
                <include name="xml-apis.jar" />
1289
            </lib>
1290
            <lib dir="${build.dir}">
1291
                <include name="metacat-client.jar" />
1292
            </lib>
1293
        </war>
1294
    </target>
1295
1296
    <target name="deploy-lsid"
1297
            depends="war-lsid"
1298
            description="Deploy LSID war to servlet container">
1299 4080 daigle
        <delete dir="${dev.deploy.dir}/${authority.context}" />
1300
        <delete file="${dev.deploy.dir}/${authority.context}.war" />
1301
        <mkdir dir="${dev.deploy.dir}" />
1302
        <copy todir="${dev.deploy.dir}">
1303 2737 jones
            <fileset dir="${dist.dir}" />
1304
        </copy>
1305
    </target>
1306 113 jones
</project>