Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2180 asteen 1
<project name="jboss-config-jms" default="install" basedir=".">
2
 
3
	<description>
4
	Configures JBoss with MASS server configuration(s) as required.
5
 
6
	Prerequisites:
7
		- JBoss version 3.2.3 must be installed.
8
		- The JBOSS_HOME environment variable must be set to the base directory
9
		  where JBoss is installed.
10
		- The ANTSHIELD Ant plugin must be installed in the %ANT_HOME%\lib directory.
11
		- The JANTS Ant plugin must be installed in the %ANT_HOME%\lib directory.
12
	</description>
13
 
14
 
15
	<taskdef resource="antshield.properties"/>
16
	<taskdef resource="jats.properties"/>
17
 
18
	<!-- =================================================================== -->
19
	<!--  GLOBAL PROPERTIES                                                  -->
20
	<!-- =================================================================== -->
21
	<property file="${user.home}/.ant.properties" />
22
	<property name="env" environment="env"         value="not used"/>
23
	<property name="jboss.cfg"                     value="project"/>
24
 
25
 
26
	<!--
27
	  -  Pulls in project dependencies.
28
	  -->
29
	<!-- <target name="sandbox"
30
		description="Prepare the project dependency 'sandbox'.">
31
		<echo message="Prepare the sandbox."/>
32
		<ant antfile="depends.xml"/>
33
	</target> -->
34
 
35
 
36
	<!--
37
	  -  Cleans derived objects.
38
	  -->
39
	<target name="clean">
40
 
41
		<delete dir="${basedir}/build"/>
42
		<delete dir="${basedir}/interface"/>
43
		<delete dir="${basedir}/pkg"/>
44
 
45
	</target>
46
 
47
 
48
	<!--
49
	  -  Checks the JBoss environment.
50
	  -
51
	  -  This target verifies that the compatible version of JBoss is installed
52
	  -  on the build machine. This latest release supports JBoss 3.2.3 only.
53
	  -->
54
	<target name="-check-environment" depends="">
55
 
56
		<property name="jboss.home" value="${env.JBOSS_HOME}"/>
57
		<fail unless="jboss.home">
58
			Environment variable 'JBOSS_HOME' is not set.
59
		</fail>
60
	  	<available property="jboss.present" file="${env.JBOSS_HOME}/bin/run.jar"/>
61
	  	<fail unless="jboss.present">
62
	  		Environment variable JBOSS_HOME is set but it does
63
		    not seem to point to the right directory. The file
64
			'run.jar' must be available at ${env.JBOSS_HOME}/bin"
65
		</fail>
66
 
67
		<property name="jats.home" value="${env.JATS_HOME}"/>
68
		<fail unless="jats.home">
69
			Environment variable 'JATS_HOME' is not set.
70
		</fail>
71
 
72
		<!-- Check JBoss version - do not proceed unless compatible -->
73
		<mkdir dir="tmp"/>
74
		<unjar src="${env.JBOSS_HOME}/bin/run.jar" dest="tmp">
75
			<patternset includes="META-INF/MANIFEST.MF"/>
76
		</unjar>
77
		<loadfile property="jboss.manifest" srcfile="tmp/META-INF/MANIFEST.MF"/>
78
		<delete dir="tmp"/>
79
 
80
		<condition property="jboss.active.version" value="3.2.3">
81
			<contains string="${jboss.manifest}" substring="Implementation-Version: 3.2.3"/>
82
		</condition>
83
 
84
		<fail unless="jboss.active.version">
85
			Incompatible version of JBoss detected. This configuration script is only
86
			compatible with JBoss 3.2.3
87
		</fail>
88
   	</target>
89
 
90
	<!--
91
	  -  Packages the release
92
	  -
93
	  -  This target looks for the installed JDBC drivers, and flags their existence.
94
	  -  This package should be dependent on the JDBC drivers, because it contains
95
	  -  them within the release.
96
	  -->
97
	<target name    ="package"
98
	        depends ="-check-environment">
99
 
100
		<delete dir="${basedir}/build"/>
101
 
