buildframework/helium/tools/preparation/bom/bom.ant.xml
author Ross Qin <ross.qin@nokia.com>
Tue, 30 Nov 2010 14:05:41 +0800
changeset 713 7b7f0409fc00
parent 645 b8d81fa19e7d
permissions -rw-r--r--
merge
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
    
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    34
    <!--* @property bom.release.regex
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    35
    This property (if set) defines the regular expression BOM will use to extract data from 
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    36
    a basline release. The regular expression must define 4 fields: TYPE, YEAR, WEEK, REVISION
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    37
    Example:
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    38
        (?<TYPE>.*)_(?P<YEAR>\d{4})(?P<WEEK>\d{2})_(?<REVISION>.*)
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    39
    
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    40
    @type string
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    41
    @editable allowed
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    42
    @scope public
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    43
    -->
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    44
    
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    45
    <!-- 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
    46
    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
    47
    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
    48
    projects work area directory. -->
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    49
    <target name="create-bom">
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    50
        <runtarget target="get-ccm-password"/>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    51
        <runtarget target="old-bom-log"/>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    52
        <runtarget target="prep-prepare-input" />
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    53
        <runtarget target="ccm-prepare-input"/>
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    54
        <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
    55
        <hlm:python>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    56
import os
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    57
import build.model
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    58
import configuration
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    59
import nokia.nokiaccm
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    60
import ccm.extra
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    61
import ant
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    62
import sys
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    63
import traceback
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    64
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    65
session = None
645
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    66
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    67
runccm = ant.get_property(r'${ccm.enabled}')
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    68
database = ant.get_property(r'${ccm.database}')
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    69
username = ant.get_property(r'${ccm.user.login}')
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    70
password = ant.get_property(r'${ccm.user.password}')
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    71
engine = ant.get_property(r'${ccm.engine.host}')
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    72
dbpath = ant.get_property(r'${ccm.database.path}')
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    73
waroot = ant.get_property(r'${create.bom.workarea.root}')
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    74
buildid = ant.get_property(r'${build.id}')
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    75
buildlogdir = ant.get_property(r'${build.log.dir}')
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    76
deliveryfile = ant.get_property(r'${prep.delivery.conf.parsed}')
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    77
oldbom = ant.get_property(r'${old.bom.log}')
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    78
bom = None
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    79
bomfilename = r"%s/%s_bom.xml" % (buildlogdir, buildid)
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    80
if deliveryfile and runccm == 'true':
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    81
    cache = None
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    82
    if ant.get_property(r'${ccm.cache.xml}') is not None:
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    83
        cache = str(ant.get_property(r'${ccm.cache.xml}'))
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    84
    provider = ccm.extra.CachedSessionProvider(opener=nokia.nokiaccm.open_session, cache=cache)
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    85
        
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    86
    configBuilder = configuration.NestedConfigurationBuilder(open(deliveryfile, 'r'))
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    87
    configSet = configBuilder.getConfiguration()
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    88
    for config in configSet.getConfigurations():
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    89
        waroot = config['dir']
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    90
        print "Found wa for project %s" % waroot
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    91
                    
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    92
    if database != None:
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    93
        session = provider.get(username, password, database=database)
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    94
    else:
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    95
        session = provider.get(username, password, engine, dbpath)
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    96
        
645
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    97
    ccmproject =  ccm.extra.get_toplevel_project(session, waroot)
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    98
    
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
    99
    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", 'release_regexp': ant.get_property(r'${bom.release.regex}') }
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   100
    config = configuration.Configuration(config_data)
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   101
    
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   102
    # let's only support the new spec model!
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   103
    bom = build.model.SynergyBOM(config, ccmproject, username=username, password=password, provider=provider)
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   104
    
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   105
    xml_writer = build.model.BOMXMLWriter(bom)
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   106
    xml_writer.write(bomfilename)
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   107
if not bom and os.path.exists(bomfilename):
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   108
    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"}
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   109
    config = configuration.Configuration(config_data)
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   110
    bom = build.model.SimpleBOM(config, bomfilename)
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   111
if bom and os.path.exists(oldbom):
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   112
    xml_delta_writer = build.model.BOMDeltaXMLWriter(bom, oldbom)
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   113
    xml_delta_writer.write(buildlogdir + "/" + buildid + "_bom_delta.xml")
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   114
    delta_bom_content_validity = xml_delta_writer.validate_delta_bom_contents(buildlogdir + "/" + buildid + "_bom_delta.xml", bomfilename, oldbom)
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   115
    if((delta_bom_content_validity == False) and (ant.get_property(r'${hlm.enable.asserts}') is not None)):
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   116
        print 'Bom delta contents are not matching'
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   117
        raise Exception
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   118
    elif((delta_bom_content_validity == True) or (delta_bom_content_validity == None)):
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   119
        print 'Bom delta contents are matching.'
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   120
    elif(delta_bom_content_validity == False):
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   121
        print 'Bom delta contents are not matching.'
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   122
else:
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   123
    print 'Old BOM log cannot be found ' + oldbom + ', skipping BOM delta creation.'
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   124
if runccm == 'true':
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   125
    bom.close()
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   126
if session:
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   127
    session.close()
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   128
        </hlm:python>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   129
        <if>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   130
            <available file="${build.log.dir}/${build.id}_bom.xml"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   131
            <then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   132
                <echo>${build.log.dir}</echo>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   133
                <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
   134
                    <replace path="//bom/build/text()" withText="${build.id}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   135
                </xmltask>
