buildframework/helium/tools/preparation/ido-prep.ant.xml
changeset 587 85df38eb4012
parent 217 0f5e3a7fb6af
child 588 c7c26511138f
equal deleted inserted replaced
217:0f5e3a7fb6af 587:85df38eb4012
    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     
    62     
    63     <!-- Internal target that generates the '''ado.mapping.file'''.
    63     <!-- 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.
    64      It is a INI file that contains ADO location as a key and target location as value.
    65     -->
    65     -->
    66     <target name="ido-create-ado-mapping">        
    66     <target name="ido-create-ado-mapping">
    67         <mkdir dir="${build.output.dir}/build"/>
    67         <mkdir dir="${build.output.dir}/build"/>
    68         <mkdir dir="${temp.build.dir}"/>
    68         <mkdir dir="${temp.build.dir}"/>
    69         <tempfile property="prep.dynamic.sysdef.config" suffix=".txt" deleteonexit="false" destdir="${temp.build.dir}"/>
    69         <if>
    70         <trycatch property="error.message">
    70             <istrue value="${schema.new}" />
    71             <try>
    71             <then>
    72                 <hlm:referenceToFileMacro refid="system.definition.files" output="${prep.dynamic.sysdef.config}"/>
    72                 <hlm:createPackageMapping epocroot="${build.drive}" destFile="${ado.mapping.file}">
    73             </try>
    73                     <path refid="system.definition.files" />
    74             <catch>       
    74                 </hlm:createPackageMapping>
    75                 <propertyregex property="message" input="${error.message}"
    75                 <if>
    76                   regexp=":(.*)$"
    76                     <isreference refid="ado.quality.dirs" />
    77                   select="\1" casesensitive="false" />
    77                     <then>
    78                 <fail message="Error: ${message}" />     
    78                         <hlm:createPackageMapping epocroot="${build.drive}" destFile="${ado.quality.mapping.file}"
    79             </catch>               
    79                             filterDirSet="ado.quality.dirs" >
    80         </trycatch>
    80                             <path refid="system.definition.files" />
    81         <trycatch>
    81                         </hlm:createPackageMapping>
    82             <try>
    82                     </then>
    83                 <pathconvert pathsep="," property="ado.quality.dirs.path">
    83                     <else>
    84                     <dirset refid="ado.quality.dirs"/>
    84                         <copy file="${ado.mapping.file}" tofile="${ado.quality.mapping.file}" overwrite="true" />
    85                 </pathconvert>                              
    85                     </else>
    86             </try>
    86                 </if>
    87         </trycatch>
    87             </then>
    88         <script language="jython" setbeans="false">
    88             <else>
       
    89                 <tempfile property="prep.dynamic.sysdef.config" suffix=".txt" deleteonexit="false" destdir="${temp.build.dir}"/>
       
    90                 <trycatch property="error.message">
       
    91                     <try>
       
    92                         <hlm:referenceToFileMacro refid="system.definition.files" output="${prep.dynamic.sysdef.config}"/>
       
    93                     </try>
       
    94                     <catch>       
       
    95                         <propertyregex property="message" input="${error.message}"
       
    96                           regexp=":(.*)$"
       
    97                           select="\1" casesensitive="false" />
       
    98                         <fail message="Error: ${message}" />     
       
    99                     </catch>               
       
   100                 </trycatch>
       
   101                 <trycatch>
       
   102                     <try>
       
   103                         <pathconvert pathsep="," property="ado.quality.dirs.path">
       
   104                             <dirset refid="ado.quality.dirs"/>
       
   105                         </pathconvert>                              
       
   106                     </try>
       
   107                 </trycatch>
       
   108                 <script language="jython" setbeans="false">
    89 import idoprep
   109 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"))
   110 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>
   111                 </script>
       
   112             </else>
       
   113         </if>
    92     </target>
   114     </target>
    93     
   115     
    94     <!-- Target to generate cenreps using cone tool -->
   116     <!-- Target to generate cenreps using cone tool -->
    95     <target name="ido-gen-cenrep">
   117     <target name="ido-gen-cenrep">
    96         <mkdir dir="${post.log.dir}" />
   118         <mkdir dir="${post.log.dir}" />
   170         <hlm:metadataCountSeverity severity="ERROR" log="${build.id}_cenrep.cone.log" db="${metadata.dbfile}" property="cone.error.total"/>
   192         <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>
   193         <echo>ConE error: ${cone.error.total}</echo>
   172         <hlm:generateBuildStatus file="${build.id}_cenrep.cone.log" />
   194         <hlm:generateBuildStatus file="${build.id}_cenrep.cone.log" />
   173     </target>
   195     </target>
   174     
   196     
       
   197     <!--* @property keep.internals
       
   198     Set to 'true' so ido-prep-copy includes 'internal' directories.
       
   199     @type boolean
       
   200     @scope public
       
   201     -->
       
   202 
       
   203     <!--* @property ido.prep.copy.template
       
   204     Defines which template to use in order to achive the package copying.
       
   205     @type boolean
       
   206     @scope public
       
   207     -->
       
   208     <property name="ido.prep.copy.template" location="${helium.dir}/tools/common/templates/ido/ido-ant-copy.xml.ftl" />
       
   209     
   175     <!-- Target that uses the information from the system.definition.files to prepare the IDO build area.
   210     <!-- 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.
   211         It relies on the fact that layer_real_source_path entity is declared in each ADO configuration.
   177         
   212         
   178         By default it deletes the previous content. If you want to backup what was previoulsy used please
   213         By default it deletes the previous content. If you want to backup what was previoulsy used please
   179         defined '''ido.keep.old''' property.         
   214         defined '''ido.keep.old''' property.         
   180         -->
   215         -->
   181     <target name="ido-prep-copy" depends="ido-create-ado-mapping">
   216     <target name="ido-prep-copy" depends="ido-create-ado-mapping">
   182         <mkdir dir="${temp.build.dir}"/>
   217         <mkdir dir="${temp.build.dir}"/>
   183         <tempfile property="prep.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/>
   218         <tempfile property="prep.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/>
   184         
   219         <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}">
   220             outputFile="${prep.dynamic.config}">
   204             <data expandProperties="yes">
   221             <data expandProperties="yes">
   205                 inputfile: antProperty(ado.mapping.file)
   222                 inputfile: antProperty(ado.mapping.file)
   206                 ant: antProperties()
   223                 ant: antProperties()
   207                     data: eval('
   224                     data: eval('
   285 
   302 
   286 config = configuration.PropertiesConfiguration(stream=open(str(project.getProperty("ado.quality.mapping.file")), 'r'))
   303 config = configuration.PropertiesConfiguration(stream=open(str(project.getProperty("ado.quality.mapping.file")), 'r'))
   287 prefix = pathaddition.relative.commonprefix(config.keys())
   304 prefix = pathaddition.relative.commonprefix(config.keys())
   288 if not os.path.exists(prefix):
   305 if not os.path.exists(prefix):
   289     raise Exception("Could not find common prefix for the following paths:\n" + "\n".join(config.keys()))
   306     raise Exception("Could not find common prefix for the following paths:\n" + "\n".join(config.keys()))
   290 self.log(str('Substing %s' % prefix))
   307 if os.sep == '\\':
   291 drive = fileutils.get_next_free_drive()
   308     self.log(str('Substing %s' % prefix))
   292 fileutils.subst(drive, prefix)
   309     drive = fileutils.get_next_free_drive()
       
   310     fileutils.subst(drive, prefix)
       
   311 else:
       
   312     drive = prefix
   293 project.setProperty('internal.codescanner.drive', drive)
   313 project.setProperty('internal.codescanner.drive', drive)
   294 
   314 
   295 # creating the structure form subst drive.
   315 # creating the structure form subst drive.
   296 path = project.createDataType("path")
   316 path = project.createDataType("path")
   297 for location in config.keys():
   317 for location in config.keys():
   300     self.log(str("To %s" % location))
   320     self.log(str("To %s" % location))
   301     pe = path.createPathElement()
   321     pe = path.createPathElement()
   302     pe.setPath(location)
   322     pe.setPath(location)
   303 project.addReference('substed.ado.src.path', path)
   323 project.addReference('substed.ado.src.path', path)
   304         </script>
   324         </script>
   305         <hlm:codescanner dest="${ido.codescanner.output.dir}"
   325         <trycatch property="codescanner.thrown">
   306             format="${ido.codescanner.output.type}"
   326             <try>
   307             configuration="${ido.codescanner.config}">
   327                 <hlm:codescanner dest="${ido.codescanner.output.dir}"
   308             <path refid="substed.ado.src.path"/>
   328                     format="${ido.codescanner.output.type}"
   309         </hlm:codescanner>
   329                     configuration="${ido.codescanner.config}">
   310         <hlm:unsubst drive="${internal.codescanner.drive}"/>
   330                     <path refid="substed.ado.src.path"/>
       
   331                 </hlm:codescanner>
       
   332             </try>
       
   333             <catch>
       
   334                 <fail message="${codescanner.thrown}" />
       
   335             </catch>
       
   336             <finally>
       
   337                 <hlm:unsubst drive="${internal.codescanner.drive}"/>
       
   338             </finally>
       
   339         </trycatch>
   311     </target>
   340     </target>
   312 
   341 
   313         <!-- CMT Tool target. Complexity tool measures. Supported options for cmt tool macro is
   342         <!-- CMT Tool target. Complexity tool measures. Supported options for cmt tool macro is
   314         1. input - files to be measured
   343         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
   344         2. output - output xml file (file size is huge 68MB for JAVA IDO, if this needs to be send, need to consider
   443         @editable required
   472         @editable required
   444         @scope public
   473         @scope public
   445     -->
   474     -->
   446     <!--* @property s60.grace.usetickler
   475     <!--* @property s60.grace.usetickler
   447         Enable the detection of ready release using GRACE tickler mechanism.
   476         Enable the detection of ready release using GRACE tickler mechanism.
   448         @type string
   477         @type boolean
   449         @editable required
   478         @editable required
   450         @scope public
   479         @scope public
   451     -->
   480     -->
   452 
   481 
   453     <!-- Checks the contents from GRACE release. Mainly used by IDOs. But could be
   482     <!-- Checks the contents from GRACE release. Mainly used by IDOs. But could be
   477         <!-- Just get S60 for IDOs -->
   506         <!-- Just get S60 for IDOs -->
   478         <echo>Location of the new S60 release:${s60.getenv.path}</echo>
   507         <echo>Location of the new S60 release:${s60.getenv.path}</echo>
   479         <tstamp>
   508         <tstamp>
   480             <format property="getenv.tstamp" pattern="yyyyMMddHHmmss"/>
   509             <format property="getenv.tstamp" pattern="yyyyMMddHHmmss"/>
   481         </tstamp>
   510         </tstamp>
       
   511         <!-- For linux build prep.build.dir value should not be changed as 
       
   512         as prep.build.dir <==> build.drive -->
       
   513         <condition property="ba.root.dir" value="${prep.build.dir}" else="${prep.root.dir}/${getenv.tstamp}_${s60.getenv.release}">
       
   514             <os family="unix"/>
       
   515         </condition>
   482         <antcall target="init-drive">
   516         <antcall target="init-drive">
   483             <param name="prep.build.dir" location="${prep.root.dir}/${getenv.tstamp}_${s60.getenv.release}"/>            
   517             <param name="prep.build.dir" location="${ba.root.dir}"/>            
   484         </antcall>
   518         </antcall>
   485         <antcall target="preparation-getenv">
   519         <antcall target="preparation-getenv">
   486             <param name="base_release.path" value="${s60.getenv.path}"/>
   520             <param name="base_release.path" value="${s60.getenv.path}"/>
   487         </antcall>
   521         </antcall>
   488         <antcall target="ido-prep-variant"/>
   522         <antcall target="ido-prep-variant"/>
   565                 org.apache.tools.ant.types.Path.PathElement pe = (org.apache.tools.ant.types.Path.PathElement)path.createPathElement();
   599                 org.apache.tools.ant.types.Path.PathElement pe = (org.apache.tools.ant.types.Path.PathElement)path.createPathElement();
   566                 pe.setPath(i.next()); 
   600                 pe.setPath(i.next()); 
   567             }
   601             }
   568             self.log("Creating reference: " + attributes.get("pathid"));
   602             self.log("Creating reference: " + attributes.get("pathid"));
   569             project.addReference(attributes.get("pathid"), path);
   603             project.addReference(attributes.get("pathid"), path);
   570         } catch (Exception e) {
   604         } catch (java.io.IOException e) {
   571             throw new org.apache.tools.ant.BuildException(e);
   605             throw new org.apache.tools.ant.BuildException(e);
   572         }
   606         }
   573     </scriptdef>
   607     </scriptdef>
   574 
   608 
   575     <!-- Target to get the Substituted drives information-->
   609     <!-- Target to get the Substituted drives information-->