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-06 11:20:16 -0700 (Mon, 06 May 2002) $'
11
  *  '$Revision: 1051 $'
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="localhost:8443"/>
65
      <property name="systemidserver" value="http://localhost:8080" />
66
      <property name="datadir" value="data" />
67
      <property name="replication" value="on" />
68
      <property name="replicationdata" value="on" />
69
      <property name="debuglevel" value="0" />
70
      <property name="web-base-url" 
71
                value="http://knb.ecoinformatics.org"/>
72
      <property name="default-style" value="knb" />
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/xerces.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
   </target>
91

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

    
113
      <property name="cpath" 
114
                value="${xmlp}:${xalan}:${apis}:${jdbc}:${jsdk}:${srb}:${cos}:${morpho}"/>
115

    
116
      <filter token="docrooturl" value="./" />
117
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
118
      <filter token="dbDriver" value="${dbDriver}"/>
119
      <filter token="dbAdapter" value="${dbAdapter}"/>
120
      <filter token="install-dir" value="${installdir}"/>
121
      <filter token="server" value="${server}"/>
122
      <filter token="systemidserver" value="${systemidserver}"/>
123
      <filter token="replication-log" value="${replication-log}"/>
124
      <filter token="release" value="${release}"/>
125
      <filter token="servlet-path" value="${servlet-path}"/>
126
      <filter token="html-path" value="${html-path}"/>
127
      <filter token="user" value="${user}"/>
128
      <filter token="password" value="${password}"/>
129
      <filter token="image-path" value="${image-path}"/>
130
      <filter token="style-path" value="${style-path}"/>
131
      <filter token="web-base-url" value="${web-base-url}"/>
132
      <filter token="replication-path" value="${replication-path}"/>
133
      <filter token="config-dir" value="${config-dir}"/>
134
      <filter token="default-style" value="${default-style}"/>
135
      <filter token="eml-version" value="${eml-version}"/>
136
      <filter token="context" value="${context}"/>
137
      <filter token="replication" value="${replication}" />
138
      <filter token="replicationdata" value="${replicationdata}" />
139
      <filter token="debuglevel" value="${debuglevel}" />
140
      <property name="srcdir" value="./src" />
141
      <property name="junittestsdir" value="./junittests" />
142
      <property name="build.dir" value="./build"/>
143
      <property name="build.src" value="${build.dir}/src"/>
144
      <property name="build.dest" value="${build.dir}/classes"/>
145
      <property name="build.docs" value="${build.dir}/docs"/>
146
      <property name="build.samples" value="${build.dir}/samples"/>
147
      <property name="build.tests" value="${build.dir}/tests"/>
148
      <property name="build.junittests" value="${build.dir}/junittests"/>
149
      <property name="build.data" value="${build.dir}/data"/>
150
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
151
      <property name="build.img" value="${installdir}/${image-path}"/>
152

    
153
      <property name="dist.dir" value="dist"/>
154
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
155
      <property name="ver.src" value="${ver.dir}/src"/>
156

    
157
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
158

    
159
   </target>
160
   
161
   <target name="prepare" depends="init">
162
      <mkdir dir="${build.dir}"/>
163
      <mkdir dir="${build.src}"/>
164
      <mkdir dir="${build.dest}"/>
165
      <mkdir dir="${build.javadocs}"/>
166

    
167
      <copy todir="${build.src}" filtering="yes">
168
        <fileset dir="${srcdir}">
169
          <include name="edu/**"/>
170
          <include name="com/**"/>
171
          <include name="**/*.sql"/>
172
          <exclude name="**/CVS*"/>
173
          <exclude name="**/.#*"/>
174
        </fileset>
175
      </copy>
176
   </target>
177

    
178
   <target name="compile" depends="prepare">
179
       <javac srcdir="${build.src}" 
180
              destdir="${build.dest}" 
181
              classpath="${cpath}" 
182
              excludes="**/*.sql" /> 
183
       <copy file="lib/metacat.properties" 
184
             tofile="${build.dest}/${package.home}/metacat.properties" 
185
             filtering="yes" />
186
       <copy file="lib/srbProps.properties" 
187
             tofile="${build.dest}/${package.home}/srbProps.properties"/>
188
   </target> 
189

    
190
   <target name="jar" depends="compile">
191
       <delete file="${build.dir}/${name}.jar" />
192
       <copy todir="${build.dest}">
193
         <fileset dir="lib/srbrmi"/>
194
       </copy>
