Project

General

Profile

1 113 jones
<?xml version="1.0"?>
2
<!--
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
  *      '$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 113 jones
-->
32 329 jones
<project name="metacat" default="jar" basedir=".">
33 931 jones
34 925 berkley
   <target name="oracle">
35 931 jones
     <!-- Customize these properties if you are using oracle -->
36
     <property name="jdbc-connect"
37
               value="jdbc:oracle:thin:@dev.nceas.ucsb.edu:1521:exp"/>
38 925 berkley
     <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
39
     <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.OracleAdapter"/>
40
     <property name="oracle_home" value="/oracle01/app/oracle/product/8.1.6" />
41
     <property name="jdbc" value="${oracle_home}/jdbc/lib/classes111.zip" />
42
   </target>
43
44
   <target name="postgresql">
45 931 jones
     <!-- Customize these properties if you are using postgres -->
46
     <property name="jdbc-connect"
47 1051 tao
               value="jdbc:postgresql://localhost/exp"/>
48 925 berkley
     <property name="dbDriver" value="org.postgresql.Driver"/>
49 931 jones
     <property name="dbAdapter"
50
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
51 925 berkley
     <property name="jdbc" value="lib/jdbc7.1-1.2.jar" />
52
   </target>
53
54 1009 tao
   <target name="config" depends="postgresql">
55 931 jones
      <!-- Change the 'depends' attribute above to 'postgresql' to install
56
           metacat with postgres instead of oracle -->
57
58
      <!-- Customize these properties for your system -->
59 1051 tao
      <property name="tomcat" value="/usr/local/devtools/jakarta-tomcat" />
60
      <property name="webapps" value="/usr/local/devtools/jakarta-tomcat/webapps" />
61
      <property name="context" value="tao" />
62 1009 tao
      <property name="user" value="tao"/>
63 992 berkley
      <property name="password" value="your-pw-goes-here"/>
64 1073 tao
      <property name="server" value="pine.nceas.ucsb.edu:8443"/>
65
      <property name="systemidserver" value="http://pine.nceas.ucsb.edu:8080" />
66 993 tao
      <property name="datadir" value="data" />
67 1073 tao
      <property name="replication" value="off" />
68
      <property name="replicationsenddata" value="off" />
69
      <property name="replicationacceptdata" value="off" />
70
      <property name="debuglevel" value="55" />
71 931 jones
      <property name="web-base-url"
72
                value="http://knb.ecoinformatics.org"/>
73
      <property name="default-style" value="knb" />
74
75
      <!-- Make sure these paths match the location of the jar files
76
           on your system, the defaults should usually work -->
77
      <property name="jsdk"
78
                value="${tomcat}/lib/common/servlet.jar" />
79
      <property name="xmlp"
80
                value="lib/xerces.jar" />
81
      <property name="srb"
82
                value="lib/srbrmi" />
83
      <property name="cos"
84
                value="lib/cos.jar" />
85 939 tao
      <property name="morpho"
86
                value="lib/morpho.jar" />
87 931 jones
      <property name="xalan"
88
                value="lib/xalan/xalan.jar" />
89
      <property name="apis"
90
                value="lib/xalan/xml-apis.jar" />
91
   </target>
92
93
   <target name="init" depends="config">
94
      <!-- It is less likely you'll need to make any changes from here down,
95
           but customization is possible -->
96
      <property name="installdir" value="${webapps}/${context}" />
97 348 jones
      <property name="name" value="metacat"/>
98
      <property name="Name" value="MetaCat"/>
99 992 berkley
      <property name="release" value="1.1.0"/>
100 931 jones
      <property name="replication-path"
101
                value="/${context}/servlet/replication"/>
102
      <property name="servlet-path" value="/${context}/servlet/metacat"/>
103
      <property name="html-path" value="/${context}"/>
104
      <property name="image-path" value="/img/${context}" />
105
      <property name="style-path" value="/${context}/style"/>
106 923 jones
      <property name="replication-log" value="/tmp/metacatreplication.log"/>
107 832 jones
      <property name="config-dir" value="${installdir}" />
