ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin Manolache <cmanola...@yahoo.com>
Subject Re: Ant 2.0
Date Mon, 09 Feb 2004 02:18:18 GMT
Steve Loughran wrote:
> I know Ant2.0-the-rewrite is essentially dead (and essentially obsolete 
> through evolution in the codebase), but I still think we ought to 
> consider using the name as and when the time is appropriate. If we add 
> enough interesting stuff to 1.7, it could be the time.

Please, not again :-)


> 
> One thing that was voted on (positively, I recall), way  way back in 
> time, was for Ant2.0 to fail on undefined properties.
> 
> Having just struggled with a build file refactor that introduced the 
> problem, a problem I only dealt with by resorting to IntelliJ's 
> property-aware ant file editor, I am starting to think the 
> fail-on-undefined property mechanism is good.
> 
> But at the same time, those echo statements with undefined properties 
> are ubiquitous, and they need to stay in. And we need the option of 
> turning strict property evaluation off or on.


> 
> My preferred way to do this would be to
> 
> 
> 1. either or both of
>     a new command line option,
>     a new property to set.
> to turn strict property evaluation on.
> 
> The nice thing about these two is that they can be applied to existing 
> files. The property set tactic would let you use build.properties to set 
> the flag, and enable inline in projects that will still work in ant 1.6, 
> but get complex w/ <ant> and <antcall>
> 
> 2. in strict mode, any expansion of a unknown property into a string 
> would throw a BuildException

> 
> 3. But there would be a non-throwing expansion method for code that 
> explicitly wanted to not fail on missing strings in their .
> 
> 4. <echo>, <fail> and a few others would be modified to use the new non 
> throwing expansion mechanism.
> 
> The problem with this is that while
> 
> <echo>${undefined}</echo> would work as intended,
> 
> <echo message="${undefined}" /> would always throw an exception.
> 
> The only fix there would be a new datatype NonvalidatingString() that 
> would expand properties but not bail.
> 
> Would that be enough? Would it work and be usable?


What about just displaying a warning "Use of undefined property foo at 
line xxx" instead of failing ?

I suppose the problem was that undefined properties were just ignored, 
and you had a hard time debugging this ( I had similar problems many 
times ).

I would preffer a warning for undefined properties outside echo/fail 
instead of the option to fail - since in the second case it may fail in 
too many build.xml files, forcing people to just disable it.

Costin


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


Mime
View raw message