ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tran, Khiet" <kt...@melochemonnex.com>
Subject FW: Retrieving target name at runtime.
Date Fri, 25 Jan 2002 22:01:44 GMT
Well as nobody answered my question from the user's group, I don't know if
the following patch I've made is conceptually correct, and if yes may you
add it :) or give me a hint about another way to do the correction?
Thanks, Khiet.

org.apache.tools.ant.Target
    private String parentTask;
    ...
    public final void performTasks() {
        try {
			project.fireTargetStarted(this);
	
parentTask=project.getProperty("ant.target.current.name");
			project.setProperty("ant.target.current.name",
name);
			execute();
			if(parentTask==null)
	
project.getProperties().remove("ant.target.current.name");
			else
			project.setProperty("ant.target.current.name",
parentTask);
            project.fireTargetFinished(this, null);
        }
        catch(RuntimeException exc) {
            project.fireTargetFinished(this, exc);
            throw exc;
        }
    }
-----Original Message-----
From: Tran, Khiet [mailto:ktran@melochemonnex.com] 
Sent: Tuesday, January 22, 2002 2:00 PM
To: 'ant-user@jakarta.apache.org'
Subject: Retrieving target name at runtime.



> Hi,
> 
> We are using ant for defining dependencies between our components and as a
> matter, each target name happens to be a component name. The component
> name
> is also used for other purpose so we want to be able to retrieve the
> current running target name for processing. I've found no predefined
> variables of type ${ant.target.name}, is there something alike defined?
> Right now I've modified ant source code to incorporate such variable but
> such making sure it is not a bad idea.
> 
> Thanks a lot, Khiet.

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message