Project

General

Profile

metacat / build.xml @ 1439

1
<?xml version="1.0"?>
2
<!--
3
  *   '$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
  *
9
  *    '$Author: berkley $'
10
  *    '$Date: 2003-02-28 10:48:26 -0800 (Fri, 28 Feb 2003) $'
11
  *    '$Revision: 1437 $'
12
  *
13
  * Build file for the Ant cross-platform build system for metacat
14
  * See http://jakarta.apache.org for details on Ant
15
  *
16
  * usage: ant [compile|jar|install|jdoc]
17
  *
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
-->
32
<project name="metacat" default="jar" basedir=".">
33

    
34
   <target name="oracle">
35
     <!-- 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
     <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
     <!-- Customize these properties if you are using postgres -->
46
     <property name="jdbc-connect"
47
               value="jdbc:postgresql://localhost/exp2"/>
48
     <property name="dbDriver" value="org.postgresql.Driver"/>
49
     <property name="dbAdapter"
50
               value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
51
     <property name="jdbc" value="lib/jdbc7.1-1.2.jar" />
52
   </target>
53

    
54
   <target name="config" depends="postgresql">
55
      <!-- 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
      <property name="tomcat" value="/usr/local/devtools/jakarta-tomcat-3.3a" />
60
      <property name="webapps" value="${tomcat}/webapps" />
61
      <property name="context" value="metacat" />
62
      <property name="user" value="berkley"/>
63
      <property name="password" value=""/>
64
      <property name="server" value="trestles.nceas.ucsb.edu:8090"/>
65
      <property name="systemidserver" value="http://trestles.nceas.ucsb.edu:8090" />
66
      <property name="datafilepath" value="/opt/tomcat/data/berkley/data" />
67
      <property name="debuglevel" value="0" />
68
      <property name="forcereplicationwaitingtime" value="30000"/>
69
      <property name="web-base-url"
70
                value="http://knb.ecoinformatics.org"/>
71
      <property name="default-style" value="knb" />
72
      <property name="morphosourcedir" value="morpho" />
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/xercesImpl.jar" />
80
      <property name="srb"
81
                value="lib/srbrmi" />
82
      <property name="cos"
83
                value="lib/cos.jar" />
84
      <property name="morpho"
85
                value="lib/morpho.jar" />
86
      <property name="xalan"
87
                value="lib/xalan/xalan.jar" />
88
      <property name="apis"
89
                value="lib/xalan/xml-apis.jar" />
90
      <property name="httpclient"
91
                value="${morphosourcedir}/lib/httpclient.jar" />
92
      <property name="itis"
93
                value="${morphosourcedir}/lib/itislib.jar" />
94

    
95
  </target>
96

    
97
   <target name="init" depends="config">
98
      <!-- It is less likely you'll need to make any changes from here down,
99
           but customization is possible -->
100
      <property name="installdir" value="${webapps}/${context}" />
101
      <property name="name" value="metacat"/>
102
      <property name="Name" value="MetaCat"/>
103
      <property name="release" value="1.2.1"/>
104
      <property name="replication-path"
105
                value="/${context}/servlet/replication"/>
106
      <property name="servlet-path" value="/${context}/servlet/metacat"/>
107
      <property name="html-path" value="/${context}"/>
108
      <property name="image-path" value="/${context}" />
109
      <property name="style-path" value="/${context}/style"/>
110
      <property name="replication-log" value="/tmp/metacatreplication.log"/>
111
      <property name="config-dir" value="${installdir}" />
112
      <property name="eml-module" value="eml" />
113
      <property name="eml-version" value="2.0.0beta6" />
114
      <property name="eml-tag" value="RELEASE_EML_2_0_0_BETA_6_REV1" />
115
      <property name="cvsroot"
116
                value=":ext:berkley@cvs.ecoinformatics.org:/cvs" />
117

    
118
      <property name="cpath"
119
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${srb}:${cos}:${morpho}"/>
120

    
121
      <filter token="docrooturl" value="./" />
