Library/Tool/Way to manipulate Gradle Build Scripts

Hi,

Anybody can recommend a library/tool/way to manipulate Gradle build scripts in a structured way? Say, I want to transform a script by adding a plugin or removing an AppliedPlugin? How would I do that? Anybody?

Thank you!