108 924 jones
      <property name="eml-module" value="eml" />
109 877 jones
      <property name="eml-version" value="2.0.0beta6" />
110
      <property name="eml-tag" value="RELEASE_EML_2_0_0_BETA_6" />
111
      <property name="cvsroot"
112 1009 tao
                value=":ext:tao@cvs.ecoinformatics.org:/cvs" />
113 348 jones
114 931 jones
      <property name="cpath"
115 1049 tao
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${srb}:${cos}:${morpho}"/>
116 882 jones
117
      <filter token="docrooturl" value="./" />
118 588 berkley
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
119 882 jones
      <filter token="dbDriver" value="${dbDriver}"/>
120 915 berkley
      <filter token="dbAdapter" value="${dbAdapter}"/>
121 614 bojilova
      <filter token="install-dir" value="${installdir}"/>
122 586 berkley
      <filter token="server" value="${server}"/>
123 977 tao
      <filter token="systemidserver" value="${systemidserver}"/>
124 586 berkley
      <filter token="replication-log" value="${replication-log}"/>
125 348 jones
      <filter token="release" value="${release}"/>
126
      <filter token="servlet-path" value="${servlet-path}"/>
127 359 bojilova
      <filter token="html-path" value="${html-path}"/>
128 362 jones
      <filter token="user" value="${user}"/>
129
      <filter token="password" value="${password}"/>
130 409 berkley
      <filter token="image-path" value="${image-path}"/>
131 828 jones
      <filter token="style-path" value="${style-path}"/>
132 506 jones
      <filter token="web-base-url" value="${web-base-url}"/>
133 525 berkley
      <filter token="replication-path" value="${replication-path}"/>
134 832 jones
      <filter token="config-dir" value="${config-dir}"/>
135
      <filter token="default-style" value="${default-style}"/>
136 877 jones
      <filter token="eml-version" value="${eml-version}"/>
137 1009 tao
      <filter token="context" value="${context}"/>
138 1018 tao
      <filter token="replication" value="${replication}" />
139 1073 tao
      <filter token="replicationsenddata" value="${replicationsenddata}" />
140
      <filter token="replicationacceptdata" value="${replicationacceptdata}" />
141 1051 tao
      <filter token="debuglevel" value="${debuglevel}" />
142 254 jones
      <property name="srcdir" value="./src" />
143 971 tao
      <property name="junittestsdir" value="./junittests" />
144 348 jones
      <property name="build.dir" value="./build"/>
145
      <property name="build.src" value="${build.dir}/src"/>
146
      <property name="build.dest" value="${build.dir}/classes"/>
147 516 jones
      <property name="build.docs" value="${build.dir}/docs"/>
148 348 jones
      <property name="build.samples" value="${build.dir}/samples"/>
149
      <property name="build.tests" value="${build.dir}/tests"/>
150 971 tao
      <property name="build.junittests" value="${build.dir}/junittests"/>
151 348 jones
      <property name="build.data" value="${build.dir}/data"/>
152 806 jones
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
153 887 berkley
      <property name="build.img" value="${installdir}/${image-path}"/>
154 348 jones
155 882 jones
      <property name="dist.dir" value="dist"/>
156 806 jones
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
157
      <property name="ver.src" value="${ver.dir}/src"/>
158
159 254 jones
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
160 915 berkley
161 113 jones
   </target>
162
163 348 jones
   <target name="prepare" depends="init">
164
      <mkdir dir="${build.dir}"/>
165
      <mkdir dir="${build.src}"/>
166
      <mkdir dir="${build.dest}"/>
167 516 jones
      <mkdir dir="${build.javadocs}"/>
168 348 jones
169 822 jones
      <copy todir="${build.src}" filtering="yes">
170
        <fileset dir="${srcdir}">
171
          <include name="edu/**"/>
172
          <include name="com/**"/>
173 877 jones
          <include name="**/*.sql"/>
174 822 jones
          <exclude name="**/CVS*"/>
175
          <exclude name="**/.#*"/>
176
        </fileset>
177
      </copy>
178 348 jones
   </target>
179
180
   <target name="compile" depends="prepare">
