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
36
  <target name="check-db">
37 2393 tao
    <property name="upgrade-1.5-sql"
38
               value="upgrade-db-to-1.5.sql" />
39 1929 brooke
    <condition property="use-oracle">
40
      <equals arg1="${database}" arg2="oracle" />
41
    </condition>
42
    <condition property="use-postgresql">
43
      <equals arg1="${database}" arg2="postgresql" />
44
    </condition>
45
    <condition property="use-sqlserver">
46
      <equals arg1="${database}" arg2="sqlserver" />
47
    </condition>
48
  </target>
49
50
  <target name="oracle" if="use-oracle">
51 931 jones
     <!-- Customize these properties if you are using oracle -->
52 1929 brooke
     <echo message="Using oracle..."/>
53 925 berkley
     <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
54
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
55 1929 brooke
     <property name="jdbc" value="${jdbc_base}/classes111.zip" />
56 1744 tao
     <!-- Property to indicate is not MSSQL installation-->
57
     <property name="other" value="yes"/>
58 2175 tao
     <property name="install-sql"
59 2103 jones
               value="xmltables.sql" />
60 2175 tao
     <property name="upgrade-1.2-sql"
61 2103 jones
               value="upgrade-db-to-1.2.sql" />
62 2175 tao
     <property name="upgrade-1.3-sql"
63 2103 jones
               value="upgrade-db-to-1.3.sql" />
64 2175 tao
     <property name="upgrade-1.4-sql"
65 2103 jones
               value="upgrade-db-to-1.4.sql" />
66 2393 tao
67 925 berkley
   </target>
68 1311 berkley
69 1929 brooke
   <target name="postgresql" if="use-postgresql">
70 931 jones
     <!-- Customize these properties if you are using postgres -->
71 1929 brooke
     <echo message="Using PostgreSQL..."/>
72 925 berkley
     <property name="dbDriver" value="org.postgresql.Driver"/>
73 1311 berkley
     <property name="dbAdapter"
74 931 jones
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
75 1716 berkley
     <property name="jdbc" value="lib/jdbc7.1-1.2.jar" />
76 1744 tao
     <!-- Property to indicate is not MSSQL installation-->
77
     <property name="other" value="yes"/>
78 2175 tao
     <property name="install-sql"
79 2277 jones
               value="xmltables-postgres.sql" />
80 2175 tao
     <property name="upgrade-1.2-sql"
81 2277 jones
               value="upgrade-db-to-1.2-postgres.sql" />
82 2175 tao
     <property name="upgrade-1.3-sql"
83 2277 jones
               value="upgrade-db-to-1.3-postgres.sql" />
84 2175 tao
     <property name="upgrade-1.4-sql"
85 2277 jones
               value="upgrade-db-to-1.4-postgres.sql" />
86 1744 tao
    </target>
87 2175 tao
88 1929 brooke
   <target name="sqlserver" if="use-sqlserver">
89 1739 tao
     <!-- Customize these properties if you are using SQL server -->
90 1929 brooke
     <echo message="Using SQL Server..."/>
91 1739 tao
     <property name="dbDriver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
92
     <property name="dbAdapter"
93
               value="edu.ucsb.nceas.dbadapter.SqlserverAdapter"/>
94 2296 sgarg
     <property name="jdbc" value="${jdbc_base}/msbase.jar" />
95
     <property name="jdbc-add1" value="${jdbc_base}/msutil.jar" />
96
     <property name="jdbc-add2" value="${jdbc_base}/mssqlserver.jar" />
97 1744 tao
     <!-- Property to indicate is a MSSQL installation-->
98
     <property name="MSSQL" value="yes"/>
99 2175 tao
     <property name="install-sql"
100 2118 costa
               value="xmltables-sqlserver.sql" />
101 1739 tao
   </target>
102 1311 berkley
103 1929 brooke
   <target name="config" depends="check-db,oracle,postgresql,sqlserver">
104 1814 tao
      <!-- usr for client testing, generally you don't need change-->
105 2277 jones
      <property name="mcuser" value="uid=jones,o=NCEAS,dc=ecoinformatics,dc=org"/>
106 1783 jones
      <property name="mcpassword" value=""/>
107 1801 tao
      <property name="mcanotheruser" value="uid=jtao,o=LTER,dc=ecoinformatics,dc=org"/>
108
      <property name="mcanotherpassword" value=""/>
109
110 1827 jones
      <property name="debug" value="on" />
111 2053 sgarg
      <property name="debuglevel" value="55" />
112 1716 berkley
113 1522 berkley
      <property name="morphosourcedir" value="../morpho" />
114 1570 tao
      <property name="defaultcontenttype" value="application/octet-stream" />
115 1780 jones
      <property name="utilitiesdir" value="../utilities" />
116 2175 tao
117 931 jones
      <!-- Make sure these paths match the location of the jar files
118
           on your system, the defaults should usually work -->
119 1941 brooke
      <condition property="jsdk" value="${tomcat}/lib/common/servlet.jar">
120
        <equals arg1="${tomcatversion}" arg2="tomcat3" />
121
      </condition>
122
      <condition property="jsdk" value="${tomcat}/common/lib/servlet.jar">
123
        <equals arg1="${tomcatversion}" arg2="tomcat4" />
124
      </condition>
125 2011 cjones
      <condition property="jsdk" value="${tomcat}/common/lib/servlet-api.jar">
126
        <equals arg1="${tomcatversion}" arg2="tomcat5" />
127
      </condition>
128 1941 brooke
      <echo>*********** tomcatversion = ${tomcatversion}</echo>
129
      <echo>*********** set jsdk to ${jsdk}</echo>
130 1311 berkley
      <property name="xmlp"
131 1376 tao
                value="lib/xercesImpl.jar" />
132 1311 berkley
      <property name="cos"
133 931 jones
                value="lib/cos.jar" />
134 939 tao
      <property name="morpho"
135
                value="lib/morpho.jar" />
136 931 jones
      <property name="xalan"
137
                value="lib/xalan/xalan.jar" />
138
      <property name="apis"
139
                value="lib/xalan/xml-apis.jar" />
140 1103 tao
      <property name="httpclient"
141 1780 jones
                value="lib/httpclient.jar" />
142 1470 tao
      <property name="emlparser"
143
                value="lib/eml.jar" />
144
      <property name="configxml"
145
                value="lib/configxml.jar" />
146 1578 tao
      <property name="itislib"
147
                value="lib/itislib.jar" />
148 1487 tao
      <property name="emlparser"
149 2175 tao
150 1487 tao
                value="lib/eml.jar" />
151 1780 jones
      <property name="util"
152
                value="lib/utilities.jar" />
153 1103 tao
  </target>
154
155 931 jones
   <target name="init" depends="config">
156
      <!-- It is less likely you'll need to make any changes from here down,
157
           but customization is possible -->
158 1929 brooke
      <property name="installdir"          value="${webapps}/${context}" />
159
      <property name="temp-dir"            value="/tmp/${context}" />
160
      <property name="name"                value="metacat"/>
161
      <property name="Name"                value="MetaCat"/>
162
      <property name="debugprefix"         value="${Name}:"/>
163 1990 jones
      <property name="release"             value="1.4.0"/>
164 1929 brooke
      <property name="replication-path"    value="/${context}/servlet/replication"/>
