xref: /aoo42x/test/build.xml (revision 6467ecbf)
1faa4b864SLei De Bin<?xml version="1.0"?>
27acce70dSLiu Zhe<!--***********************************************************
37acce70dSLiu Zhe *
47acce70dSLiu Zhe * Licensed to the Apache Software Foundation (ASF) under one
57acce70dSLiu Zhe * or more contributor license agreements.  See the NOTICE file
67acce70dSLiu Zhe * distributed with this work for additional information
77acce70dSLiu Zhe * regarding copyright ownership.  The ASF licenses this file
87acce70dSLiu Zhe * to you under the Apache License, Version 2.0 (the
97acce70dSLiu Zhe * "License"); you may not use this file except in compliance
107acce70dSLiu Zhe * with the License.  You may obtain a copy of the License at
117acce70dSLiu Zhe *
127acce70dSLiu Zhe *   http://www.apache.org/licenses/LICENSE-2.0
137acce70dSLiu Zhe *
147acce70dSLiu Zhe * Unless required by applicable law or agreed to in writing,
157acce70dSLiu Zhe * software distributed under the License is distributed on an
167acce70dSLiu Zhe * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
177acce70dSLiu Zhe * KIND, either express or implied.  See the License for the
187acce70dSLiu Zhe * specific language governing permissions and limitations
197acce70dSLiu Zhe * under the License.
207acce70dSLiu Zhe *
217acce70dSLiu Zhe ***********************************************************-->
22b164ae3eSLei De Bin
23b164ae3eSLei De Bin
24faa4b864SLei De Bin
25faa4b864SLei De Bin<project basedir="." default="test">
2609c344eeSLiu Zhe    <property environment="env" />
27faa4b864SLei De Bin	<property name="junit.home" value="${env.JUNIT_HOME}" />
28*6467ecbfSLiu Zhe	<property name="dist.dir" value="." />
29*6467ecbfSLiu Zhe	<property name="dist.name" value="aoo_test" />
30*6467ecbfSLiu Zhe	<property name="junit.jar.repos" value="http://repo1.maven.org/maven2/junit/junit/4.10/junit-4.10.jar" />
31*6467ecbfSLiu Zhe
32*6467ecbfSLiu Zhe	<path id="uno.classpath">
33*6467ecbfSLiu Zhe		<fileset dir="${env.OUTDIR}" erroronmissingdir="false">
34*6467ecbfSLiu Zhe			<include name="**/juh.jar" />
35*6467ecbfSLiu Zhe			<include name="**/unoil.jar" />
36*6467ecbfSLiu Zhe			<include name="**/ridl.jar" />
37*6467ecbfSLiu Zhe			<include name="**/jurt.jar" />
38*6467ecbfSLiu Zhe		</fileset>
39*6467ecbfSLiu Zhe		<fileset dir="${openoffice.home}" erroronmissingdir="false">
40*6467ecbfSLiu Zhe			<include name="**/juh.jar" />
41*6467ecbfSLiu Zhe			<include name="**/unoil.jar" />
42*6467ecbfSLiu Zhe			<include name="**/ridl.jar" />
43*6467ecbfSLiu Zhe			<include name="**/jurt.jar" />
44faa4b864SLei De Bin		</fileset>
45faa4b864SLei De Bin	</path>
46*6467ecbfSLiu Zhe
47*6467ecbfSLiu Zhe	<target name="check.junit">
48*6467ecbfSLiu Zhe	    <copy todir="lib" >
49*6467ecbfSLiu Zhe	        <fileset dir="${junit.home}" erroronmissingdir="false">
50*6467ecbfSLiu Zhe	            <include name="junit*.jar" />
51*6467ecbfSLiu Zhe			</fileset>
52*6467ecbfSLiu Zhe			<globmapper from="*" to="junit.jar" />
53*6467ecbfSLiu Zhe        </copy>
54*6467ecbfSLiu Zhe		<available file="lib/junit.jar" property="junit.jar.exists"/>
55b4d2d410SLiu Zhe	</target>
56faa4b864SLei De Bin
57*6467ecbfSLiu Zhe	<target name="prepare.junit" depends="check.junit" unless="junit.jar.exists">
58*6467ecbfSLiu Zhe		<mkdir dir="lib" />
59*6467ecbfSLiu Zhe		<get src="${junit.jar.repos}" dest="lib/junit.jar" skipexisting="true" />
60b4d2d410SLiu Zhe	</target>
61*6467ecbfSLiu Zhe
62*6467ecbfSLiu Zhe	<target name="testcommon.init">
63*6467ecbfSLiu Zhe		<mkdir dir="testcommon/bin" />
64*6467ecbfSLiu Zhe		<copy includeemptydirs="false" todir="testcommon/bin">
650e2e75f4SLiu Zhe			<fileset dir="testcommon/source">
66faa4b864SLei De Bin				<exclude name="**/*.java" />
67faa4b864SLei De Bin			</fileset>
68faa4b864SLei De Bin		</copy>
69faa4b864SLei De Bin	</target>
70faa4b864SLei De Bin
7122a14f28SLiu Zhe	<target name="testcommon.compile" depends="testcommon.init, prepare.junit">
72*6467ecbfSLiu Zhe		<javac destdir="testcommon/bin" debug="on" source="1.6" encoding="utf-8" includeantruntime="false">
730e2e75f4SLiu Zhe			<src path="testcommon/source"/>
7422a14f28SLiu Zhe			<classpath>
75*6467ecbfSLiu Zhe				<fileset dir="lib">
76*6467ecbfSLiu Zhe					<include name="*.jar" />
77*6467ecbfSLiu Zhe				</fileset>
7822a14f28SLiu Zhe			</classpath>
790e2e75f4SLiu Zhe		</javac>
80faa4b864SLei De Bin	</target>
81faa4b864SLei De Bin
820e2e75f4SLiu Zhe	<target name="testgui.init">
83*6467ecbfSLiu Zhe		<mkdir dir="testgui/bin" />
84*6467ecbfSLiu Zhe		<copy includeemptydirs="false" todir="testgui/bin">
850e2e75f4SLiu Zhe			<fileset dir="testgui/source">
860e2e75f4SLiu Zhe				<exclude name="**/*.java" />
870e2e75f4SLiu Zhe			</fileset>
880e2e75f4SLiu Zhe		</copy>
89faa4b864SLei De Bin	</target>
90faa4b864SLei De Bin
91*6467ecbfSLiu Zhe	<target name="testgui.compile" depends="testcommon.compile, testgui.init">
92*6467ecbfSLiu Zhe		<javac destdir="testgui/bin" debug="on" source="1.6" encoding="utf-8" includeantruntime="false">
930e2e75f4SLiu Zhe			<src path="testgui/source"/>
947acce70dSLiu Zhe			<classpath>
95*6467ecbfSLiu Zhe				<fileset dir="lib">
96*6467ecbfSLiu Zhe				    <include name="*.jar" />
97*6467ecbfSLiu Zhe				</fileset>
98*6467ecbfSLiu Zhe				<pathelement location="testcommon/bin" />
997acce70dSLiu Zhe			</classpath>
1000e2e75f4SLiu Zhe		</javac>
101faa4b864SLei De Bin	</target>
102faa4b864SLei De Bin
1030e2e75f4SLiu Zhe	<target name="testuno.init">
104*6467ecbfSLiu Zhe		<mkdir dir="testuno/bin" />
105*6467ecbfSLiu Zhe		<copy includeemptydirs="false" todir="testuno/bin">
1060e2e75f4SLiu Zhe			<fileset dir="testuno/source">
1070e2e75f4SLiu Zhe				<exclude name="**/*.java" />
1080e2e75f4SLiu Zhe			</fileset>
1090e2e75f4SLiu Zhe		</copy>
110faa4b864SLei De Bin	</target>
111faa4b864SLei De Bin
112*6467ecbfSLiu Zhe	<target name="testuno.compile" depends="testcommon.compile, testuno.init">
113*6467ecbfSLiu Zhe		<javac destdir="testuno/bin" debug="on" source="1.6" encoding="utf-8" includeantruntime="false">
1140e2e75f4SLiu Zhe			<src path="testuno/source"/>
1157acce70dSLiu Zhe			<classpath>
116*6467ecbfSLiu Zhe				<fileset dir="lib">
117*6467ecbfSLiu Zhe					<include name="*.jar" />
118*6467ecbfSLiu Zhe				</fileset>
119*6467ecbfSLiu Zhe				<pathelement location="testcommon/bin" />
1207acce70dSLiu Zhe				<path refid="uno.classpath"/>
1217acce70dSLiu Zhe			</classpath>
1220e2e75f4SLiu Zhe		</javac>
123faa4b864SLei De Bin	</target>
124faa4b864SLei De Bin
1250e2e75f4SLiu Zhe	<target name="clean" description="Clean all output">
126*6467ecbfSLiu Zhe		<delete dir="testcommon/bin" />
127*6467ecbfSLiu Zhe		<delete dir="testgui/bin" />
128*6467ecbfSLiu Zhe		<delete dir="testuno/bin" />
129*6467ecbfSLiu Zhe	</target>
130*6467ecbfSLiu Zhe
131*6467ecbfSLiu Zhe	<target name="compile" depends="testcommon.compile,testgui.compile,testuno.compile" description="Compile source code">
132*6467ecbfSLiu Zhe	</target>
133*6467ecbfSLiu Zhe
134*6467ecbfSLiu Zhe	<target name="dist" depends="clean,compile">
135*6467ecbfSLiu Zhe		<tstamp/>
136*6467ecbfSLiu Zhe        <zip destfile="${dist.dir}/${dist.name}_${DSTAMP}.zip" update="false">
137*6467ecbfSLiu Zhe			<zipfileset dir="." includes="lib/**, testcommon/**,testgui/**,testuno/**,build.xml" prefix="aoo_test/"/>
138*6467ecbfSLiu Zhe			<zipfileset dir="." includes="test,test.bat" filemode="751" prefix="aoo_test/"/>
139*6467ecbfSLiu Zhe        </zip>
1400e2e75f4SLiu Zhe	</target>
141*6467ecbfSLiu Zhe
142*6467ecbfSLiu Zhe	<target name="test" depends="compile" description="start test">
143*6467ecbfSLiu Zhe        <property name="openoffice.home" value=""/>
144*6467ecbfSLiu Zhe        <condition property="test.arg0" value="-Dopenoffice.home=${openoffice.home}">
145*6467ecbfSLiu Zhe			<isset property="openoffice.home" />
146*6467ecbfSLiu Zhe		</condition>
147*6467ecbfSLiu Zhe		<pathconvert property="openoffice.pack" setonempty="false">
148*6467ecbfSLiu Zhe			<path>
149*6467ecbfSLiu Zhe				<fileset dir="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/OpenOffice/archive/install/en-US" includes="*.tar.gz,*.zip"  erroronmissingdir="false"/>
150*6467ecbfSLiu Zhe			</path>
151*6467ecbfSLiu Zhe		</pathconvert>
152*6467ecbfSLiu Zhe		<condition property="test.arg0" value="-Dopenoffice.pack=${openoffice.pack}">
153*6467ecbfSLiu Zhe			<isset property="openoffice.pack" />
154*6467ecbfSLiu Zhe		</condition>
155*6467ecbfSLiu Zhe		<fail message="No OpenOffice available!" unless="test.arg0"/>
156*6467ecbfSLiu Zhe	    <condition property="test.executable" value="./test.bat">
157*6467ecbfSLiu Zhe			<os family="windows" />
158*6467ecbfSLiu Zhe		</condition>
159*6467ecbfSLiu Zhe		<echo>${test.arg0}</echo>
160*6467ecbfSLiu Zhe        <property name="test.executable" value="./test"/>
161*6467ecbfSLiu Zhe        <exec executable="${test.executable}">
162*6467ecbfSLiu Zhe			<arg value="${test.arg0}"/>
163*6467ecbfSLiu Zhe			<arg value="-tp"/>
164*6467ecbfSLiu Zhe			<arg value="bvt"/>
165*6467ecbfSLiu Zhe		</exec>
1660e2e75f4SLiu Zhe	</target>
167*6467ecbfSLiu Zhe
168*6467ecbfSLiu Zhe    <target name="upgrade">
169*6467ecbfSLiu Zhe		<property name="upgrade.script" location="${java.io.tmpdir}/aoo_test_upgrade.xml"/>
170*6467ecbfSLiu Zhe		<property name="upgrade.to" location="."/>
171*6467ecbfSLiu Zhe		<copy file="build.xml" tofile="${upgrade.script}"/>
172*6467ecbfSLiu Zhe        <condition property="ant.executable" value="ant.bat">
173*6467ecbfSLiu Zhe			<os family="windows" />
174*6467ecbfSLiu Zhe		</condition>
175*6467ecbfSLiu Zhe        <property name="ant.executable" value="ant"/>
176*6467ecbfSLiu Zhe        <exec executable="${ant.executable}" spawn="true">
177*6467ecbfSLiu Zhe			<arg value="-Dupgrade.to=${upgrade.to}"/>
178*6467ecbfSLiu Zhe			<arg value="-f"/>
179*6467ecbfSLiu Zhe			<arg value="${upgrade.script}"/>
180*6467ecbfSLiu Zhe			<arg value="upgrade.run"/>
181*6467ecbfSLiu Zhe		</exec>
182faa4b864SLei De Bin	</target>
183faa4b864SLei De Bin
184*6467ecbfSLiu Zhe	<target name="upgrade.run">
185*6467ecbfSLiu Zhe		<property name="testpack.url" value="http://9.123.117.85/testpack/trunk/aoo_test.zip"/>
186*6467ecbfSLiu Zhe		<property name="testack.temp" location="${java.io.tmpdir}/aoo_test.zip"/>
187*6467ecbfSLiu Zhe 		<get src="${testpack.url}" dest="${testack.temp}"/>
188*6467ecbfSLiu Zhe		<delete dir="${upgrade.to}" failonerror="false"/>
189*6467ecbfSLiu Zhe		<mkdir dir="${upgrade.to}"/>
190*6467ecbfSLiu Zhe		<unzip src="${testack.temp}" dest="${upgrade.to}"/>
191faa4b864SLei De Bin	</target>
192*6467ecbfSLiu Zhe
193*6467ecbfSLiu Zhe
194faa4b864SLei De Bin
195faa4b864SLei De Bin	<target name="check.build" description="Check the build context">
196e90ed1f0SLiu Zhe		<condition property="openoffice.pack.dir" value="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/OpenOffice/archive/install/en-US">
1977acce70dSLiu Zhe			<isset property="env.SRC_ROOT" />
198faa4b864SLei De Bin		</condition>
199faa4b864SLei De Bin		<condition property="find.build.skip">
200faa4b864SLei De Bin			<or>
201e90ed1f0SLiu Zhe				<isset property="openoffice.pack.url" />
202e90ed1f0SLiu Zhe				<isset property="openoffice.pack.dir" />
203faa4b864SLei De Bin				<isset property="openoffice.home" />
204faa4b864SLei De Bin			</or>
205faa4b864SLei De Bin		</condition>
206faa4b864SLei De Bin		<condition property="download.build.skip">
207faa4b864SLei De Bin			<or>
208e90ed1f0SLiu Zhe				<isset property="openoffice.pack.dir" />
209faa4b864SLei De Bin				<isset property="openoffice.home" />
210faa4b864SLei De Bin			</or>
211faa4b864SLei De Bin		</condition>
212faa4b864SLei De Bin		<condition property="install.build.skip">
213e90ed1f0SLiu Zhe            <isset property="openoffice.home" />
214faa4b864SLei De Bin		</condition>
215faa4b864SLei De Bin	</target>
216faa4b864SLei De Bin</project>
217