I wanted to run tasks by running scripts through Gradle with all the tasks run before compilation to automate generation of artifacts to run the Android app.
Tasks:
- I want to run a
.cmd
file that generates artifacts - Copy the generated artifacts to the Android assets folder
Here's the module build.gradle:
task createArtifacts(type:Exec) {
commandLine 'cmd', '/c', "$rootDir\\create-artifacts.cmd"
workingDir "$rootDir"
}
task copyAssets(type: Copy) {
from "$rootDir/../Artifacts/assets"
into "src/main/assets"
}
afterEvaluate {
android.applicationVariants.all { variant ->
variant.javaCompiler.dependsOn[copyAssets] //How do I make this multiple in this part?
}
}
So I want to do the task createArtifacts
before copyAssets
inside the afterEvaluate
.
My reference is here.