last week there was again a thread about binary dists or at least about simplifying the build on the users list:
http://marc.theaimsgroup.com/?t=106817421400001&r=1&w=2
The original reason were Alexander's problems with the CLI: it is/was not usable with the authentication-fw block. Further dependencies were not in the blocks.properties and so he became frustrated.
One solution for him where different blocks.properties for different use cases. Another solution IMO are the complete dependencies in our blocks.properties. But maintaining both gump.xml and blocks.properties is a pain. The solution is to have one file and to generate the other one. I wrote a stylesheet doing this from gump.xml, find it attached (after problems with Xalan).
The question is how to integrate it exactly into the build. Only as a helper target? Only for developers before committing gump.xml? As one of the first steps in the build, i.e. blocks.properties is removed from the CVS and it's only generated dynamically?
Furthermore the gump.xml project/@status must be completed (status="stable" and stable="deprecated").
I hope you will find it useful. Any comments?
Joerg
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:desc="description">
<xsl:output method="text"/>
<xsl:key name="status" match="project[starts-with(@name, 'cocoon-block-')]" use="@status"/>
<xsl:key name="dependency" match="project[starts-with(@name, 'cocoon-block-')]/depend[starts-with(@project, 'cocoon-block-')]" use="@project"/>
<desc:descs>
<desc:desc name="common">
#------------------------------------------------------------------------------#
# Cocoon Blocks #
#------------------------------------------------------------------------------#
#
# Remove blocks from your cocoon distribution by uncommenting the
# corresponding exclude property.
#
# NOTE: Don't modify this file directly but make a copy named
# 'local.blocks.properties' and modify that. The build system will override
# these properties with the ones in the 'local.blocks.properties' file.
#
# NOTE: "#-----[dependency]" indicates blocks that are required by other blocks.
# disabling batik, for example, will prevent fop from compiling.
</desc:desc>
<desc:desc name="stable">
# Stable blocks ----------------------------------------------------------------
#
# Stable blocks are those that can be considered ready for production and
# will contain components and API that will remain stable and where
# developers are committed to back compatibility. In short, stuff that you
# can depend on.
</desc:desc>
<desc:desc name="unstable">
# Unstable blocks --------------------------------------------------------------
#
# Unstable blocks are currently under development and do not guarantee that the
# contracts they expose (API, xml schema, properties, behavior) will remain
# constant in time. Developers are not committed to back-compatibility just yet.
# This doesn't necessarily mean the blocks implementation is unstable or
# the code can't be trusted for production, but use with care and watch
# its development as things might change over time before they are marked
# stable.
</desc:desc>
<desc:desc name="deprecated">
# Deprecated blocks ------------------------------------------------------------
#
# Although some of these blocks may have been stable, they are now deprecated
# in favour of other blocks and therefore are excluded by default from the build
</desc:desc>
</desc:descs>
<xsl:template match="/module">
<xsl:value-of select="document('')/xsl:stylesheet/desc:descs/desc:[EMAIL PROTECTED] = 'common']"/>
<xsl:apply-templates
select="project[starts-with(@name, 'cocoon-block-')]
[count(. | key('status', @status)[1]) = 1]"
mode="group"/>
</xsl:template>
<xsl:template match="project" mode="group">
<xsl:value-of select="document('')/xsl:stylesheet/desc:descs/desc:[EMAIL PROTECTED] = current()/@status]"/>
<!-- unfortunately key('status', @status) does not work with sorting because of a bug in Xalan: 24583 -->
<xsl:apply-templates select="../project[starts-with(@name, 'cocoon-block-')[EMAIL PROTECTED] = current()/@status]">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="project">
<xsl:call-template name="dependency">
<xsl:with-param name="elements" select="depend[starts-with(@project, 'cocoon-block-')]"/>
<xsl:with-param name="text" select="'depends on'"/>
</xsl:call-template>
<xsl:call-template name="dependency">
<xsl:with-param name="elements" select="key('dependency', @name)/.."/>
<xsl:with-param name="text" select="'is needed by'"/>
</xsl:call-template>
<xsl:text>#exclude.block.</xsl:text>
<xsl:value-of select="substring-after(@name, 'cocoon-block-')"/>
<xsl:text>=true </xsl:text>
</xsl:template>
<xsl:template name="dependency">
<xsl:param name="elements" select="/.."/>
<xsl:param name="text" select="''"/>
<xsl:if test="$elements">
<xsl:text>#-----[dependency]: "</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>" </xsl:text>
<xsl:value-of select="$text"/>
<xsl:apply-templates select="$elements" mode="dependency">
<xsl:sort select="@name|@project"/>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<xsl:template match="project | depend" mode="dependency">
<xsl:text> "</xsl:text>
<xsl:value-of select="@name|@project"/>
<xsl:text>"</xsl:text>
<xsl:choose>
<xsl:when test="position() = last()">. </xsl:when>
<xsl:otherwise>,</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
