Updated gradle tasks order
This commit is contained in:
parent
6afb9a7297
commit
333d57e162
@ -109,9 +109,7 @@ compose.desktop {
|
|||||||
application {
|
application {
|
||||||
mainClass = "com.jetpackduba.gitnuro.MainKt"
|
mainClass = "com.jetpackduba.gitnuro.MainKt"
|
||||||
|
|
||||||
this@application.dependsOn("rust_generateKotlinFromUdl")
|
this@application.dependsOn("rustTasks")
|
||||||
this@application.dependsOn("rust_build")
|
|
||||||
this@application.dependsOn("rust_copyBuild")
|
|
||||||
|
|
||||||
sourceSets.forEach {
|
sourceSets.forEach {
|
||||||
it.java.srcDir(rustGeneratedSource)
|
it.java.srcDir(rustGeneratedSource)
|
||||||
@ -161,27 +159,28 @@ task("fatJarLinux", type = Jar::class) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
task("rust_generateKotlinFromUdl", type = Exec::class) {
|
task("rust_generateKotlinFromUdl") {
|
||||||
println("Generate Kotlin")
|
println("Generate Kotlin")
|
||||||
workingDir = File(project.projectDir, "rs")
|
generateKotlinFromUdl()
|
||||||
commandLine = listOf(
|
|
||||||
"cargo", "run", "--features=uniffi/cli",
|
|
||||||
"--bin", "uniffi-bindgen", "generate", "src/repository_watcher.udl",
|
|
||||||
"--language", "kotlin",
|
|
||||||
"--out-dir", rustGeneratedSource
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task("rust_build", type = Exec::class) {
|
task("rust_build") {
|
||||||
println("Build rs called")
|
buildRust()
|
||||||
workingDir = File(project.projectDir, "rs")
|
|
||||||
commandLine = listOf(
|
|
||||||
"cargo", "build", "--release", "--features=uniffi/cli",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.getByName("compileKotlin").dependsOn("rustTasks")
|
tasks.getByName("compileKotlin").doLast {
|
||||||
tasks.getByName("compileTestKotlin").dependsOn("rustTasks")
|
println("compileKotlin called")
|
||||||
|
buildRust()
|
||||||
|
copyRustBuild()
|
||||||
|
generateKotlinFromUdl()
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.getByName("compileTestKotlin").doLast {
|
||||||
|
println("compileTestKotlin called")
|
||||||
|
buildRust()
|
||||||
|
copyRustBuild()
|
||||||
|
generateKotlinFromUdl()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
task("tasksList") {
|
task("tasksList") {
|
||||||
@ -192,14 +191,40 @@ task("tasksList") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task("rustTasks") {
|
task("rustTasks") {
|
||||||
dependsOn("rust_build")
|
buildRust()
|
||||||
dependsOn("rust_generateKotlinFromUdl")
|
copyRustBuild()
|
||||||
dependsOn("rust_copyBuild")
|
generateKotlinFromUdl()
|
||||||
}
|
}
|
||||||
|
|
||||||
task("rust_copyBuild") {
|
task("rust_copyBuild") {
|
||||||
|
copyRustBuild()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun generateKotlinFromUdl() {
|
||||||
|
exec {
|
||||||
|
workingDir = File(project.projectDir, "rs")
|
||||||
|
commandLine = listOf(
|
||||||
|
"cargo", "run", "--features=uniffi/cli",
|
||||||
|
"--bin", "uniffi-bindgen", "generate", "src/repository_watcher.udl",
|
||||||
|
"--language", "kotlin",
|
||||||
|
"--out-dir", rustGeneratedSource
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun buildRust() {
|
||||||
|
exec {
|
||||||
|
println("Build rs called")
|
||||||
|
workingDir = File(project.projectDir, "rs")
|
||||||
|
commandLine = listOf(
|
||||||
|
"cargo", "build", "--release", "--features=uniffi/cli",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun copyRustBuild() {
|
||||||
val outputDir = "${buildDir}/classes/kotlin/main"
|
val outputDir = "${buildDir}/classes/kotlin/main"
|
||||||
println("Copy rs called")
|
println("Copy rs build called")
|
||||||
val workingDir = File(project.projectDir, "rs/target/release")
|
val workingDir = File(project.projectDir, "rs/target/release")
|
||||||
|
|
||||||
val directory = File(outputDir)
|
val directory = File(outputDir)
|
||||||
@ -221,4 +246,6 @@ task("rust_copyBuild") {
|
|||||||
val destinyFile = File(directory, destinyLib)
|
val destinyFile = File(directory, destinyLib)
|
||||||
|
|
||||||
com.google.common.io.Files.copy(originFile, destinyFile)
|
com.google.common.io.Files.copy(originFile, destinyFile)
|
||||||
|
|
||||||
|
println("Copy rs build completed")
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user