Project

General

Profile

1 5027 daigle
<?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 5057 daigle
				<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 5027 daigle
				<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 5057 daigle
			<fileset dir="../seek/projects/ecogrid/build/lib">
74
				<include name="org.ecoinformatics.ecogrid.AuthenticationService-stub.jar" />
75 5077 daigle
				<include name="org.ecoinformatics.ecogrid.AuthorizationService-stub.jar" />
76 5057 daigle
			</fileset>
77 5027 daigle
		</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 5057 daigle
		<property name="ecogrid.stublib.dir" value="../seek/projects/ecogrid/build/lib" />
118 5027 daigle
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 5097 daigle
				<include name="edu/ucsb/nceas/metacat/accesscontrol/AccessControlInterface.java" />
180 5027 daigle
				<include name="edu/ucsb/nceas/metacat/cart/**" />
181
				<include name="edu/ucsb/nceas/metacat/database/**" />
182 5034 daigle
				<include name="edu/ucsb/nceas/metacat/properties/**" />
183
				<exclude name="edu/ucsb/nceas/metacat/properties/SkinPropertyService.java" />
184
				<exclude name="edu/ucsb/nceas/metacat/properties/ConfigurableProperties.java" />
185 5027 daigle
				<include name="edu/ucsb/nceas/metacat/scheduler/**" />
186
				<include name="edu/ucsb/nceas/metacat/shared/**" />
187
				<include name="edu/ucsb/nceas/metacat/util/**" />
188
				<exclude name="edu/ucsb/nceas/metacat/util/ConfigurationUtil.java" />
189
				<exclude name="edu/ucsb/nceas/metacat/util/DocumentUtil.java" />
190
				<exclude name="edu/ucsb/nceas/metacat/util/EMLVersionsTransformer.java" />
191
				<exclude name="edu/ucsb/nceas/metacat/util/GeoserverUtil.java" />
192
				<exclude name="edu/ucsb/nceas/metacat/util/OrganizationUtil.java" />
193
				<include name="edu/ucsb/nceas/metacat/AuthInterface.java" />
194
				<include name="edu/ucsb/nceas/metacat/AuthLdap.java" />
195 5181 leinfelder
				<include name="edu/ucsb/nceas/metacat/AuthTLSException.java" />
196 5027 daigle
				<include name="edu/ucsb/nceas/metacat/AuthSession.java" />
197
				<include name="edu/ucsb/nceas/metacat/MetacatVersion.java" />
198
				<include name="edu/ucsb/nceas/metacat/service/SessionService.java" />
199
				<include name="edu/ucsb/nceas/metacat/service/ServiceService.java" />
200 5034 daigle
				<include name="edu/ucsb/nceas/workflowscheduler/**" />
201 5027 daigle
				<include name="org/kepler/executionWS/**" />
202
				<exclude name="**/CVS*" />
203
				<exclude name="**/.#*" />
204
			</fileset>
205
		</copy>
206
	</target>
207
208
	<taskdef resource="axis-tasks.properties"
209
		classpathref="compile.classpath" />
210
211
	<target name="generateStubs" depends="prepare">
212
		<echo
213
			message=" Generating stubs for execution service from ${/tmp/KeplerWebService.wsdl}" />
214
		<axis-wsdl2java verbose="true" output="${srcdir}"
215
			url="/tmp/KeplerWebService.wsdl" />
216
	</target>
217
218
	<target name="compile" depends="prepare, utilities"
219
		description="Compiles java code to build dir, and copies metacat props files there">
220
221
		<javac srcdir="${build.src}" destdir="${build.dest}"
222
			debug="${debug}"
223 6053 leinfelder
			excludes="**/*.sql **/client/*.java **/harvesterClient/*.java">
224 5027 daigle
			<classpath>
225
				<path refid="compile.classpath" />
226
			</classpath>
227
		</javac>
228
	</target>
229
230
	<target name="jar" depends="compile"
231
		description="Compiles and jars metacat java code to metacat.jar in build dir ">
232
233
		<delete file="${build.dir}/${name}.jar" />
234
		<jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}"
235
			excludes="**/protocols/ **/harvesterClient/" />
236
	</target>
237
238
	<target name="utilities" depends="config,getpeerutilities"
239
		if="utilities.required">
240
		<ant dir="${utilitiesdir}" target="clean" inheritAll="false" />
