On Wed, Nov 4, 2009 at 15:16, Adam Murdoch <a...@rubygrapefruit.net> wrote:
>
>
> Hans Dockter wrote:
>
> On Nov 4, 2009, at 3:04 PM, Jason Porter wrote:
>
> Sent from my iPhone
> On Nov 4, 2009, at 4:43, Levi Hoogenberg <levihoogenb...@gmail.com> wrote:
>
> Hi Jason,
>
> I don't know if it's the Gradle way, but in one of my projects' build.gradle
> I have the following:
>
> processResources {
>     filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [version:
> project.version])
> }
>
> This replaces @version@ in a property file, so that it can be read from the
> code.
>
> The processResources task is of type Copy.
> See
> Javadoc: http://gradle.org/0.8/docs/javadoc/index.html?org/gradle/api/tasks/Copy.html
> What you could do in your case:
> Properties props = new Props()
> props.load(...)
> copy {
>    from 'path_to_file_to_be_filtered'
>    into ...
>    props.each { key, value ->
>       filter(ReplaceTokens, tokens: props) // It depends on you set up if
> this is exactly what you want.
>    }
> }
>
> This seems like such a common thing to do, we should probably add some
> convenience methods for doing this. Or perhaps there should be something in
> the convention or in each source set, for properties to substitute into the
> resources of the source set.
>
>
> --
> Adam Murdoch
> Gradle Developer
> http://www.gradle.org
>

+10

-- 
Jason Porter
Real Programmers think better when playing Adventure or Rogue.

PGP key id: 926CCFF5
PGP fingerprint: 64C2 C078 13A9 5B23 7738 F7E5 1046 C39B 926C CFF5
PGP key available at: keyserver.net, pgp.mit.edu

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

    http://xircles.codehaus.org/manage_email


Reply via email to