Nested projects / submodules and settings.gradle

I realize it’s been asked before, and the official feature is coming in the future. However, I’m curious if it’s possible to include nested settings.gradle files with a bit of Groovy. Ideally the code would go directly into settings.gradle such as ‘evaluate(new File("submoduleA/settings.gradle))’. If that isn’t possible (it wasn’t working for me) perhaps a custom task could update the root settings.gradle file by processing each submodule’s settings.gradle. It would be totally fine to hardcode references to the submodule’s settings.gradle.

The main issue I’m trying to avoid is the fact that adding a project causes the build to break all the way up the submodule chain. Each time this happens, all settings.gradle files that depend on that submodule must have the new project added which is fairly painful. Adding submodules is rare but adding projects is common.