poi/old.xml

925 lines
38 KiB
XML

<?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.
-->
<!--
POI Build System. Written by:
Glen Stampoultzis glens at apache.org
Modified by:
Rainer Klute klute@rainer-klute.de
Bruno Girin brunogirin@gmail.com
Yegor Kozlov yegor at apache.org
This build was tested with ant 1.6.2 although it will probably work with
other versions. The following jar files should be available on the
classpath when running ant:
LIBRARY LOCATION
======= ========
junit(3.8+) http://www.junit.org
To build the documentation you will need to install forrest and set
the FORREST_HOME environment variable. Forrest 0.5.1 required.
Since POI 3.5 you will need JDK 1.5 or newer to build POI.
Some people may find the tests hang when run through Ant. If this
happens to you, try giving Ant some more memory when you run it, eg:
ANT_OPTS="-Xmx1024m -XX:MaxPermSize=256m" ant test
-->
<project name="POI Build" default="help" basedir="." xmlns:mvn="antlib:org.apache.maven.artifact.ant">
<description>The Apache POI project Ant build.</description>
<property name="version.id" value="3.11-beta1"/>
<property environment="env"/>
<!-- the repository to download jars from -->
<property name="repository.m2" value="http://repo1.maven.org"/>
<property name="main.lib" location="lib"/>
<property name="ooxml.lib" location="ooxml-lib"/>
<property name="forrest.home" value="${env.FORREST_HOME}"/>
<!-- Main: -->
<property name="main.resource1.dir" value="src/resources/main"/>
<property name="main.src" location="src/java"/>
<property name="main.src.test" location="src/testcases"/>
<property name="main.documentation" value="src/documentation"/>
<property name="main.output.dir" location="build/classes"/>
<property name="main.output.test.dir" location="build/test-classes"/>
<property name="main.reports.test" location="build/test-results"/>
<property name="main.testokfile" location="build/main-testokfile.txt"/>
<!-- Examples: -->
<property name="examples.src" location="src/examples/src"/>
<property name="examples.output.dir" location="build/examples-classes"/>
<!-- OOXML support: -->
<property name="ooxml.src" location="src/ooxml/java"/>
<property name="ooxml.resource1.dir" value="src/resources/ooxml"/>
<property name="ooxml.src.test" location="src/ooxml/testcases"/>
<property name="ooxml.reports.test" location="build/ooxml-test-results"/>
<property name="ooxml.output.dir" location="build/ooxml-classes"/>
<property name="ooxml.output.test.dir" location="build/ooxml-test-classes"/>
<property name="ooxml.testokfile" location="build/ooxml-testokfile.txt"/>
<property name="ooxml.lite.output.dir" location="build/ooxml-lite-classes"/>
<property name="ooxml.encryption.xsd.dir" location="src/ooxml/resources/org/apache/poi/poifs/crypt"/>
<!-- coverage libs -->
<property name="jacoco.zip" location="${main.lib}/jacoco-0.6.5.201403032054.zip"/>
<property name="jacoco.url" value="${repository.m2}/maven2/org/jacoco/jacoco/0.6.5.201403032054/jacoco-0.6.5.201403032054.zip"/>
<property name="asm.jar" location="${main.lib}/asm-all-4.0.jar"/>
<property name="asm.url" value="${repository.m2}/maven2/org/ow2/asm/asm-all/4.0/asm-all-4.0.jar"/>
<!-- See http://www.ecma-international.org/publications/standards/Ecma-376.htm -->
<!-- "Copy these file(s), free of charge" -->
<property name="ooxml.xsds.ozip" location="${ooxml.lib}/OfficeOpenXML-Part4.zip"/>
<property name="ooxml.xsds.izip" location="${ooxml.lib}/OfficeOpenXML-XMLSchema.zip"/>
<property name="ooxml.xsds.url"
value="http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%201st%20edition%20Part%204%20(PDF).zip"/>
<property name="ooxml.xsds.src.dir" location="build/ooxml-xsds-src"/>
<property name="ooxml.xsds.src.jar" location="${ooxml.lib}/ooxml-schemas-src-1.1.jar"/>
<property name="ooxml.xsds.jar" location="${ooxml.lib}/ooxml-schemas-1.1.jar"/>
<property name="ooxml.encryption.src.dir" location="build/ooxml-encryption-src"/>
<property name="ooxml.encryption.src.jar" location="${ooxml.lib}/ooxml-encryption-src-1.1.jar"/>
<property name="ooxml.encryption.jar" location="${ooxml.lib}/ooxml-encryption-1.1.jar"/>
<property name="maven.ooxml.xsds.version.id" value="1.0"/>
<property name="maven.ooxml.xsds.jar" value="ooxml-schemas-${maven.ooxml.xsds.version.id}.jar"/>
<!-- Coverage -->
<property name="coverage.dir" value="build/coverage"/>
<!-- Exclude some uninteresting classes from coverage-instrumentation as we do not want to measure coverage in those packages anyway -->
<property name="coverage.excludes" value="org.openxmlformats.*:com.*:org.junit.*:junit.*:"/>
<!-- Apache RAT license check properties -->
<property name="rat.reportdir" value="build/rat"/>
<property name="rat.report" value="${rat.reportdir}/report.txt"/>
<!-- build and distro settings -->
<property name="jar.name" value="poi"/>
<property name="build.site" location="build/tmp/site/build/site"/>
<property name="build.site.src" location="build/tmp/site"/>
<property name="apidocs.report.dir" location="${build.site}/apidocs"/>
<property name="dist.dir" location="build/dist"/>
<property name="halt.on.test.failure" value="true"/>
<propertyset id="junit.properties">
<propertyref name="POI.testdata.path"/>
<propertyref name="java.awt.headless"/>
<propertyref name="org.apache.poi.util.POILogger"/>
</propertyset>
<path id="main.classpath">
<pathelement location="${main.commons-logging.jar}"/>
<pathelement location="${main.commons-codec.jar}"/>
<pathelement location="${main.log4j.jar}"/>
<pathelement location="${main.junit.jar}"/>
<pathelement location="${main.hamcrest.jar}"/>
</path>
<path id="ooxml.classpath">
<pathelement location="${ooxml.jsr173.jar}"/>
<pathelement location="${ooxml.dom4j.jar}"/>
<pathelement location="${ooxml.xmlbeans.jar}"/>
<pathelement location="${ooxml.xsds.jar}"/>
<path refid="main.classpath"/>
<pathelement location="${main.output.dir}"/>
<pathelement location="${ooxml.encryption.jar}"/>
</path>
<path id="test.classpath">
<path refid="main.classpath"/>
<pathelement location="${main.output.dir}"/>
<pathelement location="${main.output.test.dir}"/>
</path>
<path id="test.ooxml.classpath">
<path refid="ooxml.classpath"/>
<pathelement location="${ooxml.output.dir}"/>
<pathelement location="${ooxml.output.test.dir}"/>
<pathelement location="${main.output.test.dir}"/>
</path>
<path id="ooxml-lite.classpath">
<pathelement location="${ooxml.jsr173.jar}"/>
<pathelement location="${ooxml.dom4j.jar}"/>
<pathelement location="${ooxml.xmlbeans.jar}"/>
<pathelement location="build/ooxml-xsds-lite"/> <!-- instead of ooxml-xsds.jar use the filtered classes-->
<path refid="main.classpath"/>
<pathelement location="${main.output.dir}"/>
<path refid="ooxml.classpath"/>
<pathelement location="${ooxml.output.dir}"/>
<pathelement location="${ooxml.output.test.dir}"/>
<pathelement location="${main.output.test.dir}"/>
</path>
<path id="examples.classpath">
<path refid="main.classpath"/>
<pathelement location="${main.output.dir}"/>
</path>
<path id="lib.jacoco">
<fileset dir="lib">
<include name="org.jacoco*.jar" />
<include name="asm-all-4*.jar" />
</fileset>
</path>
<!-- Prints POI's Ant usage help -->
<target name="help" description="Prints Apache POI's Ant usage help">
<echo>
This is POI ${version.id}
Java Version ${ant.java.version}
Timestamp ${DSTAMP}
The main targets of interest are:
- clean Erase all build work products (ie. everything in the build directory)
- compile Compile all files from main, ooxml
- test Run all unit tests from main, ooxml
- jar Produce jar files
- site Generate all documentation (Requires Apache Forrest)
- dist Create a distribution (Requires Apache Forrest)
</echo>
</target>
<tstamp>
<format property="tstamp.year" pattern="yyyy"/>
</tstamp>
<target name="init" depends="fetch-jars,fetch-ooxml-jars">
<mkdir dir="build"/>
<mkdir dir="${main.output.dir}"/>
<mkdir dir="${main.output.test.dir}"/>
<mkdir dir="${main.reports.test}"/>
<mkdir dir="${ooxml.output.dir}"/>
<mkdir dir="${ooxml.output.test.dir}"/>
<mkdir dir="${ooxml.reports.test}"/>
<mkdir dir="${examples.output.dir}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${build.site}"/>
</target>
<target name="clean">
<delete dir="build"/>
</target>
<target name="testexist">
<echo message="Testing for ${destfile}" level="debug"/>
<available file="${destfile}" property="exist"/>
</target>
<target name="downloadfile" unless="exist" depends="testexist">
<get src="${sourcefile}" dest="${destfile}"/>
</target>
<target name="check-jars">
<condition property="jars.present">
<or>
<and>
<available file="${main.commons-logging.jar}"/>
<available file="${main.commons-codec.jar}"/>
<available file="${main.log4j.jar}"/>
<available file="${main.junit.jar}"/>
<available file="${main.hamcrest.jar}"/>
<available file="${main.ant.jar}"/>
<available file="${asm.jar}"/>
<available file="${jacoco.zip}"/>
<available file="${rat.jar}"/>
</and>
<isset property="disconnected"/>
</or>
</condition>
</target>
<target name="fetch-jars" depends="check-jars" unless="jars.present"
description="Fetches needed JAR files from the Internet">
<mkdir dir="${main.lib}"/>
<antcall target="downloadfile">
<param name="sourcefile" value="${main.commons-logging.url}"/>
<param name="destfile" value="${main.commons-logging.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${main.commons-codec.url}"/>
<param name="destfile" value="${main.commons-codec.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${main.log4j.url}"/>
<param name="destfile" value="${main.log4j.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${main.junit.url}"/>
<param name="destfile" value="${main.junit.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${main.hamcrest.url}"/>
<param name="destfile" value="${main.hamcrest.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${main.ant.url}"/>
<param name="destfile" value="${main.ant.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${asm.url}"/>
<param name="destfile" value="${asm.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${jacoco.url}"/>
<param name="destfile" value="${jacoco.zip}"/>
</antcall>
<unzip src="${jacoco.zip}" dest=".">
<patternset>
<include name="lib/*.jar"/>
</patternset>
</unzip>
<antcall target="downloadfile">
<param name="sourcefile" value="${rat.url}"/>
<param name="destfile" value="${rat.jar}"/>
</antcall>
</target>
<target name="check-ooxml-jars">
<condition property="ooxml.jars.present">
<or>
<and>
<available file="${ooxml.dom4j.jar}"/>
<available file="${ooxml.xmlbeans.jar}"/>
<available file="${ooxml.jsr173.jar}"/>
<available file="${ooxml.xsds.jar}"/>
</and>
<isset property="disconnected"/>
</or>
</condition>
</target>
<target name="fetch-ooxml-jars" depends="check-ooxml-jars" unless="ooxml.jars.present">
<mkdir dir="${ooxml.lib}"/>
<antcall target="downloadfile">
<param name="sourcefile" value="${ooxml.dom4j.url}"/>
<param name="destfile" value="${ooxml.dom4j.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${ooxml.xmlbeans.url}"/>
<param name="destfile" value="${ooxml.xmlbeans.jar}"/>
</antcall>
<antcall target="downloadfile">
<param name="sourcefile" value="${ooxml.jsr173.url}"/>
<param name="destfile" value="${ooxml.jsr173.jar}"/>
</antcall>
</target>
<target name="check-ooxml-xsds">
<condition property="ooxml-xsds.present">
<or>
<and>
<available file="${ooxml.xsds.izip}"/>
</and>
<isset property="disconnected"/>
</or>
</condition>
</target>
<target name="fetch-ooxml-xsds" unless="ooxml-xsds.present"
depends="check-ooxml-xsds"
description="Fetches needed OOXML xsd files from the Internet">
<get src="${ooxml.xsds.url}" dest="${ooxml.xsds.ozip}"/>
<unzip src="${ooxml.xsds.ozip}" dest="${ooxml.lib}">
<patternset>
<include name="OfficeOpenXML-XMLSchema.zip"/>
</patternset>
</unzip>
</target>
<target name="check-compiled-ooxml-xsds" depends="fetch-ooxml-xsds">
<condition property="ooxml-compiled-xsds.present">
<or>
<available file="${ooxml.xsds.jar}"/>
<isset property="disconnected"/>
</or>
</condition>
<condition property="ooxml-compiled-encryption-xsds.present">
<or>
<available file="${ooxml.encryption.jar}"/>
<isset property="disconnected"/>
</or>
</condition>
</target>
<target name="compile-ooxml-xsds" unless="ooxml-compiled-xsds.present"
depends="check-jars,fetch-jars,check-compiled-ooxml-xsds"
description="Unpacks the OOXML xsd files, and compiles them into XmlBeans">
<property name="ooxml.xsds.tmp.dir" location="build/ooxml-xsds"/>
<mkdir dir="${ooxml.xsds.tmp.dir}"/>
<taskdef name="xmlbean"
classname="org.apache.xmlbeans.impl.tool.XMLBean"
classpath="${ooxml.xmlbeans.jar}:${ooxml.jsr173.jar}"/>
<!-- We need a fair amount of memory to compile the xml schema, -->
<!-- but limit it in case it goes wrong! -->
<!-- Pick the right amount based on 32 vs 64 bit jvm -->
<condition property="ooxml.memory" value="768m" else="512m">
<equals arg1="${sun.arch.data.model}" arg2="64" />
</condition>
<unzip src="${ooxml.xsds.izip}" dest="${ooxml.xsds.tmp.dir}"/>
<!--
schema="build/ooxml-xsds/"
schema="build/ooxml-xsds/sml-workbook.xsd"
-->
<xmlbean
schema="${ooxml.xsds.tmp.dir}"
srcgendir="${ooxml.xsds.src.dir}"
optimize="yes"
destfile="${ooxml.xsds.jar}"
javasource="1.5"
failonerror="true"
fork="true"
memoryMaximumSize="${ooxml.memory}"
>
<classpath refid="ooxml.classpath"/>
</xmlbean>
<!-- Now make a jar of the schema sources -->
<jar
basedir="${ooxml.xsds.src.dir}"
destfile="${ooxml.xsds.src.jar}"
/>
</target>
<target name="compile-ooxml-encryption-xsds" unless="ooxml-compiled-encryption-xsds.present"
depends="check-jars,fetch-jars,check-compiled-ooxml-xsds"
description="Compiles the OOXML encryption xsd files into XmlBeans">
<taskdef name="xmlbean"
classname="org.apache.xmlbeans.impl.tool.XMLBean"
classpath="${ooxml.xmlbeans.jar}:${ooxml.jsr173.jar}"/>
<!-- We need a fair amount of memory to compile the xml schema, -->
<!-- but limit it in case it goes wrong! -->
<!-- Pick the right amount based on 32 vs 64 bit jvm -->
<condition property="ooxml.memory" value="768m" else="512m">
<equals arg1="${sun.arch.data.model}" arg2="64" />
</condition>
<xmlbean
schema="${ooxml.encryption.xsd.dir}"
srcgendir="${ooxml.encryption.src.dir}"
optimize="yes"
destfile="${ooxml.encryption.jar}"
javasource="1.5"
failonerror="true"
fork="true"
memoryMaximumSize="${ooxml.memory}"
>
<classpath refid="ooxml.classpath"/>
</xmlbean>
<!-- Now make a jar of the schema sources -->
<jar
basedir="${ooxml.encryption.src.dir}"
destfile="${ooxml.encryption.src.jar}"
/>
</target>
<target name="compile" depends="init, compile-main,
compile-examples"
description="Compiles the POI main classes and examples"/>
<target name="compile-all" depends="compile,compile-ooxml-lite"/>
<target name="compile-main" depends="init">
<javac target="${jdk.version.class}"
source="${jdk.version.source}"
destdir="${main.output.dir}"
srcdir="${main.src}"
debug="${compile.debug}"
encoding="${java.source.encoding}"
fork="yes"
includeantruntime="false">
<classpath refid="main.classpath"/>
</javac>
<javac target="${jdk.version.class}"
source="${jdk.version.source}"
destdir="${main.output.test.dir}"
srcdir="${main.src.test}"
debug="${compile.debug}"
encoding="${java.source.encoding}"
fork="yes"
includeantruntime="false">
<classpath>
<path refid="main.classpath"/>
<pathelement path="${main.output.dir}"/>
</classpath>
</javac>
<copy todir="${main.output.dir}">
<fileset dir="${main.resource1.dir}"/>
</copy>
</target>
<target name="compile-ooxml" depends="compile-main,compile-ooxml-xsds,compile-ooxml-encryption-xsds">
<javac target="${jdk.version.class}"
source="${jdk.version.source}"
destdir="${ooxml.output.dir}"
srcdir="${ooxml.src}"
debug="${compile.debug}"
encoding="${java.source.encoding}"
fork="yes"
includeantruntime="false">
<classpath refid="ooxml.classpath"/>
</javac>
<javac target="${jdk.version.class}"
source="${jdk.version.source}"
destdir="${ooxml.output.test.dir}"
srcdir="${ooxml.src.test}"
debug="${compile.debug}"
encoding="${java.source.encoding}"
fork="yes"
includeantruntime="false">
<classpath>
<path refid="ooxml.classpath"/>
<pathelement path="${ooxml.output.dir}"/>
<pathelement path="${main.output.test.dir}"/>
</classpath>
</javac>
<copy todir="${ooxml.output.dir}">
<fileset dir="${ooxml.resource1.dir}"/>
</copy>
</target>
<target name="compile-version" depends="init"
description="Compiles the version class">
<!-- Generate the .java file -->
<property name="version.java" value="${main.output.dir}/org/apache/poi/Version.java"/>
<delete file="${version.java}"/>
<copy
file="src/resources/version/Version.java.template"
tofile="${version.java}">
<filterset>
<filter token="VERSION" value="${version.id}"/>
<filter token="DSTAMP" value="${DSTAMP}"/>
</filterset>
</copy>
<!-- Compile -->
<javac target="${jdk.version.class}" source="${jdk.version.source}"
failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes"
srcdir="${main.output.dir}"
encoding="${java.source.encoding}" includeantruntime="false">
</javac>
<!-- Tidy up -->
<delete file="${version.java}"/>
</target>
<target name="jacocotask" depends="">
<echo message="Coverage reporting: ${coverage.enabled}"/>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath refid="lib.jacoco"/>
</taskdef>
</target>
<target name="test" depends="compile,jacocotask,test-main,test-ooxml"
description="Tests main and ooxml"/>
<target name="test-all" depends="test,test-ooxml-lite,testcoveragereport"/>
<target name="testcoveragereport" depends="jacocotask" description="create test-report" xmlns:jacoco="antlib:org.jacoco.ant" if="coverage.enabled">
<delete dir="${coverage.dir}"/>
<mkdir dir="${coverage.dir}"/>
<jacoco:report>
<executiondata>
<fileset dir="build">
<include name="*.exec"/>
</fileset>
</executiondata>
<structure name="Apache POI">
<group name="Main">
<classfiles>
<fileset dir="${main.output.dir}">
<exclude name="org/apache/poi/hssf/usermodel/DummyGraphics2d.class"/>
</fileset>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${main.src}"/>
</sourcefiles>
</group>
<group name="Scratchpad">
<classfiles>
<fileset dir="${scratchpad.output.dir}">
<exclude name="org/apache/poi/hwpf/model/types/*.class"/>
<exclude name="org/apache/poi/hdf/model/hdftypes/definitions/*.class"/>
</fileset>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${scratchpad.src}"/>
</sourcefiles>
</group>
<group name="OOXML">
<classfiles>
<fileset dir="${ooxml.output.dir}">
<exclude name=""/>
</fileset>
<fileset dir="${ooxml.lite.output.dir}">
<exclude name="org/openxmlformats/**"/>
<exclude name="schema*/**"/>
</fileset>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${ooxml.src}"/>
<!--fileset dir="${ooxml.lite.src}"/-->
</sourcefiles>
</group>
<group name="Excelant">
<classfiles>
<fileset dir="${excelant.output.dir}"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${excelant.src}"/>
</sourcefiles>
</group>
</structure>
<html destdir="${coverage.dir}"/>
<xml destfile="${coverage.dir}/coverage.xml"/>
</jacoco:report>
<echo message="Coverage results are available at coverage\index.html, coverage/coverage.xml" />
</target>
<target name="-test-main-check">
<uptodate property="main.test.notRequired" targetfile="${main.testokfile}">
<srcfiles dir="${main.src}"/>
<srcfiles dir="${main.src.test}"/>
</uptodate>
</target>
<target name="test-main" unless="main.test.notRequired"
depends="compile-main, -test-main-check,jacocotask" xmlns:jacoco="antlib:org.jacoco.ant">
<jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-main.exec">
<junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="${halt.on.test.failure}"
failureproperty="main.test.failed" showoutput="true">
<classpath refid="test.classpath"/>
<syspropertyset refid="junit.properties"/>
<jvmarg value="${poi.test.locale}"/>
<jvmarg value="-ea"/>
<jvmarg value="-Xmx256m"/>
<formatter type="plain"/>
<formatter type="xml"/>
<batchtest todir="${main.reports.test}">
<fileset dir="${main.src.test}">
<include name="**/${testpattern}.java"/>
<exclude name="**/All*Tests.java"/>
<exclude name="**/TestUnfixedBugs.java"/>
<exclude name="**/TestcaseRecordInputStream.java"/>
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
<delete file="${main.testokfile}"/>
<antcall target="-test-main-write-testfile"/>
</target>
<target name="-test-property-check" unless="testcase">
<echo message="Please use -Dtestcase=org.your.testcase to run a single test"/>
<fail/>
</target>
<target name="-test-main-write-testfile" unless="main.test.failed">
<echo file="${main.testokfile}" append="false" message="testok"/>
</target>
<target name="-test-ooxml-check">
<uptodate property="ooxml.test.notRequired" targetfile="${ooxml.testokfile}">
<srcfiles dir="${ooxml.src}"/>
<srcfiles dir="${ooxml.src.test}"/>
</uptodate>
</target>
<macrodef name="ooxml-test-runner" xmlns:jacoco="antlib:org.jacoco.ant">
<attribute name="classpath"/>
<attribute name="type"/>
<sequential>
<jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-@{type}.exec">
<junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}"
failureproperty="ooxml.test.failed">
<classpath refid="@{classpath}"/>
<syspropertyset refid="junit.properties"/>
<jvmarg value="${poi.test.locale}"/>
<jvmarg value="-ea"/>
<formatter type="plain"/>
<formatter type="xml"/>
<batchtest todir="${ooxml.reports.test}">
<fileset dir="${ooxml.src.test}">
<include name="**/${testpattern}.java"/>
<exclude name="**/TestUnfixedBugs.java"/>
<exclude name="**/All*Tests.java"/>
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
</sequential>
</macrodef>
<target name="test-ooxml" depends="compile-main,compile-ooxml,-test-ooxml-check,jacocotask" unless="ooxml.test.notRequired">
<ooxml-test-runner classpath="test.ooxml.classpath" type="ooxml"/>
<delete file="${ooxml.testokfile}"/>
<antcall target="-test-ooxml-write-testfile"/>
</target>
<target name="-test-ooxml-write-testfile" unless="ooxml.test.failed">
<echo file="${ooxml.testokfile}" append="false" message="testok"/>
</target>
<target name="compile-ooxml-lite" depends="compile-ooxml">
<property name="ooxml.lite-merged.dir" location="build/ooxml-lite-merged"/>
<mkdir dir="${ooxml.lite-merged.dir}"/>
<jar destfile="${ooxml.lite-merged.dir}/ooxml-lite-merged.jar">
<zipfileset includes="**/*" src="${ooxml.xsds.jar}"/>
<zipfileset includes="**/*" src="${ooxml.encryption.jar}"/>
</jar>
<java classname="org.apache.poi.util.OOXMLLite" fork="yes">
<classpath>
<pathelement path="${ooxml.lite-merged.dir}/ooxml-lite-merged.jar"/>
</classpath>
<classpath refid="test.ooxml.classpath"/>
<syspropertyset refid="junit.properties"/>
<jvmarg value="${poi.test.locale}"/>
<arg value="-ooxml"/>
<arg value="${ooxml.lite-merged.dir}/ooxml-lite-merged.jar"/>
<arg value="-test"/>
<arg value="${ooxml.output.test.dir}"/>
<arg value="-dest"/>
<arg value="${ooxml.lite.output.dir}"/>
</java>
</target>
<target name="test-ooxml-lite" depends="jacocotask">
<delete file="${ooxml.testokfile}"/>
<echo message="Running ooxml tests against 'poi-ooxml-schemas'"/>
<ooxml-test-runner classpath="ooxml-lite.classpath" type="ooxml-lite"/>
</target>
<target name="-check-docs">
<uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html">
<srcfiles dir="${main.documentation}" />
</uptodate>
</target>
<target name="-check-forrest-installed" unless="env.FORREST_HOME">
<echo>Please install Apache Forrest (see
&lt;http://forrest.apache.org/index.html&gt;) and set the
FORREST_HOME environment variable!
</echo>
<fail message="Apache Forrest is not installed."/>
</target>
<target name="docs" depends="init, -check-forrest-installed, -check-docs"
unless="main.docs.notRequired" description="Builds the POI website">
<mkdir dir="${build.site.src}/${main.documentation}"/>
<copy todir="${build.site.src}/${main.documentation}">
<fileset dir="${main.documentation}"/>
</copy>
<copy file="forrest.properties" tofile="${build.site.src}/forrest.properties"/>
<move
file="${build.site.src}/src/documentation/content/xdocs/status.xml"
tofile="${build.site.src}/status.xml"/>
<ant antfile="${env.FORREST_HOME}/forrest.antproxy.xml" target="site">
<property name="project.home" location="${build.site.src}"/>
</ant>
<echo>Broken links:</echo>
<echo file="${build.site}/../tmp/brokenlinks.txt"/>
<touch>
<fileset dir="${build.site}"/>
</touch>
</target>
<!-- Generates documentation and reports -->
<target name="site" depends="docs"
description="Generates POI's website's contents"/>
<!-- TODO to be done with assembly -->
<target name="assemble" depends="jar,jar-src">
<!-- jars to include in binary assemblies -->
<patternset id="bin.dist.jars">
<include name="${jar.name}-${version.id}-${DSTAMP}.jar"/>
<include name="${jar.name}-ooxml-${version.id}-${DSTAMP}.jar"/>
<include name="${jar.name}-examples-${version.id}-${DSTAMP}.jar"/>
<include name="${jar.name}-ooxml-schemas-${version.id}-${DSTAMP}.jar"/>
</patternset>
<!-- patterns to exclude from source assemblies -->
<patternset id="src.dist.patterns"
excludes="build/**,
maven/**,
lib/**,
ooxml-lib/**,
scripts/**,
TEST*,
*.ipr,
*.iml,
*.iws,
*.lnk,
*.rdf,
*.swp,
.settings/**,
.classpath,
.settings/**,
.project"/>
<property name="zipdir" value="${jar.name}-${version.id}"/>
<zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip">
<zipfileset dir="legal/" prefix="${zipdir}"/>
<zipfileset dir="${main.lib}" prefix="${zipdir}/lib">
<include name="commons-codec-*.jar"/>
<include name="commons-logging-*.jar"/>
<include name="junit-*.jar"/>
<include name="log4j-*.jar"/>
</zipfileset>
<zipfileset dir="${ooxml.lib}" prefix="${zipdir}/ooxml-lib">
<include name="dom4j-*.jar"/>
<include name="stax-api-*.jar"/>
<include name="xmlbeans-*.jar"/>
</zipfileset>
<zipfileset dir="${dist.dir}" prefix="${zipdir}">
<patternset refid="bin.dist.jars"/>
</zipfileset>
<zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
</zip>
<zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
<zipfileset dir="legal/" prefix="${zipdir}" />
<zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
<zipfileset dir="." prefix="${zipdir}">
<patternset refid="src.dist.patterns"/>
</zipfileset>
</zip>
<tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz"
longfile="gnu"
compression="gzip">
<tarfileset dir="legal/" prefix="${zipdir}"/>
<zipfileset dir="${main.lib}" prefix="${zipdir}/lib">
<include name="commons-codec-*.jar"/>
<include name="commons-logging-*.jar"/>
<include name="junit-*.jar"/>
<include name="log4j-*.jar"/>
</zipfileset>
<tarfileset dir="${ooxml.lib}" prefix="${zipdir}/ooxml-lib">
<include name="dom4j-*.jar"/>
<include name="stax-api-*.jar"/>
<include name="xmlbeans-*.jar"/>
</tarfileset>
<tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
<tarfileset dir="${dist.dir}" prefix="${zipdir}">
<patternset refid="bin.dist.jars"/>
</tarfileset>
</tar>
<tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz"
longfile="gnu"
compression="gzip">
<tarfileset dir="legal/" prefix="${zipdir}" />
<tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
<tarfileset dir="." prefix="${zipdir}">
<patternset refid="src.dist.patterns"/>
</tarfileset>
</tar>
<!-- script to create signatures and hashes -->
<copy file="maven/multisign.sh" todir="${dist.dir}"/>
<echo>Creating Maven POMs</echo>
<antcall target="maven-poms"/>
<echo>Distribution located in ${dist.dir}</echo>
<echo>Use ${dist.dir}/multisign.sh to create md5 checksums and GPG signatures</echo>
</target>
<target name="dist" depends="clean, compile-all, test-all, site, jar, assemble"
description="Creates the entire distribution into build/dist, from scratch">
</target>
<target name="gump" depends="compile-all, test-all, jar"/>
<target name="jenkins" depends="compile-all, test-all, jar, assemble, findbugs, rat-check"/>
<available property="maven.ant.tasks.present" classname="org.apache.maven.artifact.ant.Pom"/>
<target name="maven.ant.tasks-check">
<fail unless="maven.ant.tasks.present">
Maven ant tasks not found.
Please make sure the maven-ant-tasks jar is in ANT_HOME/lib, or made
available to Ant using other mechanisms like -lib or CLASSPATH.
You can download the Maven Ant Tasks from http://maven.apache.org/ant-tasks/download.html
</fail>
</target>
<macrodef name="m2-install">
<attribute name="artifactId"/>
<sequential>
<mvn:install file="${dist.dir}/@{artifactId}-${version.id}-${DSTAMP}.jar">
<pom file="${dist.dir}/@{artifactId}-${version.id}.pom"/>
</mvn:install>
</sequential>
</macrodef>
<!-- Runs Apache Rat against the source code, to spot any files -->
<!-- which are missing the correct license headers -->
<!-- You need to download rat from http://incubator.apache.org/rat/ -->
<!-- and place the Rat jar into your ant lib before running -->
<target name="rat-check" depends="check-jars,fetch-jars">
<mkdir dir="${rat.reportdir}" />
<typedef resource="org/apache/rat/anttasks/antlib.xml"
uri="antlib:org.apache.rat.anttasks"
classpath="${main.lib}/apache-rat-0.10.jar" />
<rat:report xmlns:rat="antlib:org.apache.rat.anttasks" reportFile="${rat.report}">
<fileset dir="src/">
<exclude name="documentation/content/xdocs/dtd/" />
<exclude name="documentation/content/xdocs/entity/" />
<exclude name="contrib/testcases/dummy.txt" />
<exclude name="examples/lib/dummy.txt" />
<exclude name="resources/ooxml/org/apache/poi/xslf/usermodel/presetShapeDefinitions.xml" />
<exclude name="examples/src/org/apache/poi/xslf/usermodel/pie-chart-data.txt" />
</fileset>
</rat:report>
<loadfile property="rat.reportcontent" srcFile="${rat.report}"/>
<echo>${rat.reportcontent}</echo>
<!-- fail the build if at least one note is in the report -->
<fail><condition><matches pattern="[1-9][0-9]* Unknown Licens" string="${rat.reportcontent}"/></condition></fail>
</target>
</project>