mirror of https://github.com/apache/poi.git
improved tasks for fetching jars
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@712095 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ec1b159441
commit
f85249cf3c
207
build.xml
207
build.xml
|
@ -75,19 +75,19 @@ under the License.
|
|||
<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="main14.output.dir" location="build/classes-jdk14"/>
|
||||
<property name="main.output.test.dir" location="build/test-classes"/>
|
||||
<property name="main.lib" location="lib"/>
|
||||
<property name="ooxml.lib" location="ooxml-lib"/>
|
||||
<property name="main.reports.test" location="build/test-results"/>
|
||||
<property name="main.jar1.dir" location="${main.lib}/commons-logging-1.1.jar"/>
|
||||
<property name="main.jar1.url" value="${repository}/commons-logging/jars/commons-logging-1.1.jar"/>
|
||||
<property name="main.jar2.dir" location="${main.lib}/log4j-1.2.13.jar"/>
|
||||
<property name="main.jar2.url" value="${repository}/log4j/jars/log4j-1.2.13.jar"/>
|
||||
<property name="main.testokfile" location="build/main-testokfile.txt"/>
|
||||
|
||||
<property name="junit.jar1.dir" location="${main.lib}/junit-3.8.1.jar"/>
|
||||
<property name="junit.jar1.url" value="${repository}/junit/jars/junit-3.8.1.jar"/>
|
||||
<property name="main.commons-logging.jar" location="${main.lib}/commons-logging-1.1.jar"/>
|
||||
<property name="main.commons-logging.url" value="${repository}/commons-logging/jars/commons-logging-1.1.jar"/>
|
||||
<property name="main.log4j.jar" location="${main.lib}/log4j-1.2.13.jar"/>
|
||||
<property name="main.log4j.url" value="${repository}/log4j/jars/log4j-1.2.13.jar"/>
|
||||
<property name="main.junit.jar" location="${main.lib}/junit-3.8.1.jar"/>
|
||||
<property name="main.junit.url" value="${repository}/junit/jars/junit-3.8.1.jar"/>
|
||||
|
||||
<property name="main.testokfile" location="build/main-testokfile.txt"/>
|
||||
|
||||
<!-- Scratchpad: -->
|
||||
<property name="scratchpad.resource1.dir" value="src/resources/scratchpad"/>
|
||||
|
@ -113,7 +113,6 @@ under the License.
|
|||
<property name="examples.output.dir" location="build/examples-classes"/>
|
||||
|
||||
<!-- Common interfaces for ole2 and ooxml classes -->
|
||||
<property name="interfaces.jdk14.src" location="src/ooxml/interfaces-jdk14"/>
|
||||
<property name="interfaces.jdk15.src" location="src/ooxml/interfaces-jdk15"/>
|
||||
|
||||
<!-- Experimental OOXML support: -->
|
||||
|
@ -124,19 +123,21 @@ under the License.
|
|||
<property name="ooxml.output.test.dir" location="build/ooxml-test-classes"/>
|
||||
<property name="ooxml.testokfile" location="build/ooxml-testokfile.txt"/>
|
||||
|
||||
<property name="ooxml.jar1.dir" location="${ooxml.lib}/dom4j-1.6.1.jar"/>
|
||||
<property name="ooxml.jar1.url" value="${repository}/dom4j/jars/dom4j-1.6.1.jar"/>
|
||||
<property name="ooxml.jar2.dir" location="${ooxml.lib}/jaxen-1.1.jar"/>
|
||||
<property name="ooxml.jar2.url" value="${repository}/jaxen/jars/jaxen-1.1.jar"/>
|
||||
<property name="ooxml.jar3.dir" location="${ooxml.lib}/xercesImpl-2.8.1.jar"/>
|
||||
<property name="ooxml.jar3.url" value="${repository}/xerces/jars/xercesImpl-2.8.1.jar"/>
|
||||
<property name="ooxml.jar4.dir" location="${ooxml.lib}/xmlbeans-2.3.0.jar"/>
|
||||
<property name="ooxml.jar4.url" value="${repository}/org.apache.xmlbeans/jars/xmlbeans-2.3.0.jar"/>
|
||||
<property name="ooxml.jar5.dir" location="${ooxml.lib}/jsr173_1.0_api.jar"/>
|
||||
<property name="ooxml.jar5.url" value="${repository}/xmlbeans/jars/jsr173_1.0_api.jar"/>
|
||||
<!-- No official release of openxml4j yet -->
|
||||
<property name="ooxml.jar6.dir" location="${ooxml.lib}/openxml4j-bin-beta-080728.jar"/>
|
||||
<property name="ooxml.jar6.url" value="http://people.apache.org/~nick/openxml4j-bin-beta-080728.jar"/>
|
||||
<!-- The following jars are downloaded by the fetch-ooxml-jars task -->
|
||||
<property name="ooxml.openxml4j.jar" location="${ooxml.lib}/openxml4j-1.0-beta.jar"/>
|
||||
<property name="ooxml.openxml4j.url" value="http://people.apache.org/~nick/openxml4j-bin-beta-080728.jar"/>
|
||||
<property name="ooxml.dom4j.jar" location="${ooxml.lib}/dom4j-1.6.1.jar"/>
|
||||
<property name="ooxml.dom4j.url" value="${repository}/dom4j/jars/dom4j-1.6.1.jar"/>
|
||||
<property name="ooxml.jaxen.jar" location="${ooxml.lib}/jaxen-1.1.jar"/>
|
||||
<property name="ooxml.jaxen.url" value="${repository}/jaxen/jars/jaxen-1.1.jar"/>
|
||||
<property name="ooxml.xerces.jar" location="${ooxml.lib}/xercesImpl-2.8.1.jar"/>
|
||||
<property name="ooxml.xerces.url" value="${repository}/xerces/jars/xercesImpl-2.8.1.jar"/>
|
||||
<property name="ooxml.xmlbeans.jar" location="${ooxml.lib}/xmlbeans-2.3.0.jar"/>
|
||||
<property name="ooxml.xmlbeans.url" value="${repository}/org.apache.xmlbeans/jars/xmlbeans-2.3.0.jar"/>
|
||||
<property name="ooxml.jsr173.jar" location="${ooxml.lib}/jsr173_1.0_api.jar"/>
|
||||
<property name="ooxml.jsr173.url" value="${repository}/xmlbeans/jars/jsr173_1.0_api.jar"/>
|
||||
<property name="ooxml.schemas.jar" location="${ooxml.lib}/ooxml-schemas-1.0.jar"/>
|
||||
<property name="ooxml.schemas.url" value="${repository}/org.apache.poi/jars/ooxml-schemas-1.0.jar"/>
|
||||
|
||||
<!-- See http://www.ecma-international.org/publications/standards/Ecma-376.htm -->
|
||||
<!-- "Copy these file(s), free of charge" -->
|
||||
|
@ -145,9 +146,6 @@ under the License.
|
|||
<property name="ooxml.xsds.url" value="http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%20Part%204%20(DOCX).zip" />
|
||||
<property name="ooxml.xsds.jar" location="${ooxml.lib}/ooxml-schemas.jar"/>
|
||||
|
||||
<!--
|
||||
YK: OOXML requires two dependencies that are not in the Maven repository.
|
||||
-->
|
||||
<property name="maven.ooxml.xsds.version.id" value="1.0"/>
|
||||
<property name="maven.ooxml.xsds.jar" value="ooxml-schemas-${maven.ooxml.xsds.version.id}.jar"/>
|
||||
<property name="maven.openxml4j.version.id" value="1.0-beta"/>
|
||||
|
@ -173,22 +171,11 @@ under the License.
|
|||
description="JDK version of source code"/>
|
||||
<property name="jdk.version.class" value="1.5"
|
||||
description="JDK version of generated class files"/>
|
||||
<property name="jdk14.version.source" value="1.3"
|
||||
description="JDK version of source code, when built on JDK 1.4"/>
|
||||
<property name="jdk14.version.class" value="1.3"
|
||||
description="JDK version of generated class files, when built on JDK 1.4"/>
|
||||
|
||||
|
||||
<!-- normally use the jdk 1.5 stuff -->
|
||||
<path id="main.classpath">
|
||||
<pathelement location="${main.jar1.dir}"/>
|
||||
<pathelement location="${main.jar2.dir}"/>
|
||||
<pathelement location="${main.resource1.dir}"/>
|
||||
</path>
|
||||
|
||||
<path id="main14.classpath">
|
||||
<pathelement location="${main.jar1.dir}"/>
|
||||
<pathelement location="${main.jar2.dir}"/>
|
||||
<fileset dir="${main.lib}">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
<pathelement location="${main.resource1.dir}"/>
|
||||
</path>
|
||||
|
||||
|
@ -285,7 +272,7 @@ under the License.
|
|||
</clover-report>
|
||||
</target>
|
||||
|
||||
<target name="init" depends="check-jars,fetch-jars">
|
||||
<target name="init" depends="fetch-jars,fetch-ooxml-jars">
|
||||
|
||||
<tstamp>
|
||||
<format property="tstamp.year" pattern="yyyy"/>
|
||||
|
@ -297,7 +284,6 @@ under the License.
|
|||
<mkdir dir="build"/>
|
||||
<mkdir dir="build/non-ant-classes"/>
|
||||
<mkdir dir="${main.output.dir}"/>
|
||||
<mkdir dir="${main14.output.dir}"/>
|
||||
<mkdir dir="${scratchpad.output.dir}"/>
|
||||
<mkdir dir="${contrib.output.dir}"/>
|
||||
<mkdir dir="${examples.output.dir}"/>
|
||||
|
@ -334,40 +320,92 @@ under the License.
|
|||
<delete dir="build"/>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="testexist">
|
||||
<echo message="Testing for ${destfile}" level="debug"/>
|
||||
<available file="${destfile}" property="exist"/>
|
||||
</target>
|
||||
<target name="downloadfile" unless="exist" depends="testexist">
|
||||
<get src="${sourcefile}" dest="${destfile}" />
|
||||
</target>
|
||||
|
||||
<target name="check-jars">
|
||||
<condition property="jars.present">
|
||||
<or>
|
||||
<and>
|
||||
<available file="${main.jar1.dir}"/>
|
||||
<available file="${main.jar2.dir}"/>
|
||||
<available file="${junit.jar1.dir}"/>
|
||||
<available file="${ooxml.jar1.dir}"/>
|
||||
<available file="${ooxml.jar2.dir}"/>
|
||||
<available file="${ooxml.jar3.dir}"/>
|
||||
<available file="${ooxml.jar4.dir}"/>
|
||||
<available file="${ooxml.jar5.dir}"/>
|
||||
<available file="${ooxml.jar6.dir}"/>
|
||||
<available file="${main.commons-logging.jar}"/>
|
||||
<available file="${main.log4j.jar}"/>
|
||||
<available file="${main.junit.jar}"/>
|
||||
</and>
|
||||
<isset property="disconnected"/>
|
||||
</or>
|
||||
</condition>
|
||||
</target>
|
||||
|
||||
<target name="fetch-jars" unless="jars.present"
|
||||
description="Fetches needed JAR files from the Internet">
|
||||
<get src="${main.jar1.url}" dest="${main.jar1.dir}"/>
|
||||
<get src="${main.jar2.url}" dest="${main.jar2.dir}"/>
|
||||
<get src="${junit.jar1.url}" dest="${junit.jar1.dir}"/>
|
||||
|
||||
<get src="${ooxml.jar1.url}" dest="${ooxml.jar1.dir}"/>
|
||||
<get src="${ooxml.jar2.url}" dest="${ooxml.jar2.dir}"/>
|
||||
<get src="${ooxml.jar3.url}" dest="${ooxml.jar3.dir}"/>
|
||||
<get src="${ooxml.jar4.url}" dest="${ooxml.jar4.dir}"/>
|
||||
<get src="${ooxml.jar5.url}" dest="${ooxml.jar5.dir}"/>
|
||||
<get src="${ooxml.jar6.url}" dest="${ooxml.jar6.dir}"/>
|
||||
<target name="fetch-jars" depends="check-jars" unless="jars.present"
|
||||
description="Fetches needed JAR files from the Internet">
|
||||
<antcall target="downloadfile">
|
||||
<param name="sourcefile" value="${main.commons-logging.url}"/>
|
||||
<param name="destfile" value="${main.commons-logging.jar}"/>
|
||||
</antcall>
|
||||
<antcall target="downloadfile">
|
||||
<param name="sourcefile" value="${main.log4j.url}"/>
|
||||
<param name="destfile" value="${main.log4j.jar}"/>
|
||||
</antcall>
|
||||
<antcall target="downloadfile">
|
||||
<param name="sourcefile" value="${{main.junit.url}"/>
|
||||
<param name="destfile" value="${{main.junit.jar}"/>
|
||||
</antcall>
|
||||
</target>
|
||||
|
||||
<target name="check-ooxml-xsds">
|
||||
<target name="check-ooxml-jars">
|
||||
<condition property="ooxml.jars.present">
|
||||
<or>
|
||||
<and>
|
||||
<available file="${ooxml.dom4j.jar}"/>
|
||||
<available file="${ooxml.jaxen.jar}"/>
|
||||
<available file="${ooxml.xerces.jar}"/>
|
||||
<available file="${ooxml.xmlbeans.jar}"/>
|
||||
<available file="${ooxml.jsr173.jar}"/>
|
||||
<available file="${ooxml.schemas.jar}"/>
|
||||
<available file="${ooxml.openxml4j.jar}"/>
|
||||
</and>
|
||||
<isset property="disconnected"/>
|
||||
</or>
|
||||
</condition>
|
||||
</target>
|
||||
<target name="fetch-ooxml-jars" depends="check-ooxml-jars" unless="ooxml.jars.present">
|
||||
<antcall target="downloadfile">
|
||||
<param name="sourcefile" value="${ooxml.dom4j.url}"/>
|
||||
<param name="destfile" value="${ooxml.dom4j.jar}"/>
|
||||
</antcall>
|
||||
<antcall target="downloadfile">
|
||||
<param name="sourcefile" value="${ooxml.jaxen.url}"/>
|
||||
<param name="destfile" value="${ooxml.jaxen.jar}"/>
|
||||
</antcall>
|
||||
<antcall target="downloadfile">
|
||||
<param name="sourcefile" value="${ooxml.xerces.url}"/>
|
||||
<param name="destfile" value="${ooxml.xerces.jar}"/>
|
||||
</antcall>
|
||||
<antcall target="downloadfile">
|
||||
<param name="sourcefile" value="${ooxml.xmlbeans.url}"/>
|
||||
<param name="destfile" value="${ooxml.xmlbeans.jar}"/>
|
||||
</antcall>
|
||||
<antcall target="downloadfile">
|
||||
<param name="sourcefile" value="${ooxml.jsr173.url}"/>
|
||||
<param name="destfile" value="${ooxml.jsr173.jar}"/>
|
||||
</antcall>
|
||||
<antcall target="downloadfile">
|
||||
<param name="sourcefile" value="${ooxml.schemas.url}"/>
|
||||
<param name="destfile" value="${ooxml.schemas.jar}"/>
|
||||
</antcall>
|
||||
<antcall target="downloadfile">
|
||||
<param name="sourcefile" value="${ooxml.openxml4j.url}"/>
|
||||
<param name="destfile" value="${ooxml.openxml4j.jar}"/>
|
||||
</antcall>
|
||||
</target>
|
||||
|
||||
<target name="check-ooxml-xsds">
|
||||
<condition property="ooxml-xsds.present">
|
||||
<or>
|
||||
<and>
|
||||
|
@ -397,7 +435,7 @@ under the License.
|
|||
</condition>
|
||||
</target>
|
||||
<target name="compile-ooxml-xsds" unless="ooxml-compiled-xsds.present"
|
||||
depends="check-jars,fetch-jars,check-ooxml-xsds,fetch-ooxml-xsds,check-compiled-ooxml-xsds"
|
||||
depends="check-jars,fetch-jars"
|
||||
description="Unpacks the OOXML xsd files, and compiles them into XmlBeans">
|
||||
<taskdef name="xmlbean"
|
||||
classname="org.apache.xmlbeans.impl.tool.XMLBean"
|
||||
|
@ -445,18 +483,6 @@ under the License.
|
|||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="compile-main-14" depends="fail-unless-xslt-is-available">
|
||||
<copy todir="${main14.output.dir}">
|
||||
<fileset dir="${main.resource1.dir}"/>
|
||||
</copy>
|
||||
<javac target="${jdk14.version.class}" source="${jdk14.version.source}"
|
||||
failonerror="true" destdir="${main14.output.dir}" debug="on" fork="yes">
|
||||
<src path="${main.src}" />
|
||||
<src path="${interfaces.jdk14.src}" />
|
||||
<classpath refid="main.classpath"/>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="compile-scratchpad" depends="init,compile-main">
|
||||
<javac target="${jdk.version.class}" source="${jdk.version.source}"
|
||||
failonerror="true" destdir="${scratchpad.output.dir}" debug="on"
|
||||
|
@ -519,7 +545,7 @@ under the License.
|
|||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="compile-ooxml" depends="init, check-ooxml-xsds, fetch-ooxml-xsds, compile-ooxml-xsds, compile-main, compile-scratchpad">
|
||||
<target name="compile-ooxml" depends="init, compile-main, compile-scratchpad">
|
||||
<!-- openxml4j requires java 1.5, so so must we, for now -->
|
||||
<javac target="1.5" source="1.5"
|
||||
destdir="${ooxml.output.dir}" debug="on" srcdir="${ooxml.src}">
|
||||
|
@ -556,10 +582,6 @@ under the License.
|
|||
<javac target="${jdk.version.class}" source="${jdk.version.source}"
|
||||
failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes"
|
||||
srcdir="${main.output.dir}" />
|
||||
<javac target="${jdk14.version.class}" source="${jdk14.version.source}"
|
||||
failonerror="true" destdir="${main14.output.dir}" debug="on" fork="yes"
|
||||
srcdir="${main.output.dir}" />
|
||||
|
||||
<!-- Tidy up -->
|
||||
<delete file="${version.java}" />
|
||||
</target>
|
||||
|
@ -1000,7 +1022,7 @@ FORREST_HOME environment variable!</echo>
|
|||
<packageset dir="${contrib.src}" defaultexcludes="yes">
|
||||
<include name="org/apache/poi/**"/>
|
||||
</packageset>
|
||||
<packageset dir="${ooxml.src}" defaultexcludes="yes">
|
||||
<packageset dir="${examples.src}" defaultexcludes="yes">
|
||||
<include name="org/apache/poi/**"/>
|
||||
</packageset>
|
||||
|
||||
|
@ -1241,22 +1263,6 @@ FORREST_HOME environment variable!</echo>
|
|||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="jar-14" depends="compile-main-14, compile-version" description="Creates the jdk 1.4 only jar file">
|
||||
<jar destfile="${dist.dir}/${jar.name}-jdk14-${version.id}-${DSTAMP}.jar">
|
||||
<fileset dir="${main14.output.dir}" />
|
||||
<fileset dir="legal/" />
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${user.name}"/>
|
||||
<attribute name="Specification-Title" value="Apache POI"/>
|
||||
<attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
|
||||
<attribute name="Specification-Vendor" value="Apache"/>
|
||||
<attribute name="Implementation-Title" value="Apache POI for JDK 1.3/1.4"/>
|
||||
<attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
|
||||
<attribute name="Implementation-Vendor" value="Apache"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="jar" depends="compile, compile-version, jar-ooxml" description="Creates jar files for distribution">
|
||||
<jar destfile="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar">
|
||||
<fileset dir="${main.output.dir}" />
|
||||
|
@ -1327,7 +1333,6 @@ FORREST_HOME environment variable!</echo>
|
|||
</zipfileset>
|
||||
<zipfileset dir="${build.site}" prefix="${zipdir}/docs"/>
|
||||
<zipfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
|
||||
<zipfileset file="${dist.dir}/${jar.name}-jdk14-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
|
||||
<zipfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
|
||||
<zipfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
|
||||
<zipfileset file="${dist.dir}/${jar.name}-ooxml-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
|
||||
|
@ -1358,7 +1363,6 @@ FORREST_HOME environment variable!</echo>
|
|||
</tarfileset>
|
||||
<tarfileset dir="${build.site}" prefix="${zipdir}/docs"/>
|
||||
<tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
|
||||
<tarfileset file="${dist.dir}/${jar.name}-jdk14-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
|
||||
<tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
|
||||
<tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
|
||||
<tarfileset file="${dist.dir}/${jar.name}-ooxml-${version.id}-${DSTAMP}.jar" prefix="${zipdir}" />
|
||||
|
@ -1399,9 +1403,6 @@ FORREST_HOME environment variable!</echo>
|
|||
<antstructure output="ant.dtd"/>
|
||||
</target>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Abort the build if JUnit is missing. -->
|
||||
<target name="fail-unless-junit-is-available" depends="init">
|
||||
<condition property="isAvailable.junit">
|
||||
|
|
Loading…
Reference in New Issue