From 554ba5c41f639b83e943d34229aa66153f888c1f Mon Sep 17 00:00:00 2001 From: Martin Hickson Date: Wed, 11 Nov 2026 10:35:53 +1300 Subject: [PATCH] Bundle BCEL 6.7.0 plus the vendored regexp and CUP runtime classes in the xalan jar. Official 2.7.3 ships those classes inside xalan, and the Maven BCEL jar matches the official bytes. --- build-support/prepare-sources.groovy | 31 ++++++++++++++++++++++++++ xalan/pom.xml | 33 ++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/build-support/prepare-sources.groovy b/build-support/prepare-sources.groovy index 14e5bb5d6..5e540f393 100644 --- a/build-support/prepare-sources.groovy +++ b/build-support/prepare-sources.groovy @@ -151,6 +151,37 @@ if (command == 'generate-serializer') { } Files.move(generatedLexer.toPath(), lexer.toPath(), StandardCopyOption.REPLACE_EXISTING) lexCopy.delete() +} else if (command == 'bundle-xalan') { + def classes = new File(moduleTarget, 'classes') + if (!classes.isDirectory()) { + throw new IllegalStateException("Compiled classes are missing: ${classes}") + } + def unpack = { File jar, List prefixes -> + if (!jar.isFile()) { + throw new IllegalStateException("Bundle jar is missing: ${jar}") + } + def zip = new java.util.zip.ZipFile(jar) + try { + zip.entries().each { entry -> + if (entry.directory) { + return + } + def name = entry.name + if (!prefixes.any { name.startsWith(it) }) { + return + } + def out = new File(classes, name) + out.parentFile.mkdirs() + out.withOutputStream { output -> + zip.getInputStream(entry).withCloseable { input -> output << input } + } + } + } finally { + zip.close() + } + } + unpack(new File(repo, 'lib/regexp.jar'), ['org/apache/regexp/']) + unpack(new File(repo, 'lib/runtime.jar'), ['java_cup/runtime/']) } else { throw new IllegalArgumentException("Unknown command ${command}") } diff --git a/xalan/pom.xml b/xalan/pom.xml index fe4ec6995..48e9ab2a5 100644 --- a/xalan/pom.xml +++ b/xalan/pom.xml @@ -97,6 +97,24 @@ + + unpack-bcel + prepare-package + + unpack + + + + + org.apache.bcel + bcel + ${bcel.version} + ${project.build.outputDirectory} + org/apache/bcel/**,META-INF/maven/org.apache.bcel/** + + + + @@ -122,6 +140,21 @@ + + + + + bundle-vendored-classes + prepare-package + + execute + + + +