buildframework/helium/build.xml
changeset 620 ad8ffc8e1982
parent 590 360bd6b35136
child 629 541af5ee3ed9
equal deleted inserted replaced
585:238f4cb8391f 620:ad8ffc8e1982
     1 <?xml version="1.0" encoding="UTF-8"?>
     1 <?xml version="1.0"?>
     2 <!-- 
     2 <project name="helium-root" default="all">
     3 ============================================================================ 
       
     4 Name        : build.xml 
       
     5 Part of     : Helium 
       
     6 
       
     7 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     8 All rights reserved.
       
     9 This component and the accompanying materials are made available
       
    10 under the terms of the License "Eclipse Public License v1.0"
       
    11 which accompanies this distribution, and is available
       
    12 at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    13 
       
    14 Initial Contributors:
       
    15 Nokia Corporation - initial contribution.
       
    16 
       
    17 Contributors:
       
    18 
       
    19 Description:
       
    20 
       
    21 ============================================================================
       
    22 -->
       
    23 <project name="helium-build" default="help" xmlns:au="org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium"> 
       
    24     <description>
       
    25         Helium targets to build helium itself.
       
    26     </description>
       
    27     
     3     
    28     <import file="build-jar.ant.xml"/>
     4     <property environment="env"/>
    29     <property name="build.drive" location="${env.TEMP}/helium/temp_drive"/>
     5     <import file="helium/build.xml"/>
    30     <mkdir dir="${build.drive}/"/> 
       
    31     
     6     
    32     <!-- @property helium.version
     7 
    33     @type string
     8     <property name="helium.svn.workarea.dir" value="\\vcfiler02\proj2\Juno\juno_build_release\helium\svn"/>
    34     @scope private -->
     9     <property name="helium.ccm.workarea.dir" value="\\vcfiler02\proj2\Juno\juno_build_release\internal\workarea\helium\next"/>
    35     <property file="${helium.dir}/config/version.txt"/>
    10     <property name="helium.svn.url" value="http://helium.nmp.nokia.com/svn" />
    36     <property name="release.label" value="${helium.version}"/>
    11 
    37 
    12     <target name="unittest">
    38     <!-- Override docs targets to do more for Helium. -->
    13         <ant dir="helium" target="unittest" inheritAll="false"/>
    39     <target name="apidocs" depends="python-apidocs,java-apidocs,antdoclet,internal.docs.apidocs"/>
    14     </target>
    40     <!-- Generate rst files for docs -->
    15 
    41     <target name="prep-textdocs" depends="overview-to-html,tools-rst-table,dependency-diagram,
    16     <target name="ant-unittest" depends="xtest-diamonds">
    42         dependency-logs,release-diff,helium-user-graph,helium-prep-textdocs,internal.docs.prep-textdocs"/>
    17         <ant dir="helium" target="ant-unittest" inheritAll="false"/>
    43     <!-- generate all the user documentation for helium -->
    18     </target>
    44     <target name="docs" depends="clean-doc-dir,database,apidocs,textdocs,add-policies-to-docs"/>
    19 
       
    20     <target name="ju-unittest">
       
    21         <ant dir="helium" target="ju-unittest" inheritAll="false"/>
       
    22     </target>
       
    23 
       
    24     <target name="py-unittest">
       
    25         <ant dir="helium" target="py-unittest" inheritAll="false"/>
       
    26     </target>
       
    27 
       
    28     <target name="check">
       
    29         <ant dir="helium" target="check" inheritAll="false"/>
       
    30     </target>
       
    31 
       
    32     <target name="check-distribution-policies">
       
    33         <ant dir="helium" target="delete-svn-unversioned" inheritAll="false"/>
       
    34         <ant dir="helium" target="check-distribution-policies" inheritAll="false"/>
       
    35     </target>
       
    36 
       
    37     <target name="pylint">
       
    38         <ant dir="helium" target="pylint" inheritAll="false"/>
       
    39     </target>
       
    40 
       
    41     <target name="antlint">
       
    42         <ant dir="helium" target="antlint" inheritAll="false"/>
       
    43     </target>
       
    44 
       
    45     <target name="java-checkstyle">
       
    46         <ant dir="helium" target="java-checkstyle" inheritAll="false"/>
       
    47     </target>
       
    48 
       
    49     <target name="apidocs">
       
    50         <ant dir="helium" target="apidocs" inheritAll="false"/>
       
    51     </target>
       
    52 
       
    53     <target name="textdocs">
       
    54         <ant dir="helium" target="textdocs" inheritAll="false"/>
       
    55     </target>
       
    56 
       
    57     <target name="docs">
       
    58         <ant dir="helium" target="docs" inheritAll="false"/>
       
    59     </target>
       
    60 
       
    61     <target name="upload-docs">
       
    62         <ant dir="helium" target="upload-docs" inheritAll="false"/>
       
    63     </target>
       
    64 
       
    65     <target name="build-zip">
       
    66         <ant dir="helium" target="build-zip" inheritAll="false"/>
       
    67     </target>
       
    68 
       
    69     <target name="all" depends="unittest,apidocs,docs,pylint,java-checkstyle"/>
       
    70 
       
    71     <!-- Create a new branch from the current working copy.
    45     
    72     
    46     <import file="helium.ant.xml"/>
    73     A ${branch} property must be defined for the branch version, e.g. 0.9.x.    
    47     <import file="tools/startup/antserver/antserver.ant.xml"/>
    74     --> 
    48          
    75     <target name="branch" description="Create a new branch from the current working copy">
       
    76         <fail unless="branch">"branch" property not defined, e.g. 0.21.x</fail>
       
    77         <fail unless="version">"version" property not defined, e.g. 0.21</fail>
       
    78         <!-- Major Branches need a reference_branch set -->
       
    79         <if>
       
    80             <contains string="${branch}" substring=".0" />
       
    81             <then>
       
    82                 <fail unless="reference_branch">"reference_branch" property not defined, e.g. 0.21</fail>   
       
    83             </then>
       
    84         </if>
       
    85         <if>
       
    86             <not>
       
    87                 <isset property="create.branch"/>
       
    88             </not>
       
    89             <then>
       
    90                 <input validargs="y,n" addproperty="create.branch">
       
    91 A svn branch will be made:
       
    92 To: ${helium.svn.url}/helium/branches/helium-${branch}
       
    93 Do you want to continue?
       
    94                 </input>
       
    95             </then>
       
    96         </if>
       
    97         <if>
       
    98             <equals arg1="${create.branch}" arg2="y"/>
       
    99             <then>
       
   100             	<propertyfile file="helium\config\version.txt" comment="Helium version - DO NOT EDIT">
       
   101                     <entry key="helium.version" value="${version}"/>
       
   102                 </propertyfile>
       
   103                 <svn username="${env.USERNAME}" password="${env.USERNAME}">
       
   104                 	<commit file="helium\config\version.txt"
       
   105                 		    message="Updating version to ${version}"/>
       
   106                 </svn>
       
   107                 <if>
       
   108                     <or>
       
   109                         <not>
       
   110                             <isset property="reference_branch" />                            
       
   111                         </not>
       
   112                         <equals arg1="${reference_branch}" arg2="trunk" />                            
       
   113                     </or>
       
   114                     <then>
       
   115                         <echo message="Create a trunk based branch" />
       
   116                         <!-- Create a Sprint branch -->
       
   117                         <svn username="${env.USERNAME}" password="${env.USERNAME}">
       
   118                             <copy srcurl="${helium.svn.url}/helium/trunk"
       
   119                                   desturl="${helium.svn.url}/helium/branches/helium-${branch}"
       
   120                                   message="Created release branch for helium-${branch} branch based on helium trunk."/>
       
   121                         </svn>
       
   122                     </then>
       
   123                     <else>
       
   124                         <echo message="Create a Sprint based branch" />
       
   125                         <!-- Create a Major branch -->
       
   126                         <svn username="${env.USERNAME}" password="${env.USERNAME}">
       
   127                             <copy srcurl="${helium.svn.url}/helium/branches/helium-${reference_branch}"
       
   128                                   desturl="${helium.svn.url}/helium/branches/helium-${branch}"
       
   129                                   message="Created release branch for helium-${branch} branch based on helium-${reference_branch}."/>
       
   130                             <copy srcurl="${helium.svn.url}/helium/trunk/helium/config/version.txt"
       
   131                                   desturl="${helium.svn.url}/helium/branches/helium-${branch}/helium/config/version.txt"
       
   132                                   message="Updating version to ${version}."/>
       
   133                         </svn>
       
   134                     </else>
       
   135                 </if>
       
   136                 <svn username="${env.USERNAME}" password="${env.USERNAME}">
       
   137                     <switch path="${helium.svn.workarea.dir}\helium-next"
       
   138                             url="${helium.svn.url}/helium/branches/helium-${branch}"/>
       
   139                 </svn>
       
   140             </then>
       
   141         </if>
       
   142     </target>
       
   143 
       
   144     <!-- Create a new release tag from the given branch.
    49     
   145     
    50     
   146         
    51     
   147     --> 
    52     <target name="must-property-comments">
   148     <target name="release" description="Create a new release tag from the current working copy">
    53         <!--<xslt in="${data.model.file}" out="${data.model.parsed}" style="${data.model.xsl}"/>-->
   149         <fail unless="branch">"branch" property not defined</fail>
    54         <for param="ant.file">
   150         <fail unless="version">"version" property not defined</fail>
    55             <fileset dir="${helium.dir}" includes="helium.ant.xml">
   151         <property name="url" value=""/>
    56             </fileset>
   152         <if>
    57             <sequential>     
   153             <not>
    58                 <script language="jython">
   154                 <isset property="create.release"/>
    59 import re
   155             </not>
    60 import java.io
   156             <then>
    61 import org.dom4j
   157                 <input validargs="y,n" addproperty="create.release">
    62 import org.dom4j.io
   158 A svn tag will be made:
    63 
   159 From: ${helium.svn.url}/helium/branches/helium-${branch}
    64 model = org.dom4j.io.SAXReader().read(java.io.File(project.getProperty("helium.dir") + '/build/datamodel.out'))
   160 To  : ${helium.svn.url}/helium/tags/helium-${version}
    65 
   161 Do you want to continue?
    66 user_props = model.selectNodes('//property[editStatus="must"]')
   162                 </input>
    67 indent = '    '
   163             </then>
    68 out = open('required_properties.txt', 'w')
   164         </if>
    69 for prop in user_props:
   165         <if>
    70 #    print prop
   166             <equals arg1="${create.release}" arg2="y"/>
    71     property_comment = indent + "&lt;!--* @property " + prop.elementTextTrim('name') + "\n"
   167             <then>
    72     property_comment += indent + prop.elementTextTrim('description') + "\n"
   168                 <echo>Creating release tag from ${helium.svn.url}/helium/branches/helium-${branch}</echo>                
    73     property_comment += indent + "@type " + prop.elementTextTrim('type') + "\n"
   169                 <propertyfile file="${helium.svn.workarea.dir}\helium-next\helium\config\version.txt" comment="Helium version - DO NOT EDIT">
    74     property_comment += indent + "@editable required\n"
   170                     <entry key="helium.version" value="${version}"/>
    75     property_comment += indent + "@scope public\n"
   171                 </propertyfile>
    76     property_comment += indent + "--&gt;\n\n"
   172                 <svn username="${env.USERNAME}" password="${env.USERNAME}">
    77     print property_comment
   173                     <commit file="${helium.svn.workarea.dir}\helium-next\helium\config\version.txt" message="Updating version to ${version}"/>
    78     out.write(property_comment)
   174                 </svn>
    79 
   175                 <svn username="${env.USERNAME}" password="${env.USERNAME}" failonerror="false">
    80 out.close()
   176                     <copy srcurl="${helium.svn.url}/helium/branches/helium-${branch}"
    81                 </script>
   177                           desturl="${helium.svn.url}/helium/tags/helium-${version}"
    82             </sequential>
   178                           message="Created release tag for helium-${version} release."/>
    83         </for>                               
   179                     <switch path="${helium.svn.workarea.dir}\helium-next"
    84     </target>
   180                             url="${helium.svn.url}/helium/tags/helium-${version}"/>
       
   181                 </svn>
       
   182                 <exec executable="python" failonerror="true">        
       
   183                     <arg line="bin\trac-add-version.py"/>
       
   184                     <arg value="helium-${version}"/>
       
   185                 </exec>
       
   186             </then>
       
   187         </if>
       
   188     </target>
       
   189 
       
   190     <target name="merge-svn-to-ccm">
       
   191         <exec executable="c:\apps\bc\bc2.exe">
       
   192             <arg value="@${helium.dir}/tools/common/svn-ccm-sync.bc.txt"/>
       
   193             <arg value="${helium.svn.workarea.dir}\helium-next\helium"/>
       
   194             <arg value="${helium.ccm.workarea.dir}\helium"/>
       
   195             <arg value="c:\svn_ccm_diff.txt"/>
       
   196         </exec>
       
   197     </target>
       
   198 
       
   199     <target name="release-email" description="Create a release email HTML content">
       
   200         <fail unless="milestone">"milestone" property not defined (typically sprint name)</fail>
       
   201         <fail unless="release">"release" property not defined</fail>
       
   202         <exec executable="python" failonerror="true">        
       
   203             <arg line="bin\trac-collect-release-email-changes.py"/>
       
   204             <arg value="${milestone}"/>
       
   205         </exec>
       
   206         <fmpp sourceFile="${helium.dir}/extensions/nokia/doc/src/release_notes.html.ftl"
       
   207         	  outputFile="${helium.dir}/build/doc/release_notes_${release}.html">
       
   208             <data expandProperties="yes">
       
   209                 doc: xml(${helium.dir}/../release_notes_tickets_${milestone}.xml)
       
   210                 cfg: tdd(${helium.dir}/../release_notes_config.txt)
       
   211                 ant: antProperties(milestone, release)
       
   212             </data>
       
   213         </fmpp>
       
   214         <fmpp sourceFile="${helium.dir}/extensions/nokia/doc/src/release_notes.rst.ftl"
       
   215         	  outputFile="${helium.dir}/extensions/nokia/doc/src/releasenotes/release_notes_${release}.rst">
       
   216             <data expandProperties="yes">
       
   217                 doc: xml(${helium.dir}/../release_notes_tickets_${milestone}.xml)
       
   218                 cfg: tdd(${helium.dir}/../release_notes_config.txt)
       
   219                 ant: antProperties(milestone, release)
       
   220             </data>
       
   221         </fmpp>
       
   222     </target>
       
   223  
       
   224     <!-- Get a listing of the number of story points completed in a sprint per user. -->
       
   225     <target name="story-points">
       
   226         <fail unless="milestone">"milestone" property not defined (typically sprint name)</fail>
       
   227         <echo>Story points per developer for ${milestone}:
       
   228         </echo>
       
   229         <exec executable="python" failonerror="true">        
       
   230             <arg line="bin\trac-user-story-points.py"/>
       
   231             <arg value="${milestone}"/>
       
   232         </exec>
       
   233     </target>
       
   234 
       
   235     <!-- Shows a dialog allowing the daily SCRUM information to be posted to the Trac wiki. -->
       
   236     <target name="scrum">
       
   237         <antform title="Submit SCRUM notes">
       
   238             <dateProperty label="Date" property="date" dateFormat="yyyy-MM-dd" focus="true"/>
       
   239             <multiLineTextProperty label="Done" property="done"/>
       
   240             <multiLineTextProperty label="Todo" property="todo"/>
       
   241             <multiLineTextProperty label="Blocking" property="blocking"/>
       
   242         </antform>
       
   243         <echo file="scrum_notes.txt">
       
   244 == ${env.USERNAME} ==
       
   245    '''Done:''' ${done}
       
   246 
       
   247    '''Todo:''' ${todo}
       
   248 
       
   249    '''Blocking:''' ${blocking}
       
   250         </echo>
       
   251         <if>
       
   252             <isset property="date"/>
       
   253             <then>
       
   254                 <echo>${done}</echo>
       
   255                 <property name="page" value="Scrum/Log/${date}"/>
       
   256                 <property name="done" value="None"/>
       
   257                 <property name="todo" value="None"/>
       
   258                 <property name="blocking" value="None"/>
       
   259                 <exec executable="python" failonerror="true">        
       
   260                     <arg line="bin\trac-update-scrum-notes.py"/>
       
   261                     <arg line="--file scrum_notes.txt ${page}"/>
       
   262                 </exec>   
       
   263             </then>
       
   264         </if>
       
   265     </target>
       
   266 
       
   267     <!-- Install BBControllerService.py and start the service to control Buildbot service -->
       
   268     <target name="install-bb-controller-service">
       
   269         <copy file="bin\BBControllerService.py" tofile="c:\apps\actpython\Lib\site-packages\BBControllerService.py"/>
       
   270         <exec osfamily="windows" executable="python" failonerror="true">            
       
   271             <env key="PYTHONPATH" value="${env.PYTHONPATH};${python.modules.path}"/>
       
   272             <arg line="c:\apps\actpython\Lib\site-packages\BBControllerService.py"/>
       
   273             <arg line="--startup auto"/> 
       
   274             <arg line="install"/>
       
   275         </exec>
       
   276         <exec osfamily="windows" executable="python" failonerror="true">            
       
   277             <env key="PYTHONPATH" value="${env.PYTHONPATH};${python.modules.path}"/>
       
   278             <arg line="c:\apps\actpython\Lib\site-packages\BBControllerService.py"/>
       
   279             <arg line="start"/>
       
   280         </exec>
       
   281     </target>
       
   282 
       
   283     <!-- Use this target to restart a Helium buildbot service. BBControllerService.py service
       
   284     must be installed in buildbot machine.
       
   285     Usage:
       
   286     <pre>
       
   287         Usage: hlm restart-buildbot -Dbb.machine=[Buildbot machine name] -Dbb.command=[BB_RESTART]
       
   288     </pre>  -->
       
   289     <target name="restart-buildbot">
       
   290         <script language="jython" setbeans="false">
       
   291 import os
       
   292 import socket
       
   293 import time
       
   294 import sys
       
   295 import traceback
       
   296 
       
   297 bbmachie = project.getProperty("bb.machine")
       
   298 cmd = project.getProperty("bb.cmd")
       
   299 
       
   300 if bbmachie == None or cmd == None :
       
   301     print "Buildbot machine name and/or Command not found."
       
   302     print "Usage: hlm restart-buildbot -Dbb.machine=[Buildbot machine name] -Dbb.cmd=[BB_RESTART]"
       
   303 else :    
       
   304     sockt = socket.socket(socket.AF_INET, socket.SOCK_STREAM)        
       
   305     try:
       
   306         sockt.connect((bbmachie, int(50008)))
       
   307         sockt.send(cmd)    
       
   308         data = sockt.recv(1024)
       
   309         print "Response: ", data
       
   310     except:
       
   311         print "Buildbot machine is busy or not found."
       
   312         traceback.print_exc()
       
   313     sockt.close()       
       
   314         </script>
       
   315     </target>
       
   316 
       
   317     <target name="coffee">
       
   318         <splash imageurl="file:////${helium.dir}/../coffee.png" showduration="5000"/>
       
   319     </target>
       
   320 
       
   321     <!-- Create a zip file of Helium for release via Hydra -->    
       
   322     <target name="helium-hydra-zip">
       
   323         <delete file="${env.TEMP}/helium-${helium.version}.zip" failonerror="false"/>  
       
   324         <zip destfile="${env.TEMP}/helium-${helium.version}.zip">
       
   325             <zipfileset dir="./helium" prefix="helium"/>
       
   326         </zip>
       
   327     </target>
       
   328 
    85 </project>
   329 </project>
    86