ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/tools/xsl build.xsl
Date Sat, 11 May 2002 12:34:40 GMT
adammurdoch    02/05/11 05:34:40

  Modified:    tools/xsl build.xsl
  Log:
  - Use <manifest> task to generate the manifest, rather than generating it directly
from this stylesheet.
  - Added an <uptodate> check before calling <antlib-descriptor>.
  
  Revision  Changes    Path
  1.14      +53 -82    jakarta-ant-myrmidon/tools/xsl/build.xsl
  
  Index: build.xsl
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/tools/xsl/build.xsl,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- build.xsl	10 May 2002 06:27:32 -0000	1.13
  +++ build.xsl	11 May 2002 12:34:40 -0000	1.14
  @@ -90,16 +90,7 @@
   
               <target name="clean" description="Cleans up the project">
                   <delete file="checkstyle.cache"/>
  -                <xsl:choose>
  -                    <xsl:when test="build/jar">
  -                        <delete includeEmptyDirs="true">
  -                            <fileset dir="${{build.dir}}" excludes="conf/*/manifest.mf"
/>
  -                        </delete>
  -                    </xsl:when>
  -                    <xsl:otherwise>
  -                        <delete dir="${{build.dir}}"/>
  -                    </xsl:otherwise>
  -                </xsl:choose>
  +                <delete dir="${{build.dir}}"/>
                   <delete dir="${{dist.dir}}" />
                   <delete>
                       <fileset dir="." includes="**/*~" defaultexcludes="no"/>
  @@ -385,51 +376,26 @@
       </xsl:template>
   
       <xsl:template match="jar">
  -        <!-- Generate the manifest -->
  -        <redirect:write file="build/conf/{id}/manifest.mf">
  -            <xsl:text>Manifest-Version: 1.0
  -Created-By: Apache Ant Project
  -</xsl:text>
  -            <xsl:choose>
  -                <xsl:when test="extension">
  -                    <!-- Use supplied extension info -->
  -                    <xsl:apply-templates select="extension">
  -                        <xsl:with-param name="prefix"></xsl:with-param>
  -                    </xsl:apply-templates>
  -                </xsl:when>
  -                <xsl:otherwise>
  -                    <!-- Add some basic extension info -->
  -                    <xsl:text>Extension-Name: </xsl:text><xsl:value-of select="id"/><xsl:text>
  -</xsl:text>
  -                    <xsl:text>Specification-Version: </xsl:text><xsl:value-of
select="/project/currentVersion"/><xsl:text>
  -</xsl:text>
  -                    <xsl:text>Implementation-Version: </xsl:text><xsl:value-of
select="/project/currentVersion"/><xsl:text>
  -</xsl:text>
  -                </xsl:otherwise>
  -            </xsl:choose>
  -
  -            <!-- Add dependencies -->
  -            <xsl:for-each select="depends/extension[1]">Extension-List:</xsl:for-each>
  -            <xsl:for-each select="depends/extension"> ext<xsl:value-of select="position()"/></xsl:for-each>
  -            <xsl:for-each select="depends/extension[last()]"><xsl:text>
  -</xsl:text>
  -            </xsl:for-each>
  -            <xsl:apply-templates select="depends/extension" />
  -
  -            <!-- Add attributes -->
  -            <xsl:for-each select="attribute"><xsl:value-of select="@name"/>:
