buildframework/helium/tools/relnotes/relnotes.ant.xml
changeset 217 0f5e3a7fb6af
parent 179 d8ac696cc51f
child 587 85df38eb4012
--- a/buildframework/helium/tools/relnotes/relnotes.ant.xml	Fri Feb 05 11:59:41 2010 +0000
+++ b/buildframework/helium/tools/relnotes/relnotes.ant.xml	Thu Mar 04 15:10:37 2010 +0200
@@ -20,6 +20,7 @@
 
 ============================================================================
 -->
+<!--* @package releases -->
 <project name="relnotes" default="release-notes" xmlns:hlm="http://www.nokia.com/helium">
     <description>
     Generates a release note by modifying a template (that you can edit yourself) with
@@ -29,23 +30,83 @@
     * Adds table of errors and warnings
     * Generates list of baselines, projects and tasks used
     </description>
+    
+    <!--* @property product.printname
+    A printable name for a product used in release notes.
+    @type string
+    @editable required
+    @scope public
+    -->
+    
+    <!--* @property product.type
+    Project ID in release notes.
+    @type string
+    @editable required
+    @scope public
+    -->
+    
+    <!--* @property relnotes.config.dir
+    Defines the directory that contains release notes creation configuration files.
+    @type string
+    @editable required
+    @scope public
+    -->
 
+    <!-- Defines the directory that will contain the output of release notes creation.
+    @type string
+    @scope private
+    -->
     <property name="releasenotes.output.dir" value="${build.output.dir}/relnotes"/>
+    <!-- Defines the logo image file which will be used in release notes.
+    @type string
+    @scope private
+    -->
     <property name="releasenotes.logo" value="${relnotes.config.dir}/logo.png"/>
+    <!-- Property file with customer values
+    @type string
+    @scope private
+    -->
     <property name="releasenotes.props" value="${relnotes.config.dir}/relnotes.properties"/>
+    <!-- Temp file
+    @type string
+    @scope private
+    -->
     <property name="releasenotes.temp.props" value="${temp.build.dir}/relnotes.properties"/>
+    <!-- Temp file
+    @type string
+    @scope private
+    -->
     <property name="releasenotes.temp.props2" value="${temp.build.dir}/relnotes2.properties"/>
+    <!-- Defines the name of the release note template used.
+    @type string
+    @scope private
+    -->
     <property name="releasenotes.template" value="${relnotes.config.dir}/template.rtf"/>
+    <!-- Location of output rtf file
+    @type string
+    @scope private
+    -->
     <property name="releasenotes.output" value="${releasenotes.output.dir}/${build.id}_relnotes.rtf"/>
+    <!-- Temp file
+    @type string
+    @scope private
+    -->
     <property name="releasenotes.temp.errors" value="${temp.build.dir}/errors.csv"/>
+    <!-- Temp file
+    @type string
+    @scope private
+    -->
     <property name="releasenotes.temp.output" value="${temp.build.dir}/tempDocument.rtf"/>
+    <!-- Location of scan2log HTML file
+    @type string
+    @scope private
+    -->
     <property name="releasenotes.scan2log" value="${build.log.dir}/${build.id}.${product.family}_scan2.html"/>
     
     <import file="${relnotes.config.dir}/relnotes_properties.ant.xml" optional="true"/>
     
-    <!-- Private: -->
-    <target name="release-notes-variant-configuration" depends="rombuild-prepare-input">
-        
+    <!-- @scope private -->
+    <target name="release-notes-variant-configuration" depends="imaker-merge-rom-xml">
         <script language="jython" setbeans="false">
 tagnames = ""
 for product in project.getProperty("product.list").split(","):
@@ -55,10 +116,9 @@
         <replace file="${releasenotes.output}" token="TypeVariantTableHere" value="${variant.product.tagnames}" summary="true"/>
         <for list="${product.list}" delimiter="," param="product.name" >
             <sequential>            
-                <exec executable="python" dir="${helium.dir}/tools/relnotes" failonerror="${failonerror}">
-                    <arg value="getVariantConfiguration.py"/>
+                <exec executable="python" failonerror="${failonerror}">
+                    <arg line="-m getVariantConfiguration"/>
                     <arg value="@{product.name}"/>
-                    <arg value="${localisation.language.file}"/>
                     <arg value="${rombuild.config.file.parsed}"/>
                     <arg value="${temp.build.dir}/variant_@{product.name}.csv"/>
                 </exec>
@@ -75,13 +135,20 @@
         </for>
     </target>
     
-    <!-- Private: Create error list in release notes -->
+    <!-- Create error list in release notes
+    @scope private    
+    -->
     <target name="release-notes-error-summary">
-        <exec executable="python" dir="${helium.dir}/tools/relnotes" failonerror="${failonerror}">
-            <arg value="readHTML.py"/>
-            <arg value="${releasenotes.scan2log}"/>
-            <arg value="${releasenotes.temp.errors}"/>
-        </exec>
+        <fmpp sourceFile="${helium.dir}/tools/relnotes/templates/errors.csv.ftl"
+                     outputfile="${releasenotes.temp.errors}">
+            <freemarkerLinks expandProperties="yes">
+                macro: ${helium.dir}/tools/common/templates/macro
+            </freemarkerLinks>
+            <data expandProperties="yes">
+                dbPath: ${metadata.dbfile}
+                ant: antProperties()
+            </data>
+        </fmpp>
         <hlm:python>
 import ant
 import rtfutils
@@ -92,7 +159,7 @@
         <move file="${releasenotes.temp.output}" tofile="${releasenotes.output}"/>
     </target>
     
-    <!-- Private: Add logo to release notes -->
+    <!--  Add logo to release notes. @scope private -->
     <target name="release-notes-logo">
         <hlm:python>
 import ant