195
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
196
            excludes="**/protocols/" />
197
   </target> 
198
 
199
   <target name="protocol" depends="compile">
200
       <delete file="${build.dir}/protocol.jar" />
201
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
202
            includes="**/protocols/" />
203
   </target> 
204

    
205
   <target name="getdtd" depends="prepare">
206
        <cvs cvsRoot="${cvsroot}"
207
             package="${eml-module}"
208
             tag="${eml-tag}"
209
             dest="${build.src}" />
210
       <mkdir dir="lib/dtd" />
211
       <copy todir="lib/dtd" filtering="yes">
212
         <fileset dir="${build.src}/${eml-module}">
213
           <include name="*.dtd"/>
214
         </fileset>
215
         <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
216
       </copy>
217
   </target>
218

    
219
   <target name="dtdsql" depends="prepare">
220
     <echo/>
221
     <echo>Registering the DTDs with the new Metacat instance...</echo>
222
     <sql driver="${dbDriver}"
223
          classpath="${jdbc}"
224
          url="${jdbc-connect}"
225
          userid="${user}"
226
          password="${password}"
227
          src="${build.src}/loaddtd.sql" />
228
   </target>
229

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

    
282
      <jar jarfile="${build.dir}/${name}-junittests.jar" 
283
		    basedir="${build.junittests}"
284
          	    includes="**/*.class" />
285

    
286
      <!-- use the ant "junit" task to run JUnit tests. -->
287
      <junit printsummary="yes" haltonfailure="no" fork="no"
288
             haltonerror="no">
289
        <classpath>
290
          <pathelement path="${cpath}:${build.dir}/${name}.jar:${build.dir}/${name}-junittests.jar" />
291
        </classpath>
292

    
293
        <formatter type="plain" />
294

    
295
        <batchtest fork="yes" todir="${build.dir}">
296
          <fileset dir="${junittestsdir}">
297
            <include name="**/*.java" />
298
          </fileset>
299
        </batchtest>
300
     </junit>
301
   </target>
302
   
303
   <target name="clean" depends="init">
304
       <delete dir="${build.dir}" />
305
   </target>
306

    
307
   <target name="jdoc" depends="prepare">
308
       <javadoc packagenames="edu.ucsb.nceas.*"
309
           sourcepath="${build.src}"
310
           destdir="${build.javadocs}"
311
           author="true"
312
           version="true"
313
           use="true"
314
           windowtitle="${Name} API"
315
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
316
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
317
       />
318
   </target>
319

    
320
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
321
      <mkdir dir="${dist.dir}"/>
322
      <delete dir="${ver.dir}" />
323
      <mkdir dir="${ver.dir}"/>
324
      <copy todir="${ver.dir}">
325
        <fileset dir="." 
326
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
327
      </copy>
328
      <copy todir="${ver.dir}" file="build.xml"/>
329
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
330
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
331

    
332
      <copy todir="${ver.dir}/docs" filtering="yes">
333
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
334
      </copy>
335
      <copy todir="${ver.dir}/docs" filtering="no">
336
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
337
      </copy>
338
      <copy todir="${ver.dir}/docs/dev">
339
        <fileset dir="${build.dir}/docs"/>
340
      </copy>
341
      <copy todir="${ver.dir}/src">
342
        <fileset dir="${build.dir}/src"/>
343
      </copy>
344

    
345
      <delete dir="./${ver.dir}/${build.dir}"/>
346
      <delete dir="./${ver.dir}/dist"/>
347
      <delete file="./${name}-${release}.zip"/>
348
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}"/>
349
      <delete file="./${name}-${release}.tar.gz" />
350
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}"/>
351
      <gzip zipfile="./${name}-${release}.tar.gz" 
352
                src="./${name}-${release}.tar"/>
353
      <delete file="./${name}-${release}.tar" />
354
  </target> 
355

    
356
  <target name="distsrc" depends="dist">
357
      <mkdir dir="${ver.src}"/>
358
      <copy todir="${ver.src}">
359
        <fileset dir="./src"/>
360
      </copy>
361

    
362
      <delete file="./${name}-src-${release}.zip"/>
363
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
364
      <delete file="./${name}-src-${release}.tar.gz" />
365
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
366
      <gzip zipfile="./${name}-src-${release}.tar.gz" 
367
                src="./${name}-src-${release}.tar"/>
368
      <delete file="./${name}-src-${release}.tar" />
369
      <delete dir="${dist.dir}"/>
370
  </target> 
371

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