<xsl:value-of select="@value"/></xsl:for-each>
  -        </redirect:write>
  +        <xsl:variable name="patterns" select="patternset"/>
   
           <target name="jar-{id}" depends="jar-{id}-prepare, jar-{id}-descriptors, jar-{id}-package"/>
   
  -        <target name="jar-{id}-prepare">
  -            <mkdir dir="${{build.conf}}/{id}"/>
  +        <target name="jar-{id}-prepare" unless="xdoclet.omit">
  +            <uptodate targetfile="${{build.conf}}/{id}/ant-descriptor.xml"
  +                      property="xdoclet.omit">
  +                <xsl:for-each select="../sourceDirectory">
  +                    <srcfiles dir="{.}">
  +                        <patternset refid="project.compile.patternset"/>
  +                        <xsl:copy-of select="$patterns"/>
  +                    </srcfiles>
  +                </xsl:for-each>
  +            </uptodate>
           </target>
   
           <target name="jar-{id}-descriptors" unless="xdoclet.omit">
               <!-- Generate the descriptors -->
               <xsl:if test="not(includeDescriptors = 'false')">
  -                <xsl:variable name="patterns" select="patternset"/>
  +                <mkdir dir="${{build.conf}}/{id}"/>
                   <antlib-descriptor
                       destdir="${{build.conf}}/{id}"
                       libName="{id}"
  @@ -449,6 +415,45 @@
           </target>
   
           <target name="jar-{id}-package">
  +
  +            <mkdir dir="${{build.conf}}/{id}"/>
  +
  +            <manifest file="${{build.conf}}/{id}/manifest.mf" mode="update">
  +                <!-- Add extension info -->
  +                <xsl:choose>
  +                    <xsl:when test="extension">
  +                        <!-- Use supplied extension info -->
  +                        <xsl:for-each select="extension/@*">
  +                            <attribute name="{name(.)}" value="{.}"/>
  +                        </xsl:for-each>
  +                    </xsl:when>
  +                    <xsl:otherwise>
  +                        <!-- Add some basic extension info -->
  +                        <attribute name="extension-name" value="{id}"/>
  +                        <attribute name="specification-version" value="{/project/currentVersion}"/>
  +                        <attribute name="implementation-version" value="{/project/currentVersion}"/>
  +                    </xsl:otherwise>
  +                </xsl:choose>
  +
  +                <!-- Add dependencies -->
  +                <xsl:if test="depends/extension">
  +                    <attribute name="extension-list">
  +                        <xsl:attribute name="value">
  +                            <xsl:for-each select="depends/extension"> ext<xsl:value-of
select="position()"/></xsl:for-each>
  +                        </xsl:attribute>
  +                    </attribute>
  +                </xsl:if>
  +                <xsl:for-each select="depends/extension">
  +                    <xsl:variable name="prefix" select="concat( 'ext', position(), '-'
)"/>
  +                    <xsl:for-each select="@*">
  +                        <attribute name="{$prefix}{name(.)}" value="{.}"/>
  +                    </xsl:for-each>
  +                </xsl:for-each>
  +
  +                <!-- Add attributes -->
  +                <xsl:copy-of select="attribute"/>
  +            </manifest>
  +
               <copy todir="${{build.conf}}/{id}" file="../LICENSE.txt"/>
   
               <xsl:variable name="jarName">
  @@ -465,7 +470,7 @@
               <jar jarfile="${{build.lib}}/{$jarName}"
                   basedir="${{build.classes}}"
                   compress="${{build.compress}}"
  -                manifest="${{build.dir}}/conf/{id}/manifest.mf">
  +                manifest="${{build.conf}}/{id}/manifest.mf" >
                   <metainf dir="${{build.conf}}/{id}" excludes="manifest.mf"/>
                   <xsl:copy-of select="patternset"/>
                   <xsl:copy-of select="fileset"/>
  @@ -473,40 +478,6 @@
               </jar>
           </target>
   
  -    </xsl:template>
  -
  -    <xsl:template match="extension">
  -        <xsl:param name="prefix" select="concat( 'ext', position(), '-' )"/>
  -        <xsl:if test="@extension-name">
  -            <xsl:value-of select="$prefix"/>Extension-Name: <xsl:value-of select="@extension-name"/>
  -            <xsl:text>
  -</xsl:text>
  -        </xsl:if>
  -        <xsl:if test="@specification-vendor">
  -            <xsl:value-of select="$prefix"/>Specification-Vendor: <xsl:value-of
select="@specification-vendor"/>
  -            <xsl:text>
  -</xsl:text>
  -        </xsl:if>
  -        <xsl:if test="@specification-version">
  -            <xsl:value-of select="$prefix"/>Specification-Version: <xsl:value-of
select="@specification-version"/>
  -            <xsl:text>
  -</xsl:text>
  -        </xsl:if>
  -        <xsl:if test="@implementation-vendor">
  -            <xsl:value-of select="$prefix"/>Implementation-Vendor: <xsl:value-of
select="@implementation-vendor"/>
  -            <xsl:text>
  -</xsl:text>
  -        </xsl:if>
  -        <xsl:if test="@implementation-vendor-id">
  -            <xsl:value-of select="$prefix"/>Implementation-Vendor-Id: <xsl:value-of
select="@implementation-vendor-id"/>
  -            <xsl:text>
  -</xsl:text>
  -        </xsl:if>
  -        <xsl:if test="@implemenation-version">
  -            <xsl:value-of select="$prefix"/>Implementation-Version: <xsl:value-of
select="@implementation-version"/>
  -            <xsl:text>
  -</xsl:text>
  -        </xsl:if>
       </xsl:template>
   
       <!-- Chuck all text content -->
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message