Project

General

Profile

1 901 berkley
<?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$'
10
  *      '$Date$'
11
  *  '$Revision$'
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
   <target name="init">
34
      <property name="jdbc-connect"
35 909 berkley
                value="jdbc:postgresql://localhost/metacat"/>
36 902 berkley
      <property name="installdir" value="/home/berkley/tomcat/webapps/metacat" />
37
      <property name="dbDriver" value="org.postgresql.Driver"/>
38 915 berkley
      <property name="dbAdapter" value="edu.ucsb.nceas.dbadapter.PostgresqlAdapter"/>
39 901 berkley
      <property name="name" value="metacat"/>
40
      <property name="Name" value="MetaCat"/>
41
      <property name="release" value="1.0.3"/>
42
      <property name="web-base-url"
43 902 berkley
                value="http://alpha.nceas.ucsb.edu:8080/"/>
44 901 berkley
45
      <property name="replication-path" value="/servlet/replication"/>
46
      <property name="servlet-path" value="/metacat/servlet/metacat"/>
47
      <property name="html-path" value="/metacat"/>
48
      <property name="image-path" value="/img/metacat" />
49
      <property name="style-path" value="/metacat/style"/>
50 902 berkley
      <property name="server" value="alpha.nceas.ucsb.edu:8080"/>
51
      <property name="replication-log" value="/home/berkley/tomcat/webapps/metacat/metacatreplication.log"/>
52 909 berkley
      <property name="user" value="metacat"/>
53 902 berkley
      <property name="password" value=""/>
54 901 berkley
      <property name="config-dir" value="${installdir}" />
55
      <property name="default-style" value="knb" />
56
      <property name="eml-module" value="mdstandards/eml" />
57
      <property name="eml-version" value="2.0.0beta6" />
58
      <property name="eml-tag" value="RELEASE_EML_2_0_0_BETA_6" />
59
      <property name="cvsroot"
60
                value=":ext:berkley@cvs.nceas.ucsb.edu:/cvs/pbi" />
61
62
63
      <filter token="docrooturl" value="./" />
64
      <filter token="jdbc-connect" value="${jdbc-connect}"/>
65
      <filter token="dbDriver" value="${dbDriver}"/>
66
      <filter token="install-dir" value="${installdir}"/>
67
      <filter token="serverhost" value="${serverhost}"/>
68
      <filter token="server" value="${server}"/>
69
      <filter token="replication-log" value="${replication-log}"/>
70
      <filter token="release" value="${release}"/>
71
      <filter token="servlet-path" value="${servlet-path}"/>
72
      <filter token="html-path" value="${html-path}"/>
73
      <filter token="user" value="${user}"/>
74
      <filter token="password" value="${password}"/>
75
      <filter token="image-path" value="${image-path}"/>
76
      <filter token="style-path" value="${style-path}"/>
77
      <filter token="web-base-url" value="${web-base-url}"/>
78
      <filter token="replication-path" value="${replication-path}"/>
79
      <filter token="config-dir" value="${config-dir}"/>
80
      <filter token="default-style" value="${default-style}"/>
81
      <filter token="eml-version" value="${eml-version}"/>
82
83
      <property name="srcdir" value="./src" />
84
      <property name="build.dir" value="./build"/>
85
      <property name="build.src" value="${build.dir}/src"/>
86
      <property name="build.dest" value="${build.dir}/classes"/>
87
      <property name="build.docs" value="${build.dir}/docs"/>
88
      <property name="build.samples" value="${build.dir}/samples"/>
89
      <property name="build.tests" value="${build.dir}/tests"/>
90
      <property name="build.data" value="${build.dir}/data"/>
91
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
92
      <property name="build.img" value="${installdir}/${image-path}"/>
93
94
      <property name="dist.dir" value="dist"/>
95
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>
96
      <property name="ver.src" value="${ver.dir}/src"/>
97
98
      <property name="xmlp2"
99 902 berkley
                value="./lib/xerces.jar" />
100 901 berkley
      <property name="jdbc"
101 906 berkley
                value="lib/jdbc7.1-1.2.jar" />