241
		<ant dir="${utilitiesdir}" target="jar" inheritAll="false" />
242
		<copy file="${utilitiesdir}/lib/httpclient.jar" todir="lib" />
243
		<copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
244
	</target>
245
246
	<target name="getpeerutilities" depends="prepare"
247
		if="peer.utilities.required"
248
		description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
249
		<echo message="Exporting utiities files from svn repository:" />
250
		<!-- input message="Please enter svn repo username:" addproperty="svn.username" / -->
251
		<!-- input message="Please enter svn repo password:" addproperty="svn.password" / -->
252
		<!--  svn username="${svn.username}" password="${svn.password}" -->
253
		<svn>
254
			<export srcUrl="${svn.utilitiesUrl}"
255
				destPath="${utilitiesdir}" />
256
		</svn>
257
258
		<!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
259
	</target>
260
261
	<target name="getutilities" depends="prepare"
262
		description="Checks utility out of svn and copies it to your metacat cvs sandbox">
263
		<echo>Enter CVS password:</echo>
264
		<cvs cvsRoot="${cvsroot}" package="${util-module}"
265
			tag="${utilities-tag}" dest="${build.tmp}" />
266
	</target>
267
268
	<target name="install" depends="init, war"
269
		description="* Full Install For Development *">
270
		<copy file="${dist.dir}/${workflowscheduler.context}.war"
271
			todir="${app.deploy.dir}" />
272
		<delete dir="${app.deploy.dir}/${workflowscheduler.context}" />
273
		<tstamp>
274
			<format property="NOW" pattern="MM/dd/yyyy hh:mm:ss aa" />
275
		</tstamp>
276
		<echo>Dev install completed at ${NOW}</echo>
277
	</target>
278
279
	<target name="war" depends="warPrepare"
280
		description="Create a web archive (WAR) for servlet deployment">
281
		<mkdir dir="${dist.dir}" />
282
		<war destfile="${dist.dir}/${workflowscheduler.context}.war"
283
			webxml="${build.war}/web.xml">
284
			<fileset dir="${war.context}" />
285
			<lib dir="${war.lib}" />
286
			<webinf dir="${war.webinf}" />
287
		</war>
288
	</target>
289
290
	<target name="warPrepare" depends="jar"
291
		description="Prepare files for creating a web archive (WAR)">
292
293
		<property name="war.lib" value="${build.war}/lib" />
294
		<property name="war.webinf" value="${build.war}/WEB-INF" />
295
		<property name="war.context"
296
			value="${build.war}/${workflowscheduler.context}" />
297
		<property name="war.webinf.sql" value="${war.webinf}/sql" />
298
		<property name="war.webinf.scripts"
299
			value="${war.webinf}/scripts" />
300
		<mkdir dir="${war.lib}" />
301
		<mkdir dir="${war.webinf}" />
302
		<mkdir dir="${war.context}" />
303
		<mkdir dir="${war.webinf.sql}" />
304
305
		<copy file="${build.dir}/${name}.jar" todir="${war.lib}" />
306
		<copy todir="${war.lib}" filtering="no">
307
			<fileset dir="lib">
308
				<include name="cos.jar" />
309
				<include name="postgresql-8.0-312.jdbc3.jar" />
310
				<include name="quartz-1.5.2.jar" />
311
				<include name="utilities.jar" />
312
				<include name="log4j-1.2.12.jar" />
313
				<include name="xalan.jar" />
314
			</fileset>
315
			<fileset dir="lib/lsid_lib">
316
				<include name="commons-logging-1.0.4.jar" />
317 5057 daigle
				<include name="commons-discovery.jar" />
318
				<include name="commons-discovery-0.2.jar" />
319
				<include name="wsdl4j-1.5.1.jar" />
320
				<include name="saaj.jar" />
321 5027 daigle
				<include name="axis.jar" />
322
				<include name="jaxrpc.jar" />
323
			</fileset>
324
			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
325
				<include name="commons-httpclient-2.0.jar" />
326
			</fileset>
327 5057 daigle
			<fileset dir="${ecogrid.stublib.dir}">
328
				<include name="org.ecoinformatics.ecogrid.AuthenticationService-stub.jar" />
329 5077 daigle
				<include name="org.ecoinformatics.ecogrid.AuthorizationService-stub.jar" />
330 5057 daigle
			</fileset>
331 5027 daigle
		</copy>
