buildframework/helium/tools/preparation/ido-prep.ant.xml
changeset 620 ad8ffc8e1982
parent 588 c7c26511138f
child 628 7c4a911dc066
equal deleted inserted replaced
585:238f4cb8391f 620:ad8ffc8e1982
    57     <property name="ido.cenrep.target" value="${build.drive}${env.EPOCROOT}/epoc32/data/z/private/10202be9"  />
    57     <property name="ido.cenrep.target" value="${build.drive}${env.EPOCROOT}/epoc32/data/z/private/10202be9"  />
    58     <!-- Defines the location of Codescanner output.
    58     <!-- Defines the location of Codescanner output.
    59     @type string
    59     @type string
    60     -->
    60     -->
    61     <property name="ido.codescanner.output.dir" location="${build.output.dir}/${build.id}_codescanner"/>
    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"/>
    62     
    67     
    63     <!-- Internal target that generates the '''ado.mapping.file'''.
    68     <!-- Internal target that generates the '''ado.mapping.file'''.
    64      It is a INI file that contains ADO location as a key and target location as value.
    69      It is a INI file that contains ADO location as a key and target location as value.
    65     -->
    70     -->
    66     <target name="ido-create-ado-mapping">        
    71     <target name="ido-create-ado-mapping">
    67         <mkdir dir="${build.output.dir}/build"/>
    72         <mkdir dir="${build.output.dir}/build"/>
    68         <mkdir dir="${temp.build.dir}"/>
    73         <mkdir dir="${temp.build.dir}"/>
    69         <tempfile property="prep.dynamic.sysdef.config" suffix=".txt" deleteonexit="false" destdir="${temp.build.dir}"/>
    74         <if>
    70         <trycatch property="error.message">
    75             <istrue value="${schema.new}" />
    71             <try>
    76             <then>
    72                 <hlm:referenceToFileMacro refid="system.definition.files" output="${prep.dynamic.sysdef.config}"/>
    77                 <hlm:createPackageMapping epocroot="${build.drive}" destFile="${ado.mapping.file}">
    73             </try>
    78                     <path refid="system.definition.files" />
    74             <catch>       
    79                 </hlm:createPackageMapping>
    75                 <propertyregex property="message" input="${error.message}"
    80                 <if>
    76                   regexp=":(.*)$"
    81                     <isreference refid="ado.quality.dirs" />
    77                   select="\1" casesensitive="false" />
    82                     <then>
    78                 <fail message="Error: ${message}" />     
    83                         <hlm:createPackageMapping epocroot="${build.drive}" destFile="${ado.quality.mapping.file}"
    79             </catch>               
    84                             filterDirSet="ado.quality.dirs" >
    80         </trycatch>
    85                             <path refid="system.definition.files" />
    81         <trycatch>
    86                         </hlm:createPackageMapping>
    82             <try>
    87                     </then>
    83                 <pathconvert pathsep="," property="ado.quality.dirs.path">
    88                     <else>
    84                     <dirset refid="ado.quality.dirs"/>
    89                         <copy file="${ado.mapping.file}" tofile="${ado.quality.mapping.file}" overwrite="true" />
    85                 </pathconvert>                              
    90                     </else>
    86             </try>
    91                 </if>
    87         </trycatch>
    92             </then>
    88         <script language="jython" setbeans="false">
    93             <else>
       
    94                 <tempfile property="prep.dynamic.sysdef.config" suffix=".txt" deleteonexit="false" destdir="${temp.build.dir}"/>
       
    95                 <trycatch property="error.message">
       
    96                     <try>
       
    97                         <hlm:referenceToFileMacro refid="system.definition.files" output="${prep.dynamic.sysdef.config}"/>
       
    98                     </try>
       
    99                     <catch>       
       
   100                         <propertyregex property="message" input="${error.message}"
       
   101                           regexp=":(.*)$"
       
   102                           select="\1" casesensitive="false" />
       
   103                         <fail message="Error: ${message}" />     
       
   104                     </catch>               
       
   105                 </trycatch>
       
   106                 <trycatch>
       
   107                     <try>
       
   108                         <pathconvert pathsep="," property="ado.quality.dirs.path">
       
   109                             <dirset refid="ado.quality.dirs"/>
       
   110                         </pathconvert>                              
       
   111                     </try>
       
   112                 </trycatch>
       
   113                 <script language="jython" setbeans="false">
    89 import idoprep
   114 import idoprep
    90 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"))
   115 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"))
    91         </script>
   116                 </script>
       
   117             </else>
       
   118         </if>
    92     </target>
   119     </target>
    93     
   120     
    94     <!-- Target to generate cenreps using cone tool -->
   121     <!-- Target to generate cenreps using cone tool -->
    95     <target name="ido-gen-cenrep">
   122     <target name="ido-gen-cenrep">
    96         <mkdir dir="${post.log.dir}" />
   123         <mkdir dir="${post.log.dir}" />
   170         <hlm:metadataCountSeverity severity="ERROR" log="${build.id}_cenrep.cone.log" db="${metadata.dbfile}" property="cone.error.total"/>
   197         <hlm:metadataCountSeverity severity="ERROR" log="${build.id}_cenrep.cone.log" db="${metadata.dbfile}" property="cone.error.total"/>
   171         <echo>ConE error: ${cone.error.total}</echo>
   198         <echo>ConE error: ${cone.error.total}</echo>
   172         <hlm:generateBuildStatus file="${build.id}_cenrep.cone.log" />
   199         <hlm:generateBuildStatus file="${build.id}_cenrep.cone.log" />
   173     </target>
   200     </target>
   174     
   201     
       
   202     <!--* @property keep.internals
       
   203     Set to 'true' so ido-prep-copy includes 'internal' directories.
       
   204     @type boolean
       
   205     @scope public
       
   206     -->
       
   207 
       
   208     <!--* @property ido.prep.copy.template
       
   209     Defines which template to use in order to achive the package copying.
       
   210     @type boolean
       
   211     @scope public
       
   212     -->
       
   213     <property name="ido.prep.copy.template" location="${helium.dir}/tools/common/templates/ido/ido-ant-copy.xml.ftl" />
       
   214     
   175     <!-- Target that uses the information from the system.definition.files to prepare the IDO build area.
   215     <!-- Target that uses the information from the system.definition.files to prepare the IDO build area.
   176         It relies on the fact that layer_real_source_path entity is declared in each ADO configuration.
   216         It relies on the fact that layer_real_source_path entity is declared in each ADO configuration.
   177         
   217         
   178         By default it deletes the previous content. If you want to backup what was previoulsy used please
   218         By default it deletes the previous content. If you want to backup what was previoulsy used please
   179         defined '''ido.keep.old''' property.         
   219         defined '''ido.keep.old''' property.         
   180         -->
   220         -->
   181     <target name="ido-prep-copy" depends="ido-create-ado-mapping">
   221     <target name="ido-prep-copy" depends="ido-create-ado-mapping">
   182         <mkdir dir="${temp.build.dir}"/>
   222         <mkdir dir="${temp.build.dir}"/>
   183         <tempfile property="prep.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/>
   223         <tempfile property="prep.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/>
   184         
   224         <fmpp sourceFile="${ido.prep.copy.template}"
   185         <!-- new implementation that only rely on Ant -->
       
   186         <fmpp sourceFile="${helium.dir}/tools/common/templates/ido/ido-ant-delete.xml.ftl"
       
   187                      outputFile="${prep.dynamic.config}.clean.xml">
       
   188             <data expandProperties="yes">
       
   189                     inputfile: antProperty(ado.mapping.file)
       
   190                     ant: antProperties()
       
   191                         data: eval('
       
   192                                 java.io.FileInputStream pin = new java.io.FileInputStream(filename);
       
   193                                 java.util.Properties props = new java.util.Properties();
       
   194                                 props.load(pin);
       
   195                                 return props;
       
   196                                 ', {filename:get(inputfile)})
       
   197             </data>
       
   198         </fmpp>
       
   199         <ant antfile="${prep.dynamic.config}.clean.xml"/>
       
   200         
       
   201         <!-- new implementation that only rely on Ant -->
       
   202         <fmpp sourceFile="${helium.dir}/tools/common/templates/ido/ido-ant-copy.xml.ftl"
       
   203             outputFile="${prep.dynamic.config}">
   225             outputFile="${prep.dynamic.config}">
   204             <data expandProperties="yes">
   226             <data expandProperties="yes">
   205                 inputfile: antProperty(ado.mapping.file)
   227                 inputfile: antProperty(ado.mapping.file)
   206                 ant: antProperties()
   228                 ant: antProperties()
   207                     data: eval('
   229                     data: eval('
   285 
   307 
   286 config = configuration.PropertiesConfiguration(stream=open(str(project.getProperty("ado.quality.mapping.file")), 'r'))
   308 config = configuration.PropertiesConfiguration(stream=open(str(project.getProperty("ado.quality.mapping.file")), 'r'))
   287 prefix = pathaddition.relative.commonprefix(config.keys())
   309 prefix = pathaddition.relative.commonprefix(config.keys())
   288 if not os.path.exists(prefix):
   310 if not os.path.exists(prefix):
   289     raise Exception("Could not find common prefix for the following paths:\n" + "\n".join(config.keys()))
   311     raise Exception("Could not find common prefix for the following paths:\n" + "\n".join(config.keys()))
   290 self.log(str('Substing %s' % prefix))
   312 if os.sep == '\\':
   291 drive = fileutils.get_next_free_drive()
   313     self.log(str('Substing %s' % prefix))
   292 fileutils.subst(drive, prefix)
   314     drive = fileutils.get_next_free_drive()
       
   315     fileutils.subst(drive, prefix)
       
   316 else:
       
   317     drive = prefix
   293 project.setProperty('internal.codescanner.drive', drive)
   318 project.setProperty('internal.codescanner.drive', drive)
   294 
   319 
   295 # creating the structure form subst drive.
   320 # creating the structure form subst drive.
   296 path = project.createDataType("path")
   321 path = project.createDataType("path")
   297 for location in config.keys():
   322 for location in config.keys():
   300     self.log(str("To %s" % location))
   325     self.log(str("To %s" % location))
   301     pe = path.createPathElement()
   326     pe = path.createPathElement()
   302     pe.setPath(location)
   327     pe.setPath(location)
   303 project.addReference('substed.ado.src.path', path)
   328 project.addReference('substed.ado.src.path', path)
   304         </script>
   329         </script>
   305         <hlm:codescanner dest="${ido.codescanner.output.dir}"
   330         <trycatch property="codescanner.thrown">
   306             format="${ido.codescanner.output.type}"
   331             <try>
   307             configuration="${ido.codescanner.config}">
   332                 <hlm:codescanner dest="${ido.codescanner.output.dir}"
   308             <path refid="substed.ado.src.path"/>
   333                     format="${ido.codescanner.output.type}"
   309         </hlm:codescanner>
   334                     configuration="${ido.codescanner.config}">
   310         <hlm:unsubst drive="${internal.codescanner.drive}"/>
   335                     <path refid="substed.ado.src.path"/>
       
   336                 </hlm:codescanner>
       
   337             </try>
       
   338             <catch>
       
   339                 <fail message="${codescanner.thrown}" />
       
   340             </catch>
       
   341             <finally>
       
   342                 <hlm:unsubst drive="${internal.codescanner.drive}"/>
       
   343             </finally>
       
   344         </trycatch>
   311     </target>
   345     </target>
   312 
   346 
   313         <!-- CMT Tool target. Complexity tool measures. Supported options for cmt tool macro is
   347         <!-- CMT Tool target. Complexity tool measures. Supported options for cmt tool macro is
   314         1. input - files to be measured
   348         1. input - files to be measured
   315         2. output - output xml file (file size is huge 68MB for JAVA IDO, if this needs to be send, need to consider
   349         2. output - output xml file (file size is huge 68MB for JAVA IDO, if this needs to be send, need to consider
   328                                     return props;
   362                                     return props;
   329                                     ', {filename:get(inputfile)})
   363                                     ', {filename:get(inputfile)})
   330             </data>
   364             </data>
   331         </fmpp>
   365         </fmpp>
   332         <ant antfile="${temp.build.dir}/ido-cmt.ant.xml"/>
   366         <ant antfile="${temp.build.dir}/ido-cmt.ant.xml"/>
   333     </target>
   367         <runtarget target="cmt-generate-diamond-summary" />
   334 
   368     </target>
       
   369 
       
   370         <!-- CMT Tool target. Once the CMT tool has been run this scans the results file and puts the
       
   371         results into a .XML file in the diamonds folder ready for transmission to diamonds. 
       
   372         The target uses the ido-cmt-summary-ant.xml.ftl file to create a file called ido-cmt-summary.ant.xml
       
   373         which contains 1 new target for each of the input folders found under the build area. Then the 
       
   374         ido-cmt-summary.ant.xml file is called as an ant file and the targets executed. Each target runs
       
   375         the file scanner looking for CMT summary information which it extracts and writes to an 
       
   376         XML file in the diamonds folder.
       
   377         -->
       
   378     <target name="cmt-generate-diamond-summary" if="enable.cmt">
       
   379         <!--use the header.ftl template file to create the init part of the output file
       
   380         that can be copied to the final output file by the java class-->
       
   381         <property name="temp.diamonds.header.xml" location="${env.TEMP}/diamonds_header.xml" />
       
   382         <fmpp sourcefile="${helium.dir}/tools/common/templates/diamonds/diamonds_header.ftl" 
       
   383               outputfile="${temp.diamonds.header.xml}" quiet="true"/>
       
   384         <property name="temp.diamonds.footer.xml" location="${env.TEMP}/diamonds_footer.xml" />
       
   385         <fmpp sourcefile="${helium.dir}/tools/common/templates/diamonds/diamonds_footer.ftl" 
       
   386               outputfile="${temp.diamonds.footer.xml}" quiet="true"/>
       
   387         
       
   388         <hlm:cmtsummarytask diamondsHeaderFileName="${temp.diamonds.header.xml}" diamondsFooterFileName="${temp.diamonds.footer.xml}"
       
   389             outputFile="${diamonds.build.output.dir}/cmt_summary.xml"
       
   390             inputFile="${ido.cmt.html.output.dir}/CMTHTML/index.html" />
       
   391         <delete file="${temp.diamonds.header.xml}" failonerror="false" />
       
   392         <delete file="${temp.diamonds.footer.xml}" failonerror="false" />
       
   393         
       
   394     </target>
   335 
   395 
   336     <!-- Internal target that generates a temporary file that allow the 
   396     <!-- Internal target that generates a temporary file that allow the 
   337     either export of iby or either key*.xls. The generated Ant build file
   397     either export of iby or either key*.xls. The generated Ant build file
   338     contains two targets with copy insturctions and generic set of fileset rules.     
   398     contains two targets with copy insturctions and generic set of fileset rules.     
   339     -->
   399     -->
   443         @editable required
   503         @editable required
   444         @scope public
   504         @scope public
   445     -->
   505     -->
   446     <!--* @property s60.grace.usetickler
   506     <!--* @property s60.grace.usetickler
   447         Enable the detection of ready release using GRACE tickler mechanism.
   507         Enable the detection of ready release using GRACE tickler mechanism.
   448         @type string
   508         @type boolean
   449         @editable required
   509         @editable required
   450         @scope public
   510         @scope public
   451     -->
   511     -->
   452 
   512 
   453     <!-- Checks the contents from GRACE release. Mainly used by IDOs. But could be
   513     <!-- Checks the contents from GRACE release. Mainly used by IDOs. But could be
   477         <!-- Just get S60 for IDOs -->
   537         <!-- Just get S60 for IDOs -->
   478         <echo>Location of the new S60 release:${s60.getenv.path}</echo>
   538         <echo>Location of the new S60 release:${s60.getenv.path}</echo>
   479         <tstamp>
   539         <tstamp>
   480             <format property="getenv.tstamp" pattern="yyyyMMddHHmmss"/>
   540             <format property="getenv.tstamp" pattern="yyyyMMddHHmmss"/>
   481         </tstamp>
   541         </tstamp>
       
   542         <!-- For linux build prep.build.dir value should not be changed as 
       
   543         as prep.build.dir <==> build.drive -->
       
   544         <condition property="ba.root.dir" value="${prep.build.dir}" else="${prep.root.dir}/${getenv.tstamp}_${s60.getenv.release}">
       
   545             <os family="unix"/>
       
   546         </condition>
   482         <antcall target="init-drive">
   547         <antcall target="init-drive">
   483             <param name="prep.build.dir" location="${prep.root.dir}/${getenv.tstamp}_${s60.getenv.release}"/>            
   548             <param name="prep.build.dir" location="${ba.root.dir}"/>            
   484         </antcall>
   549         </antcall>
   485         <antcall target="preparation-getenv">
   550         <antcall target="preparation-getenv">
   486             <param name="base_release.path" value="${s60.getenv.path}"/>
   551             <param name="base_release.path" value="${s60.getenv.path}"/>
   487         </antcall>
   552         </antcall>
   488         <antcall target="ido-prep-variant"/>
   553         <antcall target="ido-prep-variant"/>
   565                 org.apache.tools.ant.types.Path.PathElement pe = (org.apache.tools.ant.types.Path.PathElement)path.createPathElement();
   630                 org.apache.tools.ant.types.Path.PathElement pe = (org.apache.tools.ant.types.Path.PathElement)path.createPathElement();
   566                 pe.setPath(i.next()); 
   631                 pe.setPath(i.next()); 
   567             }
   632             }
   568             self.log("Creating reference: " + attributes.get("pathid"));
   633             self.log("Creating reference: " + attributes.get("pathid"));
   569             project.addReference(attributes.get("pathid"), path);
   634             project.addReference(attributes.get("pathid"), path);
   570         } catch (Exception e) {
   635         } catch (java.io.IOException e) {
   571             throw new org.apache.tools.ant.BuildException(e);
   636             throw new org.apache.tools.ant.BuildException(e);
   572         }
   637         }
   573     </scriptdef>
   638     </scriptdef>
   574 
   639 
   575     <!-- Target to get the Substituted drives information-->
   640     <!-- Target to get the Substituted drives information-->