165 2331 costa
      <property name="harvester-registration-login-path" value="/${context}/harvesterRegistrationLogin"/>
166
      <property name="harvester-registration-path"       value="/${context}/harvesterRegistration"/>
167 1952 jones
      <property name="servlet-path"        value="/${context}/metacat"/>
168 1929 brooke
      <property name="html-path"           value="/${context}"/>
169 2180 tao
      <property name="systemidserver"      value="http://${httpserver}"/>
170 2175 tao
      <property name="style-common-relpath"
171 1933 brooke
                                           value="/style/common"/>
172 2175 tao
      <property name="style-common-cvsrelpath"
173 1938 brooke
                                           value="lib${style-common-relpath}"/>
174 2175 tao
      <property name="style-common-fullpath"
175 1933 brooke
                                           value="/${installdir}${style-common-relpath}"/>
176 2343 sgarg
      <property name="templates.dir"       value="${style-common-fullpath}/templates"/>
177 2175 tao
      <property name="style-common-path"
178 1933 brooke
                                           value="/${context}${style-common-relpath}"/>
179 1929 brooke
      <property name="style-skins-relpath" value="/style/skins"/>
180
      <property name="style-skins-path"    value="/${context}${style-skins-relpath}"/>
181
      <property name="replication-log"     value="/tmp/metacatreplication.log"/>
182 1579 tao
      <property name="replicationerrorlog" value="/tmp/metacatreplication.err"/>
183 1929 brooke
      <property name="config-dir"          value="${webapps}/${style-skins-path}" />
184
      <property name="eml-module"          value="eml" />
185
      <property name="eml-version"         value="2.0.0beta6" />
186
      <property name="eml-tag"             value="EML_2_0_0_BETA_6_FOR_METACAT" />
187 2232 sgarg
      <property name="eml2_0_0-tag"        value="RELEASE_EML_2_0_0_UPDATE_1" />
188
      <property name="eml2_0_1-tag"        value="RELEASE_EML_2_0_1" />
189 2228 sgarg
      <property name="eml2_0_0namespace"   value="eml://ecoinformatics.org/eml-2.0.0" />
190
      <property name="eml2_0_1namespace"   value="eml://ecoinformatics.org/eml-2.0.1" />
191
      <property name="eml2_1_0namespace"   value="eml://ecoinformatics.org/eml-2.1.0" />
192 1929 brooke
      <property name="stmmlnamespace"      value="http://www.xml-cml.org/schema/stmml" />
193 1933 brooke
      <property name="eml-css"             value="eml_xsl.css"/>
194
      <property name="eml-module.default.css"
195
                                           value="default.css"/>
196 1929 brooke
      <property name="conversion-module"   value="webmdentry" />
197 348 jones
198 1929 brooke
      <!-- Config for registry variables -->
199 1933 brooke
      <property name="scope"               value="obfs"/>
200
      <property name="responseForm"        value="genericResponse.tmpl"/>
201
      <property name="entryForm"           value="entryForm.tmpl"/>
202
      <property name="guide"               value="genericGuide.tmpl"/>
203 2343 sgarg
      <property name="confirmData"         value="confirmData.tmpl"/>
204
      <property name="deleteData"          value="deleteData.tmpl"/>
205
      <property name="genericHeader"       value="genericHeader.tmpl"/>
206
      <property name="genericFooter"       value="genericFooter.tmpl"/>
207
      <property name="adminname"           value="KNB Support"/>
208
      <property name="recipient"           value="knb-software\@nceas.ucsb.edu"/>
209 1929 brooke
210 2343 sgarg
      <property name="defaultStage"        value="initregister"/>
211
      <property name="defaultHeader"       value="genericHeader.tmpl"/>
212
      <property name="defaultFooter"       value="genericFooter.tmpl"/>
213
      <property name="defaultChangePass"   value="ldapChangePass.tmpl"/>
214
      <property name="defaultResetPass"    value="ldapResetPass.tmpl"/>
215
      <property name="changePassSuccess"   value="ldapChangePassSuccess.tmpl"/>
216
      <property name="resetPassSuccess"    value="ldapResetPassSuccess.tmpl"/>
217
      <property name="registerFailed"      value="ldapRegisterFailed.tmpl"/>
218
      <property name="registerLter"        value="ldapRegisterLter.tmpl"/>
219
      <property name="registerMatch"       value="ldapRegisterMatch.tmpl"/>
220
      <property name="registerSuccess"     value="ldapRegisterSuccess.tmpl"/>
221
      <property name="register"            value="ldapRegister.tmpl"/>
222
      <property name="searchResults"       value="searchResults.tmpl"/>
223
224
      <filter token="scope"                value="${scope}"/>
225
      <filter token="responseForm"         value="${responseForm}"/>
226
      <filter token="entryForm"            value="${entryForm}"/>
227
      <filter token="guide"                value="${guide}"/>
228
      <filter token="confirmData"          value="${confirmData}"/>
229
      <filter token="deleteData"           value="${deleteData}"/>
230
      <filter token="genericHeader"        value="${genericHeader}"/>
231
      <filter token="genericFooter"        value="${genericFooter}"/>
232
      <filter token="adminname"            value="${adminname}"/>
233
      <filter token="recipient"            value="${recipient}"/>
234
235
      <filter token="ldapurl"              value="ldap.ecoinformatics.org"/>
236
      <filter token="ldapSearchBase"       value="dc=ecoinformatics,dc=org"/>
237
      <filter token="ldap_user"            value="cn=Manager,dc=ecoinformatics,dc=org"/>
238
      <filter token="ldap_password"        value="ldap_password"/>
239
      <filter token="mailhost"             value="smtp.ecoinformatics.org"/>
240
      <filter token="sender"               value="knb-software\@nceas.ucsb.edu"/>
241
      <filter token="cgiurl"               value="http://${server}/cgi-bin/ldapweb.cgi"/>
242
243 1311 berkley
      <property name="cpath"
244 1986 jones
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${cos}:${morpho}:${emlparser}:${jdbc-add1}:${jdbc-add2}:${util}:${httpclient}"/>
245 882 jones
246
      <filter token="docrooturl" value="./" />
247 2356 sgarg
      <filter token="database" value="${database}" />
248 588 berkley
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
249 882 jones
      <filter token="dbDriver" value="${dbDriver}"/>
250 915 berkley
      <filter token="dbAdapter" value="${dbAdapter}"/>
251 614 bojilova
      <filter token="install-dir" value="${installdir}"/>
252 1929 brooke
      <filter token="temp-dir" value="${temp-dir}"/>
253 586 berkley
      <filter token="server" value="${server}"/>
254 977 tao
      <filter token="systemidserver" value="${systemidserver}"/>
255 1929 brooke
      <filter token="cgi-prefix" value="${cgi-prefix}"/>
256
      <filter token="ldapUrl" value="${ldapUrl}"/>
257 586 berkley
      <filter token="replication-log" value="${replication-log}"/>
258 1579 tao
      <filter token="replicationerrorlog" value="${replicationerrorlog}"/>
259 348 jones
      <filter token="release" value="${release}"/>
260
      <filter token="servlet-path" value="${servlet-path}"/>
261 359 bojilova
      <filter token="html-path" value="${html-path}"/>
262 362 jones
      <filter token="user" value="${user}"/>
263
      <filter token="password" value="${password}"/>
