buildframework/helium/tools/publish/publish.ant.xml
changeset 628 7c4a911dc066
parent 588 c7c26511138f
child 645 b8d81fa19e7d
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
    24 <project name="publish" xmlns:hlm="http://www.nokia.com/helium">
    24 <project name="publish" xmlns:hlm="http://www.nokia.com/helium">
    25     <description>
    25     <description>
    26     Zipping, delta zipping and copying targets
    26     Zipping, delta zipping and copying targets
    27     </description>
    27     </description>
    28     
    28     
       
    29     <!-- Tools configuration for basic Helium tools. -->
       
    30     <hlm:envdata id="helium.tools.envdata">
       
    31         <hlm:executable name="7za" versionArgs="" versionRegex="7-Zip (\S+)"/>
       
    32         <hlm:executable name="ant" versionArgs="-version" versionRegex="Apache Ant version (\S+)"/>
       
    33         <hlm:executable name="armcc" versionArgs="" versionRegex="RVCT(.+)" output="stderr"/>
       
    34         <hlm:executable name="ccm" versionArgs="version -c" versionRegex="(\S+)"/>
       
    35         <hlm:executable name="codescanner" versionArgs="" versionRegex="version (\S+)"/>
       
    36         <hlm:executable name="ctc" versionArgs="" versionRegex="This is CTC\+\+ \(v(\S+)\)"/>
       
    37         <hlm:executable name="java" versionArgs="-version" versionRegex="java version &quot;(\S+)\&quot;"/>
       
    38         <hlm:executable name="perl" versionArgs="-v" versionRegex="This is perl, v(\S+)"/>
       
    39         <hlm:executable name="python" versionArgs="--version" versionRegex="Python (\S+)"/>
       
    40         <hlm:executable name="sbs" versionArgs="-version" versionRegex="sbs version (.+)$"/>
       
    41         <hlm:executable name="unzip" versionArgs="-v" versionRegex="UnZip (\S+)"/>
       
    42         <hlm:executable name="emake" versionArgs="--version" versionRegex="Electric Make version (\S+)"/>
       
    43         <hlm:executable name="ectool" versionArgs="--version" versionRegex="ElectricCommander Tool version (\S+)"/>
       
    44     </hlm:envdata>
       
    45     
    29     <!--* @property zip.config.file
    46     <!--* @property zip.config.file
    30     The ZIP configuration XML file.
    47     The ZIP configuration XML file.
    31     @type string
    48     @type string
    32     @editable required
    49     @editable required
    33     @scope public
    50     @scope public
    72     The fileset id used on the right side of comparison.
    89     The fileset id used on the right side of comparison.
    73     @type string
    90     @type string
    74     @editable required
    91     @editable required
    75     @scope public
    92     @scope public
    76     -->
    93     -->
    77 
    94     
       
    95     <!--* Set to true to generate zip file containing binaries generated by build.
       
    96     @type boolean
       
    97     @editable required
       
    98     @scope public
       
    99     @since 11.0
       
   100     -->
       
   101     <property name="archiving.enabled" value="true"/>
       
   102 
       
   103     
       
   104     <!--* @property internal.archiving.enabled
       
   105     Set to run archiving targets if archiving.enabled set to true.
       
   106     @type boolean
       
   107     @scope private
       
   108     -->
       
   109     
       
   110     <!--* @property skip-zips
       
   111     Set to true to generate zip file containing binaries generated by build. - deprecated: Start using archiving.enabled property.
       
   112     @type boolean
       
   113     @editable required
       
   114     @scope public
       
   115     @deprecated since 11.0
       
   116     -->
       
   117     
       
   118     <!--* @property publish.enabled
       
   119     Set to true to publish build artificats.
       
   120     @type boolean
       
   121     @editable required
       
   122     @scope public
       
   123     @since 11.0
       
   124     -->
       
   125     
       
   126     <!--* @property internal.publish.enabled
       
   127     Set to run publishing targets if publish.enabled set to true.
       
   128     @type boolean
       
   129     @scope private
       
   130     -->
       
   131     
       
   132     <!--* @property publish
       
   133     Set to true to publish build artificats.. - deprecated: Start using publish.enabled property.
       
   134     @type boolean
       
   135     @editable required
       
   136     @scope public
       
   137     @deprecated since 11.0
       
   138     -->
       
   139     
       
   140     <!--* @property archive.wa.enabled
       
   141     Set to true to archive or zip the synergy workarea.
       
   142     @type boolean
       
   143     @editable required
       
   144     @scope public
       
   145     @since 11.0
       
   146     -->
       
   147     
       
   148     <!--* @property internal.archive.wa.enabled
       
   149     Set to run synergy wa archiving targets if archive.wa.enabled set to true.
       
   150     @type boolean
       
   151     @scope private
       
   152     -->
       
   153     
       
   154     <!--* @property zip.wa
       
   155     Set to true to arhive or zip the synergy workarea. - deprecated: Start using archive.wa.enabled property.
       
   156     @type boolean
       
   157     @editable required
       
   158     @scope public
       
   159     @deprecated since 11.0
       
   160     -->
       
   161     
       
   162     <!-- Check, is zipping binaries enabled -->
       
   163     <condition property="internal.archiving.enabled">
       
   164         <and>
       
   165             <not>
       
   166                 <isfalse value="${archiving.enabled}" />
       
   167             </not>
       
   168             <not>
       
   169                 <isset property="skip-zips"/>
       
   170             </not>
       
   171         </and>
       
   172     </condition>
       
   173     
       
   174     <!-- Check, is publish enabled -->
       
   175     <condition property="internal.publish.enabled">
       
   176         <or>
       
   177             <istrue value="${publish.enabled}"/>
       
   178             <isset property="publish"/>
       
   179         </or>
       
   180     </condition>
       
   181     
       
   182     <!-- Check, is publish enabled -->
       
   183     <condition property="internal.archive.wa.enabled">
       
   184         <or>
       
   185             <istrue value="${archive.wa.enabled}"/>
       
   186             <isset property="zip.wa"/>
       
   187         </or>
       
   188     </condition>
       
   189     
    78     <import file="internal-api/internal-api.ant.xml" />
   190     <import file="internal-api/internal-api.ant.xml" />
    79     <import file="nwiki.ant.xml" />
   191     <import file="nwiki.ant.xml" />
    80     <import file="synergy.ant.xml" />
   192     <import file="synergy.ant.xml" />
    81     <import file="test/test2_publishing_to_diamonds.ant.xml" />
   193     <import file="test/test2_publishing_to_diamonds.ant.xml" />
    82 
   194 
       
   195     
    83     <!-- Set the maximum number of threads running for archiving (for a parallel job).
   196     <!-- Set the maximum number of threads running for archiving (for a parallel job).
    84     @type integer
   197     @type integer
    85     -->
   198     -->
    86     <property name="archive.max.number.of.threads" value="8" />
   199     <property name="archive.max.number.of.threads" value="8" />
    87     
   200     
   133         <include name="**/*.ant.xml" />
   246         <include name="**/*.ant.xml" />
   134         <include name="tools/common/**/*" />
   247         <include name="tools/common/**/*" />
   135         <include name="tools/release/**/*" />
   248         <include name="tools/release/**/*" />
   136     </fileset>
   249     </fileset>
   137 
   250 
       
   251     
   138     <!-- 
   252     <!-- 
   139         If publish property is set, copy the publish.files fileset to the publish.dir directory using 
   253         If publish property is set, copy the publish.files fileset to the publish.dir directory using 
   140         number.of.threads parallel threads
   254         number.of.threads parallel threads
   141     -->
   255     -->
   142     <macrodef name="publishMacro" uri="http://www.nokia.com/helium">
   256     <macrodef name="publishMacro" uri="http://www.nokia.com/helium">
   143         <sequential>
   257         <sequential>
   144             <if>
   258             <if>
   145                 <isset property="publish" />
   259                 <isset property="internal.publish.enabled" />
   146                 <then>
   260                 <then>
   147                     <for list="${publish.fileset.ids}" param="fileset.id" parallel="true" threadCount='${number.of.threads}'>
   261                     <for list="${publish.fileset.ids}" param="fileset.id" parallel="true" threadCount='${number.of.threads}'>
   148                         <sequential>
   262                         <sequential>
   149                             <copy todir="${publish.dir}" preservelastmodified="true" failonerror="false">
   263                             <copy todir="${publish.dir}" preservelastmodified="true" failonerror="false">
   150                                 <fileset refid="@{fileset.id}" />
   264                                 <fileset refid="@{fileset.id}" />
   151                             </copy>
   265                             </copy>
       
   266                             
       
   267                             <pathconvert pathsep=" " property="@{fileset.id}.diamonds.files">
       
   268                                 <map from="${build.output.dir}" to="${publish.dir}"/>
       
   269                                 <fileset refid="@{fileset.id}"/>
       
   270                             </pathconvert>
       
   271                             <property name="diamonds.files" value="" />
       
   272                             <var name="diamonds.files" value="${@{fileset.id}.diamonds.files} ${diamonds.files}"/>
   152                         </sequential>
   273                         </sequential>
   153                     </for>
   274                     </for>
   154                 </then>
   275                 </then>
   155             </if>
   276             </if>
   156         </sequential>
   277         </sequential>
   157     </macrodef>
   278     </macrodef>
   158 
   279 
   159 
   280 
   160     <!-- Creates the publish directory. Directory location is defined by property: ${publish.dir} -->
   281     <!-- Creates the publish directory. Directory location is defined by property: ${publish.dir} -->
   161     <target name="prep-publish" if="publish">
   282     <target name="prep-publish" if="internal.publish.enabled">
   162         <mkdir dir="${publish.dir}" />
   283         <mkdir dir="${publish.dir}" />
   163     </target>
   284     </target>
   164 
   285 
   165 
   286 
   166     <!-- Parses the zip configuration file. Expands all the ant properties. -->
   287     <!-- Parses the zip configuration file. Expands all the ant properties. -->
   247 ]]> 
   368 ]]> 
   248             </hlm:python>
   369             </hlm:python>
   249         </sequential>
   370         </sequential>
   250     </macrodef>
   371     </macrodef>
   251 
   372 
       
   373     
   252     <!-- This macro allows you to add or update one archive definition inside the release metadata files.
   374     <!-- This macro allows you to add or update one archive definition inside the release metadata files.
   253     
   375     
   254     e.g.:
   376     e.g.:
   255     <pre>
   377     <pre>
   256         <hlm:updateMetadataMacro file="<path>/release_metadata.xml" archive="<path>/archive.zip" />
   378         <hlm:updateMetadataMacro file="<path>/release_metadata.xml" archive="<path>/archive.zip" />
   311 ]]> 
   433 ]]> 
   312             </hlm:python>
   434             </hlm:python>
   313         </sequential>
   435         </sequential>
   314     </macrodef>
   436     </macrodef>
   315     
   437     
       
   438     
   316     <!-- This macro update the metadata file generated by the config provided by file.
   439     <!-- This macro update the metadata file generated by the config provided by file.
   317     
   440     
   318     e.g:
   441     e.g:
   319     <pre>
   442     <pre>
   320     <hlm:updateMD5Macro file="${zip.config.file.parsed}" config="${zips.@{type}.spec.name}"/>
   443     <hlm:updateMD5Macro file="${zip.config.file.parsed}" config="${zips.@{type}.spec.name}"/>
   362 ]]> 
   485 ]]> 
   363         </hlm:python>
   486         </hlm:python>
   364         </sequential>
   487         </sequential>
   365     </macrodef>
   488     </macrodef>
   366 
   489 
       
   490     
   367     <condition property="archive.using.ec">
   491     <condition property="archive.using.ec">
   368         <or>
   492         <or>
   369             <equals arg1="${build.system}" arg2="ec-helium" />
   493             <equals arg1="${build.system}" arg2="ec-helium" />
   370             <equals arg1="${build.system}" arg2="sbs-ec" />
   494             <equals arg1="${build.system}" arg2="sbs-ec" />
   371         </or>
   495         </or>
   372     </condition>
   496     </condition>
       
   497     
   373     
   498     
   374     <!-- Zips files using a type and zip config file as args -->
   499     <!-- Zips files using a type and zip config file as args -->
   375     <macrodef name="zipContentMacro" uri="http://www.nokia.com/helium">
   500     <macrodef name="zipContentMacro" uri="http://www.nokia.com/helium">
   376         <attribute name="type" />
   501         <attribute name="type" />
   377         <attribute name="file" />
   502         <attribute name="file" />
   389             </if>
   514             </if>
   390             <mkdir dir="${@{phase}.log.dir}"/>
   515             <mkdir dir="${@{phase}.log.dir}"/>
   391             <mkdir dir="${post.log.dir}"/>
   516             <mkdir dir="${post.log.dir}"/>
   392             <property name="zip.@{type}.nopolicy.log.file" location="${@{phase}.log.dir}/${build.id}_@{type}_archive.nopolicy.log" />
   517             <property name="zip.@{type}.nopolicy.log.file" location="${@{phase}.log.dir}/${build.id}_@{type}_archive.nopolicy.log" />
   393             <property name="zip.@{type}.policy.log.file" location="${@{phase}.log.dir}/${build.id}_@{type}_archive.policy.log" />
   518             <property name="zip.@{type}.policy.log.file" location="${@{phase}.log.dir}/${build.id}_@{type}_archive.policy.log" />
   394             <trycatch property="exception" reference="exception">
   519             <hlm:taskRecorder output="${zip.@{type}.log.file}">
   395                 <try>
   520                 <!-- Path to the parsed file of zip specification file
   396                     <!-- Don't print 'compressing' on console -->
   521                 @type string
   397                     <hlm:logtoconsole action="stop" />
   522                 @scope private
   398                     <!-- Stops writing on ...ant_build.log file-->
   523                 -->
   399                     <hlm:startSpecificLogMacro name="${zip.@{type}.log.file}" phase="@{phase}"/>
   524                 <property name="zip.config.file.parsed" location="${temp.build.dir}/zip.cfg.xml.parsed" />
   400             
   525                 <copy file="@{file}" tofile="${zip.config.file.parsed}" overwrite="true">
   401                     <!-- Path to the parsed file of zip specification file
   526                     <filterchain>
   402                     @type string
   527                         <expandproperties />
   403                     @scope private
   528                     </filterchain>
   404                     -->
   529                 </copy>
   405                     <property name="zip.config.file.parsed" location="${temp.build.dir}/zip.cfg.xml.parsed" />
   530                 <hlm:updateArchiveConfig configtype="${zips.@{type}.spec.name}" configfileparsed="${zip.config.file.parsed}" usingec="@{ec}" failonemptyconfig="@{failonemptyconfig}"/>
   406                     <copy file="@{file}" tofile="${zip.config.file.parsed}" overwrite="true">
   531                 <if>
   407                         <filterchain>
   532                     <istrue value="@{ec}" />
   408                             <expandproperties />
   533                     <then>
   409                         </filterchain>
   534                         <echo>emake.root.to.append=${emake.root.to.append}</echo>
   410                     </copy>
   535                         <hlm:emakeMacro name="archive-full-@{type}" makefile="${build.drive}/ZIP_${zips.@{type}.spec.name}.make" target="all" dir="${build.drive}/" annodetail="basic,history,file,waiting" root="${emake.root.to.append}" failonerror="false" phase="archive"/>
   411                     <hlm:updateArchiveConfig configtype="${zips.@{type}.spec.name}" configfileparsed="${zip.config.file.parsed}" usingec="@{ec}" failonemptyconfig="@{failonemptyconfig}"/>
   536                     </then>
   412                     <if>
   537                     <else>
   413                         <istrue value="@{ec}" />
   538                         <if>
   414                         <then>
   539                             <isgreaterthan arg1="${number.of.threads}" arg2="${archive.max.number.of.threads}"/>
   415                             <echo>emake.root.to.append=${emake.root.to.append}</echo>
   540                             <then>
   416                             <hlm:emakeMacro name="archive-full-@{type}" makefile="${build.drive}/ZIP_${zips.@{type}.spec.name}.make" target="all" dir="${build.drive}/" annodetail="basic,history,file,waiting" root="${emake.root.to.append}" failonerror="false" phase="archive"/>
   541                                 <ant antfile="${build.drive}/ZIP_${zips.@{type}.spec.name}.xml">
   417                         </then>
   542                                     <!-- how many parallel threads can run
   418                         <else>
   543                                     @type string
   419                             <if>
   544                                     -->
   420                                 <isgreaterthan arg1="${number.of.threads}" arg2="${archive.max.number.of.threads}"/>
   545                                     <property name="number.of.threads" value="${archive.max.number.of.threads}"/>
   421                                 <then>
   546                                 </ant>
   422                                     <ant antfile="${build.drive}/ZIP_${zips.@{type}.spec.name}.xml">
   547                             </then>
   423                                         <!-- how many parallel threads can run
   548                             <else>
   424                                         @type string
   549                                 <ant antfile="${build.drive}/ZIP_${zips.@{type}.spec.name}.xml" />
   425                                         -->
   550                             </else>
   426                                         <property name="number.of.threads" value="${archive.max.number.of.threads}"/>
   551                         </if>
   427                                     </ant>
   552                     </else>
   428                                 </then>
   553                 </if>
   429                                 <else>
   554                 <hlm:python>
   430                                     <ant antfile="${build.drive}/ZIP_${zips.@{type}.spec.name}.xml" />
       
   431                                 </else>
       
   432                             </if>
       
   433                         </else>
       
   434                     </if>
       
   435                     <hlm:python>
       
   436 import archive
   555 import archive
   437 import configuration
   556 import configuration
   438 
   557 
   439 builder = configuration.NestedConfigurationBuilder(open(r'${zip.config.file.parsed}', 'r'))
   558 builder = configuration.NestedConfigurationBuilder(open(r'${zip.config.file.parsed}', 'r'))
   440 configSet = builder.getConfiguration()
   559 configSet = builder.getConfiguration()
   441 configs = configSet.getConfigurations(r'${zips.@{type}.spec.name}')
   560 configs = configSet.getConfigurations(r'${zips.@{type}.spec.name}')
   442 prebuilder = archive.ArchivePreBuilder(configuration.ConfigurationSet(configs), r'${zips.@{type}.spec.name}')
   561 prebuilder = archive.ArchivePreBuilder(configuration.ConfigurationSet(configs), r'${zips.@{type}.spec.name}')
   443 prebuilder.cleanupSubstDrives()
   562 prebuilder.cleanupSubstDrives()
   444                     </hlm:python>
   563                 </hlm:python>
   445                     <hlm:mergeMetadataMacro file="${zip.config.file.parsed}" config="${zips.@{type}.spec.name}" />
   564                 <hlm:mergeMetadataMacro file="${zip.config.file.parsed}" config="${zips.@{type}.spec.name}" />
   446                     <hlm:updateMD5Macro file="${zip.config.file.parsed}" config="${zips.@{type}.spec.name}" />
   565                 <hlm:updateMD5Macro file="${zip.config.file.parsed}" config="${zips.@{type}.spec.name}" />
   447                 </try>
   566             </hlm:taskRecorder>
   448                 <catch>
       
   449                     <!-- Printing and propagating the error -->
       
   450                     <echo>ERROR: ${exception}</echo>
       
   451                     <throw refid="exception"/>
       
   452                 </catch>
       
   453                 <finally>
       
   454                     <!-- Todo: metadata: Convert to metadata structure -->
       
   455                     <!-- Stops log back to main log. -->
       
   456                     <hlm:stopSpecificLogMacro name="${zip.@{type}.log.file}" phase="@{phase}"/>
       
   457                     <hlm:logtoconsole action="resume" />
       
   458                 </finally>
       
   459             </trycatch>
       
   460             <hlm:assertFileExists file="${zip.@{type}.log.file}" />
   567             <hlm:assertFileExists file="${zip.@{type}.log.file}" />
   461             <copy file="${zip.@{type}.log.file}" tofile="${zip.@{type}.nopolicy.log.file}" verbose="true">
   568             <copy file="${zip.@{type}.log.file}" tofile="${zip.@{type}.nopolicy.log.file}" verbose="true">
   462                 <filterchain>
   569                 <filterchain>
   463                     <linecontainsregexp negate="true">
   570                     <linecontainsregexp negate="true">
   464                         <regexp pattern="POLICY_(ERROR|WARNING|INFO)" />
   571                         <regexp pattern="POLICY_(ERROR|WARNING|INFO)" />
   495             <hlm:signalMacro logfile="${zip.@{type}.policy.log.file}" 
   602             <hlm:signalMacro logfile="${zip.@{type}.policy.log.file}" 
   496                 signal.input="archivePolicyErrorSignalInput" />
   603                 signal.input="archivePolicyErrorSignalInput" />
   497         </sequential>
   604         </sequential>
   498     </macrodef>
   605     </macrodef>
   499     
   606     
       
   607     
   500     <!--
   608     <!--
   501     1. To update the archive configuration file with substituted drives information for UNC paths (if any).
   609     1. To update the archive configuration file with substituted drives information for UNC paths (if any).
   502     2. To create the .make file to zip the sources using EC.    
   610     2. To create the .make file to zip the sources using EC.    
   503     -->
   611     -->
   504     <scriptdef name="updateArchiveConfig" language="jython" uri="http://www.nokia.com/helium">
   612     <scriptdef name="updateArchiveConfig" language="jython" uri="http://www.nokia.com/helium">
   541 ]]>
   649 ]]>
   542     </scriptdef>
   650     </scriptdef>
   543     
   651     
   544 
   652 
   545     <!-- Zips the Engineering English content. -->
   653     <!-- Zips the Engineering English content. -->
   546     <target name="zip-ee" unless="skip-zips">
   654     <target name="zip-ee" if="internal.archiving.enabled">
   547         <hlm:zipContentMacro type="ee" file="${zip.config.file}" />
   655         <hlm:zipContentMacro type="ee" file="${zip.config.file}" />
   548     </target>
   656     </target>
   549 
   657 
   550     <!-- Zips the subcon content. -->
   658     <!-- Zips the subcon content. -->
   551     <target name="zip-subcon" unless="skip-zips">
   659     <target name="zip-subcon" if="internal.archiving.enabled">
   552         <hlm:zipContentMacro type="subcon" file="${zip.config.file}" />
   660         <hlm:zipContentMacro type="subcon" file="${zip.config.file}" />
   553     </target>
   661     </target>
   554 
   662 
   555 
   663 
   556     <!-- Zips the subcon rom content. -->
   664     <!-- Zips the subcon rom content. -->
   557     <target name="zip-subcon-roms" unless="skip-zips">
   665     <target name="zip-subcon-roms" if="internal.archiving.enabled">
   558         <hlm:zipContentMacro type="subcon_roms" file="${zip.config.file}" />
   666         <hlm:zipContentMacro type="subcon_roms" file="${zip.config.file}" />
   559     </target>
   667     </target>
   560 
   668 
   561 
   669 
   562     <!-- Zips the localised content. -->
   670     <!-- Zips the localised content. -->
   563     <target name="zip-localised" unless="skip-zips">
   671     <target name="zip-localised" if="internal.archiving.enabled">
   564         <hlm:zipContentMacro type="localised" file="${zip.config.file}" />
   672         <hlm:zipContentMacro type="localised" file="${zip.config.file}" />
   565     </target>
   673     </target>
   566 
   674 
   567 
   675 
   568     <!-- Zips the trace rom content -->
   676     <!-- Zips the trace rom content -->
   569     <target name="zip-trace-roms" unless="skip-zips">
   677     <target name="zip-trace-roms" if="internal.archiving.enabled">
   570         <hlm:zipContentMacro type="trace_roms" file="${zip.config.file}" />
   678         <hlm:zipContentMacro type="trace_roms" file="${zip.config.file}" />
   571     </target>
   679     </target>
   572 
   680 
       
   681     
   573     <!-- Publishes the content defined by the filesets at the top of this project.
   682     <!-- Publishes the content defined by the filesets at the top of this project.
   574     
   683     
   575     The files are split into 4 filesets to parallelize the publish operation:
   684     The files are split into 4 filesets to parallelize the publish operation:
   576     
   685     
   577     * publish.files1
   686     * publish.files1
   579     * publish.files3
   688     * publish.files3
   580     * publish.files4
   689     * publish.files4
   581     
   690     
   582     All content is copied to the location defined by publish.dir. Also verify the source and target content after publish.
   691     All content is copied to the location defined by publish.dir. Also verify the source and target content after publish.
   583     -->
   692     -->
   584     <target name="publish" depends="prep-publish" if="publish">
   693     <target name="publish" depends="prep-publish" if="internal.publish.enabled">
   585         <hlm:publishMacro />
   694         <hlm:publishMacro />
   586         <resourcecount property="total.changes.in.fileset">
   695         <!--<resourcecount property="total.changes.in.fileset">
   587             <fileset id="publish.files.location" dir="${build.output.dir}">
   696             <fileset id="publish.files.location" dir="${build.output.dir}">
   588                 <exclude name="logs/**/*_ant_build.log" />
   697                 <exclude name="logs/**/*_ant_build.log" />
   589                 <exclude name="*" />
   698                 <exclude name="*" />
   590                 <exclude name="build/**/*" />
   699                 <exclude name="build/**/*" />
   591                 <exclude name="ec/**/*" />
   700                 <exclude name="ec/**/*" />
   600             </not>
   709             </not>
   601             <then>
   710             <then>
   602                 <echo message="ERROR: There are ${total.changes.in.fileset} changes in the publish directory. Uploading the changes again..." />
   711                 <echo message="ERROR: There are ${total.changes.in.fileset} changes in the publish directory. Uploading the changes again..." />
   603                 <hlm:publishMacro />
   712                 <hlm:publishMacro />
   604             </then>
   713             </then>
   605         </if>
   714         </if>-->
   606     </target>
   715     </target>
   607 
   716 
   608 
   717 
   609     <!-- Basic publish target that publishes all important content. -->
   718     <!-- Basic publish target that publishes all important content. -->
   610     <target name="publish-generic" depends="prep-publish,publish-tools" if="publish">
   719     <target name="publish-generic" depends="prep-publish,publish-tools" if="internal.publish.enabled">
   611         <hlm:publishMacro />
   720         <hlm:publishMacro />
   612     </target>
   721     </target>
   613 
   722 
   614 
   723 
   615     <!-- Publishes tools needed to run commands from a published build area. -->
   724     <!-- Publishes tools needed to run commands from a published build area. -->
   616     <target name="publish-tools" depends="prep-publish" if="publish">
   725     <target name="publish-tools" depends="prep-publish" if="internal.publish.enabled">
   617         <echoproperties destfile="${publish.dir}/build_properties.txt">
   726         <echoproperties destfile="${publish.dir}/build_properties.txt">
   618             <propertyset>
   727             <propertyset>
   619                 <propertyref name="publish.dir" />
   728                 <propertyref name="publish.dir" />
   620                 <propertyref name="publish.release.dir" />
   729                 <propertyref name="publish.release.dir" />
   621             </propertyset>
   730             </propertyset>
   628         </copy>
   737         </copy>
   629     </target>
   738     </target>
   630 
   739 
   631 
   740 
   632     <!-- The same as a basic publish. -->
   741     <!-- The same as a basic publish. -->
   633     <target name="publish-variants" depends="prep-publish" if="publish">
   742     <target name="publish-variants" depends="prep-publish" if="internal.publish.enabled">
   634         <hlm:publishMacro />
   743         <hlm:publishMacro />
   635     </target>
   744     </target>
   636 
   745 
   637 
   746 
   638     <!-- Notifies the lxr indexing engine that the build area is ready to be indexed. -->
   747     <!-- Notifies the lxr indexing engine that the build area is ready to be indexed. -->
   639     <target name="lxr">
   748     <target name="lxr">
   640         <copy todir="${lxr.publish.dir}" preservelastmodified="true" failonerror="false" flatten="true">
   749         <copy todir="${lxr.publish.dir}" preservelastmodified="true" failonerror="false" flatten="true">
   641             <fileset refid="publish.files" />
   750             <fileset refid="publish.files" />
   642         </copy>
   751         </copy>
   643         <echo file="${lxr.publish.dir}\${build.id}_ready.txt" />
   752         <echo file="${lxr.publish.dir}\${build.id}_ready.txt" />
   644     </target>
       
   645 
       
   646 
       
   647     <!-- Mails the Diamonds XML data to the Diamonds server account. -->
       
   648     <target name="mail-log-to-diamonds">
       
   649         <runtarget target="lookup-email" />
       
   650         <echo message="Sending XML log through email." />
       
   651         <!--Ant mail task can not include xml as msg body. so do it in python-->
       
   652         <!-- TODO - would this work by using a <message> subelement? -->
       
   653         <hlm:python>
       
   654 import sys, smtplib, string
       
   655             
       
   656 fromaddr = r'${email.from}'
       
   657 toaddrs  = r'${diamonds.mail}'
       
   658 smtpserver  = r'${email.smtp.server}'
       
   659 subject  = "[DIAMONDS_DATA] ${build.id}>>>${diamonds.host}>>>${diamonds.path}"
       
   660 file = open(r'${diamonds.log.file}', 'r')
       
   661 msg = file.read()
       
   662 body = string.join(("From: %s" %fromaddr, "To: %s" %toaddrs, "Subject: %s" %subject, "", msg), "\r\n")
       
   663 try:
       
   664     server = smtplib.SMTP(smtpserver)
       
   665     server.sendmail(fromaddr, toaddrs, body)
       
   666     server.quit()
       
   667     print "Mail sent to " , toaddrs
       
   668 except Exception:
       
   669     print "SMTP server " + smtpserver + " unavailable!! Unable to send log to " , toaddrs
       
   670     
       
   671         </hlm:python>
       
   672     </target>
   753     </target>
   673 
   754 
   674     <!-- Reports on the status of the build, through other targets. -->
   755     <!-- Reports on the status of the build, through other targets. -->
   675     <target name="report" depends="binary-sizes-log"/>
   756     <target name="report" depends="binary-sizes-log"/>
   676 
   757 
   753         </hlm:python>
   834         </hlm:python>
   754 
   835 
   755         <antcall target="post-build-md5" />
   836         <antcall target="post-build-md5" />
   756     </target>
   837     </target>
   757 
   838 
       
   839     
   758     <!-- Generate a list of checksums for all files in the build area using EC system. @scope private-->
   840     <!-- Generate a list of checksums for all files in the build area using EC system. @scope private-->
   759     <target name="build-md5-ec" depends="pre-build-md5">
   841     <target name="build-md5-ec" depends="pre-build-md5">
   760         <mkdir dir="${delta.zip.location}" />
   842         <mkdir dir="${delta.zip.location}" />
   761         <echo>delta.zip.temp.location: ${delta.zip.temp.location}</echo>
   843         <echo>delta.zip.temp.location: ${delta.zip.temp.location}</echo>
   762         <hlm:python failonerror="true">
   844         <hlm:python failonerror="true">
   827             <arg value="${release.grace.service}/${release.grace.product}/${old.release.label}" />
   909             <arg value="${release.grace.service}/${release.grace.product}/${old.release.label}" />
   828         </exec>
   910         </exec>
   829 
   911 
   830         <move file="${delta.zip.temp.location}/specialInstructions.xml" tofile="${delta.zip.delete.file}" />
   912         <move file="${delta.zip.temp.location}/specialInstructions.xml" tofile="${delta.zip.delete.file}" />
   831         <move file="${delta.zip.temp.location}/${build.id}.md5" tofile="${md5.signature.file}" />
   913         <move file="${delta.zip.temp.location}/${build.id}.md5" tofile="${md5.signature.file}" />
   832 
       
   833     </target>
   914     </target>
   834 
   915 
   835 
   916 
   836     <!-- Set prop old.md5.file to md5 file from last build in publish dir -->
   917     <!-- Set prop old.md5.file to md5 file from last build in publish dir -->
   837     <target name="delta-use-last-build">
   918     <target name="delta-use-last-build">
   883         <antcall target="grace-upload">
   964         <antcall target="grace-upload">
   884             <reference refid="grace.delta.zips.id" torefid="release.zips" />
   965             <reference refid="grace.delta.zips.id" torefid="release.zips" />
   885         </antcall>
   966         </antcall>
   886     </target>
   967     </target>
   887 
   968 
       
   969     
   888     <!-- Publishes the Ant build log.
   970     <!-- Publishes the Ant build log.
   889         
   971         
   890     First the logging should be stopped, before the file is copied. Hence this target should be called
   972     First the logging should be stopped, before the file is copied. Hence this target should be called
   891     by the "final" target last.
   973     by the "final" target last.
   892     -->
   974     -->
   893     <target name="publish-build-log" depends="prep-publish" if="publish">
   975     <target name="publish-build-log" depends="prep-publish" if="internal.publish.enabled">
   894         <copy todir="${publish.dir}/logs" preservelastmodified="true" failonerror="false">
   976         <copy todir="${publish.dir}/logs" preservelastmodified="true" failonerror="false">
   895             <fileset dir="${build.log.dir}" includes="**/*.log" />
   977             <fileset dir="${build.log.dir}" includes="**/*.log" />
   896         </copy>
   978         </copy>
   897     </target>
   979     </target>
   898 
   980 
       
   981     
   899     <!-- Copy the debug log to the build area if available-->
   982     <!-- Copy the debug log to the build area if available-->
   900     <target name="copy-debug-logs">
   983     <target name="copy-debug-logs">
   901         <echo message="log4j.dir:${log4j.cache.dir}" /> 
   984         <echo message="log4j.dir:${log4j.cache.dir}" /> 
   902         <if>
   985         <if>
   903             <available file="${log4j.cache.dir}" />
   986             <available file="${log4j.cache.dir}" />
   907                 </copy>
   990                 </copy>
   908             </then>
   991             </then>
   909         </if>
   992         </if>
   910     </target>
   993     </target>
   911 
   994 
       
   995     
   912     <!-- Target to simulate that the build is failed because of processing
   996     <!-- Target to simulate that the build is failed because of processing
   913     ant output
   997     ant output
   914     -->
   998     -->
   915     <target name="raise-error">
   999     <target name="raise-error">
   916         <echo message="ERROR: Build failed due to exceptions" />
  1000         <echo message="ERROR: Build failed due to exceptions" />
   917     </target>
  1001     </target>
       
  1002     
   918 
  1003 
   919     <!-- Update the build status by processing the ant build output log -->
  1004     <!-- Update the build status by processing the ant build output log -->
   920     <target name="build-status">
  1005     <target name="build-status">
   921         <hlm:metadatarecord database="${metadata.dbfile}">
  1006         <hlm:metadatarecord database="${metadata.dbfile}">
   922             <hlm:antmetadatainput>
  1007             <hlm:antmetadatainput>
   926         </hlm:metadatarecord>
  1011         </hlm:metadatarecord>
   927 
  1012 
   928         <hlm:signalMacro logfile="${build.log}" 
  1013         <hlm:signalMacro logfile="${build.log}" 
   929             signal.input="exceptionSignalInput" />
  1014             signal.input="exceptionSignalInput" />
   930     </target>
  1015     </target>
       
  1016     
       
  1017     
       
  1018     <property name="ExecListener.file" value="${build.cache.log.dir}/${build.id}_executables.csv"/>
       
  1019     
       
  1020     <!-- Logs details about the tools used in the environment.
       
  1021         
       
  1022     This includes name, path, version. -->
       
  1023     <target name="log-environment">
       
  1024         <hlm:environment output="${build.log.dir}/${build.id}_environment.xml">
       
  1025             <hlm:envdata refid="helium.tools.envdata"/>
       
  1026         </hlm:environment>
       
  1027     </target>
       
  1028     
   931 
  1029 
   932     <!-- Exception handler to process the ant output log -->
  1030     <!-- Exception handler to process the ant output log -->
   933     <target name="hlm-exception-handler">
  1031     <target name="hlm-exception-handler">
   934         <if>
  1032         <if>
   935             <available file="${build.log}"/>
  1033             <available file="${build.log}"/>
   937                 <runtarget target="do-exception-handler" />
  1035                 <runtarget target="do-exception-handler" />
   938             </then>
  1036             </then>
   939         </if>
  1037         </if>
   940     </target>
  1038     </target>
   941 
  1039 
       
  1040     
   942     <target name="do-exception-handler" depends="raise-error, build-status, build-log-summary, copy-debug-logs, publish-build-log" />
  1041     <target name="do-exception-handler" depends="raise-error, build-status, build-log-summary, copy-debug-logs, publish-build-log" />
   943 
  1042 
       
  1043     
   944     <!-- Does any wrap-up at the end of the build. This should be the last target for every top-level target. -->
  1044     <!-- Does any wrap-up at the end of the build. This should be the last target for every top-level target. -->
   945     <target name="final" depends="build-status, build-log-summary, copy-debug-logs, publish-build-log" />
  1045     <target name="final" depends="build-status, build-log-summary, copy-debug-logs, publish-build-log, log-environment" />
       
  1046     
   946     
  1047     
   947     <!-- This target will zip the WA depending on the ado mapping file -->
  1048     <!-- This target will zip the WA depending on the ado mapping file -->
   948     <target name="zip-wa" depends="ido-create-ado-mapping" if="zip.wa">
  1049     <target name="zip-wa" depends="ido-create-ado-mapping" if="internal.archive.wa.enabled">
   949         <tempfile property="zipwa.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/>
  1050         <tempfile property="zipwa.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/>
   950         <fmpp sourceFile="${helium.dir}/tools/common/templates/ido/zip-ant-wa-copy.xml.ftl" outputFile="${zipwa.dynamic.config}">
  1051         <fmpp sourceFile="${helium.dir}/tools/common/templates/ido/zip-ant-wa-copy.xml.ftl" outputFile="${zipwa.dynamic.config}">
   951             <data expandProperties="yes">
  1052             <data expandProperties="yes">
   952                 inputfile: antProperty(ado.mapping.file)
  1053                 inputfile: antProperty(ado.mapping.file)
   953                 ant: antProperties()
  1054                 ant: antProperties()