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 32041] New: - want to remember a value set within a task next time the task is called
Date Wed, 03 Nov 2004 15:45:51 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32041>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32041

want to remember a value set within a task next time the task is called

           Summary: want to remember a value set within a task next time the
                    task is called
           Product: Ant
           Version: 1.6.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: benjamin@yangtemko.com


We have a highly distributed project encompassing many jars containing many
components all of which run on many machines across the network.  Remote deploys
are problematic given this architecture.  We currently have a base
"remote-deploy" task which prompts the user via "input" for a remote machine and
directory and uses the "scp" task to deploy there.

I'd really love to be able to remember the value the user enters here so that
the next time the "remote-deploy" task is called it can display the last value
the user gave as a default, and use that value if they just hit "return".  This
way they can tailor their builds to ask them for their first remote-deploy host,
use that until the needed files are deployed there, then give the next
remote-deploy host, then use that until the needed files are there, etc.  None
of these hosts are known until deploy-time, so it cannot be done via properties
in the build file.

Right now my only option is to pass in a default value every time I call the
"remote-deploy" task, and then prompt the user for a value if they want to use a
different value than the default.  It would be fantastic to remember the value
they enter in and use THAT as the default next time I call the task.  

In general, a "property" like entity/task which is truly mutable across the span
of the project (and not just within a target, as in the ant-contrib "variable"
task) so that it can be dynamically altered to suit the conditions of the
progression of the build based on the changing requirements as given by the user
would be phenomenal.  Right now, if a property is only referred to within a
particular Task, its scope is that Task (and any Task it antcalls), and no more
- one you're done with that Task, the property is removed, and any state-ful
information it might contain is gone with it.  

I've been studying the Ant codebase, and I don't think it's enormously difficult
(unless I'm missing something crucial about Ant's architecture (and yes, I know
"properties are non-mutable" is law, but I can't find a clear explanation of the
necessity of this fact on the site)) : a few tweaks to PropertyHelper to add a
new Hashtable to contain the mutable variables, a small tweak to add Hooks for
them, and a tweak to the replaceProperties function so that these variables are
treated as properties are for ${} substitution, and a new class to describe them.  

That, or allow us to subclass PropertyHelper to add these enhancements ourselves
(if we can subclass ProjectHelper, why not PropertyHelper?), looks like it would
do the trick...

Another possibility would be to have static properties in Tasks, so that they
are treated as static variables in a java method would be.  I'll have to
investigate that as well - might be easier than making changes to PropertyHelper...

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


Mime
View raw message