65206 - Migrate ant / maven to gradle build

compile / jar / test of mrJars
don't include ants build.xml anymore
rename directories to match project and maven artifact names
refactor artifacts - so each project has one artifact
replace static references in hssf/dev tests with junit5 constructs, which had problems in parallel tests
increase gradle heap to 4gb because of OOM - maybe less would also work

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1888488 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2021-04-07 21:40:33 +00:00
parent 6458acb931
commit b6aee1ef6d
3647 changed files with 2127 additions and 723 deletions

View File

@ -25,6 +25,7 @@ buildscript {
} }
plugins { plugins {
id 'base'
id("org.nosphere.apache.rat") version "0.7.0" id("org.nosphere.apache.rat") version "0.7.0"
} }
@ -59,6 +60,7 @@ ant.taskdef(name: "junit",
classpath: configurations.antLibs.asPath) classpath: configurations.antLibs.asPath)
wrapper { wrapper {
// https://stackoverflow.com/a/54741656/2066598
gradleVersion = '6.8' gradleVersion = '6.8'
} }
@ -78,6 +80,7 @@ wrapper.finalizedBy adjustWrapperPropertiesFile
*/ */
allprojects { allprojects {
apply plugin: 'eclipse' apply plugin: 'eclipse'
// apply plugin: 'idea'
} }
/** /**
@ -89,6 +92,7 @@ subprojects {
//Put instructions for each sub project, but not the master //Put instructions for each sub project, but not the master
apply plugin: 'java-library' apply plugin: 'java-library'
apply plugin: 'jacoco' apply plugin: 'jacoco'
apply plugin: 'maven-publish'
version = '5.0.1-SNAPSHOT' version = '5.0.1-SNAPSHOT'
ext { ext {
@ -108,6 +112,10 @@ subprojects {
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
tasks.withType(Jar) {
duplicatesStrategy = 'fail'
}
sourceCompatibility = 1.8 sourceCompatibility = 1.8
targetCompatibility = 1.8 targetCompatibility = 1.8
@ -127,7 +135,7 @@ subprojects {
jar { jar {
manifest { manifest {
attributes 'Implementation-Title': 'Apache POI', 'Implementation-Version': version attributes 'Implementation-Title': 'Apache POI', 'Implementation-Version': project.version
} }
} }
@ -209,6 +217,56 @@ subprojects {
jenkins.dependsOn javadoc jenkins.dependsOn javadoc
jenkins.dependsOn jacocoTestReport jenkins.dependsOn jacocoTestReport
jenkins.dependsOn rat jenkins.dependsOn rat
publishing {
publications {
POI(MavenPublication) {
groupId 'org.apache.poi'
pom {
packaging = 'jar'
url = 'https://poi.apache.org/'
mailingLists {
mailingList {
name = 'POI Users List'
subscribe = 'user-subscribe@poi.apache.org'
unsubscribe = 'user-unsubscribe@poi.apache.org'
archive = 'http://mail-archives.apache.org/mod_mbox/poi-user/'
}
mailingList {
name = 'POI Developer List'
subscribe = 'dev-subscribe@poi.apache.org'
unsubscribe = 'dev-unsubscribe@poi.apache.org'
archive = 'http://mail-archives.apache.org/mod_mbox/poi-dev/'
}
}
licenses {
license {
name = 'Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
organization {
name = 'Apache Software Foundation'
url = 'http://www.apache.org/'
}
withXml {
def r = asElement()
def doc = r.getOwnerDocument()
def asl = doc.createComment(new File('../legal/HEADER').text)
// adding ASF header before root node is ignored
// doc.insertBefore(asl, doc.getDocumentElement())
r.insertBefore(asl, r.getFirstChild())
}
}
}
}
}
} }
// Make JavaDoc behave similar to Ant, i.e. be a bit more lenient // Make JavaDoc behave similar to Ant, i.e. be a bit more lenient
@ -264,6 +322,10 @@ task allJavaDoc(type: Javadoc) {
task jenkins task jenkins
jenkins.dependsOn allJavaDoc jenkins.dependsOn allJavaDoc
clean {
delete "${rootDir}/build/dist"
}
rat { rat {
// Input directory, defaults to '.' // Input directory, defaults to '.'
inputDir.set(file(".")) inputDir.set(file("."))
@ -306,3 +368,14 @@ rat {
// Prints the list of files with unapproved licences to the console, defaults to false // Prints the list of files with unapproved licences to the console, defaults to false
verbose.set(true) verbose.set(true)
} }
/*task downloadJarsToLibs() {
def f = new File("$projectDir/../lib/ooxml/xmlbeans-5.0.0.jar")
if (!f.exists()) {
println 'writing file ' + f.getAbsolutePath()
f.getParentFile().mkdirs()
new URL('https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/lastSuccessfulBuild/artifact/build/xmlbeans-5.0.0.jar').withInputStream{ i -> f.withOutputStream{ it << i }}
}
}*/
//compileJava.dependsOn 'downloadJarsToLibs'

244
build.xml
View File

