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-11 17:41:54 -0700 (Sat, 11 May 2002) $'
11
  *  '$Revision: 1079 $'
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" />
67
      <property name="replication" value="on" />
68
      <property name="replicationsenddata" value="on" />
69
      <property name="replicationacceptdata" value="on" />
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

    
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}/lib/common/servlet.jar" />
79
      <property name="xmlp" 
80
                value="lib/xerces.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
   </target>
92

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

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

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

    
156
      <property name="dist.dir" value="dist"/>
157
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
158
      <property name="ver.src" value="${ver.dir}/src"/>
159

    
160
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
161

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

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

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

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

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

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

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

    
285
      <jar jarfile="${build.dir}/${name}-junittests.jar" 
286
		    basedir="${build.junittests}"
287
          	    includes="**/*.class" />
288

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

    
296
        <formatter type="plain" />
297

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

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

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

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

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

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

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

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