Project

General

Profile

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="commons-discovery.jar" />
64
				<include name="commons-discovery-0.2.jar" />
65
				<include name="wsdl4j-1.5.1.jar" />
66
				<include name="saaj.jar" />
67
				<include name="axis.jar" />
68
				<include name="jaxrpc.jar" />
69
			</fileset>
70
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
71
				<include name="commons-httpclient-2.0.jar" />
72
			</fileset>
73
			<fileset dir="../seek/projects/ecogrid/build/lib">
74
				<include name="org.ecoinformatics.ecogrid.AuthenticationService-stub.jar" />
75
			</fileset>
76
		</path>
77

    
78
		<!-- It is less likely you'll need to make any changes from here down,
79
			but customization is possible -->
80
		<property name="name" value="workflowscheduler" />
81
		<property name="Name" value="workflowscheduler" />
82
		<property name="debugprefix" value="${Name}:" />
83
		<property name="release" value="${metacat.version}" />
84

    
85
		<filter token="docrooturl" value="./" />
86
		<filter token="debugprefix" value="${debugprefix}" />
87
		<filter token="build.context" value="${workflowscheduler.context}" />
88

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

    
118
		<property name="package.home" value="edu/ucsb/nceas/metacat" />
119

    
120
		<!-- set up svn -->
121
		<property name="svnant.lib" value="lib" />
122
		<property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
123
		<property name="svnClientAdapter.jar"
124
			value="${svnant.lib}/svnClientAdapter.jar" />
125
		<property name="svnjavahl.jar"
126
			value="${svnant.lib}/svnjavahl.jar" />
127
		<property name="svn.utilitiesUrl"
128
			value="https://code.ecoinformatics.org/code/utilities/tags/${utilities-tag}" />
129
		<property name="svn.ecogridUrl"
130
			value="https://code.ecoinformatics.org/code/seek/trunk/projects/ecogrid/" />
131
		<!--  property name="svn.utilitiesExportPath" value="${knbdir}" / -->
132

    
133
		<!-- load the svn task -->
134
		<path id="svn.classpath">
135
			<pathelement location="${svnjavahl.jar}" />
136
			<pathelement location="${svnant.jar}" />
137
			<pathelement location="${svnClientAdapter.jar}" />
138
		</path>
139
		<taskdef resource="svntask.properties"
140
			classpathref="svn.classpath" />
141

    
142
		<condition property="utilities.required">
143
			<or>
144
				<not>
145
					<available file="lib/httpclient.jar" />
146
				</not>
147
				<not>
148
					<available file="lib/utilities.jar" />
149
				</not>
150
				<not>
151
					<available file="${utilitiesdir}" type="dir" />
152
				</not>
153
			</or>
154
		</condition>
155
		<!-- peer.utilities.required is used when there is no utilities 
156
			directory at ${utilitiesdir} -->
157
		<condition property="peer.utilities.required">
158
			<or>
159
				<not>
160
					<available file="${utilitiesdir}" type="dir" />
161
				</not>
162
			</or>
163
		</condition>
164
	</target>
165

    
166
	<target name="prepare" depends="init">
167
		<mkdir dir="${build.dir}" />
168
		<mkdir dir="${build.src}" />
169
		<mkdir dir="${build.dest}" />
170
		<mkdir dir="${build.javadocs}" />
171
		<mkdir dir="${build.tmp}" />
172

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

    
205
	<taskdef resource="axis-tasks.properties"
206
		classpathref="compile.classpath" />
207

    
208
	<target name="generateStubs" depends="prepare">
209
		<echo
210
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
211
		<axis-wsdl2java verbose="true" output="${srcdir}"
212
			url="/tmp/KeplerWebService.wsdl" />
213
	</target>
214

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

    
218
		<javac srcdir="${build.src}" destdir="${build.dest}"
219
			debug="${debug}"
220
			excludes="**/*.sql **/stringclient/** **/client/*.java **/harvesterClient/*.java">
221
			<classpath>
222
				<path refid="compile.classpath" />
223
			</classpath>
224
		</javac>
