Project

General

Profile

metacat / workflowscheduler.build.xml @ 5044

1
<?xml version="1.0"?>
2
<!--
3
        *   '$RCSfile$'
4
        *     Authors: Michael Daigle
5
        *   Copyright: 2009 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: daigle $'
10
        *    '$Date: 2009-07-30 10:31:08 -0700 (Thu, 30 Jul 2009) $'
11
        *    '$Revision: 5009 $'
12
        *
13
        * Build file for the Ant cross-platform build system for the 
14
        * Workflow Scheduler Application
15
        * See http://jakarta.apache.org for details on Ant
16
        *
17
        * usage: ant [compile|jar|install|jdoc]
18
        *
19
        * This program is free software; you can redistribute it and/or modify
20
        * it under the terms of the GNU General Public License as published by
21
        * the Free Software Foundation; either version 2 of the License, or
22
        * (at your option) any later version.
23
        *
24
        * This program is distributed in the hope that it will be useful,
25
        * but WITHOUT ANY WARRANTY; without even the implied warranty of
26
        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27
        * GNU General Public License for more details.
28
        *
29
        * You should have received a copy of the GNU General Public License
30
        * along with this program; if not, write to the Free Software
31
        * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
32
-->
33
<project name="workflowscheduler" default="jar" basedir=".">
34
        <property environment="env" />
35
        <property file="build.properties" /><!-- USER SPECIFIC PROPS -->
36

    
37
        <target name="config">
38
                <property name="jsdk"
39
                        value="${build.tomcat.dir}/common/lib/servlet-api.jar" />
40

    
41
                <property name="debug" value="on" />
42
                <!-- property name="morphosourcedir" value="../morpho" / -->
43
                <property name="utilitiesdir" value="../utilities" />
44
                <property name="installdir"
45
                        value="${app.deploy.dir}/${workflowscheduler.context}" />
46

    
47
                <echo>*********** set jsdk to ${jsdk}</echo>
48
        </target>
49

    
50
        <target name="init" depends="config">
51
                <path id="compile.classpath">
52
                        <pathelement location="${jsdk}" />
53
                        <pathelement location="lib" />
54
                        <fileset dir="lib">
55
                                <include name="cos.jar" />
56
                                <include name="postgresql-8.0-312.jar" />
57
                                <include name="quartz-1.5.2.jar" />
58
                                <include name="utilities.jar" />
59
                                <include name="log4j-1.2.12.jar" />
60
                        </fileset>
61
                        <fileset dir="lib/lsid_lib">
62
                                <include name="commons-logging-1.0.4.jar" />
63
                                <include name="axis.jar" />
64
                                <include name="jaxrpc.jar" />
65
                        </fileset>
66
                        <fileset dir="lib/spatial/geoserver/WEB-INF/lib">
67
                                <include name="commons-httpclient-2.0.jar" />
68
                        </fileset>
69
                </path>
70

    
71
                <!-- It is less likely you'll need to make any changes from here down,
72
                        but customization is possible -->
73
                <property name="name" value="workflowscheduler" />
74
                <property name="Name" value="workflowscheduler" />
75
                <property name="debugprefix" value="${Name}:" />
76
                <property name="release" value="${metacat.version}" />
77

    
78
                <filter token="docrooturl" value="./" />
79
                <filter token="debugprefix" value="${debugprefix}" />
80
                <filter token="build.context" value="${workflowscheduler.context}" />
81

    
82
                <property name="srcdir" value="./src" />
83
                <property name="lib.dir" value="./lib" />
84
                <property name="docdir" value="./docs" />
85
                <property name="testdir" value="./test" />
86
                <property name="build.dir" value="./workflowscheduler.build" />
87
                <property name="build.src" value="${build.dir}/src" />
88
                <property name="build.dest" value="${build.dir}/classes" />
89
                <property name="build.samples" value="${build.dir}/samples" />
90
                <property name="build.tests" value="${build.dir}/tests" />
91
                <property name="build.tmp" value="${build.dir}/tmp" />
92
                <property name="build.metacattest"
93
                        value="${build.tests}/metacattest" />
94
                <property name="build.metacatnettest"
95
                        value="${build.tests}/metacatnettest" />
96
                <property name="build.data" value="${build.dir}/data" />
97
                <property name="build.javadocs" value="${build.dir}/docs/api" />
98
                <property name="build.war" value="${build.dir}/war" />
99
                <property name="dist.dir" value="${name}.dist" />
100
                <property name="ver.dir" value="${dist.dir}/${name}-${release}" />
101
                <property name="ver.src" value="${ver.dir}/src" />