122
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
123
      <filter token="dbDriver" value="${dbDriver}"/>
124
      <filter token="dbAdapter" value="${dbAdapter}"/>
125
      <filter token="install-dir" value="${installdir}"/>
126
      <filter token="server" value="${server}"/>
127
      <filter token="systemidserver" value="${systemidserver}"/>
128
      <filter token="replication-log" value="${replication-log}"/>
129
      <filter token="release" value="${release}"/>
130
      <filter token="servlet-path" value="${servlet-path}"/>
131
      <filter token="html-path" value="${html-path}"/>
132
      <filter token="user" value="${user}"/>
133
      <filter token="password" value="${password}"/>
134
      <filter token="image-path" value="${image-path}"/>
135
      <filter token="style-path" value="${style-path}"/>
136
      <filter token="web-base-url" value="${web-base-url}"/>
137
      <filter token="replication-path" value="${replication-path}"/>
138
      <filter token="config-dir" value="${config-dir}"/>
139
      <filter token="default-style" value="${default-style}"/>
140
      <filter token="eml-version" value="${eml-version}"/>
141
      <filter token="context" value="${context}"/>
142
      <filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" />
143
      <filter token="debuglevel" value="${debuglevel}" />
144
      <filter token="datafilepath" value="${datafilepath}" />
145
      <property name="srcdir" value="./src" />
146
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
147
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
148
      <property name="build.dir" value="./build"/>
149
      <property name="build.src" value="${build.dir}/src"/>
150
      <property name="build.dest" value="${build.dir}/classes"/>
151
      <property name="build.docs" value="${build.dir}/docs"/>
152
      <property name="build.samples" value="${build.dir}/samples"/>
153
      <property name="build.tests" value="${build.dir}/tests"/>
154
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
155
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
156
      <property name="build.data" value="${build.dir}/data"/>
157
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
158
      <property name="build.img" value="${installdir}"/>
159

    
160
      <property name="dist.dir" value="dist"/>
161
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
162
      <property name="ver.src" value="${ver.dir}/src"/>
163

    
164
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
165

    
166
   </target>
167

    
168
   <target name="prepare" depends="init">
169
      <mkdir dir="${build.dir}"/>
170
      <mkdir dir="${build.src}"/>
171
      <mkdir dir="${build.dest}"/>
172
      <mkdir dir="${build.javadocs}"/>
173

    
174
      <copy todir="${build.src}" filtering="yes">
175
        <fileset dir="${srcdir}">
176
          <include name="edu/**"/>
177
          <include name="com/**"/>
178
          <include name="**/*.sql"/>
179
          <exclude name="**/CVS*"/>
180
          <exclude name="**/.#*"/>
181
        </fileset>
182
      </copy>
183
   </target>
184

    
185
   <target name="compile" depends="prepare">
186
       <javac srcdir="${build.src}"
187
              destdir="${build.dest}"
188
              classpath="${cpath}"
189
              excludes="**/*.sql" />
190
       <copy file="lib/metacat.properties"
191
             tofile="${build.dest}/${package.home}/metacat.properties"
192
             filtering="yes" />
193
       <copy file="lib/srbProps.properties"
194
             tofile="${build.dest}/${package.home}/srbProps.properties"/>
195
   </target>
196

    
197
   <target name="jar" depends="compile">
198
       <delete file="${build.dir}/${name}.jar" />
199
       <copy todir="${build.dest}">
200
         <fileset dir="lib/srbrmi"/>
201
       </copy>
202
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
203
            excludes="**/protocols/" />
204
   </target>
205

    
206
   <target name="protocol" depends="compile">
207
       <delete file="${build.dir}/protocol.jar" />
208
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
209
            includes="**/protocols/" />
210
   </target>
211

    
212
   <target name="getdtd" depends="prepare">
213
     <echo>Enter CVS password: </echo>
214
     <cvs cvsRoot="${cvsroot}"
215
          package="${eml-module}"
216
          tag="${eml-tag}"
217
          dest="${build.src}" />
218
     <mkdir dir="lib/dtd" />
