buildframework/helium/tools/preparation/synergy/buildmanagement.ant.xml
author lorewang
Wed, 01 Dec 2010 16:05:36 +0800
changeset 715 e0739b8406dd
parent 588 c7c26511138f
permissions -rw-r--r--
Specify extenal tool with path

<?xml version="1.0" encoding="UTF-8"?>
<!-- 
============================================================================ 
Name        : buildmanagement.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 preparation -->
<project name="buildmanagement" xmlns:hlm="http://www.nokia.com/helium">
    <description>
        Runs the build manager Synergy operations.
    </description>
    <!-- Preprocesses the build management configuration file. -->
    <target name="build-manager-prepare-input">
        <property name="project.config.file.parsed" location="${build.cache.dir}/project_config.xml.parsed" />
        <copy file="${project.config.file}" tofile="${project.config.file.parsed}" overwrite="true">
            <filterchain>
                <expandproperties />
            </filterchain>
        </copy>
    </target>


    <!-- Runs the build manager Synergy operations. -->
    <target name="build-manager" depends="build-manager-prepare-input">
        <hlm:record name="${build.log.dir}/${build.id}_build_manager.log" action="start" />
        <echo>ccm.engine.host = ${ccm.engine.host}</echo>
        <echo>ccm.database.path = ${ccm.database.path}</echo>
        <hlm:python resultproperty="buildmanagement.result">
import buildmanagement

buildmanagement.buildmanager(r'${ccm.engine.host}', r'${ccm.database.path}', r'${project.config.file.parsed}', r'${project.spec.name}')
        </hlm:python>
        <hlm:record name="${build.log.dir}/${build.id}_build_manager.log" action="stop" />
        <hlm:logextract file="${build.log.dir}/${build.id}_build_manager.log" />
        <!-- <hlm:signal name="buildManagementSignal" result="${buildmanagement.result}"/> -->
    </target>

    <!-- This macro enables you to create a synergy session using information from your .netrc file. -->
    <scriptdef name="createSessionMacro" language="jython" uri="http://www.nokia.com/helium">
        <attribute name="database" />
        <attribute name="reference" />
        <attribute name="cache" />
import sys
import heliumlogging
import logging
import ant
logging.getLogger('').addHandler(ant.AntHandler(self))
reference = attributes.get('reference')
cache = attributes.get('cache')
if reference == None:
    raise Exception("reference attribute is not defined.")
database = attributes.get('database')
if database == None:
    raise Exception("database attribute is not defined.")

import nokia.nokiaccm
import ccm.extra
from com.nokia.helium.ccmtask.ant.types import SessionSet
import traceback
        
session = None
if cache != None:
    p = ccm.extra.CachedSessionProvider(cache=str(cache))
    session = p.get(database=str(database))
    p.close()
else:
    session = nokia.nokiaccm.open_session(database=str(database))
    session.close_on_exit = False

sessionset = SessionSet()
asession = sessionset.createSession()
asession.setAddr(str(session.addr()))
project.addReference(str(reference), sessionset)
    </scriptdef>


</project>