ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@bost.de>
Subject Re: A question about "available" and doing conditionals in a build xml file.
Date Thu, 18 May 2000 09:18:50 GMT
>>>>> "KW" == Ken Wood <kwood@i2.com> writes:

 KW> Conor MacNeill wrote:
 >>  Conditional execution of tasks is a topic of considerable debate
 >> on the ant list. Many people have a strong desire to avoid
 >> creating within ant a new programming language.
 >> 
 >> Conor

 KW> I agree 100%. And, I'm new to this arena, so I'm not up to speed
 KW> on what's been proposed, debated, etc.

Be prepared to read a rather longish summary of the current
state. Everything should be read with an "if Stefan recalled
correctly" in mind.

I've entered this list by proposing setif and setunless tasks that
should be a more general approach to properties than available about
two month ago.

The proposal has been ignored by most people - probably because
they've been tired to discuss the same issues over and over again,
maybe because of my attitude.

The responses I did get boiled down to "we agree that properties are
confusing, that there should be some changes and that we don't want to
make Ant a new programming language".

Let me address the first two points separately.

"properties are confusing":

The property tasks are evaluated in the same order they appear inside
the XML-File. It doesn't matter whether they are inside targets or not - 
they are executed by the parser before anything else happens.

The ${property} thingies get replaced by the parser, there is no
runtime evaluation of these constructs. The if and unless attributes
found in several places work because they get passed the name of an
property not a ${} construct.

"there should be some changes":

Take a look at spec/core.html to see a first cut on the current
discussions state.

The main changes are that tasks get instantiated at runtime, just
before they are actually executed, and are expected to access
properties through the project. Note there is no mention of the ${}
construct at all.

Some things you don't find there:

Most (all?) people involved agree that some way of conditional
compilation - or more generally conditional task execution - is
needed, but there are different opinions about how to do this.

One way is to use properties as flags - this is the way Ant works
right now. If we stick to this, I agree an unless attribute should be
added to Target to complement the if attribute. Sometimes it is easier
to check for the condition you don't want to see.

Another way would be to use an external scripting language and allow
it to modify tasks. The - optional - script task would be a starting
point. This would make Ant depend on the presence of some external
scripting language parser.

The other uses of properties:

Define pathnames or other "constants". This could be done with a
property implementation like the one currently present, it could be
done using a "better" property implementation (where you would have a
File instance for directories ...) or it could be done with XML
entities (which would mean they were immutable).

Define "constants" who's value can only be determined at build time
(current time, CVS revision numbers, ...). I cannot remember anybody
addressing this.

Flags of all kinds like build.compiler to specify which compiler to
use in the javac task. There is a proposal by Sam Ruby to replace
those with some kind of style sheet.

There has been a very active discussion period for two or three weeks
around easter but most of the participants vanished soon
thereafter. Guess their main focus has switched to Tomcat or their
lives again 8^).

Stefan

Mime
View raw message