264 1783 jones
      <filter token="mcuser" value="${mcuser}"/>
265
      <filter token="mcpassword" value="${mcpassword}"/>
266 1801 tao
      <filter token="mcanotheruser" value="${mcanotheruser}"/>
267
      <filter token="mcanotherpassword" value="${mcanotherpassword}"/>
268 1929 brooke
      <filter token="knb-site-url" value="${knb-site-url}"/>
269 1933 brooke
      <filter token="eml-css" value="${eml-css}"/>
270 1929 brooke
      <filter token="style-skins-relpath" value="${style-skins-relpath}"/>
271
      <filter token="style-skins-path" value="${style-skins-path}"/>
272
      <filter token="style-common-relpath" value="${style-common-relpath}"/>
273
      <filter token="style-common-fullpath" value="${style-common-fullpath}"/>
274
      <filter token="style-common-path" value="${style-common-path}"/>
275 2343 sgarg
      <filter token="templates.dir" value="${templates.dir}"/>
276
277 1929 brooke
      <!-- The "style-path" filter is used by the eml xsl stylesheets!!  -->
278
      <filter token="style-path" value="${style-skins-path}"/>
279 525 berkley
      <filter token="replication-path" value="${replication-path}"/>
280 2299 costa
      <filter token="harvester-registration-login-path" value="${harvester-registration-login-path}"/>
281
      <filter token="harvester-registration-path" value="${harvester-registration-path}"/>
282 832 jones
      <filter token="config-dir" value="${config-dir}"/>
283
      <filter token="default-style" value="${default-style}"/>
284 877 jones
      <filter token="eml-version" value="${eml-version}"/>
285 2175 tao
      <filter token="eml2_0_0namespace" value="${eml2_0_0namespace}"/>
286 2228 sgarg
      <filter token="eml2_0_1namespace" value="${eml2_0_1namespace}"/>
287 2175 tao
      <filter token="eml2_1_0namespace" value="${eml2_1_0namespace}"/>
288 1718 tao
      <filter token="stmmlnamespace" value="${stmmlnamespace}"/>
289 1009 tao
      <filter token="context" value="${context}"/>
290 1292 tao
      <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
291 1051 tao
      <filter token="debuglevel" value="${debuglevel}" />
292 1079 tao
      <filter token="datafilepath" value="${datafilepath}" />
293 1455 tao
      <filter token="inlinedatafilepath" value="${inlinedatafilepath}" />
294 1522 berkley
      <filter token="defaultcontenttype" value="${defaultcontenttype}" />
295 1538 berkley
      <filter token="debugprefix" value="${debugprefix}"/>
296 2308 jones
      <filter token="administrators" value="${administrators}"/>
297 1487 tao
298 2343 sgarg
      <filter token="defaultStage" value="${defaultStage}"/>
299
      <filter token="defaultHeader" value="${defaultHeader}"/>
300
      <filter token="defaultFooter" value="${defaultFooter}"/>
301
      <filter token="defaultChangePass" value="${defaultChangePass}"/>
302
      <filter token="defaultResetPass" value="${defaultResetPass}"/>
303
      <filter token="changePassSuccess" value="${changePassSuccess}"/>
304
      <filter token="resetPassSuccess" value="${resetPassSuccess}"/>
305
      <filter token="registerFailed" value="${registerFailed}"/>
306
      <filter token="registerLter" value="${registerLter}"/>
307
      <filter token="registerMatch" value="${registerMatch}"/>
308
      <filter token="registerSuccess" value="${registerSuccess}"/>
309
      <filter token="register" value="${register}"/>
310
      <filter token="searchResults" value="${searchResults}"/>
311
312 254 jones
      <property name="srcdir" value="./src" />
313 1783 jones
      <property name="testdir" value="./test" />
314 2277 jones
      <property name="testtorun" value="BuildIndexTest" />
315 1116 tao
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
316
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
317 348 jones
      <property name="build.dir" value="./build"/>
318
      <property name="build.src" value="${build.dir}/src"/>
319
      <property name="build.dest" value="${build.dir}/classes"/>
320 516 jones
      <property name="build.docs" value="${build.dir}/docs"/>
321 348 jones
      <property name="build.samples" value="${build.dir}/samples"/>
322
      <property name="build.tests" value="${build.dir}/tests"/>
323 1778 tao
      <property name="build.tmp" value="${build.dir}/tmp"/>
324 1116 tao
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
325
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
326 348 jones
      <property name="build.data" value="${build.dir}/data"/>
327 806 jones
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
328 1952 jones
      <property name="build.war" value="${build.dir}/war"/>
329 348 jones
330 882 jones
      <property name="dist.dir" value="dist"/>
331 806 jones
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
332
      <property name="ver.src" value="${ver.dir}/src"/>
333 2401 costa
	  <!-- directories for creating a Harvest List Editor distribution -->
334
      <property name="dist.dir.hle" value="disthle"/>
335
      <property name="ver.dir.hle" value="${dist.dir.hle}/harvest-list-editor-${release}"/>
336 806 jones
337 254 jones
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
338 2317 jones
      <condition property="utilities.required">
339
        <or>
340
          <not><available file="lib/httpclient.jar"/></not>
341
          <not><available file="lib/utilities.jar"/></not>
342
        </or>
343
      </condition>
344 2318 jones
      <condition property="eml.required">
345
        <or>
346
          <not><available file="lib/schema/eml-2.0.1/eml.xsd"/></not>
347
          <not><available file="lib/schema/eml-2.0.0/eml.xsd"/></not>
348
          <not><available file="lib/dtd/eml-dataset-2.0.0beta6.dtd"/></not>
349
        </or>
350
      </condition>
351 113 jones
   </target>
352 1311 berkley
353 348 jones
   <target name="prepare" depends="init">
354
      <mkdir dir="${build.dir}"/>
355
      <mkdir dir="${build.src}"/>
356
      <mkdir dir="${build.dest}"/>
357 516 jones
      <mkdir dir="${build.javadocs}"/>
358 1778 tao
      <mkdir dir="${build.tmp}"/>
359 348 jones
360 822 jones
      <copy todir="${build.src}" filtering="yes">
361
        <fileset dir="${srcdir}">
362
          <include name="edu/**"/>
363
          <include name="com/**"/>
364 877 jones
          <include name="**/*.sql"/>
365 822 jones
          <exclude name="**/CVS*"/>
366
          <exclude name="**/.#*"/>
367
        </fileset>
368
      </copy>
369 2344 sgarg
      <available file="lib/style/common/emlb6toeml2" type="dir"
370 1954 jones
                 property="styles.not.needed"/>
371 348 jones
   </target>
372
373 1939 brooke
   <target name="compile" depends="prepare,utilities"
374 1986 jones
    description="Compiles java code to build dir, and copies metacat props files there">
375 1939 brooke
376 1311 berkley
       <javac srcdir="${build.src}"
377
              destdir="${build.dest}"
378
              classpath="${cpath}"
379 1827 jones
              debug="${debug}"
380 2135 costa
              excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java"/>
381 1311 berkley
   </target>
382 113 jones
383 2322 jones
   <target name="jar" depends="compile,geteml"
384 1939 brooke
    description="Compiles and jars metacat java code to metacat.jar in build dir">
385
386 353 jones
       <delete file="${build.dir}/${name}.jar" />