225
	</target>
226

    
227
	<target name="jar" depends="compile"
228
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
229

    
230
		<delete file="${build.dir}/${name}.jar" />
231
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
232
			excludes="**/protocols/ **/harvesterClient/" />
233
	</target>
234

    
235
	<target name="utilities" depends="config,getpeerutilities"
236
		if="utilities.required">
237
		<ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
238
		<ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
239
		<copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
240
		<copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
241
	</target>
242

    
243
	<target name="getpeerutilities" depends="prepare"
244
		if="peer.utilities.required"
245
		description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
246
		<echo message="Exporting utiities files from svn repository:" />
247
		<!-- input message="Please enter svn repo username:" addproperty="svn.username" / -->
248
		<!-- input message="Please enter svn repo password:" addproperty="svn.password" / -->
249
		<!--  svn username="${svn.username}" password="${svn.password}" -->
250
		<svn>
251
			<export srcUrl="${svn.utilitiesUrl}"
252
				destPath="${utilitiesdir}" />
253
		</svn>
254

    
255
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
256
	</target>
257

    
258
	<target name="getutilities" depends="prepare"
259
		description="Checks utility out of svn and copies it to your metacat cvs sandbox">
260
		<echo>Enter CVS password:</echo>
261
		<cvs cvsRoot="${cvsroot}" package="${util-module}"
262
			tag="${utilities-tag}" dest="${build.tmp}" />
263
	</target>
264

    
265
	<target name="install" depends="init, war"
266
		description="* Full Install For Development *">
267
		<copy file="${dist.dir}/${workflowscheduler.context}.war"
268
			todir="${app.deploy.dir}" />
269
		<delete dir="${app.deploy.dir}/${workflowscheduler.context}" />
270
		<tstamp>
271
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
272
		</tstamp>
273
		<echo>Dev install completed at ${NOW}</echo>
274
	</target>
275

    
276
	<target name="war" depends="warPrepare"
277
		description="Create a web archive (WAR) for servlet deployment">
278
		<mkdir dir="${dist.dir}" />
279
		<war destfile="${dist.dir}/${workflowscheduler.context}.war"
280
			webxml="${build.war}/web.xml">
281
			<fileset dir="${war.context}" />
282
			<lib dir="${war.lib}" />
283
			<webinf dir="${war.webinf}" />
284
		</war>
285
	</target>
286

    
287
	<target name="warPrepare" depends="jar"
288
		description="Prepare files for creating a web archive (WAR)">
289

    
290
		<property name="war.lib" value="${build.war}/lib" />
291
		<property name="war.webinf" value="${build.war}/WEB-INF" />
292
		<property name="war.context"
293
			value="${build.war}/${workflowscheduler.context}" />
294
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
295
		<property name="war.webinf.scripts"
296
			value="${war.webinf}/scripts" />
297
		<mkdir dir="${war.lib}" />
298
		<mkdir dir="${war.webinf}" />
299
		<mkdir dir="${war.context}" />
300
		<mkdir dir="${war.webinf.sql}" />
301

    
302
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
303
		<copy todir="${war.lib}" filtering="no">
304
			<fileset dir="lib">
305
				<include name="cos.jar" />
306
				<include name="postgresql-8.0-312.jdbc3.jar" />
307
				<include name="quartz-1.5.2.jar" />
308
				<include name="utilities.jar" />
309
				<include name="log4j-1.2.12.jar" />
310
				<include name="xalan.jar" />
311
			</fileset>
312
			<fileset dir="lib/lsid_lib">
313
				<include name="commons-logging-1.0.4.jar" />
314
				<include name="commons-discovery.jar" />
315
				<include name="commons-discovery-0.2.jar" />
316
				<include name="wsdl4j-1.5.1.jar" />
317
				<include name="saaj.jar" />
318
				<include name="axis.jar" />
319
				<include name="jaxrpc.jar" />
320
			</fileset>
321
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
322
				<include name="commons-httpclient-2.0.jar" />
323
			</fileset>
324
			<fileset dir="${ecogrid.stublib.dir}">
