On Wed, Mar 24, 2010 at 01:25, Hans Dockter <[email protected]> wrote: > Hi Jesse, > > On Wed, Mar 24, 2010 at 8:18 AM, Jesse Eichar <[email protected] > > wrote: > >> Hi, >> >> I want to do the ant filter: >> >> ant.copy (todir: "$buildDir/webappSource") { >> fileset(dir: "src/main/filtered-webapp") >> filterset (begintoken: '@', endtoken: '@'){ >> filtersfile(file: >> "${project(':proxy:config').projectDir}/filters/global-resource.filter") >> } >> } >> >> I can see from the API how to do this if the filters are in memory. >> Something like: >> >> task copyTask(type: Copy) { >> from 'src/main/webapp' >> into 'build/explodedWar' >> >> filter(ReplaceTokens, tokens:[copyright:'2009', version:'2.3.1']) >> } >> >> Should I use ReplaceTokens and simply pass the Properties object to the >> method? Or is there a cleaner way? >> > > The above is the supposed way of doing it. >
This works fine, but there really should be a cleaner way in Gradle to do this. It's a very common thing and maybe some syntactic sugar is in order (at the very least something like tokenFile: <properties file>) so there's no need to build the properties yourself. Of course then you get into the problem of multiple properties files. > - Hans > > -- > Hans Dockter > Founder, Gradle > http://www.gradle.org, http://twitter.com/gradleorg > CEO, Gradle Inc. - Gradle Training, Support, Consulting > http://www.gradle.biz > > >> Thank you Jesse >> > > -- Jason Porter Software Engineer Open Source Advocate PGP key id: 926CCFF5 PGP key available at: keyserver.net, pgp.mit.edu
