forked from ycrash/buggyapp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
211 lines (166 loc) · 6.9 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="buggyapp" default="dist" basedir=".">
<!-- set global properties for this bin -->
<property name="src" location="src"/>
<!--<property name="src-util" location="../tier1app-util/src/main/java"/>-->
<property name="test" location="test"/>
<property name="resources" location="resources"/>
<property name="webroot" location="webroot"/>
<property name="bin" location="webroot/WEB-INF/classes"/>
<property name="lib" location="webroot/WEB-INF/lib"/>
<property name="test-lib" location="test-lib"/>
<property name="resources" location="resources"/>
<property name="dist" location="dist"/>
<path id="compile.classpath">
<pathelement location="${lib}/"/>
<pathelement path="${lib}\servlet-api.jar;${lib}\log4j-core-2.6.2.jar;${lib}\log4j-api-2.6.2.jar; ${lib}\gson-2.3.1.jar;"/>
</path>
<path id="test.classpath">
<pathelement location="${lib}/"/>
<pathelement path="${lib}\servlet-api.jar;${lib}\log4j-core-2.6.2.jar;${lib}\log4j-api-2.6.2.jar;${lib}\commons-logging-1.1.1.jar; ${lib}\javassist.jar; ${lib}\gson-2.3.1.jar;${lib}\spring-mock.jar;${lib}\spring-core.jar;"/>
<pathelement path="${lib}\testng-6.8.jar" />
<!-- <pathelement path="${test-lib}\mockito-all-1.10.19.jar" />-->
</path>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the bin directory structure used by compile -->
<mkdir dir="${bin}"/>
<mkdir dir="${dist}"/>
<echo message="Using lib: ${lib}"/>
<echo message="Using src: ${src}"/>
</target>
<target name="clean" description="clean up" >
<!-- Delete the ${bin} and ${dist} directory trees -->
<delete dir="${bin}"/>
<delete dir="${dist}"/>
<delete dir="webroot/META-INF"/>
</target>
<target name="compile" depends="init" description="compile the source " >
<echo message="Using Java version ${ant.java.version}."/>
<!-- Compile the buggyapp code into ${bin} -->
<javac encoding="UTF-8" srcdir="${src}" destdir="${bin}" debug="true" source="1.8" target="1.8" classpathref="compile.classpath">
</javac>
</target>
<target name="compile-cmd" depends="init"
description="compile the source">
<echo message="Using Java version ${ant.java.version}."/>
<!-- Compile the tier1app-util code into ${bin} -->
<javac encoding="UTF-8" srcdir="${src}" destdir="${dist}" debug="true" source="1.8" target="1.8" classpathref="compile.classpath">
</javac>
</target>
<target name="test-compile" depends="compile" description="compile the source " >
<javac encoding="UTF-8" srcdir="${test}" destdir="${bin}" debug="true" source="1.8" target="1.8" classpathref="test.classpath">
</javac>
</target>
<taskdef name="testng" classname="org.testng.TestNGAntTask">
<classpath location="${lib}/testng-6.8.jar" />
</taskdef>
<target name="testng" depends="test-compile">
<copy todir="${bin}">
<fileset dir="${resources}" />
</copy>
<!-- Assume test.path contains the project library dependencies -->
<testng classpathref="test.classpath" outputDir="${dist}\testng" haltOnFailure="true">
<classpath location="${bin}" />
<classfileset dir="${bin}" includes="**/*Test*.class" />
</testng>
</target>
<target name="dist" depends="clean, compile" description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<copy todir="${bin}">
<fileset dir="${resources}" />
</copy>
<copy file="webroot/pe-index.jsp" tofile="webroot/index.jsp" overwrite="true"/>
<delete file="${dist}/buggyapp.war" />
<jar jarfile="${dist}/buggyapp.war" >
<fileset dir="webroot"/>
</jar>
</target>
<target name="dist-test" depends="clean, compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<copy todir="${bin}">
<fileset dir="${resources}" />
</copy>
<delete file="${dist}/buggyapp.war" />
<jar jarfile="${dist}/buggyapp.war" >
<fileset dir="webroot"/>
</jar>
</target>
<target name="dist-cmd" depends="clean, compile-cmd"
description="generate the prod distribution">
<!-- Create the distribution directory
<mkdir dir="${dist}/lib"/>
<copy todir="${dist}/lib">
<fileset dir="${lib}" />
</copy>
-->
<delete file="${dist}/buggyApp.jar" />
<jar jarfile="${dist}/buggyApp.jar" >
<fileset dir="${dist}"/>
<manifest>
<attribute name="Main-Class"
value="com.buggyapp.LaunchPad"/>
</manifest>
</jar>
</target>
<target name="dist-ee"
depends="clean, compile, compile-cmd"
description="generate the buggyapp distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<copy todir="${bin}">
<fileset dir="${resources}" />
</copy>
<!-- Create META-INF directory -->
<mkdir dir="webroot/META-INF"/>
<copy todir="webroot/META-INF" file="${resources}/context.xml"></copy>
<delete file="${bin}/license.lic"/>
<delete file="${bin}/context.xml"/>
<delete file="${bin}/saml.xml"/>
<delete file="${dist}/buggyApp.jar"/>
<property name="enterprise.version" value="0_5"/>
<copy todir="${dist}/enterprise/">
<filterset>
<filter token="enterprise.version" value="${enterprise.version}"/>
</filterset>
<fileset dir="embedded-runner" includes="**/version*"/>
</copy>
<copy todir="${bin}">
<fileset dir="${dist}/enterprise/" includes="**/version**"/>
</copy>
<!-- Add index and error files -->
<copy file="webroot/ee-index.jsp" tofile="webroot/index.jsp" overwrite="true"/>
<delete file="webroot/sitemap.xml"/>
<delete file="${dist}/enterprise/buggyapp.war" />
<jar jarfile="${dist}/enterprise/buggyapp.war">
<fileset dir="webroot" excludes="WEB-INF/lib/**, **/testng-*.jar" />
</jar>
<!-- build buggyapp.jar file -->
<delete file="${dist}/enterprise/buggyApp.jar" />
<jar jarfile="${dist}/enterprise/buggyApp.jar" >
<fileset dir="${dist}"/>
<manifest>
<attribute name="Main-Class"
value="com.buggyapp.LaunchPad"/>
</manifest>
</jar>
<delete dir="${dist}/com" />
<!-- build the server -->
<copy todir="${dist}/enterprise/">
<fileset dir="embedded-runner" includes="**/launch*, **/webapp-runner-8*, **/README.txt"/>
</copy>
<!-- Create Lib directory -->
<mkdir dir="${dist}/enterprise/lib"/>
<copy todir="${dist}/enterprise/lib">
<fileset dir="webroot/WEB-INF/lib/" excludes="**/testng-*.jar" />
</copy>
<zip destfile="${dist}/enterprise/buggyapp-${enterprise.version}.zip" basedir="${dist}/enterprise/"/>
<delete dir="${dist}/enterprise/lib" />
<delete>
<fileset dir="${dist}/enterprise/" excludes="**/buggyapp*.zip"/>
</delete>
</target>
</project>