gradle: kts dsl (#1845)

* gradle: kts dsl

* deob: Fix tests

* gradle: Convert fernflower plugin to kotlin
This commit is contained in:
Owain van Brakel
2019-10-27 19:35:25 +01:00
committed by Ganom
parent a3667f10e3
commit b859cec91a
52 changed files with 1598 additions and 975 deletions

View File

@@ -0,0 +1,30 @@
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction
import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler
import java.io.File
open class FernflowerTask: DefaultTask() {
var extraArgs: List<String>? = null
var inputJar: String? = null
var outputDir: String? = null
fun getInputJar(): File {
return project.file(inputJar ?: project.buildDir.toString() + "/libs/" + project.name + '-' + project.version + ".jar")
}
fun getOutputDir(): File {
return project.file(outputDir ?: project.buildDir.toString() + "/decompiled-sources")
}
@TaskAction
fun decompile() {
getOutputDir().mkdirs()
val args = mutableListOf(getInputJar().toString(), getOutputDir().toString())
if (extraArgs != null) {
args.addAll(extraArgs!!)
}
ConsoleDecompiler.main(args.toTypedArray())
}
}