Gert Driesen wrote:
Actually whenever we load a file we store the location map - mapping each xml node to a file and line-number. So the information is there - the major issue I see is that you would need to obtain the task/Target object that is being referenced at the function call site. So in the example above :
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steve Jansen
Sent: vrijdag 3 december 2004 17:19
To: [EMAIL PROTECTED]
Subject: [nant-dev] <include> task question
Hi again,
I have a question about the <include> task and the project::get-buildfile-path() function.
I would like to know if there is a way to get the path of an included build file, rather than the containing build file, from withing the included file.
Example:
C:\folder\project.build ----------------------- <project> <include buildfile="..\include.build" /> </project>
C:\include.build ----------------------- <project> <echo message="${project::get-buildfile-path()}" /> </project>
In this case, the message display is "C:\folder\project.build", but, I need to find a way to have a function return "C:\include.build".
Any suggestions?
As far as I know this is not possible.
Ian: do you have anything to add to this ?
<echo message="${project::get-buildfile-path()}" />
we'd need to get a hold of the Location property on the echoTask instance. Hmm now that I look at it we already maintain a Project.CurrentTarget property. If we added a CurrentTask property to Target then that should be sufficent. GetBuildfilePath could look somthing like :
GetBuildfilePath() { if ( Project.CurrentTask != null ){ return = Project.CurrentTask.Location.FileName; } if ( Project.CurrentTarget == null ) { return Project.BuildFileLocalName } if ( Project.CurrentTarget.CurrentTask == null ){ return Project.CurrentTarget.CurrentTask.Location.FileName; } else { return Project.CurrentTarget.FileName; } }
( simplified for brevity )
It probably wouldn't be quite that simple - this is just speculation right now - but it looks possible with a few changes.
Ian
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers