This repository was archived by the owner on Aug 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
319 lines (249 loc) · 10.6 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
<project name="librarycloud" default="doall" basedir=".">
<!-- ===================== Property Definitions =========================== -->
<property file="build-local.properties"/>
<property file="project.properties"/>
<!-- ==================== File and Directory Names ======================== -->
<property name="ois.buildfile.type" value="internal-build"/>
<property name="ois.buildfile.version" value="2.0"/>
<property name="app.name" value="${project.shortName}"/>
<property name="context.name" value="${app.name}"/>
<property name="jar.name" value="${app.name}.jar"/>
<property name="jar.home" value="lib"/>
<property name="config.home" value="conf"/>
<property name="compile.dirs" value="src"/>
<property name="test.dirs" value="test"/>
<property name="javadoc.home" value="javadoc"/>
<property name="manifest.name" value="MANIFEST.MF"/>
<property name="bin.home" value="bin" />
<property name="build.home" value="webapps"/>
<property name="build.test.home" value="target/test"/>
<property name="webinf.home" value="${build.home}/WEB-INF"/>
<property name="metainf.home" value="${build.home}/META-INF"/>
<!-- ==================== Build 2.0 enhancements ======================== -->
<property name="appserver.home" value="/usr/local/tomcat8"/>
<property name="war-file" value="${app.name}.war" />
<property name="web-xml-file" value="${webinf.home}/web.xml" />
<property name="deployments.home" value="${appserver.home}/webapps"/>
<!-- ===================== Compilation Control Options ==================== -->
<property name="compile.debug" value="true"/>
<property name="compile.deprecation" value="true"/>
<property name="compile.optimize" value="true"/>
<!-- ==================== Compilation Classpath =========================== -->
<path id="compile.classpath">
<fileset dir=".">
<include name="lib/*.jar"/>
<include name="lib_tmp/*.jar"/>
</fileset>
</path>
<path id="test.classpath">
<pathelement path="target/test/classes"/>
<pathelement path="webapps/WEB-INF/classes"/>
<fileset dir=".">
<include name="lib/*.jar"/>
</fileset>
</path>
<!-- ==================== Config Target ================================== -->
<filterset id="blp.filterset"/>
<target name="init-build-local.properties" if="blp.available" depends="check-build-local.properties">
<echo>build-local.properties found</echo>
<filterset id="blp.filterset">
<filtersfile file="build-local.properties"/>
</filterset>
</target>
<target name="check-build-local.properties">
<available file="build-local.properties" type="file" property="blp.available"/>
</target>
<macrodef name="propertycopy">
<attribute name="name" />
<attribute name="from" />
<sequential>
<property name="@{name}" value="${@{from}}" />
</sequential>
</macrodef>
<target name="run-post-config" if="post-config.available" depends="post-config.check">
<echo>post-config.sh found...executing</echo>
<!-- make post-config.sh executable -->
<exec dir="${project.base}/${project.dir}/bin" executable="/bin/chmod">
<arg line="+x post-config.sh"/>
</exec>
<!-- call post-config.sh-->
<exec executable="${project.base}/${project.dir}/bin/post-config.sh">
<arg line="${instance}"/>
</exec>
</target>
<target name="make-bin-executable" if="bin.present" depends="check-bin">
<echo>Making files in ${bin.home} executable</echo>
<apply dir="${bin.home}" executable="/bin/chmod" parallel="false">
<arg value="700" />
<fileset dir="${bin.home}">
<include name="**/*.sh"/>
</fileset>
</apply>
</target>
<target name="post-config.check">
<echo>checking for bin/post-config.sh</echo>
<available file="${project.base}/${project.dir}/bin/post-config.sh" type="file" property="post-config.available"/>
</target>
<target name="config" depends="init-build-local.properties">
<dirname property="project.base" file="." />
<basename property="project.dir" file="." />
<property name="app.home" value="${project.base}/${project.dir}"/>
<echo>instance: ${instance}</echo>
<echo>project.base: ${project.base}/${project.dir}</echo>
<echo>config.home: ${config.home}</echo>
<echo>bin.home: ${bin.home}</echo>
<echo>appserver.home: ${appserver.home}</echo>
<!-- copy web.xml.template to web.xml -->
<copy overwrite="true" todir="${webinf.home}">
<fileset dir="${webinf.home}">
<include name="*.template"/>
</fileset>
<filterset refid="blp.filterset"/>
<filterset>
<filter token="project.base" value="${project.base}/${project.dir}"/>
<filtersfile file="project.properties"/>
</filterset>
<globmapper from="*.template" to="*"/>
</copy>
<antcall target="make-bin-executable" />
<antcall target="run-post-config" />
</target>
<!-- ==================== Compile Target ================================== -->
<target name="compile" if="lib.present" depends="check-lib" description="Compile Java sources">
<echo>
The dest dir is ${build.home}/WEB-INF/classes
</echo>
<javac srcdir="${compile.dirs}" destdir="${build.home}/WEB-INF/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}">
<classpath>
<path refid="compile.classpath"/>
<fileset dir="${appserver.home}">
<include name="lib/*.jar"/>
</fileset>
</classpath>
</javac>
<!-- copy all jars from lib/ to WEB-INF/lib -->
<copy todir="${webinf.home}/lib">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
</copy>
<!-- copy all configuration files from conf/ to WEB-INF/classes -->
<copy todir="${webinf.home}/classes">
<fileset dir="conf">
<include name="*.properties"/>
<include name="*.xml"/>
</fileset>
</copy>
</target>
<!-- ==================== Compile Tests ================================== -->
<target name="compile-tests" if="lib.present" depends="check-lib" description="Compile Java sources">
<echo>
The dest dir is ${build.home}/WEB-INF/classes
</echo>
<javac srcdir="${test.dirs}" destdir="${build.test.home}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" classpathref="test.classpath">
<exclude name="**/ItemTest.java" />
<exclude name="**/TestRecords.java" />
<exclude name="**/TestResource.java" />
<exclude name="**/ClientTest.java" />
</javac>
<!-- copy all jars from lib/ to WEB-INF/lib -->
<copy todir="${webinf.home}/lib">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
</copy>
<!-- copy all configuration files from conf/ to WEB-INF/classes -->
<copy todir="${webinf.home}/classes">
<fileset dir="conf">
<include name="*.properties"/>
<include name="*.xml"/>
</fileset>
</copy>
</target>
<!-- ==================== Clean Target ==================================== -->
<target name="clean"
description="Delete old build and dist directories">
<delete quiet="true">
<fileset dir="${build.home}/WEB-INF/classes" includes="**/*.class"/>
<fileset dir="${webinf.home}/lib" includes="**/*.jar"/>
</delete>
</target>
<!-- ==================== Javadoc Target ================================== -->
<target name="javadoc" description="Create Javadoc API documentation">
<mkdir dir="${javadoc.home}"/>
<javadoc destdir="${javadoc.home}" packagenames="*">
<fileset dir=".">
<include name="src/**/*.java"/>
</fileset>
<classpath refid="compile.classpath"/>
</javadoc>
</target>
<!-- ==================== Check and Set Targets =========================== -->
<target name="check-conf">
<available file="conf" type="dir" property="conf.present" />
</target>
<target name="check-lib">
<available file="lib" type="dir" property="lib.present" />
</target>
<target name="check-src">
<available file="src" type="dir" property="src.present" />
</target>
<target name="check-bin">
<available file="bin" type="dir" property="bin.present" />
</target>
<!-- ====================================== NEW BUILD 2.0 deployment tasks ==================================== -->
<tstamp prefix="build-info">
<format property="current-date" pattern="d-MMMM-yyyy" locale="en" />
<format property="current-time" pattern="hh:mm:ss a z" locale="en" />
<format property="year-month-day" pattern="yyyy-MM-dd" locale="en" />
</tstamp>
<property name="builder" value="LTS" />
<target name="war" depends="config, compile">
<delete file="webapps/${war-file}" />
<war warfile="webapps/${war-file}" webxml="${web-xml-file}">
<classes dir="${webinf.home}/classes">
<include name="*.properties" />
</classes>
<fileset dir="${build.home}" >
<exclude name="META-INF" />
<exclude name="WEB-INF" />
<exclude name="**/web.xml"/>
</fileset>
<lib dir="${webinf.home}/lib/">
<!-- <exclude name="jdbc1.jar"/> -->
</lib>
<manifest>
<attribute name="Built-By" value="${builder}" />
<attribute name="Built-On" value="${build-info.current-date}" />
<attribute name="Built-At" value="${build-info.current-time}" />
</manifest>
</war>
</target>
<target name="deploy" description="deploy to jboss">
<echo>deploying ${deployments.home}/${war-file}</echo>
<copy file="webapps/${war-file}" todir="${deployments.home}" />
</target>
<target name="undeploy" description="undeploy from tomcat">
<echo>deleting ${deployments.home}/${war-file}</echo>
<delete file="${deployments.home}/${war-file}" />
</target>
<target name="doall" depends="config,compile,war,deploy" />
<target name="test.junit.launcher" depends="compile,compile-tests">
<junitlauncher>
<classpath refid="test.classpath" />
<!-- <test name="ItemDAOTests" /> -->
<testclasses>
<fileset dir="target/test/classes">
<include name="**/*Tests.class"/>
</fileset>
<!-- <listener type="legacy-plain" sendSysOut="true" /> -->
</testclasses>
</junitlauncher>
</target>
<target name="test.console.launcher" depends="compile-tests,compile">
<java classpathref="test.classpath" classname="org.junit.platform.console.ConsoleLauncher" fork="true" failonerror="true">
<arg value="--scan-classpath"/>
</java>
</target>
<target name="test" depends="test.console.launcher" />
</project>