[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Removing dead targets from Ant build files

Subject: RE: Removing dead targets from Ant build files
From: "Hofman, Peter" <peter.hofman@xxxxxxxxxxxxx>
Date: Fri, 21 Dec 2007 10:05:41 +0100
RE:  Removing dead targets from Ant build files
Hi Graham and all other xsl-list contributors,

To only remove targets not listed in depends attributes (or project
default attribute),
it looks something like this (xsl 1.0):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	exclude-result-prefixes="xsl">
<xsl:output method="xml" indent="yes" encoding="utf-8"/>
<xsl:template match="/project">
  <xsl:copy>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>
<xsl:template match="target">
  <xsl:variable name="name" select="@name"/>
  <xsl:if test="//target[contains(@depends,$name)] or
/project[@default=$name]">
    <xsl:copy-of select="."/>
  </xsl:if>
</xsl:template>
</xsl:stylesheet>

I tested it with some very simple ant build files, using the msxsl
processor.
This will remove any target that is not listed in either
/project/@default or any //target/@depends.
IIRC ant complains if some target/@depends contains a non existing
target,
so I didn't bother cleaning up the target/@depends.

Breaking up large build files into smaller ones is something completely
different.
I would do that in XSLT 2.0 anyway using xsl:result-document.

Regards,
Peter

>-----Original Message-----
>From: Heath, Graham [mailto:Graham.Heath@xxxxxxxxxxxxxxxxxxx]
>Sent: vrijdag 21 december 2007 8:45
>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>Subject:  Removing dead targets from Ant build files
>
>
>Does anyone out there have a stylesheet that parses and trims
>dead targets from ant build files?
>
>I started writing a stylesheet to do this but it got very
>convoluted and never acheived what I wanted so I gave up.
>Currently we use Saxon 6.53 (becuase of DocBook).
>I am also convinced that other people must also have large
>unwieldy ant files that over time have collected a bunch of
>dead targets (ones that do not appear in depends="" lists and
>do not have a description attribute).
>
>Thanks for any ideas, hints, or stylesheets. There is, of
>course, the related issue of chunking these build files by
>following dependancies from distinct targets to build
>"feature" related build files, that are smaller and more manageable.
>
>
>
>
>


This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an intended
recipient then please promptly delete this e-mail and any attachment and all
copies and inform the sender. Thank you.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.