On 06/01/2011, at 7:37 AM, Zsolt Kovacs wrote:

> Hi,
> 
> I am using gradle to build my project for which I am also developing a 
> plugin. I started to use buildSrc as it seems to be the easiest approach. The 
> plugin has external jar dependencies and also depends on the 'root' project 
> classes. It took me some time to figure out that buildSrc can have its own 
> build.gradle file to specify the external dependencies because I was assuming 
> that the compile dependencies of the root project are also available for 
> buildSrc:compileGroovy. I think this information should be added to the user 
> guide. 

A good idea.

> 
> But now I am facing the problem that my plugin also uses the class from the 
> root project. This means that I would like to add the 
> rootProjectDir/build/classes/main to the classpath of the build script. Is 
> this possible?

How is the plugin going to be used? Is the plugin used by the build for the 
root project?

It will be difficult (but should be possible) to get this to work if the root 
project build uses the plugin, as you have a nasty dependency cycle there: the 
plugin needs the compiled root project classes, but the build for the root 
project classes needs the plugin.


> 
> In fact it seems to me that buildSrc behaves as a subproject,

It's a separate build. Gradle builds it before running any of the build scripts 
for the main build. It should not depend on the main build.

Over time, we want to make buildSrc less of a special case, so that you can 
instead use regular projects and builds to achieve the same thing. For example, 
you might be able to add a build time project dependency on another project, 
and that project's runtime classpath will be available to the build script.


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to