Ciaran Sloan
08/10/2023, 10:22 AM./gradlew :myprogram:run
however I want to run this as part of the pre-defined build
gradle task. In other words, I always want this to run when someone tries to build the android app, and prior to that app compiling. Any suggestions on how I would do that? Some things I have tried 🧵Ciaran Sloan
08/10/2023, 10:22 AMtasks.named(":myProgram:run").also { tasks.named("build").dependsOn(this) }
But I get an error that task :myProgram:run
cannot be found.Ciaran Sloan
08/10/2023, 10:22 AMtasks.register("runMyProgram") {
exec {
commandLine("./gradlew :myProgram:run")
}
tasks.named("build").dependsOn(this)
}
Ciaran Sloan
08/10/2023, 10:23 AMAdam S
08/10/2023, 10:35 AM:myProgram:run
task yet
tasks.named(":myProgram:run").also { tasks.named("build").dependsOn(this) }
Instead you can add a dependency based on the task path
tasks.build {
dependsOn(":myProgram:run")
}
(and using the generated Kotlin DSL accessor, tasks.build
, for the build task)Ciaran Sloan
08/10/2023, 1:20 PM