On Tue, Apr 19, 2011 at 8:10 PM, Jason Porter <[email protected]>wrote:

>
> > also... it would be cool if there was a way of registering a type to a
> plugin... so you know which sourceset to use... this was you could type
> "createJavaClass" and this plugin would leverage the "java" plugin
> sourceset... where as the "createGroovyClass" would leverage the groovy
> plugin.    There would be a new for registration or discovery in order to
> make this work.
> >
> > I'm not sure about the dynamically registering a plugin type, but as I
> mentioned above, I don't think it's unreasonable for the java-templates
> plugin to depend on the Java plugin. So I'll just "project.apply(plugin:
> 'java')" in the JavaTemplatesPlugin.appy method. I should be able to make
> use of the Java plugin convention in the template tasks as well.
>
> You could just depend on the JavaBasePlugin (pretty sure that's the
> class, or it's BaseJavaPlugin) that gives you all the sourceSet stuff
> and basics without adding all the tasks.
>

I actually didn't need to even do that. I can just test for
'project.sourceSets?.main?.java?.srcDirs'. If it's available I use it,
otherwise I throw an exception stating that it looks like the Java plugin is
not installed, and so I cannot determine the main Java source directory.

I've made the requested changes, all the task's are camel cased now and the
wiki is updated so, and I've udpated createJavaClass and createGroovyClass
to make use of sourceSets if they are available, otherwise it'll throw an
exception.

Thanks for all the feedback, please keep it coming. :)

Cheers,
Eric


-- 
Learn from the past. Live in the present. Plan for the future.
Blog: http://eric-berry.blogspot.com
jEdit <http://www.jedit.org> - Programmer's Text Editor
Bazaar <http://bazaar.canonical.com> - Version Control for Humans

Reply via email to