xref: /aoo42x/test/build.xml (revision 2b3f926e)
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" />
30*2b3f926eSCarl Marcum	<property name="junit.jar.repos" value="https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar" />
31dee6bc11SCarl Marcum	<property name="hamcrest.jar.repos" value="https://repo1.maven.org/maven2/org/hamcrest/hamcrest/2.2/hamcrest-2.2.jar" />
326467ecbfSLiu Zhe
336467ecbfSLiu Zhe	<path id="uno.classpath">
34c74863a0SLiu Zhe		<fileset dir="${env.OUTDIR}/bin" erroronmissingdir="false">
35c74863a0SLiu Zhe			<include name="juh.jar" />
36180e3c91SLiu Zhe			<include name="unoil.jar" />
37c74863a0SLiu Zhe			<include name="ridl.jar" />
38c74863a0SLiu Zhe			<include name="jurt.jar" />
396467ecbfSLiu Zhe		</fileset>
406467ecbfSLiu Zhe		<fileset dir="${openoffice.home}" erroronmissingdir="false">
416467ecbfSLiu Zhe			<include name="**/juh.jar" />
426467ecbfSLiu Zhe			<include name="**/unoil.jar" />
436467ecbfSLiu Zhe			<include name="**/ridl.jar" />
446467ecbfSLiu Zhe			<include name="**/jurt.jar" />
45faa4b864SLei De Bin		</fileset>
46faa4b864SLei De Bin	</path>
476467ecbfSLiu Zhe
486467ecbfSLiu Zhe	<target name="check.junit">
496467ecbfSLiu Zhe	    <copy todir="lib" >
506467ecbfSLiu Zhe	        <fileset dir="${junit.home}" erroronmissingdir="false">
516467ecbfSLiu Zhe	            <include name="junit*.jar" />
526467ecbfSLiu Zhe			</fileset>
536467ecbfSLiu Zhe			<globmapper from="*" to="junit.jar" />
546467ecbfSLiu Zhe        </copy>
55dee6bc11SCarl Marcum		<copy todir="lib" >
56dee6bc11SCarl Marcum			<fileset dir="${junit.home}" erroronmissingdir="false">
57dee6bc11SCarl Marcum				<include name="hamcrest*.jar" />
58dee6bc11SCarl Marcum			</fileset>
59dee6bc11SCarl Marcum			<globmapper from="*" to="hamcrest.jar" />
60dee6bc11SCarl Marcum		</copy>
616467ecbfSLiu Zhe		<available file="lib/junit.jar" property="junit.jar.exists"/>
62dee6bc11SCarl Marcum		<available file="lib/hamcrest.jar" property="hamcrest.jar.exists"/>
63b4d2d410SLiu Zhe	</target>
64faa4b864SLei De Bin
656467ecbfSLiu Zhe	<target name="prepare.junit" depends="check.junit" unless="junit.jar.exists">
666467ecbfSLiu Zhe		<mkdir dir="lib" />
676467ecbfSLiu Zhe		<get src="${junit.jar.repos}" dest="lib/junit.jar" skipexisting="true" />
68dee6bc11SCarl Marcum		<get src="${hamcrest.jar.repos}" dest="lib/hamcrest.jar" skipexisting="true" />
69b4d2d410SLiu Zhe	</target>
706467ecbfSLiu Zhe
716467ecbfSLiu Zhe	<target name="testcommon.init">
726467ecbfSLiu Zhe		<mkdir dir="testcommon/bin" />
736467ecbfSLiu Zhe		<copy includeemptydirs="false" todir="testcommon/bin">
740e2e75f4SLiu Zhe			<fileset dir="testcommon/source">
75faa4b864SLei De Bin				<exclude name="**/*.java" />
76faa4b864SLei De Bin			</fileset>
77faa4b864SLei De Bin		</copy>
78faa4b864SLei De Bin	</target>
79faa4b864SLei De Bin
8022a14f28SLiu Zhe	<target name="testcommon.compile" depends="testcommon.init, prepare.junit">
819f57b441SLiu Zhe		<javac destdir="testcommon/bin" debug="on" source="1.6" target="1.6" encoding="utf-8" includeantruntime="false">
820e2e75f4SLiu Zhe			<src path="testcommon/source"/>
8322a14f28SLiu Zhe			<classpath>
846467ecbfSLiu Zhe				<fileset dir="lib">
856467ecbfSLiu Zhe					<include name="*.jar" />
866467ecbfSLiu Zhe				</fileset>
8722a14f28SLiu Zhe			</classpath>
880e2e75f4SLiu Zhe		</javac>
89faa4b864SLei De Bin	</target>
90faa4b864SLei De Bin
910e2e75f4SLiu Zhe	<target name="testgui.init">
926467ecbfSLiu Zhe		<mkdir dir="testgui/bin" />
936467ecbfSLiu Zhe		<copy includeemptydirs="false" todir="testgui/bin">
940e2e75f4SLiu Zhe			<fileset dir="testgui/source">
950e2e75f4SLiu Zhe				<exclude name="**/*.java" />
960e2e75f4SLiu Zhe			</fileset>
970e2e75f4SLiu Zhe		</copy>
98faa4b864SLei De Bin	</target>
99faa4b864SLei De Bin
1006467ecbfSLiu Zhe	<target name="testgui.compile" depends="testcommon.compile, testgui.init">
1019f57b441SLiu Zhe		<javac destdir="testgui/bin" debug="on" source="1.6" target="1.6" encoding="utf-8" includeantruntime="false">
1020e2e75f4SLiu Zhe			<src path="testgui/source"/>
1037acce70dSLiu Zhe			<classpath>
1046467ecbfSLiu Zhe				<fileset dir="lib">
1056467ecbfSLiu Zhe				    <include name="*.jar" />
1066467ecbfSLiu Zhe				</fileset>
1076467ecbfSLiu Zhe				<pathelement location="testcommon/bin" />
1087acce70dSLiu Zhe			</classpath>
1090e2e75f4SLiu Zhe		</javac>
110faa4b864SLei De Bin	</target>
111faa4b864SLei De Bin
1120e2e75f4SLiu Zhe	<target name="testuno.init">
1136467ecbfSLiu Zhe		<mkdir dir="testuno/bin" />
1146467ecbfSLiu Zhe		<copy includeemptydirs="false" todir="testuno/bin">
1150e2e75f4SLiu Zhe			<fileset dir="testuno/source">
1160e2e75f4SLiu Zhe				<exclude name="**/*.java" />
1170e2e75f4SLiu Zhe			</fileset>
1180e2e75f4SLiu Zhe		</copy>
119faa4b864SLei De Bin	</target>
120faa4b864SLei De Bin
1216467ecbfSLiu Zhe	<target name="testuno.compile" depends="testcommon.compile, testuno.init">
1229f57b441SLiu Zhe		<javac destdir="testuno/bin" debug="on" source="1.6" target="1.6" encoding="utf-8" includeantruntime="false">
1230e2e75f4SLiu Zhe			<src path="testuno/source"/>
1247acce70dSLiu Zhe			<classpath>
1256467ecbfSLiu Zhe				<fileset dir="lib">
1266467ecbfSLiu Zhe					<include name="*.jar" />
1276467ecbfSLiu Zhe				</fileset>
1286467ecbfSLiu Zhe				<pathelement location="testcommon/bin" />
1297acce70dSLiu Zhe				<path refid="uno.classpath"/>
1307acce70dSLiu Zhe			</classpath>
1310e2e75f4SLiu Zhe		</javac>
132faa4b864SLei De Bin	</target>
133faa4b864SLei De Bin
1340e2e75f4SLiu Zhe	<target name="clean" description="Clean all output">
1356467ecbfSLiu Zhe		<delete dir="testcommon/bin" />
1366467ecbfSLiu Zhe		<delete dir="testgui/bin" />
1376467ecbfSLiu Zhe		<delete dir="testuno/bin" />
138a622bb93SDamjan Jovanovic		<ant antfile="smoketestdoc/build.xml" target="clean" inheritAll="false" useNativeBasedir="true"/>
1396467ecbfSLiu Zhe	</target>
140a622bb93SDamjan Jovanovic
1416467ecbfSLiu Zhe	<target name="compile" depends="testcommon.compile,testgui.compile,testuno.compile" description="Compile source code">
142a622bb93SDamjan Jovanovic		<ant antfile="smoketestdoc/build.xml" inheritAll="false" useNativeBasedir="true"/>
1436467ecbfSLiu Zhe	</target>
1446467ecbfSLiu Zhe
1456467ecbfSLiu Zhe	<target name="dist" depends="clean,compile">
1466467ecbfSLiu Zhe		<tstamp/>
1475148ee0dSLiu Zhe        	<zip destfile="${dist.dir}/${dist.name}_${DSTAMP}.zip" update="false">
1485148ee0dSLiu Zhe			<zipfileset dir="." includes="lib/**, testcommon/**,testgui/**,testuno/**,build.xml,run,run.bat" filemode="751" prefix="aoo_test/"/>
1495148ee0dSLiu Zhe		</zip>
1500e2e75f4SLiu Zhe	</target>
1516467ecbfSLiu Zhe
1526467ecbfSLiu Zhe	<target name="test" depends="compile" description="start test">
153eb07ef5fSDamjan Jovanovic		<!-- Try the specified ${openoffice.home} first -->
1545148ee0dSLiu Zhe		<condition property="test.arg0" value="-Dopenoffice.home=${openoffice.home}">
1556467ecbfSLiu Zhe			<isset property="openoffice.home" />
1566467ecbfSLiu Zhe		</condition>
157eb07ef5fSDamjan Jovanovic
158eb07ef5fSDamjan Jovanovic		<!-- Next try the internal install path that the with-package-format=installed option to configure uses -->
15929b55262Sdamjan		<available type="dir" file="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/Apache_OpenOffice/installed/install/en-US/openoffice4"
16029b55262Sdamjan			property="internalInstalledDirNix" value="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/Apache_OpenOffice/installed/install/en-US/openoffice4"/>
16129b55262Sdamjan		<condition property="test.arg0" value="-Dopenoffice.home=${internalInstalledDirNix}">
16229b55262Sdamjan			<isset property="internalInstalledDirNix" />
16329b55262Sdamjan		</condition>
16429b55262Sdamjan		<available type="dir" file="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/Apache_OpenOffice/installed/install/en-US/OpenOffice 4"
16529b55262Sdamjan			property="internalInstalledDirWin" value="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/Apache_OpenOffice/installed/install/en-US/OpenOffice 4"/>
16629b55262Sdamjan		<condition property="test.arg0" value="-Dopenoffice.home=${internalInstalledDirWin}">
16729b55262Sdamjan			<isset property="internalInstalledDirWin" />
168eb07ef5fSDamjan Jovanovic		</condition>
169eb07ef5fSDamjan Jovanovic
170eb07ef5fSDamjan Jovanovic		<!-- Finally try the tar.gz and zip archives which build by default -->
1716467ecbfSLiu Zhe		<pathconvert property="openoffice.pack" setonempty="false">
1726467ecbfSLiu Zhe			<path>
173864de7b8SHerbert Dürr				<fileset dir="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/Apache_OpenOffice/archive/install/en-US" includes="*.tar.gz,*.zip"  erroronmissingdir="false"/>
1746467ecbfSLiu Zhe			</path>
1756467ecbfSLiu Zhe		</pathconvert>
1766467ecbfSLiu Zhe		<condition property="test.arg0" value="-Dopenoffice.pack=${openoffice.pack}">
1776467ecbfSLiu Zhe			<isset property="openoffice.pack" />
1786467ecbfSLiu Zhe		</condition>
179eb07ef5fSDamjan Jovanovic
1806467ecbfSLiu Zhe		<fail message="No OpenOffice available!" unless="test.arg0"/>
1815148ee0dSLiu Zhe		<condition property="test.executable" value="./run.bat">
1826467ecbfSLiu Zhe			<os family="windows" />
1836467ecbfSLiu Zhe		</condition>
1845148ee0dSLiu Zhe		<property name="test.executable" value="./run"/>
185adc0d9c1SLiu Zhe		<property name="test.args" value="-tp bvt"/>
1865148ee0dSLiu Zhe		<exec executable="${test.executable}">
1876467ecbfSLiu Zhe			<arg value="${test.arg0}"/>
188adc0d9c1SLiu Zhe			<arg line="${test.args}"/>
1896467ecbfSLiu Zhe		</exec>
1900e2e75f4SLiu Zhe	</target>
191faa4b864SLei De Bin</project>
192