RE: can subant reuse Projects?

2003-08-14 Thread Dominique Devienne
No, this is currently not possible. subant uses ant behind the scene's,
and doesn't access the created project. Now, I've also hacked antreturn
that works for my own purpose, and does indeed get access to the child
project thru devious means, so in theory it could cache the child projects,
so I just don't think it's very advisable...

On the other hand, my goal with antreturn was to get back properties and
references from the child build, so you could get back up a property set in
a.xml, and feed it back down to c.xml and later to a.xml to avoid
reprocessing something. My own version of subant allows passing down a
propertyset, but I guess one could also have a return propertyset by
merging the antreturn functionality.

All this sounds very hackish though, even to me ;-)

Even my current use of antReturn I find hackish, but without the ability
to use Ant's own digester-like XML to Java engine, I find easier to call
another Project and extract what I need out of it, rather than coding from
scratch the info I need about of a separate non-Ant (data-type) file.

I hope I'm not too off base vis-à-vis your question. --DD

 -Original Message-
 From: Knut Wannheden [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 14, 2003 6:40 AM
 To: [EMAIL PROTECTED]
 Subject: can subant reuse Projects?
 
 Hi,
 
 Up until now I've been using my own subant like task.  But now that Ant
 1.6 doesn't seem too distant anymore I'd like to integrate with subant.
 
 There's one thing I'm wondering about: Can subant reuse the same Project
 object corresponding to a buildfile in multiple calls?  The reason that
 I'm
 askin this is that I think it would be nice if a target's dependencies
 were
 only resolved once.  Consider the following case:
 
  a.xml
^
  /   \
 b.xmlc.xml
^  ^
 \/
  d.xml
 
 where I in b.xml and c.xml use subant to invoke a target i a.xml.  And
 in
 d.xml i use subant to invoke a target in b.xml and c.xml.  Now if both
 b.xml and c.xml invoke the same target foo in a.xml, then I'd only want
 the dependencies of a:foo to be resolved once.
 
 Is this currently possible with subant or would it be possible to add
 this
 behaviour?
 
 --
 knut

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: can subant reuse Projects?

2003-08-14 Thread Wannheden, Knut
Dominique,

 Even my current use of antReturn I find hackish, but 
 without the ability
 to use Ant's own digester-like XML to Java engine, I find 
 easier to call
 another Project and extract what I need out of it, rather 
 than coding from
 scratch the info I need about of a separate non-Ant (data-type) file.
 

Maybe the xpath PropertyHelper would help you in this case.

My version of subant (not based on it (yet)) does what I suggested, but
not by reusing Projects, because it's also internally using ant :-)
Rather I have a static Map which tells me what targets I've already run on
what buildfiles.

Of course it's not always desirable to run a target only exactly once.  But
IMO, if the buildfiles are well organized, this should be the case.  At
least for project inter-dependencies.  And I can of course always get around
this optimization by using ant instead.  Also my subant has a
onlyonce attribute to control this.

I found that I can significantly lower my build times with this behaviour.
Also the log is more readable.

I think I will continue using my own subant.  But if someone thinks this
is a good idea I could write a patch which would add a onlyonce attribute
to Ant's subant.

--
knut

 I hope I'm not too off base vis-à-vis your question. --DD
 
  -Original Message-
  From: Knut Wannheden [mailto:[EMAIL PROTECTED]
  Sent: Thursday, August 14, 2003 6:40 AM
  To: [EMAIL PROTECTED]
  Subject: can subant reuse Projects?
  
  Hi,
  
  Up until now I've been using my own subant like task.  
 But now that Ant
  1.6 doesn't seem too distant anymore I'd like to integrate 
 with subant.
  
  There's one thing I'm wondering about: Can subant reuse 
 the same Project
  object corresponding to a buildfile in multiple calls?  The 
 reason that
  I'm
  askin this is that I think it would be nice if a target's 
 dependencies
  were
  only resolved once.  Consider the following case:
  
   a.xml
 ^
   /   \
  b.xmlc.xml
 ^  ^
  \/
   d.xml
  
  where I in b.xml and c.xml use subant to invoke a target 
 i a.xml.  And
  in
  d.xml i use subant to invoke a target in b.xml and c.xml. 
  Now if both
  b.xml and c.xml invoke the same target foo in a.xml, then 
 I'd only want
  the dependencies of a:foo to be resolved once.
  
  Is this currently possible with subant or would it be 
 possible to add
  this
  behaviour?
  
  --
  knut
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]