102 901 berkley
      <property name="jsdk"
103 911 berkley
                value="/home/berkley/metacat/tomcat/lib/common/servlet.jar" />
104 901 berkley
      <property name="srb"
105
                value="lib/srbrmi" />
106
      <property name="cos"
107
                value="lib/cos.jar" />
108 906 berkley
      <property name="xalan"
109
                value="lib/xalan/xalan.jar" />
110
      <property name="xalanxml-apis"
111
                value="lib/xalan/xml-apis.jar" />
112 901 berkley
      <property name="cpath"
113 906 berkley
                value="${xalan}:${xalanxml-apis}:${xmlp2}:${jdbc}:${jserv}:${jsdk}:${srb}:${cos}"/>
114 901 berkley
      <property name="package.home" value="edu/ucsb/nceas/metacat" />
115
   </target>
116
117
   <target name="prepare" depends="init">
118
      <mkdir dir="${build.dir}"/>
119
      <mkdir dir="${build.src}"/>
120
      <mkdir dir="${build.dest}"/>
121
      <mkdir dir="${build.javadocs}"/>
122
123
      <copy todir="${build.src}" filtering="yes">
124
        <fileset dir="${srcdir}">
125
          <include name="edu/**"/>
126
          <include name="com/**"/>
127
          <include name="**/*.sql"/>
128
          <exclude name="**/CVS*"/>
129
          <exclude name="**/.#*"/>
130
        </fileset>
131
      </copy>
132
   </target>
133
134
   <target name="compile" depends="prepare">
135
       <javac srcdir="${build.src}"
136
              destdir="${build.dest}"
137
              classpath="${cpath}"
138
              excludes="**/*.sql" />
139
       <copy file="lib/metacat.properties"
140
             tofile="${build.dest}/${package.home}/metacat.properties"
141
             filtering="yes" />
142
       <copy file="lib/srbProps.properties"
143
             tofile="${build.dest}/${package.home}/srbProps.properties"/>
144
   </target>
145
146
   <target name="jar" depends="compile">
147
       <delete file="${build.dir}/${name}.jar" />
148
       <copy todir="${build.dest}">
149
         <fileset dir="lib/srbrmi"/>
150
       </copy>
151
       <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
152
            excludes="**/protocols/" />
153
   </target>
154
155
   <target name="protocol" depends="compile">
156
       <delete file="${build.dir}/protocol.jar" />
157
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
158
            includes="**/protocols/" />
159
   </target>
160
161
   <target name="getdtd" depends="prepare">
162
        <cvs cvsRoot="${cvsroot}"
163
             package="${eml-module}"
164
             tag="${eml-tag}"
165
             dest="${build.src}" />
166
       <mkdir dir="lib/dtd" />
167
       <copy todir="lib/dtd" filtering="yes">
168
         <fileset dir="${build.src}/${eml-module}">
169
           <include name="*.dtd"/>
170
         </fileset>
171
         <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
172
       </copy>
173
   </target>
174
175
   <target name="dtdsql" depends="prepare">
176
     <echo/>
177
     <echo>Registering the DTDs with the new Metacat instance...</echo>
178
     <sql driver="${dbDriver}"
179
          classpath="${jdbc}"
180
          url="${jdbc-connect}"
181
          userid="${user}"
182
          password="${password}"
183
          src="${build.src}/loaddtd.sql" />
184
   </target>
185
186
   <target name="install" depends="jar">
187
       <mkdir dir="${installdir}/WEB-INF/lib" />
188
       <copy file="${build.dir}/${name}.jar"
189
             tofile="${installdir}/WEB-INF/lib/${name}.jar" />
190
       <copy file="${xmlp2}"
191
             tofile="${installdir}/WEB-INF/lib/xerces.jar" />
192
       <copy file="${jdbc}"
193
             tofile="${installdir}/WEB-INF/lib/oracle-jdbc111.jar" />
194
       <copy file="${cos}"
195
             tofile="${installdir}/WEB-INF/lib/cos.jar" />
196 906 berkley
       <copy file="${xalan}"