@ -89,9 +89,9 @@ under the License.
<attribute name="name"/> <attribute name="name"/>
<attribute name="value"/> <attribute name="value"/>
<sequential> <sequential>
<mkdir dir="excelant/build/poi-ant-contrib"/> <mkdir dir="poi-excelant/build/poi-ant-contrib"/>
<javac srcdir="excelant/src//poi-ant-contrib/java" destdir="excelant/build/poi-ant-contrib" includeantruntime="true" excludes="Junit5Progress.java"/> <javac srcdir="poi-excelant/src//poi-ant-contrib/java" destdir="poi-excelant/build/poi-ant-contrib" includeantruntime="true" excludes="Junit5Progress.java"/>
<taskdef name="PropertyResetHelper" classname="PropertyReset" classpath="excelant/build/poi-ant-contrib"/> <taskdef name="PropertyResetHelper" classname="PropertyReset" classpath="poi-excelant/build/poi-ant-contrib"/>
<PropertyResetHelper name="@{name}" value="@{value}" /> <PropertyResetHelper name="@{name}" value="@{value}" />
</sequential> </sequential>
</macrodef> </macrodef>
@ -115,65 +115,66 @@ under the License.
<property name="tempdir" value="build/tmp"/> <property name="tempdir" value="build/tmp"/>
<!-- Main: --> <!-- Main: -->
<property name="main.resources.main" value="main/src/main/resources"/> <property name="main.resources.main" value="poi/src/main/resources"/>
<property name="main.src" location="main/src/main/java"/> <property name="main.src" location="poi/src/main/java"/>
<property name="main.src.test" location="main/src/test/java"/> <property name="main.src.test" location="poi/src/test/java"/>
<property name="main.resources.test" location="main/src/test/resources"/> <property name="main.resources.test" location="poi/src/test/resources"/>
<property name="main.documentation" value="src/documentation"/> <property name="main.documentation" value="src/documentation"/>
<property name="main.output.dir" location="main/build/classes/ant/java"/> <property name="main.output.dir" location="poi/build/classes/ant/java"/>
<property name="main.output.test.dir" location="main/build/test-classes"/> <property name="main.output.test.dir" location="poi/build/test-classes"/>
<property name="main.reports.test" location="main/build/test-results"/> <property name="main.reports.test" location="poi/build/test-results"/>
<property name="main.testokfile" location="main/build/testokfile.txt"/> <property name="main.testokfile" location="poi/build/testokfile.txt"/>
<property name="main.output.gen-sources.dir" location="main/build/generated-sources"/> <property name="main.output.gen-sources.dir" location="poi/build/generated-sources"/>
<property name="main.version.template" location="main/src/main/version/Version.java.template"/> <property name="main.version.template" location="poi/src/main/version/Version.java.template"/>
<property name="main.version.java" location="${main.output.gen-sources.dir}/org/apache/poi/Version.java"/> <property name="main.version.java" location="${main.output.gen-sources.dir}/org/apache/poi/Version.java"/>
<!-- Scratchpad: --> <!-- Scratchpad: -->
<property name="scratchpad.resources.main" value="scratchpad/src/main/resources"/> <property name="scratchpad.resources.main" value="poi-scratchpad/src/main/resources"/>
<property name="scratchpad.src" location="scratchpad/src/main/java"/> <property name="scratchpad.src" location="poi-scratchpad/src/main/java"/>
<property name="scratchpad.src.test" location="scratchpad/src/test/java"/> <property name="scratchpad.src.test" location="poi-scratchpad/src/test/java"/>
<property name="scratchpad.resources.test" location="scratchpad/src/main/resources"/> <property name="scratchpad.resources.test" location="poi-scratchpad/src/main/resources"/>
<property name="scratchpad.reports.test" location="scratchpad/build/test-results"/> <property name="scratchpad.reports.test" location="poi-scratchpad/build/test-results"/>
<property name="scratchpad.output.dir" location="scratchpad/build/classes/ant/java"/> <property name="scratchpad.output.dir" location="poi-scratchpad/build/classes/ant/java"/>
<property name="scratchpad.output.test.dir" location="scratchpad/build/test-classes"/> <property name="scratchpad.output.test.dir" location="poi-scratchpad/build/test-classes"/>
<property name="scratchpad.testokfile" location="scratchpad/build/testokfile.txt"/> <property name="scratchpad.testokfile" location="poi-scratchpad/build/testokfile.txt"/>
<!-- Examples: --> <!-- Examples: -->
<property name="examples.src" location="examples/src/main/java"/> <property name="examples.src" location="poi-examples/src/main/java"/>
<property name="examples.output.dir" location="examples/build/classes/ant/java"/> <property name="examples.output.dir" location="poi-examples/build/classes/ant/java"/>
<!-- OOXML support: --> <!-- OOXML support: -->
<property name="ooxml.src" location="ooxml/src/main/java"/> <property name="ooxml.src" location="poi-ooxml/src/main/java"/>
<property name="ooxml.resources.main" value="ooxml/src/main/resources"/> <property name="ooxml.resources.main" value="poi-ooxml/src/main/resources"/>
<property name="ooxml.src.test" location="ooxml/src/test/java"/> <property name="ooxml.src.test" location="poi-ooxml/src/test/java"/>
<property name="ooxml.resources.test" location="ooxml/src/test/resources"/> <property name="ooxml.resources.test" location="poi-ooxml/src/test/resources"/>
<property name="ooxml.reports.test" location="ooxml/build/test-results"/> <property name="ooxml.reports.test" location="poi-ooxml/build/test-results"/>
<property name="ooxml.output.dir" location="ooxml/build/classes/ant/java"/> <property name="ooxml.output.dir" location="poi-ooxml/build/classes/ant/java"/>
<property name="ooxml.output.test.dir" location="ooxml/build/test-classes"/> <property name="ooxml.output.test.dir" location="poi-ooxml/build/test-classes"/>
<property name="ooxml.testokfile" location="ooxml/build/testokfile.txt"/> <property name="ooxml.testokfile" location="poi-ooxml/build/testokfile.txt"/>
<property name="ooxml.lite.agent" location="lib/ooxml-tests/ooxml-lite-agent.jar"/> <property name="ooxml.lite.agent" location="build/dist/maven/poi-ooxml-lite-agent/poi-ooxml-lite-agent-${version.id}.jar"/>
<property name="ooxml.lite.report" location="ooxml-schema/build/ooxml-lite-report"/> <property name="ooxml.lite.report" location="build/ooxml-lite-report"/>
<property name="ooxml.lite.jar" location="build/dist/maven/poi-ooxml-lite/poi-ooxml-lite-${version.id}.jar"/> <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)"/> <property name="ooxml.lite.includes" value="^(com/microsoft/schemas|org/(etsi|openxmlformats|w3/)|org/apache/poi/schemas)"/>
<property name="ooxml.lite.output.dir" location="poi-ooxml-lite-agent/build/classes/ant/java"/>
<!-- Integration testing: --> <!-- Integration testing: -->
<property name="integration.src.test" location="integrationtest/src/test/java"/> <property name="integration.src.test" location="poi-integration/src/test/java"/>
<property name="integration.resources.test" location="integrationtest/src/test/resources"/> <property name="integration.resources.test" location="poi-integration/src/test/resources"/>
<property name="integration.reports.test" location="integrationtest/build/test-results"/> <property name="integration.reports.test" location="poi-integration/build/test-results"/>
<property name="integration.output.test.dir" location="integrationtest/build/test-classes"/> <property name="integration.output.test.dir" location="poi-integration/build/test-classes"/>
<property name="integration.testokfile" location="integrationtest/build/testokfile.txt"/> <property name="integration.testokfile" location="poi-integration/build/testokfile.txt"/>
<!-- Excelant: --> <!-- Excelant: -->
<property name="excelant.resource.main" value="excelant/src/main/resources"/> <property name="excelant.resource.main" value="poi-excelant/src/main/resources"/>
<property name="excelant.src" location="excelant/src/main/java"/> <property name="excelant.src" location="poi-excelant/src/main/java"/>
<property name="excelant.src.test" location="excelant/src/test/java"/> <property name="excelant.src.test" location="poi-excelant/src/test/java"/>
<property name="excelant.resources.test" location="excelant/src/test/resources"/> <property name="excelant.resources.test" location="poi-excelant/src/test/resources"/>
<property name="excelant.reports.test" location="excelant/build/test-results"/> <property name="excelant.reports.test" location="poi-excelant/build/test-results"/>
<property name="excelant.output.dir" location="excelant/build/classes/ant/java"/> <property name="excelant.output.dir" location="poi-excelant/build/classes/ant/java"/>
<property name="excelant.output.test.dir" location="excelant/build/test-classes"/> <property name="excelant.output.test.dir" location="poi-excelant/build/test-classes"/>
<property name="excelant.testokfile" location="excelant/build/testokfile.txt"/> <property name="excelant.testokfile" location="poi-excelant/build/testokfile.txt"/>
<macrodef name="dependency"> <macrodef name="dependency">
<attribute name="prefix"/> <attribute name="prefix"/>
@ -347,21 +348,21 @@ under the License.
<!-- See https://www.ecma-international.org/publications/standards/Ecma-376.htm --> <!-- See https://www.ecma-international.org/publications/standards/Ecma-376.htm -->
<!-- "Copy these file(s), free of charge" --> <!-- "Copy these file(s), free of charge" -->
<property name="ooxml-schema.output.dir" location="ooxml-schema/build/classes/ant/java"/> <property name="ooxml-schema.output.dir" location="poi-ooxml-full/build/classes/ant/java"/>
<property name="ooxml-schema.output.test.dir" location="ooxml-schema/build/test-classes"/> <property name="ooxml-schema.output.test.dir" location="poi-ooxml-full/build/test-classes"/>
<property name="ooxml-schema.output.gen-sources.dir" location="ooxml-schema/build/generated-sources"/> <property name="ooxml-schema.output.gen-sources.dir" location="poi-ooxml-full/build/generated-sources"/>
<property name="ooxml-schema.output.gen-classes.dir" location="ooxml-schema/build/generated-classes"/> <property name="ooxml-schema.output.gen-classes.dir" location="poi-ooxml-full/build/generated-classes"/>
<property name="ooxml.xsds.izip.1" value="${basedir}/ooxml-schema/src/main/xmlschema/org/apache/poi/schemas/OfficeOpenXML-XMLSchema-Transitional.zip"/> <property name="ooxml.xsds.izip.1" value="${basedir}/poi-ooxml-full/src/main/xmlschema/org/apache/poi/schemas/OfficeOpenXML-XMLSchema-Transitional.zip"/>
<property name="ooxml.xsds.src.dir" location="ooxml-schema/build/xsds"/> <property name="ooxml.xsds.src.dir" location="poi-ooxml-full/build/xsds"/>
<property name="ooxml.xsds.src.jar" location="build/dist/maven/poi-ooxml-full/poi-ooxml-full-${version.id}-sources.jar"/> <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"/> <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, --> <!-- 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 --> <!-- so we don't have to care about a separate versioning of the original ooxml schemas -->
<property name="ooxml.xsds.izip.2" value="${basedir}/ooxml-schema/src/main/xmlschema/org/apache/poi/schemas/OpenPackagingConventions-XMLSchema.zip"/> <property name="ooxml.xsds.izip.2" value="${basedir}/poi-ooxml-full/src/main/xmlschema/org/apache/poi/schemas/OpenPackagingConventions-XMLSchema.zip"/>
<property name="ooxml.security.xsd.dir" location="ooxml-schema/src/main/xmlschema/org/apache/poi/poifs/crypt"/> <property name="ooxml.security.xsd.dir" location="poi-ooxml-full/src/main/xmlschema/org/apache/poi/poifs/crypt"/>
<property name="ooxml.visio.xsd.dir" location="ooxml-schema/src/main/xmlschema/org/apache/poi/xdgf"/> <property name="ooxml.visio.xsd.dir" location="poi-ooxml-full/src/main/xmlschema/org/apache/poi/xdgf"/>
<property name="ooxml.schema.xsdconfig.dir" location="ooxml-schema/src/main/xmlschema/org/apache/poi/schemas"/> <property name="ooxml.schema.xsdconfig.dir" location="poi-ooxml-full/src/main/xmlschema/org/apache/poi/schemas"/>
<!-- Coverage --> <!-- Coverage -->
<property name="coverage.dir" value="build/coverage"/> <property name="coverage.dir" value="build/coverage"/>
@ -623,13 +624,13 @@ under the License.
<target name="clean" description="Remove generated artefacts"> <target name="clean" description="Remove generated artefacts">
<delete dir="build"/> <delete dir="build"/>
<delete dir="examples/build"/> <delete dir="poi-examples/build"/>
<delete dir="excelant/build"/> <delete dir="poi-excelant/build"/>
<delete dir="integrationtest/build"/> <delete dir="poi-integration/build"/>
<delete dir="main/build"/> <delete dir="poi/build"/>
<delete dir="ooxml/build"/> <delete dir="poi-ooxml/build"/>
<delete dir="ooxml-schema/build"/> <delete dir="poi-ooxml-full/build"/>
<delete dir="scratchpad/build"/> <delete dir="poi-scratchpad/build"/>
<delete includeemptydirs="true"> <delete includeemptydirs="true">
<fileset dir="sonar"> <fileset dir="sonar">
<include name="*/target/**"/> <include name="*/target/**"/>
@ -972,8 +973,8 @@ under the License.
</javac> </javac>
<javac release="9" <javac release="9"
srcdir="${basedir}/ooxml-schema/src/ooxml-full/java9" srcdir="${basedir}/poi-ooxml-full/src/main/java9"
destdir="${basedir}/ooxml-schema/src/ooxml-full/java9" destdir="${basedir}/poi-ooxml-full/src/main/java9"
includeantruntime="false" includeantruntime="false"
fork="true" fork="true"
modulepath="lib/ooxml" modulepath="lib/ooxml"
@ -986,8 +987,8 @@ under the License.
<jar destfile="${ooxml.xsds.jar}"> <jar destfile="${ooxml.xsds.jar}">
<fileset dir="${ooxml-schema.output.dir}"/> <fileset dir="${ooxml-schema.output.dir}"/>
<fileset dir="${ooxml-schema.output.gen-classes.dir}"/> <fileset dir="${ooxml-schema.output.gen-classes.dir}"/>
<zipfileset dir="${basedir}/ooxml-schema/src/ooxml-full/java9" prefix="META-INF/versions/9" excludes="*.java"/> <zipfileset dir="${basedir}/poi-ooxml-full/src/main/java9" prefix="META-INF/versions/9" excludes="*.java"/>
<metainf dir="legal/"/> <metainf dir="legal/" excludes="HEADER"/>
<manifest> <manifest>
<attribute name="Multi-Release" value="true"/> <attribute name="Multi-Release" value="true"/>
<attribute name="Automatic-Module-Name" value="org.apache.poi.ooxml.schemas"/> <attribute name="Automatic-Module-Name" value="org.apache.poi.ooxml.schemas"/>
@ -1004,8 +1005,8 @@ under the License.
<jar destfile="${ooxml.xsds.src.jar}"> <jar destfile="${ooxml.xsds.src.jar}">
<fileset dir="${ooxml-schema.output.gen-sources.dir}"/> <fileset dir="${ooxml-schema.output.gen-sources.dir}"/>
<zipfileset dir="${basedir}/ooxml-schema/src/ooxml-full/java9" prefix="META-INF/versions/9/" excludes="*.class"/> <zipfileset dir="${basedir}/poi-ooxml-full/src/main/java9" prefix="META-INF/versions/9/" excludes="*.class"/>
<metainf dir="legal"/> <metainf dir="legal" excludes="HEADER"/>
</jar> </jar>
</target> </target>
@ -1039,7 +1040,7 @@ under the License.
<string>@{module}</string> <string>@{module}</string>
<filterchain> <filterchain>
<prefixlines prefix="poi-"/> <prefixlines prefix="poi-"/>
<replacestring from="poi-main" to="poi"/> <replacestring from="poi-poi" to="poi"/>
</filterchain> </filterchain>
</loadresource> </loadresource>
@ -1080,7 +1081,7 @@ under the License.
<zipfileset dir="${basedir}/@{module}/src/main/java9" <zipfileset dir="${basedir}/@{module}/src/main/java9"
prefix="META-INF/versions/9" prefix="META-INF/versions/9"
excludes="*.java"/> excludes="*.java"/>
<metainf dir="legal/"/> <metainf dir="legal/" excludes="HEADER"/>
<manifest> <manifest>
<attribute name="Multi-Release" value="true"/> <attribute name="Multi-Release" value="true"/>
<attribute name="Automatic-Module-Name" value="org.apache.poi.@{module}"/> <attribute name="Automatic-Module-Name" value="org.apache.poi.@{module}"/>
@ -1139,7 +1140,7 @@ under the License.
<resources/> <resources/>
<test-resources/> <test-resources/>
<zipfileset dir="${basedir}/@{module}/src/test/java9" prefix="META-INF/versions/9" excludes="*.java"/> <zipfileset dir="${basedir}/@{module}/src/test/java9" prefix="META-INF/versions/9" excludes="*.java"/>
<metainf dir="legal/"/> <metainf dir="legal/" excludes="HEADER"/>
<manifest> <manifest>
<attribute name="Multi-Release" value="true"/> <attribute name="Multi-Release" value="true"/>
<attribute name="Automatic-Module-Name" value="org.apache.poi.@{module}"/> <attribute name="Automatic-Module-Name" value="org.apache.poi.@{module}"/>
@ -1157,7 +1158,7 @@ under the License.
<!-- create the sources jar --> <!-- create the sources jar -->
<jar destfile="build/dist/maven/${maven-name}/${maven-name}-@{version}-sources.jar"> <jar destfile="build/dist/maven/${maven-name}/${maven-name}-@{version}-sources.jar">
<fileset dir="@{java}"/> <fileset dir="@{java}"/>
<metainf dir="legal/"/> <metainf dir="legal/" excludes="HEADER"/>
<manifest> <manifest>
<attribute name="Built-By" value="${user.name}"/> <attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Title" value="Apache POI"/> <attribute name="Specification-Title" value="Apache POI"/>
@ -1173,12 +1174,13 @@ under the License.
</macrodef> </macrodef>
<target name="compile-main" depends="init, compile-version"> <target name="compile-main" depends="init, compile-version">
<compile-jar module="main" <compile-jar module="poi"
java="${main.src}" classes="${main.output.dir}" java="${main.src}" classes="${main.output.dir}"
test="${main.src.test}" test-classes="${main.output.test.dir}"> test="${main.src.test}" test-classes="${main.output.test.dir}">
<lib> <lib>
<pathelement path="lib/main"/> <pathelement path="lib/main"/>
<pathelement path="lib/main-tests"/> <pathelement path="lib/main-tests"/>
<pathelement path="lib/excelant"/>
</lib> </lib>
<resources> <resources>
<fileset dir="${main.resources.main}"/> <fileset dir="${main.resources.main}"/>
@ -1190,7 +1192,7 @@ under the License.
</target> </target>
<target name="compile-scratchpad" depends="compile-main"> <target name="compile-scratchpad" depends="compile-main">
<compile-jar module="scratchpad" <compile-jar module="poi-scratchpad"
java="${scratchpad.src}" classes="${scratchpad.output.dir}" java="${scratchpad.src}" classes="${scratchpad.output.dir}"
test="${scratchpad.src.test}" test-classes="${scratchpad.output.test.dir}"> test="${scratchpad.src.test}" test-classes="${scratchpad.output.test.dir}">
<lib> <lib>
@ -1208,7 +1210,7 @@ under the License.
</target> </target>
<target name="compile-examples" depends="compile-main,compile-scratchpad,compile-ooxml"> <target name="compile-examples" depends="compile-main,compile-scratchpad,compile-ooxml">
<compile-jar module="examples" <compile-jar module="poi-examples"
java="${examples.src}" classes="${examples.output.dir}"> java="${examples.src}" classes="${examples.output.dir}">
<lib> <lib>
<pathelement path="build/dist/maven/poi-ooxml-full"/> <pathelement path="build/dist/maven/poi-ooxml-full"/>
@ -1222,7 +1224,7 @@ under the License.
</target> </target>
<target name="compile-ooxml" depends="compile-main,compile-scratchpad,compile-ooxml-xsds"> <target name="compile-ooxml" depends="compile-main,compile-scratchpad,compile-ooxml-xsds">
<compile-jar module="ooxml" <compile-jar module="poi-ooxml"
java="${ooxml.src}" classes="${ooxml.output.dir}" java="${ooxml.src}" classes="${ooxml.output.dir}"
test="${ooxml.src.test}" test-classes="${ooxml.output.test.dir}"> test="${ooxml.src.test}" test-classes="${ooxml.output.test.dir}">
<lib> <lib>
@ -1242,9 +1244,21 @@ under the License.
</compile-jar> </compile-jar>
<!-- create ooxml-lite-agent jar --> <!-- create ooxml-lite-agent jar -->
<mkdir dir="${ooxml.lite.output.dir}"/>
<javac release="8"
srcdir="${basedir}/poi-ooxml-lite-agent/src/main/java"
destdir="${ooxml.lite.output.dir}"
includeantruntime="false"
fork="true">
<classpath>
<fileset dir="${basedir}/lib/main-tests" includes="*.jar"/>
<fileset dir="${basedir}/lib/ooxml" includes="*.jar"/>
</classpath>
</javac>
<javac release="9" <javac release="9"
srcdir="${basedir}/ooxml/src/ooxml-lite-agent/java9" srcdir="${basedir}/poi-ooxml-lite-agent/src/main/java9"
destdir="${basedir}/ooxml/src/ooxml-lite-agent/java9" destdir="${basedir}/poi-ooxml-lite-agent/src/main/java9"
includeantruntime="false" includeantruntime="false"
fork="true" fork="true"
modulepath="${basedir}/lib/main-tests" modulepath="${basedir}/lib/main-tests"
@ -1253,8 +1267,8 @@ under the License.
</javac> </javac>
<jar destfile="${ooxml.lite.agent}"> <jar destfile="${ooxml.lite.agent}">
<fileset dir="${ooxml.output.test.dir}" includes="org/apache/poi/ooxml/lite/**"/> <fileset dir="${ooxml.lite.output.dir}"/>
<zipfileset dir="${basedir}/ooxml/src/ooxml-lite-agent/java9" prefix="META-INF/versions/9" excludes="*.java"/> <zipfileset dir="${basedir}/poi-ooxml-lite-agent/src/main/java9" prefix="META-INF/versions/9" excludes="*.java"/>
<manifest> <manifest>
<attribute name="Multi-Release" value="true"/> <attribute name="Multi-Release" value="true"/>
<attribute name="Automatic-Module-Name" value="org.apache.poi.ooxml_lite"/> <attribute name="Automatic-Module-Name" value="org.apache.poi.ooxml_lite"/>
@ -1304,8 +1318,8 @@ under the License.
</path> </path>
<mkdir dir="excelant/build/poi-ant-contrib"/> <mkdir dir="poi-excelant/build/poi-ant-contrib"/>
<javac srcdir="excelant/src/poi-ant-contrib/java" destdir="excelant/build/poi-ant-contrib" <javac srcdir="poi-excelant/src/poi-ant-contrib/java" destdir="poi-excelant/build/poi-ant-contrib"
includeantruntime="true" includes="Junit5Progress.java" classpathref="junit-jars"/> includeantruntime="true" includes="Junit5Progress.java" classpathref="junit-jars"/>
@ -1340,7 +1354,7 @@ under the License.
<classpath> <classpath>
<path refid="junit-jars" if:true="${isJava8}"/> <path refid="junit-jars" if:true="${isJava8}"/>
<fileset dir="${basedir}" includes="${cp_java}" if:true="${isJava8}"/> <fileset dir="${basedir}" includes="${cp_java}" if:true="${isJava8}"/>
<pathelement location="excelant/build/poi-ant-contrib"/> <pathelement location="poi-excelant/build/poi-ant-contrib"/>
</classpath> </classpath>
<testclasses outputDir="@{outputDir}"> <testclasses outputDir="@{outputDir}">
@ -1414,7 +1428,7 @@ under the License.
</target> </target>
<target name="compile-excelant" depends="compile-main,compile-ooxml"> <target name="compile-excelant" depends="compile-main,compile-ooxml">
<compile-jar module="excelant" <compile-jar module="poi-excelant"
java="${excelant.src}" classes="${excelant.output.dir}" java="${excelant.src}" classes="${excelant.output.dir}"
test="${excelant.src.test}" test-classes="${excelant.output.test.dir}"> test="${excelant.src.test}" test-classes="${excelant.output.test.dir}">
<lib> <lib>
@ -1459,7 +1473,7 @@ under the License.
<mkdir dir="${integration.output.test.dir}/META-INF/versions/9"/> <mkdir dir="${integration.output.test.dir}/META-INF/versions/9"/>
<javac release="9" <javac release="9"
srcdir="${basedir}/integrationtest/src/test/java9" srcdir="${basedir}/poi-integration/src/test/java9"
destdir="${integration.output.test.dir}/META-INF/versions/9" destdir="${integration.output.test.dir}/META-INF/versions/9"
includeantruntime="false" includeantruntime="false"
fork="true" fork="true"
@ -1478,20 +1492,20 @@ under the License.
</modulepath> </modulepath>
</javac> </javac>
<manifest file="integrationtest/build/poi-manifest.mf"> <manifest file="poi-integration/build/poi-manifest.mf">
<attribute name="Multi-Release" value="true"/> <attribute name="Multi-Release" value="true"/>
<attribute name="Automatic-Module-Name" value="org.apache.poi.stress"/> <attribute name="Automatic-Module-Name" value="org.apache.poi.stress"/>
</manifest> </manifest>
<jar destfile="build/dist/maven/poi-integration/poi-integration-${version.id}.jar" <jar destfile="build/dist/maven/poi-integration/poi-integration-${version.id}.jar"
basedir="${integration.output.test.dir}" basedir="${integration.output.test.dir}"
manifest="integrationtest/build/poi-manifest.mf"/> manifest="poi-integration/build/poi-manifest.mf"/>
</target> </target>
<target name="-version-java-check"> <target name="-version-java-check">
<!-- recompile Version.java from the template whenever source or the version in build.xml changes --> <!-- 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"> <uptodate property="version.java.notRequired" targetfile="${main.output.dir}/org/apache/poi/Version.class">
<srcfiles file="main/src/main/version/Version.java.template"/> <srcfiles file="poi/src/main/version/Version.java.template"/>
<srcfiles file="build.xml"/> <srcfiles file="build.xml"/>
</uptodate> </uptodate>
</target> </target>
@ -1821,7 +1835,7 @@ under the License.
<local name="full.schema"/> <local name="full.schema"/>
<loadresource property="full.schema"> <loadresource property="full.schema">
<file file="${basedir}/ooxml-schema/src/ooxml-full/java9/module-info.java"/> <file file="${basedir}/poi-ooxml-full/src/main/java9/module-info.java"/>
<filterchain> <filterchain>
<linecontains negate="true" matchany="true"> <linecontains negate="true" matchany="true">
<contains value="exports"/> <contains value="exports"/>
@ -1830,11 +1844,11 @@ under the License.
</filterchain> </filterchain>
</loadresource> </loadresource>
<echo output="${basedir}/ooxml-schema/src/ooxml-lite/java9/module-info.java">${full.schema}${lite.exports}}</echo> <echo output="${basedir}/poi-ooxml-lite/src/main/java9/module-info.java">${full.schema}${lite.exports}}</echo>
<javac release="9" <javac release="9"
srcdir="${basedir}/ooxml-schema/src/ooxml-lite/java9" srcdir="${basedir}/poi-ooxml-lite/src/main/java9"
destdir="${basedir}/ooxml-schema/src/ooxml-lite/java9" destdir="${basedir}/poi-ooxml-lite/src/main/java9"
includeantruntime="false" includeantruntime="false"
fork="true" fork="true"
unless:true="${isJava8}"> unless:true="${isJava8}">
@ -1869,7 +1883,7 @@ under the License.
<mkdir dir="build/dist/maven/poi-ooxml-lite"/> <mkdir dir="build/dist/maven/poi-ooxml-lite"/>
<jar destfile="${ooxml.lite.jar}" duplicate="fail"> <jar destfile="${ooxml.lite.jar}" duplicate="fail">
<zipfileset dir="${basedir}/ooxml-schema/src/ooxml-lite/java9" prefix="META-INF/versions/9" excludes="*.java"/> <zipfileset dir="${basedir}/poi-ooxml-lite/src/main/java9" prefix="META-INF/versions/9" excludes="*.java"/>
<zipfileset src="${ooxml.xsds.jar}"> <zipfileset src="${ooxml.xsds.jar}">
<patternset> <patternset>
<includesfile name="${ooxml.lite.report}.clazz1"/> <includesfile name="${ooxml.lite.report}.clazz1"/>
@ -2185,7 +2199,7 @@ under the License.
<jar destfile="build/dist/maven/${destfile}.jar"> <jar destfile="build/dist/maven/${destfile}.jar">
<fileset dir="@{src}" unless:true="${isjar}"/> <fileset dir="@{src}" unless:true="${isjar}"/>
<zipfileset src="@{src}" if:true="${isjar}"/> <zipfileset src="@{src}" if:true="${isjar}"/>
<metainf dir="legal/"/> <metainf dir="legal/" excludes="HEADER"/>
<manifest> <manifest>
<attribute name="Multi-Release" value="true"/> <attribute name="Multi-Release" value="true"/>
<attribute name="Automatic-Module-Name" value="org.apache.poi.@{module}"/> <attribute name="Automatic-Module-Name" value="org.apache.poi.@{module}"/>
@ -2261,7 +2275,7 @@ under the License.
<jar destfile="${dist.dir}/maven/@{dest}/@{dest}-${version.id}-javadoc.jar" <jar destfile="${dist.dir}/maven/@{dest}/@{dest}-${version.id}-javadoc.jar"
manifest="build/poi-manifest.mf"> manifest="build/poi-manifest.mf">
<fileset dir="${build.maven.javadocs}"/> <fileset dir="${build.maven.javadocs}"/>
<metainf dir="legal/"/> <metainf dir="legal/" excludes="HEADER"/>
</jar> </jar>
</sequential> </sequential>
</macrodef> </macrodef>
@ -2280,7 +2294,7 @@ under the License.
<property name="zipdir" value="${jar.name}-${version.id}"/> <property name="zipdir" value="${jar.name}-${version.id}"/>
<mappedresources id="legal-files" cache="true"> <mappedresources id="legal-files" cache="true">
<fileset dir="legal"/> <fileset dir="legal" excludes="HEADER"/>
<globmapper from="*" to="${zipdir}/*"/> <globmapper from="*" to="${zipdir}/*"/>
</mappedresources> </mappedresources>
@ -2340,7 +2354,7 @@ under the License.
scripts/**, scripts/**,
TEST*, TEST*,
*.ipr, *.ipr,
*.iml, **/*.iml,
*.iws, *.iws,
*.lnk, *.lnk,
*.rdf, *.rdf,
@ -2437,24 +2451,24 @@ under the License.
uri="antlib:org.apache.rat.anttasks" uri="antlib:org.apache.rat.anttasks"
classpath="${rat.jar}" /> classpath="${rat.jar}" />
<rat:report xmlns:rat="antlib:org.apache.rat.anttasks" reportFile="${rat.report}"> <rat:report xmlns:rat="antlib:org.apache.rat.anttasks" reportFile="${rat.report}">
<fileset dir="examples/src" excludes="main/java/org/apache/poi/**/*-chart-data.txt"/> <fileset dir="poi-examples/src" excludes="main/java/org/apache/poi/**/*-chart-data.txt"/>
<fileset dir="excelant/src"/> <fileset dir="poi-excelant/src"/>
<fileset dir="integrationtest/src"/> <fileset dir="poi-integration/src"/>
<fileset dir="main/src"> <fileset dir="poi/src">
<exclude name="main/resources/org/apache/poi/sl/draw/geom/presetShapeDefinitions.xml" /> <exclude name="main/resources/org/apache/poi/sl/draw/geom/presetShapeDefinitions.xml" />
</fileset> </fileset>
<fileset dir="ooxml/src"> <fileset dir="poi-ooxml/src">
<exclude name="main/resources/org/apache/poi/xslf/usermodel/notesMaster.xml" /> <exclude name="main/resources/org/apache/poi/xslf/usermodel/notesMaster.xml" />
<exclude name="main/resources/org/apache/poi/xslf/usermodel/empty.pptx" /> <exclude name="main/resources/org/apache/poi/xslf/usermodel/empty.pptx" />
<exclude name="main/resources/org/apache/poi/xssf/usermodel/presetTableStyles.xml" /> <exclude name="main/resources/org/apache/poi/xssf/usermodel/presetTableStyles.xml" />
</fileset> </fileset>
<fileset dir="ooxml-schema/src"> <fileset dir="poi-ooxml-full/src">
<exclude name="main/xmlschema/org/apache/poi/xdgf/visio.xsd" /> <exclude name="main/xmlschema/org/apache/poi/xdgf/visio.xsd" />
<exclude name="main/xmlschema/org/apache/poi/schemas/XAdES*.xsd" /> <exclude name="main/xmlschema/org/apache/poi/schemas/XAdES*.xsd" />
<exclude name="main/xmlschema/org/apache/poi/schemas/xmldsig-core-schema.xsd" /> <exclude name="main/xmlschema/org/apache/poi/schemas/xmldsig-core-schema.xsd" />
<exclude name="main/xmlschema/org/apache/poi/schemas/*.zip" /> <exclude name="main/xmlschema/org/apache/poi/schemas/*.zip" />
</fileset> </fileset>
<fileset dir="scratchpad/src"/> <fileset dir="poi-scratchpad/src"/>
<fileset dir="src"> <fileset dir="src">
<exclude name="documentation/*.txt" /> <exclude name="documentation/*.txt" />
@ -2690,11 +2704,11 @@ under the License.
<auxClasspath path="${pdf.pdfbox.jar}"/> <auxClasspath path="${pdf.pdfbox.jar}"/>
<auxClasspath path="${pdf.fontbox.jar}"/> <auxClasspath path="${pdf.fontbox.jar}"/>
<auxClasspath path="${pdf.graphics2d.jar}"/> <auxClasspath path="${pdf.graphics2d.jar}"/>
<sourcePath path="main/src/main/java" /> <sourcePath path="poi/src/main/java" />
<sourcePath path="excelant/src/main/java" /> <sourcePath path="poi-excelant/src/main/java" />
<sourcePath path="examples/src/main/java" /> <sourcePath path="poi-examples/src/main/java" />
<sourcePath path="ooxml/src/main/java" /> <sourcePath path="poi-ooxml/src/main/java" />
<sourcePath path="scratchpad/src/main/java" /> <sourcePath path="poi-scratchpad/src/main/java" />
</spotbugs> </spotbugs>
<!-- instead of calling findbugs again, we simply transform the xml --> <!-- instead of calling findbugs again, we simply transform the xml -->
@ -2920,7 +2934,7 @@ under the License.
<format property="tstamp_next" pattern="yyyy-MM" offset="3" unit="month"/> <format property="tstamp_next" pattern="yyyy-MM" offset="3" unit="month"/>
</tstamp> </tstamp>
<taskdef name="NextRelease" classname="NextRelease" classpath="excelant/build/poi-ant-contrib"/> <taskdef name="NextRelease" classname="NextRelease" classpath="poi-excelant/build/poi-ant-contrib"/>
<NextRelease property="rel_next"/> <NextRelease property="rel_next"/>
<antcall target="-update-build.xml"> <antcall target="-update-build.xml">
@ -3044,7 +3058,7 @@ under the License.
</tstamp> </tstamp>
<taskdef name="NextRelease" classname="NextRelease" classpath="excelant/build/poi-ant-contrib"/> <taskdef name="NextRelease" classname="NextRelease" classpath="poi-excelant/build/poi-ant-contrib"/>
<NextRelease property="rel_prev" increment="-1"/> <NextRelease property="rel_prev" increment="-1"/>
<!-- we don't simply generate a new iso file date with tstamp, <!-- we don't simply generate a new iso file date with tstamp,
@ -3057,8 +3071,8 @@ under the License.
</loadresource> </loadresource>
<replaceregexp file="build.gradle" match="( +version += +)'[^']+'" replace="\1'${version.id}'"/> <replaceregexp file="build.gradle" match="( +version += +)'[^']+'" replace="\1'${version.id}'"/>
<replaceregexp file="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/groovy/build.gradle" match="( *compile 'org.apache.poi:[^0-9]+)([0-9.]+)'" replace="\1${rel_prev}'" byline="true"/>
<replaceregexp file="examples/src/main/scala/build.sbt" match='( *org.apache.poi.* ")[0-9.]+(.+)' replace="\1${rel_prev}\2" 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}[^&lt;]+" replace="version>${version.id}"/> <replaceregexp file="osgi/pom.xml" match="version>${rel_prev}[^&lt;]+" replace="version>${version.id}"/>
<replaceregexp file="doap_POI.rdf" match="&lt;release&gt;" replace="&lt;release&gt;&#10; &lt;Version&gt;&#10; &lt;name&gt;Apache POI ${rel_prev}&lt;/name&gt;&#10; &lt;created&gt;${file_date_iso}&lt;/created&gt;&#10; &lt;revision&gt;${rel_prev}&lt;/revision&gt;&#10; &lt;/Version&gt;&#10; &lt;/release&gt;&#10; &lt;release&gt;"/> <replaceregexp file="doap_POI.rdf" match="&lt;release&gt;" replace="&lt;release&gt;&#10; &lt;Version&gt;&#10; &lt;name&gt;Apache POI ${rel_prev}&lt;/name&gt;&#10; &lt;created&gt;${file_date_iso}&lt;/created&gt;&#10; &lt;revision&gt;${rel_prev}&lt;/revision&gt;&#10; &lt;/Version&gt;&#10; &lt;/release&gt;&#10; &lt;release&gt;"/>
@ -3146,7 +3160,7 @@ under the License.
</filterchain> </filterchain>
</loadfile> </loadfile>
<taskdef name="bytes2mega" classname="Bytes2Mega" classpath="excelant/build/poi-ant-contrib"/> <taskdef name="bytes2mega" classname="Bytes2Mega" classpath="poi-excelant/build/poi-ant-contrib"/>
<local name="fileSizeMb"/> <local name="fileSizeMb"/>
<bytes2mega property="fileSizeMb" bytes="${fileSize}"/> <bytes2mega property="fileSizeMb" bytes="${fileSize}"/>

