Well, the @REPLACE@ could be handled by a <filterchain> inside a copy.
The tricky part is finding the value for ${replacing}.

You might be able to do something with the AntContrib <PropertyRegex>
task. This can take a property and munge it.

Let's say you do something like this:

<path id="replaceme">
    <fileset dir="${replace.dir}">
        <include name="*.jar"/>
    </fileset>
</path>

<property name="replace.string" refid="replaceme"/>

This will give you ${replace.string} = "foo.jar:bar.jar:fobar.jar"

Not what you want, but then you can use <propertyregex>

<propertyregex
     property="munge.replace"
     input="${replace.string}"
     regexp="[;:]"
     replace="</string>"<string>"
     global="true"/>

That will give you ${munge.replace} =
"foo.jar</string><string>bar.jar</string><string>foobar.jar"

Then, we need to add a prefix and suffix:

<property name="munge.replace2"
    value="<string>${munge.replace}</string>"/>

It's all on a single line and not separate lines, but XML doesn't care.

<copy toDir="${dest.dir}">
  <fileset dir="${src.dir}">
    <include name="*.jar">
  </fileset>
  <filterset
    token="REPLACEME"
    value="${munge.replace2"/>
</copy>

Haven't tested it, but something like that should work.

On Wed, Feb 20, 2008 at 4:20 PM, Paul J. Lucas <[EMAIL PROTECTED]> wrote:
> Given a file that contains:
>
>         @REPLACEME@
>
>  I want to use <copy> to copy the file and replace @REPLACEME@ with
>  contents like:
>
>         <string>foo.jar</string>
>         <string>bar.jar</string>
>         ...
>
>  where "foo" and "bar" are the names of the file(s) in a particular
>  directory that match a certain pattern (in this case *.jar).
>
>  Is there a way to do that?  I've read the docs but the answer isn't
>  all that obvious.  Thanks.
>
>  - Paul
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
--
David Weintraub
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to