1.13
This commit is contained in:
parent
aefa846d3c
commit
943f2679f9
|
|
@ -6,7 +6,7 @@ plugins {
|
|||
}
|
||||
|
||||
group 'io.izzel.taboolib'
|
||||
version '1.12'
|
||||
version '1.13'
|
||||
|
||||
configurations {
|
||||
embed
|
||||
|
|
|
|||
|
|
@ -53,32 +53,35 @@ class RelocateJar extends DefaultTask {
|
|||
def buf = new byte[32768]
|
||||
new JarFile(inJar).withCloseable { jarFile ->
|
||||
jarFile.entries().each { def jarEntry ->
|
||||
jarFile.getInputStream(jarEntry).withCloseable {
|
||||
if (jarEntry.name.endsWith(".class")) {
|
||||
def reader = new ClassReader(it)
|
||||
def writer = new ClassWriter(0)
|
||||
def visitor = new TabooLibClassVisitor(writer, project)
|
||||
def rem = new ClassRemapper(visitor, remapper)
|
||||
remapper.remapper = rem
|
||||
reader.accept(rem, 0)
|
||||
isolated.putAll(visitor.isolated)
|
||||
try {
|
||||
out.putNextEntry(new JarEntry(remapper.map(jarEntry.name)))
|
||||
} catch(ZipException zipException) {
|
||||
println(zipException)
|
||||
return true
|
||||
}
|
||||
out.write(writer.toByteArray())
|
||||
} else {
|
||||
try {
|
||||
out.putNextEntry(new JarEntry(remapper.map(jarEntry.name)))
|
||||
} catch(ZipException zipException) {
|
||||
println(zipException)
|
||||
return true
|
||||
}
|
||||
while ((n = it.read(buf)) != -1) {
|
||||
out.write(buf, 0, n)
|
||||
if (tabooExt.exclude.none { String e -> jarEntry.name.matches(e) }) {
|
||||
jarFile.getInputStream(jarEntry).withCloseable {
|
||||
if (jarEntry.name.endsWith(".class")) {
|
||||
def reader = new ClassReader(it)
|
||||
def writer = new ClassWriter(0)
|
||||
def visitor = new TabooLibClassVisitor(writer, project)
|
||||
def rem = new ClassRemapper(visitor, remapper)
|
||||
remapper.remapper = rem
|
||||
reader.accept(rem, 0)
|
||||
isolated.putAll(visitor.isolated)
|
||||
try {
|
||||
out.putNextEntry(new JarEntry(remapper.map(jarEntry.name)))
|
||||
} catch(ZipException zipException) {
|
||||
println(zipException)
|
||||
return true
|
||||
}
|
||||
out.write(writer.toByteArray())
|
||||
} else {
|
||||
try {
|
||||
out.putNextEntry(new JarEntry(remapper.map(jarEntry.name)))
|
||||
} catch(ZipException ex) {
|
||||
println(ex)
|
||||
return true
|
||||
}
|
||||
while ((n = it.read(buf)) != -1) {
|
||||
out.write(buf, 0, n)
|
||||
}
|
||||
}
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ class TabooLibExtension {
|
|||
|
||||
List<String> modules = []
|
||||
|
||||
List<String> exclude = []
|
||||
|
||||
Description des = new Description()
|
||||
|
||||
Map<String, String> relocation = new LinkedHashMap<>()
|
||||
|
|
@ -21,6 +23,10 @@ class TabooLibExtension {
|
|||
name.each { modules += it }
|
||||
}
|
||||
|
||||
def exclude(String match) {
|
||||
exclude += match
|
||||
}
|
||||
|
||||
def relocate(String pre, String post) {
|
||||
relocation[pre] = post
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue