Project

General

Profile

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: 2002-05-22 20:15:32 -0700 (Wed, 22 May 2002) $'
11
  *  '$Revision: 1116 $'
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="your-pw-goes-here"/>
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="replication" value="on" />
68
      <property name="replicationsenddata" value="on" />
69
      <property name="replicationacceptdata" value="off" />
70
      <property name="debuglevel" value="55" />
71
      <property name="web-base-url" 
72
                value="http://knb.ecoinformatics.org"/>
73
      <property name="default-style" value="knb" />
74
      <property name="morphosourcedir" value="morpho" />
75

    
76
      <!-- Make sure these paths match the location of the jar files
77
           on your system, the defaults should usually work -->
78
      <property name="jsdk" 
79
                value="${tomcat}/lib/common/servlet.jar" />
80
      <property name="xmlp" 
81
                value="lib/xerces.jar" />
82
      <property name="srb" 
83
                value="lib/srbrmi" />
84
      <property name="cos" 
85
                value="lib/cos.jar" />
86
      <property name="morpho"
87
                value="lib/morpho.jar" />
88
      <property name="xalan"
89
                value="lib/xalan/xalan.jar" />
90
      <property name="apis"
91
                value="lib/xalan/xml-apis.jar" />
92
      <property name="httpclient"
93
                value="${morphosourcedir}/lib/httpclient.jar" />
94
      <property name="itis"
95
                value="${morphosourcedir}/lib/itislib.jar" /> 
96

    
97
  </target>
98

    
99
   <target name="init" depends="config">
100
      <!-- It is less likely you'll need to make any changes from here down,
101
           but customization is possible -->
102
      <property name="installdir" value="${webapps}/${context}" />
103
      <property name="name" value="metacat"/>
104
      <property name="Name" value="MetaCat"/>
105
      <property name="release" value="1.1.0"/>
106
      <property name="replication-path" 
107
                value="/${context}/servlet/replication"/>
108
      <property name="servlet-path" value="/${context}/servlet/metacat"/>
109
      <property name="html-path" value="/${context}"/>
110
      <property name="image-path" value="/img/${context}" />
111
      <property name="style-path" value="/${context}/style"/>
112
      <property name="replication-log" value="/tmp/metacatreplication.log"/>
113
      <property name="config-dir" value="${installdir}" />
114
      <property name="eml-module" value="eml" />
115
      <property name="eml-version" value="2.0.0beta6" />
116
      <property name="eml-tag" value="RELEASE_EML_2_0_0_BETA_6" />
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="replication" value="${replication}" />
145
      <filter token="replicationsenddata" value="${replicationsenddata}" />
146
      <filter token="replicationacceptdata" value="${replicationacceptdata}" />
147
      <filter token="debuglevel" value="${debuglevel}" />
148
      <filter token="datafilepath" value="${datafilepath}" />
149
      <property name="srcdir" value="./src" />
150
      <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
151
      <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
152
      <property name="build.dir" value="./build"/>
153
      <property name="build.src" value="${build.dir}/src"/>
154
      <property name="build.dest" value="${build.dir}/classes"/>
155
      <property name="build.docs" value="${build.dir}/docs"/>
156
      <property name="build.samples" value="${build.dir}/samples"/>
157
      <property name="build.tests" value="${build.dir}/tests"/>
158
      <property name="build.metacattest" value="${build.tests}/metacattest"/>
159
      <property name="build.metacatnettest" value="${build.tests}/metacatnettest"/>
160
      <property name="build.data" value="${build.dir}/data"/>
161
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
162
      <property name="build.img" value="${installdir}/${image-path}"/>
163

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

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

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

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

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

    
201
   <target name="jar" depends="compile">
202
       <delete file="${build.dir}/${name}.jar" />
203
       <copy todir="${build.dest}">
204
         <fileset dir="lib/srbrmi"/>
205
       </copy>
206
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
207
            excludes="**/protocols/" />
208
   </target> 
209
 
210
   <target name="protocol" depends="compile">
211
       <delete file="${build.dir}/protocol.jar" />
212
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
213
            includes="**/protocols/" />
214
   </target> 
215

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

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

    
293
      <jar jarfile="${build.dir}/${name}-junittests.jar" 
294
		    basedir="${build.metacattest}"
295
          	    includes="**/*.class" />
296

    
297
      <!-- use the ant "junit" task to run JUnit tests. -->
298
      <junit printsummary="yes" haltonfailure="no" fork="no"
299
             haltonerror="no">
300
        <classpath>
301
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
302
        </classpath>
303

    
304
        <formatter type="plain" />
305

    
306
        <batchtest fork="yes" todir="${build.dir}">
307
          <fileset dir="${build.metacattest}">
308
            <include name="**/*.class" />
309
          </fileset>
310
        </batchtest>
311
     </junit>
312
   </target>
313

    
314
  <target name="gethttpclient" depends="prepare">
315
	<!--mkdir dir="${morphosourcedir}" -->
316
        <cvs cvsRoot=":ext:tao@cvs.ecoinformatics.org:/cvs"
317
             package="morpho"
318
             dest="." />
319
        <ant dir="${morphosourcedir}" inheritAll="false"  target="jar" />
320
   </target>
321

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

    
335
      <jar jarfile="${build.dir}/${name}-junitnettests.jar"
336
                    basedir="${build.metacatnettest}"
337
                    includes="**/*.class" />
338

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

    
347
        <formatter type="plain" />
348

    
349
        <batchtest fork="yes" todir="${build.dir}">
350
          <fileset dir="${build.metacatnettest}">
351
            <include name="**/*.class" />
352
          </fileset>
353
        </batchtest>
354
     </junit>
355
   </target>   
356

    
357
   <target name="clean" depends="init">
358
       <delete dir="${build.dir}" />
359
   </target>
360

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

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

    
386
      <copy todir="${ver.dir}/docs" filtering="yes">
387
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
388
      </copy>
389
      <copy todir="${ver.dir}/docs" filtering="no">
390
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
391
      </copy>
392
      <copy todir="${ver.dir}/docs/dev">
393
        <fileset dir="${build.dir}/docs"/>
394
      </copy>
395
      <copy todir="${ver.dir}/src">
396
        <fileset dir="${build.dir}/src"/>
397
      </copy>
398

    
399
      <delete dir="./${ver.dir}/${build.dir}"/>
400
      <delete dir="./${ver.dir}/dist"/>
401
      <delete file="./${name}-${release}.zip"/>
402
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}"/>
403
      <delete file="./${name}-${release}.tar.gz" />
404
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}"/>
405
      <gzip zipfile="./${name}-${release}.tar.gz" 
406
                src="./${name}-${release}.tar"/>
407
      <delete file="./${name}-${release}.tar" />
408
  </target> 
409

    
410
  <target name="distsrc" depends="dist">
411
      <mkdir dir="${ver.src}"/>
412
      <copy todir="${ver.src}">
413
        <fileset dir="./src"/>
414
      </copy>
415

    
416
      <delete file="./${name}-src-${release}.zip"/>
417
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
418
      <delete file="./${name}-src-${release}.tar.gz" />
419
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
420
      <gzip zipfile="./${name}-src-${release}.tar.gz" 
421
                src="./${name}-src-${release}.tar"/>
422
      <delete file="./${name}-src-${release}.tar" />
423
      <delete dir="${dist.dir}"/>
424
  </target> 
425

    
426
</project>
(4-4/4)