Project

General

Profile

metacat / build.xml @ 1463

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: tao $'
10
  *    '$Date: 2003-03-07 16:24:42 -0800 (Fri, 07 Mar 2003) $'
11
  *    '$Revision: 1463 $'
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/exp"/>
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" />
60
      <property name="webapps" value="/usr/local/devtools/jakarta-tomcat/webapps" />
61
      <property name="context" value="tao" />
62
      <property name="user" value="tao"/>
63
      <property name="password" value="tdataint"/>
64
      <property name="server" value="pine.nceas.ucsb.edu:8443"/>
65
      <property name="systemidserver" value="http://pine.nceas.ucsb.edu:8080" />
66
      <property name="datafilepath" value="/usr/local/devtools/jakarta-tomcat/data/tao/data" />
67
      <property name="inlinedatafilepath" value="/usr/local/devtools/jakarta-tomcat/data/tao/inlinedata" />
68
      <property name="debuglevel" value="55" />
69
      <property name="forcereplicationwaitingtime" value="30000"/>
70
      <property name="web-base-url"
71
                value="http://knb.ecoinformatics.org"/>
72
      <property name="default-style" value="knb" />
73
      <property name="morphosourcedir" value="morpho" />
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}/common/lib/servlet.jar" />
79
      <property name="xmlp"
80
                value="lib/xercesImpl.jar" />
81
      <property name="srb"
82
                value="lib/srbrmi" />
83
      <property name="cos"
84
                value="lib/cos.jar" />
85
      <property name="morpho"
86
                value="lib/morpho.jar" />
87
      <property name="xalan"
88
                value="lib/xalan/xalan.jar" />
89
      <property name="apis"
90
                value="lib/xalan/xml-apis.jar" />
91
      <property name="httpclient"
92
                value="${morphosourcedir}/lib/httpclient.jar" />
93
      <property name="itis"
94
                value="${morphosourcedir}/lib/itislib.jar" />
95

    
96
  </target>
97

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

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

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

    
163
      <property name="dist.dir" value="dist"/>
164
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
165
      <property name="ver.src" value="${ver.dir}/src"/>
166

    
167
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
168

    
169
   </target>
170

    
171
   <target name="prepare" depends="init">
172
      <mkdir dir="${build.dir}"/>
173
      <mkdir dir="${build.src}"/>
174
      <mkdir dir="${build.dest}"/>
175
      <mkdir dir="${build.javadocs}"/>
176

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

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

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

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

    
215
   <target name="getdtd" depends="prepare">
216
     <echo>Enter CVS password: </echo>
217
     <cvs cvsRoot="${cvsroot}"
218
          package="${eml-module}"
219
          tag="${eml-tag}"
220
          dest="${build.src}" />
221
     <mkdir dir="lib/dtd" />
222
     <copy todir="lib/dtd" filtering="yes">
223
       <fileset dir="${build.src}/${eml-module}">
224
         <include name="*.dtd"/>
225
       </fileset>
226
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
227
     </copy>
228
     </copy>
229
   </target>
230
  
231
   <target name="getschema" depends="prepare">
232
     <echo>Enter CVS password: </echo>
233
     <cvs cvsRoot="${cvsroot}"
234
          package="${eml-module}"
235
          tag="${eml2-tag}"
236
          dest="${build.src}" />
237
     <mkdir dir="lib/schema" />
238
     <copy todir="lib/schema" filtering="yes">
239
       <fileset dir="${build.src}/${eml-module}">
240
         <include name="*.xsd"/>
241
       </fileset>
242
     </copy>
243
     <copy todir="lib/style">
244
       <fileset dir="${build.src}/${eml-module}/style">
245
       <include name="*.xsl"/>
246
     </fileset>
247
     </copy>
248
   </target> 
249

    
250
   <target name="dtdsql" depends="prepare">
251
     <echo/>
252
     <echo>Registering the DTDs with the new Metacat instance...</echo>
