Subversion Repositories DevTools

Rev

Blame | Last modification | View Log | RSS feed

<project name="summarise-manifest-macrodef">
   <description>
        The summarise-manifest macro updates the descpkg file with the build information.
        If there are any .jar files in the pkg directory then the updated
   </description>

        <macrodef name="summarise-manifest">

                <attribute      name="package" 
                                        default="${packagename}" 
                                        description="The name of the package in release manager and dpkg_archive."/>
                                   
                <attribute      name="version" 
                                        default="${packageversion}"
                                        description="The version of the package in release manager and dpkg_archive."/>
                                        
                <attribute name="builder" default="${user.name}"/>

        <attribute name="usemanifestpackageversion" default="${version}"/>

                <element   name="jars"  optional="yes"  implicit="yes" />

                <sequential>

                        <!-- If version is UNOFFICIAL & jants.build.version is set, then use
                             jants.build.version, otherwise use version.
                          -->
                        <if>
                            <and>
                                <equals arg1="@{version}" arg2="UNOFFICIAL"/>
                                <not><equals arg1="${jants.build.version}" arg2="$${jants.build.version}"/></not>
                            </and>
                                <then>
                                    <var name="ant.project.version" value="${jants.build.version}"/>
                                </then>
                                <else>
                                        <var name="ant.project.version" value="@{version}"/>
                                </else>
                        </if>

                        <tstamp>
                                <format property="NOW" pattern="E MMM dd HH:mm:ss z yyyy"/>
                        </tstamp>

                        <manifest file="${basedir}/build/pkg/descpkg" mode="update">
                                <section name="Build Properties">
                                        <attribute name="Package Name"    value="@{package}"/>
                                        <attribute name="Package Version" value="${ant.project.version}"/>
                                        <attribute name="Built By"        value="@{builder}"/>
                                        <attribute name="Built On"        value="${NOW}"/>
                                </section>
                        </manifest>
                        
                        <!-- New stuff to simplify using version generation in manifest -->
                        <propertyselector property="package.version.list"
                         delimiter=","
                         match="using\.([^\.]*)\.version"
                         select="\1"
                         casesensitive="true" />

                        <for list="${package.version.list}" param="this.package.name">
                                <sequential>
                                        <propertycopy name="this.package.version" from="using.@{this.package.name}.version" override="true"/>
                                        
                                        <manifest file="${basedir}/build/pkg/descpkg" mode="update">
                                                <section name="Build Dependencies">
                                                        <attribute name="@{this.package.name}" value="${this.package.version}"/>
                                                </section>
                                        </manifest>
                                </sequential>
                        </for>
                        
                        <!-- End of new stuff -->

                        <for param="jar.name">
                            <path>
                                <jars/>
                            </path>
                            <sequential>
                                <jar destfile="@{jar.name}" 
                                             update="true" 
                                                 manifest="${basedir}/build/pkg/descpkg"/>
                            </sequential>
                        </for>

                </sequential>
        </macrodef>

</project>