ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craeg Strong <>
Subject Re: PROPOSE: Property Trace Facility For Ant?
Date Wed, 09 Nov 2005 21:32:35 GMT
Dominique Devienne wrote:

>So obviously I'm +1 on adding such a facility, but implementing it the
>way you propose is indeed disruptive.
>Alternate impls (disclaimer: I'm just thinking aloud here...) might be:
>1) Add categories to log messages. You could then change the log
>statements in property-related tasks (and in Project) to use this new
>"property" log category, and add a switch to the launcher to allow
>saying -verbose:property or -debug:property and get only these
>particular log messages.
Cool!  Continuing this thought experiment, what about enhancing 
BuildListener like so:

     * Signals that a property has been set.
     * @param event An event with any relevant extra information,
     *              for example, the name of the property and whether
     *              the property was set successfully or was an ignored 
    void propertySet(PropertyEvent event);
     * Signals that a property has been retrieved, for example,
     * the text "I am using the ${foo} property" in an echo task
     * could trigger this event.
     * @param event An event with any relevant extra information,
     *              for example the name of the property.
    void propertyGet(PropertyEvent event);

You could have PropertyHelper fire the propertyGet event in 
replaceProperties(), for example.

The issue with these events is the same one you normally have with 
That is, at the time an exception is thrown deep in the guts of a 
program you typically don't have enough context.
Here in replaceProperties() we don't have a reference to the calling 
Task, only the Project.

The typical solution for exceptions is to cascade them up the chain, 
either directly or within an enclosing Exception.

A similar approach for events might be to simply accumulate the 
propertyGet events within the scope of the PropertyHelper and then
print them out later in the taskFinished() event message.  
Alternatively, we don't worry about the loss of context,
relying on the surrounding taskStarted/taskFinished events to provide 
the context-- as long as there are not multiple threads going on.

What do you think? 


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message