ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brown, Carlton" <Carlton.Br...@BellSouth.com>
Subject Bulk token substitution
Date Wed, 09 Nov 2005 15:09:00 GMT
Hello,

 

I'm looking to do bulk replacement of tokens in a file.  This is to
replace a perl-based build solution.    I have created the
single-replacement solution in ant, but I am somewhat stumped as to how
to do a bulk substitution.   

 

The following code copies all files named *.src to a new file without
the *.src suffix, replacing APP_HOME with /usr/local/app, as expected:

 

 

<target name="do-macro" depends="check-macro" unless="macro.uptodate">

<echo message="Status of replacement targets is ${macro.uptodate}" /> 

<copy todir="${build.root}" overwrite="true">

               <fileset dir="${src.root}" includes="**/*.src" /> 

               <mapper type="glob" from="*.src" to="*" /> 

<filterset begintoken="@#$%" endtoken="%$#@">

                         <filter token="APP_HOME" value="/usr/local/app"
/> 

            </filterset>

  </copy>

</target>

 

The problem is that we have something like 50 other tokens to replace in
addition to APP_HOME.   I do not want to clutter this build file with
the filter definitions, and I'd like to share these filter definitions
with other build tasks.   I'd like to define the filterset in an
external file, if possible.

 

Can someone get me going in the right direction?   I read the FAQ and
this does not seem to be covered.


*****
The information transmitted is intended only for the person or entity to which it is addressed
and may contain confidential, proprietary, and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon this information by
persons or entities other than the intended recipient is prohibited. If you received this
in error, please contact the sender and delete the material from all computers. 162


Mime
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message