<!-- 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"/>
- <dependency prefix="dist.lz4-java" artifact="org.lz4:lz4-java:1.7.1" usage="util"/>
-
-
-
<propertyset id="junit.properties">
<propertyref name="POI.testdata.path"/>
<propertyref name="java.awt.headless"/>
<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}"/>
- <available file="${dist.lz4-java.jar}"/>
- </and>
- <isset property="disconnected"/>
- </or>
- </condition>
- </target>
- <target name="fetch-svn-jars" depends="check-svn-jars" unless="svn.jars.present">
- <!-- some jars are gone since bintray.dl is shutting down, so we started to include them in the sources for now -->
- <copy todir="lib/util">
- <fileset dir="lib.stored/" includes="*.jar"/>
- </copy>
- <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}"/>
- <downloadfile src="${dist.lz4-java.url}" dest="${dist.lz4-java.jar}"/>
- </target>
-
<target name="check-compiled-ooxml-xsds">
<condition property="ooxml-compiled-xsds.present">
<and>
<!-- 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, maventask"
+ depends="replaceVersion, compile, test-all, jar, javadocs, assemble, findbugs, release-notes, rat-check, forbidden-apis-check, help, maventask"
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">
<nexus-upload artifactId="poi-scratchpad"/>
</target>
- <macrodef name="nexus-upload">
- <attribute name="artifactId"/>
- <sequential>
- <local name="repo"/>
- <property name="repo" location="build/repo/@{artifactId}"/>
-
- <copy todir="${repo}">
- <mappedresources>
- <!-- add sha-512 when nexus rules are updated (1/2) -->
- <fileset dir="build/dist/maven" includes="@{artifactId}/**" excludes="**/*.sha512,**/*.sha256"/>
- <regexpmapper from="^([^/]+)/(.*)$$" to="org/apache/poi/\1/${version.id}/\2" handledirsep="true"/>
- </mappedresources>
- </copy>
-
- <local name="lastUpdated"/>
- <tstamp>
- <format property="lastUpdated" pattern="yyyyMMddHHmmss" timezone="UTC"/>
- </tstamp>
-
- <local name="metadir"/>
- <property name="metadir" location="${repo}/org/apache/poi/@{artifactId}"/>
-
- <echo file="${metadir}/maven-metadata.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<metadata>
- <groupId>org.apache.poi</groupId>
- <artifactId>@{artifactId}</artifactId>
- <versioning>
- <latest>${version.id}</latest>
- <release>${version.id}</release>
- <versions>
- <version>${version.id}</version>
- </versions>
- <lastUpdated>${lastUpdated}</lastUpdated>
- </versioning>
-</metadata>]]></echo>
- <fixcrlf srcdir="${metadir}" includes="maven-metadata.xml" eol="unix" eof="remove" />
- <!-- add sha-512 when nexus rules are updated (2/2) -->
- <!--checksum algorithm="SHA-512" fileext=".sha512" format="MD5SUM">
- <fileset dir="${metadir}" includes="maven-metadata.xml"/>
- </checksum-->
- <checksum algorithm="sha1" format="MD5SUM">
- <fileset dir="${metadir}" includes="maven-metadata.xml"/>
- </checksum>
- <checksum algorithm="md5" format="MD5SUM">
- <fileset dir="${metadir}" includes="maven-metadata.xml"/>
- </checksum>
-
- <fixcrlf srcDir="${metadir}" includes="*.md5,*.sha1,*.sha256,*.sha512" eol="unix"/>
-
- <downloadfile src="${dist.nexus-staging.url}" dest="${dist.nexus-staging.jar}"/>
- <taskdef uri="antlib:org.sonatype.nexus.ant.staging" resource="org/sonatype/nexus/ant/staging/antlib.xml">
- <classpath><pathelement path="${dist.nexus-staging.jar}"/></classpath>
- </taskdef>
-
- <staging:stageLocally description="@{artifactId} ${version.id}">
- <staging:nexusStagingInfo stagingDirectory="build/nexus-stage/@{artifactId}"/>
- <fileset dir="${repo}" />
- </staging:stageLocally>
-
- <!-- if this throws a "... dh keypair ..." exception, use Java 7+ for executing the task -->
- <staging:stageRemotely description="@{artifactId} ${version.id}">
- <staging:nexusStagingInfo stagingDirectory="build/nexus-stage/@{artifactId}">
- <staging:projectInfo groupId="org.apache.poi" artifactId="@{artifactId}" version="${version.id}" />
- <staging:connectionInfo baseUrl="https://repository.apache.org/">
- <staging:authentication username="${settings.apache-id.username}" password="${settings.apache-id.password}" />
- </staging:connectionInfo>
- </staging:nexusStagingInfo>
- </staging:stageRemotely>
- </sequential>
- </macrodef>
-
- <target name="-init-svn" depends="init,fetch-svn-jars,load-maven-server-settings">
- <!-- JAVA_HOME needs to point to a JRE/JDK7+, otherwise the svn/https connection throws a "Could not generate DH keypair"-->
- <fail message="Environment needs to point to Java 8+">
- <condition>
- <or>
- <equals arg1="${ant.java.version}" arg2="1.7"/>
- <equals arg1="${ant.java.version}" arg2="1.6"/>
- <equals arg1="${ant.java.version}" arg2="1.5"/>
- </or>
- </condition>
- </fail>
-
- <path id="path.svnant">
- <pathelement location="${dist.svnant.jar}"/>
- <pathelement location="${dist.svnclientadapter-base.jar}"/>
- <pathelement location="${dist.svnclientadapter-svnkit.jar}"/>
- <pathelement location="${dist.svnclientadapter-javahl.jar}"/>
- <pathelement location="${dist.svnkit.jar}"/>
- <pathelement location="${dist.svnkit-javahl16.jar}"/>
- <pathelement location="${dist.sqljet.jar}"/>
- <pathelement location="${dist.antlr.jar}"/>
- <pathelement location="${dist.sequence-library.jar}"/>
- <pathelement location="${dist.lz4-java.jar}"/>
- </path>
- <taskdef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="path.svnant"/>
-
- <svnSetting
- svnkit="true"
- javahl="false"
- username="${settings.apache-id.username}"
- password="${settings.apache-id.password}"
- id="svn.settings"
- />
- </target>
-
- <target name="release-prep0" depends="-init-svn" description="check to make sure the release tag doesn't exist yet">
- <!-- verify that svn username/password are valid ... -->
- <fail message="Unable to connect to SVN repo. Verify apache-id username and password. If these are correct, change the release-prep0 target to check over http, which would indicate a problem with your https setup.">
- <condition>
- <not><svnExists refid="svn.settings" target="https://svn.apache.org/repos/asf/poi/"/></not>
- </condition>
- </fail>
-
- <!-- verify that the release tag that we're about to create in release-prep1 does not already exist (no overwriting tags!) -->
- <fail message="Cannot create release tag. https://svn.apache.org/repos/asf/poi/tags/${RELEASE_TAG} already exists. Verify the requested release version (${version.id}).">
- <condition>
- <svnExists refid="svn.settings" target="https://svn.apache.org/repos/asf/poi/tags/${RELEASE_TAG}/"/>
- </condition>
- </fail>
- </target>
-
- <!-- experimental release preparation ... tbd. ... -->
- <target name="release-prep1" depends="-init-svn,release-prep0" description="update the documentation and create the svn tag - needs Java7+">
- <local name="tstamp_rel"/>
- <local name="tstamp_next"/>
- <local name="rel_next"/>
- <tstamp>
- <format property="tstamp_rel" pattern="yyyy-MM-dd" offset="7" unit="day"/>
- <format property="tstamp_next" pattern="yyyy-MM" offset="3" unit="month"/>
- </tstamp>
-
- <taskdef name="NextRelease" classname="NextRelease" classpath="poi-excelant/build/poi-ant-contrib"/>
- <NextRelease property="rel_next"/>
-
- <antcall target="-update-build.xml">
- <param name="version_id" value="${version.id}"/>
- </antcall>
-
- <replaceregexp byline="true">
- <regexp pattern="<release.*date=".*\?\?">"/>
- <substitution expression="<!-- release version="${rel_next}" date="${tstamp_next}-??"> </release --> <release version="${version.id}" date="${tstamp_rel}">"/>
- <fileset dir="src/documentation/content/xdocs">
- <include name="changes.xml"/>
- </fileset>
- </replaceregexp>
-
- <fixcrlf srcdir="." includes="src/documentation/content/xdocs/changes.xml" eol="unix" eof="remove" />
-
- <!-- can't combine updating and pinning of the documentation ... so we need two commits -->
- <!-- (revision)properties can't be set and read within one svn block -->
- <echo message="updating build.xml and changes.xml"/>
- <exec command="svn ci --username ${settings.apache-id.username} --password ${settings.apache-id.password} -m 'release prepare for ${version.id} - updating build.xml and changes.xml' build.xml src/documentation/content/xdocs/changes.xml"/>
- <svn refid="svn.settings">
- <!--<commit message="release prepare for ${version.id} - updating build.xml and changes.xml" recurse="false">
- <fileset dir="." includes="build.xml,src/documentation/content/xdocs/changes.xml"/>
- </commit>-->
- <update dir="." recurse="true"/>
- <status path="." revisionProperty="svn_version1"/>
- </svn>
- <echo message="pin documentation - release ${svn_version1}"/>
- <exec command="svn ci --username ${settings.apache-id.username} --password ${settings.apache-id.password} -m 'release prepare for ${version.id} - pin documentation' src"/>
- <svn refid="svn.settings">
- <propset path="src" name="svn:externals" value="documentation -r${svn_version1} https://svn.apache.org/repos/asf/poi/site/src/documentation"/>
-<!-- <commit message="release prepare for ${version.id} - pin documentation" dir="src" recurse="false"/>-->
- <update dir="." recurse="true"/>
- <status path="." revisionProperty="svn_version2"/>
- </svn>
- <echo message="create release tag"/>
- <svn refid="svn.settings">
- <copy
- srcUrl="https://svn.apache.org/repos/asf/poi/trunk"
- destUrl="https://svn.apache.org/repos/asf/poi/tags/${RELEASE_TAG}"
- message="tag r${svn_version2} as ${version.id}"/>
- </svn>
-
- <!-- update build.xml to the next snapshot version -->
- <antcall target="-update-build.xml">
- <param name="version_id" value="${rel_next}"/>
- </antcall>
-
- <!-- unpin documentation and commit next snapshot version -->
- <svn refid="svn.settings">
- <update dir="." recurse="true"/>
- <propset path="src" name="svn:externals" value="documentation https://svn.apache.org/repos/asf/poi/site/src/documentation"/>
- <!--<commit message="prepare for ${rel_next}" recurse="false">
- <fileset dir="." includes="build.xml"/>
- <dirset dir="src"/>
- </commit>-->
- </svn>
- <exec command="svn ci --username ${settings.apache-id.username} --password ${settings.apache-id.password} -m 'prepare for ${rel_next}' build.xml src poi*"/>
-
- <mkdir dir="build/release"/>
-
- <svn refid="svn.settings">
- <checkout url="https://svn.apache.org/repos/asf/poi/tags/${RELEASE_TAG}" destPath="build/release" ignoreExternals="false"/>
- </svn>
- </target>
-
- <target name="release-prep2" depends="init" description="compile the freshly checked out svn tag and upload it to the nexus - needs a JDK6">
- <!-- JAVA_HOME needs to point to a JDK8, otherwise the ant invocation is failing on a missing javac -->
- <fail message="Environment needs to point to a Java 8 JDK">
- <condition>
- <not><equals arg1="${ant.java.version}" arg2="1.8"/></not>
- </condition>
- </fail>
-
- <local name="DSTAMP"/>
- <tstamp>
- <format property="DSTAMP" pattern="yyyyMMdd" offset="7" unit="day"/>
- </tstamp>
-
- <ant dir="build/release" inheritAll="false" inheritRefs="false" useNativeBasedir="true">
- <property name="DSTAMP" value="${DSTAMP}"/>
- <target name="dist" />
- </ant>
- </target>
-
- <target name="release-prep3" depends="-init-svn" description="write the dist to the release candidate repo - needs Java7+">
- <ant dir="build/release" inheritAll="false" inheritRefs="false" useNativeBasedir="true">
- <target name="dist-nexus" />
- </ant>
-
- <svn refid="svn.settings">
- <import path="build/release/build/dist"
- url="https://dist.apache.org/repos/dist/dev/poi"
- newEntry="${version.id}-${release.rc}"
- message="release candidate POI ${version.id}"/>
- </svn>
- </target>
-
- <target name="release-finish" description="write the dist to the release candidate repo - needs Java7+">
- <!--svn refid="svn.settings">
- <update dir="." recurse="true"/>
- </svn-->
- <local name="rel_prev"/>
- <local name="file_date"/>
- <local name="file_date_iso"/>
-
- <tstamp>
- <!-- usually overwritten by a command line argument -->
- <!-- for convenience this is kept in the same format as in the release-prep call -->
- <format property="file_date" pattern="yyyyMMdd" locale="US"/>
- </tstamp>
-
-
- <taskdef name="NextRelease" classname="NextRelease" classpath="poi-excelant/build/poi-ant-contrib"/>
- <NextRelease property="rel_prev" increment="-1"/>
-
- <!-- we don't simply generate a new iso file date with tstamp,
- but potentially use the date given as an argument to ant -->
- <loadresource property="file_date_iso">
- <string>${file_date}</string>
- <filterchain>
- <replaceregex pattern="([0-9]{4})([0-9]{2})([0-9]{2})" replace="\1-\2-\3"/>
- </filterchain>
- </loadresource>
-
- <replaceregexp file="build.gradle" match="( +version += +)'[^']+'" replace="\1'${version.id}'"/>
- <replaceregexp file="poi-examples/src/main/groovy/build.gradle" match="( *compile 'org.apache.poi:[^0-9]+)([0-9.]+)'" replace="\1${rel_prev}'" byline="true"/>
- <replaceregexp file="poi-examples/src/main/scala/build.sbt" match='( *org.apache.poi.* ")[0-9.]+(.+)' replace="\1${rel_prev}\2" byline="true"/>
- <replaceregexp file="osgi/pom.xml" match="version>${rel_prev}[^<]+" replace="version>${version.id}"/>
- <replaceregexp file="doap_POI.rdf" match="<release>" replace="<release> <Version> <name>Apache POI ${rel_prev}</name> <created>${file_date_iso}</created> <revision>${rel_prev}</revision> </Version> </release> <release>"/>
- </target>
-
-
-
<target name="-update-build.xml">
<replaceregexp byline="true">
<regexp pattern="(<property name="version.id" value=")[^"]+("/>)"/>