buildframework/helium/tools/preparation/preparation.ant.xml
changeset 1 be27ed110b50
child 179 d8ac696cc51f
equal deleted inserted replaced
0:044383f39525 1:be27ed110b50
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <!-- 
       
     3 ============================================================================ 
       
     4 Name        : preparation.ant.xml 
       
     5 Part of     : Helium 
       
     6 
       
     7 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     8 All rights reserved.
       
     9 This component and the accompanying materials are made available
       
    10 under the terms of the License "Eclipse Public License v1.0"
       
    11 which accompanies this distribution, and is available
       
    12 at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    13 
       
    14 Initial Contributors:
       
    15 Nokia Corporation - initial contribution.
       
    16 
       
    17 Contributors:
       
    18 
       
    19 Description:
       
    20 
       
    21 ============================================================================
       
    22 -->
       
    23 <project name="preparation" xmlns:hlm="http://www.nokia.com/helium">
       
    24     <description>Preparation of a build area and other build initialization.</description>
       
    25     
       
    26     <!-- includes all necessary stuff -->
       
    27     <property name="ccmgetinput" value="ccmgetinput" />
       
    28 
       
    29     <import file="bom/bom.ant.xml" />
       
    30     <import file="password.ant.xml" />
       
    31     <import file="ido-prep.ant.xml" />
       
    32     <import file="overlays.ant.xml" />
       
    33     <import file="synergy/ccmgetinput.ant.xml" />
       
    34     <import file="synergy/buildmanagement.ant.xml" />
       
    35     <import file="ivy/dependencies.ant.xml"/>
       
    36 
       
    37 
       
    38     <!--
       
    39         Gets a release from GRACE.
       
    40         TODO: Improve interface with customer configuration, getenv_options should be replaced by set of properties.
       
    41     -->
       
    42     <target name="preparation-getenv" if="base_release.path" depends="init-build-area">
       
    43         <!-- Making sure we have nothing to pass -->
       
    44         <property name="base_release.path" value=""/>
       
    45         <property name="base_release.getenv_options" value=""/>
       
    46         <!-- Using the cleaned version of getenv.pl -->
       
    47         <property name="getenv.tool.location" location="${helium.dir}/tools/preparation/getenv.pl"/>
       
    48         <hlm:tempRecordStartMacro name="${build.id}_getenv.log"/>        
       
    49         <trycatch>
       
    50             <try>
       
    51                 <if>
       
    52                     <not>
       
    53                         <equals arg1="${base_release.getenv_options}" arg2="" />
       
    54                     </not>
       
    55                     <then>
       
    56                         <exec executable="perl" dir="${build.drive}/" failonerror="true">
       
    57                             <arg value="${getenv.tool.location}"/>
       
    58                             <arg value="-start"/>
       
    59                             <arg value="-nosoap"/>            
       
    60                             <arg value="-path"/>
       
    61                             <arg value="${base_release.path}"/>
       
    62                             <arg line="${base_release.getenv_options}"/>
       
    63                         </exec>
       
    64                     </then>
       
    65                     <else>
       
    66                         <exec executable="perl" dir="${build.drive}/" failonerror="true">
       
    67                             <arg value="${getenv.tool.location}"/>
       
    68                             <arg value="-start"/>
       
    69                             <arg value="-nosoap"/>            
       
    70                             <arg value="-path"/>
       
    71                             <arg value="${base_release.path}"/>
       
    72                         </exec>
       
    73                     </else>
       
    74                 </if>
       
    75             </try>
       
    76             <catch>
       
    77                 <echo message="Error: getenv failed"/>
       
    78             </catch>
       
    79         </trycatch>
       
    80         <hlm:tempRecordStopMacro name="${build.id}_getenv.log" filterref="filterset.getenv"/>
       
    81     </target>
       
    82 
       
    83         
       
    84     <!-- Removes an older build area from a machine, based on a count of 
       
    85     how many build areas to maintain at a time.
       
    86     -->
       
    87     <target name="delete-old-build-area" if="build.area.limit">
       
    88         <dirset id="build.area.dirs" dir="${prep.root.dir}" includes="${build.name}*"/>
       
    89         <if>
       
    90             <resourcecount when="greater" count="${build.area.limit}">
       
    91                 <dirset refid="build.area.dirs"/>
       
    92             </resourcecount>
       
    93             <then>
       
    94                 <pathconvert property="build.area">
       
    95                     <first count="1">
       
    96                         <sort xmlns:rcmp="antlib:org.apache.tools.ant.types.resources.comparators">
       
    97                             <rcmp:date/>
       
    98                             <dirset refid="build.area.dirs"/>
       
    99                         </sort>
       
   100                     </first>
       
   101                 </pathconvert>
       
   102                 <echo>${build.area}</echo>
       
   103                 <shellscript shell="cmd.exe" tmpsuffix=".bat" dir="${prep.root.dir}">
       
   104                     <arg value="/c"/>
       
   105                     <arg value="call"/>
       
   106                     rmdir /s/q ${build.area}
       
   107                 </shellscript>
       
   108             </then>
       
   109         </if>
       
   110     </target>
       
   111 
       
   112 
       
   113     <!-- Defines the start of a build from logging point of view. -->
       
   114     <target name="log-build-start">
       
   115         <tstamp>
       
   116             <format property="log.build.start_time" pattern="yyyy-MM-dd'T'HH:mm:ss" />
       
   117         </tstamp>
       
   118         <!-- Used in ROM configuration files for version date. -->
       
   119         <tstamp>
       
   120             <format property="today" pattern="dd-MM-yyyy" />
       
   121         </tstamp>
       
   122     </target>
       
   123 
       
   124 
       
   125  
       
   126      <!-- Prepares the Synergy configuration input for processing.
       
   127      
       
   128      This inserts Ant properties to the config file. --> 
       
   129     <target name="ccm-prepare-input" if="prep.delivery.file">        
       
   130         <property name="prep.delivery.conf.parsed" location="${build.cache.dir}/delivery.xml.parsed" />
       
   131         <copy file="${prep.delivery.file}" tofile="${prep.delivery.conf.parsed}" overwrite="true">
       
   132             <filterchain>
       
   133                 <expandproperties />
       
   134             </filterchain>
       
   135         </copy>
       
   136     </target>
       
   137     
       
   138 
       
   139     <!-- Checks the build drive is available. -->
       
   140     <target name="check-env-build-drive">
       
   141         <available file="${build.drive}/" property="build.drive.available" />
       
   142         <fail unless="build.drive.available" />
       
   143     </target>
       
   144 
       
   145     <!-- Macro to check enough disk space available or not. Notify build manager
       
   146     in case of insufficient disk space. -->
       
   147     <macrodef name="diskspaceMacro" uri="http://www.nokia.com/helium">
       
   148         <attribute name="drive"/>
       
   149         <attribute name="space"/>
       
   150         <sequential>
       
   151             <trycatch>
       
   152                 <try>
       
   153                     <exec executable="python" failonerror="true">
       
   154                         <arg value="${helium.dir}/tools/preparation/freedisk.py" />
       
   155                         <arg value="--drive" />
       
   156                         <arg value="@{drive}" />
       
   157                         <arg value="--space" />
       
   158                         <arg value="@{space}" />
       
   159                     </exec>
       
   160                 </try>
       
   161                 <catch>
       
   162                     <hlm:notifyMacro message="${env.COMPUTERNAME} has insufficient disk space on drive @{drive} for ${build.id}. Build will continue..."/>
       
   163                 </catch>
       
   164             </trycatch>
       
   165         </sequential>
       
   166     </macrodef>
       
   167     
       
   168     
       
   169     <!-- Checks there is sufficient disk space on the local machine and on the network. -->
       
   170     <target name="check-free-space">
       
   171         <if>
       
   172             <isset property="local.free.space"/>
       
   173             <then>
       
   174                 <echo message="drive: ${build.drive}"/>
       
   175                 <echo message="Required Space: ${local.free.space}MB"/>
       
   176                 <if>
       
   177                     <not>
       
   178                         <hasfreespace partition="${build.drive}" needed="${local.free.space}M"/>
       
   179                     </not>
       
   180                     <then>
       
   181                         <hlm:notifyMacro message="${env.COMPUTERNAME} has insufficient disk space on drive ${build.drive} for ${build.id}. Build will continue..."/>
       
   182                     </then>
       
   183                 </if>
       
   184             </then>
       
   185         </if>
       
   186         <if>
       
   187             <isset property="network.free.space"/>
       
   188             <then>
       
   189                 <hlm:diskspaceMacro drive="${network.drive}" space="${network.free.space}"/>
       
   190             </then>
       
   191         </if>
       
   192     </target>
       
   193 
       
   194 
       
   195     <!-- Checks that filedisk is on the machine.
       
   196     
       
   197     TODO: do we still need this if filedisk is in /external? Also should handle
       
   198     tools dependencies in more structured way. 
       
   199     -->
       
   200     <target name="check-env-filedisk" depends="check-env-build-drive">
       
   201         <available file="${env.SystemRoot}/system32/filedisk.exe" property="filedisk.available" />
       
   202         <fail unless="filedisk.available" />
       
   203     </target>
       
   204 
       
   205 
       
   206     <!-- Gets the ARM compiler license text. -->
       
   207     <target name="get-arm-license">
       
   208         <exec executable="armcc.exe" outputproperty="arm.compiler.version.text" failonerror="${failonerror}">
       
   209             <arg value="--vsn" />
       
   210         </exec>
       
   211         <echo message="ARM compiler version text: ${arm.compiler.version.text}" />
       
   212     </target>
       
   213 
       
   214 
       
   215     <!-- Checks if there was any error getting the ARM license information. -->
       
   216     <target name="check-env-arm-license" depends="get-arm-license">
       
   217         <!-- Fail if the compiler version string contains error text. -->
       
   218         <fail message="Error with ARM compiler configuration.">
       
   219             <condition>
       
   220                 <contains string="${arm.compiler.version.text}" substring="Error" />
       
   221             </condition>
       
   222         </fail>
       
   223     </target>
       
   224 
       
   225 
       
   226     <!-- Sets the ARM compiler version to a property so it can be set in the environment
       
   227     during compilation. -->
       
   228     <target name="set-arm-version" depends="check-env-arm-license" unless="not.using.rvct">
       
   229         <loadresource property="arm.compiler.version">
       
   230             <propertyresource name="arm.compiler.version.text"/>
       
   231             <filterchain>
       
   232                 <linecontainsregexp>
       
   233                     <regexp pattern="ARM/Thumb C/C\+\+ Compiler" />
       
   234                 </linecontainsregexp>
       
   235             </filterchain>
       
   236         </loadresource>
       
   237         <echo message="ARM compiler version: ${arm.compiler.version}" />
       
   238     </target>
       
   239 
       
   240 
       
   241     <!-- Prepares the preparation configuration by inserting Ant properties. -->
       
   242     <target name="prep-prepare-input" if="prep.config.file">
       
   243         <property name="prep.config.file.parsed" location="${build.output.dir}/prep.xml.parsed" />
       
   244         <copy file="${prep.config.file}" tofile="${prep.config.file.parsed}" overwrite="true">
       
   245             <filterchain>
       
   246                 <expandproperties />
       
   247             </filterchain>
       
   248         </copy>
       
   249     </target>
       
   250 
       
   251 
       
   252     <!-- Checks that all the build area inputs are available. -->
       
   253     <target name="check-env-prep" depends="prep-prepare-input">
       
   254         <preset.exec executable="${env.PERL}" failonerror="true">
       
   255             <arg value="${helium.dir}/tools/preparation/prep_build_area.pl" />
       
   256             <arg value="-config" />
       
   257             <arg value="${prep.config.file.parsed}" />
       
   258             <arg value="-destdir" />
       
   259             <arg value="${build.drive}${env.EPOCROOT}" />
       
   260             <arg value="-dry-run" />
       
   261             <arg value="yes" />
       
   262         </preset.exec>
       
   263     </target>
       
   264 
       
   265 
       
   266     <!-- Generates a starting XML file for the build summary. -->
       
   267     <target name="build-info" depends="log-build-start">
       
   268         <dirname file="${build.summary.file}" property="build.summary.file.dir"/>
       
   269         <mkdir dir="${build.summary.file.dir}"/>
       
   270         <xmltask dest="${build.log.dir}/${build.id}_info.log.xml">
       
   271             <insert path="/">
       
   272                 <![CDATA[
       
   273             <info>
       
   274                 <id>${build.id}</id>
       
   275                 <number>${build.number}</number>
       
   276                 <startTime>${log.build.start_time}</startTime>
       
   277                 <machine>${env.COMPUTERNAME}</machine>
       
   278                 <publish>
       
   279                     <status>${is.published}</status>
       
   280                     <location>${publish.dir}</location>
       
   281                 </publish>
       
   282             </info>
       
   283                 ]]>
       
   284             </insert>
       
   285         </xmltask>
       
   286     </target>
       
   287     
       
   288     <propertyset id="password.list.ref">
       
   289         <propertyref name="ccm.password.rc" />
       
   290         <propertyref name="ccm.user.password" />
       
   291         <propertyref name="release.grace.password" />
       
   292         <propertyref name="unix.password" />
       
   293         <propertyref name="release.notes.password" />
       
   294         <propertyref name="nwiki.password" />
       
   295         <propertyref name="noe.password" />
       
   296         <propertyref name="ats3.password" />
       
   297         <propertyref name="hydra.password" />
       
   298     </propertyset>
       
   299     
       
   300     <!-- Logs the Ant property build environment. -->
       
   301     <target name="log-build-env">
       
   302         <echoproperties destfile="${build.log.dir}/${build.id}_ant_env.log">
       
   303             <!-- Do not log passwords... -->
       
   304             <propertyset negate="true">
       
   305                 <propertyset refid="password.list.ref"/>
       
   306             </propertyset>
       
   307         </echoproperties>
       
   308     </target>
       
   309     
       
   310     
       
   311     <!-- Create a free substed drive for running the build on.
       
   312         
       
   313     Helium can now subst/unsubst build drive automatically. If you don't define the property "build.drive" then helium will search the next available build drive and assign it to in "build.drive" property.
       
   314     To unsubst the build drive after the build use property "unsubst.after.build=yes", the value "no" will let the drive still in subst.
       
   315         
       
   316     This target will: 
       
   317     * Rename the prep directory if it exists and we don't have prep.build.dir.keep defined. 
       
   318     * Create a new directory for prepping the build area.
       
   319     * Subst that directory to the build drive.
       
   320     -->
       
   321     <target name="prep-drive">
       
   322       
       
   323       <!-- Just un-subst the drive if build.drive is predefined. -->
       
   324         <propertyregex property="prep.build.dir.drive" input="${prep.build.dir}" regexp="^([^:]*:\\).*" select="\1" />
       
   325         <fail message="${prep.build.dir.drive} could not be located">
       
   326             <condition>
       
   327                 <and>
       
   328                     <os family='windows'/>
       
   329                     <not>
       
   330                         <available file="${prep.build.dir.drive}"/>
       
   331                     </not>
       
   332                 </and>
       
   333             </condition>
       
   334         </fail>
       
   335         <if>
       
   336             <and>
       
   337                 <not>
       
   338                     <isset property="env.HLM_SUBCON"/>
       
   339                 </not>
       
   340                 <isset property="use.dragonfly"/>
       
   341             </and>
       
   342             <then>
       
   343                 <antcall target="dragonfly-prep-drive"/>
       
   344             </then>
       
   345             <else>
       
   346                 <if>
       
   347                     <not>
       
   348                         <isset property="build.drive.notdefined"/>
       
   349                     </not>
       
   350                     <then>
       
   351                         <echo>Unsubsting any existing path substed to ${build.drive}.
       
   352 If this fails, it is because there was no substed drive.</echo>
       
   353                         <hlm:unsubst drive="${build.drive}" failonerror="${failonerror}"/>
       
   354                     </then>   
       
   355                 </if>    
       
   356                 <tstamp>
       
   357                     <format property="old.prep.dir.timestamp" pattern="yyyyMMdd'_'HHmmss" />
       
   358                 </tstamp>
       
   359                 <if>
       
   360                     <not>
       
   361                         <isset property="prep.build.dir.keep"/>
       
   362                     </not>
       
   363                     <then>
       
   364                         <script language="jython" setbeans="false">
       
   365 from java.io import *
       
   366 import time
       
   367 prep_build_dir_str = project.getProperty('prep.build.dir')
       
   368 prep_build_dir = File(prep_build_dir_str)
       
   369 print prep_build_dir
       
   370 if prep_build_dir.exists(): 
       
   371     timestamp = time.strftime("%Y%m%d_%H%M%S", time.localtime(time.time()))
       
   372     renamed_prep_build_dir = File('%s.%s' % (prep_build_dir_str, timestamp))
       
   373     print renamed_prep_build_dir
       
   374     result = prep_build_dir.renameTo(renamed_prep_build_dir)
       
   375     if result:
       
   376         print 'Dir rename successful.'
       
   377     else:
       
   378         print 'Dir rename failed!'
       
   379 
       
   380         raise Exception('Could not rename prep dir')
       
   381                         </script>
       
   382                     </then>
       
   383                 </if>
       
   384                 <!-- Create a new directory for the build and subst it to a drive. -->
       
   385                 <mkdir dir="${prep.build.dir}" />
       
   386                 <exec osfamily="windows" executable="subst.exe" failonerror="false">
       
   387                     <arg value="${build.drive}" />
       
   388                     <arg value="${prep.build.dir}" />
       
   389                 </exec>
       
   390                 <antcall target="backup-subst-drives"/>
       
   391             </else>
       
   392         </if>
       
   393     </target>
       
   394 
       
   395     <!-- To initialization prep-drive-->
       
   396     <target name="init-drive" depends="prep-drive"/>
       
   397 
       
   398     <!-- To initialization substituted drive-->
       
   399     <target name="restore-subst-drives">
       
   400         <if>
       
   401             <available file="${cache.dir}/hlmsubsteddrives.bat" type="file"/>
       
   402             <then>
       
   403                 <exec dir="${cache.dir}" executable="${cache.dir}/hlmsubsteddrives.bat" osfamily="windows" failonerror="false"/>
       
   404             </then>
       
   405         </if>
       
   406     </target>
       
   407     
       
   408      
       
   409     <!-- Creates several initial directories in a new build area. -->
       
   410     <target name="init-build-area" depends="check-env-build-drive">
       
   411         <mkdir dir="${build.output.dir}" />
       
   412         <mkdir dir="${build.log.dir}" />
       
   413         <mkdir dir="${temp.build.dir}" />
       
   414     </target>
       
   415     
       
   416     
       
   417     <!-- Basic initialization for a build, including starting the main ant_build log.
       
   418         It also copies the additional logs from the temp directory into the build area. -->
       
   419     <target name="init" depends="get-ccm-password">
       
   420         <runtarget target="build-number"/>
       
   421         <runtarget target="init-build-area"/>
       
   422         <runtarget target="start-ant-log"/>
       
   423     </target>
       
   424     
       
   425     <!-- Starting the main ant_build log -->
       
   426     <target name="start-ant-log" depends="build-info">
       
   427         <record name="${build.log}" append="true" loglevel="info"/>
       
   428         <echo>Start main Ant build log: ${build.log}</echo>
       
   429     
       
   430         <echo>Copying temp logs from ${build.cache.log.dir} into the build area.</echo>
       
   431         <copy todir="${build.log.dir}" verbose="true" failonerror="false">
       
   432             <fileset dir="${build.cache.log.dir}">
       
   433                 <include name="*.log"/>
       
   434                 <include name="*.xml"/>
       
   435             </fileset>
       
   436         </copy>
       
   437     </target>
       
   438     
       
   439     <!-- This target exists as a trigger for initiating the Diamonds logger. If 
       
   440           it is not included in the build sequence, the build will not be logged to 
       
   441           Diamonds. Also  build.property.cache.file will be there contains all the diamonds related properties 
       
   442     --> 
       
   443     <target name="diamonds">
       
   444         <mkdir dir="${build.log.dir}" />
       
   445         <var name="diamonds.build.url"  value="http://${diamonds.host}:${diamonds.port}${diamonds.build.id}"/>
       
   446         <echoproperties destfile="${build.property.cache.file}">
       
   447             <propertyset>
       
   448                 <propertyref prefix="diamonds.build.url"/>
       
   449                 <propertyref prefix="diamonds.host"/>
       
   450                 <propertyref prefix="diamonds.port"/>
       
   451                 <propertyref prefix="diamonds.build.id"/>
       
   452             </propertyset>
       
   453         </echoproperties>
       
   454     </target>    
       
   455    
       
   456     <!-- The ido-clean-prep is to be run after compile-clean but before prep copy in order to move old sources away.
       
   457     It uses the "ido.src.root" property.
       
   458     If property "ido.keep.old" is defined, the old files are renamed to a timestamped directory  
       
   459     if not defined the directory for the old  files is "${ido.src.root}.old"
       
   460     <deprecated>IDO which have now implemented the new ADO sysdef structure should use ido-prep-clean.</deprecated>
       
   461     -->
       
   462     <target name="ido-clean-prep" if="ido.src.root" >
       
   463         <if>
       
   464             <isset property="ido.keep.old"/>
       
   465             <then>
       
   466                 <tstamp>
       
   467                     <format property="ido.clean.src.extension" pattern="yyyyMMdd'_'HHmmss" />
       
   468                 </tstamp>
       
   469             </then>
       
   470             <else>
       
   471                 <property name="ido.clean.src.extension" value="old" />
       
   472             </else>
       
   473         </if>
       
   474         <move todir="${ido.src.root}.${ido.clean.src.extension}"  failonerror="false" >
       
   475             <fileset dir="${ido.src.root}" />
       
   476         </move>
       
   477     </target>
       
   478 
       
   479 
       
   480     <!-- Preps the build area by copying and unzipping all the inputs. -->
       
   481     <target name="prep-copy" depends="prep-prepare-input">
       
   482         <preset.exec executable="${env.PERL}" output="${build.log.dir}/${build.id}_buildarea_prep.log" failonerror="true">
       
   483             <arg value="${helium.dir}/tools/preparation/prep_build_area.pl" />
       
   484             <arg value="-config" />
       
   485             <arg value="${prep.config.file.parsed}" />
       
   486             <arg value="-destdir" />
       
   487             <arg value="${build.drive}${env.EPOCROOT}" />
       
   488             <arg value="-zipdir" />
       
   489             <arg value="${build.drive}/unzip" />
       
   490         </preset.exec>
       
   491         <!-- Delete Symbian file to force S60 version to compile -->
       
   492         <delete file="${build.drive}/epoc32/tools/j2me/hromize.exe" />
       
   493         <!-- parsing the generated log -->
       
   494         <hlm:metadatarecord database="${metadata.dbfile}">
       
   495             <hlm:textmetadatainput>
       
   496                 <fileset casesensitive="false" file="${build.log.dir}/${build.id}_buildarea_prep.log" />
       
   497                 <metadatafilterset refid="filterset.buildarea.prep" />
       
   498             </hlm:textmetadatainput>
       
   499         </hlm:metadatarecord>
       
   500         <hlm:generateBuildStatus file="${build.id}_buildarea_prep.log" />
       
   501     </target>
       
   502     
       
   503     <condition property="run.ccm">
       
   504         <and>
       
   505             <not>
       
   506                 <equals arg1="${ccm.enabled}" arg2="false" casesensitive="true"/>
       
   507             </not>
       
   508             <isset property="ccm.enabled"/>
       
   509         </and>
       
   510     </condition>
       
   511     
       
   512     <!-- Wrapper target to call prep-work-area during the build.
       
   513          log will get recorded under the log directory.
       
   514          Property ccm.enabled has to be set to 'true' to enable that step!
       
   515          prep-work-area-check-errors is also run so it emits a signal in case of errors.
       
   516       -->
       
   517     <target name="do-prep-work-area">
       
   518         <runtarget target="prep-work-area"/>
       
   519     </target>
       
   520     <!-- <deprecated>Please use do-prep-work-area</deprecated> -->
       
   521     <target name="do-ccm-get-input" depends="do-prep-work-area"/>
       
   522     
       
   523     
       
   524     <!-- Wrapper target to call start-remote-builds during the build.
       
   525          log will get recorded under the log directory.
       
   526          Property remote.builds.enabled has to be defined to enable that step!
       
   527       -->
       
   528     <target name="do-start-remote-builds" if="remote.builds.enabled">
       
   529         <runtarget target="start-remote-builds"/>
       
   530     </target>
       
   531     
       
   532     
       
   533     <!-- check-env-prep has to be called after getting the delivery else it doesn't works for the first build. -->
       
   534     <target name="do-prep" depends="check-tool-dependencies,check-free-space,do-prep-work-area,
       
   535                                     do-start-remote-builds,check-env-prep,diamonds,create-bom,log-build-env,prep-copy,
       
   536                                     set-arm-version,scan-overlays" />
       
   537     
       
   538     <!-- Macro to notify user by email/sms -->
       
   539     <macrodef name="notifyMacro" uri="http://www.nokia.com/helium">
       
   540         <attribute name="message"/>
       
   541         <sequential>
       
   542             <runtarget target="lookup-email" />
       
   543             <tstamp>
       
   544                 <format property="time.failure" pattern="yyyy-MM-dd_HH.mm.ss" />
       
   545             </tstamp>
       
   546             <preset.mail tolist="${email.from}" subject="${env.COMPUTERNAME} prep stage problem!" message="@{message}" />
       
   547             <!-- Get the first part of email address to use with SMS gateway -->
       
   548             <propertyregex property="email.from.name" input="${email.from}" regexp="(.*?)@" select="\1" />
       
   549             <preset.mail tolist="${email.from.name}@${sms.server}" subject="" message="@{message}" />
       
   550         </sequential>
       
   551     </macrodef>
       
   552     
       
   553     
       
   554     <!-- Fails the build if prep did not succeed. -->
       
   555     <target name="prep-fail">
       
   556         <if>
       
   557             <available file="${build.log}"/>
       
   558             <then>
       
   559                 <record name="${build.log}" action="stop" append="true"/>
       
   560             </then>
       
   561         </if>
       
   562         <hlm:metadatarecord database="${metadata.dbfile}">
       
   563             <hlm:antmetadatainput>
       
   564                 <fileset casesensitive="false" file="${build.log.dir}/${build.id}_ant_build.log" />
       
   565                 <metadatafilterset refid="filterset.ant.output" />
       
   566             </hlm:antmetadatainput>
       
   567         </hlm:metadatarecord>
       
   568         <hlm:generateBuildStatus file="${build.id}_ant_build.log" />
       
   569         <!-- Todo: metadata: insert assertions for metadata parsing here -->
       
   570     </target>
       
   571     
       
   572     <!-- Set properties for track full build event. -->
       
   573     <target name="set-fullbuild-properties">
       
   574         <property name="log.target" value="yes"/>
       
   575         <property name="call.cleanup" value="no"/>
       
   576     </target>
       
   577     
       
   578     <!-- Top-level target for preparing the build area. -->
       
   579     <target name="prep" depends="set-fullbuild-properties,init-drive,init">
       
   580         <trycatch property="build.exception">
       
   581             <try>
       
   582                 <runtarget target="do-prep" />
       
   583             </try>
       
   584             <catch>
       
   585                 <echo message="Build has failed during prep: ${build.exception}" />
       
   586                 <runtarget target="prep-fail" />
       
   587                 <fail />
       
   588             </catch>
       
   589         </trycatch>
       
   590     </target>
       
   591 
       
   592     
       
   593     <!-- Can be used to unsubst the drive . -->
       
   594     <target name="remove-drive">
       
   595         <if>
       
   596             <os family="windows"/>
       
   597             <then>
       
   598                 <hlm:unsubst drive="${build.drive}"/>
       
   599             </then>
       
   600         </if>
       
   601     </target>
       
   602     
       
   603     
       
   604 </project>