-
Notifications
You must be signed in to change notification settings - Fork 33
/
build.xml
173 lines (144 loc) · 6.43 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="WAAT" default="all" basedir=".">
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
<property environment="env"/>
<property file="resources//waat.properties"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="out.dir" value="${basedir}/out"/>
<property name="zip.dir" value="${out.dir}/zip"/>
<property name="prod.output.dir" value="${out.dir}/${PRODUCTION_TYPE}"/>
<property name="test.output.dir" value="${out.dir}/${TEST_TYPE}"/>
<property name="testNGOutput.dir" value="${out.dir}/testNGReports"/>
<path id="library.lib.test.classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
<path location="${basedir}/resources"/>
</path>
<path id="library.lib.classpath">
<fileset dir="${lib.dir}" includes="*.jar"/>
<path location="${lib.dir}"/>
</path>
<taskdef name="testNG" classpathref="library.lib.test.classpath" classname="org.testng.TestNGAntTask"/>
<path id="waat.module.sourcepath">
<dirset dir="${basedir}">
<include name="${SRC_DIR}"/>
</dirset>
</path>
<path id="waat.module.test.sourcepath">
<dirset dir="${basedir}">
<include name="${TEST_TYPE}"/>
</dirset>
</path>
<target name="compile.prod" description="Compile module WAAT; production classes">
<javac destdir="${prod.output.dir}" debug="on" excludes="">
<classpath refid="library.lib.classpath"/>
<src refid="waat.module.sourcepath"/>
</javac>
</target>
<target name="compileOnly">
<javac destdir="${test.output.dir}" debug="on" excludes="">
<classpath refid="library.lib.test.classpath"/>
<src refid="waat.module.test.sourcepath"/>
<src refid="waat.module.sourcepath"/>
</javac>
</target>
<target name="compile.test" description="compile module WAAT; test classes" unless="skip.tests">
<antcall target="compileOnly"/>
<antcall target="runTests"/>
</target>
<target name="cleanUp">
<delete dir="${out.dir}"/>
<delete dir="${testNGOutput.dir}"/>
<delete file="waat.log"/>
<delete file="velocity.log"/>
</target>
<target name="init" description="Build initialization">
<mkdir dir="${prod.output.dir}"/>
<mkdir dir="${test.output.dir}"/>
<mkdir dir="${out.dir}/dist"/>
<mkdir dir="${zip.dir}"/>
</target>
<target name="runTests">
<delete dir="${testNGOutput.dir}"/>
<mkdir dir="${testNGOutput.dir}"/>
<property name="testGroup" value=""/>
<echo message="testGroup: ${testGroup}"/>
<echo message="*** Running tests in ${threadCount} threads ***"/>
<testNG classpathref="library.lib.test.classpath" groups="${testGroup}"
parallel="methods" outputdir="${testNGOutput.dir}" threadcount="${threadCount}"
listeners="org.uncommons.reportng.HTMLReporter" listener="com.thoughtworks.webanalyticsautomation.runUtils.CustomTestListener">
<sysproperty key="org.uncommons.reportng.title" value="WAAT Test Report"/>
<sysproperty key="java.library.path" value="${lib.dir}"/>
<classpath>
<pathelement path="${out.dir}/${TEST_TYPE}"/>
</classpath>
<classfileset dir="${out.dir}/${TEST_TYPE}" includes="**/*Test.class"/>
</testNG>
</target>
<target name="buildJAR">
<property name="JAR_FILE_NAME" value="${JAR_FILE_PREFIX}_${VERSION}"/>
<property name="JAR_BASE_DIR" value="${out.dir}/${PRODUCTION_TYPE}"/>
<property name="JAR_LIB_FILTER" value="*.jar"/>
<jar destfile="${out.dir}/dist/${JAR_FILE_NAME}.jar"
basedir="${JAR_BASE_DIR}">
</jar>
<antcall target="zip">
<param name="ZIP_FILE_NAME" value="${JAR_FILE_NAME}"/>
<param name="JAR_FILE_IN_ZIP" value="${out.dir}/dist/${JAR_FILE_NAME}.jar"/>
<param name="JAR_LIB_FILTER" value="${JAR_LIB_FILTER}"/>
</antcall>
</target>
<target name="zip">
<mkdir dir="${zip.dir}/WAAT"/>
<mkdir dir="${zip.dir}/WAAT/lib"/>
<mkdir dir="${zip.dir}/WAAT/samplescripts"/>
<mkdir dir="${zip.dir}/WAAT/resources"/>
<mkdir dir="${zip.dir}/WAAT/docs"/>
<!--Copy the LICENSE file to the root folder -->
<copy file="${basedir}/LICENSE.txt" todir="${zip.dir}/WAAT" overwrite="true" verbose="true"/>
<!--Copy the sample test data files-->
<copy todir="${zip.dir}/WAAT">
<fileset dir="${basedir}/${TEST_TYPE}" includes="sampledata/*.xml"/>
</copy>
<!--Copy the sample Script files-->
<copy todir="${zip.dir}/WAAT/samplescripts">
<fileset dir="${basedir}/${TEST_TYPE}"
includes="**/scriptrunner/*.java"
excludes="**/*Helper.java"/>
</copy>
<!--Copy the resources files-->
<copy todir="${zip.dir}/WAAT/resources">
<fileset dir="${basedir}/resources" includes="log*.*"/>
</copy>
<!--Copy the docs-->
<copy todir="${zip.dir}/WAAT/docs">
<fileset dir="${basedir}/docs" includes="*.*"/>
<fileset dir="${basedir}" includes="README*"/>
</copy>
<antcall target="createZip"></antcall>
<delete dir="${zip.dir}/WAAT" verbose="true"/>
<antcall target="deploy"/>
</target>
<target name="createZip">
<!--Copy the appropriate WAAT.jar in the lib folder -->
<copy file="${JAR_FILE_IN_ZIP}" todir="${zip.dir}/WAAT/lib" overwrite="true" verbose="true"/>
<zip destfile="${out.dir}/dist/${ZIP_FILE_NAME}.zip" basedir="${zip.dir}"/>
</target>
<target name="deploy" if="DEPLOY">
<copy file="${out.dir}/dist/${ZIP_FILE_NAME}.zip" todir="${basedir}/dist" overwrite="false" verbose="true"/>
</target>
<target name="package" depends="init">
<property name="type" value="${TEST_TYPE}"/>
<antcall target="compile.${type}"/>
</target>
<target name="all" depends="cleanUp" description="build all">
<antcall target="package">
<param name="type" value="${TEST_TYPE}"/>
</antcall>
<antcall target="package">
<param name="type" value="${PRODUCTION_TYPE}"/>
</antcall>
<antcall target="buildJAR"/>
</target>
</project>