buildframework/helium/tools/release/scm_release.ant.xml
changeset 620 ad8ffc8e1982
parent 588 c7c26511138f
child 628 7c4a911dc066
equal deleted inserted replaced
585:238f4cb8391f 620:ad8ffc8e1982
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <!-- 
       
     3 ============================================================================ 
       
     4 Name        : scm_release.ant.xml 
       
     5 Part of     : Helium 
       
     6 
       
     7 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     8 All rights reserved.
       
     9 This component and the accompanying materials are made available
       
    10 under the terms of the License "Eclipse Public License v1.0"
       
    11 which accompanies this distribution, and is available
       
    12 at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    13 
       
    14 Initial Contributors:
       
    15 Nokia Corporation - initial contribution.
       
    16 
       
    17 Contributors:
       
    18 
       
    19 Description:
       
    20 
       
    21 ============================================================================
       
    22 -->
       
    23 <!--* @package releases -->
       
    24 <project name="scm-release" xmlns:hlm="http://www.nokia.com/helium">
       
    25     <description>
       
    26         SCM Release publishing.
       
    27     </description>
       
    28     
       
    29     
       
    30     
       
    31     <!--
       
    32      The release-work-area target will reuse the prep-work-area configuration 
       
    33      to retrieve what project to release based on the releasable 
       
    34      and baseline.release configuration xml properties.
       
    35      Each project releasing will follow these steps:
       
    36         * un-maitained work area
       
    37         * Using RBT tool 
       
    38           * deconfigure
       
    39           * rebaseline
       
    40         * update
       
    41         * maintain the work area
       
    42      -->
       
    43     <target name="release-work-area">
       
    44         <mkdir dir="${release.log.dir}" />
       
    45         <record name="${release.log.dir}/${build.id}_release_work_area.log" action="start"/>
       
    46         <runtarget target="get-ccm-password"/>
       
    47         <runtarget target="ccm-prepare-input"/>
       
    48         
       
    49         <hlm:assertPropertySet property="prep.delivery.file" message="Property prep.delivery.file is not defined." />
       
    50         <trycatch>
       
    51             <try>
       
    52                 <hlm:python failonerror="true">
       
    53 import preparation
       
    54 import configuration
       
    55 import traceback
       
    56 import logging            
       
    57 import ant
       
    58 import sys
       
    59 import os.path
       
    60 
       
    61 # enabling logging
       
    62 logging.basicConfig(level=logging.INFO)
       
    63 
       
    64 builder = None           
       
    65 try:
       
    66     configBuilder = configuration.NestedConfigurationBuilder(open(ant.get_property(r'${prep.delivery.conf.parsed}'), 'r'))
       
    67     configSet = configBuilder.getConfiguration()
       
    68     password = ant.get_property(r'${ccm.user.password}')
       
    69     builder = preparation.PreparationBuilder(configSet.getConfigurations(), ant.get_property(r'${ccm.user.login}'), password, cache=ant.get_property(r'${ccm.cache.xml}'))
       
    70     builder.extract_release_data(r'${release.log.dir}/${build.id}_releasable.xml')
       
    71     builder.close()
       
    72 except Exception, e:
       
    73     print "ERROR: error found during preparation phase:" 
       
    74     for l in traceback.format_exc().splitlines(False):
       
    75         print "ERROR: %s" % l
       
    76     print "ERROR: this is a critical error, build will fail now:"
       
    77     for l in str(e).splitlines(False):
       
    78         print "ERROR: %s" % l
       
    79     if builder != None:
       
    80         builder.close()
       
    81     sys.exit(-1)
       
    82 sys.exit(0)
       
    83                 </hlm:python>
       
    84             </try>
       
    85             <finally>
       
    86                 <record name="${release.log.dir}/${build.id}_release_work_area.log" action="stop"/>
       
    87                 <hlm:assertFileExists file="${release.log.dir}/${build.id}_release_work_area.log" />
       
    88             </finally>
       
    89         </trycatch>
       
    90         <hlm:assertFileExists file="${release.log.dir}/${build.id}_releasable.xml" />
       
    91         
       
    92         <fmpp sourceFile="${helium.dir}/tools/release/templates/release_ccm_project.ant.xml.ftl"
       
    93             outputFile="${temp.build.dir}/release_ccm_project.ant.xml">
       
    94             <data expandProperties="yes">
       
    95                 data: xml(${release.log.dir}/${build.id}_releasable.xml)
       
    96                 ant: antProperties()
       
    97             </data>
       
    98         </fmpp>
       
    99         <hlm:assertFileExists file="${temp.build.dir}/release_ccm_project.ant.xml" />
       
   100         <ant antfile="${temp.build.dir}/release_ccm_project.ant.xml" target="all" />
       
   101     </target>
       
   102     
       
   103 </project>