102
                <property name="util.dir" value="${dist.dir}/${util-module}" />
103
                <property name="test.dir" value="${dist.dir}/test" />
104
                <!-- directories for creating a Harvest List Editor distribution -->
105
                <property name="dist.dir.hle" value="disthle" />
106
                <property name="ver.dir.hle"
107
                        value="${dist.dir.hle}/harvest-list-editor-${release}" />
108
                <property name="pkg.dir" value="./package" />
109

    
110
                <property name="package.home" value="edu/ucsb/nceas/metacat" />
111

    
112
                <!-- set up svn -->
113
                <property name="svnant.lib" value="lib" />
114
                <property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
115
                <property name="svnClientAdapter.jar"
116
                        value="${svnant.lib}/svnClientAdapter.jar" />
117
                <property name="svnjavahl.jar"
118
                        value="${svnant.lib}/svnjavahl.jar" />
119
                <property name="svn.utilitiesUrl"
120
                        value="https://code.ecoinformatics.org/code/utilities/tags/${utilities-tag}" />
121
                <property name="svn.ecogridUrl"
122
                        value="https://code.ecoinformatics.org/code/seek/trunk/projects/ecogrid/" />
123
                <!--  property name="svn.utilitiesExportPath" value="${knbdir}" / -->
124

    
125
                <!-- load the svn task -->
126
                <path id="svn.classpath">
127
                        <pathelement location="${svnjavahl.jar}" />
128
                        <pathelement location="${svnant.jar}" />
129
                        <pathelement location="${svnClientAdapter.jar}" />
130
                </path>
131
                <taskdef resource="svntask.properties"
132
                        classpathref="svn.classpath" />
133

    
134
                <condition property="utilities.required">
135
                        <or>
136
                                <not>
137
                                        <available file="lib/httpclient.jar" />
138
                                </not>
139
                                <not>
140
                                        <available file="lib/utilities.jar" />
141
                                </not>
142
                                <not>
143
                                        <available file="${utilitiesdir}" type="dir" />
144
                                </not>
145
                        </or>
146
                </condition>
147
                <!-- peer.utilities.required is used when there is no utilities 
148
                        directory at ${utilitiesdir} -->
149
                <condition property="peer.utilities.required">
150
                        <or>
151
                                <not>
152
                                        <available file="${utilitiesdir}" type="dir" />
153
                                </not>
154
                        </or>
155
                </condition>
156
        </target>
157

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

    
165
                <copy todir="${build.src}" filtering="yes">
166
                        <fileset dir="${srcdir}">
167
                                <include name="edu/ucsb/nceas/dbadapter/**" />
168
                                <include name="edu/ucsb/nceas/shared/**" />
169
                                <include name="edu/ucsb/nceas/metacat/Version.java" />
170
                                <include name="edu/ucsb/nceas/metacat/cart/**" />
171
                                <include name="edu/ucsb/nceas/metacat/database/**" />
172
                                <include name="edu/ucsb/nceas/metacat/properties/**" />
173
                                <exclude name="edu/ucsb/nceas/metacat/properties/SkinPropertyService.java" />
174
                                <exclude name="edu/ucsb/nceas/metacat/properties/ConfigurableProperties.java" />
175
                                <include name="edu/ucsb/nceas/metacat/scheduler/**" />
176
                                <include name="edu/ucsb/nceas/metacat/shared/**" />
177
                                <include name="edu/ucsb/nceas/metacat/util/**" />
178
                                <exclude name="edu/ucsb/nceas/metacat/util/ConfigurationUtil.java" />
179
                                <exclude name="edu/ucsb/nceas/metacat/util/DocumentUtil.java" />
180
                                <exclude name="edu/ucsb/nceas/metacat/util/EMLVersionsTransformer.java" />
181
                                <exclude name="edu/ucsb/nceas/metacat/util/GeoserverUtil.java" />
182
                                <exclude name="edu/ucsb/nceas/metacat/util/OrganizationUtil.java" />
183
                                <include name="edu/ucsb/nceas/metacat/AuthInterface.java" />
184
                                <include name="edu/ucsb/nceas/metacat/AuthLdap.java" />
185
                                <include name="edu/ucsb/nceas/metacat/AuthSession.java" />
186
                                <include name="edu/ucsb/nceas/metacat/MetacatVersion.java" />
187
                                <include name="edu/ucsb/nceas/metacat/service/SessionService.java" />
188
                                <include name="edu/ucsb/nceas/metacat/service/ServiceService.java" />
189
                                <include name="edu/ucsb/nceas/workflowscheduler/**" />
