ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject RE: getting the value of the Target
Date Thu, 26 Apr 2001 18:15:35 GMT
--- Christopher Berry <christopher.berry@etrade.com> wrote:
> Hi Nico,
> I wrote a Task as you suggested. But it turns out that this information
> is not available -- even to the Project itself.

Project knows the "root" target -- it prints it out if you run -verbose
(see line 943 in Project.java). I was playing with the logging stuff at
one point so that it would print out the "top" target(s) before the "sub"
target(s) instead of after (since that seemed backwards to me), eg:

  $ ant foo
  [start stuff]

  foo:
    subfoo1:
      [taskstuff...]

  BUILD SUCCESSFUL

But I didn't keep those changes (they were pretty kludgy as I recall :)
and I don't remember now exactly what I did.

I'm still too much of a Java newbie to be able to tell you exactly how Ant
all goes together (I've been hoping to find a cflow-like tool for Java,
but so far, no luck) or to tell you how to get that name into your task,
but hopefully this might at least help some.

Diane

> We can find the current target
> but not the driving target. (i.e. if I execute "ant sometarget" then I
> would like to get at "sometarget" somehow) 
> 
> I downloaded the Ant source, and as far as I could tell from reading it,
> this information is not explicitly kept anywhere during the build
> process. 
> 
> It seems like this would be a nice enhancement for Ant2??  
> Cheers,
> -- Chris
> 
> > -----Original Message-----
> > From: Nico Seessle [mailto:nico@apache.org]
> > Sent: Thursday, April 26, 2001 1:04 AM
> > To: ant-user@jakarta.apache.org
> > Subject: Re: getting the value of the Target
> > 
> > 
> > ----- Original Message -----
> > From: "Christopher Berry" <christopher.berry@etrade.com>
> > To: <ant-user@jakarta.apache.org>
> > Sent: Thursday, April 26, 2001 7:47 AM
> > Subject: getting the value of the Target
> > 
> > 
> > > Greetings,
> > >
> > > I would like to know how to get the value of the incoming 
> > target. (i.e for
> > > "ant clean", I want "clean"). I have searched the -debug 
> > output for such a
> > > property, and I read the section on built-in properties in 
> > the manual. But
> > I
> > > don't see it. Is it possible???
> > >
> > > What I am trying to do is execute a target conditionally 
> > based on the
> > > incoming target name. So that I can skip some intermediate step in a
> > build.
> > > Is there a workaround??
> > >
> > 
> > Even if there was access to such a property you can't perform 
> > some action
> > based on the value of a property - only based on it's existence.
> > If you want to do something based on the value of a property 
> > you need to
> > write your own task. If you are writing your own task you may 
> > get access to
> > the currently executing target thru your task
> > (this.getOwningTarget().getName()).
> > 
> > Nico
> > 
> > 


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Mime
View raw message