plugins {
id "cn.enaium.transform" version "1.2"
}
repositories {
gradlePluginPortal()
}
dependencies {
compileOnly('cn.enaium:transform:1.2')
}
or
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "cn.enaium:transform:1.2"
}
}
apply plugin: "cn.enaium.transform"
transformExtend {
transform = new ITransform() {
@Override
byte[] transform(byte[] basic) {
ClassReader classReader = new ClassReader(basic)
ClassWriter classWriter = new ClassWriter(0);
classReader.accept(new ClassVisitor(Opcodes.ASM5, classWriter) {
@Override
void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
println name
super.visit(version, access, name, signature, superName, interfaces)
}
}, 0)
return classWriter.toByteArray()
}
}
}
compileJava.finalizedBy(transformTask)