Try adding a couple of targets that "help" you find your information via some 
xsl transforms:
a)      
<target name="showtargets" description="List all of the current build targets">
        <mkdir dir="tmp"/>
        <xslt in="${ant.file}" out="tmp/targetlist.txt" style="targetlist.xsl"/>
        <loadfile property="targetlist" srcFile="tmp/targetlist.txt"/>
        <echo message="${targetlist}"/>
</target>

targetlist.xsl
--------------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:template match="text()"/>

        <xsl:template match="project">
                <xsl:text>Found targets:</xsl:text>
                <xsl:apply-templates/>
        </xsl:template>

        <xsl:template match="target">
                <xsl:text>
                </xsl:text>
                <xsl:apply-templates select="@name"/>
        </xsl:template>
</xsl:stylesheet>
b)
<target name="dependencies" description="List all of the current build target 
dependencies">
        <mkdir dir="tmp"/>
        <xslt in="${ant.file}" out="tmp/dependlist.txt" style="dependlist.xsl"/>
        <loadfile property="dependlist" srcFile="tmp/dependlist.txt"/>
        <echo message="${dependlist}"/>
</target>

dependlist.xsl
--------------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:template match="text()"/>

        <xsl:template match="project">
                <xsl:text>Dependencies:</xsl:text>
                <xsl:apply-templates/>
        </xsl:template>

        <xsl:template match="target">
                <xsl:text>
        target [</xsl:text>
                <xsl:value-of select="@name"/>
                <xsl:text>]
                - </xsl:text>
                <xsl:value-of select="@depends"/>
        </xsl:template>
</xsl:stylesheet>

Perhaps with a few modifications to get your exact desires. :)

Pete Bulford <mailto:[EMAIL PROTECTED]> 

-----Original Message-----
From: Ashwin S. [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 01, 2004 1:39 AM
To: [EMAIL PROTECTED]
Subject: Ant introspection and property resolution


Is there a way of actually introspecting a build file via ant. The 
introspection should help expose details such as
a) all targets in an build file
b) dependency trees for targets

and many other such details that might be useful to seasoned ant-users.

I am envisaging its use as follows:

a)

cmdline> ant -showtargets [build.xml]

Result:

Found targets: 
        abc
        xyz


b) 

cmdline> ant -dependencies [build.xml]

        target [abc]
                - init
                - check-ab
        target [xyz]
                - init
                - abc


Also, is there a property resolver which allows an ant-user to know what the 
real values of all properties used by any target(s) would be at runtime?

If these features don't exist, what do the folks here think of it? Anyone 
interested in working on creating them??



Thanks & Regards,
Ash


Disclaimer:

This email and any files transmitted with it are confidential and intended 
solely for the individual or entity to which it is addressed. If you have 
received this email in error please notify the sender and delete this mail 
immediately. 







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






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

Reply via email to