• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<project name="CLDR Unit Tests" default="all" basedir=".">
2	<target name="init">
3		<!-- copied from cldr/tools/java's build.xml -->
4		<tstamp />
5		<property name="src.dir" value="src" />
6		<!-- <property name="libs.dir" value="WebContent/WEB-INF/lib"/> -->
7
8		<property name="build.dir" value="build/classes" />
9		<property name="log.dir" value="build/logs" />
10		<property name="cldr.unittest.log" value="${log.dir}/unittest.log" />
11		<property name="cldr.unittest.result" value="${log.dir}/unittest.result" />
12		<property name="cldr.datacheck.log" value="${log.dir}/datacheck.log" />
13		<property name="cldr.datacheck.result" value="${log.dir}/datacheck.result" />
14		<property name="jar.file" value="cldr-unittest.jar" />
15		<property name="libs.dir" value="libs" />
16		<property name="jarSrc.file" value="cldr-unittest-src.jar" />
17		<property name="jarDocs.file" value="cldr-unittest-docs.jar" />
18		<property name="doc.dir" value="doc" />
19		<property name="doc.params" value="" />
20
21		<!-- Load local definitions from an optional properties file, if
22			available. build.properties is NOT checked into SVN. -->
23		<property file="build.properties" />
24		<!-- Load environment variables -->
25		<property environment="env" />
26
27
28		<!-- CLDR_TOOLS defaults to ../java, override if not correct. -->
29		<property name="CLDR_TOOLS" value="../java" />
30		<property name="CLDR_DIR" value="../../common/.." />
31		<property name="CLDR_JAR" value="${CLDR_TOOLS}/cldr.jar" />
32		<property file="${CLDR_TOOLS}/cldr-tools.properties" />
33		<property name="JVM_OPTIONS"
34			value="-DCLDR_DIR=${CLDR_DIR} -DDEBUG=false -Dverbose=false" />
35		<!-- JVM_EXTRA_OPTIONS might be resolved in the next priority order:
36			1) System property JVM_EXTRA_OPTIONS specified by ant command arg: ant -DJVM_EXTRA_OPTIONS=xxx <target>
37			2) JVM_EXTRA_OPTIONS=xxx in build.properties
38			3) Environment variable - JVM_EXTRA_OPTIONS=xxx
39			4) Final fallback - "-Xmx6g" below -->
40		<property name="env.JVM_EXTRA_OPTIONS" value="-Xmx6g" />
41		<property name="JVM_EXTRA_OPTIONS" value="${env.JVM_EXTRA_OPTIONS}" />
42		<property name="jvm_options" value="${JVM_OPTIONS} ${JVM_EXTRA_OPTIONS}" />
43
44		<path id="project.class.path">
45			<pathelement path="${java.class.path}/" />
46			<pathelement path="${build.dir}" />
47			<fileset dir="${libs.dir}">
48				<include name="**/*.jar" />
49			</fileset>
50			<pathelement path="${CLDR_TOOLS}/classes" />
51			<fileset dir="${CLDR_TOOLS}/libs" includes="*.jar" /> <!-- all libs -->
52		</path>
53	</target>
54
55	<target name="clean" depends="init" description="remove all build targets">
56		<delete dir="${build.dir}" />
57		<delete file="${cldr.unittest.log}" />
58		<delete file="${cldr.datacheck.log}" />
59		<delete dir="${log.dir}" />
60		<delete dir="build" />
61		<delete file="${jar.file}" />
62		<delete file="${jarSrc.file}" />
63		<delete file="${jarDocs.file}" />
64		<delete dir="${doc.dir}" />
65	</target>
66
67	<target name="jar" depends="build"
68		description="build full cldr-unittest.jar' jar file">
69		<jar jarfile="${jar.file}" compress="true"
70			includes="org/unicode/cldr/unittest/**/*" basedir="${build.dir}" />
71	</target>
72	<target name="tests" depends="build" />
73	<target name="all" depends="build" />
74	<!-- Docs stuff -->
75	<!-- use excludefiles below when we move to ant 1.5 -->
76	<target name="docs-jar" depends="docs">
77		<jar jarfile="${jarDocs.file}" compress="true" includes="**/*"
78			basedir="${doc.dir}" />
79	</target>
80	<target name="docs" depends="init" description="build user javadoc">
81		<tstamp>
82			<format property="current.year" pattern="yyyy" />
83		</tstamp>
84		<echo message="doc params: ${doc.params}" />
85		<mkdir dir="${doc.dir}" />
86		<javadoc packagenames="org.unicode.cldr.*" sourcepath="${src.dir}"
87			destdir="${doc.dir}" classpathref="project.class.path"
88			nodeprecatedlist="true" windowtitle="CLDR | Java Unittest" doctitle="CLDR | Java Unittest"
89			encoding="utf-8" docencoding="utf-8" additionalparam="${doc.params}"
90			link="http://docs.oracle.com/javase/7/docs/api"
91			bottom="&lt;font size=-1>&lt;a  target='_top' href='http://www.unicode.org/copyright.html'>Copyright &amp;copy; 2004-${current.year} Unicode, Inc. All Rights Reserved.&lt;/a>&lt;/font>"
92			source="1.8" />
93	</target>
94
95	<target name="build" depends="init" description="build web classes">
96		<mkdir dir="${build.dir}" />
97		<mkdir dir="${log.dir}" />
98		<javac srcdir="${src.dir}" includes="org/unicode/cldr/unittest/*.java"
99			destdir="${build.dir}" classpathref="project.class.path" source="1.8"
100			target="1.8" debug="on" deprecation="off" includeantruntime="false"
101			encoding="UTF-8" />
102		<mkdir dir="${build.dir}/org/unicode/cldr/unittest" />
103		<copy todir="${build.dir}/org/unicode/cldr/unittest">
104			<fileset dir="${src.dir}/org/unicode/cldr/unittest" excludes="**/CVS/**/* **/**/*.java" />
105		</copy>
106	</target>
107
108	<target name="check" description="Run the CLDR test suite and data tests"
109		depends="unittest,datacheck">
110	</target>
111
112	<target name="pcheck" depends="init">
113		<sequential>
114			<delete file="${cldr.unittest.result}" />
115			<delete file="${cldr.datacheck.result}" />
116			<parallel threadsPerProcessor="1">
117				<ant target='cldr.unittest.logged' />
118				<ant target='cldr.datacheck.logged' />
119			</parallel>
120			<loadfile property="cldr.unittest.log_file" srcfile="${cldr.unittest.log}" />
121			<loadfile property="cldr.datacheck.log_file" srcfile="${cldr.datacheck.log}" />
122			<loadfile property="cldr.unittest.result_file" srcfile="${cldr.unittest.result}" />
123			<loadfile property="cldr.datacheck.result_file" srcfile="${cldr.datacheck.result}" />
124			<echo
125				message="CLDR Build Results: ${line.separator} Unit Tests: ${line.separator} ${cldr.unittest.log_file} ${line.separator} --- ${line.separator} Data Check: ${line.separator} ${cldr.datacheck.log_file}" />
126			<fail message="CLDR Unit Tests FAILED">
127				<condition>
128					<not>
129						<equals arg1="${cldr.unittest.result_file}" arg2="0" />
130					</not>
131				</condition>
132			</fail>
133			<fail message="CLDR Data Check FAILED">
134				<condition>
135					<not>
136						<equals arg1="${cldr.datacheck.result_file}" arg2="0" />
137					</not>
138				</condition>
139			</fail>
140		</sequential>
141	</target>
142
143	<target name="unittest" description="Run the standard CLDR test suite"
144		depends="init,build">
145		<antcall target="_runUnitTests">
146			<param name="rununittest.arg" value="-n -q" />
147			<param name="rununittest.jvmarg" value="${jvm_options}" />
148		</antcall>
149	</target>
150
151	<target name="cldr.unittest.logged" description="Run the standard CLDR test suite"
152		depends="init,build">
153		<property name="rununittest.arg" value="-n -q" />
154		<property name="rununittest.jvmarg" value="${jvm_options}" />
155		<echo
156			message="JVM argument:   ${rununittest.jvmarg} -DCLDR_ENVIRONMENT=UNITTEST  -Djava.awt.headless=true ${line.separator}"
157			output="${cldr.unittest.log}" />
158		<echo message="Test argument:   ${rununittest.arg} ${line.separator}"
159			output="${cldr.unittest.log}" append="true" />
160		<echo level="info" message="CLDR Unit Tests In Progress" />
161		<java classname="org.unicode.cldr.unittest.TestAll" fork="yes"
162			failonerror="false" resultproperty="unittest.result" classpathref="project.class.path"
163			output="${cldr.unittest.log}" append="true">
164			<arg line="${rununittest.arg}" />
165			<jvmarg
166				line="${rununittest.jvmarg} -DCLDR_ENVIRONMENT=UNITTEST -Djava.awt.headless=true" />
167		</java>
168		<echo message="${unittest.result}" file="${cldr.unittest.result}" />
169	</target>
170
171	<target name="unittestExhaustive"
172		description="Run the standard CLDR test suite in exhaustive mode"
173		depends="init,build">
174		<antcall target="_runUnitTests">
175			<param name="rununittest.arg" value="-n -q -e10" />
176			<param name="rununittest.jvmarg" value="${jvm_options}" />
177		</antcall>
178	</target>
179
180	<target name="_runUnitTests" depends="init,build">
181		<echo
182			message="JVM argument:   ${rununittest.jvmarg} -DCLDR_ENVIRONMENT=UNITTEST  -Djava.awt.headless=true" />
183		<echo message="Test argument:   ${rununittest.arg}" />
184		<java classname="org.unicode.cldr.unittest.TestAll" fork="yes"
185			failonerror="true" classpathref="project.class.path">
186			<arg line="${rununittest.arg}" />
187			<jvmarg
188				line="${rununittest.jvmarg} -DCLDR_ENVIRONMENT=UNITTEST -Djava.awt.headless=true" />
189		</java>
190	</target>
191
192
193	<target name="datacheck" description="Run the standard data tests"
194		depends="init,build">
195		<antcall target="_dataCheck">
196			<param name="datacheck.arg" value="-S common,seed -e -z FINAL_TESTING" />
197			<param name="datacheck.jvmarg" value="${jvm_options}" />
198		</antcall>
199	</target>
200
201	<target name="cldr.datacheck.logged" description="Run the standard data tests"
202		depends="init,build">
203		<antcall target="_dataCheck_logged">
204			<param name="datacheck.arg" value="-S common,seed -e -z FINAL_TESTING" />
205			<param name="datacheck.jvmarg" value="${jvm_options}" />
206		</antcall>
207	</target>
208
209	<target name="_dataCheck_logged" depends="init,build">
210		<echo
211			message="JVM argument:   ${datacheck.jvmarg} -Djava.awt.headless=true ${line.separator}"
212			output="${cldr.datacheck.log}" />
213		<echo message="Test argument:   ${datacheck.arg} ${line.separator}"
214			output="${cldr.datacheck.log}" append="true" />
215		<echo level="info" message="CLDR Data Check In Progress" />
216		<java classname="org.unicode.cldr.test.ConsoleCheckCLDR" fork="yes"
217			failonerror="false" resultproperty="datacheck.result" classpathref="project.class.path"
218			output="${cldr.datacheck.log}" append="true">
219			<arg line="${datacheck.arg}" />
220			<jvmarg line="${datacheck.jvmarg} -Djava.awt.headless=true" />
221		</java>
222		<echo message="${datacheck.result}" file="${cldr.datacheck.result}" />
223	</target>
224
225	<target name="_dataCheck" depends="init,build">
226		<echo message="JVM argument:   ${datacheck.jvmarg} -Djava.awt.headless=true" />
227		<echo message="Test argument:   ${datacheck.arg}" />
228		<java classname="org.unicode.cldr.test.ConsoleCheckCLDR" fork="yes"
229			failonerror="true" classpathref="project.class.path">
230			<arg line="${datacheck.arg}" />
231			<jvmarg line="${datacheck.jvmarg} -Djava.awt.headless=true" />
232		</java>
233	</target>
234
235</project>
236