View File

@ -1,26 +0,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.
==================================================================== */
dependencies {
implementation project(':ooxml')
implementation project(':scratchpad')
implementation "org.apache.logging.log4j:log4j-core:${log4jVersion}"
testImplementation project(path: ':ooxml', configuration: 'tests')
testImplementation project(path: ':main', configuration: 'tests')
}

3
gradle.properties Normal file
View File

@ -0,0 +1,3 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx4096m

View File

@ -1,37 +0,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.
==================================================================== */
dependencies {
testImplementation 'org.apache.ant:ant:1.10.9'
testImplementation project(':ooxml')
testImplementation project(':scratchpad')
testImplementation project(':examples')
testImplementation files(this.project(':ooxml').sourceSets.test.runtimeClasspath)
}
jar {
manifest {
attributes 'Automatic-Module-Name': 'org.apache.poi.integrationtest'
}
}
test {
// exclude these from the normal test-run
exclude '**/*FileHandler.class'
}

View File

@ -1,4 +1,5 @@
/* ====================================================================
====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership. this work for additional information regarding copyright ownership.
@ -13,18 +14,4 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==================================================================== */ ====================================================================
dependencies {
api 'org.apache.ant:ant:1.10.9'
api project(':ooxml')
testImplementation project(path: ':main', configuration: 'tests')
}
jar {
manifest {
attributes 'Automatic-Module-Name': 'org.apache.poi.excelant'
}
}