253
     <sql driver="${dbDriver}"
254
          classpath="${jdbc}"
255
          url="${jdbc-connect}"
256
          userid="${user}"
257
          password="${password}"
258
          src="${build.src}/loaddtd.sql" />
259
   </target>
260

    
261
   <target name="install" depends="jar">
262
       <mkdir dir="${datafilepath}" />
263
       <mkdir dir="${inlinedatafilepath}" />
264
       <chmod dir="${datafilepath}" perm="ug+w" />
265
       <mkdir dir="${installdir}/WEB-INF/lib" />
266
       <copy file="${build.dir}/${name}.jar"
267
             tofile="${installdir}/WEB-INF/lib/${name}.jar" />
268
       <copy file="${xmlp}"
269
             tofile="${installdir}/WEB-INF/lib/xercesImpl.jar" />
270
       <copy file="${xalan}"
271
             tofile="${installdir}/WEB-INF/lib/xalan.jar" />
272
       <copy file="${apis}"
273
             tofile="${installdir}/WEB-INF/lib/xml-apis.jar" />
274
       <copy file="${jdbc}"
275
             tofile="${installdir}/WEB-INF/lib/oracle-jdbc111.jar" />
276
       <copy file="${cos}"
277
             tofile="${installdir}/WEB-INF/lib/cos.jar" />
278
       <copy file="${morpho}"
279
       tofile="${installdir}/WEB-INF/lib/morpho.jar" />
280
       <copy file="lib/web.xml"
281
             tofile="${installdir}/WEB-INF/web.xml" />
282
       <copy todir="${build.img}" filtering="no">
283
         <fileset dir="lib">
284
           <include name="**/*.jpg"/>
285
           <include name="**/*.png"/>
286
           <include name="**/*.gif"/>
287
         </fileset>
288
       </copy>
289
       <copy todir="${installdir}" filtering="yes">
290
         <fileset dir="lib">
291
           <exclude name="*.jar"/>
292
           <exclude name="*.properties"/>
293
           <exclude name="web.xml"/>
294
           <exclude name="**/srbrmi*"/>
295
           <exclude name="**/*.jpg"/>
296
           <exclude name="**/*.png"/>
297
           <exclude name="**/*.gif"/>
298
         </fileset>
299
       </copy>
300
       <echo>
301
             ***********************************************************
302
              Remember to register the default DTDs by running the
303
              "${build.src}/loaddtd.sql script". This is most easily
304
              done by using the "ant dtdsql" which will run it for you.
305
             ***********************************************************
306
       </echo>
307
   </target>
308

    
309
   <target name="test" depends="install">
310
      <!-- copy and compile the tests into a jar file -->
311
      <mkdir dir="${build.metacattest}"/>
312
      <javac srcdir="${junittestsdir}"
313
             destdir="${build.metacattest}"
314
             classpath="${cpath}:${build.dir}/${name}.jar"
315
       includes="**/*.java" />
316

    
317
      <jar jarfile="${build.dir}/${name}-junittests.jar"
318
        basedir="${build.metacattest}"
319
                includes="**/*.class" />
320

    
321
      <!-- use the ant "junit" task to run JUnit tests. -->
322
      <junit printsummary="yes" haltonfailure="no" fork="no"
323
             haltonerror="no">
324
        <classpath>
325
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
326
        </classpath>
327

    
328
        <formatter type="plain" />
329

    
330
        <batchtest fork="yes" todir="${build.dir}">
331
          <fileset dir="${build.metacattest}">
332
            <include name="**/*.class" />
333
          </fileset>
334
        </batchtest>
335
     </junit>
336
   </target>
337

    
338
  <target name="gethttpclient" depends="prepare">
339
  <!--mkdir dir="${morphosourcedir}" -->
340
        <cvs cvsRoot=":ext:tao@cvs.ecoinformatics.org:/cvs"
