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