Added kotlin code generation
This commit is contained in:
parent
618a5f805e
commit
633e75acaa
@ -171,12 +171,6 @@ task("fatJarLinux", type = Jar::class) {
|
||||
with(tasks.jar.get() as CopySpec)
|
||||
}
|
||||
|
||||
//
|
||||
//task("rust_generateKotlinFromUdl") {
|
||||
// println("Generate Kotlin")
|
||||
// generateKotlinFromUdl()
|
||||
//}
|
||||
|
||||
task("rust_build") {
|
||||
buildRust()
|
||||
}
|
||||
@ -206,7 +200,7 @@ task("tasksList") {
|
||||
task("rustTasks") {
|
||||
buildRust()
|
||||
copyRustBuild()
|
||||
// generateKotlinFromUdl()
|
||||
generateKotlinFromRs()
|
||||
}
|
||||
|
||||
task("rust_copyBuild") {
|
||||
@ -214,7 +208,29 @@ task("rust_copyBuild") {
|
||||
}
|
||||
|
||||
fun generateKotlinFromRs() {
|
||||
val outDir = "${project.projectDir}/src/main/kotlin/com/jetpackduba/gitnuro/autogenerated/"
|
||||
println("Out dir is $outDir")
|
||||
val outDirFile = File(outDir)
|
||||
|
||||
if (outDirFile.exists()) {
|
||||
outDirFile.listFiles()?.forEach { file -> if (file.name != ".gitignore") file.delete() }
|
||||
} else {
|
||||
outDirFile.mkdirs()
|
||||
}
|
||||
|
||||
// cargo-kotars must be preinstalled
|
||||
val command = listOf(
|
||||
"cargo-kotars",
|
||||
"--kotlin-output",
|
||||
outDir,
|
||||
)
|
||||
|
||||
exec {
|
||||
println("Generating Kotlin source files")
|
||||
|
||||
workingDir = File(project.projectDir, "rs")
|
||||
commandLine = command
|
||||
}
|
||||
}
|
||||
|
||||
fun buildRust() {
|
||||
|
Loading…
Reference in New Issue
Block a user