ahh, got it! hah

I have this in a filters.xml

<?xml version="1.0" encoding="UTF-8"?>
<project>
    <filterset id="filters">
        <filter token="LOGS_DIR" value="${logs.dir}"/>
        <filter token="DATABASE_URL" value="${am.db.url}"/>
    </filterset>
</project>

this in the build.xml

<import file="filters.xml"/>

and then this in my ant copy tasks:

        <copy todir="${war.staging.dir}/WEB-INF" overwrite="true">
            <fileset dir="${basedir}/WebRoot">
                <include name="*.xml"/>
            </fileset>
            <filterset refid="filters"/>
        </copy>

So in the end, it just happens that the way the filterset is implemented in my 
case is "wonky" to say the least.

I imagine, maybe, I could ant.import my filters.xml directly into my 
build.gradle,a nd then just refer to the filters redid

maybe :)?

Roger


On Dec 22, 2009, at 11:23 AM, Steve Appling wrote:

> 
> 
> On 12/22/2009 11:03 AM, Roger Studner wrote:
>> And if I have a pre-existing filters.xml, just a matter of parsing it and 
>> building up the filter map?
>> 
>> I guess I wasn't as clear as I should be.. just trying to find as many 
>> "awesome" ways to bridge the gap between ant/maven.
>> 
>> I'm trying to get my workplace to adopt gradle hah, and the maven people are 
>> one set of arguements.. and an "Ant person" came at me about their many-many 
>> page filters.xml file.
>> 
>> Custom groovy code to process it with XmlSlurper is "super-cool" but isn't 
>> as Gradley (groovy) as I figured it might be.
>> 
>> Roger
>> 
>> On Dec 22, 2009, at 10:57 AM, Steve Appling wrote:
>> 
>>> 
>>> 
>>> On 12/22/2009 8:39 AM, Roger Studner wrote:
>>>> Was curious.. I found some chatter about this around Gradle 0.4 on various 
>>>> sites.. but I can't seem to find an example that works with 0.8.
>>>> 
>>>> I have an ant build i'm converting over, that makes use of a filters.xml  
>>>> (@OPTION_CACHING_TRUE@ kind of nonsense).
>>>> 
>>>> Can I 'hook that in' in a gradle way to handle it?  or do I need to do 
>>>> some kind of ant.copy adhoc thing that just copy a file from an out of 
>>>> bounds location into the right spot "pre" everything else?
>>>> 
>>>> Thanks!
>>>> Roger
>>>> 
>>> 
>>> You could replace the processResources task with a Copy task to copy to the 
>>> classes directory and use filtering.  See the top of the Copy task javadoc 
>>> (http://gradle.org/0.8/docs/javadoc/?org/gradle/api/tasks/Copy.html) for an 
>>> example of copying using filtering.
>>> 
>>> --
>>> Steve Appling
>>> Automated Logic Research Team
>>> 
> 
> The filtering (token replacing) mechanism in Ant that I am familiar with uses 
> a properties file, not an xml file (like filtersfile property of a filterset 
> - http://ant.apache.org/manual/CoreTypes/filterset.html).  You can do that in 
> Gradle fairly easily:
> 
> Properties props = new Props()
> props.load(...)
> 
> copy {
>    from 'path_to_file_to_be_filtered'
>    into ...
>    filter(ReplaceTokens, tokens: props)
> }
> 
> 
> -- 
> Steve Appling
> Automated Logic Research Team
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>   http://xircles.codehaus.org/manage_email
> 
> 


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

    http://xircles.codehaus.org/manage_email


Reply via email to