102
		<property name="jboss.cfg.directory" location="${basedir}/build/${jboss.cfg}.mas"/>
103
		<property name="jboss.default.directory" location="${env.JBOSS_HOME}/server/default"/>
104
 
105
		<available file="${jboss.cfg.directory}" type="dir" property="jboss.cfg.present"/>
106
		<fail if="jboss.cfg.present" message="JBoss configuration for ${jboss.cfg.directory} already exists."/>
107
 
108
		<mkdir dir="${jboss.cfg.directory}"/>
109
		<mkdir dir="${jboss.cfg.directory}/conf"/>
110
		<mkdir dir="${jboss.cfg.directory}/deploy"/>
111
		<mkdir dir="${jboss.cfg.directory}/lib"/>
112
 
113
		<!-- Prepare configuration -->
114
		<copy todir="${jboss.cfg.directory}/conf">
115
			<fileset dir="${basedir}/conf"/>
116
		</copy>
117
 
118
		<copy todir="${jboss.cfg.directory}/deploy">
119
			<fileset dir="${basedir}/deploy"/>
120
		</copy>
121
 
122
		<copy todir="${jboss.cfg.directory}/lib">
123
			<fileset dir="${basedir}/lib"/>
124
		</copy>
125
 
126
	</target>
127
 
128
	<!--
129
	  -  Formally releases package 'jboss_config'
130
	  -->
131
	<target name="release"
132
		description="Formally release this package as a patch release.">
133
		<antshield packageName="${ant.project.name}"/>
134
		<antcall target="-label"/>
135
	</target>
136
 
137
 
138
	<!--
139
	  -  Undoes a failed release
140
	  -->
141
	<target name="undo"
142
		description="Remove artifacts from a partially complete build.">
143
		<antshield packageName="${ant.project.name}" type="minor"/>
144
		<!-- Remove any label for the given version -->
145
		<ccrmlabel labelname="${ant.project.name}_${antshield.release}"/>
146
		<!-- Remove any network drive mapping, and remove any view corresponding to the label -->
147
		<ccrmview viewname="${user.name}_jats_build_${ant.project.name}_${antshield.release}" unmap="${jants.map.drive}"/>
148
	</target>
149
 
150
 
151
	<!--
152
	  -  Creates a label, a view based on the label, and invokes a build in the new view.
153
	  -->
154
	<target name="-label">
155
 
156
		<cclabel package       = "${ant.project.name}"
157
				 version       = "${antshield.release}"
158
				 findCheckouts = "true"
159
				 mkview        = "true"
160
				 mapview       = "${jants.map.drive}"
161
				 labelname     = "jants.build.label"
162
				 viewname      = "jants.build.view.name"
163
				 viewpath      = "jants.build.view.path"/>
164
		<ant antfile="build.xml" dir="${jants.build.view.path}" inheritAll="false" inheritRefs="false" target="-release">
165
			<property name="jants.build.version" value="${antshield.release}"/>
166
		</ant>
167
		<cclocklabel labelname="${jants.build.label}"/>
168
		<ccrmview viewname="${jants.build.view.name}" unmap="${jants.map.drive}"/>
169
 
170
	</target>
171
 
172
 
173
	<!--
174
	  -  Puts release elements in their staging location, and puts them into dpkg_archive.
175
	  -->
176
	<target name="-release" depends="package">
177
		<!-- Clean the package directory -->
178
		<delete dir="pkg"/>
179
		<mkdir dir="pkg"/>
180
		<mkdir dir="pkg/pkg"/>
181
		<mkdir dir="pkg/scripts"/>
182
 
183
		<!-- Prepare the package entities -->
184
		<copy todir="pkg/pkg">
185
			<fileset dir="${basedir}/build/project.mas"/>
186
		</copy>
187
 
188
		<copy todir="pkg/scripts">
189
			<fileset dir="${basedir}/scripts" includes="*"/>
190
		</copy>
191
 
192
		<!-- And perform the dpkg release -->
193
		<jats package="${ant.project.name}">
194
			<release version="${jants.build.version}" label="${jants.build.label}"/>
195
		</jats>
196
	</target>
197
 
198
</project>