<?xml version="1.0"?> <!--*********************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * ***********************************************************--> <project basedir="." default="test"> <property environment="env" /> <property name="junit.home" value="${env.JUNIT_HOME}" /> <property name="dist.dir" value="." /> <property name="dist.name" value="aoo_test" /> <property name="junit.jar.repos" value="https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar" /> <property name="hamcrest.jar.repos" value="https://repo1.maven.org/maven2/org/hamcrest/hamcrest/2.2/hamcrest-2.2.jar" /> <path id="uno.classpath"> <fileset dir="${env.OUTDIR}/bin" erroronmissingdir="false"> <include name="juh.jar" /> <include name="unoil.jar" /> <include name="ridl.jar" /> <include name="jurt.jar" /> </fileset> <fileset dir="${openoffice.home}" erroronmissingdir="false"> <include name="**/juh.jar" /> <include name="**/unoil.jar" /> <include name="**/ridl.jar" /> <include name="**/jurt.jar" /> </fileset> </path> <target name="check.junit"> <copy todir="lib" > <fileset dir="${junit.home}" erroronmissingdir="false"> <include name="junit*.jar" /> </fileset> <globmapper from="*" to="junit.jar" /> </copy> <copy todir="lib" > <fileset dir="${junit.home}" erroronmissingdir="false"> <include name="hamcrest*.jar" /> </fileset> <globmapper from="*" to="hamcrest.jar" /> </copy> <available file="lib/junit.jar" property="junit.jar.exists"/> <available file="lib/hamcrest.jar" property="hamcrest.jar.exists"/> </target> <target name="prepare.junit" depends="check.junit" unless="junit.jar.exists"> <mkdir dir="lib" /> <get src="${junit.jar.repos}" dest="lib/junit.jar" skipexisting="true" /> <get src="${hamcrest.jar.repos}" dest="lib/hamcrest.jar" skipexisting="true" /> </target> <target name="testcommon.init"> <mkdir dir="testcommon/bin" /> <copy includeemptydirs="false" todir="testcommon/bin"> <fileset dir="testcommon/source"> <exclude name="**/*.java" /> </fileset> </copy> </target> <target name="testcommon.compile" depends="testcommon.init, prepare.junit"> <javac destdir="testcommon/bin" debug="on" source="1.6" target="1.6" encoding="utf-8" includeantruntime="false"> <src path="testcommon/source"/> <classpath> <fileset dir="lib"> <include name="*.jar" /> </fileset> </classpath> </javac> </target> <target name="testgui.init"> <mkdir dir="testgui/bin" /> <copy includeemptydirs="false" todir="testgui/bin"> <fileset dir="testgui/source"> <exclude name="**/*.java" /> </fileset> </copy> </target> <target name="testgui.compile" depends="testcommon.compile, testgui.init"> <javac destdir="testgui/bin" debug="on" source="1.6" target="1.6" encoding="utf-8" includeantruntime="false"> <src path="testgui/source"/> <classpath> <fileset dir="lib"> <include name="*.jar" /> </fileset> <pathelement location="testcommon/bin" /> </classpath> </javac> </target> <target name="testuno.init"> <mkdir dir="testuno/bin" /> <copy includeemptydirs="false" todir="testuno/bin"> <fileset dir="testuno/source"> <exclude name="**/*.java" /> </fileset> </copy> </target> <target name="testuno.compile" depends="testcommon.compile, testuno.init"> <javac destdir="testuno/bin" debug="on" source="1.6" target="1.6" encoding="utf-8" includeantruntime="false"> <src path="testuno/source"/> <classpath> <fileset dir="lib"> <include name="*.jar" /> </fileset> <pathelement location="testcommon/bin" /> <path refid="uno.classpath"/> </classpath> </javac> </target> <target name="clean" description="Clean all output"> <delete dir="testcommon/bin" /> <delete dir="testgui/bin" /> <delete dir="testuno/bin" /> <ant antfile="smoketestdoc/build.xml" target="clean" inheritAll="false" useNativeBasedir="true"/> </target> <target name="compile" depends="testcommon.compile,testgui.compile,testuno.compile" description="Compile source code"> <ant antfile="smoketestdoc/build.xml" inheritAll="false" useNativeBasedir="true"/> </target> <target name="dist" depends="clean,compile"> <tstamp/> <zip destfile="${dist.dir}/${dist.name}_${DSTAMP}.zip" update="false"> <zipfileset dir="." includes="lib/**, testcommon/**,testgui/**,testuno/**,build.xml,run,run.bat" filemode="751" prefix="aoo_test/"/> </zip> </target> <target name="test" depends="compile" description="start test"> <!-- Try the specified ${openoffice.home} first --> <condition property="test.arg0" value="-Dopenoffice.home=${openoffice.home}"> <isset property="openoffice.home" /> </condition> <!-- Next try the internal install path that the with-package-format=installed option to configure uses --> <available type="dir" file="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/Apache_OpenOffice/installed/install/en-US/openoffice4" property="internalInstalledDirNix" value="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/Apache_OpenOffice/installed/install/en-US/openoffice4"/> <condition property="test.arg0" value="-Dopenoffice.home=${internalInstalledDirNix}"> <isset property="internalInstalledDirNix" /> </condition> <available type="dir" file="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/Apache_OpenOffice/installed/install/en-US/OpenOffice 4" property="internalInstalledDirWin" value="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/Apache_OpenOffice/installed/install/en-US/OpenOffice 4"/> <condition property="test.arg0" value="-Dopenoffice.home=${internalInstalledDirWin}"> <isset property="internalInstalledDirWin" /> </condition> <!-- Finally try the tar.gz and zip archives which build by default --> <pathconvert property="openoffice.pack" setonempty="false"> <path> <fileset dir="${env.SRC_ROOT}/instsetoo_native/${env.INPATH}/Apache_OpenOffice/archive/install/en-US" includes="*.tar.gz,*.zip" erroronmissingdir="false"/> </path> </pathconvert> <condition property="test.arg0" value="-Dopenoffice.pack=${openoffice.pack}"> <isset property="openoffice.pack" /> </condition> <fail message="No OpenOffice available!" unless="test.arg0"/> <condition property="test.executable" value="./run.bat"> <os family="windows" /> </condition> <property name="test.executable" value="./run"/> <property name="test.args" value="-tp bvt"/> <echo message="Executing: ${test.executable} ${test.arg0} ${test.args}" level="info"/> <exec executable="${test.executable}"> <arg value="${test.arg0}"/> <arg line="${test.args}"/> </exec> </target> </project>