What is the recommended approach for maintaining top-level build logic?

Hey :wave:

We’ve got a custom plugin defined in a composite build that we apply to our root build.gradle file, and another custom Settings plugin that we apply to our root settings.gradle file. Modifying either of these custom plugins causes the class path of every task in the project to change, meaning every task in the project is invalidated (resulting in terribly slow feedback loop).

Alternatively (and confusingly), if we put that same custom plugin logic into a regular Gradle script and apply it using apply from: "whatever.gradle", then we can freely change build logic without affecting the class path. Similarly, if we simply modify settings.gradle or build.gradle directly, the class path does not change either. So one solution to this problem is just putting a bunch of our build logic directly into these files. But ideally we want to use plugins because it keeps our scripts a lot cleaner and easier to maintain.

Can anyone explain any of the following questions?

  1. Why do changes to the the custom plugins change the entire project’s class path?
  2. What’s different about apply from: "whatever.gradle"? Isn’t this technically a plugin too?
  3. What is the recommended approach for maintaining top-level build logic?