332
333
		<!-- MCD added next - Remove the tomcat5 reference-->
334 5034 daigle
		<copy file="lib/${name}/${name}.web.xml" tofile="${build.war}/web.xml" />
335
		<copy file="lib/${name}/${name}.properties" todir="${war.webinf}"
336 5027 daigle
			filtering="yes" />
337 5034 daigle
		<!-- copy file="lib/${name}/${name}.properties.metadata.xml"
338
			todir="${war.webinf}" filtering="no" / -->
339
		<!--  copy file="lib/auth.properties.metadata.xml"
340
			todir="${war.webinf}" filtering="no" / -->
341 5027 daigle
		<copy file="lib/log4j.properties" todir="${war.webinf}"
342
			filtering="yes" />
343
344
		<copy todir="${war.webinf.sql}" filtering="yes">
345
			<fileset dir="src">
346
				<include name="**/*.sql" />
347
			</fileset>
348
		</copy>
349
		<copy todir="${war.webinf.scripts}" filtering="yes">
350
			<fileset dir="src/scripts" />
351
		</copy>
352
		<copy todir="${war.webinf.scripts}"
353
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
354
			failonerror="false" />
355
	</target>
356
357
	<target name="clean" depends="init"
358
		description="deletes build dir and files that can be regenerated form the release">
359
		<delete dir="${build.dir}" />
360
		<delete dir="${dist.dir}" />
361
	</target>
362
363
	<target name="localclean" depends="clean"
364
		description="deletes even jars that depend on external sources such as stylesheets and jars">
365
		<delete file="lib/httpclient.jar" />
366
		<delete file="lib/utilities.jar" />
367
	</target>
368
369
	<target name="fullclean" depends="localclean"
370
		description="deletes code and eml">
371
		<delete includeEmptyDirs="true" failonerror="false">
372
			<fileset dir="${style-common-cvsrelpath}">
373
				<include name="${eml-css}" />
374
				<include name="eml-*/*.xsl" />
375
				<include name="eml-*" />
376
			</fileset>
377
			<fileset dir="${schema-cvsrelpath}">
378
				<include name="eml-*/*.xsd" />
379
			</fileset>
380
			<fileset dir="${ecogrid-dir}">
381
				<include name="build.properties" />
382
				<include name="buildfiles/metacatImpl.xml" />
383
			</fileset>
384
		</delete>
385
	</target>
386
387
	<target name="jdoc" depends="prepare"
388
		description="generates javadoc documentation">
389
		<javadoc packagenames="edu.ucsb.nceas.*"
390
			sourcepath="${build.src}" destdir="${build.javadocs}" author="true"
391
			version="true" use="true" windowtitle="${Name} API"
392
			doctitle="&lt;h1&gt;${Name}&lt;/h1&gt;"
393
			bottom="&lt;i&gt;Copyright &#169; 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.&lt;/i&gt;">
394
			<classpath>
395
				<path refid="compile.classpath" />
396
			</classpath>
397
		</javadoc>
398
	</target>
399
400
	<target name="dist"
401
		depends="jar,getutilities"
402
		description="prepares a full release distribution">
403
		<mkdir dir="${dist.dir}" />
404
		<delete dir="${ver.dir}" />
405
		<mkdir dir="${ver.dir}" />
406
		<copy todir="${ver.dir}">
407
			<fileset dir="."
408
				excludes="**/CVS* **/.#* src/** test/** build/** docs/** ${dist.dir}/** ${dist.dir.hle}/** metacat*.tar.gz metacat*.tar metacat*.zip" />
409
		</copy>
410
		<copy todir="${ver.dir}" file="build.xml" />
411
		<copy todir="${ver.dir}" file="build.properties" />
412
413
		<copy todir="${ver.dir}/docs" filtering="yes">
414
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
415
		</copy>
416
		<copy todir="${ver.dir}/docs" filtering="no">
417
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
418
		</copy>
419
		<copy todir="${ver.dir}/docs/dev">
420
			<fileset dir="${build.dir}/docs" />
421
		</copy>
422
		<copy todir="${ver.dir}/src">
423
			<fileset dir="${build.dir}/src" />
424
		</copy>
425
426
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
427
		<copy todir="${ver.dir}/test/servertestfiles">
428
			<fileset dir="./test/servertestfiles" />
429
		</copy>
430
	</target>
431
</project>