ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <>
Subject RE: override
Date Fri, 08 Aug 2003 17:34:22 GMT
> From: Costin Manolache []
> Jose Alberto Fernandez wrote:
> > One of the problems I have with the "rewriting" approach is 
> that target
> > names get rewritten y the caller which means that two independent
> > importers may decide to use the same prefix and hence you 
> get a clash.
> > Namespaces or java-style fully-qualified-names are a 
> property intrinsic
> > of the imported file, that is the reason that makes it safe.
> That's why I think it's better to not try to be too flexible 
> in allowing
> arbitrary rewriting, but do it in a canonical way:
>  - after a build.xml is read, all un-qualified names get 
> prefixed with the 
> project name and a delimiter ( need some tricks for ant-call, but it's
> possible )

Antcall is a call to the entire buildfile, since it will reload the build
file from the top. Hence I do not think we should rewrite here. 
In any case, how do you deal with properties in the target attribute:

	<antcall target="${picktarget}"/>

In my opinion, if you are writing buildfiles for reuse you should
make sure either not to use <antcall/> or instead use:

	<ant file="${ant.file.thisfile}" target="${picktarget}/>

In my experience most uses of <antcall/> can be rewritten into dependencies.

>  - you can call a target by the local name as long as it is unique,
> otherwise you need qualified names.
> No overloading, no conflicts, no abiguity.
As long as you cannot import two projects with the same name (but different file),
I agree this would be a possible solution. 
This means targets may have multiple names (decorated and not decorated), yes?

> > Single inheritance (a la Java) requires having syntax that 
> allows for
> > extending only once, something like:
> > 
> >   <project name="q" extends="this/other/build.xml">...</project>
> > 
> > if you use something like a task to specify the extend then 
> you may write
> > multiple inheritance and all these ambiguities appear.
> > Could we live with single inheritance and <include/> 
> instead of <import/>?
> My point is that <import> is different than "extneds". 
> > The escenario is that you have your tipical:
> > 
> > a
> >    target compile depends=precompile
> >    target precompile (do-nothing)
> > 
> > b
> >    target precopile (very complex precompile lib)
> > 
> > build:
> >    import (a,b)
> > 
> > With cross-talk that is all you need to connect the two
> > and get the required effect. Without cross-talk you would 
> need to add
> > more targets to build:
> With qnames there is no crosstalk.
> a
>    target a::compile depends a::precompile
>    target a::precompile
> b
>   target b::precompile
> build:
>   import a, b
>   You can call a::compile ( which will call a::precompile ), etc.
> >    target precompile depends=b.precompile
> > 
> > or
> > 
> >    override-target compile depends=b.precompile, super.compile
> Too complicated IMO. 
> All import should do is load some build files and deal with the 
> name conflicts in a clear way, without becoming a very hacky solution
> that nobody understand - and to be honest I have a lot of trouble 
> understanding most of the overriding - even in the simple examples 
> on the thread, I can't imagine what will happen when people 
> start using this
> with dozens of targets.

This is exactly my point. If the feature is not properly defined
and all cases taken into consideration, people will get into trouble
when writing large build files. We already have people using things
like centepide that has inheritance and would like to have it directly
in ANT. Are there any interesting uses of inheritance there that we can
see. After all this feature is so that we address the need of real users
and not just a feature for feature sake.

As I said before, I do not presume to have all answers,

Jose Alberto

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

View raw message