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
				<include name="org.ecoinformatics.ecogrid.AuthorizationService-stub.jar" />
76
			</fileset>
77
		</path>
78

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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