ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Srinivas_Chand...@McAfee.com>
Subject Substituting the value according to the property name
Date Tue, 14 Feb 2006 10:14:26 GMT

We are replacing the occurrence of a string with another value by
reading a predefined property file as given below.

<property file="${rootdir}/build.properties"/>

<target name="editversion">
    <delete file="ems.iap_xml"/>
    <copy file="emsMaster.iap_xml" tofile="ems.iap_xml"/>
    <replace file="ems.iap_xml" token="$$PRODUCT_VERSIONMAJOR$$"
value="${ems.versionmajor}"/>
</target>

The above file i.e. ems.iap_xml is getting replaced perfectly with the
defined values. 

For example the token $PRODUCT_VERSIONMAJOR$ has been replaced with '1'
after running the above script.(as defined in build.properties file)

However, if the user made some changes for the file emsMaster.iap_xml,
the requirement is to bring back the old strings(values) for those
property names. So the script which has been used for replacing back is
as below.

<target name="savepackage" depends="setupedit">
    <delete file="emsMaster.iap_xml"/>
    <copy file="ems.iap_xml" tofile="emsMaster.iap_xml">
	<replace file="emsMaster.iap_xml" token="${ems.versionmajor}"
value="$$PRODUCT_VERSIONMAJOR$$"/>
  </target>

However, with this script iam facing the problem that what ever the
property values are '1' in the emsMaster.iap_xml it is getting replaced
with values $PRODUCT_VERSIONMAJOR$

For example the emsMaster.iap_xml file contains the following entries :

<property name="productVersionMajor">
						<int>1</int>
					</property>
<property name="imageOption">
	<int>1</int>
</property>

In the above script, the requirement is to replace the value of 1 for
the ProductVersionMajor property to $PRODUCT_VERSIONMAJOR$
but not to the imageOption property. How can we achieve this one?

Thanks,
Srinivas 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message