219
     <copy todir="lib/dtd" filtering="yes">
220
       <fileset dir="${build.src}/${eml-module}">
221
         <include name="*.dtd"/>
222
       </fileset>
223
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
224
     </copy>
225
     <copy todir="lib/style">
226
       <fileset dir="${build.src}/${eml-module}/style">
227
       <include name="*.xsl"/>
228
     </fileset>
229
     </copy>
230
   </target>
231

    
232
   <target name="dtdsql" depends="prepare">
233
     <echo/>
234
     <echo>Registering the DTDs with the new Metacat instance...</echo>
235
     <sql driver="${dbDriver}"
236
          classpath="${jdbc}"
237
          url="${jdbc-connect}"
238
          userid="${user}"
239
          password="${password}"
240
          src="${build.src}/loaddtd.sql" />
241
   </target>
242

    
243
   <target name="install" depends="jar">
244
       <mkdir dir="${datafilepath}" />
245
       <chmod dir="${datafilepath}" perm="ug+w" />
246
       <mkdir dir="${installdir}/WEB-INF/lib" />
247
       <copy file="${build.dir}/${name}.jar"
248
             tofile="${installdir}/WEB-INF/lib/${name}.jar" />
249
       <copy file="${xmlp}"
250
             tofile="${installdir}/WEB-INF/lib/xercesImpl.jar" />
251
       <copy file="${xalan}"
252
             tofile="${installdir}/WEB-INF/lib/xalan.jar" />
253
       <copy file="${apis}"
254
             tofile="${installdir}/WEB-INF/lib/xml-apis.jar" />
255
       <copy file="${jdbc}"
256
             tofile="${installdir}/WEB-INF/lib/oracle-jdbc111.jar" />
257
       <copy file="${cos}"
258
             tofile="${installdir}/WEB-INF/lib/cos.jar" />
259
       <copy file="${morpho}"
260
       tofile="${installdir}/WEB-INF/lib/morpho.jar" />
261
       <copy file="lib/web.xml"
262
             tofile="${installdir}/WEB-INF/web.xml" />
263
       <copy todir="${build.img}" filtering="no">
264
         <fileset dir="lib">
265
           <include name="**/*.jpg"/>
266
           <include name="**/*.png"/>
267
           <include name="**/*.gif"/>
268
         </fileset>
269
       </copy>
270
       <copy todir="${installdir}" filtering="yes">
271
         <fileset dir="lib">
272
           <exclude name="*.jar"/>
273
           <exclude name="*.properties"/>
274
           <exclude name="web.xml"/>
275
           <exclude name="**/srbrmi*"/>
276
           <exclude name="**/*.jpg"/>
277
           <exclude name="**/*.png"/>
278
           <exclude name="**/*.gif"/>
279
         </fileset>
280
       </copy>
281
       <echo>
282
             ***********************************************************
283
              Remember to register the default DTDs by running the
284
              "${build.src}/loaddtd.sql script". This is most easily
285
              done by using the "ant dtdsql" which will run it for you.
286
             ***********************************************************
287
       </echo>
288
   </target>
289

    
290
   <target name="test" depends="install">
291
      <!-- copy and compile the tests into a jar file -->
292
      <mkdir dir="${build.metacattest}"/>
293
      <javac srcdir="${junittestsdir}"
294
             destdir="${build.metacattest}"
295
             classpath="${cpath}:${build.dir}/${name}.jar"
296
       includes="**/*.java" />
297

    
298
      <jar jarfile="${build.dir}/${name}-junittests.jar"
299
        basedir="${build.metacattest}"
300
                includes="**/*.class" />
301

    
302
      <!-- use the ant "junit" task to run JUnit tests. -->
303
      <junit printsummary="yes" haltonfailure="no" fork="no"
304
             haltonerror="no">
305
        <classpath>
306
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
307
        </classpath>
308

    
309
        <formatter type="plain" />
310

    
311
        <batchtest fork="yes" todir="${build.dir}">
312
          <fileset dir="${build.metacattest}">
