You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by George Storm <gs...@divxcorp.com> on 2007/04/30 12:30:38 UTC

Indirect property lookup failing.

I am experimenting with ways to change the case of the text I am passing to
a target. In the following test I have created a small table which I am
accessing indirectly.

>From my primary call (ant-test) I call (target1) which creates a compound
string which will be used to lookup my replacement string (target2) which
will be used by my final target (target3).

My problem is that in target2 instead of it returning the contents of my
property it is returning the name of the property.

Your assistance would be appreciated.

Thanks,

- George Lawrence Storm, DivX, Inc.

----------------

Actual script:

<project name = "AntTest3" default = "lookup-test" basedir = ".">

    <property name = "txt.l.dosomething" value = "dosomething"/>
    <property name = "txt.t.dosomething" value = "Dosomething"/>
    <property name = "txt.u.dosomething" value = "DOSOMETHING"/>

    <target name = " lookup-test">
        <echo message = "txt.l.dosomething: ${txt.l.dosomething}"/>
        <echo message = "text.t.dosomething: ${txt.t.dosomething}"/>
        <echo message = "txt.u.dosomething: ${txt.u.dosomething}"/>

        <antcall target = "target1">
            <param name = "action" value = "dosomething"/>
        </antcall>
    </target>

    <target name = "target1">
        <echo message = "action: ${action}"/>
        <antcall target = "target2">
            <param name = "txt.action" value = "txt.t.${action}"/>
        </antcall>
    </target>

    <target name = "target2">
        <echo message = "txt.action: ${txt.action}"/>
        <antcall target = "target3">
            <param name = "do.action" value = "${txt.action}"/>
        </antcall>
    </target>

    <target name = "target3">
        <echo message = "do.action: ${do.action}"/>
    </target>

</project>

----------------

Result:

lookup-test:
     [echo] txt.l.dosomething: dosomething
     [echo] text.t.dosomething: Dosomething
     [echo] txt.u.dosomething: DOSOMETHING

target1:
     [echo] action: dosomething

target2:
     [echo] txt.action: txt.t.dosomething

target3:
     [echo] do.action: txt.t.dosomething


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


Re: Indirect property lookup failing.

Posted by Martin Gainty <mg...@hotmail.com>.
Hi George

yes properties are by design immutable (once set cannot change)
I think you may want to look at implementing dynamic set capability with 
'variable'
http://ant-contrib.sourceforge.net/tasks/tasks/variable_task.html

Does this help?
M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- 
From: "George Storm" <gs...@divxcorp.com>
To: <us...@ant.apache.org>
Sent: Monday, April 30, 2007 6:30 AM
Subject: Indirect property lookup failing.


>I am experimenting with ways to change the case of the text I am passing to
> a target. In the following test I have created a small table which I am
> accessing indirectly.
>
> From my primary call (ant-test) I call (target1) which creates a compound
> string which will be used to lookup my replacement string (target2) which
> will be used by my final target (target3).
>
> My problem is that in target2 instead of it returning the contents of my
> property it is returning the name of the property.
>
> Your assistance would be appreciated.
>
> Thanks,
>
> - George Lawrence Storm, DivX, Inc.
>
> ----------------
>
> Actual script:
>
> <project name = "AntTest3" default = "lookup-test" basedir = ".">
>
>    <property name = "txt.l.dosomething" value = "dosomething"/>
>    <property name = "txt.t.dosomething" value = "Dosomething"/>
>    <property name = "txt.u.dosomething" value = "DOSOMETHING"/>
>
>    <target name = " lookup-test">
>        <echo message = "txt.l.dosomething: ${txt.l.dosomething}"/>
>        <echo message = "text.t.dosomething: ${txt.t.dosomething}"/>
>        <echo message = "txt.u.dosomething: ${txt.u.dosomething}"/>
>
>        <antcall target = "target1">
>            <param name = "action" value = "dosomething"/>
>        </antcall>
>    </target>
>
>    <target name = "target1">
>        <echo message = "action: ${action}"/>
>        <antcall target = "target2">
>            <param name = "txt.action" value = "txt.t.${action}"/>
>        </antcall>
>    </target>
>
>    <target name = "target2">
>        <echo message = "txt.action: ${txt.action}"/>
>        <antcall target = "target3">
>            <param name = "do.action" value = "${txt.action}"/>
>        </antcall>
>    </target>
>
>    <target name = "target3">
>        <echo message = "do.action: ${do.action}"/>
>    </target>
>
> </project>
>
> ----------------
>
> Result:
>
> lookup-test:
>     [echo] txt.l.dosomething: dosomething
>     [echo] text.t.dosomething: Dosomething
>     [echo] txt.u.dosomething: DOSOMETHING
>
> target1:
>     [echo] action: dosomething
>
> target2:
>     [echo] txt.action: txt.t.dosomething
>
> target3:
>     [echo] do.action: txt.t.dosomething
>
>
> ---------------------------------------------------------------------
> 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