@@ -103,9 +170,14 @@
         <move file="${releasenotes.temp.output}" tofile="${releasenotes.output}"/>
     </target>
     
-    <!-- Private: Find project and baseline of what is running helium -->
+    <!-- Find project and baseline of what is running helium
+    @scope private    
+    -->
     <target name="release-notes-getcmprojectname">
-        <script language="jython" setbeans="false">
+        <if>
+            <istrue value="${ccm.enabled}" />
+            <then>
+                <script language="jython" setbeans="false">
 import ccm.extra
 import traceback
 import os
@@ -133,8 +205,10 @@
 except Exception, ex:
     print 'Caught exception: ' + str(ex)
     traceback.print_exc()
-        </script>
-        <hlm:python outputproperty="ccm.toplevel.baseline">
+    if session:
+        session.close()
+                </script>
+                <hlm:python outputproperty="ccm.toplevel.baseline">
 import traceback
 import ant
 import logging
@@ -154,43 +228,62 @@
 except Exception, ex:
     print 'Caught exception: ' + str(ex)
     traceback.print_exc()
-        </hlm:python>
+    if session:
+        session.close()
+                </hlm:python>
+            </then>
+        </if>
     </target>
     
-    <!-- Private: 
-    Look at property 'project.startswith' and find complete CM name
-    Output property: '${project.startswith}.project'
+    <!--
+    Look 'startsWith' and find complete CM name
+    Output property: '{startsWith}.project'.
+        
+    @scope private
     -->
-    <target name="release-notes-getprojectname">
-        <hlm:python outputproperty="release.notes.temp">
+    <macrodef name="releaseNotesGetProjectName" uri="http://www.nokia.com/helium">
+        <attribute name="startsWith" />
+        <sequential>
+            <if>
+                <available file="${build.log.dir}/${build.id}_bom.xml" />
+                <then>
+                    <hlm:python outputproperty="@{startsWith}.project">
 import amara
 import ant
 
-bomfile = open(r"${temp.build.dir}/${build.id}_BOM.xml")
+bomfile = open(r"${build.log.dir}/${build.id}_bom.xml")
 bom = amara.parse(bomfile)
 
 for p in bom.bom.content.project:
-    if (str(p.name).startswith(ant.get_property(r'${project.startswith}'))):
+    if (str(p.name).startswith(ant.get_property(r'@{startsWith}'))):
         print str(p.name)
 bomfile.close()
-        </hlm:python>
-        <script language="jython" setbeans="false">
-project.setProperty(project.getProperty('project.startswith') + '.project', project.getProperty('release.notes.temp'))
-        </script>
-        
-    </target>
+                    </hlm:python>
+                </then>
+            </if>
+        </sequential>
+    </macrodef>
     
-    <!-- Private: Write projects, baselines and task list for MC and IBUSAL -->
+    <!-- Write projects, baselines and task list for MC and IBUSAL
+    @scope private    
+    -->
     <target name="release-notes-ccm" depends="get-ccm-password,release-notes-getcmprojectname,create-bom">
-        <hlm:python>
+        <if>
+            <and>
+                <istrue value="${ccm.enabled}" />
+                <available file="${build.log.dir}/${build.id}_bom.xml" />
+            </and>
+            <then>
+                <hlm:python>
 import amara
 import ant
 import bomtofile
 import ccmutil
 
-bomfile = open(r"${temp.build.dir}/${build.id}_BOM.xml")
+bomfile = open(r"${build.log.dir}/${build.id}_bom.xml")
 bom = amara.parse(bomfile)
-session = ccmutil.get_session(ant.get_property(r'${ccm.database}'), ant.get_property(r'${ccm.user.login}'), ant.get_property(r'${ccm.user.password}'), ant.get_property(r'${ccm.engine.host}'), ant.get_property(r'${ccm.database.path}'))
+password = ant.get_property(r'${ccm.user.password}')
+session = ccmutil.get_session(ant.get_property(r'${ccm.database}'), ant.get_property(r'${ccm.user.login}'), password, ant.get_property(r'${ccm.engine.host}'), ant.get_property(r'${ccm.database.path}'))
 for p in bom.bom.content.project:
     if p.name == ant.get_property(r'${ccm.toplevel.project}'):
         bomwriter = bomtofile.BOMWriter(session, 'MC', p, ant.get_property(r'${releasenotes.output.dir}'))
@@ -204,25 +297,34 @@
         bomwriter.writetasks()
 session.close()
 bomfile.close()
-        </hlm:python>
+                </hlm:python>
+            </then>
+        </if>
     </target>
     
-    <!-- Private: Read BOM and write ICF list -->
+    <!-- Read BOM and write ICF list
+    @scope private
+    -->
     <target name="release-notes-icfs" depends="create-bom">
-        <exec executable="python" dir="${helium.dir}/tools/relnotes" failonerror="${failonerror}">
-            <arg value="icf2txt.py"/>
+        <exec executable="python" failonerror="${failonerror}">
+            <arg line="-m icf2txt"/>
             <arg value="${temp.build.dir}/${build.id}_BOM.xml"/>            
             <arg value="${releasenotes.output.dir}/icdicf.txt"/>
         </exec>
     </target>
     
-    <!-- Private: -->
+    <!-- @scope private -->
     <target name="release-notes-test" if="hlm.enable.asserts">
-        <hlm:python>
+        <if>
+            <istrue value="${ccm.enabled}" />
+            <then>
+                <hlm:python>
 import ccm
 #check for ccm session leaks
 assert (len(ccm.running_sessions()) == 0)
-        </hlm:python>
+                </hlm:python>
+            </then>
+        </if>
     </target>
         
     <!--