Gradle & AspectJ

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

Gradle & AspectJ

Jira
Hi all,

has anyone solved integration of AspectJ with Gradle. From perspective of ANT I need to compile with iajc not with javac.

Should I write mine own plugin, or can I just replace the compile tasks with something else?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Gradle & AspectJ

hans_d
Administrator

On Oct 1, 2008, at 11:02 PM, Jira wrote:

>
> Hi all,
>
> has anyone solved integration of AspectJ with Gradle. From  
> perspective of
> ANT I need to compile with iajc not with javac.
>
> Should I write mine own plugin, or can I just replace the compile  
> tasks with
> something else?

Either you replace the compile task within your build script. Or you  
write a plugin that does this. The latter has the advantage that you  
can reuse it and submit it as a patch to Gradle ;)

The most straight forward way to overwrite the compile task would be  
to say in your script:

createTask(dependsOn: JavaPlugin.RESOURCES, overwrite: true) {
       ant.iajc(classpath: dependencies.resolve(...), ...)
}

To integrate AspectJ the Gradle way you would write your own Gradle  
AspectJCompile task which provides an API for configuring it and  
would integrate with the conventions. It would be an implementation  
detail that it delegates to Ant.

This aspectJ plugin would extend the Java plugin. You might have a  
look at the war plugin for an example.

- Hans

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





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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Gradle & AspectJ

Jira
Hi,

thanks a lot for quick answer. I try to create new plugin integrating the AspectJ, because it will be usable to others too.

Thanks and hope finish soon ...

Jirka

hdockter wrote
On Oct 1, 2008, at 11:02 PM, Jira wrote:

>
> Hi all,
>
> has anyone solved integration of AspectJ with Gradle. From  
> perspective of
> ANT I need to compile with iajc not with javac.
>
> Should I write mine own plugin, or can I just replace the compile  
> tasks with
> something else?

Either you replace the compile task within your build script. Or you  
write a plugin that does this. The latter has the advantage that you  
can reuse it and submit it as a patch to Gradle ;)

The most straight forward way to overwrite the compile task would be  
to say in your script:

createTask(dependsOn: JavaPlugin.RESOURCES, overwrite: true) {
       ant.iajc(classpath: dependencies.resolve(...), ...)
}

To integrate AspectJ the Gradle way you would write your own Gradle  
AspectJCompile task which provides an API for configuring it and  
would integrate with the conventions. It would be an implementation  
detail that it delegates to Ant.

This aspectJ plugin would extend the Java plugin. You might have a  
look at the war plugin for an example.

- Hans

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





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

    http://xircles.codehaus.org/manage_email