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-10 18:22:37 -0700 (Fri, 10 May 2002) $'
11
  *  '$Revision: 1073 $'
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="datadir" value="data" />
67
      <property name="replication" value="off" />
68
      <property name="replicationsenddata" value="off" />
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

    
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
      <property name="srcdir" value="./src" />
143
      <property name="junittestsdir" value="./junittests" />
144
      <property name="build.dir" value="./build"/>
145
      <property name="build.src" value="${build.dir}/src"/>
146
      <property name="build.dest" value="${build.dir}/classes"/>
147
      <property name="build.docs" value="${build.dir}/docs"/>
148
      <property name="build.samples" value="${build.dir}/samples"/>
149
      <property name="build.tests" value="${build.dir}/tests"/>
150
      <property name="build.junittests" value="${build.dir}/junittests"/>
151
      <property name="build.data" value="${build.dir}/data"/>
152
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
153
      <property name="build.img" value="${installdir}/${image-path}"/>
154

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

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

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

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

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

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

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

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

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

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

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

    
295
        <formatter type="plain" />
296

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

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

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

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

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

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

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

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