buildframework/helium/tools/preparation/bom/bom.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:
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     1
<?xml version="1.0" encoding="UTF-8"?>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     2
<!-- 
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     3
============================================================================ 
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     4
Name        : bom.ant.xml 
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     5
Part of     : Helium 
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     6
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     7
Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     8
All rights reserved.
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     9
This component and the accompanying materials are made available
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    10
under the terms of the License "Eclipse Public License v1.0"
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    11
which accompanies this distribution, and is available
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    12
at the URL "http://www.eclipse.org/legal/epl-v10.html".
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    13
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    14
Initial Contributors:
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    15
Nokia Corporation - initial contribution.
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    16
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    17
Contributors:
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    18
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    19
Description:
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    20
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    21
============================================================================
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    22
-->
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    23
<!--* @package preparation -->
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    24
<project name="preparation.bom" xmlns:hlm="http://www.nokia.com/helium">    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    25
    <description>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    26
    Creates a Bill-Of-Materials record based on the Synergy inputs.
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    27
    </description>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    28
    
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    29
    <!-- Your synergy work area directory (Set as the parent of the helium dir by default).
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    30
    @type string
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    31
    -->
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    32
    <property name="create.bom.workarea.root" value="."/> 
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    33
    
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    34
    <!-- The target create-bom creates a Bill-Of-Material based on the SCM project 
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    35
    The target can be run in the project's root directory or the directory can be given by
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    36
    setting the property create.bom.workarea.root. The IDO builds are expected to set it to their 
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    37
    projects work area directory. -->
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    38
    <target name="create-bom" depends="get-ccm-password,old-bom-log,ccm-prepare-input,prep-prepare-input">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    39
        <hlm:startSpecificLogMacro name="${prep.log.dir}/${build.id}_bom.log" regexp="${ccm.user.password}" phase="prep"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    40
        <hlm:python>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    41