645
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   136
                <fmpp sourceRoot="${helium.dir}/tools/preparation/bom/templates"
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   137
                      outputRoot="${prep.log.dir}" includes="bom.html.*,bom.txt.*" removeExtensions="ftl">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   138
                    <freemarkerLinks expandProperties="yes">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   139
                        macro: ${helium.dir}/tools/common/templates/macro
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   140
                    </freemarkerLinks>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   141
                    <data expandProperties="yes">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   142
                        doc: xml(${build.log.dir}/${build.id}_bom.xml)                
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   143
                    </data>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   144
                </fmpp>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   145
                
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   146
                <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
   147
                <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
   148
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   149
                <!-- Transform bom data into the diamonds xml format: 
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   150
                     * BOM folders are flattened into tasks.
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   151
                     * Schema version is extracted from the appropriate FMPP template. -->
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   152
                <mkdir dir="${temp.build.dir}" />
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   153
                <fmpp sourcefile="${helium.dir}/tools/common/templates/diamonds/diamonds_header.ftl" 
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   154
                      outputfile="${temp.build.dir}/diamonds_header.xml" quiet="true"/>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   155
                <loadfile srcfile="${temp.build.dir}/diamonds_header.xml" property="diamonds.schema.xml">
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   156
                    <filterchain>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   157
                        <linecontains>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   158
                            <contains value="schema"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   159
                        </linecontains>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   160
                    </filterchain>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   161
                </loadfile>                
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   162
                <mkdir dir="${diamonds.build.output.dir}" />
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   163
                <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
   164
                    <insert path="bom/content" xml="${diamonds.schema.xml}" position="before"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   165
                    <remove path="bom/content/project/folder/name"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   166
                    <remove path="bom/build"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   167
                    <rename path="bom" to="diamonds-build"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   168
                </xmltask>                
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   169
                <delete file="${temp.build.dir}/diamonds_header.xml"/>
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   170
                <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
   171
                <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
   172
                <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
   173
                         outputter="simple">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   174
                    <remove path="//comment()"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   175
                </xmltask>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   176
             
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   177
                <hlm:assertFileExists file="${diamonds.build.output.dir}/create-bom.xml"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   178
                <hlm:assertFileExists file="${build.log.dir}/${build.id}_bom.html"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   179
                <hlm:assertFileExists file="${prep.log.dir}/${build.id}_bom.txt"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   180
                
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   181
                <runtarget target="collect-task-owner-email"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   182
            </then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   183
            <else>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   184
                <echo>WARNING: ${build.log.dir}/${build.id}_bom.xml file not found.</echo>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   185
            </else>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   186
        </if>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   187
        
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   188
        <if>
645
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   189
            <and>
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   190
                <available file="${old.bom.log}"/>
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   191
                <available file="${build.log.dir}/${build.id}_bom_delta.xml"/>
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   192
            </and>
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   193
            <then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   194
                <hlm:assertFileExists file="${build.log.dir}/${build.id}_bom_delta.xml"/>