313
            <include name="**/*.class" />
314
          </fileset>
315
        </batchtest>
316
     </junit>
317
   </target>
318

    
319
  <target name="gethttpclient" depends="prepare">
320
  <!--mkdir dir="${morphosourcedir}" -->
321
        <cvs cvsRoot=":ext:tao@cvs.ecoinformatics.org:/cvs"
322
             package="morpho"
323
             dest="." />
324
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
325
   </target>
326

    
327
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
328
   <target name="nettest" depends="install">
329
      <echo>***********************************
330
      Please run ant gethttpclient first!
331
      ***********************************
332
      </echo>
333
      <!-- copy and compile the tests into a jar file -->
334
      <mkdir dir="${build.metacatnettest}"/>
335
      <javac srcdir="${junitnettestsdir}"
336
             destdir="${build.metacatnettest}"
337
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
338
             includes="**/*.java" />
339

    
340
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
341
                    basedir="${build.metacatnettest}"
342
                    includes="**/*.class" />
343

    
344
      <!-- use the ant "junit" task to run JUnit tests. -->
345
      <junit printsummary="yes" haltonfailure="no" fork="yes"
346
             haltonerror="no">
347
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
348
        <classpath>
349
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itis}" />
350
        </classpath>
351

    
352
        <formatter type="plain" />
353

    
354
        <batchtest fork="yes" todir="${build.dir}">
355
          <fileset dir="${build.metacatnettest}">
356
            <include name="**/*.class" />
357
          </fileset>
358
        </batchtest>
359
     </junit>
360
   </target>
361

    
362
   <target name="clean" depends="init">
363
       <delete dir="${build.dir}" />
364
   </target>
365

    
366
   <target name="jdoc" depends="prepare">
367
       <javadoc packagenames="edu.ucsb.nceas.*"
368
           sourcepath="${build.src}"
369
           destdir="${build.javadocs}"
370
           author="true"
371
           version="true"
372
           use="true"
373
           windowtitle="${Name} API"
374
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
375
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
376
       />
377
   </target>
378

    
379
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
380
      <mkdir dir="${dist.dir}"/>
381
      <delete dir="${ver.dir}" />
382
      <mkdir dir="${ver.dir}"/>
383
      <copy todir="${ver.dir}">
384
        <fileset dir="."
385
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
386
      </copy>
387
      <copy todir="${ver.dir}" file="build.xml"/>
388
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
389
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
390

    
391
      <copy todir="${ver.dir}/docs" filtering="yes">
392
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
393
      </copy>
394
      <copy todir="${ver.dir}/docs" filtering="no">
395
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
396
      </copy>
397
      <copy todir="${ver.dir}/docs/dev">
398
        <fileset dir="${build.dir}/docs"/>
399
      </copy>
400
      <copy todir="${ver.dir}/src">
401
        <fileset dir="${build.dir}/src"/>
402
      </copy>
403

    
404
      <delete dir="./${ver.dir}/${build.dir}"/>
405
      <delete dir="./${ver.dir}/dist"/>
406
      <delete file="./${name}-${release}.zip"/>
407
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
408
      <delete file="./${name}-${release}.tar.gz" />
409
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
410
      <gzip zipfile="./${name}-${release}.tar.gz"
411
                src="./${name}-${release}.tar"/>
412
      <delete file="./${name}-${release}.tar" />
413
  </target>
414

    
415
  <target name="distsrc" depends="dist">
416
      <mkdir dir="${ver.src}"/>
417
      <copy todir="${ver.src}">
418
        <fileset dir="./src"/>
419
      </copy>
420

    
421
      <delete file="./${name}-src-${release}.zip"/>
422
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
423
      <delete file="./${name}-src-${release}.tar.gz" />
424
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
425
      <gzip zipfile="./${name}-src-${release}.tar.gz"
426
                src="./${name}-src-${release}.tar"/>
427
      <delete file="./${name}-src-${release}.tar" />
428
      <delete dir="${dist.dir}"/>
429
  </target>
430

    
431
</project>