Wow.. had no idea this was possible with Gradle

Must go find newer docs :)

Roger

On Mar 15, 2010, at 8:53 AM, Luke Taylor wrote:

> That's pretty much what I've done to support AspectJ in Spring Security:
> 
> https://fisheye.springsource.org/browse/spring-security/gradle/aspectj.gradle?r=55de2cfcb1d7f5399149b4f46818648114d4ec05
> 
> It also allows you to more easily override the compileTestJava task as well.
> 
> Luke.
> 
> 
> On 15/03/2010 02:08, Adam Murdoch wrote:
>> 
>> 
> ....
>> 
>> I would be tempted to use a custom task for this, and use the various
>> annoations, such as @InputFiles and @OutputDirectory:
>> 
>> task compileJava(type: AspectJCompile) {
>>      ajcClasspath = configurations.ajc
>>      source = sourceSets.main.java
>>      destDir = sourceSets.classesDir
>>      // ... plus some more properties
>> }
>> 
>> class AspectJCompile extends DefaultTask { // or possibly extends SourceTask
>>      @InputFiles
>>      def FileCollection ajcClasspath
>>      @InputFiles
>>      def FileCollection source
>>      @OutputDirectory
>>      def File destDir
>>      @Input
>>      def souceCompatibility
>>      // ... plus some more properties ...
>> 
>>      @TaskAction
>>      def compile() {
>>          project.ant {
>>              taskdef(..., classpath: ajcClasspath.asPath)
>>              iajc(..., destDir: destDir, sourceCompatibility:
>> sourceCompatibility) {
>>                   ....
>>              }
>>          }
>>      }
>> }
>> 
>> This is arguably a better way of separating the 'what' and the 'how'.
>> Plus, by using the annotations, you get validation and (some) dependency
>> auto-wiring for free.
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>   http://xircles.codehaus.org/manage_email
> 
> 


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

    http://xircles.codehaus.org/manage_email


Reply via email to