181
       <javac srcdir="${build.src}"
182
              destdir="${build.dest}"
183 257 jones
              classpath="${cpath}"
184
              excludes="**/*.sql" />
185 822 jones
       <copy file="lib/metacat.properties"
186
             tofile="${build.dest}/${package.home}/metacat.properties"
187
             filtering="yes" />
188
       <copy file="lib/srbProps.properties"
189
             tofile="${build.dest}/${package.home}/srbProps.properties"/>
190 113 jones
   </target>
191
192 204 jones
   <target name="jar" depends="compile">
193 353 jones
       <delete file="${build.dir}/${name}.jar" />
194 822 jones
       <copy todir="${build.dest}">
195
         <fileset dir="lib/srbrmi"/>
196
       </copy>
197 635 jones
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
198
            excludes="**/protocols/" />
199 113 jones
   </target>
200 635 jones
201
   <target name="protocol" depends="compile">
202
       <delete file="${build.dir}/protocol.jar" />
203
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
204
            includes="**/protocols/" />
205
   </target>
206 113 jones
207 877 jones
   <target name="getdtd" depends="prepare">
208
        <cvs cvsRoot="${cvsroot}"
209
             package="${eml-module}"
210
             tag="${eml-tag}"
211
             dest="${build.src}" />
212 879 jones
       <mkdir dir="lib/dtd" />
213
       <copy todir="lib/dtd" filtering="yes">
214
         <fileset dir="${build.src}/${eml-module}">
215
           <include name="*.dtd"/>
216
         </fileset>
217
         <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
218
       </copy>
219 877 jones
   </target>
220
221
   <target name="dtdsql" depends="prepare">
222
     <echo/>
223
     <echo>Registering the DTDs with the new Metacat instance...</echo>
224
     <sql driver="${dbDriver}"
225
          classpath="${jdbc}"
226
          url="${jdbc-connect}"
227
          userid="${user}"
228
          password="${password}"
229
          src="${build.src}/loaddtd.sql" />
230
   </target>
231
232 204 jones
   <target name="install" depends="jar">
233 993 tao
       <mkdir dir="${installdir}/${datadir}" />
234
       <chmod dir="${installdir}/${datadir}" perm="ug+w" />
235 329 jones
       <mkdir dir="${installdir}/WEB-INF/lib" />
236 822 jones
       <copy file="${build.dir}/${name}.jar"
237
             tofile="${installdir}/WEB-INF/lib/${name}.jar" />
238 931 jones
       <copy file="${xmlp}"
239 822 jones
             tofile="${installdir}/WEB-INF/lib/xerces.jar" />
240 923 jones
       <copy file="${xalan}"
241
             tofile="${installdir}/WEB-INF/lib/xalan.jar" />
242 931 jones
       <copy file="${apis}"
243 923 jones
             tofile="${installdir}/WEB-INF/lib/xml-apis.jar" />
244 822 jones
       <copy file="${jdbc}"
245
             tofile="${installdir}/WEB-INF/lib/oracle-jdbc111.jar" />
246
       <copy file="${cos}"
247
             tofile="${installdir}/WEB-INF/lib/cos.jar" />
248 939 tao
       <copy file="${morpho}"
249
	     tofile="${installdir}/WEB-INF/lib/morpho.jar" />
250 822 jones
       <copy file="lib/web.xml"
251
             tofile="${installdir}/WEB-INF/web.xml" />
252
       <copy todir="${build.img}" filtering="no">
253
         <fileset dir="lib">
254
           <include name="**/*.jpg"/>
255
           <include name="**/*.png"/>
256
           <include name="**/*.gif"/>
257
         </fileset>
258
       </copy>
259
       <copy todir="${installdir}" filtering="yes">
260
         <fileset dir="lib">
261
           <exclude name="*.jar"/>
262
           <exclude name="*.properties"/>
263
           <exclude name="web.xml"/>
264
           <exclude name="**/srbrmi*"/>
265
         </fileset>
266
       </copy>
267 877 jones
       <echo>
268
             ***********************************************************
269
              Remember to register the default DTDs by running the
