buildframework/helium/tools/preparation/ido-prep.ant.xml
changeset 645 b8d81fa19e7d
parent 628 7c4a911dc066
equal deleted inserted replaced
643:27cf35f95864 645:b8d81fa19e7d
    28          * Codescanner integration
    28          * Codescanner integration
    29          * Cenrep generation (old way)
    29          * Cenrep generation (old way)
    30          * IBY export (old way)
    30          * IBY export (old way)
    31     </description>
    31     </description>
    32         
    32         
    33     <!-- Path to a INI file that contains the mapping between the ADO from Synergy WA and it's location on the BA.
    33     <!-- Path to the cenrep root. Default value is "${build.drive}/epoc32/tools/cenrep/ido/src"
    34     @type string
    34     @type string
    35     @scope private
    35     @scope private
    36     -->
    36     -->
    37     <property name="ado.mapping.file" location="${build.output.dir}/build/ado_mapping.ini"/>
    37     <property name="ido.cenrep.root" location="${build.drive}/epoc32/tools/cenrep/ido/src"  />
       
    38     <!-- Path to the cenrep target directory. Default value is "${build.drive}/epoc32/data/z/private/10202be9"
       
    39     @type string
       
    40     @scope private
       
    41     -->
       
    42     <property name="ido.cenrep.target" value="${build.drive}/epoc32/data/z/private/10202be9"  />
       
    43     <!-- Defines the location of Codescanner output.
       
    44     @type string
       
    45     -->
       
    46     <property name="ido.codescanner.output.dir" location="${build.output.dir}/${build.id}_codescanner"/>
       
    47 
       
    48     <!-- Defines the location of CMT++ output and the input for the diamonds creation target.
       
    49     @type string
       
    50     -->
       
    51     <property name="ido.cmt.html.output.dir" location="${build.log.dir}/${build.id}_cmt"/>
       
    52     
       
    53     <!--* @property package.cone.validation.enabled
       
    54     Enables to run confml file validation.
       
    55     @type boolean
       
    56     @editable required
       
    57     @scope public
       
    58     @since 11.0
       
    59     -->
       
    60     
       
    61     <!--* @property internal.package.cone.validation.enabled
       
    62     Enables the targets to run confml file validation if package.cone.validation.enabled set to true.
       
    63     @type boolean
       
    64     @scope private
       
    65     -->
       
    66 
    38     <!-- Path to a INI file that contains the mapping between the ADO from Synergy WA and it's location on the BA for quality targets.
    67     <!-- Path to a INI file that contains the mapping between the ADO from Synergy WA and it's location on the BA for quality targets.
    39     @type string
    68     @type string
    40     @scope private
    69     @scope private
    41     -->
    70     @deprecated since 12.0 Not used, ido-create-ado-mapping is not used, it is replaced with macro createAdoMappingMacro.
    42     <property name="ado.quality.mapping.file" location="${build.output.dir}/build/ado_quality_mapping.ini"/>
    71     -->
    43     <!-- Path to the build romtree; the location contains iby files. Default value is "${build.drive}${env.EPOCROOT}/epoc32/rom/include"
    72     <property name="ado.mapping.file" location="${build.output.dir}/build/ado_mapping.ini"/>
       
    73 
       
    74     <!-- Path to a INI file that contains the quality mapping between the ADO from Synergy WA and it's location on the BA for quality targets.
    44     @type string
    75     @type string
    45     @scope private
    76     @scope private
    46     -->
    77     @deprecated since 12.0 Not used, ido-create-ado-mapping is not used, it is replaced with macro createAdoMappingMacro.
    47     <property name="ido.romtree" location="${build.drive}${env.EPOCROOT}/epoc32/rom/include"  />
    78     -->
    48     <!-- Path to the cenrep root. Default value is "${build.drive}${env.EPOCROOT}/epoc32/tools/cenrep/ido/src"
    79     <property name="ado.quality.mapping.file" location="${build.output.dir}/build/ado_quality_mapping.ini"/>
       
    80 
       
    81     <!-- Path to the build romtree; the location contains iby files. Default value is "${build.drive}${env.EPOCROOT}/epoc32/rom/include"
       
    82     deprecated: Not used, ido-create-ado-mapping is not used, it is replaced with macro createAdoMappingMacro.
    49     @type string
    83     @type string
    50     @scope private
    84     @scope private
    51     -->
    85     @deprecated 12.0 since Not used, ido-create-ado-mapping is not used, it is replaced with macro createAdoMappingMacro.
    52     <property name="ido.cenrep.root" location="${build.drive}${env.EPOCROOT}/epoc32/tools/cenrep/ido/src"  />
       
    53     <!-- Path to the cenrep target directory. Default value is "${build.drive}${env.EPOCROOT}/epoc32/data/z/private/10202be9"
       
    54     @type string
       
    55     @scope private
       
    56     -->
       
    57     <property name="ido.cenrep.target" value="${build.drive}${env.EPOCROOT}/epoc32/data/z/private/10202be9"  />
       
    58     <!-- Defines the location of Codescanner output.
       
    59     @type string
       
    60     -->
       
    61     <property name="ido.codescanner.output.dir" location="${build.output.dir}/${build.id}_codescanner"/>
       
    62 
       
    63     <!-- Defines the location of CMT++ output and the input for the diamonds creation target.
       
    64     @type string
       
    65     -->
       
    66     <property name="ido.cmt.html.output.dir" location="${build.log.dir}/${build.id}_cmt"/>
       
    67     
       
    68     <!--* @property package.cone.validation.enabled
       
    69     Enables to run confml file validation.
       
    70     @type boolean
       
    71     @editable required
       
    72     @scope public
       
    73     @since 11.0
       
    74     -->
       
    75     
       
    76     <!--* @property internal.package.cone.validation.enabled
       
    77     Enables the targets to run confml file validation if package.cone.validation.enabled set to true.
       
    78     @type boolean
       
    79     @scope private
       
    80     -->
    86     -->
    81     
    87     
    82     <!--* @property cmt.enabled
    88     <!--* @property cmt.enabled
    83     Enables to run cmt, testing code coverage tool.
    89     Enables to run cmt, testing code coverage tool.
    84     @type boolean
    90     @type boolean
   107     @scope public
   113     @scope public
   108     @since 11.0
   114     @since 11.0
   109     -->
   115     -->
   110     <property name="codescanner.enabled" value="true"/>
   116     <property name="codescanner.enabled" value="true"/>
   111 
   117 
       
   118     <!--* @property codescanner.lxr.source.url
       
   119     Enables source files referring to lxr url path in codescanner output html files. Should not include source path on platform.
       
   120     @type string
       
   121     @scope public
       
   122     @since 12.0
       
   123     -->
   112     
   124     
   113     <!--* @property internal.codescanner.enabled
   125     <!--* @property internal.codescanner.enabled
   114     Enables codescanner targets to run if codescanner.enabled is set to true.
   126     Enables codescanner targets to run if codescanner.enabled is set to true.
   115     @type boolean
   127     @type boolean
   116     @scope private
   128     @scope private
   182             <not>
   194             <not>
   183                 <isset property="skip.codescanner"/>
   195                 <isset property="skip.codescanner"/>
   184             </not>
   196             </not>
   185         </and>
   197         </and>
   186     </condition>
   198     </condition>
   187     
   199 
       
   200     <!--
       
   201     @deprecated: since 12.0: Use createAdoMappingMacro  
       
   202      -->
   188     <target name="ido-create-ado-mapping">
   203     <target name="ido-create-ado-mapping">
   189         <mkdir dir="${build.output.dir}/build"/>
   204         <hlm:createAdoMappingMacro adoMapFile="${ado.mapping.file}" />
   190         <mkdir dir="${temp.build.dir}"/>
   205         <hlm:createAdoMappingMacro adoMapFile="${ado.quality.mapping.file}" mapForQuality="true"/>
   191         <if>
   206     </target>
   192             <istrue value="${sysdef3.enabled}" />
   207 
   193             <then>
   208     <!-- Internal target to generate ado mapping for old sysdef format, this would be deprecated once
   194                 <hlm:createPackageMapping epocroot="${build.drive}" destFile="${ado.mapping.file}">
   209          the sysdef3 is deployed. 
   195                     <path refid="system.definition.files" />
   210     -->
   196                 </hlm:createPackageMapping>
   211     <scriptdef name="adoMappingOldSysdefMacro" language="jython" uri="http://www.nokia.com/helium">
   197                 <if>
   212         <attribute name="adomapfile" />
   198                     <isreference refid="ado.quality.dirs" />
   213         <attribute name="mapforquality" />
   199                     <then>
   214 import os
   200                         <hlm:createPackageMapping epocroot="${build.drive}" destFile="${ado.quality.mapping.file}"
       
   201                             filterDirSet="ado.quality.dirs" >
       
   202                             <path refid="system.definition.files" />
       
   203                         </hlm:createPackageMapping>
       
   204                     </then>
       
   205                     <else>
       
   206                         <copy file="${ado.mapping.file}" tofile="${ado.quality.mapping.file}" overwrite="true" />
       
   207                     </else>
       
   208                 </if>
       
   209             </then>
       
   210             <else>
       
   211                 <tempfile property="prep.dynamic.sysdef.config" suffix=".txt" deleteonexit="false" destdir="${temp.build.dir}"/>
       
   212                 <trycatch property="error.message">
       
   213                     <try>
       
   214                         <hlm:referenceToFileMacro refid="system.definition.files" output="${prep.dynamic.sysdef.config}"/>
       
   215                     </try>
       
   216                     <catch>       
       
   217                         <propertyregex property="message" input="${error.message}"
       
   218                           regexp=":(.*)$"
       
   219                           select="\1" casesensitive="false" />
       
   220                         <fail message="Error: ${message}" />     
       
   221                     </catch>               
       
   222                 </trycatch>
       
   223                 <trycatch>
       
   224                     <try>
       
   225                         <pathconvert pathsep="," property="ado.quality.dirs.path">
       
   226                             <dirset refid="ado.quality.dirs"/>
       
   227                         </pathconvert>                              
       
   228                     </try>
       
   229                 </trycatch>
       
   230                 <script language="jython" setbeans="false">
       
   231 import idoprep
   215 import idoprep
   232 idoprep.create_ado_mapping(project.getProperty(r"prep.dynamic.sysdef.config"), project.getProperty(r"ado.mapping.file"), project.getProperty(r"ado.quality.mapping.file"), project.getProperty(r"build.drive"), project.getProperty("ado.quality.dirs.path"))
   216 idoprep.create_ado_mapping(project.getProperty(r"prep.dynamic.sysdef.config"), attributes.get(r"adomapfile"), attributes.get(r"mapforquality"), project.getProperty(r"build.drive"), project.getProperty(r"ado.quality.dirs.path"))
   233                 </script>
   217     </scriptdef>
   234             </else>
   218 
   235         </if>
   219     <!-- Generates ado mapping file which could be used to identify the new sources. 
   236     </target>
   220         e.g: 
   237     
   221         <pre>
       
   222             <property name="prep.copy.mapping.file" location="${build.output.dir}/build/ado_mapping_copy.ini" />
       
   223             <hlm:createAdoMappingMacro adoMapFile="${prep.copy.mapping.file}" />
       
   224         </pre>
       
   225 
       
   226     Usage example:
       
   227     <pre>
       
   228         <target name="ido-map-file">
       
   229             <property name="prep.copy.mapping.file" location="${build.output.dir}/build/ado_mapping_copy.ini" />
       
   230             <hlm:createAdoMappingMacro adoMapFile="${prep.copy.mapping.file}" />
       
   231         </target>
       
   232     </pre>
       
   233     -->
       
   234     <macrodef name="createAdoMappingMacro" uri="http://www.nokia.com/helium">
       
   235         <attribute name="adoMapFile"/>
       
   236         <attribute name="mapForQuality" default="false"/>
       
   237         <sequential>
       
   238             <mkdir dir="${build.output.dir}/build"/>
       
   239             <mkdir dir="${temp.build.dir}"/>
       
   240             <if>
       
   241                 <istrue value="${sysdef3.enabled}" />
       
   242                 <then>
       
   243                     <if>
       
   244                         <and>
       
   245                             <isreference refid="ado.quality.dirs" />
       
   246                             <equals arg1="@{mapForQuality}" arg2="true" />
       
   247                         </and>
       
   248                         <then>
       
   249                             <hlm:createPackageMapping epocroot="${build.drive}" destFile="@{adoMapFile}"
       
   250                                 filterDirSet="ado.quality.dirs" >
       
   251                                 <path refid="system.definition.files" />
       
   252                             </hlm:createPackageMapping>
       
   253                         </then>
       
   254                         <else>
       
   255                             <hlm:createPackageMapping epocroot="${build.drive}" destFile="@{adoMapFile}">
       
   256                                 <path refid="system.definition.files" />
       
   257                             </hlm:createPackageMapping>
       
   258                         </else>
       
   259                     </if>
       
   260                 </then>
       
   261                 <else>
       
   262                     <tempfile property="prep.dynamic.sysdef.config" suffix=".txt" deleteonexit="false" destdir="${temp.build.dir}"/>
       
   263                     <trycatch property="error.message">
       
   264                         <try>
       
   265                             <hlm:referenceToFileMacro refid="system.definition.files" output="${prep.dynamic.sysdef.config}"/>
       
   266                         </try>
       
   267                         <catch>       
       
   268                             <propertyregex property="message" input="${error.message}"
       
   269                               regexp=":(.*)$"
       
   270                               select="\1" casesensitive="false" />
       
   271                             <fail message="Error: ${message}" />     
       
   272                         </catch>               
       
   273                     </trycatch>
       
   274                     <trycatch>
       
   275                         <try>
       
   276                             <pathconvert pathsep="," property="ado.quality.dirs.path">
       
   277                                 <dirset refid="ado.quality.dirs"/>
       
   278                             </pathconvert>                              
       
   279                         </try>
       
   280                     </trycatch>
       
   281                     <hlm:adoMappingOldSysdefMacro adomapfile="@{adoMapFile}"  mapforquality="@{mapForQuality}" />
       
   282                 </else>
       
   283             </if>
       
   284         </sequential>
       
   285     </macrodef>
       
   286 
   238     <!-- Target to generate cenreps using cone tool -->
   287     <!-- Target to generate cenreps using cone tool -->
   239     <target name="ido-gen-cenrep">
   288     <target name="ido-gen-cenrep">
   240         <mkdir dir="${post.log.dir}" />
   289         <mkdir dir="${post.log.dir}" />
   241         <mkdir dir="${temp.build.dir}" />
   290         <mkdir dir="${temp.build.dir}" />
   242         <tempfile property="cenrep.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/>
   291         <tempfile property="cenrep.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/>
   243         <fmpp sourceFile="${helium.dir}/tools/common/templates/ido/ido-cenrep-gen.xml.ftl"
   292         <fmpp sourceFile="${helium.dir}/tools/preparation/templates/ido-cenrep-gen.xml.ftl"
   244               outputfile="${cenrep.dynamic.config}">
   293               outputfile="${cenrep.dynamic.config}">
   245             <data expandProperties="yes">
   294             <data expandProperties="yes">
   246                 dbPath: ${metadata.dbfile}
   295                 dbPath: ${metadata.dbfile}
   247                 ant: antProperties()
   296                 ant: antProperties()
   248                 os: eval('System.getProperty("os.name")')
   297                 os: eval('System.getProperty("os.name")')
   274     <!-- To validate confml files of packages.-->
   323     <!-- To validate confml files of packages.-->
   275     <target name="ido-validate-confml" if="internal.package.cone.validation.enabled">
   324     <target name="ido-validate-confml" if="internal.package.cone.validation.enabled">
   276         <mkdir dir="${post.log.dir}" />
   325         <mkdir dir="${post.log.dir}" />
   277         <mkdir dir="${temp.build.dir}" />
   326         <mkdir dir="${temp.build.dir}" />
   278         <tempfile property="confml.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/>
   327         <tempfile property="confml.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/>
   279         <fmpp sourceFile="${helium.dir}/tools/common/templates/ido/ido-confml-validate.ant.xml.ftl"
   328         <fmpp sourceFile="${helium.dir}/tools/preparation/templates/ido-confml-validate.ant.xml.ftl"
   280               outputfile="${confml.dynamic.config}">
   329               outputfile="${confml.dynamic.config}">
   281             <data expandProperties="yes">
   330             <data expandProperties="yes">
   282                 dbPath: ${metadata.dbfile}
   331                 dbPath: ${metadata.dbfile}
   283                 ant: antProperties()
   332                 ant: antProperties()
   284                 os: eval('System.getProperty("os.name")')
   333                 os: eval('System.getProperty("os.name")')
   315 
   364 
   316     <!--* Defines which template to use in order to achive the package copying.
   365     <!--* Defines which template to use in order to achive the package copying.
   317     @type string
   366     @type string
   318     @scope public
   367     @scope public
   319     -->
   368     -->
   320     <property name="ido.prep.copy.template" location="${helium.dir}/tools/common/templates/ido/ido-ant-copy.xml.ftl" />
   369     <property name="ido.prep.copy.template" location="${helium.dir}/tools/preparation/templates/ido-ant-copy.xml.ftl" />
   321     
   370     
   322     <!-- Target that uses the information from the system.definition.files to prepare the IDO build area.
   371     <!-- Target that uses the information from the system.definition.files to prepare the IDO build area.
   323         It relies on the fact that layer_real_source_path entity is declared in each ADO configuration.
   372         It relies on the fact that layer_real_source_path entity is declared in each ADO configuration.
   324         
   373         
   325         By default it deletes the previous content. If you want to backup what was previoulsy used please
   374         By default it deletes the previous content. If you want to backup what was previoulsy used please
   326         defined '''keep.old.source.enabled''' property.         
   375         defined '''keep.old.source.enabled''' property.         
   327         -->
   376         -->
   328     <target name="ido-prep-copy" depends="ido-create-ado-mapping">
   377     <target name="ido-prep-copy">
       
   378         <property name="prep.copy.mapping.file" location="${build.output.dir}/build/ado_mapping_copy.ini" />
       
   379         <hlm:createAdoMappingMacro adoMapFile="${prep.copy.mapping.file}" />
   329         <mkdir dir="${temp.build.dir}"/>
   380         <mkdir dir="${temp.build.dir}"/>
   330         <tempfile property="prep.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/>
   381         <tempfile property="prep.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/>
   331         <fmpp sourceFile="${ido.prep.copy.template}"
   382         <fmpp sourceFile="${ido.prep.copy.template}"
   332             outputFile="${prep.dynamic.config}">
   383             outputFile="${prep.dynamic.config}">
   333             <data expandProperties="yes">
   384             <data expandProperties="yes">
   334                 inputfile: antProperty(ado.mapping.file)
   385                 inputfile: antProperty(prep.copy.mapping.file)
   335                 ant: antProperties()
   386                 ant: antProperties()
   336                     data: eval('
   387                     data: eval('
   337                             java.io.FileInputStream pin = new java.io.FileInputStream(filename);
   388                             java.io.FileInputStream pin = new java.io.FileInputStream(filename);
   338                             java.util.Properties props = new java.util.Properties();
   389                             java.util.Properties props = new java.util.Properties();
   339                             props.load(pin);
   390                             props.load(pin);
   345     </target>
   396     </target>
   346     
   397     
   347     
   398     
   348     <!--
   399     <!--
   349     Run cleanup system definition configuration. The configuration name are
   400     Run cleanup system definition configuration. The configuration name are
   350     generated from the '''sysdef.configurations.list''' property, appending '_clean'
   401     generated from the ``sysdef.configurations.list`` property, appending '_clean'
   351     at the end of each configuration also reversing their build order.
   402     at the end of each configuration also reversing their build order.
   352     if '''sysdef.clean.configurations.list''' is defined it overrides
   403     if ``sysdef.clean.configurations.list`` is defined it overrides
   353     the previous beharvious and is used to cleanup the environment.
   404     the previous beharvious and is used to cleanup the environment.
   354     -->
   405     -->
   355     <target name ="ido-prep-clean">
   406     <target name ="ido-prep-clean">
   356         <if>
   407         <if>
   357             <not>
   408             <not>
   362                     <isset property="sysdef.configurations.list"/>
   413                     <isset property="sysdef.configurations.list"/>
   363                     <then>
   414                     <then>
   364                         <script language="jython" setbeans="false">
   415                         <script language="jython" setbeans="false">
   365 rev_names = ""
   416 rev_names = ""
   366 for sysdef in project.getProperty("sysdef.configurations.list").split(","):    
   417 for sysdef in project.getProperty("sysdef.configurations.list").split(","):    
   367     rev_names = sysdef + "_clean," + rev_names;
   418     rev_names = sysdef + "_clean," + rev_names
   368 project.setProperty("sysdef.clean.configurations.list", rev_names)
   419 project.setProperty("sysdef.clean.configurations.list", rev_names)
   369                         </script>
   420                         </script>
   370                     </then>
   421                     </then>
   371                     <else>
   422                     <else>
   372                         <fail message="You should either define sysdef.clean.configurations.list or sysdef.configurations.list."/>
   423                         <fail message="You should either define sysdef.clean.configurations.list or sysdef.configurations.list."/>
   383         </antcall>
   434         </antcall>
   384     </target>
   435     </target>
   385 
   436 
   386     <!--
   437     <!--
   387         This targets run the codescanner application on each discovered ADO.
   438         This targets run the codescanner application on each discovered ADO.
   388         The location of the output is defined byt '''ido.codescanner.output.dir''' property.
   439         The location of the output is defined byt ``ido.codescanner.output.dir`` property.
   389         And the type is defined by '''ido.codescanner.output.type''' (default is HTML). 
   440         And the type is defined by ``ido.codescanner.output.type`` (default is HTML). 
   390     -->
   441         To update the HTML files with lxr source URL you need to set the property ``codescanner.lxr.source.url`` 
   391     <target name="ido-codescanner" depends="ido-create-ado-mapping" if="internal.codescanner.enabled">
   442         URL should not include source path on platform.
   392         
   443     -->
   393         <!--hlm:iniKeys2Path ini="${ado.mapping.file}" pathid="ado.src.path"/-->
   444     <target name="ido-codescanner" if="internal.codescanner.enabled">
       
   445         <property name="codescanner.mapping.file" location="${build.output.dir}/build/ado_mapping_codescanner.ini" />
       
   446         <hlm:createAdoMappingMacro adoMapFile="${codescanner.mapping.file}" mapForQuality="true"/>
       
   447         <!--hlm:iniKeys2Path ini="${codescanner.mapping.file}" pathid="ado.src.path"/-->
   394         <!-- Defines the format of Codescanner output (html|xml|std).
   448         <!-- Defines the format of Codescanner output (html|xml|std).
   395         @type string
   449         @type string
   396         -->
   450         -->
   397         <property name="ido.codescanner.output.type" value="html"/>
   451         <hlm:resourceaccess lockName="subst-drive">
   398         <script language="jython" setbeans="false">
   452             <property name="ido.codescanner.output.type" value="html"/>
   399 """ internal.codescanner.drive """
   453             
       
   454             <!-- Defines the fmpp template for Codescanner.
       
   455             @type string
       
   456             @scope private
       
   457             -->
       
   458             <property name="ido.codescanner.template" value="${helium.dir}/tools/preparation/templates/ido-codescanner.ant.xml.ftl"/>
       
   459             <script language="jython" setbeans="false">
       
   460 #internal.codescanner.drive
   400 import os
   461 import os
   401 import fileutils
   462 import fileutils
   402 import configuration
   463 import configuration
   403 import pathaddition.relative
   464 import pathaddition.relative
   404 
   465 
   405 config = configuration.PropertiesConfiguration(stream=open(str(project.getProperty("ado.quality.mapping.file")), 'r'))
   466 config = configuration.PropertiesConfiguration(stream=open(str(project.getProperty("codescanner.mapping.file")), 'r'))
   406 prefix = pathaddition.relative.commonprefix(config.keys())
   467 prefix = pathaddition.relative.commonprefix(config.keys())
   407 if not os.path.exists(prefix):
   468 if not os.path.exists(prefix):
   408     raise Exception("Could not find common prefix for the following paths:\n" + "\n".join(config.keys()))
   469     raise Exception("Could not find common prefix for the following paths:\n" + "\n".join(config.keys()))
   409 if os.sep == '\\':
   470 if os.sep == '\\':
   410     self.log(str('Substing %s' % prefix))
   471     self.log(str('Substing %s' % prefix))
   421     location = drive + os.sep + pathaddition.relative.abs2rel(location, prefix)
   482     location = drive + os.sep + pathaddition.relative.abs2rel(location, prefix)
   422     self.log(str("To %s" % location))
   483     self.log(str("To %s" % location))
   423     pe = path.createPathElement()
   484     pe = path.createPathElement()
   424     pe.setPath(location)
   485     pe.setPath(location)
   425 project.addReference('substed.ado.src.path', path)
   486 project.addReference('substed.ado.src.path', path)
   426         </script>
   487             </script>
       
   488         </hlm:resourceaccess>
   427         <trycatch property="codescanner.thrown">
   489         <trycatch property="codescanner.thrown">
   428             <try>
   490             <try>
   429                 <hlm:codescanner dest="${ido.codescanner.output.dir}"
   491                 <if>
   430                     format="${ido.codescanner.output.type}"
   492                     <isset property="codescanner.lxr.source.url"/>
   431                     configuration="${ido.codescanner.config}">
   493                     <then>
   432                     <path refid="substed.ado.src.path"/>
   494                         <tempfile property="codescanner.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/>
   433                 </hlm:codescanner>
   495                         <fmpp sourceFile="${ido.codescanner.template}"
       
   496                             outputFile="${codescanner.dynamic.config}">
       
   497                             <data expandProperties="yes">
       
   498                                 inputfile: antProperty(codescanner.mapping.file)
       
   499                                 ant: antProperties()
       
   500                                 data: eval('
       
   501                                         java.io.FileInputStream pin = new java.io.FileInputStream(filename);
       
   502                                         java.util.Properties props = new java.util.Properties();
       
   503                                         props.load(pin);
       
   504                                         return props;
       
   505                                         ', {filename:get(inputfile)})
       
   506                             </data>
       
   507                         </fmpp>
       
   508                         <ant antfile="${codescanner.dynamic.config}"/>
       
   509                     </then>
       
   510                     <else>
       
   511                         <hlm:codescanner dest="${ido.codescanner.output.dir}"
       
   512                             format="${ido.codescanner.output.type}"
       
   513                             configuration="${ido.codescanner.config}">
       
   514                             <path refid="substed.ado.src.path"/>
       
   515                         </hlm:codescanner>
       
   516                     </else>
       
   517                 </if>
   434             </try>
   518             </try>
   435             <catch>
   519             <catch>
   436                 <fail message="${codescanner.thrown}" />
   520                 <fail message="${codescanner.thrown}" />
   437             </catch>
   521             </catch>
   438             <finally>
   522             <finally>
   439                 <hlm:unsubst drive="${internal.codescanner.drive}"/>
   523                 <hlm:unsubst drive="${internal.codescanner.drive}"/>
   440             </finally>
   524             </finally>
   441         </trycatch>
   525         </trycatch>
       
   526         
   442     </target>
   527     </target>
   443 
   528 
   444         <!-- CMT Tool target. Complexity tool measures. Supported options for cmt tool macro is
   529         <!-- CMT Tool target. Complexity tool measures. Supported options for cmt tool macro is
   445         1. input - files to be measured
   530         1. input - files to be measured
   446         2. output - output xml file (file size is huge 68MB for JAVA IDO, if this needs to be send, need to consider
   531         2. output - output xml file (file size is huge 68MB for JAVA IDO, if this needs to be send, need to consider
   447         3. config - input config . 
   532         3. config - input config . 
   448         -->
   533         -->
   449     <target name="ido-cmt" depends="ido-create-ado-mapping" if="internal.cmt.enabled">
   534     <target name="ido-cmt" if="internal.cmt.enabled">
   450         
   535         <property name="cmt.mapping.file" location="${build.output.dir}/build/ado_mapping_cmt.ini" />
   451         <fmpp sourceFile="${helium.dir}/tools/common/templates/ido/ido-cmt-ant.xml.ftl"
   536         <hlm:createAdoMappingMacro adoMapFile="${cmt.mapping.file}" mapForQuality="true"/>
       
   537         <fmpp sourceFile="${helium.dir}/tools/preparation/templates/ido-cmt-ant.xml.ftl"
   452                           outputFile="${temp.build.dir}/ido-cmt.ant.xml">
   538                           outputFile="${temp.build.dir}/ido-cmt.ant.xml">
   453             <data expandProperties="yes">
   539             <data expandProperties="yes">
   454                         inputfile: antProperty(ado.quality.mapping.file)
   540                         inputfile: antProperty(cmt.mapping.file)
   455                         ant: antProperties()
   541                         ant: antProperties()
   456                             data: eval('
   542                             data: eval('
   457                                     java.io.FileInputStream pin = new java.io.FileInputStream(filename);
   543                                     java.io.FileInputStream pin = new java.io.FileInputStream(filename);
   458                                        java.util.Properties props = new java.util.Properties();
   544                                        java.util.Properties props = new java.util.Properties();
   459                                     props.load(pin);
   545                                     props.load(pin);
   490         <delete file="${temp.diamonds.header.xml}" failonerror="false" />
   576         <delete file="${temp.diamonds.header.xml}" failonerror="false" />
   491         <delete file="${temp.diamonds.footer.xml}" failonerror="false" />
   577         <delete file="${temp.diamonds.footer.xml}" failonerror="false" />
   492         
   578         
   493     </target>
   579     </target>
   494 
   580 
   495     <!-- Internal target that generates a temporary file that allow the 
   581     <!-- Target to copy files based on ado mapping.
   496     either export of iby or either key*.xls. The generated Ant build file
   582     -->
   497     contains two targets with copy insturctions and generic set of fileset rules.     
   583     <target name="ido-create-copy-file">
   498     -->
   584         <property name="create.copy.mapping.file" location="${build.output.dir}/build/ado_mapping_create_copy.ini" />
   499     <target name="ido-create-copy-file" depends="ido-create-ado-mapping">
   585         <hlm:createAdoMappingMacro adoMapFile="${create.copy.mapping.file}" />
   500         <tempfile property="copyfile.dynamic.config" suffix=".ant.xml" deleteonexit="false" destdir="${temp.build.dir}"/>
   586         <tempfile property="copyfile.dynamic.config" suffix=".ant.xml" deleteonexit="false" destdir="${temp.build.dir}"/>
   501         <fmpp sourceFile="${helium.dir}/tools/common/templates/ido/ido-export.ant.xml.ftl"
   587         <fmpp sourceFile="${helium.dir}/tools/preparation/templates/ido-export.ant.xml.ftl"
   502                       outputFile="${copyfile.dynamic.config}">
   588                       outputFile="${copyfile.dynamic.config}">
   503             <data expandProperties="yes">
   589             <data expandProperties="yes">
   504                 inputfile: antProperty(ado.mapping.file)
   590                 inputfile: antProperty(create.copy.mapping.file)
   505                 ant: antProperties()
   591                 ant: antProperties()
   506                 data: eval('
   592                 data: eval('
   507                             java.io.FileInputStream pin = new java.io.FileInputStream(filename);
   593                             java.io.FileInputStream pin = new java.io.FileInputStream(filename);
   508                                java.util.Properties props = new java.util.Properties();
   594                                java.util.Properties props = new java.util.Properties();
   509                             props.load(pin);
   595                             props.load(pin);
   548         </copy>    
   634         </copy>    
   549         
   635         
   550     </target>
   636     </target>
   551 
   637 
   552     <!-- Gets the contents from a network drive or Dragonfly -->
   638     <!-- Gets the contents from a network drive or Dragonfly -->
   553     <target name="ido-check-latest-release" depends="ido-check-latest-release-grace" unless="env.HLM_SUBCON">
   639     <target name="ido-check-latest-release" depends="ido-check-latest-release-network" unless="env.HLM_SUBCON">
   554         <runtarget target="ido-check-latest-release-dragonfly"/>
   640         <runtarget target="ido-check-latest-release-dragonfly"/>
   555     </target>
   641     </target>
       
   642 
       
   643     <!--* @property s60.grace.service
       
   644         File service to look into.
       
   645         @type string
       
   646         @editable required
       
   647         @scope public
       
   648         @deprecated since 12.0
       
   649     -->
       
   650     <!--* @property download.release.service
       
   651         File service to look into.
       
   652         @type string
       
   653         @editable required
       
   654         @scope public
       
   655     -->
       
   656     <condition property="download.release.service" value="${s60.grace.service}">
       
   657         <isset property="s60.grace.service" />
       
   658     </condition>
   556 
   659 
   557     <!--* @property s60.grace.server
   660     <!--* @property s60.grace.server
   558         UNC path to file server.
   661         UNC path to file server.
   559         @type string
   662         @type string
   560         @editable required
   663         @editable required
   561         @scope public
   664         @scope public
   562     -->
   665         @deprecated since 12.0
   563     <!--* @property s60.grace.service
   666     -->
   564         File service to look into.
   667     <!--* @property download.release.server
   565         @type string
   668         UNC path to file server.
   566         @editable required
   669         @type string
   567         @scope public
   670         @editable required
   568     -->
   671         @scope public
       
   672     -->
       
   673     <condition property="download.release.server" value="${s60.grace.server}">
       
   674         <isset property="s60.grace.server" />
       
   675     </condition>
       
   676     
   569     <!--* @property s60.grace.product
   677     <!--* @property s60.grace.product
   570         Product to look into.
   678         Product to look into.
   571         @type string
   679         @type string
   572         @editable required
   680         @editable required
   573         @scope public
   681         @scope public
   574     -->
   682         @deprecated since 12.0
       
   683     -->
       
   684     <!--* @property download.release.product
       
   685         Product to look into.
       
   686         @type string
       
   687         @editable required
       
   688         @scope public
       
   689     -->
       
   690     <condition property="download.release.product" value="${s60.grace.product}">
       
   691         <isset property="s60.grace.product" />
       
   692     </condition>
       
   693     
   575     <!--* @property s60.grace.release
   694     <!--* @property s60.grace.release
   576         Regular expression to match a particular realease.
   695         Regular expression to match a particular realease.
   577         @type string
   696         @type string
   578         @editable required
   697         @editable required
   579         @scope public
   698         @scope public
   580     -->
   699         @deprecated since 12.0
   581     <!--* @property s60.grace.release.fixbuildregex
   700     -->
   582         Regular expression to match a particular release fixbuilds. Example _(.*?)$ or _(\d+)$ 
   701         
   583         @type string
   702     <!--* @property download.release.regex
   584         @editable required
   703         Regular expression to match a particular realease.
   585         @scope public
   704         @type string
   586     -->
   705         @editable required
       
   706         @scope public
       
   707     -->
       
   708     <condition property="download.release.regex" value="${s60.grace.release}">
       
   709         <isset property="s60.grace.release" />
       
   710     </condition>
       
   711     
       
   712     <!-- Regular expression to match a particular release fixbuilds. Example _(.*?)$ or _(\d+)$ 
       
   713         @type string
       
   714         @editable required
       
   715         @scope public
       
   716         @deprecated since 12.0
       
   717     -->
       
   718     <property name="s60.grace.release.fixbuildregex" value="_(.*?)$" />
       
   719     
       
   720     <!-- Regular expression to match a particular release fixbuilds. Example _(.*?)$ or _(\d+)$ 
       
   721         @type string
       
   722         @editable required
       
   723         @scope public
       
   724     -->
       
   725     <property name="download.release.fixbuildregex" value="${s60.grace.release.fixbuildregex}" />
       
   726     
   587     <!--* @property s60.grace.cache
   727     <!--* @property s60.grace.cache
   588         Location of the Grace result cache for a builder.
   728         Location of the result cache for a builder.
   589         @type string
   729         @type string
   590         @editable required
   730         @editable required
   591         @scope public
   731         @scope public
   592     -->
   732         @deprecated since 12.0
   593     <!--* @property s60.grace.checkmd5
   733     -->
   594         Enable MD5 validation for release metadata (default: false).
   734     <!--* @property download.release.cache
   595         @type boolean
   735         Location of the result cache for a builder.
   596         @editable required
   736         @type string
   597         @scope public
   737         @editable required
   598         @deprecate Since 11.0
   738         @scope public
   599     -->
   739     -->
       
   740     <condition property="download.release.cache" value="${s60.grace.cache}">
       
   741         <isset property="s60.grace.cache" />
       
   742     </condition>
   600     
   743     
   601     <!--* @property s60.grace.checkmd5.enabled
   744     <!--* @property s60.grace.checkmd5.enabled
   602         Enable MD5 validation for release metadata (default: false).
   745         Enable MD5 validation for release metadata (default: false).
   603         @type boolean
   746         @type boolean
   604         @editable required
   747         @editable required
   605         @scope public
   748         @scope public
   606     -->
   749         @deprecated since 12.0
   607     
   750     -->
   608     <!--* @property internal.s60.grace.checkmd5.enabled
   751     <!--* @property download.release.checkmd5.enabled
   609         set if s60.grace.checkmd5.enabled set to true.
   752         Enable MD5 validation for release metadata (default: false).
   610         @type boolean
   753         @type boolean
   611         @scope private
   754         @editable required
   612     -->
   755         @scope public
   613     
   756     -->
       
   757         
   614     <!--* @property s60.grace.revision
   758     <!--* @property s60.grace.revision
   615         Defined the regular expression to find a particular revision.
   759         Defined the regular expression to find a particular revision.
   616         @type string
   760         @type string
   617         @editable required
   761         @editable required
   618         @scope public
   762         @scope public
   619     -->
   763         @deprecated since 12.0
       
   764     -->
       
   765     <!--* @property download.release.revision
       
   766         Defined the regular expression to find a particular revision.
       
   767         @type string
       
   768         @editable required
       
   769         @scope public
       
   770     -->
       
   771     <condition property="download.release.revision" value="${s60.grace.revision}">
       
   772         <isset property="s60.grace.revision" />
       
   773     </condition>
       
   774     
   620     <!--* @property s60.grace.usetickler
   775     <!--* @property s60.grace.usetickler
   621         Enable the detection of ready release using release tickler mechanism.
   776         Enable the detection of ready release using release tickler mechanism.
   622         @type boolean
   777         @type boolean
   623         @editable required
   778         @editable required
   624         @scope public
   779         @scope public
   625     -->
   780         @deprecated since 12.0
   626     
   781     -->
   627     <!-- Check is the s60.grace.checkmd5.enabled is set -->
   782     <!--* @property download.release.usetickler
   628     <condition property="internal.s60.grace.checkmd5.enabled" else="false" value="true">
   783         Enable the detection of ready release using release tickler mechanism.
       
   784         @type string
       
   785         @editable required
       
   786         @scope public
       
   787     -->
       
   788     <condition property="download.release.usetickler" value="${s60.grace.usetickler}">
       
   789         <isset property="s60.grace.usetickler" />
       
   790     </condition>
       
   791     
       
   792     <condition property="internal.release.checkmd5.enabled" else="false" value="true">
   629         <or>
   793         <or>
   630             <istrue value="${s60.grace.checkmd5.enabled}"/>
   794             <istrue value="${s60.grace.checkmd5.enabled}"/>
   631             <istrue value="${s60.grace.checkmd5}"/>
   795             <istrue value="${download.release.checkmd5.enabled}"/>
   632         </or>
   796         </or>
   633     </condition>
   797     </condition>
   634     <!-- Checks the contents from the release. -->    
   798     <!-- Checks the contents from the release. -->    
   635     <target name="ido-check-latest-release-grace" unless="internal.dragonfly.enabled">
   799     <target name="ido-check-latest-release-network" unless="internal.dragonfly.enabled">
   636         <script language="jython" setbeans="false">
   800         <script language="jython" setbeans="false">
   637 import os
   801 import os
   638 import idoprep
   802 import idoprep
   639 
   803 from com.nokia.ant.util import Helper
   640 result = idoprep.get_s60_env_details(project.getProperty('s60.grace.server'), project.getProperty('s60.grace.service'), project.getProperty('s60.grace.product'), project.getProperty('s60.grace.release'), project.getProperty('s60.grace.revision'), project.getProperty('s60.grace.cache'), project.getProperty('internal.s60.grace.checkmd5.enabled'), project.getProperty('s60.grace.usetickler'))
   804 result = idoprep.get_s60_env_details(Helper.getProperty(project, 'download.release.server'), Helper.getProperty(project, 'download.release.service'), Helper.getProperty(project, 'download.release.product'), Helper.getProperty(project, 'download.release.regex'), project.getProperty('download.release.revision'), project.getProperty('download.release.cache'), project.getProperty('internal.release.checkmd5.enabled'), project.getProperty('download.release.usetickler'))
   641 resultname = os.path.basename(result[0])
   805 resultname = os.path.basename(result[0])
   642 project.setProperty('s60.getenv.path', str(result[0]))
   806 project.setProperty('s60.getenv.path', str(result[0]))
   643 project.setProperty('s60.getenv.release', str(resultname))
   807 project.setProperty('s60.getenv.release', str(resultname))
   644 version = idoprep.get_version(project.getProperty('build.drive'), resultname)
   808 version = idoprep.get_version(project.getProperty('build.drive'), resultname)
   645 if version is None or version.strip() != resultname:
   809 if version is None or version.strip() != resultname:
   646     project.setProperty('s60.getenv.update', "1")
   810     project.setProperty('s60.getenv.update', "1")
   647         </script>
   811         </script>
   648     </target>
   812     </target>
       
   813     
       
   814     <!-- Replaced by ido-update-build-area-network.
       
   815     @deprecated since 12.0
       
   816     -->
       
   817     <target name="ido-update-build-area-grace" depends="ido-update-build-area-network"/>
   649 
   818 
   650     <!-- Updates the build area from either a network drive or Dragonfly server.-->
   819     <!-- Updates the build area from either a network drive or Dragonfly server.-->
   651     <target name="ido-update-build-area" depends="backup-subst-drives,ido-update-build-area-grace" unless="env.HLM_SUBCON">
   820     <target name="ido-update-build-area" depends="backup-subst-drives,ido-update-build-area-grace" unless="env.HLM_SUBCON">
   652         <runtarget target="ido-update-build-area-dragonfly"/>
   821         <runtarget target="ido-update-build-area-dragonfly"/>
   653     </target>
   822     </target>
   654 
   823 
   655     <!-- Creates the build area by getting the contents from the release.-->    
   824     <!-- Creates the build area by getting the contents from the release.-->    
   656     <target name="ido-update-build-area-grace" if="s60.getenv.update" depends="ido-check-latest-release" unless="internal.dragonfly.enabled">
   825     <target name="ido-update-build-area-network" if="s60.getenv.update" depends="ido-check-latest-release" unless="internal.dragonfly.enabled">
   657         <!-- Just get S60 for IDOs -->
   826         <!-- Just get S60 for IDOs -->
   658         <echo>Location of the new S60 release:${s60.getenv.path}</echo>
   827         <echo>Location of the new release:${s60.getenv.path}</echo>
   659         <tstamp>
   828         <tstamp>
   660             <format property="getenv.tstamp" pattern="yyyyMMddHHmmss"/>
   829             <format property="getenv.tstamp" pattern="yyyyMMddHHmmss"/>
   661         </tstamp>
   830         </tstamp>
   662         <!-- For linux build prep.build.dir value should not be changed as 
   831         <!-- For linux build prep.build.dir value should not be changed as 
   663         as prep.build.dir <==> build.drive -->
   832         as prep.build.dir <==> build.drive -->
   701 self.log(str("Release metadata file: %s." % metadata))
   870 self.log(str("Release metadata file: %s." % metadata))
   702 rel_metadata = symrec.ReleaseMetadata(metadata)
   871 rel_metadata = symrec.ReleaseMetadata(metadata)
   703 variant_pkg = rel_metadata.getVariantPackage(project.getProperty('ido.variant'))
   872 variant_pkg = rel_metadata.getVariantPackage(project.getProperty('ido.variant'))
   704 project.setProperty('ido.variant.package', os.path.join(rel_path, variant_pkg))
   873 project.setProperty('ido.variant.package', os.path.join(rel_path, variant_pkg))
   705         </script>
   874         </script>
   706         <unzip src="${ido.variant.package}" dest="${build.drive}${env.EPOCROOT}"/>
   875         <unzip src="${ido.variant.package}" dest="${build.drive}/"/>
   707     </target>
   876     </target>
   708 
   877 
   709 
   878 
   710     <!-- This target will help CI tool to trigger a build by updating a 's60.getenv.trigger.location' file timestamp. -->
   879     <!-- This target will help CI tool to trigger a build by updating a 's60.getenv.trigger.location' file timestamp. -->
   711     <target name="ido-latest-release-trigger" if="s60.getenv.update" depends="ido-check-latest-release">
   880     <target name="ido-latest-release-trigger" if="s60.getenv.update" depends="ido-check-latest-release">