I vaguely started looking at it a while ago but didn't get
much done. The current implementation uses an xslt stylesheet to process
the buildfile and generate the projecthelp output. Xslt probably isn't
really the right tool for this ( hey I was doing a lot of work with xslt
at the time and when you've got a hammer everything looks like a nail )
however some kind of custom parsing will likely be necessary - rather
than using NAnt's project class to load the includes.
XSLT may still be useful - we can use it to identify all of the
targets _and_ the include nodes. The target nodes we just print out
the name attribute and the include nodes we open up the specified
buildfile and recursively repeat.
A quick and dirty implementation can be achieved with xslt and the
document function. Add the following template to deal with the include
elements
<xslt:template match="nant:include">
<xslt:value-of select="$space" />
<xslt:value-of select="stringutils:PadRight(@buildfile, 20)" />
<xslt:value-of select="$newline" />
<xslt:value-of select="$newline" />
<xslt:variable name="include"
select="document(@buildfile)/nant:project"/>
<xslt:apply-templates
select="$include/nant:target[string(@description) != '']" />
</xslt:template>
and then add the following to the end of the nant:project template
<xslt:text>Imports: </xslt:text>
<xslt:value-of select="$newline" />
<xslt:value-of select="$newline" />
<xslt:apply-templates select="nant:include" />
This will then add all the main targets of the included file at the end
of the help.
If you wanted this to be a more permanent solution you'd probably want
to do some more indenting for the imports.
I think the problem is with the camel getting his nose in the tent. :-)
If you parse <include> tasks, then you would also (I think) have to parse properties
since the include pathname could be defined by property expansion. However, properties can
be conditionalized by <if> tasks, so they have to be parsed, and properties get
defaults by command line parameters so they have to be parsed. By the time you're
finished, you may have processed most of the build file.
Merrill
This is why it's a quick and dirty implementation. It only works for
include elements which don't have properties in. In my opinion the
easiest way around this would be to have a description attribute allowed
on the include element which would then be output as well. This could
then be used to describe the included file and how the properties affect it.
Richard
--
Richard Willis
Director
Encounter I.T. Ltd.
http://www.encounterit.co.uk
Address:
UNIEIlab, Unit 6, William Lee Buildings,
Nottingham Science and Technology Park,
University Boulevard, Nottingham, NG7 2RQ.
Telephone:
00 44 (0) 845 226 3057
Mobile:
07961 577 032
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users