Adam,

Thanks for the example of filtering using properties. I was looking for this before as well, but didn't find it. Can I suggest the online documentation at http://www.gradle.org/0.9-rc-3/docs/userguide/userguide_single.html#filterOnCopy be expanded to include an example using a properties file to contain the replacements?

-Ken

Adam Murdoch wrote:

On 19/11/2010, at 2:04 AM, richardm wrote:


Using the examples above I get the error:  unable to resolve class Props

I can't see this in the API docs for 0.9-rc-3. What import do I need to use
the Props class?

There's no Props class. You probably want a java.util.Properties.


   Properties props = new Props()
   props.load(new FileInputStream("$rootDir/build.properties"))

   copy {
      from 'GUI/src/BuildVersionTemplate'
      into 'GUI/src/BuildVersion.properties'

The into() method specifies a directory to copy into. So, you'll end up with a file called 'GUI/src/BuildVersion.properties/BuildVersionTemplate'. We do want to add some way for you to specify the final file name, but we haven't done so yet.

You might do something like this as a work around:

into 'GUI/src'
rename 'BuildVersionTemplate', 'BuildVersion.properties'


      props.each { key, value ->
         filter(ReplaceTokens, tokens: props) // It depends on you set up
if this is exactly what you want.
      }


You can replace the above with something like (ie get rid of the each { } loop)

filter(ReplaceTokens, tokens: props)


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz


--
= Enterprise Data Services Division ===============
| CIRES, National Geophysical Data Center / NOAA  |
= Ken.Tanaka&noaa.gov =============================


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

   http://xircles.codehaus.org/manage_email


Reply via email to