ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 12044] New: - input task addproperty scope is limited to current target
Date Mon, 26 Aug 2002 16:04:47 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12044>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12044

input task addproperty scope is limited to current target

           Summary: input task addproperty scope is limited to current
                    target
           Product: Ant
           Version: 1.5
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: mcsherry@qualcomm.com


I tried to use the 'addproperty' attribute to capture user input from 
the 'input' task. The scope of the assigned property is limited to the 
containing target task.

The build file that demonstrates the problem:
---------------------------------------------

<?xml version="1.0"?>

<project name="Demo input addproperty bug" default="init" basedir="." >

<target name="init" >
   <property environment="env" />

   <antcall target="_get.input.from_cmdline" />
   <echo>
     In init (after _get.input.from_cmdline)...
     get.input is ${get.input}
     MYVAR is ${MYVAR}
   </echo>

   <antcall target="_get.input.from_env" />
   <echo>
     In init (after _get.input.from_env)...
     get.input is ${get.input}
     MYVAR is ${MYVAR}
   </echo>

</target>

<target name="_get.input.from_cmdline" unless="env.MYVAR" >
   <input message="Enter value:" addproperty="get.input" />
   <property name="MYVAR" value="${get.input}" />
   <echo>
     In _get.input.from_cmdline...
     get.input is ${get.input}
     MYVAR is ${MYVAR}
   </echo>
</target>

<target name="_get.input.from_env" if="env.MYVAR" >
   <property name="MYVAR" value="${env.MYVAR}" />
   <echo>
     In _get.input.from_env...
     get.input is ${get.input}
     MYVAR is ${MYVAR}
   </echo>
</target>

</project>

The resulting output:
---------------------

init:

_get.input.from_cmdline:
    [input] Enter value:
foobar
     [echo] 
     [echo]      In _get.input.from_cmdline...
     [echo]      get.input is foobar
     [echo]      MYVAR is foobar
     [echo]    
     [echo] 
     [echo]      In init (after _get.input.from_cmdline)...
     [echo]      get.input is ${get.input}
     [echo]      MYVAR is ${MYVAR}
     [echo]    

_get.input.from_env:
     [echo] 
     [echo]      In init (after _get.input.from_env)...
     [echo]      get.input is ${get.input}
     [echo]      MYVAR is ${MYVAR}
     [echo]    

BUILD SUCCESSFUL
Total time: 3 seconds

------- Ant diagnostics report -------
Apache Ant version 1.5 compiled on July 9 2002

-------------------------------------------
 Implementation Version (JDK1.2+ only)
-------------------------------------------
core tasks     : 1.5
optional tasks : 1.5

-------------------------------------------
 ANT_HOME/lib jar listing
-------------------------------------------
ant.jar (716139 bytes)
optional.jar (653661 bytes)
xercesImpl.jar (933730 bytes)
xml-apis.jar (108484 bytes)
jakarta-oro-2.0.6.jar (65368 bytes)

-------------------------------------------
 Tasks availability
-------------------------------------------
com/oroinc/net/SocketClient


Regards,
Mike

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message