387 635 jones
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
388 2135 costa
            excludes="**/protocols/ **/harvesterClient/" />
389 1311 berkley
   </target>
390
391 1939 brooke
   <target name="protocol" depends="compile"
392
    description="Compiles and jars protocol java code to protocol.jar in build dir">
393 635 jones
       <delete file="${build.dir}/protocol.jar" />
394
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
395
            includes="**/protocols/" />
396 1311 berkley
   </target>
397 113 jones
398 2317 jones
   <target name="utilities" depends="config" if="utilities.required">
399 1796 jones
     <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
400
     <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
401 1780 jones
     <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
402
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
403
   </target>
404
405 1939 brooke
   <target name="client" depends="utilities, prepare"
406
    description="Compiles metacat-client java code to build dir">
407 1780 jones
       <javac srcdir="${build.src}"
408
              destdir="${build.dest}"
409
              classpath="${cpath}"
410
              includes="edu/ucsb/nceas/metacat/client/*" />
411
   </target>
412
413 1939 brooke
   <target name="clientjar" depends="client"
414
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
415 1780 jones
       <delete file="${build.dir}/${name}-client.jar" />
416
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
417
            includes="**/metacat/client/" />
418
   </target>
419
420 2059 costa
   <target name="harvester" depends="client"
421 1950 costa
           description="Compiles harvester java code to build dir">
422
       <echo message="classpath is:   ${cpath}"/>
423
       <javac srcdir="${build.src}"
424
              destdir="${build.dest}"
425
              classpath="${cpath}"
426
              includes="edu/ucsb/nceas/metacat/harvesterClient/*" />
427
   </target>
428
429
   <target name="harvesterjar" depends="harvester"
430 2059 costa
           description="Compiles and jars harvester java code to harvester.jar in build dir">
431
       <delete file="${build.dir}/harvester.jar" />
432
       <jar jarfile="${build.dir}/harvester.jar" basedir="${build.dest}"
433 1950 costa
            includes="**/metacat/harvesterClient/" />
434
   </target>
435
436 2369 costa
   <target name="harvestListEditorDist" depends="harvesterjar"
437
           description="Prepares a distribution of the Harvest List Editor tool">
438 2401 costa
       <mkdir dir="${dist.dir.hle}"/>
439
       <delete dir="${ver.dir.hle}" />
440
       <mkdir dir="${ver.dir.hle}"/>
441
       <copy todir="${ver.dir.hle}" file="${build.dir}/harvester.jar"/>
442
       <copy todir="${ver.dir.hle}" file="lib/xercesImpl.jar"/>
443
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestList.xsd"/>
444
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.bat"/>
445
       <copy todir="${ver.dir.hle}" file="lib/harvester/harvestListEditor.sh"/>
446
       <delete file="./harvest-list-editor-${release}.zip"/>
447
       <zip zipfile="./harvest-list-editor-${release}.zip" basedir="${ver.dir.hle}" />
448
       <delete file="./harvest-list-editor-${release}.tar.gz" />
449
       <tar tarfile="./harvest-list-editor-${release}.tar" basedir="${ver.dir.hle}" />
450
       <gzip zipfile="./harvest-list-editor-${release}.tar.gz"
451
             src="./harvest-list-editor-${release}.tar"/>
452
       <delete file="./harvest-list-editor-${release}.tar" />
453 2369 costa
   </target>
454
455 2318 jones
   <target  name="geteml" depends="getemlpre2,geteml2+" if="eml.required"
456 1939 brooke
            description="Calls getemlpre2 and geteml2+ targets" />
457
458 2318 jones
   <target name="getemlpre2" depends="prepare" if="eml.required"
459 1939 brooke
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
460 1612 tao
     <echo>Enter CVS password: </echo>
461
     <cvs cvsRoot="${cvsroot}"
462
          package="${eml-module}"
463
          tag="${eml-tag}"
464 1939 brooke
          dest="${build.tmp}/eml_${eml-tag}" />
465 1612 tao
     <mkdir dir="lib/dtd" />
466
     <copy todir="lib/dtd" filtering="yes">
467 1939 brooke
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
468 1612 tao
         <include name="*.dtd"/>
469
       </fileset>
470
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
471
     </copy>
472 2228 sgarg
473
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
474
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}/style">
475
       <include name="**/*.xsl"/>
476
     </fileset>
477
     </copy>
478 1939 brooke
   </target>
479
480 2318 jones
   <target name="geteml2+" depends="prepare" if="eml.required"
481 1939 brooke
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
482
     <echo>Enter CVS password: </echo>
483 1612 tao
     <cvs cvsRoot="${cvsroot}"
484
          package="${eml-module}"
485 2228 sgarg
          tag="${eml2_0_0-tag}"
486
          dest="${build.tmp}/eml_${eml2_0_0-tag}" />
487
     <mkdir dir="lib/schema/eml-2.0.0" />
488
     <copy todir="lib/schema/eml-2.0.0" filtering="yes">
489
       <fileset dir="${build.tmp}/eml_${eml2_0_0-tag}/${eml-module}">
490 1612 tao
         <include name="*.xsd"/>
491
       </fileset>
492 2175 tao
493 1939 brooke
       <!-- shouldn't we have a mapper here like this??
494
       <mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
495 2175 tao
496
       Jing's code didn't nave one - does it need to be added?
497 1939 brooke
       NOTE that eml-version is set to beta 6, so this would need changing -->
498 2175 tao
499 1612 tao
     </copy>
500 1939 brooke
     <antcall target="copyxsl">
501 2228 sgarg
        <param name="cvs.tagname" value="${eml2_0_0-tag}" />
502
        <param name="dirname" value="eml-2.0.0" />
503 1939 brooke
     </antcall>
504 2228 sgarg
505
     <echo>Enter CVS password: </echo>
506
     <cvs cvsRoot="${cvsroot}"
507
          package="${eml-module}"
508
          tag="${eml2_0_1-tag}"
509
          dest="${build.tmp}/eml_${eml2_0_1-tag}" />
510
     <mkdir dir="lib/schema/eml-2.0.1" />
511
     <copy todir="lib/schema/eml-2.0.1" filtering="yes">
512
       <fileset dir="${build.tmp}/eml_${eml2_0_1-tag}/${eml-module}">
513
         <include name="*.xsd"/>
514
       </fileset>
515
     </copy>
516
     <antcall target="copyxsl">
517
        <param name="cvs.tagname" value="${eml2_0_1-tag}" />
518
        <param name="dirname" value="eml-2.0.1" />
519
     </antcall>
520 1939 brooke
   </target>
521
522 2175 tao
523
524
   <target  name="copyxsl"
525 1939 brooke
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
526
527
     <delete file="${style-common-cvsrelpath}/${eml-css}"/>
528 2175 tao
529 2228 sgarg
     <copy todir="${style-common-cvsrelpath}/${dirname}" filtering="yes">
530
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style/eml">
531 1929 brooke
       <include name="**/*.xsl"/>
532 1612 tao
     </fileset>
533
     </copy>
534 1939 brooke
535 2175 tao
536
     <!-- now copy default css from eml module and put it in style-common-path
537 1933 brooke
          dir with a new name, so other skin-specific css can import it if reqd -->
538 1939 brooke
     <copy file="${build.tmp}/eml_${cvs.tagname}/${eml-module}/${eml-module.default.css}"
