xref: /aoo42x/test/build.xml (revision 180e3c91)
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}" />
286467ecbfSLiu Zhe	<property name="dist.dir" value="." />
296467ecbfSLiu Zhe	<property name="dist.name" value="aoo_test" />
306467ecbfSLiu Zhe	<property name="junit.jar.repos" value="http://repo1.maven.org/maven2/junit/junit/4.10/junit-4.10.jar" />
316467ecbfSLiu Zhe
326467ecbfSLiu Zhe	<path id="uno.classpath">
33c74863a0SLiu Zhe		<fileset dir="${env.OUTDIR}/bin" erroronmissingdir="false">
34c74863a0SLiu Zhe			<include name="juh.jar" />
35*180e3c91SLiu Zhe			<include name="unoil.jar" />
36c74863a0SLiu Zhe			<include name="ridl.jar" />
37c74863a0SLiu Zhe			<include name="jurt.jar" />
386467ecbfSLiu Zhe		</fileset>
396467ecbfSLiu Zhe		<fileset dir="${openoffice.home}" erroronmissingdir="false">
406467ecbfSLiu Zhe			<include name="**/juh.jar" />
416467ecbfSLiu Zhe			<include name="**/unoil.jar" />
426467ecbfSLiu Zhe			<include name="**/ridl.jar" />
436467ecbfSLiu Zhe			<include name="**/jurt.jar" />
44faa4b864SLei De Bin		</fileset>
45faa4b864SLei De Bin	</path>
466467ecbfSLiu Zhe
476467ecbfSLiu Zhe	<target name="check.junit">
486467ecbfSLiu Zhe	    <copy todir="lib" >
496467ecbfSLiu Zhe	        <fileset dir="${junit.home}" erroronmissingdir="false">
506467ecbfSLiu Zhe	            <include name="junit*.jar" />
516467ecbfSLiu Zhe			</fileset>
526467ecbfSLiu Zhe			<globmapper from="*" to="junit.jar" />
536467ecbfSLiu Zhe        </copy>
546467ecbfSLiu Zhe		<available file="lib/junit.jar" property="junit.jar.exists"/>
55b4d2d410SLiu Zhe	</target>
56faa4b864SLei De Bin
576467ecbfSLiu Zhe	<target name="prepare.junit" depends="check.junit" unless="junit.jar.exists">
586467ecbfSLiu Zhe		<mkdir dir="lib" />
596467ecbfSLiu Zhe		<get src="${junit.jar.repos}" dest="lib/junit.jar" skipexisting="true" />
60b4d2d410SLiu Zhe	</target>
616467ecbfSLiu Zhe
626467ecbfSLiu Zhe	<target name="testcommon.init">
636467ecbfSLiu Zhe		<mkdir dir="testcommon/bin" />
646467ecbfSLiu 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">
726467ecbfSLiu Zhe		<javac destdir="testcommon/bin" debug="on" source="1.6" encoding="utf-8" includeantruntime="false">
730e2e75f4SLiu Zhe			<src path="testcommon/source"/>
7422a14f28SLiu Zhe			<classpath>
756467ecbfSLiu Zhe				<fileset dir="lib">
766467ecbfSLiu Zhe					<include name="*.jar" />
776467ecbfSLiu Zhe				</fileset>
7822a14f28SLiu Zhe			</classpath>
790e2e75f4SLiu Zhe		</javac>
80faa4b864SLei De Bin	</target>
81faa4b864SLei De Bin
820e2e75f4SLiu Zhe	<target name="testgui.init">
836467ecbfSLiu Zhe		<mkdir dir="testgui/bin" />
846467ecbfSLiu 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
916467ecbfSLiu Zhe	<target name="testgui.compile" depends="testcommon.compile, testgui.init">
926467ecbfSLiu Zhe		<javac destdir="testgui/bin" debug="on" source="1.6" encoding="utf-8" includeantruntime="false">
930e2e75f4SLiu Zhe			<src path="testgui/source"/>
947acce70dSLiu Zhe			<classpath>
956467ecbfSLiu Zhe				<fileset dir="lib">
966467ecbfSLiu Zhe				    <include name="*.jar" />
976467ecbfSLiu Zhe				</fileset>
986467ecbfSLiu Zhe				<pathelement location="testcommon/bin" />
997acce70dSLiu Zhe			</classpath>
1000e2e75f4SLiu Zhe		</javac>
101faa4b864SLei De Bin	</target>
102faa4b864SLei De Bin
1030e2e75f4SLiu Zhe	<target name="testuno.init">
1046467ecbfSLiu Zhe		<mkdir dir="testuno/bin" />
1056467ecbfSLiu 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
1126467ecbfSLiu Zhe	<target name="testuno.compile" depends="testcommon.compile, testuno.init">
1136467ecbfSLiu Zhe		<javac destdir="testuno/bin" debug="on" source="1.6" encoding="utf-8" includeantruntime="false">
1140e2e75f4SLiu Zhe			<src path="testuno/source"/>
1157acce70dSLiu Zhe			<classpath>
1166467ecbfSLiu Zhe				<fileset dir="lib">
1176467ecbfSLiu Zhe					<include name="*.jar" />
1186467ecbfSLiu Zhe				</fileset>
1196467ecbfSLiu 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">
1266467ecbfSLiu Zhe		<delete dir="testcommon/bin" />
1276467ecbfSLiu Zhe		<delete dir="testgui/bin" />
1286467ecbfSLiu Zhe		<delete dir="testuno/bin" />
1296467ecbfSLiu Zhe	</target>
1306467ecbfSLiu Zhe
1316467ecbfSLiu Zhe	<target name="compile" depends="testcommon.compile,testgui.compile,testuno.compile" description="Compile source code">
1326467ecbfSLiu Zhe	</target>
1336467ecbfSLiu Zhe
1346467ecbfSLiu Zhe	<target name="dist" depends="clean,compile">
1356467ecbfSLiu Zhe		<tstamp/>
1366467ecbfSLiu Zhe        <zip destfile="${dist.dir}/${dist.name}_${DSTAMP}.zip" update="false">
1376467ecbfSLiu Zhe			<zipfileset dir="." includes="lib/**, testcommon/**,testgui/**,testuno/**,build.xml" prefix="aoo_test/"/>
1386467ecbfSLiu Zhe			<zipfileset dir="." includes="test,test.bat" filemode="751" prefix="aoo_test/"/>
1396467ecbfSLiu Zhe        </zip>
1400e2e75f4SLiu Zhe	</target>
1416467ecbfSLiu Zhe
1426467ecbfSLiu Zhe	<target name="test" depends="compile" description="start test">
1436467ecbfSLiu Zhe        <condition property="test.arg0" value="-Dopenoffice.home=${openoffice.home}">
1446467ecbfSLiu Zhe			<isset property="openoffice.home" />
1456467ecbfSLiu Zhe		</condition>
1466467ecbfSLiu Zhe		<pathconvert property="openoffice.pack" setonempty="false">
1476467ecbfSLiu Zhe			<path>
1486467ecbfSLiu Zhe				<fileset dir="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/OpenOffice/archive/install/en-US" includes="*.tar.gz,*.zip"  erroronmissingdir="false"/>
1496467ecbfSLiu Zhe			</path>
1506467ecbfSLiu Zhe		</pathconvert>
1516467ecbfSLiu Zhe		<condition property="test.arg0" value="-Dopenoffice.pack=${openoffice.pack}">
1526467ecbfSLiu Zhe			<isset property="openoffice.pack" />
1536467ecbfSLiu Zhe		</condition>
1546467ecbfSLiu Zhe		<fail message="No OpenOffice available!" unless="test.arg0"/>
155*180e3c91SLiu Zhe	    <condition property="test.executable" value="./run.bat">
1566467ecbfSLiu Zhe			<os family="windows" />
1576467ecbfSLiu Zhe		</condition>
1586467ecbfSLiu Zhe		<echo>${test.arg0}</echo>
159*180e3c91SLiu Zhe        <property name="test.executable" value="./run"/>
1606467ecbfSLiu Zhe        <exec executable="${test.executable}">
1616467ecbfSLiu Zhe			<arg value="${test.arg0}"/>
1626467ecbfSLiu Zhe			<arg value="-tp"/>
1636467ecbfSLiu Zhe			<arg value="bvt"/>
1646467ecbfSLiu Zhe		</exec>
1650e2e75f4SLiu Zhe	</target>
1666467ecbfSLiu Zhe
1676467ecbfSLiu Zhe    <target name="upgrade">
1686467ecbfSLiu Zhe		<property name="upgrade.script" location="${java.io.tmpdir}/aoo_test_upgrade.xml"/>
1696467ecbfSLiu Zhe		<property name="upgrade.to" location="."/>
1706467ecbfSLiu Zhe		<copy file="build.xml" tofile="${upgrade.script}"/>
1716467ecbfSLiu Zhe        <condition property="ant.executable" value="ant.bat">
1726467ecbfSLiu Zhe			<os family="windows" />
1736467ecbfSLiu Zhe		</condition>
1746467ecbfSLiu Zhe        <property name="ant.executable" value="ant"/>
1756467ecbfSLiu Zhe        <exec executable="${ant.executable}" spawn="true">
1766467ecbfSLiu Zhe			<arg value="-Dupgrade.to=${upgrade.to}"/>
1776467ecbfSLiu Zhe			<arg value="-f"/>
1786467ecbfSLiu Zhe			<arg value="${upgrade.script}"/>
1796467ecbfSLiu Zhe			<arg value="upgrade.run"/>
1806467ecbfSLiu Zhe		</exec>
181faa4b864SLei De Bin	</target>
182faa4b864SLei De Bin
1836467ecbfSLiu Zhe	<target name="upgrade.run">
1846467ecbfSLiu Zhe		<property name="testpack.url" value="http://9.123.117.85/testpack/trunk/aoo_test.zip"/>
1856467ecbfSLiu Zhe		<property name="testack.temp" location="${java.io.tmpdir}/aoo_test.zip"/>
1866467ecbfSLiu Zhe 		<get src="${testpack.url}" dest="${testack.temp}"/>
1876467ecbfSLiu Zhe		<delete dir="${upgrade.to}" failonerror="false"/>
1886467ecbfSLiu Zhe		<mkdir dir="${upgrade.to}"/>
1896467ecbfSLiu Zhe		<unzip src="${testack.temp}" dest="${upgrade.to}"/>
190faa4b864SLei De Bin	</target>
191faa4b864SLei De Bin</project>
192