1e6e6073dSLiu Zhe<?xml version="1.0"?> 2e6e6073dSLiu Zhe<!--*********************************************************** 3e6e6073dSLiu Zhe * 4e6e6073dSLiu Zhe * Licensed to the Apache Software Foundation (ASF) under one 5e6e6073dSLiu Zhe * or more contributor license agreements. See the NOTICE file 6e6e6073dSLiu Zhe * distributed with this work for additional information 7e6e6073dSLiu Zhe * regarding copyright ownership. The ASF licenses this file 8e6e6073dSLiu Zhe * to you under the Apache License, Version 2.0 (the 9e6e6073dSLiu Zhe * "License"); you may not use this file except in compliance 10e6e6073dSLiu Zhe * with the License. You may obtain a copy of the License at 11e6e6073dSLiu Zhe * 12e6e6073dSLiu Zhe * http://www.apache.org/licenses/LICENSE-2.0 13e6e6073dSLiu Zhe * 14e6e6073dSLiu Zhe * Unless required by applicable law or agreed to in writing, 15e6e6073dSLiu Zhe * software distributed under the License is distributed on an 16e6e6073dSLiu Zhe * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17e6e6073dSLiu Zhe * KIND, either express or implied. See the License for the 18e6e6073dSLiu Zhe * specific language governing permissions and limitations 19e6e6073dSLiu Zhe * under the License. 20e6e6073dSLiu Zhe * 21e6e6073dSLiu Zhe ***********************************************************--> 22e6e6073dSLiu Zhe 23e6e6073dSLiu Zhe 24e6e6073dSLiu Zhe 25e6e6073dSLiu Zhe<project basedir="." default="test"> 26e6e6073dSLiu Zhe <property environment="env" /> 27e6e6073dSLiu Zhe <property name="junit.home" value="${env.JUNIT_HOME}" /> 286467ecbfSLiu Zhe <property name="dist.dir" value="." /> 296467ecbfSLiu Zhe <property name="dist.name" value="aoo_test" /> 307f844d9fSCarl Marcum <property name="junit.jar.repos" value="https://repo1.maven.org/maven2/junit/junit/4.10/junit-4.10.jar" /> 31e6e6073dSLiu Zhe 326467ecbfSLiu Zhe <path id="uno.classpath"> 33c74863a0SLiu Zhe <fileset dir="${env.OUTDIR}/bin" erroronmissingdir="false"> 34c74863a0SLiu Zhe <include name="juh.jar" /> 35180e3c91SLiu 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" /> 44e6e6073dSLiu Zhe </fileset> 45e6e6073dSLiu Zhe </path> 46e6e6073dSLiu 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"/> 556467ecbfSLiu Zhe </target> 566467ecbfSLiu Zhe 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" /> 606467ecbfSLiu Zhe </target> 616467ecbfSLiu Zhe 626467ecbfSLiu Zhe <target name="testcommon.init"> 636467ecbfSLiu Zhe <mkdir dir="testcommon/bin" /> 646467ecbfSLiu Zhe <copy includeemptydirs="false" todir="testcommon/bin"> 656467ecbfSLiu Zhe <fileset dir="testcommon/source"> 666467ecbfSLiu Zhe <exclude name="**/*.java" /> 676467ecbfSLiu Zhe </fileset> 686467ecbfSLiu Zhe </copy> 696467ecbfSLiu Zhe </target> 706467ecbfSLiu Zhe 716467ecbfSLiu Zhe <target name="testcommon.compile" depends="testcommon.init, prepare.junit"> 729f57b441SLiu Zhe <javac destdir="testcommon/bin" debug="on" source="1.6" target="1.6" encoding="utf-8" includeantruntime="false"> 736467ecbfSLiu Zhe <src path="testcommon/source"/> 746467ecbfSLiu Zhe <classpath> 756467ecbfSLiu Zhe <fileset dir="lib"> 766467ecbfSLiu Zhe <include name="*.jar" /> 776467ecbfSLiu Zhe </fileset> 786467ecbfSLiu Zhe </classpath> 796467ecbfSLiu Zhe </javac> 806467ecbfSLiu Zhe </target> 816467ecbfSLiu Zhe 826467ecbfSLiu Zhe <target name="testgui.init"> 836467ecbfSLiu Zhe <mkdir dir="testgui/bin" /> 846467ecbfSLiu Zhe <copy includeemptydirs="false" todir="testgui/bin"> 856467ecbfSLiu Zhe <fileset dir="testgui/source"> 866467ecbfSLiu Zhe <exclude name="**/*.java" /> 876467ecbfSLiu Zhe </fileset> 886467ecbfSLiu Zhe </copy> 896467ecbfSLiu Zhe </target> 906467ecbfSLiu Zhe 916467ecbfSLiu Zhe <target name="testgui.compile" depends="testcommon.compile, testgui.init"> 929f57b441SLiu Zhe <javac destdir="testgui/bin" debug="on" source="1.6" target="1.6" encoding="utf-8" includeantruntime="false"> 936467ecbfSLiu Zhe <src path="testgui/source"/> 946467ecbfSLiu Zhe <classpath> 956467ecbfSLiu Zhe <fileset dir="lib"> 966467ecbfSLiu Zhe <include name="*.jar" /> 976467ecbfSLiu Zhe </fileset> 986467ecbfSLiu Zhe <pathelement location="testcommon/bin" /> 996467ecbfSLiu Zhe </classpath> 1006467ecbfSLiu Zhe </javac> 1016467ecbfSLiu Zhe </target> 1026467ecbfSLiu Zhe 1036467ecbfSLiu Zhe <target name="testuno.init"> 1046467ecbfSLiu Zhe <mkdir dir="testuno/bin" /> 1056467ecbfSLiu Zhe <copy includeemptydirs="false" todir="testuno/bin"> 1066467ecbfSLiu Zhe <fileset dir="testuno/source"> 1076467ecbfSLiu Zhe <exclude name="**/*.java" /> 1086467ecbfSLiu Zhe </fileset> 1096467ecbfSLiu Zhe </copy> 1106467ecbfSLiu Zhe </target> 1116467ecbfSLiu Zhe 1126467ecbfSLiu Zhe <target name="testuno.compile" depends="testcommon.compile, testuno.init"> 1139f57b441SLiu Zhe <javac destdir="testuno/bin" debug="on" source="1.6" target="1.6" encoding="utf-8" includeantruntime="false"> 1146467ecbfSLiu Zhe <src path="testuno/source"/> 1156467ecbfSLiu Zhe <classpath> 1166467ecbfSLiu Zhe <fileset dir="lib"> 1176467ecbfSLiu Zhe <include name="*.jar" /> 1186467ecbfSLiu Zhe </fileset> 1196467ecbfSLiu Zhe <pathelement location="testcommon/bin" /> 1206467ecbfSLiu Zhe <path refid="uno.classpath"/> 1216467ecbfSLiu Zhe </classpath> 1226467ecbfSLiu Zhe </javac> 1236467ecbfSLiu Zhe </target> 1246467ecbfSLiu Zhe 1256467ecbfSLiu 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"> 1375148ee0dSLiu Zhe <zipfileset dir="." includes="lib/**, testcommon/**,testgui/**,testuno/**,build.xml,run,run.bat" filemode="751" prefix="aoo_test/"/> 1386467ecbfSLiu Zhe </zip> 1396467ecbfSLiu Zhe </target> 1406467ecbfSLiu Zhe 1416467ecbfSLiu Zhe <target name="test" depends="compile" description="start test"> 142*44cf0280SCarl Marcum <!-- Try the specified ${openoffice.home} first --> 1436467ecbfSLiu Zhe <condition property="test.arg0" value="-Dopenoffice.home=${openoffice.home}"> 1446467ecbfSLiu Zhe <isset property="openoffice.home" /> 1456467ecbfSLiu Zhe </condition> 146*44cf0280SCarl Marcum 147*44cf0280SCarl Marcum <!-- Next try the internal install path that the with-package-format=installed option to configure uses --> 148*44cf0280SCarl Marcum <available type="dir" file="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/Apache_OpenOffice/installed/install/en-US/openoffice4" 149*44cf0280SCarl Marcum property="internalInstalledDirNix" value="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/Apache_OpenOffice/installed/install/en-US/openoffice4"/> 150*44cf0280SCarl Marcum <condition property="test.arg0" value="-Dopenoffice.home=${internalInstalledDirNix}"> 151*44cf0280SCarl Marcum <isset property="internalInstalledDirNix" /> 152*44cf0280SCarl Marcum </condition> 153*44cf0280SCarl Marcum <available type="dir" file="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/Apache_OpenOffice/installed/install/en-US/OpenOffice 4" 154*44cf0280SCarl Marcum property="internalInstalledDirWin" value="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/Apache_OpenOffice/installed/install/en-US/OpenOffice 4"/> 155*44cf0280SCarl Marcum <condition property="test.arg0" value="-Dopenoffice.home=${internalInstalledDirWin}"> 156*44cf0280SCarl Marcum <isset property="internalInstalledDirWin" /> 157*44cf0280SCarl Marcum </condition> 158*44cf0280SCarl Marcum 159*44cf0280SCarl Marcum <!-- Finally try the tar.gz and zip archives which build by default --> 1606467ecbfSLiu Zhe <pathconvert property="openoffice.pack" setonempty="false"> 1616467ecbfSLiu Zhe <path> 162864de7b8SHerbert Dürr <fileset dir="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/Apache_OpenOffice/archive/install/en-US" includes="*.tar.gz,*.zip" erroronmissingdir="false"/> 1636467ecbfSLiu Zhe </path> 1646467ecbfSLiu Zhe </pathconvert> 1656467ecbfSLiu Zhe <condition property="test.arg0" value="-Dopenoffice.pack=${openoffice.pack}"> 1666467ecbfSLiu Zhe <isset property="openoffice.pack" /> 1676467ecbfSLiu Zhe </condition> 168*44cf0280SCarl Marcum 1696467ecbfSLiu Zhe <fail message="No OpenOffice available!" unless="test.arg0"/> 170180e3c91SLiu Zhe <condition property="test.executable" value="./run.bat"> 1716467ecbfSLiu Zhe <os family="windows" /> 1726467ecbfSLiu Zhe </condition> 173180e3c91SLiu Zhe <property name="test.executable" value="./run"/> 174adc0d9c1SLiu Zhe <property name="test.args" value="-tp bvt"/> 1756467ecbfSLiu Zhe <exec executable="${test.executable}"> 1766467ecbfSLiu Zhe <arg value="${test.arg0}"/> 177adc0d9c1SLiu Zhe <arg line="${test.args}"/> 1786467ecbfSLiu Zhe </exec> 1796467ecbfSLiu Zhe </target> 180e6e6073dSLiu Zhe</project> 181