197
             tofile="${installdir}/WEB-INF/lib/xalan.jar" />
198
       <copy file="${xalanxml-apis}"
199
             tofile="${installdir}/WEB-INF/lib/xml-apis.jar" />
200 901 berkley
       <copy file="lib/web.xml"
201
             tofile="${installdir}/WEB-INF/web.xml" />
202
       <copy todir="${build.img}" filtering="no">
203
         <fileset dir="lib">
204
           <include name="**/*.jpg"/>
205
           <include name="**/*.png"/>
206
           <include name="**/*.gif"/>
207
         </fileset>
208
       </copy>
209
       <copy todir="${installdir}" filtering="yes">
210
         <fileset dir="lib">
211
           <exclude name="*.jar"/>
212
           <exclude name="*.properties"/>
213
           <exclude name="web.xml"/>
214
           <exclude name="**/srbrmi*"/>
215
         </fileset>
216
       </copy>
217
       <echo>
218
             ***********************************************************
219
              Remember to register the default DTDs by running the
220
              "${build.src}/loaddtd.sql script". This is most easily
221
              done by using the "ant dtdsql" which will run it for you.
222
             ***********************************************************
223
       </echo>
224
   </target>
225
226
   <target name="clean" depends="init">
227
       <delete dir="${build.dir}" />
228
   </target>
229
230
   <target name="jdoc" depends="prepare">
231
       <javadoc packagenames="edu.ucsb.nceas.*"
232
           sourcepath="${build.src}"
233
           destdir="${build.javadocs}"
234
           author="true"
235
           version="true"
236
           use="true"
237
           windowtitle="${Name} API"
238
           doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
239
           bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;"
240
       />
241
   </target>
242
243
   <target name="dist" depends="jar,protocol,jdoc,getdtd">
244
      <mkdir dir="${dist.dir}"/>
245
      <delete dir="${ver.dir}" />
246
      <mkdir dir="${ver.dir}"/>
247
      <copy todir="${ver.dir}">
248
        <fileset dir="."
249
            excludes="**/CVS* **/.#* **/src* **/test* **/build* **/docs* ${dist.dir}"/>
250
      </copy>
251
      <copy todir="${ver.dir}" file="build.xml"/>
252
      <copy todir="${ver.dir}/lib" file="${build.dir}/metacat.jar"/>
253
      <copy todir="${ver.dir}/lib" file="${build.dir}/protocol.jar"/>
254
255
      <copy todir="${ver.dir}/docs" filtering="yes">
256
        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
257
      </copy>
258
      <copy todir="${ver.dir}/docs" filtering="no">
259
        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
260
      </copy>
261
      <copy todir="${ver.dir}/docs/dev">
262
        <fileset dir="${build.dir}/docs"/>
263
      </copy>
264
265
      <delete file="./${name}-${release}.zip"/>
266
      <zip zipfile="./${name}-${release}.zip" basedir="${dist.dir}"/>
267
      <delete file="./${name}-${release}.tar.gz" />
268
      <tar tarfile="./${name}-${release}.tar" basedir="${dist.dir}"/>
269
      <gzip zipfile="./${name}-${release}.tar.gz"
270
                src="./${name}-${release}.tar"/>
271
      <delete file="./${name}-${release}.tar" />
272
  </target>
273
274
  <target name="distsrc" depends="dist">
275
      <mkdir dir="${ver.src}"/>
276
      <copy todir="${ver.src}">
277
        <fileset dir="./src"/>
278
      </copy>
279
280
      <delete file="./${name}-src-${release}.zip"/>
281
      <zip zipfile="./${name}-src-${release}.zip" basedir="${dist.dir}"/>
282
      <delete file="./${name}-src-${release}.tar.gz" />
283
      <tar tarfile="./${name}-src-${release}.tar" basedir="${dist.dir}"/>
284
      <gzip zipfile="./${name}-src-${release}.tar.gz"
285
                src="./${name}-src-${release}.tar"/>
286
      <delete file="./${name}-src-${release}.tar" />
287
      <delete dir="${dist.dir}"/>
288
  </target>
289
290
</project>