blob: 4a9f81773a36fa4cf868859e78f23daaf114810a [file] [log] [blame]
<?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.
-->
<!--
This build was tested with ant 1.9.4 although it will probably work with
other versions, however at least 1.8.0 is required.
updated to forrest 0.9:
To build the documentation you will need to install forrest and set
the FORREST_HOME environment variable.
Since POI 4.0 you will need JDK 1.8 or newer to build and run 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" ant test
-->
<project name="POI Build" default="help" basedir="."
xmlns:mvn="antlib:org.apache.maven.artifact.ant"
xmlns:openpgp="antlib:org.apache.commons.openpgp.ant"
xmlns:staging="antlib:org.sonatype.nexus.ant.staging"
xmlns:if="ant:if"
xmlns:unless="ant:unless">
<description>The Apache POI project Ant build.</description>
<property name="version.id" value="5.0.0-SNAPSHOT"/>
<property name="release.rc" value="RC1"/>
<property environment="env"/>
<!-- the repository to download jars from -->
<property name="repository.m2" value="https://repo1.maven.org/maven2"/>
<property name="repository.pentaho" value="https://nexus.pentaho.org/"/>
<property name="main.lib" location="${basedir}/lib/main"/>
<property name="main-tests.lib" location="${basedir}/lib/main-tests"/>
<property name="ooxml.lib" location="${basedir}/lib/ooxml"/>
<property name="ooxml-tests.lib" location="${basedir}/lib/ooxml-tests"/>
<property name="ooxml-provided.lib" location="${basedir}/lib/ooxml-provided"/>
<property name="util.lib" location="${basedir}/lib/util"/>
<!-- compiler options options -->
<property name="jdk.version.source" value="1.8" description="JDK version of source code"/>
<property name="jdk.version.class" value="1.8" description="JDK version of generated class files"/>
<property name="compile.debug" value="true"/>
<condition property="isIBMVM">
<contains string="${java.vendor}" substring="IBM" casesensitive="false"/>
</condition>
<condition property="isJava8">
<equals arg1="${ant.java.version}" arg2="1.8"/>
</condition>
<!-- add addOpens parameter for Java 9 and higher -->
<condition property="addOpens">
<not><matches pattern="^1\..*" string="${java.version}"/></not>
</condition>
<!-- add addOpens parameter for Java 10 -->
<condition property="addOpens10">
<matches pattern="^10\..*" string="${java.version}"/>
</condition>
<!--
Logging is suppressed by default.
To redirect log output to console, run ant with -Dorg.apache.poi.util.POILogger=org.apache.poi.util.SystemOutLogger
-->
<property name="org.apache.poi.util.POILogger" value="org.apache.poi.util.NullLogger"/>
<!-- issue warnings if source code contains unmappable characters for encoding ASCII -->
<property name="java.source.encoding" value="UTF-8"/>
<macrodef name="propertyreset">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<mkdir dir="build/poi-ant-contrib"/>
<javac srcdir="src/excelant/poi-ant-contrib" destdir="build/poi-ant-contrib" includeantruntime="true"/>
<taskdef name="PropertyResetHelper" classname="PropertyReset" classpath="build/poi-ant-contrib"/>
<PropertyResetHelper name="@{name}" value="@{value}" />
</sequential>
</macrodef>
<!--
JVM system properties for running tests,
user.language and user.country are required as we have locale-sensitive formatters
-->
<property name="testpattern" value="Test*"/> <!--note: this excludes BaseTest* -->
<property name="POI.testdata.path" location="test-data"/>
<property name="java.awt.headless" value="true"/>
<property name="java.locale.providers" value="JRE,CLDR"/>
<property name="additionaljar" value=""/>
<propertyreset name="user.language" value="en"/>
<propertyreset name="user.country" value="US"/>
<condition property="http_proxy" value="${env.http_proxy}" else="">
<isset property="env.http_proxy"/>
</condition>
<!-- Fix for strange woodstox references in gump build -->
<property name="javax.xml.stream.XMLInputFactory" value="com.sun.xml.internal.stream.XMLInputFactoryImpl"/>
<property name="tempdir" value="build/tmp"/>
<!-- 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"/>
<!-- Scratchpad: -->
<property name="scratchpad.resource1.dir" value="src/resources/scratchpad"/>
<property name="scratchpad.src" location="src/scratchpad/src"/>
<property name="scratchpad.src.test" location="src/scratchpad/testcases"/>
<property name="scratchpad.reports.test" location="build/scratchpad-test-results"/>
<property name="scratchpad.output.dir" location="build/scratchpad-classes"/>
<property name="scratchpad.output.test.dir" location="build/scratchpad-test-classes"/>
<property name="scratchpad.testokfile" location="build/scratchpad-testokfile.txt"/>
<!-- Scratchpad/Geometry -->
<property name="geometry.pkg" value="org.apache.poi.sl.draw.binding"/>
<property name="geometry.output.tmpdir" value="build/geometry-java"/>
<!-- 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.agent" location="lib/ooxml-tests/ooxml-lite-agent.jar"/>
<property name="ooxml.lite.report" location="build/ooxml-lite-report.txt"/>
<property name="ooxml.lite.jar" location="build/dist/maven/poi-ooxml-lite/poi-ooxml-lite-${version.id}.jar"/>
<property name="ooxml.lite.includes" value="^(com/microsoft/schemas|org/(etsi|openxmlformats|w3/)|org/apache/poi/schemas)"/>
<!-- Integration testing: -->
<property name="integration.src.test" location="src/integrationtest"/>
<property name="integration.reports.test" location="build/integration-test-results"/>
<property name="integration.output.test.dir" location="build/integration-test-classes"/>
<property name="integration.testokfile" location="build/integration-testokfile.txt"/>
<!-- Excelant: -->
<property name="excelant.resource.dir" value="src/excelant/resources"/>
<property name="excelant.src" location="src/excelant/java"/>
<property name="excelant.src.test" location="src/excelant/testcases"/>
<property name="excelant.reports.test" location="build/excelant-test-results"/>
<property name="excelant.output.dir" location="build/excelant-classes"/>
<property name="excelant.output.test.dir" location="build/excelant-test-classes"/>
<property name="excelant.testokfile" location="build/excelant-testokfile.txt"/>
<macrodef name="dependency">
<attribute name="prefix"/>
<attribute name="artifact"/>
<attribute name="usage"/>
<attribute name="packaging" default="jar"/>
<attribute name="repo" default="${repository.m2}"/>
<attribute name="snapshot" default=""/>
<attribute name="query" default=""/>
<attribute name="target" default=""/>
<attribute name="url" default=""/>
<sequential>
<local name="groupDir"/>
<loadresource property="groupDir">
<string>@{artifact}</string>
<filterchain>
<replaceregex pattern="([^:]+).*" replace="\1"/>
<replaceregex pattern="\." replace="/" flags="g"/>
</filterchain>
</loadresource>
<local name="artifactId"/>
<loadresource property="artifactId">
<string>@{artifact}</string>
<filterchain>
<replaceregex pattern="[^:]+:([^:]+).*" replace="\1"/>
</filterchain>
</loadresource>
<local name="versionDir"/>
<loadresource property="versionDir">
<string>@{artifact}</string>
<filterchain>
<replaceregex pattern="[^:]+:[^:]+:([^:]+).*" replace="\1"/>
</filterchain>
</loadresource>
<local name="classifier"/>
<loadresource property="classifier">
<string>@{artifact}</string>
<filterchain>
<replaceregex pattern="[^:]+:[^:]+:[^:]+:?([^:]*)" replace="\1"/>
<replaceregex pattern="(.+)" replace="-\1"/>
</filterchain>
</loadresource>
<property name="classifier" value=""/>
<local name="version"/>
<property name="version" value="${versionDir}" if:blank="@{snapshot}"/>
<property name="version" value="@{snapshot}"/>
<local name="usageDir"/>
<loadresource property="usageDir">
<string>@{usage}</string>
<filterchain>
<replaceregex pattern="^([^/])" replace="/lib/\1"/>
<prefixlines prefix="${basedir}"/>
</filterchain>
</loadresource>
<local name="jarName"/>
<property name="jarName" value="${artifactId}-${version}${classifier}.@{packaging}"/>
<!-- delete old versions -->
<delete failonerror="false">
<fileset dir="${usageDir}" excludes="${jarName}">
<filename regex="^${artifactId}-[0-9].*${classifier}\.@{packaging}"/>
</fileset>
</delete>
<local name="jarLoc"/>
<property name="jarLoc" value="${usageDir}/@{target}" unless:blank="@{target}"/>
<property name="jarLoc" value="${usageDir}/${jarName}"/>
<local name="urlLoc"/>
<property name="urlLoc" value="@{url}" unless:blank="@{url}"/>
<property name="urlLoc" value="@{repo}/${groupDir}/${artifactId}/${versionDir}/${jarName}@{query}"/>
<property name="@{prefix}.@{packaging}" value="${jarLoc}"/>
<property name="@{prefix}.url" value="${urlLoc}"/>
<!-- TODO: add library to a queue for downloading ... -->
</sequential>
</macrodef>
<!-- jars in the /lib directory, see the fetch-jars target-->
<dependency prefix="main.commons-logging" artifact="commons-logging:commons-logging:1.2" usage="main"/>
<dependency prefix="main.commons-codec" artifact="commons-codec:commons-codec:1.15" usage="main"/>
<dependency prefix="main.commons-collections4" artifact="org.apache.commons:commons-collections4:4.4" usage="main"/>
<dependency prefix="main.commons-math3" artifact="org.apache.commons:commons-math3:3.6.1" usage="main"/>
<dependency prefix="main.com.zaxxer" artifact="com.zaxxer:SparseBitSet:1.2" usage="main"/>
<dependency prefix="main.slf4j-api" artifact="org.slf4j:slf4j-api:1.7.30" usage="main"/>
<dependency prefix="main.junit" artifact="junit:junit:4.13.1" usage="main-tests"/>
<dependency prefix="main.jmh" artifact="org.openjdk.jmh:jmh-core:1.26" usage="main-tests"/>
<dependency prefix="main.jmhAnnotation" artifact="org.openjdk.jmh:jmh-generator-annprocess:1.26" usage="main-tests"/>
<dependency prefix="main.hamcrest" artifact="org.hamcrest:hamcrest:2.2" usage="main-tests"/>
<dependency prefix="main.xmlunit" artifact="org.xmlunit:xmlunit-core:2.8.0" usage="main-tests"/>
<dependency prefix="main.mockito" artifact="org.mockito:mockito-core:3.6.0" usage="main-tests"/>
<dependency prefix="main.byte-buddy" artifact="net.bytebuddy:byte-buddy:1.10.18" usage="main-tests"/>
<dependency prefix="main.byte-buddy-agent" artifact="net.bytebuddy:byte-buddy-agent:1.10.18" usage="main-tests"/>
<dependency prefix="main.objenesis" artifact="org.objenesis:objenesis:3.1" usage="main-tests"/>
<dependency prefix="main.slf4j-simple" artifact="org.slf4j:slf4j-api:1.7.30" usage="main-tests"/>
<dependency prefix="main.ant" artifact="org.apache.ant:ant:1.10.9" usage="excelant"/>
<dependency prefix="main.antlauncher" artifact="org.apache.ant:ant-launcher:1.10.9" usage="excelant"/>
<!-- xml signature libs - not part of the distribution -->
<dependency prefix="dsig.xmlsec" artifact="org.apache.santuario:xmlsec:2.2.0" usage="ooxml-provided"/>
<dependency prefix="dsig.bouncycastle-prov" artifact="org.bouncycastle:bcprov-jdk15on:1.67" usage="ooxml-provided"/>
<dependency prefix="dsig.bouncycastle-pkix" artifact="org.bouncycastle:bcpkix-jdk15on:1.67" usage="ooxml-provided"/>
<!-- only used for signing the release - not used with the ooxml signatures -->
<dependency prefix="dsig.bouncycastle-bcpg" artifact="org.bouncycastle:bcpg-jdk15on:1.67" usage="util"/>
<!-- svg/batik/pdf libs - not part of the distribution -->
<dependency prefix="svg.xml-apis-ext" artifact="xml-apis:xml-apis-ext:1.3.04" usage="ooxml-provided"/>
<dependency prefix="svg.xmlgraphics-commons" artifact="org.apache.xmlgraphics:xmlgraphics-commons:2.4" usage="ooxml-provided"/>
<dependency prefix="svg.batik-all" artifact="org.apache.xmlgraphics:batik-all:1.13" usage="ooxml-provided"/>
<dependency prefix="pdf.pdfbox" artifact="org.apache.pdfbox:pdfbox:2.0.21" usage="ooxml-provided"/>
<dependency prefix="pdf.fontbox" artifact="org.apache.pdfbox:fontbox:2.0.21" usage="ooxml-provided"/>
<dependency prefix="pdf.graphics2d" artifact="de.rototor.pdfbox:graphics2d:0.29" usage="ooxml-provided"/>
<!-- jars in the ooxml-lib directory, see the fetch-ooxml-jars target-->
<dependency prefix="ooxml.curvesapi" artifact="com.github.virtuald:curvesapi:1.06" usage="ooxml"/>
<dependency prefix="ooxml.xmlbeans" artifact="org.apache.xmlbeans:xmlbeans:4.0.0" usage="ooxml"/>
<dependency prefix="ooxml.commons-compress" artifact="org.apache.commons:commons-compress:1.20" usage="ooxml"/>
<!-- jars in the ooxml-test-lib directory, see the fetch-ooxml-jars target-->
<dependency prefix="ooxml.test.reflections" artifact="org.reflections:reflections:0.9.12" usage="ooxml-tests"/>
<dependency prefix="ooxml.test.guava" artifact="com.google.guava:guava:30.0-jre" usage="ooxml-tests"/>
<dependency prefix="ooxml.test.javassist" artifact="org.javassist:javassist:3.27.0-GA" usage="ooxml-tests"/>
<!-- coverage libs -->
<dependency prefix="jacoco" artifact="org.jacoco:jacoco:0.8.6" usage="util" packaging="zip"/>
<dependency prefix="asm" artifact="org.ow2.asm:asm:9.0" usage="util"/>
<dependency prefix="asm-commons" artifact="org.ow2.asm:asm-commons:9.0" usage="util"/>
<dependency prefix="asm-tree" artifact="org.ow2.asm:asm-tree:9.0" usage="util"/>
<!-- license and api checks -->
<dependency prefix="rat" artifact="org.apache.rat:apache-rat:0.13" usage="util"/>
<dependency prefix="forbidden" artifact="de.thetaphi:forbiddenapis:3.1" usage="util"/>
<property name="maven.ooxml.xsds.version.id" value="1.5"/>
<!-- See https://www.ecma-international.org/publications/standards/Ecma-376.htm -->
<!-- "Copy these file(s), free of charge" -->
<property name="ooxml.xsds.izip.1" value="${basedir}/src/ooxml/resources/org/apache/poi/schemas/OfficeOpenXML-XMLSchema-Transitional.zip"/>
<property name="ooxml.xsds.src.dir" location="build/ooxml-xsds-src"/>
<property name="ooxml.xsds.src.jar" location="build/dist/maven/poi-ooxml-full/poi-ooxml-full-${version.id}-sources.jar"/>
<property name="ooxml.xsds.jar" location="build/dist/maven/poi-ooxml-full/poi-ooxml-full-${version.id}.jar"/>
<!-- additional schemas are packed into the poi schemas jar, -->
<!-- so we don't have to care about a separate versioning of the original ooxml schemas -->
<property name="ooxml.xsds.izip.2" value="${basedir}/src/ooxml/resources/org/apache/poi/schemas/OpenPackagingConventions-XMLSchema.zip"/>
<property name="ooxml.security.src.dir" location="build/ooxml-security-src"/>
<property name="ooxml.security.xsd.dir" location="src/ooxml/resources/org/apache/poi/poifs/crypt"/>
<property name="ooxml.visio.xsd.dir" location="src/ooxml/resources/org/apache/poi/xdgf"/>
<property name="ooxml.schema.xsdconfig.dir" location="src/ooxml/resources/org/apache/poi/schemas"/>
<!-- 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.*:org.etsi.*:org.w3.*:org.slf4j.*:org.hamcrest.*:org.bouncycastle.*:org.apache.xmlbeans.*:org.apache.tools.*:org.apache.commons.*:org.apache.jcp.*:sun.*:schemaorg_apache_xmlbeans.*"/>
<property name="file.leak.detector" value="-Dthis.is.a.dummy=true"/>
<!-- 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/site"/>
<property name="javadocs.report.dir" location="${build.site}/apidocs/dev"/>
<property name="dist.dir" location="build/dist"/>
<property name="halt.on.test.failure" value="true"/>
<!-- helper jars for pgp signing, building and nexus staging -->
<dependency prefix="dist.commons-openpgp" artifact="org.apache.commons:commons-openpgp:1.0-SNAPSHOT" usage="util"
repo="https://repository.apache.org/content/groups/snapshots" snapshot="1.0-20190121.221905-12"/>
<dependency prefix="dist.nexus-staging" artifact="org.sonatype.nexus.ant:nexus-staging-ant-tasks:1.6.3:uber" usage="util"/>
<!-- jars required for maven helper targets -->
<dependency prefix="maven.ant" artifact="org.apache.maven:maven-ant-tasks:2.1.3" usage="util"/>
<!-- subclipse.tigris.org is gone - left-over is hosted at https://bintray.com/openmeetings/maven/org.tigris.subclipse.svnant -->
<!-- request will be forwarded to d29vzk4ow07wi7.cloudfront.net which is an Atlassian Marketplace instance -->
<dependency prefix="dist.svnant" artifact="org.tigris.subclipse:svnant:1.3.1" usage="util"
repo="https://dl.bintray.com/openmeetings/maven"/>
<!-- hosted at https://bintray.com/subclipse/maven/svnclientadapter - https://github.com/subclipse/svnclientadapter -->
<dependency prefix="dist.svnclientadapter-base" artifact="org.tigris.svnclientadapter:adapter-base:1.12.0" usage="util"
repo="https://dl.bintray.com/subclipse/maven"/>
<dependency prefix="dist.svnclientadapter-svnkit" artifact="org.tigris.svnclientadapter:adapter-svnkit:1.12.0" usage="util"
repo="https://dl.bintray.com/subclipse/maven"/>
<dependency prefix="dist.svnclientadapter-javahl" artifact="org.tigris.svnclientadapter:adapter-javahl:1.12.0" usage="util"
repo="https://dl.bintray.com/subclipse/maven"/>
<dependency prefix="dist.svnkit" artifact="org.tmatesoft.svnkit:svnkit:1.10.1" usage="util"/>
<dependency prefix="dist.svnkit-javahl16" artifact="org.tmatesoft.svnkit:svnkit-javahl16:1.10.1" usage="util"/>
<dependency prefix="dist.sqljet" artifact="org.tmatesoft.sqljet:sqljet:1.1.13" usage="util"/>
<dependency prefix="dist.antlr" artifact="org.antlr:antlr-runtime:3.5.2" usage="util"/>
<dependency prefix="dist.sequence-library" artifact="de.regnis.q.sequence:sequence-library:1.0.4" usage="util"/>
<propertyset id="junit.properties">
<propertyref name="POI.testdata.path"/>
<propertyref name="java.awt.headless"/>
<propertyref name="org.apache.poi.util.POILogger"/>
<propertyref name="http_proxy"/>
<propertyref name="additionaljar"/>
<propertyref name="user.language"/>
<propertyref name="user.country"/>
<propertyref name="javax.xml.stream.XMLInputFactory"/>
<propertyref name="org.apache.commons.logging.Log"/>
<!-- required for Java 9 compilation -->
<propertyref name="java.locale.providers"/>
<!-- to detect if we are running on slow Gump VM -->
<propertyref name="version.id"/>
<propertyref name="scratchpad.ignore"/>
</propertyset>
<path id="main.classpath">
<pathelement location="${main.commons-logging.jar}"/>
<pathelement location="${main.commons-codec.jar}"/>
<pathelement location="${main.commons-collections4.jar}"/>
<pathelement location="${main.commons-math3.jar}"/>
<pathelement location="${main.com.zaxxer.jar}"/>
</path>
<!-- some libraries should only be required for compiling/running tests -->
<path id="test.jar.classpath">
<pathelement location="${main.junit.jar}"/>
<pathelement location="${main.jmh.jar}"/>
<pathelement location="${main.jmhAnnotation.jar}"/>
<pathelement location="${main.hamcrest.jar}"/>
<pathelement location="${main.xmlunit.jar}"/>
<pathelement location="${main.mockito.jar}"/>
<pathelement location="${main.byte-buddy.jar}"/>
<pathelement location="${main.byte-buddy-agent.jar}"/>
<pathelement location="${main.objenesis.jar}"/>
<pathelement location="${main.slf4j-simple.jar}"/>
</path>
<path id="scratchpad.classpath">
<path refid="main.classpath"/>
<pathelement location="${main.output.dir}"/>
</path>
<path id="ooxml.xmlsec.classpath">
<pathelement location="${dsig.xmlsec.jar}"/>
<pathelement location="${dsig.bouncycastle-prov.jar}"/>
<pathelement location="${dsig.bouncycastle-pkix.jar}"/>
</path>
<path id="ooxml.base.classpath">
<pathelement location="${ooxml.curvesapi.jar}"/>
<pathelement location="${ooxml.xmlbeans.jar}"/>
<pathelement location="${ooxml.commons-compress.jar}"/>
<path refid="main.classpath"/>
<pathelement location="${main.output.dir}"/>
<pathelement location="${ooxml.test.guava.jar}"/>
<!-- classes are omitted on test cases outside the xml-dsign area to avoid classpath poisioning -->
<!--path refid="ooxml.xmlsec.classpath"/-->
<!-- Used only for ExtractorFactory, see #57963 -->
<pathelement location="${scratchpad.output.dir}" unless:true="${scratchpad.ignore}"/>
</path>
<path id="batik.classpath">
<pathelement location="${svg.batik-all.jar}"/>
<pathelement location="${svg.xml-apis-ext.jar}"/>
<pathelement location="${svg.xmlgraphics-commons.jar}"/>
</path>
<path id="pdfbox.classpath">
<pathelement location="${pdf.pdfbox.jar}"/>
<pathelement location="${pdf.fontbox.jar}"/>
<pathelement location="${pdf.graphics2d.jar}"/>
</path>
<path id="ooxml.classpath">
<pathelement location="${ooxml.xsds.jar}"/>
<path refid="ooxml.base.classpath"/>
<path refid="batik.classpath"/>
<path refid="pdfbox.classpath"/>
</path>
<path id="ooxml.lite.verify.classpath">
<pathelement location="build/dist/maven/poi-ooxml-lite/poi-ooxml-lite-${version.id}.jar"/>
<path refid="ooxml.base.classpath"/>
</path>
<path id="test.ooxml.reflections.classpath">
<pathelement location="${ooxml.test.reflections.jar}"/>
<pathelement location="${ooxml.test.guava.jar}"/>
<pathelement location="${ooxml.test.javassist.jar}"/>
</path>
<path id="test.ooxml.lite.verify.classpath">
<path refid="ooxml.lite.verify.classpath"/>
<path refid="ooxml.xmlsec.classpath"/>
<path refid="test.jar.classpath"/>
<pathelement location="${ooxml.output.dir}"/>
<pathelement location="${ooxml.output.test.dir}"/>
<pathelement location="${main.output.test.dir}"/>
<pathelement location="${additionaljar}"/>
</path>
<path id="examples.classpath">
<path refid="main.classpath"/>
<pathelement location="${main.output.dir}"/>
<pathelement location="${scratchpad.output.dir}" unless:true="${scratchpad.ignore}"/>
</path>
<path id="excelant.classpath">
<path refid="ooxml.classpath"/>
<pathelement location="${main.ant.jar}"/>
<pathelement location="${ooxml.output.dir}"/>
</path>
<path id="javadoc.classpath">
<path refid="main.classpath"/>
<path refid="scratchpad.classpath"/>
<path refid="ooxml.classpath"/>
<path refid="ooxml.xmlsec.classpath"/>
<path refid="test.jar.classpath"/>
<path path="${env.CLASSPATH}"/>
</path>
<patternset id="exclude-scratchpad-test">
<exclude name="**/TestExtractorFactory.java"/>
<exclude name="**/TestEmbedOLEPackage.java"/>
<exclude name="**/TestHxxFEncryption.java"/>
</patternset>
<!-- 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}/${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 and scratchpad
- test Run all unit tests from main, ooxml and scratchpad
- jar Produce jar files
- assemble Produce the zipped distribution 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" description="Initialization run before other targets.">
<mkdir dir="build"/>
<mkdir dir="${main.output.dir}"/>
<mkdir dir="${main.output.test.dir}"/>
<mkdir dir="${main.reports.test}"/>
<mkdir dir="${scratchpad.output.dir}"/>
<mkdir dir="${scratchpad.output.test.dir}"/>
<mkdir dir="${scratchpad.reports.test}"/>
<mkdir dir="${geometry.output.tmpdir}"/>
<mkdir dir="${ooxml.output.dir}"/>
<mkdir dir="${ooxml.output.test.dir}"/>
<mkdir dir="${ooxml.reports.test}"/>
<mkdir dir="${excelant.output.dir}"/>
<mkdir dir="${excelant.output.test.dir}"/>
<mkdir dir="${excelant.reports.test}"/>
<mkdir dir="${examples.output.dir}"/>
<mkdir dir="${integration.output.test.dir}"/>
<mkdir dir="${integration.reports.test}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${build.site}"/>
<echo message="Using Ant: ${ant.version} from ${ant.home}, Ant detected Java ${ant.java.version} (may be different than actual Java sometimes...)" />
<echo message="Using Java: ${java.version}/${java.runtime.version}/${java.vm.version}/${java.vm.name} from ${java.vm.vendor} on ${os.name}: ${os.version}" />
<echo message="Building Apache POI version ${version.id} and RC: ${release.rc}" />
<loadresource property="RELEASE_TAG">
<string>REL_${version.id}</string>
<filterchain>
<replaceregex pattern="\W" replace="_" flags="g"/>
</filterchain>
</loadresource>
</target>
<target name="clean" description="Remove generated artefacts">
<delete dir="build"/>
<delete includeemptydirs="true">
<fileset dir="sonar">
<include name="*/target/**"/>
<include name="*/build/**"/>
<include name="*/src/**"/>
</fileset>
</delete>
</target>
<macrodef name="downloadfile">
<attribute name="src"/>
<attribute name="dest"/>
<sequential>
<local name="destdir"/>
<dirname property="destdir" file="@{dest}"/>
<mkdir dir="${destdir}"/>
<get src="@{src}" dest="@{dest}" skipexisting="true"/>
</sequential>
</macrodef>
<target name="check-jars">
<!-- remove previous versions of third-party jars to prevent them from lingering around,
we often had hard-to-find build/CI-problems because of these! -->
<mkdir dir="${main.lib}"/>
<mkdir dir="${ooxml.lib}"/>
<mkdir dir="${ooxml-tests.lib}"/>
<!-- remove jars from previous versions, but not the current version -->
<delete dir="compile-lib" failonerror="false"/>
<delete dir="ooxml-lib" failonerror="false"/>
<delete dir="ooxml-testlib" failonerror="false"/>
<delete verbose="true" failonerror="false">
<fileset dir="${basedir}/lib" includes="*.jar"/>
<fileset dir="${basedir}/lib/excelant">
<include name="ant*-1.10.1.jar"/>
</fileset>
<fileset dir="${basedir}/lib/main">
<include name="log4j-1.2*.jar"/>
</fileset>
<fileset dir="${basedir}/lib/main-tests">
<include name="mockito-core-3.2*.jar"/>
<include name="mockito-core-3.5*.jar"/>
<include name="hamcrest-core*"/>
</fileset>
<fileset dir="${basedir}/lib/ooxml">
<include name="xmlbeans-3.1.0.jar"/>
</fileset>
<fileset dir="${basedir}/lib/ooxml-provided">
<include name="bcpkix-jdk15on-1.65.jar"/>
<include name="bcpkix-jdk15on-1.66.jar"/>
<include name="bcprov-ext-jdk15on-1.65.jar"/>
<include name="bcprov-ext-jdk15on-1.66.jar"/>
</fileset>
<fileset dir="${basedir}/lib/ooxml-tests">
<include name="guava-20.0.jar"/>
</fileset>
<fileset dir="${basedir}/lib/util">
<include name="asm*7.2.jar"/>
</fileset>
<fileset dir="${basedir}/lib/util">
<include name="jacoco-0.8.5.zip"/>
</fileset>
<fileset dir="${basedir}/lib/excelant">
<include name="ant*1.10.1.jar"/>
</fileset>
</delete>
<condition property="jars.present">
<or>
<and>
<available file="${main.commons-logging.jar}"/>
<available file="${main.commons-codec.jar}"/>
<available file="${main.junit.jar}"/>
<available file="${main.jmh.jar}"/>
<available file="${main.jmhAnnotation.jar}"/>
<available file="${main.hamcrest.jar}"/>
<available file="${main.xmlunit.jar}"/>
<available file="${main.mockito.jar}"/>
<available file="${main.byte-buddy.jar}"/>
<available file="${main.byte-buddy-agent.jar}"/>
<available file="${main.objenesis.jar}"/>
<available file="${main.ant.jar}"/>
<available file="${main.antlauncher.jar}"/>
<available file="${main.slf4j-api.jar}"/>
<available file="${main.slf4j-simple.jar}"/>
<available file="${asm.jar}"/>
<available file="${asm-commons.jar}"/>
<available file="${asm-tree.jar}"/>
<available file="${jacoco.zip}"/>
<available file="${rat.jar}"/>
<available file="${forbidden.jar}"/>
<available file="${dsig.bouncycastle-prov.jar}"/>
<available file="${dsig.bouncycastle-pkix.jar}"/>
<available file="${dsig.xmlsec.jar}"/>
<available file="${main.commons-collections4.jar}"/>
<available file="${main.commons-math3.jar}"/>
<available file="${main.com.zaxxer.jar}"/>
<!-- we had some CI failures when the extracted files for JaCoCo were missing somehow... -->
<available file="${util.lib}/jacocoagent.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}"/>
<downloadfile src="${main.commons-logging.url}" dest="${main.commons-logging.jar}"/>
<downloadfile src="${main.commons-codec.url}" dest="${main.commons-codec.jar}"/>
<downloadfile src="${main.junit.url}" dest="${main.junit.jar}"/>
<downloadfile src="${main.jmh.url}" dest="${main.jmh.jar}"/>
<downloadfile src="${main.jmhAnnotation.url}" dest="${main.jmhAnnotation.jar}"/>
<downloadfile src="${main.hamcrest.url}" dest="${main.hamcrest.jar}"/>
<downloadfile src="${main.xmlunit.url}" dest="${main.xmlunit.jar}"/>
<downloadfile src="${main.mockito.url}" dest="${main.mockito.jar}"/>
<downloadfile src="${main.byte-buddy.url}" dest="${main.byte-buddy.jar}"/>
<downloadfile src="${main.byte-buddy-agent.url}" dest="${main.byte-buddy-agent.jar}"/>
<downloadfile src="${main.objenesis.url}" dest="${main.objenesis.jar}"/>
<downloadfile src="${main.ant.url}" dest="${main.ant.jar}"/>
<downloadfile src="${main.antlauncher.url}" dest="${main.antlauncher.jar}"/>
<downloadfile src="${main.slf4j-api.url}" dest="${main.slf4j-api.jar}"/>
<downloadfile src="${main.slf4j-simple.url}" dest="${main.slf4j-simple.jar}"/>
<downloadfile src="${asm.url}" dest="${asm.jar}"/>
<downloadfile src="${asm-commons.url}" dest="${asm-commons.jar}"/>
<downloadfile src="${asm-tree.url}" dest="${asm-tree.jar}"/>
<downloadfile src="${jacoco.url}" dest="${jacoco.zip}"/>
<downloadfile src="${main.commons-collections4.url}" dest="${main.commons-collections4.jar}"/>
<downloadfile src="${main.commons-math3.url}" dest="${main.commons-math3.jar}"/>
<downloadfile src="${main.com.zaxxer.url}" dest="${main.com.zaxxer.jar}"/>
<unzip src="${jacoco.zip}" dest="${util.lib}">
<patternset>
<include name="lib/*.jar"/>
</patternset>
<mapper type="flatten"/>
</unzip>
<downloadfile src="${rat.url}" dest="${rat.jar}"/>
<downloadfile src="${forbidden.url}" dest="${forbidden.jar}"/>
<downloadfile src="${dsig.bouncycastle-prov.url}" dest="${dsig.bouncycastle-prov.jar}"/>
<downloadfile src="${dsig.bouncycastle-pkix.url}" dest="${dsig.bouncycastle-pkix.jar}"/>
<downloadfile src="${dsig.xmlsec.url}" dest="${dsig.xmlsec.jar}"/>
</target>
<target name="check-ooxml-jars">
<condition property="ooxml.jars.present">
<or>
<and>
<available file="${ooxml.curvesapi.jar}"/>
<available file="${ooxml.xmlbeans.jar}"/>
<available file="${ooxml.commons-compress.jar}"/>
<available file="${ooxml.test.reflections.jar}"/>
<available file="${ooxml.test.guava.jar}"/>
<available file="${ooxml.test.javassist.jar}"/>
<available file="${svg.xml-apis-ext.jar}"/>
<available file="${svg.batik-all.jar}"/>
<available file="${svg.xmlgraphics-commons.jar}"/>
<available file="${pdf.pdfbox.jar}"/>
<available file="${pdf.fontbox.jar}"/>
<available file="${pdf.graphics2d.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}"/>
<mkdir dir="${ooxml-tests.lib}"/>
<downloadfile src="${ooxml.curvesapi.url}" dest="${ooxml.curvesapi.jar}"/>
<downloadfile src="${ooxml.xmlbeans.url}" dest="${ooxml.xmlbeans.jar}"/>
<downloadfile src="${ooxml.commons-compress.url}" dest="${ooxml.commons-compress.jar}"/>
<downloadfile src="${ooxml.test.reflections.url}" dest="${ooxml.test.reflections.jar}"/>
<downloadfile src="${ooxml.test.guava.url}" dest="${ooxml.test.guava.jar}"/>
<downloadfile src="${ooxml.test.javassist.url}" dest="${ooxml.test.javassist.jar}"/>
<downloadfile src="${svg.batik-all.url}" dest="${svg.batik-all.jar}"/>
<downloadfile src="${svg.xml-apis-ext.url}" dest="${svg.xml-apis-ext.jar}"/>
<downloadfile src="${svg.xmlgraphics-commons.url}" dest="${svg.xmlgraphics-commons.jar}"/>
<downloadfile src="${pdf.pdfbox.url}" dest="${pdf.pdfbox.jar}"/>
<downloadfile src="${pdf.fontbox.url}" dest="${pdf.fontbox.jar}"/>
<downloadfile src="${pdf.graphics2d.url}" dest="${pdf.graphics2d.jar}"/>
</target>
<target name="check-svn-jars">
<condition property="svn.jars.present">
<or>
<and>
<available file="${dist.svnant.jar}"/>
<available file="${dist.svnclientadapter-base.jar}"/>
<available file="${dist.svnclientadapter-svnkit.jar}"/>
<available file="${dist.svnclientadapter-javahl.jar}"/>
<available file="${dist.svnkit.jar}"/>
<available file="${dist.svnkit-javahl16.jar}"/>
<available file="${dist.sqljet.jar}"/>
<available file="${dist.antlr.jar}"/>
<available file="${dist.sequence-library.jar}"/>
</and>
<isset property="disconnected"/>
</or>
</condition>
</target>
<target name="fetch-svn-jars" depends="check-svn-jars" unless="svn.jars.present">
<downloadfile src="${dist.svnant.url}" dest="${dist.svnant.jar}"/>
<downloadfile src="${dist.svnclientadapter-base.url}" dest="${dist.svnclientadapter-base.jar}"/>
<downloadfile src="${dist.svnclientadapter-svnkit.url}" dest="${dist.svnclientadapter-svnkit.jar}"/>
<downloadfile src="${dist.svnclientadapter-javahl.url}" dest="${dist.svnclientadapter-javahl.jar}"/>
<downloadfile src="${dist.svnkit.url}" dest="${dist.svnkit.jar}"/>
<downloadfile src="${dist.svnkit-javahl16.url}" dest="${dist.svnkit-javahl16.jar}"/>
<downloadfile src="${dist.sqljet.url}" dest="${dist.sqljet.jar}"/>
<downloadfile src="${dist.antlr.url}" dest="${dist.antlr.jar}"/>
<downloadfile src="${dist.sequence-library.url}" dest="${dist.sequence-library.jar}"/>
</target>
<target name="check-compiled-ooxml-xsds">
<condition property="ooxml-compiled-xsds.present">
<and>
<available file="${ooxml.xsds.jar}"/>
<available file="${ooxml.xsds.src.jar}"/>
</and>
</condition>
</target>
<target name="compile-ooxml-xsds"
depends="init,check-compiled-ooxml-xsds"
unless="ooxml-compiled-xsds.present"
description="Unpacks the OOXML xsd files, and compiles them into XmlBeans">
<local name="ooxml.memory"/>
<!-- 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="1536m" else="1024m">
<equals arg1="${sun.arch.data.model}" arg2="64" />
</condition>
<local name="xmlbean.xsds.dir"/>
<property name="xmlbean.xsds.dir" location="build/xmlbean-xsds"/>
<mkdir dir="${xmlbean.xsds.dir}"/>
<copy todir="${xmlbean.xsds.dir}">
<zipfileset src="${ooxml.xsds.izip.1}"/>
<fileset dir="${ooxml.visio.xsd.dir}"/>
<fileset dir="${ooxml.schema.xsdconfig.dir}" includes="ooxmlSchemas.xsdconfig,markup-compatibility.xsd,vmlDrawing.xsd"/>
<zipfileset src="${ooxml.xsds.izip.2}" includes="opc-digSig.xsd,opc-relationships.xsd"/>
<fileset dir="${ooxml.security.xsd.dir}" includes="signatureInfo.xsd"/>
<fileset dir="${ooxml.schema.xsdconfig.dir}" includes="XAdES*.xsd,*.xsdconfig,xmldsig*.xsd"/>
</copy>
<local name="xmlbean.sources.dir"/>
<local name="xmlbean.classes.dir"/>
<property name="xmlbean.sources.dir" location="build/xmlbean-sources"/>
<property name="xmlbean.classes.dir" location="build/xmlbean-classes"/>
<mkdir dir="${xmlbean.sources.dir}"/>
<mkdir dir="${xmlbean.classes.dir}"/>
<taskdef name="xmlbean"
classname="org.apache.xmlbeans.impl.tool.XMLBean"
classpath="${ooxml.xmlbeans.jar}"/>
<xmlbean
schema="${xmlbean.xsds.dir}"
srcgendir="${xmlbean.sources.dir}"
classgendir="${xmlbean.classes.dir}"
destfile="${xmlbean.xsds.dir}.jar"
srconly="true"
failonerror="true"
fork="true"
memoryMaximumSize="${ooxml.memory}"
typesystemname="ooxml"
repackage="org.apache.xmlbeans.metadata:org.apache.poi.schemas.ooxml">
<classpath>
<path location="${ooxml.xmlbeans.jar}"/>
</classpath>
</xmlbean>
<javac release="8"
target="${jdk.version.class}"
source="${jdk.version.source}"
srcdir="${xmlbean.sources.dir}"
destdir="${xmlbean.classes.dir}"
encoding="${java.source.encoding}"
fork="yes"
debug="${compile.debug}"
memoryMaximumSize="${ooxml.memory}"
includeantruntime="false">
<classpath refid="ooxml.classpath"/>
</javac>
<javac release="9"
srcdir="${basedir}/src/multimodule/ooxml-full/java9"
destdir="${basedir}/src/multimodule/ooxml-full/java9"
includeantruntime="false"
fork="true"
modulepath="lib/ooxml"
unless:true="${isJava8}">
<compilerarg line="--patch-module org.apache.poi.ooxml.schemas=${xmlbean.classes.dir}"/>
</javac>
<mkdir dir="build/dist/maven/poi-ooxml-full"/>
<jar destfile="${ooxml.xsds.jar}">
<fileset dir="${xmlbean.classes.dir}"/>
<zipfileset dir="${basedir}/src/multimodule/ooxml-full/java9" prefix="META-INF/versions/9" excludes="*.java"/>
<metainf dir="legal/"/>
<manifest>
<attribute name="Multi-Release" value="true"/>
<attribute name="Automatic-Module-Name" value="org.apache.poi.ooxml.schemas"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Title" value="Apache POI OOXML Schemas"/>
<attribute name="Specification-Version" value="${maven.ooxml.xsds.version.id}"/>
<attribute name="Specification-Vendor" value="The Apache Software Foundation"/>
<attribute name="Implementation-Title" value="Apache POI OOXML Schemas"/>
<attribute name="Implementation-Version" value="${version.id}"/>
<attribute name="Implementation-Vendor-Id" value="org.apache.poi"/>
<attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
</manifest>
</jar>
<jar destfile="${ooxml.xsds.src.jar}">
<fileset dir="${xmlbean.sources.dir}"/>
<zipfileset dir="${basedir}/src/multimodule/ooxml-full/java9" prefix="META-INF/versions/9/" excludes="*.class"/>
<metainf dir="legal"/>
</jar>
</target>
<target name="compile" depends="init, compile-main,
compile-scratchpad, compile-examples, compile-excelant"
description="Compiles the POI main classes, scratchpad and examples"/>
<macrodef name="compile-jar">
<attribute name="module"/>
<attribute name="java"/>
<attribute name="classes"/>
<attribute name="test" default=""/>
<attribute name="test-classes" default=""/>
<attribute name="version" default="${version.id}"/>
<element name="lib"/>
<element name="resources" optional="true"/>
<element name="test-resources" optional="true"/>
<sequential>
<local name="cp_java"/>
<pathconvert property="cp_java" pathsep=",">
<path><lib/></path>
<filtermapper>
<replacestring from="${basedir}" to=""/>
<replaceregex pattern="^." replace=""/>
<suffixlines suffix="${file.separator}*.jar"/>
</filtermapper>
</pathconvert>
<local name="maven-name"/>
<loadresource property="maven-name">
<string>@{module}</string>
<filterchain>
<prefixlines prefix="poi-"/>
<replacestring from="poi-poi" to="poi"/>
</filterchain>
</loadresource>
<!-- compile the sources -->
<javac release="8"
target="${jdk.version.class}"
source="${jdk.version.source}"
destdir="@{classes}"
srcdir="@{java}"
debug="${compile.debug}"
encoding="${java.source.encoding}"
fork="yes"
includeantruntime="false">
<classpath>
<fileset dir="${basedir}" includes="${cp_java}"/>
</classpath>
</javac>
<!-- compile jigsaw files to sources, so we don't forget to update/provide them for Java 8 builds -->
<javac release="9"
srcdir="${basedir}/src/multimodule/@{module}/java9"
destdir="${basedir}/src/multimodule/@{module}/java9"
includeantruntime="false"
fork="true"
unless:true="${isJava8}">
<compilerarg line="--patch-module org.apache.poi.@{module}=@{classes}"/>
<modulepath>
<lib/>
</modulepath>
</javac>
<mkdir dir="build/dist/maven/${maven-name}"/>
<!-- create classes jar -->
<jar destfile="build/dist/maven/${maven-name}/${maven-name}-@{version}.jar">
<fileset dir="@{classes}"/>
<resources/>
<zipfileset dir="${basedir}/src/multimodule/@{module}/java9"
prefix="META-INF/versions/9"
excludes="*.java"/>
<metainf dir="legal/"/>
<manifest>
<attribute name="Multi-Release" value="true"/>
<attribute name="Automatic-Module-Name" value="org.apache.poi.@{module}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Title" value="Apache POI"/>
<attribute name="Specification-Version" value="${version.id}"/>
<attribute name="Specification-Vendor" value="The Apache Software Foundation"/>
<attribute name="Implementation-Title" value="Apache POI"/>
<attribute name="Implementation-Version" value="${version.id}"/>
<attribute name="Implementation-Vendor-Id" value="org.apache.poi"/>
<attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
</manifest>
</jar>
<!-- compile the tests -->
<javac release="8"
target="${jdk.version.class}"
source="${jdk.version.source}"
destdir="@{test-classes}"
srcdir="@{test}"
debug="${compile.debug}"
encoding="${java.source.encoding}"
fork="yes"
includeantruntime="false" unless:blank="@{test}">
<classpath>
<fileset dir="${basedir}" includes="${cp_java}"/>
<pathelement path="build/dist/maven/${maven-name}/${maven-name}-@{version}.jar"/>
</classpath>
</javac>
<!-- again, generate jigsaw files to sources ... -->
<local name="merged"/>
<pathconvert property="merged">
<path location="@{classes}"/>
<path location="@{test-classes}"/>
</pathconvert>
<javac release="9"
srcdir="${basedir}/src/multimodule/@{module}/test9"
destdir="${basedir}/src/multimodule/@{module}/test9"
includeantruntime="false"
fork="true"
unless:true="${isJava8}" unless:blank="@{test}">
<compilerarg line="--patch-module org.apache.poi.@{module}=${merged}"/>
<modulepath>
<lib/>
</modulepath>
</javac>
<!-- create test classes jar - using the module-info of the tests -->
<jar destfile="build/dist/maven/${maven-name}-tests/${maven-name}-@{version}-tests.jar" unless:blank="@{test}">
<fileset dir="@{classes}"/>
<fileset dir="@{test-classes}">
<exclude name="org/apache/poi/ooxml/lite/**"/>
</fileset>
<resources/>
<test-resources/>
<zipfileset dir="${basedir}/src/multimodule/@{module}/test9" prefix="META-INF/versions/9" excludes="*.java"/>
<metainf dir="legal/"/>
<manifest>
<attribute name="Multi-Release" value="true"/>
<attribute name="Automatic-Module-Name" value="org.apache.poi.@{module}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Title" value="Apache POI"/>
<attribute name="Specification-Version" value="${version.id}"/>
<attribute name="Specification-Vendor" value="The Apache Software Foundation"/>
<attribute name="Implementation-Title" value="Apache POI"/>
<attribute name="Implementation-Version" value="${version.id}"/>
<attribute name="Implementation-Vendor-Id" value="org.apache.poi"/>
<attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
</manifest>
</jar>
<!-- create the sources jar -->
<jar destfile="build/dist/maven/${maven-name}/${maven-name}-@{version}-sources.jar">
<fileset dir="@{java}"/>
<metainf dir="legal/"/>
<!-- <resources/>-->
<!-- <zipfileset dir="src/multimodule/@{module}/java9" prefix="META-INF/versions/9" excludes="*.class"/>-->
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Title" value="Apache POI"/>
<attribute name="Specification-Version" value="${version.id}"/>
<attribute name="Specification-Vendor" value="The Apache Software Foundation"/>
<attribute name="Implementation-Title" value="Apache POI"/>
<attribute name="Implementation-Version" value="${version.id}"/>
<attribute name="Implementation-Vendor-Id" value="org.apache.poi"/>
<attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
</manifest>
</jar>
</sequential>
</macrodef>
<target name="compile-main" depends="init, compile-version">
<compile-jar module="poi"
java="${main.src}" classes="${main.output.dir}"
test="${main.src.test}" test-classes="${main.output.test.dir}">
<lib>
<pathelement path="lib/main"/>
<pathelement path="lib/main-tests"/>
</lib>
<resources>
<fileset dir="${main.resource1.dir}"/>
</resources>
</compile-jar>
</target>
<target name="compile-scratchpad" depends="compile-main">
<compile-jar module="scratchpad"
java="${scratchpad.src}" classes="${scratchpad.output.dir}"
test="${scratchpad.src.test}" test-classes="${scratchpad.output.test.dir}">
<lib>
<pathelement path="build/dist/maven/poi-tests"/>
<pathelement path="lib/main"/>
<pathelement path="lib/main-tests"/>
</lib>
<resources>
<fileset dir="${scratchpad.resource1.dir}"/>
</resources>
</compile-jar>
</target>
<target name="compile-examples" depends="compile-main,compile-scratchpad,compile-ooxml">
<compile-jar module="examples"
java="${examples.src}" classes="${examples.output.dir}">
<lib>
<pathelement path="build/dist/maven/poi-ooxml-full"/>
<pathelement path="build/dist/maven/poi-tests"/>
<pathelement path="build/dist/maven/poi-scratchpad-tests"/>
<pathelement path="build/dist/maven/poi-ooxml-tests"/>
<pathelement path="lib/main"/>
<pathelement path="lib/ooxml"/>
</lib>
</compile-jar>
</target>
<target name="compile-ooxml" depends="compile-main,compile-scratchpad,compile-ooxml-xsds">
<compile-jar module="ooxml"
java="${ooxml.src}" classes="${ooxml.output.dir}"
test="${ooxml.src.test}" test-classes="${ooxml.output.test.dir}">
<lib>
<pathelement path="build/dist/maven/poi-tests"/>
<pathelement path="build/dist/maven/poi-scratchpad-tests"/>
<pathelement path="build/dist/maven/poi-ooxml-full"/>
<pathelement path="lib/main"/>
<pathelement path="lib/main-tests"/>
<pathelement path="lib/ooxml"/>
<pathelement path="lib/ooxml-provided"/>
<pathelement path="lib/ooxml-tests"/>
</lib>
<resources>
<fileset dir="${ooxml.resource1.dir}"/>
</resources>
</compile-jar>
<!-- create ooxml-lite-agent jar -->
<javac release="9"
srcdir="${basedir}/src/multimodule/ooxml-lite-agent/java9"
destdir="${basedir}/src/multimodule/ooxml-lite-agent/java9"
includeantruntime="false"
fork="true"
unless:true="${isJava8}">
<compilerarg line="--patch-module org.apache.poi.ooxml_lite=${ooxml.output.test.dir}"/>
</javac>
<jar destfile="${ooxml.lite.agent}">
<fileset dir="${ooxml.output.test.dir}" includes="org/apache/poi/ooxml/lite/**"/>
<zipfileset dir="${basedir}/src/multimodule/ooxml-lite-agent/java9" prefix="META-INF/versions/9" excludes="*.java"/>
<manifest>
<attribute name="Multi-Release" value="true"/>
<attribute name="Automatic-Module-Name" value="org.apache.poi.ooxml_lite"/>
<attribute name="Premain-Class" value="org.apache.poi.ooxml.lite.OOXMLLiteAgent"/>
</manifest>
</jar>
</target>
<macrodef name="poiunit" xmlns:jacoco="antlib:org.jacoco.ant">
<attribute name="failureproperty"/>
<attribute name="heap" default="512"/>
<attribute name="showoutput" default="false"/>
<attribute name="jacocodest" default="build/jacoco-dest.exec"/>
<attribute name="modulepath-ref"/>
<element name="elements" implicit="true"/>
<sequential>
<local name="no.jit.sherlock"/>
<!-- see http://www-01.ibm.com/support/docview.wss?uid=swg21294023 on how to determine the method strings -->
<loadresource property="no.jit.sherlock">
<string>
sun/java2d/pipe/AAShapePipe.renderTiles(Lsun/java2d/SunGraphics2D;Ljava/awt/Shape;Lsun/java2d/pipe/AATileGenerator;[I)V
sun/java2d/pipe/AlphaPaintPipe.renderPathTile(Ljava/lang/Object;[BIIIIII)V
java/awt/TexturePaintContext.getRaster(IIII)Ljava/awt/image/Raster;
</string>
<filterchain>
<trim/>
<ignoreblank/>
<prefixlines prefix=",exclude={"/>
<suffixlines suffix="}"/>
<striplinebreaks/>
</filterchain>
</loadresource>
<local name="ooxml.lite.agent.exists"/>
<available property="ooxml.lite.agent.exists" file="${ooxml.lite.agent}"/>
<local name="cp_java"/>
<pathconvert property="cp_java" pathsep=",">
<path refid="@{modulepath-ref}"/>
<filtermapper>
<replacestring from="${basedir}" to=""/>
<replaceregex pattern="^." replace=""/>
<suffixlines suffix="${file.separator}*.jar"/>
</filtermapper>
</pathconvert>
<jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="@{jacocodest}">
<junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}"
failureproperty="@{failureproperty}" showoutput="@{showoutput}" filtertrace="off">
<syspropertyset refid="junit.properties"/>
<sysproperty key="java.io.tmpdir" value="${tempdir}"/>
<jvmarg value="-Xmx@{heap}M"/>
<jvmarg value="-ea"/>
<!-- some "add-opens" and other properties are needed when running with Java 9 or newer -->
<sysproperty key="sun.reflect.debugModuleAccessChecks" value="true" if:true="${addOpens}" />
<sysproperty key="com.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize" value="true" if:true="${addOpens}" />
<jvmarg value="--illegal-access=warn" if:true="${addOpens}" />
<jvmarg value="-javaagent:${ooxml.lite.agent}=${ooxml.lite.report}|${ooxml.lite.includes}" if:true="${ooxml.lite.agent.exists}"/>
<!-- jvmarg value="-Duser.timezone=UTC"/ -->
<jvmarg value="${file.leak.detector}" />
<jvmarg value="-Xjit:verbose={compileStart|compileEnd},vlog=build/jit.log${no.jit.sherlock}" if:true="${isIBMVM}"/>
<formatter type="plain"/>
<formatter type="xml"/>
<modulepath refid="@{modulepath-ref}" unless:true="${isJava8}"/>
<classpath if:true="${isJava8}">
<fileset dir="${basedir}" includes="${cp_java}"/>
</classpath>
<elements/>
</junit>
</jacoco:coverage>
</sequential>
</macrodef>
<target name="retest-ooxml" depends="jar"
description="run ooxml tests with poi-ooxml-lite">
<path id="restest.modules">
<pathelement path="build/dist/maven/poi-tests"/>
<pathelement path="build/dist/maven/poi-scratchpad-tests"/>
<pathelement path="build/dist/maven/poi-ooxml-tests"/>
<pathelement path="build/dist/maven/poi-ooxml-lite"/>
<pathelement path="lib/main"/>
<pathelement path="lib/main-tests"/>
<pathelement path="lib/ooxml"/>
<pathelement path="lib/ooxml-provided"/>
<pathelement path="lib/ooxml-tests"/>
</path>
<poiunit failureproperty="ooxml.test.failed" heap="768"
modulepath-ref="restest.modules">
<jvmarg line="--add-modules org.apache.poi.ooxml" unless:true="${isJava8}"/>
<jvmarg line="--add-modules org.apache.poi.scratchpad" unless:true="${isJava8}"/>
<batchtest todir="${ooxml.reports.test}">
<fileset dir="${ooxml.src.test}">
<include name="**/${testpattern}.java"/>
<exclude name="**/TestUnfixedBugs.java"/>
<exclude name="**/All*Tests.java"/>
<exclude name="**/TestSignatureInfo.java"/>
<exclude name="**/${testexcludepattern}.java"/>
<patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
</fileset>
</batchtest>
</poiunit>
</target>
<target name="compile-excelant" depends="compile-main,compile-ooxml">
<compile-jar module="excelant"
java="${excelant.src}" classes="${excelant.output.dir}"
test="${excelant.src.test}" test-classes="${excelant.output.test.dir}">
<lib>
<pathelement path="build/dist/maven/poi-tests"/>
<pathelement path="build/dist/maven/poi-scratchpad-tests"/>
<pathelement path="build/dist/maven/poi-ooxml-tests"/>
<pathelement path="lib/main"/>
<pathelement path="lib/main-tests"/>
<pathelement path="lib/excelant"/>
</lib>
<resources>
<fileset dir="${excelant.resource.dir}"/>
</resources>
</compile-jar>
</target>
<target name="compile-integration" depends="compile-scratchpad, compile-main, compile-ooxml, compile-examples">
<javac release="8"
target="${jdk.version.class}"
source="${jdk.version.source}"
destdir="${integration.output.test.dir}"
srcdir="${integration.src.test}"
debug="${compile.debug}"
encoding="${java.source.encoding}"
fork="yes"
includeantruntime="false">
<classpath>
<path refid="scratchpad.classpath"/>
<path refid="ooxml.classpath"/>
<path refid="test.jar.classpath"/>
<pathelement location="${ooxml.output.dir}"/>
<pathelement location="${main.output.test.dir}"/>
<pathelement location="${examples.output.dir}"/>
<pathelement location="${main.ant.jar}"/>
<pathelement location="${scratchpad.output.dir}"/>
</classpath>
<exclude name="**/HeapDump**" if:true="${isIBMVM}"/>
</javac>
<mkdir dir="${integration.output.test.dir}/META-INF/versions/9"/>
<javac release="9"
srcdir="${basedir}/src/multimodule/integration/java9"
destdir="${integration.output.test.dir}/META-INF/versions/9"
includeantruntime="false"
fork="true"
unless:true="${isJava8}">
<compilerarg line="--patch-module org.apache.poi.stress=${integration.output.test.dir}"/>
<modulepath>
<pathelement path="build/dist/maven/poi-ooxml-full"/>
<pathelement path="build/dist/maven/poi"/>
<pathelement path="build/dist/maven/poi-ooxml"/>
<pathelement path="build/dist/maven/poi-scratchpad"/>
<pathelement path="build/dist/maven/poi-examples"/>
<pathelement path="${main.lib}"/>
<pathelement path="${main-tests.lib}"/>
<pathelement path="${ooxml.lib}"/>
<pathelement path="${ooxml-provided.lib}"/>
</modulepath>
</javac>
<manifest file="build/poi-manifest.mf">
<attribute name="Multi-Release" value="true"/>
<attribute name="Automatic-Module-Name" value="org.apache.poi.stress"/>
</manifest>
<jar destfile="build/dist/maven/poi-integration/poi-integration-${version.id}.jar"
basedir="${integration.output.test.dir}"
manifest="build/poi-manifest.mf"/>
</target>
<target name="-version-java-check">
<!-- recompile Version.java from the template whenever source or the version in build.xml changes -->
<uptodate property="version.java.notRequired" targetfile="${main.output.dir}/org/apache/poi/Version.class">
<srcfiles file="src/resources/version/Version.java.template"/>
<srcfiles file="build.xml"/>
</uptodate>
</target>
<target name="compile-version"
unless="version.java.notRequired"
depends="init, -version-java-check"
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>
<fileset dir="${util.lib}">
<include name="org.jacoco*.jar" />
<include name="asm-*.jar" />
</fileset>
</classpath>
</taskdef>
</target>
<!-- Section: test (execute junit tests on test suites) -->
<target name="test" depends="compile,jacocotask,test-main,test-scratchpad,test-ooxml,test-excelant"
description="Tests main, scratchpad and ooxml"/>
<target name="test-all" depends="test,test-integration,test-ooxml-lite,testcoveragereport"
description="Tests main, scratchpad, ooxml, ooxml-lite, and coveragereport"/>
<target name="testcoveragereport" depends="init,jacocotask" description="create test-report" xmlns:jacoco="antlib:org.jacoco.ant" if="coverage.enabled">
<delete dir="${coverage.dir}"/>
<mkdir dir="${coverage.dir}"/>
<mkdir dir="${main.output.dir}"/>
<mkdir dir="${scratchpad.output.dir}"/>
<mkdir dir="${ooxml.output.dir}"/>
<mkdir dir="${excelant.output.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 some generated classes -->
<exclude name="org/apache/poi/sl/draw/binding/*.class"/>
<!-- exclude large test-class -->
<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 some generated classes -->
<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}"/>
<!-- there are no actual POI classes in build/ooxml-lite-classes, only generated code... -->
</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>
<!--group name="Examples">
<classfiles>
<fileset dir="${examples.output.dir}"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${examples.src}"/>
</sourcefiles>
</group-->
</structure>
<html destdir="${coverage.dir}"/>
<xml destfile="${coverage.dir}/coverage.xml"/>
</jacoco:report>
<echo message="Coverage results are available at ${coverage.dir}/index.html, ${coverage.dir}/coverage.xml" />
</target>
<!-- Section: test-main -->
<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"
description="tests POI classes that deal with the Microsoft Office binary (BIFF8) file formats (excludes OOXML)">
<path id="test-main.modules">
<pathelement path="build/dist/maven/poi-tests"/>
<pathelement path="lib/main"/>
<pathelement path="lib/main-tests"/>
</path>
<poiunit failureproperty="main.test.failed" heap="256" showoutput="true" jacocodest="build/jacoco-main.exec"
modulepath-ref="test-main.modules">
<jvmarg line="--add-modules org.apache.poi.poi" unless:true="${isJava8}"/>
<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"/>
<exclude name="**/${testexcludepattern}.java"/>
<patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
</fileset>
</batchtest>
</poiunit>
<delete file="${main.testokfile}"/>
<antcall target="-test-main-write-testfile"/>
</target>
<target name="test-report" depends="init">
<mkdir dir="build/report"/>
<junitreport todir="build/report">
<fileset dir="build">
<include name="*results/**/TEST-*.xml"/>
</fileset>
<report format="frames" todir="build/report"/>
</junitreport>
<echo message="Published results from tests at build/report/index.html"/>
</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>
<!-- Section: test-scratchpad -->
<target name="-test-scratchpad-check">
<uptodate property="scratchpad.test.notRequired" targetfile="${scratchpad.testokfile}">
<srcfiles dir="${scratchpad.src}"/>
<srcfiles dir="${scratchpad.src.test}"/>
</uptodate>
</target>
<target name="test-scratchpad" depends="jacocotask,compile-scratchpad,-test-scratchpad-check,test-scratchpad-download-resources"
unless="scratchpad.test.notRequired"
description="test non-OOXML scratchpad classes">
<path id="test-scratchpad.modules">
<pathelement path="build/dist/maven/poi-tests"/>
<pathelement path="build/dist/maven/poi-scratchpad-tests"/>
<pathelement path="lib/main"/>
<pathelement path="lib/main-tests"/>
</path>
<poiunit failureproperty="scratchpad.test.failed" heap="512" jacocodest="build/jacoco-scratchpad.exec"
modulepath-ref="test-scratchpad.modules">
<jvmarg line="--add-modules org.apache.poi.scratchpad" unless:true="${isJava8}"/>
<batchtest todir="${scratchpad.reports.test}">
<fileset dir="${scratchpad.src.test}">
<include name="**/${testpattern}.java"/>
<exclude name="**/AllTests.java"/>
<exclude name="**/${testexcludepattern}.java"/>
<patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
</fileset>
</batchtest>
</poiunit>
<delete file="${scratchpad.testokfile}"/>
<antcall target="-test-scratchpad-write-testfile"/>
</target>
<target name="-test-scratchpad-write-testfile" unless="scratchpad.test.failed">
<echo file="${scratchpad.testokfile}" append="false" message="testok"/>
</target>
<!-- Section: test-ooxml -->
<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="modulepath-ref"/>
<attribute name="type"/>
<sequential>
<poiunit failureproperty="ooxml.test.failed" heap="768" jacocodest="build/jacoco-@{type}.exec"
modulepath-ref="@{modulepath-ref}">
<jvmarg line="--add-modules org.apache.poi.ooxml" unless:true="${isJava8}"/>
<jvmarg line="--add-modules org.apache.poi.scratchpad" unless:true="${isJava8}"/>
<batchtest todir="${ooxml.reports.test}">
<fileset dir="${ooxml.src.test}">
<include name="**/${testpattern}.java"/>
<exclude name="**/TestUnfixedBugs.java"/>
<exclude name="**/All*Tests.java"/>
<exclude name="**/${testexcludepattern}.java"/>
<patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
</fileset>
</batchtest>
</poiunit>
</sequential>
</macrodef>
<target name="test-ooxml" depends="compile-main,compile-ooxml,-test-ooxml-check,jacocotask" unless="ooxml.test.notRequired"
description="test OOXML classes">
<path id="test-ooxml.modules">
<!-- full schema -->
<pathelement path="build/dist/maven/poi-ooxml-full"/>
<pathelement path="build/dist/maven/poi-tests"/>
<pathelement path="build/dist/maven/poi-ooxml-tests"/>
<pathelement path="build/dist/maven/poi-scratchpad-tests"/>
<pathelement path="lib/main"/>
<pathelement path="lib/main-tests"/>
<pathelement path="lib/ooxml"/>
<pathelement path="lib/ooxml-provided"/>
<pathelement path="lib/ooxml-tests"/>
</path>
<ooxml-test-runner modulepath-ref="test-ooxml.modules" 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>
<!-- Section: test-integration -->
<target name="-test-integration-check">
<uptodate property="integration.test.notRequired" targetfile="${integration.testokfile}">
<srcfiles dir="${integration.src.test}"/>
</uptodate>
</target>
<target name="test-integration" depends="compile-integration,-test-integration-check,jacocotask"
unless="integration.test.notRequired">
<propertyreset name="org.apache.poi.util.POILogger" value="org.apache.poi.util.SLF4JLogger"/>
<delete dir="build" includes="test-integration.log*"/>
<path id="test-integration.modules">
<pathelement path="build/dist/maven/poi-tests"/>
<pathelement path="build/dist/maven/poi-ooxml"/>
<pathelement path="build/dist/maven/poi-scratchpad"/>
<pathelement path="build/dist/maven/poi-examples"/>
<pathelement path="build/dist/maven/poi-ooxml-full"/>
<pathelement path="build/dist/maven/poi-integration"/>
<pathelement path="lib/main"/>
<pathelement path="lib/main-tests"/>
<pathelement path="lib/ooxml"/>
<pathelement path="lib/ooxml-provided"/>
<pathelement path="lib/ooxml-tests"/>
</path>
<poiunit failureproperty="integration.test.failed" heap="1512" showoutput="true" jacocodest="build/jacoco-integration.exec"
modulepath-ref="test-integration.modules">
<jvmarg line="--add-modules org.apache.poi.stress" unless:true="${isJava8}"/>
<batchtest todir="${integration.reports.test}">
<fileset dir="${integration.src.test}">
<include name="**/${testpattern}.java"/>
<exclude name="**/${testexcludepattern}.java"/>
<patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
</fileset>
</batchtest>
</poiunit>
<delete file="${integration.testokfile}"/>
<antcall target="-test-integration-write-testfile"/>
</target>
<target name="-test-integration-write-testfile" unless="integration.test.failed">
<echo file="${integration.testokfile}" append="false" message="testok"/>
</target>
<!-- the ooxml lite agent collects referenced schema files while other junit tests are run, -->
<!-- therefore its best to compile the ooxml lite jar after all usual tests are done -->
<target name="compile-ooxml-lite" depends="test-ooxml">
<echo message="Create ooxml-lite schemas"/>
<local name="lite.exports"/>
<loadresource property="lite.exports">
<file file="${ooxml.lite.report}"/>
<filterchain>
<tokenfilter>
<replaceregex pattern="[/\\][^/\\]+$" replace=""/>
<replaceregex pattern="[/\\]" replace="." flags="g"/>
</tokenfilter>
<linecontainsregexp negate="true" regexp="\.impl$"/>
<sortfilter/>
<uniqfilter/>
<prefixlines prefix=" exports "/>
<suffixlines suffix=";"/>
</filterchain>
</loadresource>
<local name="full.schema"/>
<loadresource property="full.schema">
<file file="${basedir}/src/multimodule/ooxml-full/java9/module-info.java"/>
<filterchain>
<linecontains negate="true" matchany="true">
<contains value="exports"/>
<contains value="}"/>
</linecontains>
</filterchain>
</loadresource>
<echo output="${basedir}/src/multimodule/ooxml-lite/java9/module-info.java">${full.schema}${lite.exports}}</echo>
<javac release="9"
srcdir="${basedir}/src/multimodule/ooxml-lite/java9"
destdir="${basedir}/src/multimodule/ooxml-lite/java9"
includeantruntime="false"
fork="true"
unless:true="${isJava8}">
<compilerarg line="--patch-module org.apache.poi.ooxml.schemas=${ooxml.xsds.jar}"/>
<modulepath>
<pathelement path="lib/ooxml"/>
</modulepath>
</javac>
<copy file="${ooxml.lite.report}" tofile="build/ooxml-lite-classes.txt" overwrite="true">
<filterchain>
<tokenfilter>
<replaceregex pattern="(.*)" replace="\1.class${line.separator}\1$*.class "/>
</tokenfilter>
</filterchain>
</copy>
<local name="ooxml.lite.xsbs"/>
<loadresource property="ooxml.lite.xsbs">
<file file="${ooxml.lite.report}"/>
<filterchain>
<linecontains negate="true" matchany="true">
<contains value="$"/>
<contains value="TypeSystemHolder"/>
</linecontains>
<suffixlines suffix=".java"/>
</filterchain>
</loadresource>
<concat dest="build/ooxml-lite-classes.txt" append="true">
<filelist dir="build/xmlbean-sources" files="${ooxml.lite.xsbs}"/>
<filterchain>
<linecontains>
<contains value="resolveHandle"/>
</linecontains>
<replaceregex pattern='.*"([^"]+)".*' replace="org/apache/poi/schemas/ooxml/system/ooxml/\1.xsb"/>
</filterchain>
</concat>
<!-- the following xsb files aren't detected, i.e. not directly loaded by XmlBeans interface classes -->
<echo file="build/ooxml-lite-classes.txt" append="true">
org/apache/poi/schemas/ooxml/system/ooxml/index.xsb
org/apache/poi/schemas/ooxml/system/ooxml/picelement.xsb
org/apache/poi/schemas/ooxml/system/ooxml/groupelement.xsb
org/apache/poi/schemas/ooxml/system/ooxml/group7d3fdoctype.xsb
org/apache/poi/schemas/ooxml/system/ooxml/shapelayoutelement.xsb
org/apache/poi/schemas/ooxml/system/ooxml/shapetypeelement.xsb
org/apache/poi/schemas/ooxml/system/ooxml/shapetypeb89bdoctype.xsb
org/apache/poi/schemas/ooxml/system/ooxml/shapeelement.xsb
org/apache/poi/schemas/ooxml/system/ooxml/shapeaee1doctype.xsb
org/apache/poi/schemas/ooxml/system/ooxml/tblelement.xsb
org/apache/poi/schemas/ooxml/system/ooxml/tbleb1bdoctype.xsb
org/apache/poi/schemas/ooxml/system/ooxml/relationshipreferenceelement.xsb
org/apache/poi/schemas/ooxml/system/ooxml/qualifyingpropertieselement.xsb
org/apache/poi/schemas/ooxml/system/ooxml/oleobjelement.xsb
org/apache/poi/schemas/ooxml/system/ooxml/oleobj8482doctype.xsb
org/apache/poi/schemas/ooxml/system/ooxml/stcellspans60f6type.xsb
org/apache/poi/schemas/ooxml/system/ooxml/stcellspanf3a5type.xsb
org/apache/poi/schemas/ooxml/system/ooxml/alternatecontentelement.xsb
org/apache/poi/schemas/ooxml/system/ooxml/chartelement.xsb
org/apache/poi/schemas/ooxml/system/ooxml/chartf85cdoctype.xsb
org/apache/poi/schemas/ooxml/system/ooxml/rectelement.xsb
org/apache/poi/schemas/ooxml/system/ooxml/rectaf36doctype.xsb
</echo>
<mkdir dir="build/dist/maven/poi-ooxml-lite"/>
<jar destfile="${ooxml.lite.jar}" duplicate="preserve">
<zipfileset dir="${basedir}/src/multimodule/ooxml-lite/java9" prefix="META-INF/versions/9" excludes="*.java"/>
<zipfileset src="${ooxml.xsds.jar}">
<patternset includesfile="build/ooxml-lite-classes.txt">
<include name="org/apache/poi/schemas/ooxml/element/**/*.xsb"/>
</patternset>
</zipfileset>
<zipfileset dir="src/multimodule/ooxml-full/java9" prefix="META-INF/versions/9" excludes="*.java"/>
<manifest>
<attribute name="Multi-Release" value="true"/>
<attribute name="Automatic-Module-Name" value="org.apache.poi.ooxml.schemas"/>
</manifest>
</jar>
</target>
<target name="test-ooxml-lite" depends="jacocotask,compile-ooxml-lite">
<delete file="${ooxml.testokfile}"/>
<echo message="Running ooxml tests against 'poi-ooxml-lite'"/>
<path id="test-ooxml-lite.modules">
<!-- lite schema -->
<pathelement path="build/dist/maven/poi-ooxml-lite"/>
<pathelement path="build/dist/maven/poi-tests"/>
<pathelement path="build/dist/maven/poi-ooxml-tests"/>
<pathelement path="build/dist/maven/poi-scratchpad-tests"/>
<pathelement path="lib/main"/>
<pathelement path="lib/main-tests"/>
<pathelement path="lib/ooxml"/>
<pathelement path="lib/ooxml-provided"/>
<pathelement path="lib/ooxml-tests"/>
</path>
<ooxml-test-runner modulepath-ref="test-ooxml-lite.modules" type="ooxml-lite"/>
</target>
<!-- Section: test-excelant -->
<target name="-test-excelant-check">
<uptodate property="excelant.test.notRequired" targetfile="${excelant.testokfile}">
<srcfiles dir="${excelant.src}"/>
<srcfiles dir="${excelant.src.test}"/>
</uptodate>
</target>
<target name="-test-excelant-write-testfile" unless="excelant.test.failed">
<echo file="${excelant.testokfile}" append="false" message="testok"/>
</target>
<target name="test-excelant" depends="compile-excelant,compile-ooxml-lite,-test-excelant-check,jacocotask"
unless="excelant.test.notRequired">
<path id="test-excelant.modules">
<pathelement path="lib/main"/>
<pathelement path="lib/main-tests"/>
<pathelement path="lib/ooxml"/>
<pathelement path="lib/ooxml-tests"/>
<pathelement path="lib/ooxml-provided"/>
<pathelement path="lib/excelant"/>
<pathelement path="build/dist/maven/poi-tests"/>
<pathelement path="build/dist/maven/poi-ooxml-tests"/>
<pathelement path="build/dist/maven/poi-ooxml-lite"/>
<pathelement path="build/dist/maven/poi-scratchpad-tests"/>
<pathelement path="build/dist/maven/poi-excelant-tests"/>
</path>
<poiunit failureproperty="excelant.test.failed" jacocodest="build/jacoco-excelant.exec"
modulepath-ref="test-excelant.modules">
<jvmarg line="--add-modules org.apache.poi.excelant" unless:true="${isJava8}"/>
<batchtest todir="${excelant.reports.test}">
<fileset dir="${excelant.src.test}">
<include name="**/${testpattern}.java"/>
<exclude name="**/${testexcludepattern}.java"/>
<patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
</fileset>
</batchtest>
</poiunit>
<delete file="${excelant.testokfile}"/>
<antcall target="-test-excelant-write-testfile"/>
</target>
<!-- GENERATE DOCUMENTATION -->
<!-- Section: docs -->
<target name="-check-docs">
<echo message="Checking if documentation recreation is necessary, i.e. if any file at ${main.documentation} is newer than ${build.site}/index.html"/>
<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;https://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, javadocs, -forrest-docs"
unless="main.docs.notRequired"
description="Builds the POI website" />
<target name="site" depends="-forrest-docs"/>
<target name="-forrest-docs" depends="-check-forrest-installed, -check-docs"
unless="main.docs.notRequired" description="Builds the HTML pages of the POI website">
<exec executable="${env.FORREST_HOME}/bin/forrest" osfamily="unix"/>
<exec executable="cmd" osfamily="windows">
<arg value="/c"/>
<arg value="${env.FORREST_HOME}/bin/forrest.bat"/>
</exec>
<echo>Broken links:</echo>
<echo file="${build.site}/../tmp/brokenlinks.xml"/>
<!-- Apache Forrest is dead, so we cannot expect fixes there
however it does not handle "https" in "credits" currently
if the *.xml file is in a sub-directory, see Apache Forrest
code at main/webapp/skins/pelt/xslt/html/site-to-xhtml.xsl:350
So we need to replace the links afterwards to have a fully "https"
website and avoid browser warning about a "mixed content"
website -->
<echo>Fix https in ${build.site}</echo>
<replace dir="${build.site}"
token="http://www.apache.org/events/current-event-125x125.png"
value="https://www.apache.org/events/current-event-125x125.png"
summary="true"
includes="**/*.html"/>
<replace dir="${build.site}"
token="http://www.google.com/search"
value="https://www.google.com/search"
summary="true"
includes="**/*.html"/>
<fixcrlf srcdir="${build.site}" includes="**/*.html,**/*.css" eol="unix" eof="remove" />
<touch>
<fileset dir="${build.site}"/>
</touch>
</target>
<!-- Generates the latest/development API documentation. -->
<target name="javadocs"
description="Generates the API documentation">
<echo message="Generating latest Javadocs in ${javadocs.report.dir}"/>
<javadoc verbose="false" author="true" destdir="${javadocs.report.dir}"
windowtitle="POI API Documentation" use="true" version="true"
maxmemory="384M" additionalparam="-notimestamp" locale="en_US"
classpathref="javadoc.classpath">
<packageset dir="${main.src}" defaultexcludes="yes">
<include name="org/apache/poi/**"/>
</packageset>
<packageset dir="${scratchpad.src}" defaultexcludes="yes">
<include name="org/apache/poi/**"/>
<exclude name="org/apache/poi/hdf/**"/>
</packageset>
<packageset dir="${ooxml.src}" defaultexcludes="yes">
<include name="org/apache/poi/**"/>
</packageset>
<arg value="--add-modules=java.xml.bind" if:true="${addOpens10}"/>
<doctitle><![CDATA[<h1>POI API Documentation</h1>]]></doctitle>
<bottom>
<![CDATA[<i>Copyright ${tstamp.year} The Apache Software Foundation or
its licensors, as applicable.</i>]]>
</bottom>
<group>
<title>DDF - Dreadful Drawing Format</title>
<package name="org.apache.poi.ddf*"/>
</group>
<group>
<title>HPSF - Horrible Property Set Format</title>
<package name="org.apache.poi.hpsf*"/>
</group>
<group>
<title>SS - Common Spreadsheet Format</title>
<package name="org.apache.poi.ss*"/>
</group>
<group>
<title>HSSF - Horrible Spreadsheet Format</title>
<package name="org.apache.poi.hssf*"/>
</group>
<group>
<title>XSSF - Open Office XML Spreadsheet Format</title>
<package name="org.apache.poi.xssf*"/>
</group>
<group>
<title>SL - Common Slideshow Format</title>
<package name="org.apache.poi.sl*"/>
</group>
<group>
<title>HSLF - Horrible Slideshow Format</title>
<package name="org.apache.poi.hslf*"/>
</group>
<group>
<title>XSLF - Open Office XML Slideshow Format</title>
<package name="org.apache.poi.xslf*"/>
</group>
<group>
<title>HWPF - Horrible Word Processor Format</title>
<package name="org.apache.poi.hwpf*"/>
</group>
<group>
<title>XWPF - Open Office XML Word Processor Format</title>
<package name="org.apache.poi.xwpf*"/>
</group>
<group>
<title>HDGF - Horrible Diagram Format</title>
<package name="org.apache.poi.hdgf*"/>
</group>
<group>
<title>XDGF - Open Office XML Diagram Format</title>
<package name="org.apache.poi.xdgf*"/>
</group>
<group>
<title>POIFS - POI File System</title>
<package name="org.apache.poi.poifs*"/>
</group>
<group>
<title>Utilities</title>
<package name="org.apache.poi.util*"/>
</group>
<group>
<title>Examples</title>
<package name="org.apache.poi.hpsf.examples*"/>
<package name="org.apache.poi.hssf.usermodel.examples*"/>
</group>
</javadoc>
</target>
<target name="maven-poms"
description="Builds the POM files for a maven distribution, and copies these and the jars to the appropriate locations">
<!-- Build the org.apache.poi poms -->
<copy todir="${dist.dir}/maven">
<fileset dir="maven" includes="poi*.pom"/>
<chainedmapper>
<firstmatchmapper>
<regexpmapper from="^(.*).pom$$" to="\1/\1.pom"/>
<globmapper from="poi.pom" to="poi/poi.pom"/>
</firstmatchmapper>
<globmapper from="*.pom" to="*-${version.id}.pom"/>
</chainedmapper>
<filterchain>
<replacetokens>
<token key="VERSION" value="${version.id}"/>
</replacetokens>
</filterchain>
</copy>
<mkdir dir="${dist.dir}/maven/poi-ooxml-full"/>
<copy tofile="${dist.dir}/maven/poi-ooxml-full/poi-ooxml-full-${version.id}.pom" file="maven/poi-ooxml-full.pom">
<filterchain>
<replacetokens>
<token key="VERSION" value="${version.id}"/>
</replacetokens>
</filterchain>
</copy>
<echo>Maven POMs are located in ${dist.dir}</echo>
<echo>Use ant dist-nexus to deploy the artifacts in the remote repository</echo>
</target>
<target name="-manifest">
<manifest file="build/poi-manifest.mf">
<attribute name="Multi-Release" value="true"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Title" value="Apache POI"/>
<attribute name="Specification-Version" value="${version.id}"/>
<attribute name="Specification-Vendor" value="The Apache Software Foundation"/>
<attribute name="Implementation-Title" value="Apache POI"/>
<attribute name="Implementation-Version" value="${version.id}"/>
<attribute name="Implementation-Vendor-Id" value="org.apache.poi"/>
<attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
</manifest>
</target>
<macrodef name="maven-jar">
<attribute name="src"/>
<attribute name="module"/>
<element name="elements" implicit="true" optional="true"/>
<sequential>
<local name="destfile"/>
<pathconvert property="destfile" targetos="unix">
<path><pathelement path="@{src}"/></path>
<mapper>
<chainedmapper>
<filtermapper>
<replaceregex pattern=".jar" replace="" flags="g"/>
<!-- <replaceregex pattern="ooxml-lite" replace="ooxml-schemas" flags="g"/>-->
<replaceregex pattern="(.java|.src)$$" replace="-sources"/>
<replaceregex pattern=".*(?:build|src).?(.*)?" replace="\1"/>
<replaceregex pattern="(.*)(-classes|-sources)" replace="poi-\1/poi-\1-${version.id}\2"/>
<replaceregex pattern="^(classes|sources)$$" replace="poi/poi-${version.id}-\1"/>
<replaceregex pattern="-classes" replace=""/>
</filtermapper>
</chainedmapper>
</mapper>
</pathconvert>
<local name="isjar"/>
<condition property="isjar">
<contains string="@{src}" substring=".jar"/>
</condition>
<mkdir dir="@{src}/META-INF/versions/9"/>
<javac release="9"
srcdir="${basedir}/src/multimodule/@{module}/java9"
destdir="@{src}/META-INF/versions/9"
includeantruntime="false"
fork="true"
modulepath="${main.lib}"
unless:true="${isJava8}">
<compilerarg line="--patch-module org.apache.poi.@{module}=@{src}"/>
<elements/>
</javac>
<jar destfile="build/dist/maven/${destfile}.jar">
<fileset dir="@{src}" unless:true="${isjar}"/>
<zipfileset src="@{src}" if:true="${isjar}"/>
<metainf dir="legal/"/>
<manifest>
<attribute name="Multi-Release" value="true"/>
<attribute name="Automatic-Module-Name" value="org.apache.poi.@{module}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Title" value="Apache POI"/>
<attribute name="Specification-Version" value="${version.id}"/>
<attribute name="Specification-Vendor" value="The Apache Software Foundation"/>
<attribute name="Implementation-Title" value="Apache POI"/>
<attribute name="Implementation-Version" value="${version.id}"/>
<attribute name="Implementation-Vendor-Id" value="org.apache.poi"/>
<attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
</manifest>
</jar>
</sequential>
</macrodef>
<target name="jar" depends="compile, compile-ooxml-lite" description="Creates jar files for distribution">
</target>
<target name="-do-jar-check-javadocs-package-list">
<condition property="javadocs.package-list.present">
<available file="${javadocs.report.dir}/package-list"/>
</condition>
</target>
<target name="-do-jar-create-javadocs-package-list"
depends="-do-jar-check-javadocs-package-list"
unless="javadocs.package-list.present">
<antcall target="javadocs"/>
</target>
<target name="jar-javadocs" description="JavaDocs for Maven" depends="compile,-manifest,-do-jar-create-javadocs-package-list">
<property name="build.maven.javadocs" location="build/tmp/maven-javadocs"/>
<!-- Build and package the main javadocs -->
<maven-javadocs src="${main.src}" dest="${jar.name}"/>
<!-- Build and package the scratchpad javadocs -->
<maven-javadocs src="${scratchpad.src}" dest="${jar.name}-scratchpad"/>
<!-- Build and package the ooxml javadocs -->
<maven-javadocs src="${ooxml.src}" dest="${jar.name}-ooxml"/>
</target>
<macrodef name="maven-javadocs">
<attribute name="src"/>
<attribute name="dest"/>
<sequential>
<echo message="Building @{dest} javadocs from @{src}" />
<local name="build.maven.javadocs"/>
<property name="build.maven.javadocs" location="build/tmp/maven-javadocs"/>
<delete dir="${build.maven.javadocs}"/>
<mkdir dir="${build.maven.javadocs}"/>
<javadoc verbose="false" author="false" destdir="${build.maven.javadocs}"
windowtitle="POI API Documentation" use="false" version="false"
maxmemory="384M" additionalparam="-notimestamp -quiet" locale="en_US"
classpathref="javadoc.classpath">
<packageset dir="@{src}" defaultexcludes="yes">
<include name="org/apache/poi/**"/>
</packageset>
<link offline="true" href="https://poi.apache.org/apidocs/dev" packagelistLoc="${javadocs.report.dir}"/>
</javadoc>
<jar destfile="${dist.dir}/maven/@{dest}/@{dest}-${version.id}-javadoc.jar"
manifest="build/poi-manifest.mf">
<fileset dir="${build.maven.javadocs}"/>
<metainf dir="legal/"/>
</jar>
</sequential>
</macrodef>
<target name="release-notes" depends="init">
<copy file="src/documentation/RELEASE-NOTES.txt" todir="build/dist/" overwrite="true">
<filterset>
<filter token="VERSION" value="${version.id}"/>
<filter token="DSTAMP" value="${DSTAMP}"/>
<filter token="RELEASE_TAG" value="${RELEASE_TAG}"/>
</filterset>
</copy>
</target>
<target name="assemble" depends="jar,jar-javadocs" description="Produce the zipped distribution files">
<property name="zipdir" value="${jar.name}-${version.id}"/>
<mappedresources id="legal-files" cache="true">
<fileset dir="legal"/>
<globmapper from="*" to="${zipdir}/*"/>
</mappedresources>
<!-- jars to include in binary assemblies -->
<union id="bin-files" cache="true">
<mappedresources refid="legal-files"/>
<mappedresources cache="true">
<fileset dir="${main.lib}">
<include name="commons-codec-*.jar"/>
<include name="commons-logging-*.jar"/>
<include name="commons-collections4-*.jar"/>
<include name="commons-math3-*.jar"/>
<include name="SparseBitSet-*.jar"/>
</fileset>
<globmapper from="*" to="${zipdir}/lib/*"/>
</mappedresources>
<mappedresources cache="true">
<fileset dir="${ooxml.lib}"/>
<regexpmapper from="^(.*\.jar)$$" to="${zipdir}/ooxml-lib/\1"/>
</mappedresources>
<mappedresources cache="true">
<fileset dir="${ooxml-provided.lib}"/>
<regexpmapper from="^(.*\.jar)$$" to="${zipdir}/auxiliary/\1"/>
</mappedresources>
<mappedresources cache="true">
<fileset dir="${dist.dir}/maven" includes="**/*.jar" excludes="**/*-javadoc.jar,**/*-sources.jar,**/*-tests.jar"/>
<chainedmapper>
<flattenmapper/>
<globmapper from="*" to="${zipdir}/*"/>
</chainedmapper>
</mappedresources>
<mappedresources cache="true">
<fileset dir="${build.site}"/>
<globmapper from="*" to="${zipdir}/docs/*"/>
</mappedresources>
</union>
<!-- patterns to exclude from source assemblies -->
<union id="src-files" cache="true">
<mappedresources refid="legal-files"/>
<mappedresources cache="true">
<fileset dir="." excludes="build/**,
dist*/**,
lib/**,
bin/**,
out/**,
tmp/**,
sonar/**/target/**,
sonar/*/src/**,
compile-lib/**,
ooxml-lib/**,
ooxml-testlib/**,
scripts/**,
TEST*,
*.ipr,
*.iml,
*.iws,
*.lnk,
*.rdf,
*.swp,
*.launch,
*.log,
.gradle/**,
.idea/**,
.settings/**,
.classpath,
.settings/**,
.project"/>
<globmapper from="*" to="${zipdir}/*"/>
</mappedresources>
</union>
<zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip">
<union refid="bin-files"/>
</zip>
<tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz" longfile="gnu" compression="gzip">
<union refid="bin-files"/>
</tar>
<zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
<union refid="src-files"/>
</zip>
<tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz" longfile="gnu" compression="gzip">
<union refid="src-files"/>
</tar>
<echo>Creating Maven POMs</echo>
<antcall target="maven-poms"/>
<echo>Distribution located in ${dist.dir}</echo>
<echo>Use "ant dist-checksum" to create sha256/sha512 checksums and GPG signatures</echo>
</target>
<target name="osgi" depends="mvn-install">
<echo message="Building OSGi bundle via Maven" />
<mvn:mvn pom="osgi/pom.xml">
<arg value="-Dpoi.version=${version.id}" />
<arg value="install" />
</mvn:mvn>
</target>
<target name="dist" depends="clean, compile, test-all, rat-check, forbidden-apis-check, docs, jar, release-notes, assemble"
description="Creates the entire distribution into build/dist, from scratch">
</target>
<!-- continuous integration targets -->
<target name="jenkins"
depends="replaceVersion, compile, test-all, jar, javadocs, assemble, findbugs, release-notes, rat-check, forbidden-apis-check, help, fetch-svn-jars, maven-poms, maventask, mvn-install"
description="Target run by Jenkins on a continuous basis. Builds and tests POI, generates artifacts and documentation, and searches for problems."/>
<target name="maventask" depends="init">
<downloadfile src="${maven.ant.url}" dest="${maven.ant.jar}"/>
<path id="maven-ant-tasks.classpath">
<pathelement location="${maven.ant.jar}"/>
</path>
<taskdef uri="antlib:org.apache.maven.artifact.ant" resource="org/apache/maven/artifact/ant/antlib.xml">
<classpath refid="maven-ant-tasks.classpath"/>
</taskdef>
</target>
<macrodef name="m2-install">
<attribute name="artifactId"/>
<attribute name="versionId" default="${version.id}"/>
<sequential>
<mvn:install file="${dist.dir}/maven/@{artifactId}/@{artifactId}-@{versionId}.jar">
<pom file="${dist.dir}/maven/@{artifactId}/@{artifactId}-@{versionId}.pom"/>
</mvn:install>
</sequential>
</macrodef>
<target name="mvn-install" depends="maventask,jar,maven-poms" description="Install POI artifacts into the local repository. Equivalent of 'mvn install'">
<m2-install artifactId="poi"/>
<m2-install artifactId="poi-scratchpad"/>
<m2-install artifactId="poi-ooxml"/>
<m2-install artifactId="poi-examples"/>
<m2-install artifactId="poi-ooxml-lite"/>
<m2-install artifactId="poi-ooxml-full"/>
<m2-install artifactId="poi-excelant"/>
</target>
<target name="rat-check" depends="init" description="Runs the Apache Creadur Rat check against the source code, to spot any files which are missing the correct license headers">
<mkdir dir="${rat.reportdir}" />
<typedef resource="org/apache/rat/anttasks/antlib.xml"
uri="antlib:org.apache.rat.anttasks"
classpath="${rat.jar}" />
<rat:report xmlns:rat="antlib:org.apache.rat.anttasks" reportFile="${rat.report}">
<fileset dir="src/">
<exclude name="documentation/*.txt" />
<exclude name="documentation/content/xdocs/dtd/" />
<exclude name="documentation/content/xdocs/entity/" />
<exclude name="scratchpad/testcases/dummy.txt" />
<exclude name="contrib/testcases/dummy.txt" />
<exclude name="examples/lib/dummy.txt" />
<exclude name="examples/src/org/apache/poi/**/*-chart-data.txt" />
<exclude name="resources/ooxml/org/apache/poi/xslf/usermodel/notesMaster.xml" />
<exclude name="resources/ooxml/org/apache/poi/xslf/usermodel/empty.pptx" />
<exclude name="resources/main/org/apache/poi/sl/draw/geom/presetShapeDefinitions.xml" />
<exclude name="resources/ooxml/org/apache/poi/xssf/usermodel/presetTableStyles.xml" />
<exclude name="ooxml/resources/org/apache/poi/xdgf/visio.xsd" />
<exclude name="ooxml/resources/org/apache/poi/schemas/XAdES*.xsd" />
<exclude name="ooxml/resources/org/apache/poi/schemas/xmldsig-core-schema.xsd" />
<exclude name="ooxml/resources/org/apache/poi/schemas/*.zip" />
<exclude name="**/*.iml" />
<exclude name="documentation/resources/images/pb-poi.cdr"/>
<exclude name="scratchpad/models/poi-hdf.zargo"/>
<exclude name="integrationtest/build/**"/>
<exclude name="integrationtest/.ant-targets-build.xml" />
</fileset>
</rat:report>
<!-- remove clutter to compact build output -->
<!-- replaceregexp doesn't work within loadfile ... -->
<replaceregexp file="${rat.report}" match="\s+Printing headers for files without AL header.++" replace="" flags="s"/>
<loadfile property="rat.reportcontent" srcFile="${rat.report}">
<filterchain>
<linecontainsregexp negate="true">
<regexp pattern="^\s+(AL|B|N)\s+"/>
</linecontainsregexp>
</filterchain>
</loadfile>
<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>
<!-- Runs the Forbiddens APIs checker against the source code, to -->
<!-- spot any cases where we've accidently used methods we shouldn't -->
<!-- See https://github.com/policeman-tools/forbidden-apis for details -->
<!-- of the checks that this can do -->
<target name="forbidden-apis-check" depends="init, compile, compile-integration">
<taskdef name="forbiddenapis"
classname="de.thetaphi.forbiddenapis.ant.AntTask"
classpath="${forbidden.jar}"/>
<path id="forbiddenapis.classpath">
<fileset dir="lib/main" includes="*.jar"/>
<fileset dir="lib/main-tests" includes="*.jar"/>
<fileset dir="lib/ooxml" includes="*.jar"/>
<fileset dir="lib/ooxml-tests" includes="*.jar"/>
<fileset dir="lib/ooxml-provided" includes="*.jar"/>
<fileset dir="lib/excelant" includes="*.jar"/>
<pathelement location="${ooxml.xsds.jar}"/>
<pathelement location="build/dist/maven/poi-tests/poi-${version.id}-tests.jar"/>
<pathelement location="build/dist/maven/poi-examples/poi-examples-${version.id}.jar"/>
<path path="${env.CLASSPATH}"/>
</path>
<!-- forbiddenapis bundled signatures max supported version is 14 -->
<condition property="forbiddenVersion" value="14">
<javaversion atleast="15"/>
</condition>
<property name="forbiddenVersion" value="${ant.java.version}"/>
<!-- first check rules that apply to all the source code -->
<forbiddenapis
classpathref="forbiddenapis.classpath"
suppressAnnotation="org.apache.poi.util.SuppressForbidden"
targetVersion="${forbiddenVersion}"
>
<bundledsignatures name="jdk-unsafe"/>
<bundledsignatures name="jdk-deprecated"/>
<bundledsignatures name="jdk-internal"/>
<bundledsignatures name="jdk-non-portable"/>
<bundledsignatures name="jdk-reflection"/>
<!--
<bundledsignatures name="jdk-system-out"/>
-->
<signaturesFileset file="src/resources/devtools/forbidden-signatures.txt"/>
<!-- test-sources (incl. sources) -->
<zipfileset src="build/dist/maven/poi-tests/poi-${version.id}-tests.jar"/>
<zipfileset src="build/dist/maven/poi-ooxml-tests/poi-ooxml-${version.id}-tests.jar"/>
<zipfileset src="build/dist/maven/poi-scratchpad-tests/poi-scratchpad-${version.id}-tests.jar"/>
<zipfileset src="build/dist/maven/poi-excelant-tests/poi-excelant-${version.id}-tests.jar"/>
<zipfileset src="build/dist/maven/poi-examples/poi-examples-${version.id}.jar"/>
<zipfileset src="build/dist/maven/poi-integration/poi-integration-${version.id}.jar"/>
</forbiddenapis>
<!-- then check some advanced rules which we only apply to the core code and not tests or examples -->
<forbiddenapis
classpathref="forbiddenapis.classpath"
suppressAnnotation="org.apache.poi.util.SuppressForbidden"
targetVersion="${forbiddenVersion}"
>
<signaturesFileset file="src/resources/devtools/forbidden-signatures-prod.txt"/>
<!-- sources -->
<zipfileset src="build/dist/maven/poi/poi-${version.id}.jar"/>
<zipfileset src="build/dist/maven/poi-ooxml/poi-ooxml-${version.id}.jar"/>
<zipfileset src="build/dist/maven/poi-scratchpad/poi-scratchpad-${version.id}.jar"/>
<zipfileset src="build/dist/maven/poi-excelant/poi-excelant-${version.id}.jar"/>
<zipfileset src="build/dist/maven/poi-integration/poi-integration-${version.id}.jar"/>
</forbiddenapis>
</target>
<!-- disabling findbugs until jenkins is updated to a current IBM JDK
see https://stackoverflow.com/a/48561534/2066598
this should be replaced by spotbugs when available in the jenkins warnings plugin -->
<target name="findbugs" depends="jar" unless="${isIBMVM}">
<property name="spotbugs.home" value="build/findbugs" />
<property name="spotbugs.lib" value="/build/findbugs/lib" />
<!-- findbugs successor, spotbugs ... need to use the dependencies used in the spotbugs release. -->
<!-- compare with the entries found in the MANIFEST.MF of spotbugs.jar -->
<dependency prefix="spotbugs" artifact="com.github.spotbugs:spotbugs:4.1.4" usage="${spotbugs.lib}" target="spotbugs.jar"/>
<dependency prefix="spotbugs-ant" artifact="com.github.spotbugs:spotbugs-ant:4.1.4" usage="${spotbugs.lib}" target="spotbugs-ant.jar"/>
<dependency prefix="spotbugs-anno" artifact="com.github.spotbugs:spotbugs-annotations:4.1.4" usage="${spotbugs.lib}" target="spotbugs-annotations.jar"/>
<dependency prefix="spotbugs.asm" artifact="org.ow2.asm:asm:9.0" usage="${spotbugs.lib}"/>
<dependency prefix="spotbugs.asm-analysis" artifact="org.ow2.asm:asm-analysis:9.0" usage="${spotbugs.lib}"/>
<dependency prefix="spotbugs.asm-commons" artifact="org.ow2.asm:asm-commons:9.0" usage="${spotbugs.lib}"/>
<dependency prefix="spotbugs.asm-tree" artifact="org.ow2.asm:asm-tree:9.0" usage="${spotbugs.lib}"/>
<dependency prefix="spotbugs.asm-util" artifact="org.ow2.asm:asm-util:9.0" usage="${spotbugs.lib}"/>
<dependency prefix="spotbugs.jsr305" artifact="com.google.code.findbugs:jsr305:3.0.2" usage="${spotbugs.lib}"/>
<dependency prefix="spotbugs.dom4j" artifact="org.dom4j:dom4j:2.1.3" usage="${spotbugs.lib}"/>
<dependency prefix="spotbugs.jaxen" artifact