In a multi-project Android build, like
root
+--- build.gradle
+--- settings.gradle
+--- subproject1
\--- build.gradle
\--- subproject2
\--- build.gradle
I would like to execute a task that generates code, before any of the projects (subproject1,subproject2) build. The code generating task is there once for all projects. I would like to put it into the root build.gradle. Also in the root build.gradle, that all projects (allprojects) depend on the code generating task.
task code_generating_task << {
println "I generate code here"
}
preBuild.dependsOn code_generating_task
Does not work, because preBuild is not defined in the root build.gradle.