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 Wed, 06 Feb 2008 18:39:24 GMT

ok.. I am passing a list of properties to my project and along this I am
passing a comma separated of the names of this properties so that I can loop
thru their names, however their names are now held in a property {$param} in
the loop. so I need to get the value of the value that the param (in the
loop) holds.

I was able to achieve this functionality by using JavaScript as follow :

<script language="javascript"> <![CDATA[
			prop = 'project'.createTask("property");
			prop.setName("pValue");
			prop.setValue('project'.getProperty('project'.getProperty("param")));
			prop.perform();
		   ]]> </script>

so this gives me a new property that holds the value I was looking for
"${{param}}"

thanks


mgainty wrote:
> 
> could your provide an example on how you envision using ${${x}}
> 
> thanks
> M-
> ----- Original Message -----
> From: "norken76" <nabilma75@yahoo.com>
> To: <user@ant.apache.org>
> 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: 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
>>
>>
> 
> 
> ---------------------------------------------------------------------
> 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-tp2944791p15309897.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