buildframework/helium/tools/preparation/synergy/buildmanagement.ant.xml
changeset 1 be27ed110b50
child 179 d8ac696cc51f
equal deleted inserted replaced
0:044383f39525 1:be27ed110b50
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <!-- 
       
     3 ============================================================================ 
       
     4 Name        : buildmanagement.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 <project name="buildmanagement" xmlns:hlm="http://www.nokia.com/helium">
       
    24     <description>
       
    25         Runs the build manager Synergy operations.
       
    26     </description>
       
    27     <!-- Preprocesses the build management configuration file. -->
       
    28     <target name="build-manager-prepare-input">
       
    29         <property name="project.config.file.parsed" location="${build.cache.dir}/project_config.xml.parsed" />
       
    30         <copy file="${project.config.file}" tofile="${project.config.file.parsed}" overwrite="true">
       
    31             <filterchain>
       
    32                 <expandproperties />
       
    33             </filterchain>
       
    34         </copy>
       
    35     </target>
       
    36 
       
    37 
       
    38     <!-- Runs the build manager Synergy operations. -->
       
    39     <target name="build-manager" depends="build-manager-prepare-input">
       
    40         <record name="${build.log.dir}/${build.id}_build_manager.log" action="start" />
       
    41         <echo>ccm.engine.host = ${ccm.engine.host}</echo>
       
    42         <echo>ccm.database.path = ${ccm.database.path}</echo>
       
    43         <hlm:python resultproperty="buildmanagement.result">
       
    44 import buildmanagement
       
    45 
       
    46 buildmanagement.buildmanager(r'${ccm.engine.host}', r'${ccm.database.path}', r'${project.config.file.parsed}', r'${project.spec.name}')
       
    47         </hlm:python>
       
    48         <record name="${build.log.dir}/${build.id}_build_manager.log" action="stop" />
       
    49         <hlm:logextract file="${build.log.dir}/${build.id}_build_manager.log" />
       
    50         <!-- <hlm:signal name="buildManagementSignal" result="${buildmanagement.result}"/> -->
       
    51     </target>
       
    52 
       
    53     <!-- This macro enables you to create a synergy session using information from your .netrc file. -->
       
    54     <scriptdef name="createSessionMacro" language="jython" uri="http://www.nokia.com/helium">
       
    55         <attribute name="database" />
       
    56         <attribute name="reference" />
       
    57         <attribute name="cache" />
       
    58 import sys
       
    59 import heliumlogging
       
    60 import logging
       
    61 import ant
       
    62 logging.getLogger('').addHandler(ant.AntHandler(self))
       
    63 reference = attributes.get('reference')
       
    64 cache = attributes.get('cache')
       
    65 if reference == None:
       
    66     raise Exception("reference attribute is not defined.")
       
    67 database = attributes.get('database')
       
    68 if database == None:
       
    69     raise Exception("database attribute is not defined.")
       
    70 
       
    71 import nokia.nokiaccm
       
    72 import ccm.extra
       
    73 from com.nokia.ant.types.ccm import SessionSet
       
    74 import traceback
       
    75         
       
    76 session = None
       
    77 if cache != None:
       
    78     p = ccm.extra.CachedSessionProvider(cache=str(cache))
       
    79     session = p.get(database=str(database))
       
    80     p.close()
       
    81 else:
       
    82     session = nokia.nokiaccm.open_session(database=str(database))
       
    83     session.close_on_exit = False
       
    84 
       
    85 sessionset = SessionSet()
       
    86 asession = sessionset.createSession()
       
    87 asession.setAddr(str(session.addr()))
       
    88 project.addReference(str(reference), sessionset)
       
    89     </scriptdef>
       
    90 
       
    91     <!-- Target to test ccm-task. -->
       
    92     <target name="try-ccm-task" if="run.ccm">
       
    93         <hlm:ccm>
       
    94             <hlm:update project="mc_4032_component_branches-mc_4031_0650" />
       
    95         </hlm:ccm>
       
    96     </target>
       
    97 
       
    98     <!-- Target to test ccm-task. -->
       
    99     <target name="try-ccm-task2" if="run.ccm">
       
   100         <hlm:createSessionMacro database="to1tobet" reference="test.session" />
       
   101         <hlm:ccm verbose="false">
       
   102             <!-- Defining some session to use. -->
       
   103             <hlm:sessionset refid="test.session" />
       
   104 
       
   105 
       
   106             <!-- Do something ...-->
       
   107             <hlm:addtask folder="tr1test1#2079">
       
   108                 <task name="tr1test1#5310" />
       
   109             </hlm:addtask>
       
   110             <!--<hlm:update project="mc_4032_component_branches-mc_4031_0650"/>-->
       
   111             <hlm:snapshot project="helium-to1tobet#helium_3.0:project:vc1s60p1#1" dir="c:\test" fast="true" recursive="true" />
       
   112             <hlm:close />
       
   113         </hlm:ccm>
       
   114     </target>
       
   115     <!-- Target to test ccm-checkout. -->
       
   116     <target name="try-ccm-task3" if="run.ccm">
       
   117         <hlm:createSessionMacro database="tr1test1" reference="test.session" />
       
   118         <hlm:ccm verbose="false">
       
   119             <!-- Defining some session to use. -->
       
   120             <hlm:sessionset refid="test.session" />
       
   121             <hlm:checkout project="Hello_World-8.2:project:tr1test1#1" release="Hello_World/next" />
       
   122             <hlm:close />
       
   123         </hlm:ccm>
       
   124     </target>
       
   125 
       
   126     <!-- Target to test ccm-work_area. -->
       
   127     <target name="try-ccm-task4" if="run.ccm">
       
   128         <hlm:createSessionMacro database="tr1test1" reference="test.session" />
       
   129         <hlm:ccm verbose="false">
       
   130             <!-- Defining some session to use. -->
       
   131             <hlm:sessionset refid="test.session" />
       
   132             <hlm:workarea project="Hello_World-8.3:project:tr1test1#1" maintain="True" />
       
   133             <hlm:close />
       
   134         </hlm:ccm>
       
   135     </target>
       
   136 
       
   137 </project>