View File

@ -1,48 +0,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.
==================================================================== */
dependencies {
implementation "commons-codec:commons-codec:${commonsCodecVersion}"
implementation 'org.apache.commons:commons-collections4:4.4'
implementation "org.apache.commons:commons-math3:${commonsMathVersion}"
implementation "org.apache.logging.log4j:log4j-api:${log4jVersion}"
implementation 'javax.activation:activation:1.1.1'
api 'com.zaxxer:SparseBitSet:1.2'
testImplementation 'org.reflections:reflections:0.9.12'
}
jar {
manifest {
attributes 'Automatic-Module-Name': 'org.apache.poi.main'
}
}
// Create a separate jar for test-code to depend on it in other projects
// See http://stackoverflow.com/questions/5144325/gradle-test-dependency
task testJar(type: Jar, dependsOn: testClasses) {
baseName = "test-${project.archivesBaseName}"
from sourceSets.test.output
}
configurations {
tests
}
artifacts {
tests testJar
}

View File

@ -1,80 +0,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.
==================================================================== */
package org.apache.poi.hssf.dev;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Stream;
import org.apache.poi.POIDataSamples;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
/**
* Base class for integration-style tests which iterate over all test-files
* and execute the same action to find out if any change breaks these applications.
*/
public abstract class BaseTestIteratingXLS {
protected static final Map<String,Class<? extends Throwable>> EXCLUDED = new HashMap<>();
private static Stream<Arguments> files() {
String dataDirName = System.getProperty(POIDataSamples.TEST_PROPERTY);
if(dataDirName == null) {
dataDirName = "test-data";
}
List<Arguments> files = new ArrayList<>();
findFile(files, dataDirName + "/spreadsheet");
findFile(files, dataDirName + "/hpsf");
return files.stream();
}
private static void findFile(List<Arguments> list, String dir) {
String[] files = new File(dir).list((arg0, arg1) -> arg1.toLowerCase(Locale.ROOT).endsWith(".xls"));
assertNotNull(files, "Did not find any xls files in directory " + dir);
for(String file : files) {
list.add(Arguments.of(new File(dir, file)));
}
}
@ParameterizedTest
@MethodSource("files")
void testMain(File file) throws Exception {
String fileName = file.getName();
Class<? extends Throwable> t = EXCLUDED.get(fileName);
if (t == null) {
runOneFile(file);
} else {
assertThrows(t, () -> runOneFile(file));
}
}
abstract void runOneFile(File pFile) throws Exception;
}