539 1938 brooke
           tofile="${style-common-cvsrelpath}/${eml-css}" />
540 1612 tao
541 1463 tao
   </target>
542 2175 tao
543
544
545 2322 jones
   <target name="register-schemas" depends="prepare"
546
   description="Registers the Schemas with a new Metacat instance">
547 877 jones
     <echo/>
548 2322 jones
     <echo>Registering the Schemas with the new Metacat instance...</echo>
549 877 jones
     <sql driver="${dbDriver}"
550 1744 tao
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
551 877 jones
          url="${jdbc-connect}"
552
          userid="${user}"
553
          password="${password}"
554 1593 tao
          src="${build.src}/loaddtdschema.sql" />
555 877 jones
   </target>
556 1716 berkley
557 1939 brooke
   <target name="installdb" depends="prepare"
558
            description="Installs the database tables">
559 1827 jones
     <echo/>
560
     <echo>Installing the database tables...</echo>
561
     <sql driver="${dbDriver}"
562
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
563
          url="${jdbc-connect}"
564
          userid="${user}"
565
          password="${password}"
566 2103 jones
          src="${build.src}/${install-sql}" />
567 1827 jones
   </target>
568
569 1939 brooke
   <target name="upgrade12" depends="prepare"
570
            description="Updates the database tables to upgrade to version 1.2">
571 1827 jones
     <echo/>
572
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
573
     <sql driver="${dbDriver}"
574
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
575
          url="${jdbc-connect}"
576
          userid="${user}"
577
          password="${password}"
578 2103 jones
          src="${build.src}/${upgrade-1.2-sql}" />
579 1827 jones
   </target>
580
581 1939 brooke
   <target name="upgrade13" depends="prepare"
582
            description="Updates the database tables to upgrade to version 1.3">
583 1827 jones
     <echo/>
584
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
585
     <sql driver="${dbDriver}"
586
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
587
          url="${jdbc-connect}"
588
          userid="${user}"
589
          password="${password}"
590 2103 jones
          src="${build.src}/${upgrade-1.3-sql}" />
591 1827 jones
   </target>
592
593 2103 jones
   <target name="upgrade14" depends="prepare"
594
            description="Updates the database tables to upgrade to version 1.4">
595
     <echo/>
596
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
597
     <sql driver="${dbDriver}"
598
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
599
          url="${jdbc-connect}"
600
          userid="${user}"
601
          password="${password}"
602
          src="${build.src}/${upgrade-1.4-sql}" />
603
   </target>
604
605 2395 tao
   <target name="upgrade15" depends="sqlupgrade15"
606 2391 tao
           description="Updates the database tables to upgrade to version 1.5">
607 2353 sgarg
     <echo/>
608
     <echo>Updating the database tables to upgrade to version 1.4...</echo>
609
     <copy file="${srcdir}/upgrade_db_to_1_5.java"
610 2391 tao
           todir="${build.tmp}" filtering="yes"/>
611 2353 sgarg
612
     <javac srcdir="${build.tmp}"
613
            destdir="${build.tmp}"
614
            classpath="${cpath}"
615
            debug="${debug}"
616
            includes="upgrade_db_to_1_5.java"/>
617
618
     <java classname="upgrade_db_to_1_5"
619
           classpath="${cpath}:${build.tmp}"/>
620
621 2393 tao
   </target>
622
623 2395 tao
   <target name="sqlupgrade15" depends="prepare">
624
      <echo>Updating the database tables to upgrade to version 1.5 by sql command</echo>
625 2393 tao
      <sql driver="${dbDriver}"
626
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
627
          url="${jdbc-connect}"
628
          userid="${user}"
629
          password="${password}"
630
          src="${build.src}/${upgrade-1.5-sql}" />
631
   </target>
632 2353 sgarg
633 1952 jones
   <target name="install" depends="war" description="* Full Install *">
634 1079 tao
       <mkdir dir="${datafilepath}" />
635 1455 tao
       <mkdir dir="${inlinedatafilepath}" />
636 1079 tao
       <chmod dir="${datafilepath}" perm="ug+w" />
637 1929 brooke
       <mkdir dir="${temp-dir}"/>
638
       <chmod dir="${temp-dir}" perm="ug+w" />
639 1952 jones
       <copy file="${build.dir}/${context}.war" todir="${webapps}"/>
640
   </target>
641 2175 tao
642
   <target name="upgrade" depends="install"
643 1952 jones
          description="* Upgrade an existing metacat installation with a new version *">
644
       <unwar src="${webapps}/${context}.war" dest="${webapps}/${context}" />
645
   </target>
646
647 2175 tao
   <target name="install-registry" depends="init,getConversionXSL"
648 1952 jones
            description="Install Registry">
649 2175 tao
650 1952 jones
      <copy file="${srcdir}/perl/register-dataset.cgi"
651
            todir="${inst.cgi.dir}" filtering="yes"/>
652
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
653 2175 tao
654 1952 jones
      <mkdir dir="${temp-dir}" />
655 2343 sgarg
      <copy todir="${temp-dir}" filtering="yes">
656
       <fileset dir="lib/style/common/emlb6toeml2">
657 1952 jones
         <include name="*.xsl"/>
658
         <include name="*.xml"/>
659
       </fileset>
660 2343 sgarg
      </copy>
661 1952 jones
662
      <echo message="Install Registry completed." />
663
   </target>
664
665 2343 sgarg
   <target name="install-ldap" depends="init">
666
      <copy file="${srcdir}/perl/ldapweb.cgi"
667
            todir="${inst.cgi.dir}" filtering="yes"/>
668
      <chmod file="${inst.cgi.dir}/ldapweb.cgi" perm="ugo+x" />
669
      <copy file="lib/ldapweb.cfg"
670
            todir="${inst.cgi.dir}" filtering="yes"/>
671
      <chmod file="${inst.cgi.dir}/ldapweb.cfg" perm="ugo+x" />
672
      <mkdir dir="${templates.dir}" />
673
      <copy todir="${templates.dir}" filtering="yes">
674
        <fileset dir="lib/style/common/templates">
675
            <include name="${defaultChangePass}"/>
676
            <include name="${defaultResetPass}"/>
677
            <include name="${changePassSuccess}"/>
678
            <include name="${resetPassSuccess}"/>
679
            <include name="${registerFailed}"/>
680
            <include name="${registerLter}"/>
681
            <include name="${registerMatch}"/>
682
            <include name="${registerSuccess}"/>
683
            <include name="${register}"/>
684
            <include name="${searchResults}"/>
685
        </fileset>
686
      </copy>
687
      <echo message="ldapweb install complete." />
688
   </target>
689
690
691 2175 tao
   <target name="install-skin" depends="init"
692 2052 sgarg
            description="Install a Skin">
693
694 2175 tao
      <input message="Please enter name of the skin"
695 2052 sgarg
             addproperty="skin-name"/>
696
697
      <mkdir dir="${installdir}/style/skins/${skin-name}" />
698
      <copy todir="${installdir}/style/skins/${skin-name}" filtering="yes">
699
       <fileset dir="lib/style/skins/${skin-name}">
700 2054 sgarg
           <exclude name="*.png"/>
701
           <exclude name="*.gif"/>
702 2210 jones
           <exclude name="*.jpg"/>
703 2277 jones
           <exclude name="**/CVS*"/>
