-
Notifications
You must be signed in to change notification settings - Fork 22
/
build.xml
215 lines (210 loc) · 6.63 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
<project name="ZTL" default="help" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<import file="build.prop.xml" />
<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="maven-ant-tasks.classpath" />
<artifact:dependencies pathId="dependency.classpath">
<pom file="pom.xml"/>
</artifact:dependencies>
<target name="help">
<echo>
Usage:
ant clean
Clean the source.
ant build
Generate the Java class and compile them
ant generate
Generate the Java class and build the ztl.jar file
ant run -Dtags=a,b,c
Run the test in the given package acrroding to the specific tags
ant runcase -Dcase=B30-123456.ztl,...
Run the test in the given package acrroding to the specific ztl file name
ant junit report
Run all of the test case and generate the report
</echo>
</target>
<target name="clean">
<delete dir="${target.dir}" />
<delete dir="${report.dir}" />
<delete includeemptydirs="true">
<fileset dir="${codegen.dir}" includes="**/*" />
</delete>
<delete dir="${test.dir}"/>
<!--<delete dir="${javadoc.dir}"/>-->
</target>
<target name="init">
<mkdir dir="${report.dir}" />
<mkdir dir="${test.dir}"/>
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath refid="dependency.classpath" />
</taskdef>
</target>
<target name="build" depends="generate,compileztl">
</target>
<target name="genzul" depends="init">
<java classname="org.zkoss.ztl.util.ZulGenerator"
fork="true">
<arg value="${src}"/>
<arg value="${dist}"/>
<classpath refid="dependency.classpath" />
<classpath>
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</classpath>
</java>
</target>
<target name="generate">
<java classname="org.zkoss.ztl.util.ZtlGenerator"
fork="true">
<arg value="-src"/>
<arg value="${test.src}"/>
<arg value="-dist"/>
<arg value="codegen"/>
<arg value="-tags"/>
<arg value="${tags}"/>
<arg value="-excludetags"/>
<arg value="${excludetags}"/>
<classpath refid="dependency.classpath" />
</java>
</target>
<target name="compileztl" depends="init">
<!-- compile -->
<javac srcdir="${codegen.dir}" destdir="${test.dir}" includes="**/*.java">
<classpath refid="dependency.classpath" />
</javac>
<!-- compile scala using mvn instead of ant for speed up compiling time
<scalac srcdir="${zstl.src}" destdir="${test.dir}"
includes="**/*.scala" excludes="vision-test/** test/ExampleTest.scala">
<classpath refid="dependency.classpath" />
</scalac> -->
<exec executable="sh" dir="." failonerror="true">
<arg line="./lib/run-maven.sh"/>
</exec>
</target>
<target name="genTestCafeScala" depends="init">
<java classname="org.zkoss.ztl.util.ZtlGenerator"
fork="true">
<arg value="-testcafe"/>
<arg value="-src"/>
<arg value="./zstl/test"/>
<arg value="-dist"/>
<arg value="./codegen"/>
<classpath refid="dependency.classpath" />
</java>
</target>
<target name="runTestCafeScala" depends="init">
<exec executable="sh" dir="." failonerror="true">
<arg line="./lib/run-maven-testcafe.sh"/>
<arg value="${report.dir}"/>
<arg value="${test.dir}"/>
<arg value="${test.browser}"/>
<arg value="${test.openonce}"/>
</exec>
</target>
<target name="genTestCafeJS" depends="genTestCafeScala, runTestCafeScala">
</target>
<target name="run" depends="compileztl">
<echo>Tags: -Dtags=${tags}</echo>
<java classname="org.zkoss.ztl.util.ZtlGenerator"
fork="true">
<arg value="-src"/>
<arg value="${test.src}"/>
<arg value="-dist"/>
<arg value="codegen"/>
<arg value="-run"/>
<arg value="${test.dir}"/>
<arg value="${tags}"/>
<classpath refid="dependency.classpath" />
<classpath>
<pathelement path="${test.dir}"/>
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</classpath>
</java>
</target>
<target name="runcase">
<exec executable="sh" dir="." failonerror="true">
<arg line="./lib/run-maven-test-one.sh"/>
<arg value="${test.dir}"/>
<arg value="${browser}"/>
<arg value="${case}"/>
</exec>
</target>
<target name="junitTag" depends="generate,compileztl">
<junit printsummary="on" fork="true" forkmode="once" haltonfailure="false"
showoutput="true">
<classpath refid="dependency.classpath" />
<classpath>
<pathelement path="${test.dir}" />
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</classpath>
<formatter type="xml" />
<batchtest todir="${report.dir}">
<fileset dir="${test.dir}" >
<include name="test/TagSuite*" />
</fileset>
</batchtest>
</junit>
</target>
<target name="junitOne" depends="generate,compileztl">
<junit printsummary="on" fork="true" forkmode="once" haltonfailure="false"
showoutput="true">
<classpath refid="dependency.classpath" />
<classpath>
<pathelement path="${test.dir}" />
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</classpath>
<formatter type="xml" />
<batchtest todir="${report.dir}">
<fileset dir="${test.dir}" >
<include name="**/*Test.*" />
</fileset>
</batchtest>
</junit>
</target>
<!-- use target "mtest" instead, you will get parallel test performance -->
<target name="junit" depends="generate,compileztl">
<junit printsummary="on" fork="true" forkmode="once" haltonfailure="false"
showoutput="true">
<classpath refid="dependency.classpath" />
<classpath>
<pathelement path="${test.dir}" />
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</classpath>
<formatter type="xml" />
<batchtest todir="${report.dir}">
<fileset dir="${test.dir}" >
<include name="**/*Test.*" />
</fileset>
</batchtest>
</junit>
</target>
<!-- this will call maven surefire:test with optional test case parameter -->
<target name="mtest">
<exec executable="sh" dir="." failonerror="true">
<arg line="./lib/run-maven-test.sh"/>
<arg value="${report.dir}"/>
<arg value="${test.dir}"/>
<arg value="${test.browser}"/>
<arg value="${test.openonce}"/>
<arg value="${test.reportNameSuffix}"/>
</exec>
</target>
<target name="report" >
<junitreport todir="${report.dir}">
<fileset dir="${report.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" styledir="." todir="${report.dir}" />
</junitreport>
</target>
</project>