```tasks.register("clean", Delete::class) { de...
# android
v
Copy code
tasks.register("clean", Delete::class) {
    delete(rootProject.buildDir)
}
this is the default clean task. Does this need to look different for multi-module projects or will this work just fine? maybe
delete(rootProject.buildDir)
needs to be run on each buildDir? im not sure though
g
In multi module project every module should have own clean task
v
How would I run all those tasks simultaneously
g
and this task implementation doesn’t look right, every module has build dir, not only rootProject
why do you need custom clean task at all?
v
for the same reason you would need any clean task. I want to clear out any generated code
g
but default clean task already doing this
v
the code I posted is the default...
g
if you need something custom (to delete some dir outside of
build
dirrectory, you just add your custom task as dependency to default
clean
task
It is not
v
at least it was in the project build file when the project was created
g
It’s not “default” it’s just generated by some project generator
there is default clean task
v
thats what is run by clicking "clean"?
g
“clicking”?
see, every module with base plugin has clean task: https://docs.gradle.org/current/userguide/base_plugin.html
except root module, which doesn’t apply any plugins (at least in default android project), so this task is just delete root build dir, but it really not important, you just can delete it
all modules where you really need clean, already have clean task
this custom task just deletes root build dir
v
ohh ok that makes sense. I didnt know that there was a default clean task already
g
Yes, and returning to your question
How would I run all those tasks simultaneously
This how Gradle works by default with all the tasks, if you do this:
./gradlew clean
. Gradle will check every module, if it has task clean and run it, if it doesn’t, nothing happen If you do this:
./gradlew :some-module:clean
it will run clean task only on some-module, or
./gradlew :clean
it will run clean task only on root module
v
ah ok. I think I need to learn more about gradle...