704
           <exclude name="**/.#*"/>
705 2052 sgarg
       </fileset>
706
      </copy>
707 2054 sgarg
     <copy todir="${installdir}/style/skins/${skin-name}" filtering="no">
708
       <fileset dir="lib/style/skins/${skin-name}">
709
           <include name="*.png"/>
710
           <include name="*.gif"/>
711 2210 jones
           <include name="*.jpg"/>
712 2277 jones
           <exclude name="**/CVS*"/>
713
           <exclude name="**/.#*"/>
714 2054 sgarg
       </fileset>
715
      </copy>
716 2277 jones
      <!--
717 2210 jones
      <mkdir dir="${installdir}/style/skins/${skin-name}/images" />
718
     <copy todir="${installdir}/style/skins/${skin-name}/images" filtering="no">
719
       <fileset dir="lib/style/skins/${skin-name}/images">
720
           <include name="*.png"/>
721
           <include name="*.gif"/>
722
           <include name="*.jpg"/>
723
       </fileset>
724
      </copy>
725 2277 jones
      -->
726 2052 sgarg
727
      <echo message="Install Skin completed." />
728
   </target>
729
730 1952 jones
   <target name="war" depends="warPrepare,warMSSQL"
731
            description="Create a web archive (WAR) for servlet deployment">
732 2175 tao
       <war destfile="${build.dir}/${context}.war"
733 1952 jones
            webxml="${build.war}/web.xml">
734
         <fileset dir="${war.context}"/>
735
         <lib dir="${war.lib}"/>
736
         <webinf dir="${war.webinf}"/>
737
       </war>
738
   </target>
739
740 2059 costa
   <target name="warPrepare" depends="jar,clientjar,harvesterjar"
741 1952 jones
            description="Prepare files for creating a web archive (WAR)">
742
743
       <property name="war.lib" value="${build.war}/lib" />
744
       <property name="war.webinf" value="${build.war}/WEB-INF" />
745
       <property name="war.context" value="${build.war}/${context}" />
746
       <mkdir dir="${war.lib}" />
747
       <mkdir dir="${war.webinf}" />
748
       <mkdir dir="${war.context}" />
749
750
       <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
751
       <copy file="${build.dir}/${name}-client.jar" todir="${war.lib}" />
752 2059 costa
       <copy file="${build.dir}/harvester.jar" todir="${war.lib}" />
753 1952 jones
       <copy todir="${war.lib}" filtering="no">
754 1823 jones
         <fileset dir="lib">
755
           <include name="*.jar"/>
756
         </fileset>
757
         <fileset dir="lib/xalan">
758
           <include name="*.jar"/>
759
         </fileset>
760
       </copy>
761 1952 jones
       <copy file="${jdbc}" tofile="${war.lib}/jdbc.jar" />
762 1729 tao
       <copy file="lib/web.xml.${tomcatversion}"
763 1952 jones
             tofile="${build.war}/web.xml" />
764
       <copy file="lib/metacat.properties" todir="${war.webinf}"
765 1951 jones
             filtering="yes" />
766 1952 jones
       <copy todir="${war.context}" filtering="no">
767 822 jones
         <fileset dir="lib">
768
           <include name="**/*.jpg"/>
769
           <include name="**/*.png"/>
770
           <include name="**/*.gif"/>
771
         </fileset>
772
       </copy>
773 1952 jones
       <copy todir="${war.context}" filtering="yes">
774 822 jones
         <fileset dir="lib">
775
           <exclude name="*.jar"/>
776
           <exclude name="*.properties"/>
777
           <exclude name="web.xml"/>
778 1437 berkley
           <exclude name="**/*.jpg"/>
779
           <exclude name="**/*.png"/>
780
           <exclude name="**/*.gif"/>
781 822 jones
         </fileset>
782
       </copy>
783 1952 jones
       <copy todir="${war.context}" filtering="no">
784 1929 brooke
         <fileset dir="lib">
785
           <include name="**/*.jpg"/>
786
           <include name="**/*.png"/>
787
           <include name="**/*.gif"/>
788
         </fileset>
789
       </copy>
790 1311 berkley
   </target>
791 1929 brooke
792 1952 jones
   <target name="warMSSQL" if="MSSQL" depends="warPrepare">
793
      <copy file="${jdbc-add1}" tofile="${war.lib}/msutil.jar" />
794
       <copy file="${jdbc-add2}" tofile="${war.lib}/mssqlserver.jar" />
795 1929 brooke
   </target>
796
797 2175 tao
   <target name="getConversionXSL" depends="prepare"
798 1954 jones
            unless="styles.not.needed"
799 1939 brooke
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
800 1929 brooke
     <echo>Enter CVS password: </echo>
801
     <cvs cvsRoot="${cvsroot-alternate}"
802
          package="${conversion-module}"
803
          dest="${build.tmp}" />
804 2343 sgarg
805
     <mkdir dir="lib/style/common/emlb6toeml2" />
806
      <copy todir="lib/style/common/emlb6toeml2" filtering="yes">
807
       <fileset dir="${build.tmp}/${conversion-module}/lib/style">
808
         <include name="*.xsl"/>
809
         <include name="*.xml"/>
810
       </fileset>
811
      </copy>
812 1929 brooke
   </target>
813
814 2135 costa
   <target name="testprep" depends="jar,clientjar,harvesterjar">
815 1783 jones
      <mkdir dir="${build.tests}"/>
816
      <copy todir="${build.tests}" filtering="yes">
817
        <fileset dir="${testdir}">
818
          <include name="edu/**"/>
819
        </fileset>
820
      </copy>
821 971 tao
      <!-- copy and compile the tests into a jar file -->
822 1783 jones
      <javac srcdir="${build.tests}"
823
             destdir="${build.tests}"
824 2135 costa
             classpath="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar"
825 1612 tao
             debug="on"
826 1311 berkley
       includes="**/*.java" />
827 204 jones
828 1311 berkley
      <jar jarfile="${build.dir}/${name}-junittests.jar"
829 1783 jones
        basedir="${build.tests}"
830 1311 berkley
                includes="**/*.class" />
831 1822 jones
   </target>
832 971 tao
833 1939 brooke
   <target name="test" depends="testprep"
834
            description="Uses the ant junit task to run all JUnit tests">
835 1822 jones
836 971 tao
      <!-- use the ant "junit" task to run JUnit tests. -->
837 1783 jones
      <junit printsummary="yes" haltonfailure="no" fork="yes"
838 971 tao
             haltonerror="no">
839 1783 jones
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>
840 971 tao
        <classpath>
841 1783 jones
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
842 971 tao
        </classpath>
843
844
        <formatter type="plain" />
845
846
        <batchtest fork="yes" todir="${build.dir}">
847 1783 jones
          <fileset dir="${build.tests}">
848 1116 tao
            <include name="**/*.class" />
849 971 tao
          </fileset>
850
        </batchtest>
851
     </junit>
852
   </target>
853 1103 tao
854 1939 brooke
    <target name="runonetest" depends="testprep"
855
            description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
856 1500 tao
857 1939 brooke
              <echo>testtorun: ${testtorun}</echo>
858
859 1500 tao
      <!-- use the ant "junit" task to run JUnit tests. -->
860 1783 jones
      <junit printsummary="yes" haltonfailure="no" fork="yes"
861 1500 tao
             haltonerror="no">