270
              "${build.src}/loaddtd.sql script". This is most easily
271
              done by using the "ant dtdsql" which will run it for you.
272
             ***********************************************************
273
       </echo>
274 204 jones
   </target>
275 971 tao
276
   <target name="test" depends="install">
277
      <!-- copy and compile the tests into a jar file -->
278
      <mkdir dir="${build.junittests}"/>
279 1049 tao
      <javac srcdir="${junittestsdir}"
280
             destdir="${build.junittests}"
281
             classpath="${cpath}:${build.dir}/${name}.jar"
282
	     includes="**/*.java" />
283 204 jones
284 1049 tao
      <jar jarfile="${build.dir}/${name}-junittests.jar"
285
		    basedir="${build.junittests}"
286
          	    includes="**/*.class" />
287 971 tao
288
      <!-- use the ant "junit" task to run JUnit tests. -->
289
      <junit printsummary="yes" haltonfailure="no" fork="no"
290
             haltonerror="no">
291
        <classpath>
292 1049 tao
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
293 971 tao
        </classpath>
294
295
        <formatter type="plain" />
296
297
        <batchtest fork="yes" todir="${build.dir}">
298 1049 tao
          <fileset dir="${junittestsdir}">
299 971 tao
            <include name="**/*.java" />
300
          </fileset>
301
        </batchtest>
302
     </junit>
303
   </target>
304
305 113 jones
   <target name="clean" depends="init">
306 822 jones
       <delete dir="${build.dir}" />
307 113 jones
   </target>
308
309 516 jones
   <target name="jdoc" depends="prepare">
310 822 jones
       <javadoc packagenames="edu.ucsb.nceas.*"
311 516 jones
           sourcepath="${build.src}"
312
           destdir="${build.javadocs}"
313 113 jones
           author="true"
314
           version="true"
315
           use="true"
316 348 jones
           windowtitle="${Name} API"
317
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
318 113 jones
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
319
       />
320
   </target>
321
322 879 jones
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
323 806 jones
      <mkdir dir="${dist.dir}"/>
324
      <delete dir="${ver.dir}" />
325
      <mkdir dir="${ver.dir}"/>
326
      <copy todir="${ver.dir}">
327 882 jones
        <fileset dir="."
328
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
329 806 jones
      </copy>
330
      <copy todir="${ver.dir}" file="build.xml"/>
331
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
332
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
333 882 jones
334
      <copy todir="${ver.dir}/docs" filtering="yes">
335
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
336
      </copy>
337
      <copy todir="${ver.dir}/docs" filtering="no">
338
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
339
      </copy>
340 806 jones
      <copy todir="${ver.dir}/docs/dev">
341
        <fileset dir="${build.dir}/docs"/>
342
      </copy>
343 917 berkley
      <copy todir="${ver.dir}/src">
344
        <fileset dir="${build.dir}/src"/>
345
      </copy>
346
347 992 berkley
      <delete dir="./${ver.dir}/${build.dir}"/>
348
      <delete dir="./${ver.dir}/dist"/>
349 882 jones
      <delete file="./${name}-${release}.zip"/>
350
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}"/>
351
      <delete file="./${name}-${release}.tar.gz" />
352
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}"/>
353
      <gzip zipfile="./${name}-${release}.tar.gz"
354
                src="./${name}-${release}.tar"/>
355
      <delete file="./${name}-${release}.tar" />
356 806 jones
  </target>
357
358
  <target name="distsrc" depends="dist">
359
      <mkdir dir="${ver.src}"/>
360
      <copy todir="${ver.src}">
361
        <fileset dir="./src"/>
362
      </copy>
363
364 882 jones
      <delete file="./${name}-src-${release}.zip"/>
365
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
366
      <delete file="./${name}-src-${release}.tar.gz" />
367
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
368
      <gzip zipfile="./${name}-src-${release}.tar.gz"
369
                src="./${name}-src-${release}.tar"/>
370
      <delete file="./${name}-src-${release}.tar" />
371 807 jones
      <delete dir="${dist.dir}"/>
372 806 jones
  </target>
373
374 113 jones
</project>