Ah. Sorry Peter, That was actually a copy paste typo. I actually do have
closure.call().
[code]
class ReleasePluginConvention {
    ...
    def svn = new SvnReleasePluginConvention()

    void svn(Closure closure) {
       closure.delegate = svn
       closure.call()
    }

    void release(Closure closure) {
        closure.delegate = this
        closure.call()
    }
}
[/code]

When I use this it fails though. It says there is no method on 'project'
called 'svn' that accepts a closure.

I looked at the Sonar plugin as you suggested, is there a difference between
using a Convention task as the Sonar plugin is doing, and using the
following in the plugin's apply method?
[code]
project.convention.plugins.release = new ReleasePluginConvention()
[/code]

Thanks,
Eric

On Thu, Sep 1, 2011 at 7:22 PM, Peter Niederwieser <[email protected]>wrote:

> Seems like you forgot to call the closure passed to the svn() method. If
> you
> need some more guidance, have a look at the Gradle codebase, for example
> the
> Sonar plugin.
>
> --
> Peter Niederwieser
> Principal Engineer, Gradleware
> http://gradleware.com
> Creator, Spock Framework
> http://spockframework.org
> Twitter: @pniederw
>
>
> Eric Berry wrote:
> >
> > Hello,
> >    In working with on the release plugin I ran into a situation that I
> > thought would be more elegantly implemented using nested plugin
> convention
> > objects, but it doesn't seem to work like I expected it to.
> >
> > The goal was to supply a structure like the following to users for
> > configuring SVN repository layout:
> > [code]
> > release {
> >    svn {
> >       base = 'http://svn.host/repo/project'
> >       trunk = 'trunk'
> >       branches = 'branches'
> >       tags = 'tags'
> >    }
> > }
> > [/code]
> >
> > This would allow for projects to exist in a non-recommended structure
> > like:
> > http://svn.host/repo/[trunk|branches|tags]/project
> >
> > This is all basically to support automatic tag creation from the plugin.
> >
> > I tried a few variations of the following, but couldn't get it to work
> and
> > eventually gave up, and ended up just assuming a recommended repo
> > structure
> > and using URL pattern matching to pull out the base url.
> > [code]
> > class ReleasePluginConvention {
> >     ...
> >
> >     def svn = new SvnReleasePluginConvention()
> >
> >     void svn(Closure closure) {
> >        closure.delegate = svn
> >     }
> >
> >     void release(Closure closure) {
> >         closure.delegate = this
> >         closure.call()
> >     }
> > }
> > [/code]
> >
> > Is there a proper way to do this, or a way I can get this to work?
> >
> > Thanks,
> > Eric
> >
> > --
> > Learn from the past. Live in the present. Plan for the future.
> > Blog: http://eric-berry.blogspot.com
> > jEdit &lt;http://www.jedit.org&gt; - Programmer's Text Editor
> > Bazaar &lt;http://bazaar.canonical.com&gt; - Version Control for Humans
> >
>
>
> --
> View this message in context:
> http://gradle.1045684.n5.nabble.com/nested-plugin-convention-objects-tp4760581p4760760.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>


-- 
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