import os
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    42
import build.model
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    43
import configuration
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    44
import nokia.nokiaccm
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    45
import ccm.extra
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    46
import ant
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    47
import sys
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    48
import traceback
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    49
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    50
session = None
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    51
try:
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    52
    runccm = ant.get_property(r'${run.ccm}')
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    53
    database = ant.get_property(r'${ccm.database}')
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    54
    username = ant.get_property(r'${ccm.user.login}')
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    55
    password = ant.get_property(r'${ccm.user.password}')
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    56
    engine = ant.get_property(r'${ccm.engine.host}')
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    57
    dbpath = ant.get_property(r'${ccm.database.path}')
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    58
    waroot = ant.get_property(r'${create.bom.workarea.root}')
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    59
    buildid = ant.get_property(r'${build.id}')
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    60
    buildlogdir = ant.get_property(r'${build.log.dir}')
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    61
    deliveryfile = ant.get_property(r'${prep.delivery.conf.parsed}')
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    62
    oldbom = ant.get_property(r'${old.bom.log}')
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    63
    bom = None
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    64
    bomfilename = r"%s/%s_bom.xml" % (buildlogdir, buildid)
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    65
    if runccm and deliveryfile:
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    66
        cache = None
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    67
        if ant.get_property(r'${ccm.cache.xml}') is not None:
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    68
            cache = str(ant.get_property(r'${ccm.cache.xml}'))
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    69
        provider = ccm.extra.CachedSessionProvider(opener=nokia.nokiaccm.open_session, cache=cache)
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    70
            
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    71
        configBuilder = configuration.NestedConfigurationBuilder(open(deliveryfile, 'r'))
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    72
        configSet = configBuilder.getConfiguration()
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    73
        for config in configSet.getConfigurations():
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    74
            waroot = config['dir']
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    75
            print "Found wa for project %s" % waroot
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    76
                        
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    77
        if database != None:
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    78
            session = provider.get(username, password, database=database)
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    79
        else:
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    80
            session = provider.get(username, password, engine, dbpath)
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    81
            
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    82
        ccmproject =  ccm.extra.get_toplevel_project(session, waroot)
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    83
        
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    84
        config_data = {'delivery': deliveryfile, 'prep.xml': ant.get_property(r'${prep.config.file.parsed}'), 'build.id': buildid, 'ccm.database': database, 'symbian_rel_week': ant.get_property(r'${symbian.version.week}'), 'symbian_rel_ver': ant.get_property(r'${symbian.version}'), 'symbian_rel_year': ant.get_property(r'${symbian.version.year}'), 's60_version': ant.get_property(r'${s60.version}'), 's60_release': ant.get_property(r'${s60.release}'), 'currentRelease.xml': ant.get_property(r'${build.drive}') + "/currentRelease.xml"}
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    85
        config = configuration.Configuration(config_data)
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    86
        
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    87
        # let's only support the new spec model!
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    88
        bom = build.model.SynergyBOM(config, ccmproject, username=username, password=password, provider=provider)
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    89
        
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    90
        xml_writer = build.model.BOMXMLWriter(bom)
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    91
        xml_writer.write(bomfilename)
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    92
    if not bom and os.path.exists(bomfilename):
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    93
        config_data = {'prep.xml': ant.get_property(r'${prep.config.file.parsed}'), 'build.id': buildid, 'symbian_rel_week': ant.get_property(r'${symbian.version.week}'), 'symbian_rel_ver': ant.get_property(r'${symbian.version}'), 'symbian_rel_year': ant.get_property(r'${symbian.version.year}'), 's60_version': ant.get_property(r'${s60.version}'), 's60_release': ant.get_property(r'${s60.release}'), 'currentRelease.xml': ant.get_property(r'${build.drive}') + "/currentRelease.xml"}
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    94
        config = configuration.Configuration(config_data)
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    95
        bom = build.model.SimpleBOM(config, bomfilename)
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    96
    if os.path.exists(oldbom):
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    97
        xml_delta_writer = build.model.BOMDeltaXMLWriter(bom, oldbom)
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    98
        xml_delta_writer.write(buildlogdir + "/" + buildid + "_bom_delta.xml")
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    99
        delta_bom_content_validity = xml_delta_writer.validate_delta_bom_contents(buildlogdir + "/" + buildid + "_bom_delta.xml", bomfilename, oldbom)
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   100
        if((delta_bom_content_validity == False) and (ant.get_property(r'${hlm.enable.asserts}') is not None)):
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   101
            print 'Bom delta contents are not matching'
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   102
            raise Exception
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   103
        elif((delta_bom_content_validity == True) or (delta_bom_content_validity == None)):
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   104
            print 'Bom delta contents are matching.'
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   105
        elif(delta_bom_content_validity == False):
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   106
            print 'Bom delta contents are not matching.'
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   107
    else:
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   108
        print 'Old BOM log cannot be found ' + oldbom + ', skipping BOM delta creation.'
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   109
    if runccm:
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   110
        bom.close()
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   111
    if session:
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   112
        session.close()
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   113
except Exception, ex:
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   114
    print 'Caught exception in BOM: ' + str(ex)
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   115
    traceback.print_exc()
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   116
        </hlm:python>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   117
        <if>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   118
            <available file="${build.log.dir}/${build.id}_bom.xml"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   119
            <then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   120
                <echo>${build.log.dir}</echo>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   121
                <xmltask source="${build.log.dir}/${build.id}_bom.xml" dest="${build.log.dir}/${build.id}_bom.xml" outputter="simple">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   122
                    <replace path="//bom/build/text()" withText="${build.id}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   123
                </xmltask>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   124
                <fmpp sourceRoot="${helium.dir}/tools/preparation/bom"
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   125
                      outputRoot="${prep.log.dir}" includes="bom.html.*,bom.txt.*" removeExtensions="ftl">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   126
                    <freemarkerLinks expandProperties="yes">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   127
                        macro: ${helium.dir}/tools/common/templates/macro
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   128
                    </freemarkerLinks>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   129
                    <data expandProperties="yes">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   130
                        doc: xml(${build.log.dir}/${build.id}_bom.xml)                
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   131
                    </data>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   132
                </fmpp>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   133
                
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   134
                <move file="${prep.log.dir}/bom.html" tofile="${build.log.dir}/${build.id}_bom.html"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   135
                <move file="${prep.log.dir}/bom.txt" tofile="${prep.log.dir}/${build.id}_bom.txt"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   136
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   137
                <!-- Transform bom data into the diamonds xml format: 
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   138
                     * BOM folders are flattened into tasks.
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   139
                     * Schema version is extracted from the appropriate FMPP template. -->
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   140
                <mkdir dir="${temp.build.dir}" />
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   141
                <fmpp sourcefile="${helium.dir}/tools/common/templates/diamonds/diamonds_header.ftl" 
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   142
                      outputfile="${temp.build.dir}/diamonds_header.xml" quiet="true"/>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   143
                <loadfile srcfile="${temp.build.dir}/diamonds_header.xml" property="diamonds.schema.xml">
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   144
                    <filterchain>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   145
                        <linecontains>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   146
                            <contains value="schema"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   147
                        </linecontains>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   148
                    </filterchain>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   149
                </loadfile>                
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   150
                <mkdir dir="${diamonds.build.output.dir}" />
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   151
                <xmltask source="${build.log.dir}/${build.id}_bom.xml" dest="${diamonds.build.output.dir}/create-bom.xml">           
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   152
                    <insert path="bom/content" xml="${diamonds.schema.xml}" position="before"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   153
                    <remove path="bom/content/project/folder/name"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   154
                    <remove path="bom/build"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   155
                    <rename path="bom" to="diamonds-build"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   156
                </xmltask>                
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   157
                <delete file="${temp.build.dir}/diamonds_header.xml"/>
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   158
                <replace file="${diamonds.build.output.dir}/create-bom.xml" token="&lt;folder&gt;" value="&lt;!-- &lt;folder&gt; --&gt;"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   159
                <replace file="${diamonds.build.output.dir}/create-bom.xml" token="&lt;/folder&gt;" value="&lt;!-- &lt;/folder&gt; --&gt;"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   160
                <xmltask source="${diamonds.build.output.dir}/create-bom.xml" dest="${diamonds.build.output.dir}/create-bom.xml"
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   161
                         outputter="simple">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   162
                    <remove path="//comment()"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   163
                </xmltask>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   164
             
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   165
                <hlm:assertFileExists file="${diamonds.build.output.dir}/create-bom.xml"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   166
                <hlm:assertFileExists file="${build.log.dir}/${build.id}_bom.html"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   167
                <hlm:assertFileExists file="${prep.log.dir}/${build.id}_bom.txt"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   168
                
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   169
                <runtarget target="collect-task-owner-email"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   170
            </then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   171
            <else>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   172
                <echo>WARNING: ${build.log.dir}/${build.id}_bom.xml file not found.</echo>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   173
            </else>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   174
        </if>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   175
        
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   176
        <if>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   177
            <available file="${old.bom.log}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   178
            <then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   179
                <hlm:assertFileExists file="${build.log.dir}/${build.id}_bom_delta.xml"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   180
                <fmpp sourceRoot="${helium.dir}/tools/preparation/bom"
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   181
                      outputRoot="${prep.log.dir}" includes="bom_delta.*" removeExtensions="ftl">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   182
                    <freemarkerLinks expandProperties="yes">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   183
                        macro: ${helium.dir}/tools/common/templates/macro
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   184
                    </freemarkerLinks>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   185
                    <data expandProperties="yes">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   186
                        doc: xml(${build.log.dir}/${build.id}_bom_delta.xml)                
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   187
                    </data>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   188
                </fmpp>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   189
                                
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   190
                <move file="${prep.log.dir}/bom_delta.html" tofile="${build.log.dir}/${build.id}_bom_delta.html"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   191
                <move file="${prep.log.dir}/bom_delta.txt" tofile="${prep.log.dir}/${build.id}_bom_delta.txt"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   192
                
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   193
                <hlm:assertFileExists file="${build.log.dir}/${build.id}_bom_delta.html"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   194
            </then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   195
        </if>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   196
        <hlm:stopSpecificLogMacro name="${prep.log.dir}/${build.id}_bom.log" phase="prep"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   197
    </target>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   198
    
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   199
    <!-- The target create-task-owner-email creates a property task.owners.email which will contain
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   200
    the list of task owners email IDs seperated by comma, the newly created property can be used thereafter
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   201
    to send emails.
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   202
    This target is automatically called by create-bom target. @scope private-->
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   203
    <target name="collect-task-owner-email">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   204
        <if>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   205
            <available file="${build.log.dir}/${build.id}_bom_delta.xml"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   206
            <then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   207
                <xmltask source="${build.log.dir}/${build.id}_bom_delta.xml" dest="${build.log.dir}/${build.id}_bom_delta.xml"> 
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   208
                    <call path="/bomDelta/content/task">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   209
                        <param name="task.delta" path="text()"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   210
                        <actions>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   211
                            <var name="task.delta" value="@{task.delta}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   212
                            <propertyregex property="delta.task.id" input="${task.delta}" regexp="^([^:]+):\s*" select="\1"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   213
                            <xmltask source="${build.log.dir}/${build.id}_bom.xml" dest="${build.log.dir}/${build.id}_bom.xml"> 
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   214
                                <call path="/bom/content/project/folder/task/owner/text()[../../id[.='${delta.task.id}']]" >
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   215
                                    <param name="task.owner" path="."/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   216
                                    <actions>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   217
                                        <var name="task.owner" value="@{task.owner}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   218
                                        <if>
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   219
                                            <isset property="task.owners"/>
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   220
                                            <then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   221
                                                <var name="task.owners" value="${task.owners},${task.owner}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   222
                                            </then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   223
                                            <else>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   224
                                                <var name="task.owners" value="${task.owner}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   225
                                            </else>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   226
                                        </if>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   227
                                    </actions>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   228
                                </call>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   229
                            </xmltask>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   230
                        </actions>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   231
                    </call>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   232
                </xmltask> 
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   233
            </then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   234
            <else>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   235
                <if>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   236
                    <available file="${build.log.dir}/${build.id}_bom.xml"/>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   237
                    <then>
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   238
                        <xmltask source="${build.log.dir}/${build.id}_bom.xml" dest="${build.log.dir}/${build.id}_bom.xml"> 
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   239
                            <call path="/bom/content/project/folder/task/owner">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   240
                                <param name="task.owner" path="text()"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   241
                                <actions>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   242
                                    <var name="task.owner" value="@{task.owner}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   243
                                    <if>
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   244
                                        <isset property="task.owners"/>
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   245
                                        <then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   246
                                            <var name="task.owners" value="${task.owners},${task.owner}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   247
                                        </then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   248
                                        <else>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   249
                                            <var name="task.owners" value="${task.owner}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   250
                                        </else>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   251
                                    </if>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   252
                                </actions>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   253
                            </call>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   254
                        </xmltask> 
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   255
                    </then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   256
                </if>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   257
            </else>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   258
        </if>
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   259
        <script language="jython" setbeans="false">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   260
