Flat multi-project, choose which projects to execute a task on

I have a flat multi-project like this:

- rootProject
- A
- B
- C

Each project can be built and distributed separately.
rootProject has no code, but has a distZip task that merges the output of [A,B].distZip tasks.

My problem is with C:

  • I must to include it in rootProject's settings.gradle, because [A,B] depend on it
  • It also has a distZip task to package it separately
    Therefore, the distZip task is also called on projcet C, although I want my rootProject.distZip only depend on [A,B].distZip

Maybe it is not a very big deal, the build will just take longer, doing things I didn’t need. But in general, I find this quite puzzling: I am forced to include in settings.gradle all projects hat are transitively - not directly - needed, but then this implies that tasks are run on all these projects as well, which might not always e what I’d like.

Am I misinterpreting something?