190
                                <include name="org/kepler/executionWS/**" />
191
                                <exclude name="**/CVS*" />
192
                                <exclude name="**/.#*" />
193
                        </fileset>
194
                </copy>
195
        </target>
196

    
197
        <taskdef resource="axis-tasks.properties"
198
                classpathref="compile.classpath" />
199

    
200
        <target name="generateStubs" depends="prepare">
201
                <echo
202
                        message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
203
                <axis-wsdl2java verbose="true" output="${srcdir}"
204
                        url="/tmp/KeplerWebService.wsdl" />
205
        </target>
206

    
207
        <target name="compile" depends="prepare, utilities"
208
                description="Compiles java code to build dir, and copies metacat props files there">
209

    
210
                <javac srcdir="${build.src}" destdir="${build.dest}"
211
                        debug="${debug}"
212
                        excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
213
                        <classpath>
214
                                <path refid="compile.classpath" />
215
                        </classpath>
216
                </javac>
217
        </target>
218

    
219
        <target name="jar" depends="compile"
220
                description="Compiles and jars metacat java code to metacat.jar in build dir ">
221

    
222
                <delete file="${build.dir}/${name}.jar" />
223
                <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
224
                        excludes="**/protocols/ **/harvesterClient/" />
225
        </target>
226

    
227
        <target name="utilities" depends="config,getpeerutilities"
228
                if="utilities.required">
229
                <ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
230
                <ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
231
                <copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
232
                <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
233
        </target>
234

    
235
        <target name="getpeerutilities" depends="prepare"
236
                if="peer.utilities.required"
237
                description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
238
                <echo message="Exporting utiities files from svn repository:" />
239
                <!-- input message="Please enter svn repo username:" addproperty="svn.username" / -->
240
                <!-- input message="Please enter svn repo password:" addproperty="svn.password" / -->
241
                <!--  svn username="${svn.username}" password="${svn.password}" -->
242
                <svn>
243
                        <export srcUrl="${svn.utilitiesUrl}"
244
                                destPath="${utilitiesdir}" />
245
                </svn>
246

    
247
                <!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
248
        </target>
249

    
250
        <target name="getutilities" depends="prepare"
251
                description="Checks utility out of svn and copies it to your metacat cvs sandbox">
252
                <echo>Enter CVS password:</echo>
253
                <cvs cvsRoot="${cvsroot}" package="${util-module}"
254
                        tag="${utilities-tag}" dest="${build.tmp}" />
255
        </target>
256

    
257
        <target name="install" depends="init, war"
258
                description="* Full Install For Development *">
259
                <copy file="${dist.dir}/${workflowscheduler.context}.war"
260
                        todir="${app.deploy.dir}" />
261
                <delete dir="${app.deploy.dir}/${workflowscheduler.context}" />
262
                <tstamp>
263
                        <format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
264
                </tstamp>
265
                <echo>Dev install completed at ${NOW}</echo>
266
        </target>
267

    
268
        <target name="war" depends="warPrepare"
269
                description="Create a web archive (WAR) for servlet deployment">
270
                <mkdir dir="${dist.dir}" />
271
                <war destfile="${dist.dir}/${workflowscheduler.context}.war"
272
                        webxml="${build.war}/web.xml">
273
                        <fileset dir="${war.context}" />
274
                        <lib dir="${war.lib}" />
275
                        <webinf dir="${war.webinf}" />
276
                </war>
277
        </target>
278

    
279
        <target name="warPrepare" depends="jar"
280
                description="Prepare files for creating a web archive (WAR)">
281

    
282
                <property name="war.lib" value="${build.war}/lib" />
283
                <property name="war.webinf" value="${build.war}/WEB-INF" />
284
                <property name="war.context"
285
                        value="${build.war}/${workflowscheduler.context}" />
286
                <property name="war.webinf.sql" value="${war.webinf}/sql" />
287
                <property name="war.webinf.scripts"
288
                        value="${war.webinf}/scripts" />
289
                <mkdir dir="${war.lib}" />
290
                <mkdir dir="${war.webinf}" />
291
                <mkdir dir="${war.context}" />
292
                <mkdir dir="${war.webinf.sql}" />
293

    
294
                <copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
295
                <copy todir="${war.lib}" filtering="no">
296
                        <fileset dir="lib">
297
                                <include name="cos.jar" />
298
                                <include name="postgresql-8.0-312.jdbc3.jar" />
299
                                <include name="quartz-1.5.2.jar" />
300
                                <include name="utilities.jar" />
301
                                <include name="log4j-1.2.12.jar" />
