Hi Steve,

Thanks a lot for your reply.

You wrote:
>Maybe echo isnt updating its string. Just go Project.log() instead.

What does it mean ? 
I try to apend the code below:
project.log( echoval,"XXX", Packages.org.apache.tools.ant.Project.
MSG_WARN);

But this doesn't work,,,
I try to do MSG_DEBUG, MSG_ERR, MSG_INFO, MSG_VERBOSE ...
The output of console did display the same result..

Best Regards,
trad-ex


>trad-ex wrote:
>> Hi Scot,
>> Hi folks,
>> 
>> Sorry for my late response & poor English.
>> 
>> I try to organize the discussion on this thread.
>> As originally questions by other person, how can he pass values from a 
>> script into a target in spite of the immutablity of properties in Ant ?
>> A part of his script is below:
>> 
>> <target name="test">
>>   <script language="javascript"><![CDATA[
>>     project = self.getProject();
>>     echo = project.createTask("echo");
>>     project.setProperty("theVal", "foo");
>>     echo.setMessage(project.getProperty("theVal"));
>>     echo.perform();
>>     echoval.execute();
>>     project.setProperty("theVal", "bar");
>>     echo.setMessage(project.getProperty("theVal"));
>>     echo.perform();
>>     echoval.execute();
>>   ]]></script>
>> </target>
>> <target name="echoval">
>>    <echo>${theVal}</echo>
>> </target>
>> 
>> This script produces the following output.
>> 
>>    test:
>>         [echo] foo
>>         [echo] foo
>>         [echo] bar
>>         [echo] foo ( -> bar expected )
>> 
>> So, because the way of getting rid of immutability is using VariableTask 
>> in Ant-contrib, I tried to change his script above like this below:
>> 
>>   <script language="javascript"><![CDATA[
>>     project = self.getProject();
>>     echo = project.createTask("echo");
>>     variable = project.createTask("var");
>>     variable.setName("theVal");
>>     variable.setValue("foo");
>>     variable.execute();
>>     echo.setMessage(project.getProperty("theVal"));
>>     echo.perform();
>>     echoval.execute();
>>     variable.setName("theVal");
>>     variable.setValue("bar");
>>     variable.execute();
>>     echo.setMessage(project.getProperty("theVal"));
>>     echo.perform();
>>     echoval.execute();
>>   ]]></script>
>> 
>> But, this script replicated the same result
>> 
>>         [echo] foo
>>         [echo] foo
>>         [echo] bar
>>         [echo] foo ( -> bar expected )
>
>Maybe echo isnt updating its string. Just go Project.log() instead.
>
>> 
>> So I consulted the javadoc of Ant, I found that org.apache.tools.ant.
>> Project#setProperty can overwrite the given property!
>> 
>> My questions are:
>> 1. Why couldn't the first script overwrite the value of property ?
>>    It's not because of immutability, IMHO.
>
>maybe it did, and the logging is wrong
>
>> 2. What's wrong with my ( second ) script ?
>
>same as with the first?
>
>> 3. Without using MacrodefTask, can this issue be solved just by 
>> ScriptTask ?
>
>It looks to me like you are overwriting a property. 
>Project.setNewProperty() implements immutability rules, but 
>Project.setProperty() doesnt.
>
>---------------------------------------------------------------------
>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]

Reply via email to