View File

@ -1,58 +0,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.
==================================================================== */
package org.apache.poi.hssf.dev;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.hssf.OldExcelFormatException;
import org.apache.poi.hssf.record.RecordInputStream;
import org.apache.poi.util.NullOutputStream;
import org.apache.poi.util.RecordFormatException;
import org.junit.jupiter.api.BeforeAll;
class TestBiffDrawingToXml extends BaseTestIteratingXLS {
@BeforeAll
public static void setup() {
EXCLUDED.clear();
EXCLUDED.put("35897-type4.xls", EncryptedDocumentException.class); // unsupported crypto api header
EXCLUDED.put("51832.xls", EncryptedDocumentException.class);
EXCLUDED.put("xor-encryption-abc.xls", EncryptedDocumentException.class);
EXCLUDED.put("password.xls", EncryptedDocumentException.class);
EXCLUDED.put("46904.xls", OldExcelFormatException.class);
EXCLUDED.put("59074.xls", OldExcelFormatException.class);
EXCLUDED.put("testEXCEL_2.xls", OldExcelFormatException.class); // Biff 2 / Excel 2, pre-OLE2
EXCLUDED.put("testEXCEL_3.xls", OldExcelFormatException.class); // Biff 3 / Excel 3, pre-OLE2
EXCLUDED.put("testEXCEL_4.xls", OldExcelFormatException.class); // Biff 4 / Excel 4, pre-OLE2
EXCLUDED.put("testEXCEL_5.xls", OldExcelFormatException.class); // Biff 5 / Excel 5
EXCLUDED.put("60284.xls", OldExcelFormatException.class); // Biff 5 / Excel 5
EXCLUDED.put("testEXCEL_95.xls", OldExcelFormatException.class); // Biff 5 / Excel 95
EXCLUDED.put("43493.xls", RecordInputStream.LeftoverDataException.class); // HSSFWorkbook cannot open it as well
EXCLUDED.put("44958_1.xls", RecordInputStream.LeftoverDataException.class);
EXCLUDED.put("61300.xls", RecordFormatException.class);
EXCLUDED.put("64130.xls", OldExcelFormatException.class); // BIFF 5
}
@Override
void runOneFile(File pFile) throws Exception {
try (InputStream wb = new FileInputStream(pFile)) {
BiffDrawingToXml.writeToFile(new NullOutputStream(), wb, false, new String[0]);
}
}
}

