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 + + + +