Hi there,

in my build i want to set a version property to several property files, which are part of my resources. Actually I'm doing this by adding a doLast{} to the processResources Task.
In this closure I manually
1. read the text of each property file in a specific directory (a specific package located in the target directory of the processResources task)
    2. replace a specific token in each property file if the token exists
    3. store the changed file content back to the property file

I sure there is a more gradle way to do this using filter and token. I found this snippet in the assemble.gradle file of the groovy gradle build:

#####
from("$projectDir/src/main/META-INF/groovy-release-info.properties") {
        filter {String line ->
['##ImplementationVersion##': project.version, '##BundleVersion##': project.groovyBundleVersion, '##BuildDate##': new SimpleDateFormat('dd-MMM-yyyy').format(buildTime), '##BuildTime##': new SimpleDateFormat('hh:mm aa').format(buildTime)].each {key, value ->
                line = line.replace(key, value)
            }
            line
        }
    }
#####
That has pointed me to filters in the copy spec. What I would like to do is to enrich the processResources task with a filter, which replaces all occurances of a specific token in each property file, but I'm not sure how to start here or if this is actually possible at all.

Any Ideas?

regards,
René

--
------------------------------------
Rene Groeschke

[email protected]
http://www.breskeby.com
http://twitter.com/breskeby
------------------------------------


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

   http://xircles.codehaus.org/manage_email


Reply via email to