View File

@ -1,68 +0,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.
==================================================================== */
apply plugin: 'java'
configurations {
antdep
}
dependencies {
antdep 'org.apache.ant:ant:1.10.9'
}
/*task downloadJarsToLibs() {
def f = new File("$projectDir/../lib/ooxml/xmlbeans-5.0.0.jar")
if (!f.exists()) {
println 'writing file ' + f.getAbsolutePath()
f.getParentFile().mkdirs()
new URL('https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/lastSuccessfulBuild/artifact/build/xmlbeans-5.0.0.jar').withInputStream{ i -> f.withOutputStream{ it << i }}
}
}*/
// we need to ensure that the custom ant tasks are compiled before we import the build.xml file
task compileContrib (type: JavaCompile) {
source = "../excelant/src/poi-ant-contrib/java"
include '*.java'
exclude 'Junit5Progress.java'
classpath = configurations.antdep
destinationDirectory = file('../excelant/build/poi-ant-contrib')
}
// for now import the ant-task for building the jars from build.xml
// we need to rename the tasks as e.g. task "jar" conflicts with :ooxml:jar
ant.importBuild('../build.xml') { antTargetName ->
'ant-' + antTargetName
}
compileJava.dependsOn 'compileContrib'
compileJava.dependsOn 'ant-compile-ooxml-xsds'
//compileJava.dependsOn 'downloadJarsToLibs'
dependencies {
api "org.apache.xmlbeans:xmlbeans:${xmlbeansVersion}"
}
jar {
manifest {
attributes 'Automatic-Module-Name': 'org.apache.poi.ooxml.schemas'
}
}

