This commit is contained in:
坏黑 2021-08-02 15:15:27 +08:00
parent aefa846d3c
commit 943f2679f9
3 changed files with 35 additions and 26 deletions

View File

@ -6,7 +6,7 @@ plugins {
} }
group 'io.izzel.taboolib' group 'io.izzel.taboolib'
version '1.12' version '1.13'
configurations { configurations {
embed embed

View File

@ -53,6 +53,7 @@ class RelocateJar extends DefaultTask {
def buf = new byte[32768] def buf = new byte[32768]
new JarFile(inJar).withCloseable { jarFile -> new JarFile(inJar).withCloseable { jarFile ->
jarFile.entries().each { def jarEntry -> jarFile.entries().each { def jarEntry ->
if (tabooExt.exclude.none { String e -> jarEntry.name.matches(e) }) {
jarFile.getInputStream(jarEntry).withCloseable { jarFile.getInputStream(jarEntry).withCloseable {
if (jarEntry.name.endsWith(".class")) { if (jarEntry.name.endsWith(".class")) {
def reader = new ClassReader(it) def reader = new ClassReader(it)
@ -72,14 +73,16 @@ class RelocateJar extends DefaultTask {
} else { } else {
try { try {
out.putNextEntry(new JarEntry(remapper.map(jarEntry.name))) out.putNextEntry(new JarEntry(remapper.map(jarEntry.name)))
} catch(ZipException zipException) { } catch(ZipException ex) {
println(zipException) println(ex)
return true return true
} }
while ((n = it.read(buf)) != -1) { while ((n = it.read(buf)) != -1) {
out.write(buf, 0, n) out.write(buf, 0, n)
} }
} }
null
}
} }
} }
} }

View File

@ -13,6 +13,8 @@ class TabooLibExtension {
List<String> modules = [] List<String> modules = []
List<String> exclude = []
Description des = new Description() Description des = new Description()
Map<String, String> relocation = new LinkedHashMap<>() Map<String, String> relocation = new LinkedHashMap<>()
@ -21,6 +23,10 @@ class TabooLibExtension {
name.each { modules += it } name.each { modules += it }
} }
def exclude(String match) {
exclude += match
}
def relocate(String pre, String post) { def relocate(String pre, String post) {
relocation[pre] = post relocation[pre] = post
} }