Hi Narco,

On Oct 30, 2009, at 3:21 PM, Narco wrote:


I`m trying to reuse this example:
build.gradle

task intTestJar(type: Jar) {
   from sourceSets.intTest.classes
}


I`m trying to do it from custom plugin so I have:

public class LibraryPlugin implements Plugin {
...
def void use (Project project, ProjectPluginsContainer
projectPluginsHandler){
project.usePlugin('java')
...
project.task unitTestJar(type: Jar) {
           from project.sourceSets.unitTest.classes
       }
}
...
}

The 'task taskName(...)' syntax you can only use from the build script. We do some underlying transformation to make this legal Groovy code.

What you can do in a plugin class like above is to use the 'normal' api:

project.tasks.add('unitTestJar', Jar).from project.sourceSets.unitTest.classes

We will improve this in the future. The above way of declaring a plugin will always be possible. But alternatively you will be able to simply declare another build script as a plugin where you can use all the syntactic sugar we provide for that.

- Hans

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org



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

   http://xircles.codehaus.org/manage_email


Reply via email to