Skip to content

Commit da1939f

Browse files
committed
revert batik change due to build issues
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1921221 13f79535-47bb-0310-9956-ffa450edef68
1 parent ad8b9f0 commit da1939f

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

poi-ooxml/build.gradle

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,6 @@ dependencies {
8989
exclude group: 'xalan', module: 'xalan'
9090
exclude group: 'xml-apis', module: 'xml-apis'
9191
}
92-
renderImplementation("org.apache.xmlgraphics:batik-script:${batikVersion}") {
93-
exclude group: 'xalan', module: 'xalan'
94-
exclude group: 'xml-apis', module: 'xml-apis'
95-
}
9692

9793
rendersignImplementation "org.apache.pdfbox:pdfbox:${pdfboxVersion}"
9894
rendersignImplementation "de.rototor.pdfbox:graphics2d:${graphics2dVersion}"
@@ -109,10 +105,6 @@ dependencies {
109105
exclude group: 'xalan', module: 'xalan'
110106
exclude group: 'xml-apis', module: 'xml-apis'
111107
}
112-
rendersignImplementation("org.apache.xmlgraphics:batik-script:${batikVersion}") {
113-
exclude group: 'xalan', module: 'xalan'
114-
exclude group: 'xml-apis', module: 'xml-apis'
115-
}
116108

117109

118110
if (!NO_SCRATCHPAD) {
@@ -134,19 +126,29 @@ dependencies {
134126
testImplementation "org.apache.logging.log4j:log4j-slf4j2-impl:${log4jVersion}"
135127
testImplementation 'org.slf4j:slf4j-simple:2.0.16'
136128

129+
broken("org.apache.xmlgraphics:batik-script:${batikVersion}"){
130+
exclude group: 'xalan', module: 'xalan'
131+
exclude group: 'xml-apis', module: 'xml-apis'
132+
}
133+
137134
javadocs project(':poi')
138135
javadocs project(':poi-scratchpad')
139136
}
140137

141138
final String MODULE_NAME = 'org.apache.poi.ooxml'
139+
final Pattern MODULE_NOT_REGEX = ~'(poi[/\\\\][^/\\\\]+$|batik-script)'
142140
final Pattern MODULE_REGEX = ~'\\.jar$'
143141
final List MAIN_MODULE_PATH = sourceSets.main.runtimeClasspath.findAll{ it.path =~ MODULE_REGEX }.collect{ it.parent }.unique()
144-
final List TEST_MODULE_PATH = sourceSets.test.runtimeClasspath.findAll{ it.path =~ MODULE_REGEX }.collect{ it.parent }.unique()
142+
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")
145143

146144
final String OOXML_LITE_AGENT = "../build/dist/maven/poi-ooxml-lite-agent/poi-ooxml-lite-agent-${project.version}.jar"
147145
final String OOXML_LITE_REPORT = '../src/resources/ooxml-lite-report'
148146
final String OOXML_LITE_INCLUDES = "^(com/microsoft/schemas|org/(etsi|openxmlformats|w3/)|org/apache/poi/schemas)"
149147

148+
compileJava {
149+
dependsOn 'fixBatik', 'cleanupBatik'
150+
}
151+
150152
task compileJava9(type: JavaCompile) {
151153
dependsOn 'compileJava', ':poi:jar'
152154

@@ -206,6 +208,25 @@ task testJar(type: Jar, dependsOn: testClasses) {
206208
}
207209
}
208210

211+
// based on https://github.com/moditect/moditect-gradle-plugin/issues/12
212+
task fixBatik(type: Zip) {
213+
ant.mkdir(dir: "${buildDir}/brokenJars")
214+
archiveFileName = "batik-script-${batikVersion}.jar"
215+
destinationDirectory = file("${buildDir}/brokenJars")
216+
from zipTree(configurations.broken.files.find{ f -> f.name.startsWith("batik-script") })
217+
filesMatching("**/org.apache.batik.script.InterpreterFactory") {
218+
it.filter{ it2 -> it2.contains("Rhino") ? "#" + it2 : it2 }
219+
}
220+
}
221+
222+
task cleanupBatik(type: Delete) {
223+
// remove older files to avoid build failures because of duplicate modules
224+
delete fileTree("${buildDir}/brokenJars/").matching {
225+
include "*.jar"
226+
exclude "batik*-${batikVersion}.jar"
227+
}
228+
}
229+
209230
javadoc {
210231
failOnError = true
211232
doFirst {

0 commit comments

Comments
 (0)