From 720596a9eced791430b7e958b0306a99aa1aee12 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Wed, 9 Oct 2024 19:18:22 +0000 Subject: [PATCH] revert batik change due to build issues git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1921218 13f79535-47bb-0310-9956-ffa450edef68 --- build.gradle | 2 +- build.xml | 40 +++++++++++------------ osgi/pom.xml | 2 +- poi-ooxml/build.gradle | 32 +++++++++++++++++- poi-ooxml/src/main/java9/module-info.java | 38 ++++++++++----------- poi-ooxml/src/test/java9/module-info.java | 38 ++++++++++----------- 6 files changed, 91 insertions(+), 61 deletions(-) diff --git a/build.gradle b/build.gradle index db8d5631c1..3c371f58a4 100644 --- a/build.gradle +++ b/build.gradle @@ -128,7 +128,7 @@ subprojects { mockitoVersion = '4.11.0' hamcrestVersion = '3.0' xmlbeansVersion = '5.2.1' - batikVersion = '1.18' + batikVersion = '1.17' graphics2dVersion = '3.0.2' pdfboxVersion = '3.0.3' saxonVersion = '12.5' diff --git a/build.xml b/build.xml index 3796643f9a..bb4075a2c0 100644 --- a/build.xml +++ b/build.xml @@ -305,26 +305,26 @@ under the License. - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/osgi/pom.xml b/osgi/pom.xml index b1cdfd0993..1980941e44 100644 --- a/osgi/pom.xml +++ b/osgi/pom.xml @@ -176,7 +176,7 @@ junit junit test - 4.13.2 + 4.13.1 diff --git a/poi-ooxml/build.gradle b/poi-ooxml/build.gradle index 84c1fa157f..843c21ead5 100644 --- a/poi-ooxml/build.gradle +++ b/poi-ooxml/build.gradle @@ -28,6 +28,7 @@ configurations { exclude group: 'xml-apis', module: 'xml-apis' } + broken tests javadocs } @@ -125,19 +126,29 @@ dependencies { testImplementation "org.apache.logging.log4j:log4j-slf4j2-impl:${log4jVersion}" testImplementation 'org.slf4j:slf4j-simple:2.0.16' + broken("org.apache.xmlgraphics:batik-script:${batikVersion}"){ + exclude group: 'xalan', module: 'xalan' + exclude group: 'xml-apis', module: 'xml-apis' + } + javadocs project(':poi') javadocs project(':poi-scratchpad') } final String MODULE_NAME = 'org.apache.poi.ooxml' +final Pattern MODULE_NOT_REGEX = ~'(poi[/\\\\][^/\\\\]+$|batik-script)' final Pattern MODULE_REGEX = ~'\\.jar$' final List MAIN_MODULE_PATH = sourceSets.main.runtimeClasspath.findAll{ it.path =~ MODULE_REGEX }.collect{ it.parent }.unique() -final List TEST_MODULE_PATH = sourceSets.test.runtimeClasspath.findAll{ it.path =~ MODULE_REGEX }.collect{ it.parent }.unique() +final List TEST_MODULE_PATH = sourceSets.test.runtimeClasspath.findAll{ it.path =~ MODULE_REGEX && !(it.path =~ MODULE_NOT_REGEX) }.collect{ it.parent }.unique() + files("build/brokenJars") final String OOXML_LITE_AGENT = "../build/dist/maven/poi-ooxml-lite-agent/poi-ooxml-lite-agent-${project.version}.jar" final String OOXML_LITE_REPORT = '../src/resources/ooxml-lite-report' final String OOXML_LITE_INCLUDES = "^(com/microsoft/schemas|org/(etsi|openxmlformats|w3/)|org/apache/poi/schemas)" +compileJava { + dependsOn 'fixBatik', 'cleanupBatik' +} + task compileJava9(type: JavaCompile) { dependsOn 'compileJava', ':poi:jar' @@ -197,6 +208,25 @@ task testJar(type: Jar, dependsOn: testClasses) { } } +// based on https://github.com/moditect/moditect-gradle-plugin/issues/12 +task fixBatik(type: Zip) { + ant.mkdir(dir: "${buildDir}/brokenJars") + archiveFileName = "batik-script-${batikVersion}.jar" + destinationDirectory = file("${buildDir}/brokenJars") + from zipTree(configurations.broken.files.find{ f -> f.name.startsWith("batik-script") }) + filesMatching("**/org.apache.batik.script.InterpreterFactory") { + it.filter{ it2 -> it2.contains("Rhino") ? "#" + it2 : it2 } + } +} + +task cleanupBatik(type: Delete) { + // remove older files to avoid build failures because of duplicate modules + delete fileTree("${buildDir}/brokenJars/").matching { + include "*.jar" + exclude "batik*-${batikVersion}.jar" + } +} + javadoc { failOnError = true doFirst { diff --git a/poi-ooxml/src/main/java9/module-info.java b/poi-ooxml/src/main/java9/module-info.java index d740345f59..35a257fb75 100644 --- a/poi-ooxml/src/main/java9/module-info.java +++ b/poi-ooxml/src/main/java9/module-info.java @@ -93,25 +93,25 @@ module org.apache.poi.ooxml { requires static org.bouncycastle.pkix; /* optional dependencies for slideshow rendering via PPTX2PNG */ - requires static org.apache.xmlgraphics.batik.anim; - requires static org.apache.xmlgraphics.batik.awt.util; - /* this typo appears in Batik 1.18 and will be fixed in a future release */ - requires static org.apache.xmlgraphics.batik.brdige; - requires static org.apache.xmlgraphics.batik.codec; - requires static org.apache.xmlgraphics.batik.constants; - requires static org.apache.xmlgraphics.batik.css; - requires static org.apache.xmlgraphics.batik.dom; - requires static org.apache.xmlgraphics.batik.ext; - requires static org.apache.xmlgraphics.batik.gvt; - requires static org.apache.xmlgraphics.batik.i18n; - requires static org.apache.xmlgraphics.batik.parser; - requires static org.apache.xmlgraphics.batik.script; - requires static org.apache.xmlgraphics.batik.svgdom; - requires static org.apache.xmlgraphics.batik.svggen; - requires static org.apache.xmlgraphics.batik.svgrasterizer; - requires static org.apache.xmlgraphics.batik.transcoder; - requires static org.apache.xmlgraphics.batik.util; - requires static org.apache.xmlgraphics.batik.xml; + requires static batik.anim; + requires static batik.awt.util; + requires static batik.bridge; + requires static batik.codec; + requires static batik.constants; + requires static batik.css; + requires static batik.dom; + requires static batik.ext; + requires static batik.gvt; + requires static batik.i18n; + requires static batik.parser; + requires static batik.script; + requires static batik.shared.resources; + requires static batik.svg.dom; + requires static batik.svggen; + requires static batik.svgrasterizer; + requires static batik.transcoder; + requires static batik.util; + requires static batik.xml; requires static xmlgraphics.commons; requires static org.apache.pdfbox; diff --git a/poi-ooxml/src/test/java9/module-info.java b/poi-ooxml/src/test/java9/module-info.java index 1f114f5aa2..cc65353c3b 100644 --- a/poi-ooxml/src/test/java9/module-info.java +++ b/poi-ooxml/src/test/java9/module-info.java @@ -95,25 +95,25 @@ module org.apache.poi.ooxml { /* optional dependencies for slideshow rendering via PPTX2PNG */ - requires static org.apache.xmlgraphics.batik.anim; - requires static org.apache.xmlgraphics.batik.awt.util; - /* this typo appears in Batik 1.18 and will be fixed in a future release */ - requires static org.apache.xmlgraphics.batik.brdige; - requires static org.apache.xmlgraphics.batik.codec; - requires static org.apache.xmlgraphics.batik.constants; - requires static org.apache.xmlgraphics.batik.css; - requires static org.apache.xmlgraphics.batik.dom; - requires static org.apache.xmlgraphics.batik.ext; - requires static org.apache.xmlgraphics.batik.gvt; - requires static org.apache.xmlgraphics.batik.i18n; - requires static org.apache.xmlgraphics.batik.parser; - requires static org.apache.xmlgraphics.batik.script; - requires static org.apache.xmlgraphics.batik.svgdom; - requires static org.apache.xmlgraphics.batik.svggen; - requires static org.apache.xmlgraphics.batik.svgrasterizer; - requires static org.apache.xmlgraphics.batik.transcoder; - requires static org.apache.xmlgraphics.batik.util; - requires static org.apache.xmlgraphics.batik.xml; + requires static batik.anim; + requires static batik.awt.util; + requires static batik.bridge; + requires static batik.codec; + requires static batik.constants; + requires static batik.css; + requires static batik.dom; + requires static batik.ext; + requires static batik.gvt; + requires static batik.i18n; + requires static batik.parser; + requires static batik.script; + requires static batik.shared.resources; + requires static batik.svg.dom; + requires static batik.svggen; + requires static batik.svgrasterizer; + requires static batik.transcoder; + requires static batik.util; + requires static batik.xml; requires static xmlgraphics.commons; requires static org.apache.pdfbox; -- 2.39.5