862 2044 tao
        <!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
863 1500 tao
        <classpath>
864 1783 jones
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/${name}-junittests.jar" />
865 1500 tao
        </classpath>
866
867
        <formatter type="plain" />
868
869
        <batchtest fork="yes" todir="${build.dir}">
870 1783 jones
          <fileset dir="${build.tests}">
871 1500 tao
            <include name="**/${testtorun}.class" />
872
          </fileset>
873
        </batchtest>
874
     </junit>
875
   </target>
876
877 2175 tao
   <target name="testharvester"
878 2135 costa
           depends="testprep"
879
           description="Uses the ant junit task to test only the Harvester code">
880 2175 tao
     <junit printsummary="yes"
881
            haltonfailure="off"
882 2135 costa
            fork="yes"
883
            haltonerror="off">
884
       <classpath>
885
         <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-client.jar:${build.dir}/harvester.jar:${build.dir}/${name}-junittests.jar" />
886
       </classpath>
887
       <formatter type="plain" />
888
       <batchtest fork="yes" todir="${build.dir}">
889
         <fileset dir="${build.tests}">
890
           <include name="**/harvesterClient/*.class" />
891
         </fileset>
892
       </batchtest>
893
     </junit>
894
   </target>
895
896 1939 brooke
  <target name="gethttpclient" depends="prepare"
897
            description="checks out and compiles morpho httpclient code">
898 1311 berkley
  <!--mkdir dir="${morphosourcedir}" -->
899 1487 tao
        <cvs cvsRoot="${cvsroot}"
900 1103 tao
             package="morpho"
901
             dest="." />
902 1107 tao
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
903 1103 tao
   </target>
904
905
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
906 1939 brooke
   <target name="nettest" depends="install"
907
            description="compiles and runs the metacatnettest code">
908 2175 tao
909 1103 tao
      <echo>***********************************
910 1311 berkley
      Please run ant gethttpclient first!
911
      ***********************************
912 1103 tao
      </echo>
913
      <!-- copy and compile the tests into a jar file -->
914 1116 tao
      <mkdir dir="${build.metacatnettest}"/>
915 1103 tao
      <javac srcdir="${junitnettestsdir}"
916 1116 tao
             destdir="${build.metacatnettest}"
917 1103 tao
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
918
             includes="**/*.java" />
919
920
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
921 1116 tao
                    basedir="${build.metacatnettest}"
922 1103 tao
                    includes="**/*.class" />
923
924
      <!-- use the ant "junit" task to run JUnit tests. -->
925 1107 tao
      <junit printsummary="yes" haltonfailure="no" fork="yes"
926 1103 tao
             haltonerror="no">
927 1107 tao
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
928 1103 tao
        <classpath>
929 1807 tao
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itislib}" />
930 1103 tao
        </classpath>
931
932
        <formatter type="plain" />
933
934
        <batchtest fork="yes" todir="${build.dir}">
935 1116 tao
          <fileset dir="${build.metacatnettest}">
936
            <include name="**/*.class" />
937 1103 tao
          </fileset>
938
        </batchtest>
939
     </junit>
940 1311 berkley
   </target>
941 1103 tao
942 1939 brooke
   <target name="cleanweb" depends="clean"
943
            description="deletes tomcat web context dir and all its contents">
944 1522 berkley
     <delete dir="${installdir}" />
945
   </target>
946
947
948 1939 brooke
   <target name="clean" depends="init"
949 2320 jones
            description="deletes build dir and files that can be regenerated form the release">
950 822 jones
       <delete dir="${build.dir}" />
951 2320 jones
   </target>
952
953
   <target name="fullclean" depends="clean"
954
            description="deletes even jars that depend on external sources such as stylesheets and jars">
955
       <delete file="lib/httpclient.jar" />
956
       <delete file="lib/utilities.jar" />
957 1939 brooke
       <delete includeEmptyDirs="true" failonerror="false">
958
         <fileset dir="${style-common-cvsrelpath}">
959
           <include name="${eml-css}" />
960
           <include name="eml-*/*.xsl" />
961
           <include name="eml-*" />
962
         </fileset>
963 2320 jones
       </delete>
964 113 jones
   </target>
965
966 1939 brooke
   <target name="jdoc" depends="prepare"
967
            description="generates javadoc documentation">
968 822 jones
       <javadoc packagenames="edu.ucsb.nceas.*"
969 516 jones
           sourcepath="${build.src}"
970
           destdir="${build.javadocs}"
971 2319 jones
           classpath="${cpath}"
972 113 jones
           author="true"
973
           version="true"
974
           use="true"
975 348 jones
           windowtitle="${Name} API"
976
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
977 113 jones
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
978
       />
979
   </target>
980
981 2317 jones
   <target name="dist" depends="geteml,jar,protocol,jdoc"
982 1939 brooke
            description="prepares a full release distribution">
983 806 jones
      <mkdir dir="${dist.dir}"/>
984
      <delete dir="${ver.dir}" />
985
      <mkdir dir="${ver.dir}"/>
986
      <copy todir="${ver.dir}">
987 1311 berkley
        <fileset dir="."
