buildframework/helium/tools/release/release.ant.xml
author wbernard
Fri, 13 Aug 2010 14:59:05 +0300
changeset 628 7c4a911dc066
parent 588 c7c26511138f
child 645 b8d81fa19e7d
permissions -rw-r--r--
helium_11.0.0-e00f171ca185

<?xml version="1.0" encoding="UTF-8"?>
<!-- 
============================================================================ 
Name        : release.ant.xml 
Part of     : Helium 

Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved.
This component and the accompanying materials are made available
under the terms of the License "Eclipse Public License v1.0"
which accompanies this distribution, and is available
at the URL "http://www.eclipse.org/legal/epl-v10.html".

Initial Contributors:
Nokia Corporation - initial contribution.

Contributors:

Description:

============================================================================
-->
<!--* @package releases -->
<project name="release" xmlns:hlm="http://www.nokia.com/helium">
    <description>
        Release publising.
    </description>

    <import file="scm_release.ant.xml" />
    
    <!-- This is where the release build logs are stored.
    @type string
    @scope private
    -->
    <property name="release.log.dir" location="${build.log.dir}/release"/>       
    
    
    <!--* @property release.grace.service
    The Grace service used
    @type string
    @editable required
    @scope public
    -->

    <!--* @property release.grace.product
    The Grace product used
    @type string
    @editable required
    @scope public
    -->

    <!--* @property release.grace.mail.to
    To whom the completion mail is sent to
    @type string
    @editable required
    @scope public
    -->

    <!--* @property release.grace.mail.subject
    The subject of the Grace upload completion mail
    @type string
    @editable required
    @scope public
    -->

    <!--* @property release.grace.mail.message
    The message contents of the Grace upload completion mail
    @type string
    @editable required
    @scope public
    -->
    
    <!--* @property robot.release.enabled
    Set to true to do build robot release after completing the build and if it successful.
    @type boolean
    @editable required
    @scope public
    @since 11.0
    -->
    
    <!--* @property do.robot.release
    Set to synergy project name to doing the build robot release. - deprecated: Start using robot.release.enabled property.
    @type string
    @editable required
    @scope public
    @deprecated since 11.0
    -->
    
    <!--* @property internal.robot.release.enabled
    Internal property to run the robot release property if robot.release.enabled set to true. 
    @type string
    @scope private
    -->
    
    <!-- Check, is robot release is enabled -->
    <condition property="internal.robot.release.enabled">
        <and>
            <or>
                <istrue value="${robot.release.enabled}"/>
                <isset property="do.robot.release"/>
            </or>
            <isset property="s60.build.robot.path"/>
        </and>    
    </condition>

    <fileset id="release.files" dir="${publish.dir}">
        <include name="logs/**/*" />
        <include name="development_flash_images/**/*" />
        <include name="release_flash_images/**/*" />
        <include name="sisfiles/**/*" />
        <include name="build_area/**/*" />
        <include name="test_results/**/*" />
        <include name="utilities/**/*" />
    </fileset>

    <!-- Copies release.files fileset into publish.release.folder destination -->
    <target name="release">
        <mkdir dir="${publish.release.dir}" />
        <copy todir="${publish.release.dir}" preservelastmodified="true" failonerror="false">
            <fileset refid="release.files" />
        </copy>
    </target>

    <!--* @property s60.build.robot.path
    Location where to publish the build robot delivery.
    @type string
    @editable required
    @scope public
    -->

    <!--* @property s60.build.robot.date
    This property represent the releasing interval. The syntax is as follow: day1,time1,day2,time2,projectname;day1,time1,day2,time2,projectname2 With day and time matching the following properties: day [1, 14] time [00, 23]:[00, 59] Example: 2,10:00,3,20:00,ABS_domain
    @type string
    @editable required
    @scope public
    -->
    
    <!--* @property robot.release.project
    Synergy project name to be delivered onto build robot.
    @type string
    @scope private
    -->
    
    <!-- Will check is it required to do the sources release to build robot using the property  s60.build.robot.date -->
    <target name="check-robot-release" if="internal.robot.release.enabled">
        <script language="jython" setbeans="false">
            <![CDATA[
self.setTaskName("check-robot-release")

import ido
projects = []
mconfigstr = project.getProperty('s60.build.robot.date')
if mconfigstr != None:
    for configstr in mconfigstr.split(';'):
        config = map(lambda x: x.strip(), configstr.split(','))
        try:
            if ido.is_in_interval(int(config[0]), config[1], int(config[2]), config[3]):
                self.log("It is release time!")
                projects.append(config[4])
                project.setProperty('robot.release.project', ",".join(projects))
            else:
                self.log("It is not release time!")
        except Exception, e:
            self.log("'%s' invalid configuration." % configstr)
else:
    self.log("'s60.build.robot.date' is not defined.")
]]>
        </script>
    </target>

    <!-- Sources are sent to the S60 build robot by all the IDOs. 
    This target collects all the sources based on the System Definition file, 
    zip them all and send to the specified location. There is only one but mandatory 
    property to tell the location of the build server which is "s60.build.robot.path".
    -->
    <target name="ido-sources-to-s60-build-robot" if="internal.robot.release.enabled" depends="ido-create-ado-mapping,check-robot-release,lookup-email">
        <if>
            <isset property="robot.release.project"/>
            <then>
                <!-- Location of the ready.txt FMPP template (override that property if you want to customize the content).
                @type string
                @scope private
                -->
                <property name="ido.template.robot.ready" location="${helium.dir}/tools/common/templates/ido/ready.txt.ftl" />
                <tempfile property="s60robot.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}" />
                <fmpp sourceFile="${helium.dir}/tools/common/templates/ido/ido-robot-zip.ant.xml.ftl" outputFile="${s60robot.dynamic.config}">
                    <data expandProperties="yes">
                            inputfile: antProperty(ado.mapping.file)
                            ant: antProperties()
                            data: eval('
                                java.io.FileInputStream pin = new java.io.FileInputStream(filename);
                                java.util.Properties props = new java.util.Properties();
                                props.load(pin);
                                return props;
                                    ', {filename: get(inputfile)})
                    </data>
                </fmpp>
                <ant antfile="${s60robot.dynamic.config}" target="all" />
                <fmpp sourceFile="${ido.template.robot.ready}" outputFile="${s60.build.robot.path}/ready.txt">
                    <data expandProperties="yes">
                        ant: antProperties()
                    </data>
                </fmpp>
            </then>
            <else>
                <echo>It is not release time!</echo>
            </else>
        </if>
    </target>

</project>