-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.xml
186 lines (147 loc) · 7.11 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="billing-ng" default="dist" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- properties -->
<property name="root.dir" location="."/>
<property file="${root.dir}/build.properties"/>
<property name="ear.dir" value="${build.dir}/${ant.project.name}.ear"/>
<available file="${lib.dir}" type="dir" property="ivy.resolved"/>
<import file="${root.dir}/common.xml"/>
<!-- targets -->
<target name="deploy.ds" description="Deploy the data source descriptor to the jBoss application server.">
<condition property="jboss.admin.cmd" value="jboss-cli.bat">
<os family="windows"/>
</condition>
<condition property="jboss.admin.cmd" value="$jboss-cli.sh">
<os family="unix"/>
</condition>
<exec executable="${jboss.home}/bin/${jboss.admin.cmd}" >
<env key="NOPAUSE" value="true"/>
<arg value="-c"/>
<arg value="--file=${root.dir}/resources/scripts/add-billing-ng-datasource.cli"/>
</exec>
</target>
<target name="deploy.jboss-modules" description="Deploys required modules (MySQL JDBC etc.) to the jBoss application server.">
<copy todir="${jboss.home}/modules">
<fileset dir="${root.dir}/resources/modules"/>
</copy>
</target>
<target name="deploy.properties" description="Deploy billing-ng.properties to the jBoss application server.">
<copy todir="${deploy.dir}">
<fileset dir="${root.dir}/resources" includes="billing-ng.properties"/>
</copy>
</target>
<!--
application server deployment targets
-->
<target name="undeploy" description="Delete the deployed artifact (exploded or .ear).">
<delete file="${deploy.dir}/${ant.project.name}.ear" failonerror="false"/> <!-- remove packaged application -->
<delete dir="${deploy.dir}/${ant.project.name}.ear" failonerror="false"/> <!-- remove exploded application -->
</target>
<target name="touch" description="Touch the deployed artifact (exploded or .ear) and force re-deployment.">
<condition property="exploded.deployment">
<and>
<available file="${deploy.dir}/${ant.project.name}.ear/META-INF/application.xml"/>
</and>
</condition>
<antcall target="touch.ear"/> <!-- touch packaged application -->
<antcall target="touch.exploded"/> <!-- touch exploded application -->
</target>
<target name="touch.ear" unless="exploded.deployment">
<echo message="Application .ear; touching archive for re-deploy."/>
<touch file="${deploy.dir}/${ant.project.name}.ear"/>
</target>
<target name="touch.exploded" if="exploded.deployment">
<echo message="Exploded application structure; touching application.xml for re-deploy."/>
<touch file="${deploy.dir}/${ant.project.name}.ear/META-INF/application.xml"/>
</target>
<!--
exploded application deployment targets
-->
<target name="refresh" description="Refreshes the deployed exploded application structure, copying only files that have recently changed.">
<property name="build.noclean" value="true"/>
<antcall target="explode"/>
</target>
<target name="explode" depends="init, copy-libs" description="Build and deploy the exploded application structure to the jBoss application server.">
<ant dir="${billing-ng-core.dir}" target="build" inheritall="true" inheritrefs="false"/>
<ant dir="${billing-ng-web.dir}" target="build" inheritall="true" inheritrefs="false"/>
<copy todir="${ear.dir}">
<fileset dir="${billing-ng-core.dir}/build/" includes="*.jar/**"/>
<fileset dir="${billing-ng-web.dir}/build/" includes="*.war/**"/>
</copy>
<copy todir="${ear.dir}/META-INF">
<fileset file="${billing-ng-ear.dir}/src/main/resources/META-INF/application.xml"/>
</copy>
<copy todir="${deploy.dir}">
<fileset dir="${build.dir}" includes="*.ear/**"/>
</copy>
</target>
<!--
ear package and deployment targets
-->
<target name="deploy" depends="dist" description="Build and deploy the application .ear to the jBoss application server.">
<copy todir="${deploy.dir}">
<fileset dir="${dist.dir}" includes="*.ear"/>
</copy>
</target>
<target name="dist" depends="init, copy-libs" description="Build and package as a distributable application .ear file.">
<ant dir="${billing-ng-core.dir}" target="dist" inheritall="false" inheritrefs="false"/>
<ant dir="${billing-ng-web.dir}" target="dist" inheritall="false" inheritrefs="false"/>
<copy todir="${ear.dir}">
<fileset dir="${billing-ng-core.dist}" includes="*.jar"/>
<fileset dir="${billing-ng-web.dist}" includes="*.war"/>
</copy>
<ear destfile="${dist.dir}/${ant.project.name}.ear" appxml="${billing-ng-ear.dir}/src/main/resources/META-INF/application.xml">
<fileset dir="${ear.dir}" includes="**/*.jar,*.war"/>
</ear>
</target>
<target name="copy-libs" depends="ivy.resolve-once">
<mkdir dir="${ear.dir}/lib"/>
<copy todir="${ear.dir}/lib">
<fileset dir="${lib.dir}/compile" includes="*.jar"/>
<fileset dir="${billing-ng-core.dir}/lib/compile" includes="*.jar"/>
</copy>
</target>
<target name="init" depends="clean">
<mkdir dir="${build.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="clean" description="Remove old build artifacts and temp files." unless="build.noclean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<ant dir="${billing-ng-core.dir}" target="clean" inheritall="false" inheritrefs="false"/>
<ant dir="${billing-ng-web.dir}" target="clean" inheritall="false" inheritrefs="false"/>
</target>
<!--
ivy dependency management
-->
<target name="modules" depends="ivy.bootstrap">
<ivy:buildlist reference="module-paths">
<fileset dir="${root.dir}" includes="**/build.xml"/>
</ivy:buildlist>
</target>
<target name="ivy.resolve-all" depends="modules">
<subant target="ivy.resolve" buildpathref="module-paths"/>
</target>
<target name="ivy.publish-all" depends="modules">
<subant target="ivy.publish" buildpathref="module-paths"/>
</target>
<target name="ivy.clean-all" depends="modules">
<subant target="ivy.clean" buildpathref="module-paths"/>
</target>
<target name="ivy.resolve-once" unless="ivy.resolved">
<antcall target="ivy.resolve"/>
</target>
<!--
Testing
-->
<target name="test.all">
<ant dir="${billing-ng-core.dir}" target="test.all" inheritall="false" inheritrefs="false"/>
<ant dir="${billing-ng-web.dir}" target="test.all" inheritall="false" inheritrefs="false"/>
</target>
<!--
Overridden targets
-->
<target name="ivy.publish">
<echo message="nothing to publish for ${ant.project.name}"/>
</target>
</project>