Project

General

Profile

metacat / build.xml @ 1464

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:30:27 -0800 (Fri, 07 Mar 2003) $'
11
  *    '$Revision: 1464 $'
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
   </target>
229
  
230
   <target name="getschema" depends="prepare">
231
     <echo>Enter CVS password: </echo>
232
     <cvs cvsRoot="${cvsroot}"
233
          package="${eml-module}"
234
          tag="${eml2-tag}"
235
          dest="${build.src}" />
236
     <mkdir dir="lib/schema" />
237
     <copy todir="lib/schema" filtering="yes">
238
       <fileset dir="${build.src}/${eml-module}">
239
         <include name="*.xsd"/>
240
       </fileset>
241
     </copy>
242
     <copy todir="lib/style">
243
       <fileset dir="${build.src}/${eml-module}/style">
244
       <include name="*.xsl"/>
245
     </fileset>
246
     </copy>
247
   </target> 
248

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

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

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

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

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

    
327
        <formatter type="plain" />
328

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

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

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

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

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

    
370
        <formatter type="plain" />
371

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

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

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

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

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

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

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

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

    
449
</project>