988 2401 costa
            excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/**"/>
989 806 jones
      </copy>
990
      <copy todir="${ver.dir}" file="build.xml"/>
991 2317 jones
      <copy todir="${ver.dir}" file="build.properties"/>
992 882 jones
993
      <copy todir="${ver.dir}/docs" filtering="yes">
994
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
995
      </copy>
996
      <copy todir="${ver.dir}/docs" filtering="no">
997
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
998
      </copy>
999 806 jones
      <copy todir="${ver.dir}/docs/dev">
1000
        <fileset dir="${build.dir}/docs"/>
1001
      </copy>
1002 917 berkley
      <copy todir="${ver.dir}/src">
1003
        <fileset dir="${build.dir}/src"/>
1004
      </copy>
1005 2391 tao
      <!-- copy loaddtdschemal.sql form src dir(which has the server token to ver.dir/src-->
1006
      <copy todir="${ver.dir}/src" file="${srcdir}/loaddtdschema.sql" overwrite="yes" filtering="no"/>
1007 2395 tao
      <copy todir="${ver.dir}/src" file="${srcdir}/upgrade-db-to-1.5.sql" overwrite="yes" filtering="no"/>
1008 2323 jones
      <!--
1009 992 berkley
      <delete dir="./${ver.dir}/${build.dir}"/>
1010
      <delete dir="./${ver.dir}/dist"/>
1011 2323 jones
      -->
1012 882 jones
      <delete file="./${name}-${release}.zip"/>
1013 1312 tao
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1014 882 jones
      <delete file="./${name}-${release}.tar.gz" />
1015 1312 tao
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
1016 1311 berkley
      <gzip zipfile="./${name}-${release}.tar.gz"
1017 882 jones
                src="./${name}-${release}.tar"/>
1018
      <delete file="./${name}-${release}.tar" />
1019 1311 berkley
  </target>
1020 806 jones
1021 1939 brooke
  <target name="distsrc" depends="dist"
1022
            description="prepares a source distribution">
1023 806 jones
      <mkdir dir="${ver.src}"/>
1024
      <copy todir="${ver.src}">
1025
        <fileset dir="./src"/>
1026
      </copy>
1027
1028 882 jones
      <delete file="./${name}-src-${release}.zip"/>
1029
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
1030
      <delete file="./${name}-src-${release}.tar.gz" />
1031
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
1032 1311 berkley
      <gzip zipfile="./${name}-src-${release}.tar.gz"
1033 882 jones
                src="./${name}-src-${release}.tar"/>
1034
      <delete file="./${name}-src-${release}.tar" />
1035 807 jones
      <delete dir="${dist.dir}"/>
1036 1311 berkley
  </target>
1037 806 jones
1038 1702 tao
   <target name="stylesheettest">
1039 1939 brooke
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
1040 1702 tao
      <param name="displaymodule" expression="${displaymodule}"/>
1041
      <param name="docid" expression="${input}"/>
1042
      <param name="entitytype" expression="${entitytype}"/>
1043
      <param name="entityindex" expression="${entityindex}"/>
1044
      <outputproperty name="method" value="html"/>
1045
      <outputproperty name="standalone" value="yes"/>
1046
      <outputproperty name="encoding" value="iso8859_1"/>
1047
      <outputproperty name="indent" value="yes"/>
1048
    </xslt>
1049
  </target>
1050 2175 tao
1051 1819 tao
 <target name="gridinit" depends="init">
1052
   <property name="java2wsdl.tool" value="org.apache.axis.wsdl.Java2WSDL" />
1053
   <property name="wsdldecorator.tool" value="org.globus.ogsa.tools.wsdl.DecorateWSDL" />
1054
   <property name="wsdl.tool" value="org.globus.ogsa.tools.wsdl.GSDL2Java"/>
1055
   <property environment="env"/>
1056
   <property name="binding.file" value="${env.GLOBUS_LOCATION}/schema/ogsi/ogsi_bindings.wsdl"/>
1057 1820 tao
    <path id="webservicepath">
1058
        <pathelement location="."/>
1059
        <pathelement location="${env.JAVA_HOME}/../lib/tools.jar"/>
1060
        <pathelement location="${build.dest}"/>
1061
        <fileset dir="${env.GLOBUS_LOCATION}/lib">
1062
           <include name="*.jar"/>
1063
        </fileset>
1064
      </path>
1065 1819 tao
</target>
1066
1067 1821 tao
 <target name="gridprepare" depends="gridinit, prepare">
1068 2175 tao
 </target>
1069
1070 1821 tao
  <target name="compileinterface" depends="clean, gridprepare">
1071 1817 tao
    <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/${interface.name}.java" />
1072 1811 tao
  </target>
1073 2175 tao
1074 1811 tao
  <target name="generateWSDL" depends="compileinterface">
1075
    <echo message="Generating wsdl from ${interface.name} interface"/>
1076
    <java classname="${java2wsdl.tool}"
1077 1814 tao
          dir="${build.src}" fork="yes"
1078 1811 tao
          classpathref="webservicepath"  failonerror="true" >
1079
      <arg value="-P"/>
1080
      <arg value="${interface.name}PortType"/>
1081
      <arg value="-S"/>
1082
      <arg value="${interface.name}Service"/>
1083
      <arg value="-y"/>
1084
      <arg value="WRAPPED"/>
1085
      <arg value="-u"/>
1086
      <arg value="LITERAL"/>
1087
      <arg value="-l"/>
1088
      <arg value="http://localhost/ogsa/services/${interface.name}Service"/>
1089
      <arg value="-n"/>
1090
      <arg value="http://${services.namespace}/${interface.name}"/>
1091
      <arg value="${interface.package}.${interface.name}"/>
1092
    </java>
1093
  </target>
1094 2175 tao
1095 1811 tao
   <target name="decorateWSDL" depends="generateWSDL">
1096
      <property name="wsdl.file" value="${interface.name}Service.wsdl"/>
1097 1814 tao
      <java classname="${wsdldecorator.tool}" dir="${build.src}"
1098 1811 tao
            fork="yes"
1099
            classpathref="webservicepath" failonerror="true" >
1100
        <arg value="${binding.file}"/>
1101
        <arg value="${wsdl.file}"/>
1102
      </java>
1103
   </target>
1104 2175 tao
1105 1811 tao
   <target name="generatestubs" depends="decorateWSDL">
1106
      <echo message=" Generating stubs " />
1107 1814 tao
      <echo message="wsdl file is ${wsdl.file}"/>
1108
      <echo message="build.src is ${build.src}"/>
1109 1811 tao
      <java classname="${wsdl.tool}" dir="${build.src}" fork="yes"
1110
            classpathref="webservicepath" failonerror="true" >
1111 1814 tao
         <arg value="${wsdl.file}"/>
1112 1811 tao
    </java>
1113
  </target>
1114 2175 tao
1115 1811 tao
  <target name="compileStubsAndImpl" depends="generatestubs, utilities">
1116
     <echo message=" Compiling stubs " />
1117
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" includes="**/${interface.name}/*.java" />
1118
     <echo message=" Compiling impl " />
1119
     <javac srcdir="${build.src}" destdir="${build.dest}" classpathref="webservicepath" classpath="./lib/utilities.jar" includes="**/impl/*.java" />
1120
  </target>
1121 2175 tao
1122 1811 tao
  <target name="jarStubsAndImpl" depends="compileStubsAndImpl">
1123
     <echo message=" jar stubs classes " />
1124
     <jar destfile="${build.dir}/${interface.name}-stubs.jar" basedir="${build.dest}" includes="**/${interface.name}/*.class" />
1125
     <echo message=" jar impl classes " />
1126
     <jar destfile="${build.dir}/${interface.name}.jar" basedir="${build.dest}" includes="**/impl/*.class" />
1127
  </target>
1128 2175 tao
1129 1811 tao
  <target name="gar" depends="jarStubsAndImpl">
1130
     <echo message=" jar the gar file"/>
1131
     <mkdir dir="${build.dir}/gar"/>
1132
     <mkdir dir="${build.dir}/gar/schema/edu"/>
1133
     <copy file="${build.dir}/${interface.name}.jar" todir="${build.dir}/gar" />
1134
     <copy file="${build.dir}/${interface.name}-stubs.jar" todir="${build.dir}/gar" />
1135 1814 tao
     <copy file="lib/utilities.jar" todir="${build.dir}/gar" />
1136
     <copy file="lib/server-deploy.wsdd" todir="${build.dir}/gar" />
1137
     <copy file="${build.src}/${interface.name}Service.wsdl" todir="${build.dir}/gar/schema/edu" />
1138
     <jar destfile="lib/${interface.name}.gar" basedir="${build.dir}/gar"/>
1139 1811 tao
  </target>
1140 2175 tao
1141 1814 tao
  <target name="compilewebclient" depends="prepare">
1142
     <javac srcdir="${build.src}" destdir="${build.dest}" includes="**/application/*.java" classpathref="webservicepath" />
1143
  </target>
1144 2175 tao
1145 1814 tao
  <target name="runwebclient" depends="compilewebclient">
1146 2175 tao
     <java classname="edu.ucsb.nceas.metacat.stringclient.application.MetacatStringServiceApplication"
1147 1814 tao
           dir="${build.dest}" fork="yes"
1148
           classpathref="webservicepath" classpath="./lib/utilities.jar" failonerror="true">
1149
         <arg value="${serviceUrl}"/>
1150
         <arg value="${docid}"/>
1151
     </java>
1152
  </target>
1153 113 jones
</project>