View File

@ -1,66 +0,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.
==================================================================== */
dependencies {
api project(":ooxml-schema")
implementation 'org.apache.commons:commons-collections4:4.4'
api "org.apache.commons:commons-compress:${commonsCompressVersion}"
api 'org.apache.santuario:xmlsec:2.2.1'
api "org.bouncycastle:bcpkix-jdk15on:${bouncyCastleVersion}"
api 'com.github.virtuald:curvesapi:1.06'
implementation "org.apache.logging.log4j:log4j-api:${log4jVersion}"
api "org.apache.xmlgraphics:batik-svggen:${batikVersion}"
implementation("org.apache.xmlgraphics:batik-bridge:${batikVersion}") {
exclude group: 'org.apache.xmlgraphics', module: 'batik-script'
}
implementation "org.apache.xmlgraphics:batik-codec:${batikVersion}"
api 'de.rototor.pdfbox:graphics2d:0.30'
api project(':main')
api files("../build/dist/maven/poi-ooxml-full/poi-ooxml-full-${version}.jar")
testRuntime project(':scratchpad')
testImplementation 'org.xmlunit:xmlunit-core:2.8.0'
testImplementation 'org.reflections:reflections:0.9.12'
testImplementation project(path: ':main', configuration: 'tests')
testImplementation 'org.openjdk.jmh:jmh-core:1.26'
testImplementation 'org.openjdk.jmh:jmh-generator-annprocess:1.26'
testImplementation 'com.google.guava:guava:30.0-jre'
}
jar {
manifest {
attributes 'Automatic-Module-Name': 'org.apache.poi.ooxml'
}
}
// Create a separate jar for test-code to depend on it in other projects
// See http://stackoverflow.com/questions/5144325/gradle-test-dependency
task testJar(type: Jar, dependsOn: testClasses) {
baseName = "test-${project.archivesBaseName}"
from sourceSets.test.output
}
configurations {
tests
}
artifacts {
tests testJar
}