325
				<include name="org.ecoinformatics.ecogrid.AuthenticationService-stub.jar" />
326
			</fileset>
327
		</copy>
328

    
329
		<!-- MCD added next - Remove the tomcat5 reference-->
330
		<copy file="lib/${name}/${name}.web.xml" tofile="${build.war}/web.xml" />
331
		<copy file="lib/${name}/${name}.properties" todir="${war.webinf}"
332
			filtering="yes" />
333
		<!-- copy file="lib/${name}/${name}.properties.metadata.xml"
334
			todir="${war.webinf}" filtering="no" / -->
335
		<!--  copy file="lib/auth.properties.metadata.xml"
336
			todir="${war.webinf}" filtering="no" / -->
337
		<copy file="lib/log4j.properties" todir="${war.webinf}"
338
			filtering="yes" />
339

    
340
		<copy todir="${war.webinf.sql}" filtering="yes">
341
			<fileset dir="src">
342
				<include name="**/*.sql" />
343
			</fileset>
344
		</copy>
345
		<copy todir="${war.webinf.scripts}" filtering="yes">
346
			<fileset dir="src/scripts" />
347
		</copy>
348
		<copy todir="${war.webinf.scripts}"
349
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
350
			failonerror="false" />
351
	</target>
352

    
353
	<target name="clean" depends="init"
354
		description="deletes build dir and files that can be regenerated form the release">
355
		<delete dir="${build.dir}" />
356
		<delete dir="${dist.dir}" />
357
	</target>
358

    
359
	<target name="localclean" depends="clean"
360
		description="deletes even jars that depend on external sources such as stylesheets and jars">
361
		<delete file="lib/httpclient.jar" />
362
		<delete file="lib/utilities.jar" />
363
	</target>
364

    
365
	<target name="fullclean" depends="localclean"
366
		description="deletes code and eml">
367
		<delete includeEmptyDirs="true" failonerror="false">
368
			<fileset dir="${style-common-cvsrelpath}">
369
				<include name="${eml-css}" />
370
				<include name="eml-*/*.xsl" />
371
				<include name="eml-*" />
372
			</fileset>
373
			<fileset dir="${schema-cvsrelpath}">
374
				<include name="eml-*/*.xsd" />
375
			</fileset>
376
			<fileset dir="${ecogrid-dir}">
377
				<include name="build.properties" />
378
				<include name="buildfiles/metacatImpl.xml" />
379
			</fileset>
380
		</delete>
381
	</target>
382

    
383
	<target name="jdoc" depends="prepare"
384
		description="generates javadoc documentation">
385
		<javadoc packagenames="edu.ucsb.nceas.*"
386
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
387
			version="true" use="true" windowtitle="${Name} API"
388
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
389
			bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
390
			<classpath>
391
				<path refid="compile.classpath" />
392
			</classpath>
393
		</javadoc>
394
	</target>
395

    
396
	<target name="dist"
397
		depends="jar,getutilities"
398
		description="prepares a full release distribution">
399
		<mkdir dir="${dist.dir}" />
400
		<delete dir="${ver.dir}" />
401
		<mkdir dir="${ver.dir}" />
402
		<copy todir="${ver.dir}">
403
			<fileset dir="."
404
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
405
		</copy>
406
		<copy todir="${ver.dir}" file="build.xml" />
407
		<copy todir="${ver.dir}" file="build.properties" />
408

    
409
		<copy todir="${ver.dir}/docs" filtering="yes">
410
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
411
		</copy>
412
		<copy todir="${ver.dir}/docs" filtering="no">
413
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
414
		</copy>
415
		<copy todir="${ver.dir}/docs/dev">
416
			<fileset dir="${build.dir}/docs" />
417
		</copy>
418
		<copy todir="${ver.dir}/src">
419
			<fileset dir="${build.dir}/src" />
420
		</copy>
421

    
422
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
423
		<copy todir="${ver.dir}/test/servertestfiles">
424
			<fileset dir="./test/servertestfiles" />
425
		</copy>
426
	</target>
427
</project>
(6-6/6)