Where can I find decent documentation and/or examples for writing new Gradle plugins?

I’m trying to put together a plugin for generating YUI3 modules automatically from a Yui Builder style directory layout. On the face of it, this should be a rather simple task to achieve - scan all of the subdirectories under the source directory, defaulting to src/main/javascript, and for every build.properties file found process it and produce some output files in the output area.

This has so far proven to be amazingly difficult. Unless I’m missing something, the documentation on the site doesn’t cover what I’m trying to do at all - it details how to write simple plugins and then stops there, and I’m not entirely convinced it’s up-to-date either!, the plugins that are included in the main Gradle source tree are really rather complicated to try and trace through, and a lot of the custom plugins that are out there are out-dated or at least do things differently to how the core ones work.

I’ve managed to get to the point where I have a plugin with a single task, where the task has configurable input and outputs, and so on. But it doesn’t use the @InputFiles/@OutputDirectory/etc annotations - for which I can find virtually no documentation - so it doesn’t know if the files are already up-to-date or not.

Is there a definitive place I can look at - documentation, code, whatever - that will cover how to write a plugin to take a number of input files and create a number of output files?