302
                                <include name="xalan.jar" />
303
                        </fileset>
304
                        <fileset dir="lib/lsid_lib">
305
                                <include name="commons-logging-1.0.4.jar" />
306
                                <include name="axis.jar" />
307
                                <include name="jaxrpc.jar" />
308
                        </fileset>
309
                        <fileset dir="lib/spatial/geoserver/WEB-INF/lib">
310
                                <include name="commons-httpclient-2.0.jar" />
311
                        </fileset>
312
                </copy>
313

    
314
                <!-- MCD added next - Remove the tomcat5 reference-->
315
                <copy file="lib/${name}/${name}.web.xml" tofile="${build.war}/web.xml" />
316
                <copy file="lib/${name}/${name}.properties" todir="${war.webinf}"
317
                        filtering="yes" />
318
                <!-- copy file="lib/${name}/${name}.properties.metadata.xml"
319
                        todir="${war.webinf}" filtering="no" / -->
320
                <!--  copy file="lib/auth.properties.metadata.xml"
321
                        todir="${war.webinf}" filtering="no" / -->
322
                <copy file="lib/log4j.properties" todir="${war.webinf}"
323
                        filtering="yes" />
324

    
325
                <copy todir="${war.webinf.sql}" filtering="yes">
326
                        <fileset dir="src">
327
                                <include name="**/*.sql" />
328
                        </fileset>
329
                </copy>
330
                <copy todir="${war.webinf.scripts}" filtering="yes">
331
                        <fileset dir="src/scripts" />
332
                </copy>
333
                <copy todir="${war.webinf.scripts}"
334
                        file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
335
                        failonerror="false" />
336
        </target>
337

    
338
        <target name="clean" depends="init"
339
                description="deletes build dir and files that can be regenerated form the release">
340
                <delete dir="${build.dir}" />
341
                <delete dir="${dist.dir}" />
342
        </target>
343

    
344
        <target name="localclean" depends="clean"
345
                description="deletes even jars that depend on external sources such as stylesheets and jars">
346
                <delete file="lib/httpclient.jar" />
347
                <delete file="lib/utilities.jar" />
348
        </target>
349

    
350
        <target name="fullclean" depends="localclean"
351
                description="deletes code and eml">
352
                <delete includeEmptyDirs="true" failonerror="false">
353
                        <fileset dir="${style-common-cvsrelpath}">
354
                                <include name="${eml-css}" />
355
                                <include name="eml-*/*.xsl" />
356
                                <include name="eml-*" />
357
                        </fileset>
358
                        <fileset dir="${schema-cvsrelpath}">
359
                                <include name="eml-*/*.xsd" />
360
                        </fileset>
361
                        <fileset dir="${ecogrid-dir}">
362
                                <include name="build.properties" />
363
                                <include name="buildfiles/metacatImpl.xml" />
364
                        </fileset>
365
                </delete>
366
        </target>
367

    
368
        <target name="jdoc" depends="prepare"
369
                description="generates javadoc documentation">
370
                <javadoc packagenames="edu.ucsb.nceas.*"
371
                        sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
372
                        version="true" use="true" windowtitle="${Name} API"
373
                        doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
374
                        bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
375
                        <classpath>
376
                                <path refid="compile.classpath" />
377
                        </classpath>
378
                </javadoc>
379
        </target>
380

    
381
        <target name="dist"
382
                depends="jar,getutilities"
383
                description="prepares a full release distribution">
384
                <mkdir dir="${dist.dir}" />
385
                <delete dir="${ver.dir}" />
386
                <mkdir dir="${ver.dir}" />
387
                <copy todir="${ver.dir}">
388
                        <fileset dir="."
389
                                excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
390
                </copy>
391
                <copy todir="${ver.dir}" file="build.xml" />
392
                <copy todir="${ver.dir}" file="build.properties" />
393

    
394
                <copy todir="${ver.dir}/docs" filtering="yes">
395
                        <fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
396
                </copy>
397
                <copy todir="${ver.dir}/docs" filtering="no">
398
                        <fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
399
                </copy>
400
                <copy todir="${ver.dir}/docs/dev">
401
                        <fileset dir="${build.dir}/docs" />
402
                </copy>
403
                <copy todir="${ver.dir}/src">
404
                        <fileset dir="${build.dir}/src" />
405
                </copy>
406

    
407
                <mkdir dir="${ver.dir}/tests/servertestfiles" />
408
                <copy todir="${ver.dir}/test/servertestfiles">
409
                        <fileset dir="./test/servertestfiles" />
410
                </copy>
411
        </target>
412
</project>