Project

General

Profile

metacat / build.xml @ 1455

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-05 18:35:18 -0800 (Wed, 05 Mar 2003) $'
11
  *    '$Revision: 1455 $'
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="cvsroot"
117
                value=":ext:tao@cvs.ecoinformatics.org:/cvs" />
118

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

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

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

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

    
168
   </target>
169

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

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

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

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

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

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

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

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

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

    
301
      <jar jarfile="${build.dir}/${name}-junittests.jar"
302
        basedir="${build.metacattest}"
303
                includes="**/*.class" />
304

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

    
312
        <formatter type="plain" />
313

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

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

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

    
343
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
344
                    basedir="${build.metacatnettest}"
345
                    includes="**/*.class" />
346

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

    
355
        <formatter type="plain" />
356

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

    
365
   <target name="clean" depends="init">
366
       <delete dir="${build.dir}" />
367
   </target>
368

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

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

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

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

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

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

    
434
</project>