Can I build a Gradle plugin from within a Gradle build and make that plugin immediately available to the Gradle build?

Can I build a Gradle plugin P from within a Gradle project A and make that plugin available to the build of project A?

Speaking concretely, I want to use the Gradle GWT plugin, but no prebuilt jarfile exists that I can download as a dependency. I am forced to manually build the plugin locally and install it to a local repo. I can then use buildscript {} to indicate my build script depends on the Gradle GWT plugin jarfile I installed to the local repo.

What I’m looking for is complete automation where I can run a single Gradle build and have the plugin automatically prepared. Do I need to write a shell script or some other wrapper to do this? Thanks.

How about this approach: http://gradle.org/current/docs/userguide/organizing_build_logic.html#sec:build_sources

When you run Gradle, it checks for the existence of a directory called buildSrc. Just put your build source code in this directory and stick to the layout convention for a Java/Groovy project (see Table 20.4, “Java plugin - default project layout”). Gradle then automatically compiles and tests this code and puts it in the classpath of your build script. You don’t need to provide any further instruction. This can be a good place to add your custom tasks and plugins.