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