Developing and testing plugins

Hi, I’m developing a gradle plugin for a custom sw product. The plugin is a wrap over a java jar to provide same functionalities available on command line from inside gradle builds.

Now following the samples, the tutorial online and the doc I’m able to create my plugin, register on maven repo and then call it from maven in the consumer project.

So far no problems.

Still for every change, I cannot test it directly, I need to publish the plugin, and call it from the other project to verify the feature.

So I’m wondering if it’s possible to keep the plugin source as is it (without moving it to buildSrc folder) but testing the plugin code directly from inside the plugin project.

What are the best practices when developing plugins?

Thank you

Uberto

Hi Uberto,

The support for this kind of testing is currently sub-par. It’s something we are working to address, see this spec that we are working on: https://github.com/gradle/gradle/blob/master/design-docs/testing-user-build-logic.md

There is some (non official) proof of concept code available that you could pull into your project (as source) as an interim measure: https://github.com/alkemist/gradle-test-kit

Thank you Luke, I’ll look at it tomorrow.

The current situation is not terrible anyway, I was wondering if there was something I missed.

Do you need any help? I think I can dedicate some hours a week if there is some task I can do which doesn’t require big knowledge of gradle internals.

Anyway thank you to you all for the terrific job and the quick support!

Uberto

Thank you for the offer of help. We aren’t quite ready to start on this task yet as we still have some design to do. It’s a bit complicated due to all of the factors involved so probably not going to be very enjoyable to work on.

I’ll post back here when it gets into a bit more of a concrete state with clear steps.

If you’re interested in helping out with some other stuff, http://www.gradle.org/contribute lists some things that we think are good sized features to add.