buildframework/helium/tools/preparation/preparation.ant.xml
changeset 217 0f5e3a7fb6af
parent 179 d8ac696cc51f
child 587 85df38eb4012
equal deleted inserted replaced
181:59bb7c4d6172 217:0f5e3a7fb6af
    18 
    18 
    19 Description:
    19 Description:
    20 
    20 
    21 ============================================================================
    21 ============================================================================
    22 -->
    22 -->
       
    23 <!--* @package preparation -->
    23 <project name="preparation" xmlns:hlm="http://www.nokia.com/helium">
    24 <project name="preparation" xmlns:hlm="http://www.nokia.com/helium">
    24     <description>Preparation of a build area and other build initialization.</description>
    25     <description>Preparation of a build area and other build initialization.</description>
    25     
    26     
       
    27     <!--* @property prep.config.file
       
    28     Defines configuration file used in prep-copy target. The file defines how files are copied and extracted into build area.
       
    29     @type string
       
    30     @editable required
       
    31     @scope public
       
    32     -->
       
    33     
    26     <!-- includes all necessary stuff -->
    34     <!-- includes all necessary stuff -->
       
    35     <!-- To check which ccmgetinput helium will be use
       
    36     @type string
       
    37     -->
    27     <property name="ccmgetinput" value="ccmgetinput" />
    38     <property name="ccmgetinput" value="ccmgetinput" />
    28 
    39 
    29     <import file="bom/bom.ant.xml" />
    40     <import file="bom/bom.ant.xml" />
    30     <import file="password.ant.xml" />
    41     <import file="password.ant.xml" />
    31     <import file="ido-prep.ant.xml" />
    42     <import file="ido-prep.ant.xml" />
    32     <import file="overlays.ant.xml" />
       
    33     <import file="synergy/ccmgetinput.ant.xml" />
    43     <import file="synergy/ccmgetinput.ant.xml" />
    34     <import file="synergy/buildmanagement.ant.xml" />
    44     <import file="synergy/buildmanagement.ant.xml" />
    35     <import file="ivy/dependencies.ant.xml"/>
    45     <import file="ivy/dependencies.ant.xml"/>
    36 
    46 
    37 
    47 
    42     <target name="preparation-getenv" if="base_release.path" depends="init-build-area">
    52     <target name="preparation-getenv" if="base_release.path" depends="init-build-area">
    43         <!-- Making sure we have nothing to pass -->
    53         <!-- Making sure we have nothing to pass -->
    44         <property name="base_release.path" value=""/>
    54         <property name="base_release.path" value=""/>
    45         <property name="base_release.getenv_options" value=""/>
    55         <property name="base_release.getenv_options" value=""/>
    46         <!-- Using the cleaned version of getenv.pl -->
    56         <!-- Using the cleaned version of getenv.pl -->
       
    57         <!-- Defines the location of the getenv.pl script.
       
    58         @type string
       
    59         @scope private
       
    60         -->
    47         <property name="getenv.tool.location" location="${helium.dir}/tools/preparation/getenv.pl"/>
    61         <property name="getenv.tool.location" location="${helium.dir}/tools/preparation/getenv.pl"/>
    48         <hlm:tempRecordStartMacro name="${build.id}_getenv.log"/>        
    62         <hlm:tempRecordStartMacro name="${build.id}_getenv.log"/>        
    49         <trycatch>
    63         <trycatch>
    50             <try>
    64             <try>
    51                 <if>
    65                 <if>
    84     <!-- Removes an older build area from a machine, based on a count of 
    98     <!-- Removes an older build area from a machine, based on a count of 
    85     how many build areas to maintain at a time.
    99     how many build areas to maintain at a time.
    86     -->
   100     -->
    87     <target name="delete-old-build-area" if="build.area.limit">
   101     <target name="delete-old-build-area" if="build.area.limit">
    88         <dirset id="build.area.dirs" dir="${prep.root.dir}" includes="${build.name}*"/>
   102         <dirset id="build.area.dirs" dir="${prep.root.dir}" includes="${build.name}*"/>
    89         <if>
   103         <resourcecount property="build.area.count">
    90             <resourcecount when="greater" count="${build.area.limit}">
   104             <dirset refid="build.area.dirs"/>
    91                 <dirset refid="build.area.dirs"/>
   105         </resourcecount>
    92             </resourcecount>
   106         <if>
    93             <then>
   107             <scriptcondition language="jython">
       
   108                 <![CDATA[
       
   109 if project.getProperty("build.area.count") > project.getProperty("build.area.limit"):
       
   110     self.value = True
       
   111                 ]]>
       
   112             </scriptcondition>
       
   113             <then>
       
   114                 <math result="num.to.delete" operand1="${build.area.count}" operation="-" operand2="${build.area.limit}" datatype="int"/>
    94                 <pathconvert property="build.area">
   115                 <pathconvert property="build.area">
    95                     <first count="1">
   116                     <first count="${num.to.delete}">
    96                         <sort xmlns:rcmp="antlib:org.apache.tools.ant.types.resources.comparators">
   117                         <sort xmlns:rcmp="antlib:org.apache.tools.ant.types.resources.comparators">
    97                             <rcmp:date/>
   118                             <rcmp:date/>
    98                             <dirset refid="build.area.dirs"/>
   119                             <dirset refid="build.area.dirs"/>
    99                         </sort>
   120                         </sort>
   100                     </first>
   121                     </first>
   149         <attribute name="space"/>
   170         <attribute name="space"/>
   150         <sequential>
   171         <sequential>
   151             <trycatch>
   172             <trycatch>
   152                 <try>
   173                 <try>
   153                     <exec executable="python" failonerror="true">
   174                     <exec executable="python" failonerror="true">
   154                         <arg value="${helium.dir}/tools/preparation/freedisk.py" />
   175                         <arg value="-m" />
       
   176                         <arg value="freedisk" />
   155                         <arg value="--drive" />
   177                         <arg value="--drive" />
   156                         <arg value="@{drive}" />
   178                         <arg value="@{drive}" />
   157                         <arg value="--space" />
   179                         <arg value="--space" />
   158                         <arg value="@{space}" />
   180                         <arg value="@{space}" />
   159                     </exec>
   181                     </exec>
   247             </filterchain>
   269             </filterchain>
   248         </copy>
   270         </copy>
   249     </target>
   271     </target>
   250 
   272 
   251 
   273 
   252     <!-- Checks that all the build area inputs are available. -->
   274     <!-- Obsolete. Left as placeholder. 
       
   275          Earlier: Checks that all the build area inputs are available.  -->
   253     <target name="check-env-prep" depends="prep-prepare-input">
   276     <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>
   277     </target>
   264 
   278 
   265 
   279 
   266     <!-- Generates a starting XML file for the build summary. -->
   280     <!-- Generates a starting XML file for the build summary. -->
   267     <target name="build-info" depends="log-build-start">
   281     <target name="build-info" depends="start-ant-log,log-build-start">
   268         <dirname file="${build.summary.file}" property="build.summary.file.dir"/>
   282         <dirname file="${build.summary.file}" property="build.summary.file.dir"/>
   269         <mkdir dir="${build.summary.file.dir}"/>
   283         <mkdir dir="${build.summary.file.dir}"/>
   270         <mkdir dir="${prep.log.dir}"/>
   284         <mkdir dir="${prep.log.dir}"/>
   271         <xmltask dest="${build.log.dir}/${build.id}_info.log.xml">
   285         <xmltask dest="${build.log.dir}/${build.id}_info.log.xml">
   272             <insert path="/">
   286             <insert path="/">
   410     <!-- Creates several initial directories in a new build area. -->
   424     <!-- Creates several initial directories in a new build area. -->
   411     <target name="init-build-area" depends="check-env-build-drive">
   425     <target name="init-build-area" depends="check-env-build-drive">
   412         <mkdir dir="${build.output.dir}" />
   426         <mkdir dir="${build.output.dir}" />
   413         <mkdir dir="${build.log.dir}" />
   427         <mkdir dir="${build.log.dir}" />
   414         <mkdir dir="${prep.log.dir}" />
   428         <mkdir dir="${prep.log.dir}" />
   415         <mkdir dir="${compile.log.dir}" />
       
   416         <mkdir dir="${test.log.dir}" />
       
   417         <mkdir dir="${post.log.dir}" />
       
   418         <mkdir dir="${temp.build.dir}" />  
   429         <mkdir dir="${temp.build.dir}" />  
   419         <mkdir dir="${diamonds.build.output.dir}" />       
   430         <mkdir dir="${diamonds.build.output.dir}" />
   420     </target>
   431     </target>
   421     
   432     
   422     
   433     
   423     <!-- Basic initialization for a build, including starting the main ant_build log.
   434     <!-- Basic initialization for a build, including starting the main ant_build log.
   424         It also copies the additional logs from the temp directory into the build area. -->
   435         It also copies the additional logs from the temp directory into the build area. -->
   434                 <include name="*.xml"/>
   445                 <include name="*.xml"/>
   435             </fileset>
   446             </fileset>
   436         </copy>
   447         </copy>
   437         
   448         
   438     </target>
   449     </target>
   439     
       
   440     <!-- Starting the main ant_build log 
       
   441     <deprecated>
       
   442     Now this will be take care by the logging listener.
       
   443     It will start the main ant logging when ever the build starts.
       
   444     </deprecated>-->
       
   445     <target name="start-ant-log" />
       
   446     
       
   447     
   450     
   448     <!-- This target exists as a trigger for initiating the Diamonds logger. If 
   451     <!-- This target exists as a trigger for initiating the Diamonds logger. If 
   449           it is not included in the build sequence, the build will not be logged to 
   452           it is not included in the build sequence, the build will not be logged to 
   450           Diamonds. Also  build.property.cache.file will be there contains all the diamonds related properties 
   453           Diamonds. Also  build.property.cache.file will be there contains all the diamonds related properties 
   451     --> 
   454     --> 
   460                 <propertyref prefix="diamonds.build.id"/>
   463                 <propertyref prefix="diamonds.build.id"/>
   461             </propertyset>
   464             </propertyset>
   462         </echoproperties>
   465         </echoproperties>
   463     </target>    
   466     </target>    
   464    
   467    
   465     <!-- The ido-clean-prep is to be run after compile-clean but before prep copy in order to move old sources away.
   468     <!-- Used to prep the build area, now only a placeholder target for the customer -->
   466     It uses the "ido.src.root" property.
   469     <target name="prep-copy" />
   467     If property "ido.keep.old" is defined, the old files are renamed to a timestamped directory  
   470 
   468     if not defined the directory for the old  files is "${ido.src.root}.old"
       
   469     <deprecated>IDO which have now implemented the new ADO sysdef structure should use ido-prep-clean.</deprecated>
       
   470     -->
       
   471     <target name="ido-clean-prep" if="ido.src.root" >
       
   472         <if>
       
   473             <isset property="ido.keep.old"/>
       
   474             <then>
       
   475                 <tstamp>
       
   476                     <format property="ido.clean.src.extension" pattern="yyyyMMdd'_'HHmmss" />
       
   477                 </tstamp>
       
   478             </then>
       
   479             <else>
       
   480                 <property name="ido.clean.src.extension" value="old" />
       
   481             </else>
       
   482         </if>
       
   483         <move todir="${ido.src.root}.${ido.clean.src.extension}"  failonerror="false" >
       
   484             <fileset dir="${ido.src.root}" />
       
   485         </move>
       
   486     </target>
       
   487 
       
   488 
       
   489     <!-- Preps the build area by copying and unzipping all the inputs. -->
       
   490     <target name="prep-copy" depends="prep-prepare-input">
       
   491         <preset.exec executable="${env.PERL}" output="${prep.log.dir}/${build.id}_buildarea_prep.log" failonerror="true">
       
   492             <arg value="${helium.dir}/tools/preparation/prep_build_area.pl" />
       
   493             <arg value="-config" />
       
   494             <arg value="${prep.config.file.parsed}" />
       
   495             <arg value="-destdir" />
       
   496             <arg value="${build.drive}${env.EPOCROOT}" />
       
   497             <arg value="-zipdir" />
       
   498             <arg value="${build.drive}/unzip" />
       
   499         </preset.exec>
       
   500         <!-- Delete Symbian file to force S60 version to compile -->
       
   501         <delete file="${build.drive}/epoc32/tools/j2me/hromize.exe" />
       
   502         <!-- parsing the generated log -->
       
   503         <hlm:metadatarecord database="${metadata.dbfile}">
       
   504             <hlm:textmetadatainput>
       
   505                 <fileset casesensitive="false" file="${prep.log.dir}/${build.id}_buildarea_prep.log" />
       
   506                 <metadatafilterset refid="filterset.buildarea.prep" />
       
   507             </hlm:textmetadatainput>
       
   508         </hlm:metadatarecord>
       
   509         <hlm:generateBuildStatus file="${build.id}_buildarea_prep.log" />
       
   510     </target>
       
   511     
   471     
   512     <condition property="run.ccm">
   472     <condition property="run.ccm">
   513         <and>
   473         <and>
   514             <not>
   474             <not>
   515                 <equals arg1="${ccm.enabled}" arg2="false" casesensitive="true"/>
   475                 <equals arg1="${ccm.enabled}" arg2="false" casesensitive="true"/>
   525       -->
   485       -->
   526     <target name="do-prep-work-area" depends="find-files-pre">
   486     <target name="do-prep-work-area" depends="find-files-pre">
   527         <runtarget target="prep-work-area"/>
   487         <runtarget target="prep-work-area"/>
   528         <runtarget target="find-files-post"/>
   488         <runtarget target="find-files-post"/>
   529     </target>
   489     </target>
   530     <!-- <deprecated>Please use do-prep-work-area</deprecated> -->
       
   531     <target name="do-ccm-get-input" depends="do-prep-work-area"/>
       
   532     
   490     
   533     
   491     
   534     <!-- Wrapper target to call start-remote-builds during the build.
   492     <!-- Wrapper target to call start-remote-builds during the build.
   535          log will get recorded under the log directory.
   493          log will get recorded under the log directory.
   536          Property remote.builds.enabled has to be defined to enable that step!
   494          Property remote.builds.enabled has to be defined to enable that step!
   541     
   499     
   542     
   500     
   543     <!-- check-env-prep has to be called after getting the delivery else it doesn't works for the first build. -->
   501     <!-- check-env-prep has to be called after getting the delivery else it doesn't works for the first build. -->
   544     <target name="do-prep" depends="check-tool-dependencies,check-free-space,do-prep-work-area,
   502     <target name="do-prep" depends="check-tool-dependencies,check-free-space,do-prep-work-area,
   545                                     do-start-remote-builds,check-env-prep,diamonds,create-bom,log-build-env,prep-copy,
   503                                     do-start-remote-builds,check-env-prep,diamonds,create-bom,log-build-env,prep-copy,
   546                                     set-arm-version,scan-overlays" />
   504                                     set-arm-version" />
   547     
   505     
   548     <!-- Macro to notify user by email/sms -->
   506     <!-- Macro to notify user by email/sms -->
   549     <macrodef name="notifyMacro" uri="http://www.nokia.com/helium">
   507     <macrodef name="notifyMacro" uri="http://www.nokia.com/helium">
   550         <attribute name="message"/>
   508         <attribute name="message"/>
   551         <sequential>
   509         <sequential>
   579         <!-- Todo: metadata: insert assertions for metadata parsing here -->
   537         <!-- Todo: metadata: insert assertions for metadata parsing here -->
   580     </target>
   538     </target>
   581     
   539     
   582     <!-- Set properties for track full build event. -->
   540     <!-- Set properties for track full build event. -->
   583     <target name="set-fullbuild-properties">
   541     <target name="set-fullbuild-properties">
       
   542         <!-- Enables logging of the start and end of individual targets.
       
   543         @type string
       
   544         -->
   584         <property name="log.target" value="yes"/>
   545         <property name="log.target" value="yes"/>
       
   546         <!-- Ensures the cleanup-all target is called when the build finishes.
       
   547         @type string
       
   548         -->
   585         <property name="call.cleanup" value="no"/>
   549         <property name="call.cleanup" value="no"/>
   586     </target>
   550     </target>
   587     
   551     
   588     <!-- Top-level target for preparing the build area. -->
   552     <!-- Top-level target for preparing the build area. -->
   589     <target name="prep" depends="set-fullbuild-properties,init-drive,init">
   553     <target name="prep" depends="set-fullbuild-properties,init-drive,init">