```subprojects { tasks.register("foo") { … } }...
# community-support
v
Copy code
subprojects {
    tasks.register("foo") { … }
}
ELI5 why does this break configuration avoidance? It's using
register
which makes task instantiation lazy.. so what's the problem? Docs basically just say its bad because it injects code not visible at project build file (sure), and it introduces comfiguration time coupling (not sure what does it mean) How exactly am I tanking perf by this?
c
it breaks as you are reaching into each subproject to register a task. the idiomatic way of doing this is to create a custom plugin that registers the appropriate tasks and apply this to the appropriate projects.
v
Who said it does break configuration avoidance? It does not break configuration avoidance. It is just highly discouraged bad practice. It does cross-project configuration and thus introduces project coupling. This then works against some more sophisticated Gradle features and optimizations like configure-on-demand, or isolated projects which can significantly speed up the build and / or IDE sync.
v
okay so my intuition was right.. what do you mean by project coupling here? isn’t it just applying same stuff to projects? how is that coupling the projects? do you mean coupled to the root project, i.e. that they would not be viable projects without this concrete root project R?
v
Project coupling means that one project's configuration is coupled to another protect's configuration. If you configure over project from another => coupled. Even if you "just" request some mutable information from another project's model => coupling.
👍 1
v
I see thank you
👌 1