import re
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   261
taskOwnersDup = project.getProperty("task.owners")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   262
if taskOwnersDup:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   263
    taskOwnersDup = re.sub(r'\s', '', taskOwnersDup)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   264
    taskOwners = taskOwnersDup.split(',')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   265
    if taskOwners:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   266
        taskOwners = list(set(taskOwners))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   267
        project.setProperty("task.owners.unique", ",".join(taskOwners))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   268
        </script>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   269
        <for list="${task.owners.unique}" delimiter="," param="task.owner" >
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   270
            <sequential>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   271
                <var name="task.owner" value="@{task.owner}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   272
                <if>
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   273
                    <isset property="email.ldap.server"/>
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   274
                    <then>
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   275
                        <hlm:ldap url="${email.ldap.server}" rootdn="${email.ldap.rootdn}" filter="uid=${task.owner}" outputproperty="task.owner.email" key="mail"/>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   276
                        <if>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   277
                            <isset property="task.owners.email"/>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   278
                            <then>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   279
                                <var name="task.owners.email" value="${task.owners.email},${task.owner.email}"/>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   280
                            </then>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   281
                            <else>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   282
                                <var name="task.owners.email" value="${task.owner.email}"/>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   283
                            </else>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   284
                        </if>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   285
                    </then>   
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   286
                </if>
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   287
            </sequential>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   288
        </for>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   289
    </target>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   290
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   291
    <!-- Finds the path to the last usable XML BOM log for creating a BOM delta. --> 
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   292
    <target name="old-bom-log" unless="old.bom.log">
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   293
        <!-- Publish dir location of the old bom log.
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   294
        @type string
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   295
        -->
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   296
        <property name="old.bom.log.publish.dir" value="${publish.dir}" />
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   297
        <!-- Location of XML BOM log.
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   298
        @type string
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   299
        @scope private
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   300
        -->
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   301
        <property name="bom.log" value="${old.bom.log.publish.dir}/logs/${build.id}_bom.xml"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   302
        <script language="jython" setbeans="false">
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   303
import re
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   304
import ant
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   305
import os
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   306
from com.nokia.ant.util import Helper
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   307
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   308
previousbuildnumber = 1
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   309
buildnumber = Helper.getProperty(project, "build.number")
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   310
bomlog = project.getProperty("bom.log")
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   311
while(previousbuildnumber > 0 and previousbuildnumber != ''):
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   312
    previousbuildnumber = ant.get_previous_build_number(buildnumber)
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   313
    try:
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   314
        old_bom_log = re.sub(r'\.(%s)([\/_])' % project.getProperty("build.number"), r'.' + previousbuildnumber + r'\2', bomlog)
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   315
        if os.path.exists(old_bom_log):
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   316
            break
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   317
    except ValueError:
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   318
        self.log("Old BOM cannot be found")
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   319
    buildnumber = previousbuildnumber
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   320
project.setProperty("old.bom.log", old_bom_log)
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   321
        </script>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   322
        <echo>Previous BOM log: ${old.bom.log}</echo>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   323
        <available file="${old.bom.log}" property="old.bom.log.present"/>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   324
        <echo>Previous BOM log present: ${old.bom.log.present}</echo>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   325
    </target>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   326
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   327
</project>