Gradle and Plugins

View: New views
2 Messages — Rating Filter:   Alert me  

Gradle and Plugins

by Russel Winder-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Now that 0.6 is successfully out of the door, I would like to start a
campaign to make it really easy for people to write their own plugins
without having to embed things into the Gradle distribution.

I think there needs to be a hierarchy of lookup of plugins:

        per project plugins
        per user plugins
        per installation plugins
        core distribution plugins

using a directory name of "plugins" (though this could be changed of
course), one could envisage:

        <project-directory>/plugins
        ~/.gradle/plugins
        /usr/share/gradle/plugins
        /usr/share/gradle/core-plugins

or something equivalent for systems other than Debian/Ubuntu.

A plugin is then a directory with a set of jars to be added to the
classpath of the build.  I don't think there is any need for any
structure to the directory or any metadata but this could be added.
(This is a simplistic suggestion to get things started, but it would
work.)

The search lookup could be hardwired (as many systems do) or it could be
driven by an environment variable with just the core plugins included by
default (some systems work this way, but I find it more awkward).

--
Russel.
============================================================
Dr Russel Winder                 Partner

Concertant LLP          t: +44 20 7585 2200, +44 20 7193 9203
41 Buckmaster Road,     f: +44 8700 516 084    voip:  sip:russel.winder@...
London SW11 1EN, UK.    m: +44 7770 465 077    xmpp: russel@...


signature.asc (204 bytes) Download Attachment

Re: Gradle and Plugins

by Adam Murdoch-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Russel Winder wrote:
> Hi,
>
> Now that 0.6 is successfully out of the door, I would like to start a
> campaign to make it really easy for people to write their own plugins
> without having to embed things into the Gradle distribution.
>
>  

But you already can. It's really easy. It just needs a little
documentation. The process:

1. implement Plugin
2. bundle the implementation into a jar
3. publish the jar + some dependency meta-info to a repository where
people can find it
4. let people know the plugin exists

If your implementation is in the buildSrc project, or in a build script,
you can skip steps 2-4. Also, steps 2-4 are exactly what you have to do
if you are producing a java library. The only Gradle plugin specific
step is to implement Plugin.

To use a custom plugin

1. add a dependency declaration on the plugin jar in your settings.gradle
2. usePlugin(pluginImplClass)

If your implementation is in the buildSrc project or in a build script,
you can skip step 1. Also, step 1 is exactly what you have to do if you
are using a java library in your build. The only plugin specific step is
to usePlugin().

It really is really easy. Of course, there will be things we can do to
make things a little easier, but it already does work quite well.


Adam


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

    http://xircles.codehaus.org/manage_email