ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From norken76 <nabilm...@yahoo.com>
Subject Re: Substituting the value according to the property name
Date Tue, 05 Feb 2008 23:12:54 GMT

Hello guys,
I couldn't find a hint for my question.. so I am asking it here.
so, has anyone used a way to achieve the ${${x}}
which means.. to get a value of a property value. ????


thanks 

 

Srinivas_Chandolu wrote:
> 
>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Substituting-the-value-according-to-the-property-name-tp2944791p15300062.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Mime
View raw message