645
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   195
                <fmpp sourceRoot="${helium.dir}/tools/preparation/bom/templates"
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   196
                      outputRoot="${prep.log.dir}" includes="bom_delta.*" removeExtensions="ftl">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   197
                    <freemarkerLinks expandProperties="yes">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   198
                        macro: ${helium.dir}/tools/common/templates/macro
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   199
                    </freemarkerLinks>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   200
                    <data expandProperties="yes">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   201
                        doc: xml(${build.log.dir}/${build.id}_bom_delta.xml)                
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   202
                    </data>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   203
                </fmpp>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   204
                                
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   205
                <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
   206
                <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
   207
                
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   208
                <hlm:assertFileExists file="${build.log.dir}/${build.id}_bom_delta.html"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   209
            </then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   210
        </if>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   211
        <hlm:stopSpecificLogMacro name="${prep.log.dir}/${build.id}_bom.log" phase="prep"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   212
    </target>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   213
    
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   214
    <!-- 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
   215
    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
   216
    to send emails.
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   217
    This target is automatically called by create-bom target. @scope private-->
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   218
    <target name="collect-task-owner-email">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   219
        <if>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   220
            <available file="${build.log.dir}/${build.id}_bom_delta.xml"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   221
            <then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   222
                <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
   223
                    <call path="/bomDelta/content/task">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   224
                        <param name="task.delta" path="text()"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   225
                        <actions>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   226
                            <var name="task.delta" value="@{task.delta}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   227
                            <propertyregex property="delta.task.id" input="${task.delta}" regexp="^([^:]+):\s*" select="\1"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   228
                            <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
   229
                                <call path="/bom/content/project/folder/task/owner/text()[../../id[.='${delta.task.id}']]" >
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   230
                                    <param name="task.owner" path="."/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   231
                                    <actions>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   232
                                        <var name="task.owner" value="@{task.owner}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   233
                                        <if>
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   234
                                            <isset property="task.owners"/>
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   235
                                            <then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   236
                                                <var name="task.owners" value="${task.owners},${task.owner}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   237
                                            </then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   238
                                            <else>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   239
                                                <var name="task.owners" value="${task.owner}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   240
                                            </else>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   241
                                        </if>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   242
                                    </actions>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   243
                                </call>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   244
                            </xmltask>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   245
                        </actions>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   246
                    </call>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   247
                </xmltask> 
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   248
            </then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   249
            <else>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   250
                <if>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   251
                    <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
   252
                    <then>
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   253
                        <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
   254
                            <call path="/bom/content/project/folder/task/owner">
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   255
                                <param name="task.owner" path="text()"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   256
                                <actions>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   257
                                    <var name="task.owner" value="@{task.owner}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   258
                                    <if>
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   259
                                        <isset property="task.owners"/>
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   260
                                        <then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   261
                                            <var name="task.owners" value="${task.owners},${task.owner}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   262
                                        </then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   263
                                        <else>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   264
                                            <var name="task.owners" value="${task.owner}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   265
                                        </else>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   266
                                    </if>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   267
                                </actions>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   268
                            </call>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   269
                        </xmltask> 
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   270
                    </then>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   271
                </if>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   272
            </else>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   273
        </if>
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   274
        <script language="jython" setbeans="false">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   275
import re
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   276
taskOwnersDup = project.getProperty("task.owners")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   277
if taskOwnersDup:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   278
    taskOwnersDup = re.sub(r'\s', '', taskOwnersDup)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   279
    taskOwners = taskOwnersDup.split(',')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   280
    if taskOwners:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   281
        taskOwners = list(set(taskOwners))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   282
        project.setProperty("task.owners.unique", ",".join(taskOwners))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   283
        </script>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents: 217
diff changeset
   284
        <for list="${task.owners.unique}" delimiter="," param="task.owner" >
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   285
            <sequential>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   286
                <var name="task.owner" value="@{task.owner}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   287
                <if>
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   288
                    <isset property="email.ldap.server"/>
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   289
                    <then>
645
b8d81fa19e7d helium_12.0.0-63b64366f9cf
wbernard
parents: 628
diff changeset
   290
                        <hlm:ldap url="${email.ldap.server}" rootdn="${email.ldap.rootdn}" filter="uid=${task.owner}" outputproperty="task.owner.email" key="mail" failonerror="false"/>
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   291
                        <if>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   292
                            <isset property="task.owners.email"/>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   293
                            <then>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   294
                                <var name="task.owners.email" value="${task.owners.email},${task.owner.email}"/>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   295
                            </then>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   296
                            <else>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   297
                                <var name="task.owners.email" value="${task.owner.email}"/>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   298
                            </else>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   299
                        </if>
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   300
                    </then>   
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   301
                </if>
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   302
            </sequential>
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   303
        </for>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   304
    </target>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   305
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   306
    <!-- 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
   307
    <target name="old-bom-log" unless="old.bom.log">
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   308
        <!-- Publish dir location of the old bom log.
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   309
        @type string
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   310
        -->
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   311
        <property name="old.bom.log.publish.dir" value="${publish.dir}" />
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   312
        <!-- Location of XML BOM log.
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   313
        @type string
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   314
        @scope private
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   315
        -->
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   316
        <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
   317
        <script language="jython" setbeans="false">
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   318
import re
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   319
import ant
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   320
import os
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   321
from com.nokia.ant.util import Helper
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   322
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   323
previousbuildnumber = 1
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   324
buildnumber = Helper.getProperty(project, "build.number")
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   325
bomlog = project.getProperty("bom.log")
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   326
while(previousbuildnumber > 0 and previousbuildnumber != ''):
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   327
    previousbuildnumber = ant.get_previous_build_number(buildnumber)
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   328
    try:
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   329
        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
   330
        if os.path.exists(old_bom_log):
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   331
            break
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   332
    except ValueError:
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   333
        self.log("Old BOM cannot be found")
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   334
    buildnumber = previousbuildnumber
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   335
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
   336
        </script>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   337
        <echo>Previous BOM log: ${old.bom.log}</echo>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   338
        <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
   339
        <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
   340
    </target>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   341
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   342
</project>