99
poi-examples/build.gradle Normal file
View File

@ -0,0 +1,99 @@
/* ====================================================================
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.
==================================================================== */
import java.util.regex.Pattern
plugins {
id 'java'
id 'maven-publish'
id 'java-library'
}
final String JAVA9_SRC = 'src/main/java9'
final String JAVA9_OUT = "${buildDir}/classes/java9/main/"
final String VERSIONS9 = 'META-INF/versions/9'
sourceSets {
main {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
}
}
}
dependencies {
api project(':poi-ooxml')
api project(':poi-scratchpad')
implementation project(path: ':poi-ooxml', configuration: 'archives')
implementation project(path: ':poi-ooxml-full', configuration: 'archives')
implementation project(path: ':poi-scratchpad', configuration: 'archives')
implementation "org.apache.logging.log4j:log4j-core:${log4jVersion}"
testImplementation project(path: ':ooxml', configuration: 'tests')
testImplementation project(path: ':main', configuration: 'tests')
}
final String MODULE_NAME = 'org.apache.poi.examples'
final Pattern MODULE_REGEX = ~'\\.jar$'
final List MAIN_MODULE_PATH = sourceSets.main.runtimeClasspath.findAll{ it.path =~ MODULE_REGEX }.collect{ it.parent }.unique()
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
}
task compileJava9(type: JavaCompile) {
dependsOn 'compileJava', ':poi-ooxml:jar', ':poi-scratchpad:jar'
sourceCompatibility = 9
targetCompatibility = 9
destinationDirectory = file(JAVA9_OUT + VERSIONS9)
source = file(JAVA9_SRC)
classpath = files()
options.compilerArgs = [
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
'--module-path', files(MAIN_MODULE_PATH).asPath
]
}
task cacheJava9(type: Copy) {
dependsOn 'compileJava9'
from(file(JAVA9_OUT + VERSIONS9))
into(JAVA9_SRC)
}
jar {
destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")
if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
into('META-INF/versions/9') {
from JAVA9_SRC include '*.class'
}
}
manifest {
attributes('Automatic-Module-Name': MODULE_NAME, 'Multi-Release': 'true')
}
}
sourcesJar {
destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")
}

Some files were not shown because too many files have changed in this diff Show More