I have a git repo with a new Copy task that does not use Ant. It allows us to determine if anything was really copied (getDidWork() is accurate) and has some additional features from the current copy task.

This is in the copy branch at git://github.com/sappling/gradle.git

Hans has mentioned that he would like to get away from using Ant so much internally, so I hope this will be useful.

The syntax changed some:

* it uses include and exclude (singular) instead of the previous includes and excludes. * it supports nested CopySpecs instead of the previous map of includes/excludes per source dir (see javadoc for org.gradle.api.tasks.copy.CopySpec)
* it supports regular expression based renaming
* it supports content filtering using java.io.FilterReader

Some examples:

//basic copy is very similar to previous one
 task(mydoc, type:Copy) {
    from 'src/main/doc'
    into 'build/target/doc'
    exclude '**/*.bak'
 }

// but each from starts a new CopySpec that inherits from the root one
 task(initconfig, type:Copy) {
    from('src/main/config') {
       include '**\*.properties'
       include '**\*.xml'
       filter(ReplaceTokens, tokens:[version:'2.3.1'])
    }
    from('src/main/languages') {
       rename 'EN_US_(*.)', '$1'
    }
    into 'build/target/config'
    exclude '**\*.bak', '**\CVS\'
 }


I have a few more things I would like to change if you want to use this in 0.7. I would like to put some more details about it in the userguide (looking for the best place) and I would like to add some type of static access to it. I find that I do ant.copy all over the place inside other DefaultTasks. I can easily add a static accessor to do this, but this seems generally useful for other tasks as well. Would anyone else like a way to call all the types of tasks like this? Should this just be exposed at the project level, so you could just do:
task myTask << {
   copy() {
      from 'src/stuff'
      into 'dest'
   }
}


--
Steve Appling
Automated Logic Research Team

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

   http://xircles.codehaus.org/manage_email


Reply via email to