List Info

Thread: Ant default target




Ant default target
user name
2006-10-25 16:30:34
Pavel Tankov wrote:
> I am looking at the ant build.xml file for the first
time more closely now. I had noticed that the
> default target doesn't make or build, but prints
messages which I find cool, however it appeared
> that these messages are hardcoded. I searched the DEV
mailing list and here was a previous
> discussion about this:
> https://sip-communicator.dev.ja
va.net/servlets/ReadMsg?listName=dev&msgNo=469
> 
> So, my question is, can we make these messages somehow
read what is in the description attributes
> of the targets, instead having to sync it manualy with
every change? I mean, to make the default
> target be like when you call "ant -p".
> 

I haven't changed my opinion, but that does not mean I am
correct.

a) The default target is a "safe" usage prompt.
This protects someone 
who doesn't know what he or she is doing from destroying the
contents of 
their sandbox by accident. In other words, if you don't know
what target 
to specify, you cannot do any harm... AND ... the default
target gives 
you help deciding what target you might like to run.

If you accept this philosophy about the default target (it
is becoming 
common practice on many open source projects), then it makes
sense to do 
what we have, i.e. hard-code brief but helpful instructions
about ONLY 
the important targets.


b) One of the lines in the default target (it is
meaningfully called 
"usage") tells you how to run ant with the
"-projecthelp" argument. This 
option will generate a COMPLETE list of ALL external targets
within 
build.xml. The list includes the values of the description
tags of each 
target, which can be quite long and would not format nicely
(try it on a 
normal command prompt). That's why we hardcode the
description strings 
in the "usage" target... so they format as nicely
as possible without 
losing their helpful meaning.

You will see that all the external ant targets are things
you might want 
to run explicitly. There are many more than in the usage
list, which is 
limited to ONLY those external targets that ordinary mortals
might want 
to run under normal circumstances.


c) many of the build targets are internal, which means they
MUST NOT 
have a description tag and so will be suppressed by ant's
"-projecthelp" 
option. We make many of our targets invisible because you
would never 
want to run them alone, only as part of the dependency tree
of an 
external target. Nevertheless, we try to associate a
meaningful XML 
comment to every target definition.


In the ideal world, ant would provide an extra target tag,
perhaps 
called target-type. The permitted values of this tag would
be 
(hypothetically) "usage", "external" and
"internal"... or maybe ant 
would support up to three different kinds of description for
a single 
target...

Anyway, in the real world we do the best we can. The
convention I have 
just described arose because SO MANY people were downloading
the source 
and then posting the mailing list because their build's
didn't work.

Regards,

Brian

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribesip-communicator.dev.java.net
For additional commands, e-mail: dev-helpsip-communicator.dev.java.net

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )