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="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/scheduler/**" />
173
				<include name="edu/ucsb/nceas/metacat/shared/**" />
174
				<include name="edu/ucsb/nceas/metacat/util/**" />
175
				<exclude name="edu/ucsb/nceas/metacat/util/ConfigurationUtil.java" />
176
				<exclude name="edu/ucsb/nceas/metacat/util/DocumentUtil.java" />
177
				<exclude name="edu/ucsb/nceas/metacat/util/EMLVersionsTransformer.java" />
178
				<exclude name="edu/ucsb/nceas/metacat/util/GeoserverUtil.java" />
179
				<exclude name="edu/ucsb/nceas/metacat/util/OrganizationUtil.java" />
180
				<include name="edu/ucsb/nceas/metacat/workflow/**" />
181
				<exclude name="edu/ucsb/nceas/metacat/workflow/WorkflowSchedulerClient.java" />
182
				<include name="edu/ucsb/nceas/metacat/AuthInterface.java" />
183
				<include name="edu/ucsb/nceas/metacat/AuthLdap.java" />
184
				<include name="edu/ucsb/nceas/metacat/AuthSession.java" />
185
				<include name="edu/ucsb/nceas/metacat/MetacatVersion.java" />
186
				<include name="edu/ucsb/nceas/metacat/service/PropertyService.java" />
187
				<include name="edu/ucsb/nceas/metacat/service/SkinPropertyService.java" />
188
				<include name="edu/ucsb/nceas/metacat/service/SessionService.java" />
189
				<include name="edu/ucsb/nceas/metacat/service/ServiceService.java" />
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
		<!-- copy file="lib/web.xml.tomcat5" tofile="${build.war}/web.xml" / -->
272
		<war destfile="${dist.dir}/${workflowscheduler.context}.war"
273
			webxml="${build.war}/web.xml">
274
			<fileset dir="${war.context}" />
275
			<lib dir="${war.lib}" />
276
			<webinf dir="${war.webinf}" />
277
		</war>
278
	</target>
279

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

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

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

    
315
		<!-- MCD added next - Remove the tomcat5 reference-->
316
		<copy file="lib/${name}.web.xml" tofile="${build.war}/web.xml" />
317
		<copy file="lib/workflowscheduler.properties" todir="${war.webinf}"
318
			filtering="yes" />
319
		<copy file="lib/workflowscheduler.properties.metadata.xml"
320
			todir="${war.webinf}" filtering="no" />
321
		<copy file="lib/auth.properties.metadata.xml"
322
			todir="${war.webinf}" filtering="no" />
323
		<!--  copy todir="${war.webinf}" filtering="yes">
324
			<fileset dir="lib">
325
				<include name="skin.configs/**" />
326
			</fileset>
327
		</copy -->
328
		<copy file="lib/log4j.properties" todir="${war.webinf}"
329
			filtering="yes" />
330

    
331
		<copy todir="${war.webinf.sql}" filtering="yes">
332
			<fileset dir="src">
333
				<include name="**/*.sql" />
334
			</fileset>
335
		</copy>
336
		<copy todir="${war.webinf.scripts}" filtering="yes">
337
			<fileset dir="src/scripts" />
338
		</copy>
339
		<copy todir="${war.webinf.scripts}"
340
			file="src/perl/Metacat/blib/lib/auto/Metacat/autosplit.ix"
341
			failonerror="false" />
342
	</target>
343

    
344
	<target name="clean" depends="init"
345
		description="deletes build dir and files that can be regenerated form the release">
346
		<delete dir="${build.dir}" />
347
		<delete dir="${dist.dir}" />
348
	</target>
349

    
350
	<target name="localclean" depends="clean"
351
		description="deletes even jars that depend on external sources such as stylesheets and jars">
352
		<delete file="lib/httpclient.jar" />
353
		<delete file="lib/utilities.jar" />
354
	</target>
355

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

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

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

    
400
		<copy todir="${ver.dir}/docs" filtering="yes">
401
			<fileset dir="docs" excludes="**/*gif **/*jpg **/*png" />
402
		</copy>
403
		<copy todir="${ver.dir}/docs" filtering="no">
404
			<fileset dir="docs" includes="**/*gif **/*jpg **/*png" />
405
		</copy>
406
		<copy todir="${ver.dir}/docs/dev">
407
			<fileset dir="${build.dir}/docs" />
408
		</copy>
409
		<copy todir="${ver.dir}/src">
410
			<fileset dir="${build.dir}/src" />
411
		</copy>
412

    
413
		<mkdir dir="${ver.dir}/tests/servertestfiles" />
414
		<copy todir="${ver.dir}/test/servertestfiles">
415
			<fileset dir="./test/servertestfiles" />
416
		</copy>
417
	</target>
418
</project>
(6-6/6)