Use propertycopy or similar Task with regex from antcontrib
-- Jürgen Knuplesch www.icongmbh.de icon Systemhaus GmbH Tel. +49 711 806098-275 Sophienstraße 40 D-70178 Stuttgart Fax. +49 711 806098-299 Geschäftsführer: Uwe Seltmann HRB Stuttgart 17655 USt-IdNr.: DE 811944121 -----Ursprüngliche Nachricht----- Von: Martin Gainty [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 6. Februar 2008 00:21 An: Ant Users List Betreff: Re: Substituting the value according to the property name could your provide an example on how you envision using ${${x}} thanks M- ----- Original Message ----- From: "norken76" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Tuesday, February 05, 2008 6:12 PM Subject: Re: Substituting the value according to the property name > > 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: [EMAIL PROTECTED] For > > additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > 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: [EMAIL PROTECTED] For additional > commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
