Context aware delegateTo in my DSLD

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Context aware delegateTo in my DSLD

Rene Groeschke
Hi there,
I'm trying to create a DSLD file for gradle. In general a gradle
buildfile is of type org.gradle.api.Project. so I've started with this:

----------------------
def gradleFile = fileExtension("gradle") & isScript()

gradleFile & (~inClosure()).accept {
     provider = "Gradle DSL"
     delegatesTo "org.gradle.api.Project"
}
----------------------

now in my example buildfile I have the following snippet:
----------------------
repositories{
}
----------------------

inside this repositories closure, all calls are delegated to another
interface named "org.gradle.api.artifacts.dsl.RepositoryHandler"

I tried to add this delegation with the following dsld snippet:
----------------------
(gradleFile & inClosure() & enclosingCallName("repositories")).accept {
     delegatesTo "org.gradle.api.artifacts.dsl.RepositoryHandler"
}
----------------------

but this doesn't seem to work. do I miss something obvious here?

regards,
René



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Context aware delegateTo in my DSLD

Andy Clement
Andrew is the DSLD guy, as you know, he's on vacation for a few days.
Whether he'll reply before he gets back, I'm not sure.

Incidentally, I wasn't imagining all the features of code
assist/inferencing around gradle files would be handled by a DSLD. I
think we may be able to do some things more optimally by building them
directly into the gradle plugin.

cheers
Andy

On 5 July 2011 15:24, Rene Groeschke <[hidden email]> wrote:

> Hi there,
> I'm trying to create a DSLD file for gradle. In general a gradle
> buildfile is of type org.gradle.api.Project. so I've started with this:
>
> ----------------------
> def gradleFile = fileExtension("gradle") & isScript()
>
> gradleFile & (~inClosure()).accept {
>     provider = "Gradle DSL"
>     delegatesTo "org.gradle.api.Project"
> }
> ----------------------
>
> now in my example buildfile I have the following snippet:
> ----------------------
> repositories{
> }
> ----------------------
>
> inside this repositories closure, all calls are delegated to another
> interface named "org.gradle.api.artifacts.dsl.RepositoryHandler"
>
> I tried to add this delegation with the following dsld snippet:
> ----------------------
> (gradleFile & inClosure() & enclosingCallName("repositories")).accept {
>     delegatesTo "org.gradle.api.artifacts.dsl.RepositoryHandler"
> }
> ----------------------
>
> but this doesn't seem to work. do I miss something obvious here?
>
> regards,
> René
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email