341
             package="morpho"
342
             dest="." />
343
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
344
   </target>
345

    
346
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
347
   <target name="nettest" depends="install">
348
      <echo>***********************************
349
      Please run ant gethttpclient first!
350
      ***********************************
351
      </echo>
352
      <!-- copy and compile the tests into a jar file -->
353
      <mkdir dir="${build.metacatnettest}"/>
354
      <javac srcdir="${junitnettestsdir}"
355
             destdir="${build.metacatnettest}"
356
             classpath="${cpath}:${build.dir}/${name}.jar:${httpclient}"
357
             includes="**/*.java" />
358

    
359
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
360
                    basedir="${build.metacatnettest}"
361
                    includes="**/*.class" />
362

    
363
      <!-- use the ant "junit" task to run JUnit tests. -->
364
      <junit printsummary="yes" haltonfailure="no" fork="yes"
365
             haltonerror="no">
366
        <jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
367
        <classpath>
368
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${httpclient}:${build.dir}/${name}-junitnettests.jar:${itis}" />
369
        </classpath>
370

    
371
        <formatter type="plain" />
372

    
373
        <batchtest fork="yes" todir="${build.dir}">
374
          <fileset dir="${build.metacatnettest}">
375
            <include name="**/*.class" />
376
          </fileset>
377
        </batchtest>
378
     </junit>
379
   </target>
380

    
381
   <target name="clean" depends="init">
382
       <delete dir="${build.dir}" />
383
   </target>
384

    
385
   <target name="jdoc" depends="prepare">
386
       <javadoc packagenames="edu.ucsb.nceas.*"
387
           sourcepath="${build.src}"
388
           destdir="${build.javadocs}"
389
           author="true"
390
           version="true"
391
           use="true"
392
           windowtitle="${Name} API"
393
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
394
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
395
       />
396
   </target>
397

    
398
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
399
      <mkdir dir="${dist.dir}"/>
400
      <delete dir="${ver.dir}" />
401
      <mkdir dir="${ver.dir}"/>
402
      <copy todir="${ver.dir}">
403
        <fileset dir="."
404
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
405
      </copy>
406
      <copy todir="${ver.dir}" file="build.xml"/>
407
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
408
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
409

    
410
      <copy todir="${ver.dir}/docs" filtering="yes">
411
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
412
      </copy>
413
      <copy todir="${ver.dir}/docs" filtering="no">
414
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
415
      </copy>
416
      <copy todir="${ver.dir}/docs/dev">
417
        <fileset dir="${build.dir}/docs"/>
418
      </copy>
419
      <copy todir="${ver.dir}/src">
420
        <fileset dir="${build.dir}/src"/>
421
      </copy>
422

    
423
      <delete dir="./${ver.dir}/${build.dir}"/>
424
      <delete dir="./${ver.dir}/dist"/>
425
      <delete file="./${name}-${release}.zip"/>
426
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
427
      <delete file="./${name}-${release}.tar.gz" />
428
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}" excludes="${name}-${release}/src/**, ${name}-${release}/build/src/**"/>
429
      <gzip zipfile="./${name}-${release}.tar.gz"
430
                src="./${name}-${release}.tar"/>
431
      <delete file="./${name}-${release}.tar" />
432
  </target>
433

    
434
  <target name="distsrc" depends="dist">
435
      <mkdir dir="${ver.src}"/>
436
      <copy todir="${ver.src}">
437
        <fileset dir="./src"/>
438
      </copy>
439

    
440
      <delete file="./${name}-src-${release}.zip"/>
441
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
442
      <delete file="./${name}-src-${release}.tar.gz" />
443
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
444
      <gzip zipfile="./${name}-src-${release}.tar.gz"
445
                src="./${name}-src-${release}.tar"/>
446
      <delete file="./${name}-src-${release}.tar" />
447
      <delete dir="${dist.dir}"/>
448
  </target>
449

    
450
</project>