buildframework/helium/tools/common/docs.ant.xml
branchwip
changeset 380 db59fc762214
parent 217 0f5e3a7fb6af
child 587 85df38eb4012
equal deleted inserted replaced
369:1248e8f6a72d 380:db59fc762214
    18 
    18 
    19 Description:
    19 Description:
    20 
    20 
    21 ============================================================================
    21 ============================================================================
    22 -->
    22 -->
       
    23 <!--* @package framework -->
    23 <project name="internal.docs" xmlns:hlm="http://www.nokia.com/helium" xmlns:ivy="antlib:org.apache.ivy.ant">
    24 <project name="internal.docs" xmlns:hlm="http://www.nokia.com/helium" xmlns:ivy="antlib:org.apache.ivy.ant">
    24     <description>
    25     <description>
    25     Documentation generation targets.
    26     Documentation generation targets.
    26     </description>
    27     </description>
    27     
    28     
    28     <property name="helium.doc.dir" location="${helium.dir}/doc" />
    29     <!-- Location of documentation source.
       
    30     @type string
       
    31     @scope public
       
    32     -->
       
    33     <property name="doc.src.dir" location="${basedir}/doc" />
       
    34     
       
    35     <!-- The location where the docs will be built.
       
    36     @type string
       
    37     @scope private -->
       
    38     <property name="docs.build.dir" location="${basedir}/build/doc" />
    29     
    39     
    30     <fileset id="python.library.files" dir="${helium.dir}">
    40     <fileset id="python.library.files" dir="${helium.dir}">
    31         <include name="extensions/nokia/tools/common/python/lib/**/*.py"/>
    41         <include name="extensions/nokia/tools/common/python/lib/**/*.py"/>
    32         <include name="tools/common/python/lib/**/*.py"/>
    42         <include name="tools/common/python/lib/**/*.py"/>
    33         <include name="extensions/nokia/tools/dp/iCreatorDP/**/*.py"/>
    43         <include name="external/helium-antlib/python/**/*.py"/>
       
    44         <include name="extensions/nokia/external/helium-nokia-antlib/python/**/*.py"/>
    34     </fileset>
    45     </fileset>
    35     
    46     
    36     <!-- Generate an overview of Helium as HTML tables. -->
    47     <fileset id="static.doc.files" dir="${helium.dir}/doc/src">
    37     <target name="overview-to-html">
    48         <include name="conf.py"/>
    38         <fmpp sourceFile="${helium.doc.dir}/src/helium_overview.html.ftl"
    49         <include name=".static"/>
    39               outputFile="${helium.build.dir}/temp/doc/helium_overview.html"
    50         <include name=".templates/**"/>
    40               replaceExtension="html.ftl, html" expert="true">
    51         <include name="*.jpg"/>
    41             <data expandProperties="yes">
    52         <include name="*.css"/>
    42                 doc: xml(${helium.doc.dir}/src/helium_overview.xml)
    53     </fileset>
    43             </data>
    54         
    44         </fmpp>
       
    45     </target>
       
    46 
       
    47     
       
    48     <!-- Macro to generate the tools dependency xml output. -->
       
    49     <macrodef name="createToolsTableMacro" uri="http://www.nokia.com/helium">
       
    50         <attribute name="dir"/>
       
    51         <attribute name="failonerror"/>
       
    52         <attribute name="configs"/>
       
    53         <sequential>
       
    54             <ivy:configure file="${tools.ivy.config.file}" override="true"/>
       
    55             <ivy:resolve file="${helium.dir}/config/ivy/ivy.xml" conf="@{configs}" haltonfailure="@{failonerror}"/>
       
    56             <ivy:report todir="@{dir}" outputpattern="tool-dependencies-[conf].xml"
       
    57                         conf="@{configs}" xml="true" graph="false" xsl="false"/>
       
    58         </sequential>
       
    59     </macrodef>
       
    60 
       
    61     
       
    62     <!-- Generates the tools dependency xml output. used in the retrieving Helium section to list the tools used within Helium-->
       
    63     <target name="tools-rst-table">
       
    64         <hlm:createToolsTableMacro dir="${helium.build.dir}/doc/ivy" failonerror="false" 
       
    65             configs="core,ido"/>
       
    66         <fmpp sourceFile="${helium.doc.dir}/src/manual/tool-dependencies.rst.ftl" includes="*.dot.ftl"
       
    67               outputFile="${helium.build.dir}/temp/doc/nokia/tool-dependencies.rst_include"
       
    68               replaceExtension="dot.ftl, dot">
       
    69             <data expandProperties="yes">
       
    70                 doc: xml(${helium.build.dir}/doc/ivy/tool-dependencies-ido.xml)
       
    71             </data>
       
    72         </fmpp>
       
    73     </target>
       
    74     
       
    75     
       
    76     <!-- Create a complete dependency graph of Helium libraries. 
       
    77         
       
    78     Currently this does not work correctly but it is useful for future testing of repreport. -->
       
    79     <target name="libraries-dependencies">
       
    80         <ivy:settings file="${tools.ivy.config.file}"/>
       
    81         <!--<ivy:resolve file="${helium.dir}/config/ivy/ivy.xml" conf="" haltonfailure="false"/>-->
       
    82         <delete file="@{dir}/ivy-repository-report.xml"/>
       
    83         <ivy:repreport todir="${helium.build.dir}/doc/ivy" organisation="S60_SAM"
       
    84                     xml="true" graph="false" xsl="false"/>
       
    85         <!--<fmpp sourceFile="${helium.doc.dir}/src/manual/tool-dependencies.rst.ftl" includes="*.dot.ftl"
       
    86               outputFile="${helium.build.dir}/temp/doc/manual/tool-dependencies.rst_include"
       
    87               replaceExtension="dot.ftl, dot">
       
    88             <data expandProperties="yes">
       
    89                 doc: xml(${helium.build.dir}/doc/ivy/tool-dependencies-ido.xml)
       
    90             </data>
       
    91         </fmpp>-->
       
    92     </target>
       
    93     
       
    94     
       
    95     <!-- Generate .rst tables from the property groups in the data model. -->
       
    96     <target name="property-group-tables">
       
    97         <fmpp sourceRoot="${helium.doc.dir}/src" includes="*.dot.ftl" outputRoot="${helium.build.dir}/temp/doc/api/helium"
       
    98               replaceExtension="dot.ftl, dot">
       
    99             <data expandProperties="yes">
       
   100                 doc: xml(${database.file})
       
   101             </data>
       
   102         </fmpp>
       
   103     </target>
       
   104 
       
   105     
       
   106     <!-- Generate Python API documentation using epydoc. -->
       
   107     <target name="python-apidocs">
       
   108         <mkdir dir="${helium.build.dir}/doc/api/python"/>
       
   109         <pathconvert pathsep=" " property="epydoc.python.modules.path">
       
   110             <fileset refid="python.library.files"/>
       
   111         </pathconvert>
       
   112         <echo>Python modules path: ${epydoc.python.modules.path}</echo>
       
   113         <exec osfamily="windows" executable="python" dir="${helium.build.dir}" failonerror="true">        
       
   114             <arg line="${python.tools}\epydoc"/>
       
   115             <arg value="-v"/>
       
   116             <arg value="--config=${helium.dir}\config\epydoc.conf"/>
       
   117             <arg value="--exclude=sgmllib"/>
       
   118             <arg line="${epydoc.python.modules.path}"/>
       
   119         </exec>
       
   120     </target>
       
   121     
       
   122     
       
   123     <!-- Generate Java API documentation using javadoc. -->
       
   124     <target name="java-apidocs" depends="install-cruisecontrol">
       
   125         <path id="classpath-javadoc">
       
   126             <fileset dir="${helium.dir}/external/CruiseControl/lib" includes="*.jar"/>
       
   127             <fileset dir="${helium.dir}/external" includes="**/*.jar"/>
       
   128             <pathelement path="${helium.dir}/external/CruiseControl/webapps/dashboard/WEB-INF/classes"/>
       
   129         </path>
       
   130         <javadoc classpathref="classpath-javadoc" 
       
   131             destdir="${helium.build.dir}/doc/api/java" useexternalfile="true">
       
   132             <packageset dir="tools/common/java/src" defaultexcludes="yes"/>
       
   133             <packageset dir="tools/common/java/test" defaultexcludes="yes"/>
       
   134             <doctitle><![CDATA[<h1>API Documentation</h1>]]></doctitle>
       
   135         </javadoc>
       
   136     </target>
       
   137     
       
   138     
       
   139     <!-- Generate Ant API documentation using antdoclet. -->
       
   140     <target name="antdoclet" description="Generate Ant Task/Types documentation">
       
   141         <path id="doclet-classpath">
       
   142             <pathelement path="${java.class.path}/"/>
       
   143             <pathelement path="${helium.dir}/external/CruiseControl/webapps/dashboard/WEB-INF/classes"/>
       
   144         </path>
       
   145         <mkdir dir="${helium.build.dir}/doc/api/ant"/>
       
   146 
       
   147         <!-- First copy the "static" resources (images, static html files) -->
       
   148         <copy todir="${helium.build.dir}/doc/api/ant" overwrite="true">
       
   149             <fileset dir="${helium.doc.dir}/src/antdoclet/html">
       
   150                 <exclude name="*.vm"/>
       
   151             </fileset>
       
   152         </copy>
       
   153       
       
   154         <!-- Now invoke AntDoclet to generate the "dynamic" content from the templates -->
       
   155         <javadoc access="private" sourcepath="${helium.dir}/tools/common/java/src/"
       
   156                  destdir="${helium.build.dir}/doc/api/ant"
       
   157                  packagenames="com.nokia.ant,com.nokia.ant.filters,com.nokia.ant.types.imaker,com.nokia.ant.types,com.nokia.ant.listerner,com.nokia.ant.taskdefs,com.nokia.ant.taskdefs.ccm.commands,com.nokia.cruisecontrol,com.nokia.cruisecontrol.sourcecontrol,com.nokia.fmpp,nokia.ivy"
       
   158                  docletpathref="doclet-classpath" source="1.6"
       
   159                  useexternalfile="true">
       
   160             <doclet name="com.neuroning.antdoclet.AntDoclet">
       
   161                 <param name="-doctitle" value="${build.name}" />
       
   162                 <param name="-templatesdir" value="${helium.doc.dir}/src/antdoclet/html"/>
       
   163                 <param name="-templates" value="main.vm"/>
       
   164             </doclet>
       
   165         </javadoc>
       
   166         <move file="velocity.log" tofile="build/velocity.log" failonerror="false"/>
       
   167     </target>
       
   168 
       
   169     
    55     
   170     <!-- Cleans the Helium API documentation. -->
    56     <!-- Cleans the Helium API documentation. -->
   171     <target name="clean-helium-apidoc">
    57     <target name="clean-helium-apidocs">
   172         <delete dir="${helium.build.dir}/doc/api/helium"/>
    58         <delete dir="${docs.build.dir}/api/helium"/>
   173         <delete dir="${helium.build.dir}/temp/doc/api/helium"/>
    59         <delete dir="${docs.build.dir}/temp/doc/api/helium"/>
   174     </target>
    60     </target>
   175     
    61     
   176     
    62     
   177     <!-- Creates images of the dependencies for all Ant targets.
    63     <!-- Creates images of the dependencies for all Ant targets.
   178         
    64         
   179     This includes creating a cmap file that is included in the HTML document,
    65     This includes creating a cmap file that is included in the HTML document,
   180     so the boxes in the image are linked to their targets. -->
    66     so the boxes in the image are linked to their targets. -->
   181     <target name="helium-api-dependency-images">
    67     <target name="helium-api-dependency-images">
   182         <mkdir dir="${helium.build.dir}/doc/api/helium"/>
    68         <mkdir dir="${docs.build.dir}/api/helium"/>
   183         <fmpp sourceRoot="${helium.doc.dir}/src/api" includes="*.dot.ftl" outputRoot="${helium.build.dir}/temp/doc/api/helium"
    69         <fmpp sourceRoot="${helium.dir}/doc/src/api" includes="*.dot.ftl" outputRoot="${docs.build.dir}/temp/doc/api/helium"
   184               replaceExtension="dot.ftl, dot">
    70               replaceExtension="dot.ftl, dot">
   185             <data expandProperties="yes">
    71             <data expandProperties="yes">
   186                 doc: xml(${database.file})
    72                 doc: xml(${database.file})
   187             </data>
    73             </data>
   188         </fmpp>
    74         </fmpp>
   189         <for param="dot.file" parallel="true" threadCount="${number.of.threads}">
    75         <for param="dot.file" parallel="true" threadCount="${number.of.threads}">
   190             <fileset dir="${helium.build.dir}/temp/doc/api/helium" includes="*.dot"/>
    76             <fileset dir="${docs.build.dir}/temp/doc/api/helium" includes="*.dot"/>
   191             <sequential>
    77             <sequential>
   192                 <echo>Processing dot file: @{dot.file}</echo>
    78                 <echo>Processing dot file: @{dot.file}</echo>
   193                 <exec executable="dot" dir="${helium.build.dir}/temp/doc/api/helium">
    79                 <exec executable="dot" dir="${docs.build.dir}/temp/doc/api/helium">
   194                     <arg line="-Tcmap @{dot.file} -O"/>
    80                     <arg line="-Tcmap @{dot.file} -O"/>
   195                 </exec>
    81                 </exec>
   196                 <exec executable="dot" dir="${helium.build.dir}/doc/api">
    82                 <exec executable="dot" dir="${docs.build.dir}/api">
   197                     <arg line="-Tpng @{dot.file} -O"/>
    83                     <arg line="-Tpng @{dot.file} -O"/>
   198                 </exec>
    84                 </exec>
   199             </sequential>
    85             </sequential>
   200         </for>
    86         </for>
   201         <move todir="${helium.build.dir}/doc/api" overwrite="true">
    87         <move todir="${docs.build.dir}/api/helium" overwrite="true">
   202             <fileset dir="${helium.build.dir}/temp/doc/api" includes="*.dot.png"/>
    88             <fileset dir="${docs.build.dir}/temp/doc/api/helium" includes="*.dot.png"/>
   203         </move>
    89         </move>
   204     </target>
    90     </target>
   205     
    91     
   206     
    92     
   207     <!-- Builds the HTML files for the Helium API documentation. -->
    93     <!-- Builds the HTML files for the Helium API documentation. -->
   208     <target name="helium-api-html-docs">
    94     <target name="helium-api-html-docs">
   209         <mkdir dir="${helium.build.dir}/doc/api/helium"/>
    95         <mkdir dir="${docs.build.dir}/api/helium"/>
   210         <copy todir="${helium.build.dir}/temp/doc/api/helium" overwrite="true">
    96         <copy todir="${docs.build.dir}/temp/doc/api/helium" overwrite="true">
   211             <fileset dir="${helium.doc.dir}/src/api"/>
    97             <fileset dir="${helium.dir}/doc/src/api"/>
   212         </copy>
    98         </copy>
   213         <xslt in="${data.model.file}" out="${data.model.parsed}" style="${data.model.xsl}"/>
    99         <fmpp sourceRoot="${docs.build.dir}/temp/doc/api/helium" excludes="*.dot.png,*.dot.ftl,**/*.dot,**/*.cmap,*.bak"
   214         <hlm:parsemodel output="${helium.build.dir}/helium_data_model.xml_parsed" input="${data.model.parsed}"/>
   100               outputRoot="${docs.build.dir}/api/helium"
   215         <fmpp sourceRoot="${helium.build.dir}/temp/doc/api/helium" excludes="*.dot.ftl,**/*.dot,**/*.cmap,*.bak"
       
   216               outputRoot="${helium.build.dir}/doc/api/helium"
       
   217               replaceExtension="html.ftl, html">
   101               replaceExtension="html.ftl, html">
   218             <data expandProperties="yes">
   102             <data expandProperties="yes">
   219                 ant: antProperties()
   103                 ant: antProperties()
   220                 doc: xml(${database.file})
   104                 doc: xml(${database.file})
   221                 data: xml(${helium.build.dir}/helium_data_model.xml_parsed)
       
   222             </data>            
   105             </data>            
   223         </fmpp>
   106         </fmpp>
   224     </target>
   107     </target>
   225     
   108     
   226     
   109     
   227     <!-- Builds the Helium API documentation. -->
   110     <!-- Builds the Helium API documentation. -->
   228     <target name="helium-apidocs" depends="clean-helium-apidoc,database,
   111     <target name="helium-apidocs" depends="clean-helium-apidocs,database,
   229         find-python-dependencies,helium-api-dependency-images,helium-api-html-docs"/>
   112                     helium-api-dependency-images,helium-api-html-docs"/>
   230     
   113     
   231     <!-- Builds the Helium API documentation for customer. -->
       
   232     <target name="customer-apidocs">
       
   233         <mkdir dir="${helium.build.dir}"/>
       
   234         
       
   235         <antcall target="helium-apidocs">
       
   236             <param name="helium.dir" value="."/>
       
   237             <param name="home.files.only" value="true"/>
       
   238             <param name="database.file" location="${helium.build.dir}/database.xml"/>
       
   239         </antcall>
       
   240         <!--
       
   241         <antform title="login information">
       
   242             <textProperty label="password:" property="noe.password" password="true"/>
       
   243         </antform>
       
   244         
       
   245         <antcall target="upload-docs">
       
   246             <param name="helium.dir" value="."/>
       
   247             <param name="documentation.path.root" value="/var/local/www/helium/doc/${customer}"/>
       
   248         </antcall>
       
   249         -->
       
   250     </target>
       
   251     
       
   252     <!-- Generate documentation from the source code. -->
       
   253     <target name="apidocs" depends="python-apidocs,helium-apidocs,java-apidocs,antdoclet,apidocs-search"/>
       
   254     
       
   255     <!-- Macro to generate html docs from rst. -->
       
   256     <macrodef name="rstMacro" uri="http://www.nokia.com/helium">
       
   257         <attribute name="version" default="${helium.version}"/>
       
   258         <attribute name="src" default="${helium.build.dir}/temp/doc"/>
       
   259         <attribute name="output" default="${helium.build.dir}/doc"/>
       
   260         <sequential>
       
   261             <property name="sphinx.lib.dir" location="${helium.dir}/external/python/lib/2.5/Sphinx-0.5.1-py2.5.egg/sphinx" />
       
   262             <if>
       
   263                 <available file="${nokia.python.tools}/sphinxfixsearch.diff"/>
       
   264                 <then>
       
   265                     <patch patchfile="${nokia.python.tools}/sphinxfixsearch.diff" originalfile="${sphinx.lib.dir}/search.py"/>
       
   266                 </then>
       
   267             </if>
       
   268             <exec executable="python" failonerror="${failonerror}">        
       
   269                 <arg file="${python.dir}/sphinx-build.py"/>
       
   270                 <arg value="-b" />
       
   271                 <arg value="html" />            
       
   272                 <arg value="-D" />
       
   273                 <arg value="version=@{version}" />
       
   274                 <arg value="-D" />
       
   275                 <arg value="release=@{version}" />
       
   276                 <arg file="@{src}" />
       
   277                 <arg file="@{output}" />
       
   278             </exec>
       
   279             <if>
       
   280                 <available file="${nokia.python.tools}/sphinxfixsearch.diff"/>
       
   281                 <then>
       
   282                     <patch reverse="true" patchfile="${nokia.python.tools}/sphinxfixsearch.diff" originalfile="${sphinx.lib.dir}/search.py"/>
       
   283                 </then>
       
   284             </if>
       
   285         </sequential>
       
   286     </macrodef>
       
   287     
       
   288     <!-- Generate rst files for docs -->
       
   289     <target name="prep-textdocs" depends="clean-doc-dir,overview-to-html,tools-rst-table,dependency-diagram,dependency-logs,release-diff,helium-user-graph">
       
   290         <mkdir dir="${helium.build.dir}/doc"/>
       
   291         
       
   292         <delete dir="${helium.build.dir}/doc/.doctrees"/>
       
   293         <delete file="${helium.build.dir}/doc/searchindex.json"/>
       
   294         
       
   295         <copy todir="${helium.build.dir}/doc/images">
       
   296             <fileset dir="${helium.doc.dir}/images"/>
       
   297         </copy>
       
   298 
       
   299         <!-- Temporarily copy the image directory so that doc generation will complete happily. -->
       
   300         <copy todir="${helium.build.dir}/temp/doc/images">
       
   301             <fileset dir="${helium.build.dir}/doc/images"/>
       
   302         </copy>
       
   303         <copy todir="${helium.build.dir}/temp/doc">
       
   304             <fileset dir="${helium.doc.dir}/src">
       
   305                 <include name="**/*.rst"/>
       
   306                 <include name="**/*.css"/>
       
   307                 <include name="**/*.jpg"/>
       
   308                 <include name="**/*.dot"/>
       
   309             </fileset>
       
   310         </copy>
       
   311         <copy todir="${helium.build.dir}/temp/doc/nokia" failonerror="false">
       
   312             <fileset dir="${nokia.dir}/doc/src">
       
   313                 <include name="**/*.rst"/>
       
   314                 <include name="**/*.css"/>
       
   315                 <include name="**/*.jpg"/>
       
   316             </fileset>
       
   317         </copy>
       
   318         
       
   319         <mkdir dir="${helium.build.dir}/temp/doc/minibuilds"/>
       
   320         <copy todir="${helium.build.dir}/temp/doc/minibuilds" failonerror="false">
       
   321             <fileset dir="${helium.dir}/tests/minibuilds/">
       
   322                 <include name="*/doc/**/*"/>
       
   323             </fileset>
       
   324         </copy>
       
   325         
       
   326         <fmpp sourceFile="${helium.doc.dir}/src/quick_start_guide.rst.ftl" outputFile="${helium.build.dir}/temp/doc/quick_start_guide.rst">
       
   327             <data expandProperties="yes">
       
   328                 ant: antProperties()
       
   329             </data>            
       
   330         </fmpp>
       
   331         
       
   332         <fileset id="internal.ref.minibuilds" dir="${helium.build.dir}/temp/doc/minibuilds" includes="*/**/index.rst"/>
       
   333         <fmpp sourceFile="${helium.doc.dir}/src/minibuilds.rst.ftl"
       
   334               outputFile="${helium.build.dir}/temp/doc/minibuilds/index.rst">
       
   335             <data expandProperties="yes">
       
   336                 project: antProject()
       
   337             </data>            
       
   338         </fmpp>
       
   339         <fmpp sourceFile="${helium.doc.dir}/src/index.rst.ftl" outputFile="${helium.build.dir}/temp/doc/index.rst">
       
   340             <data expandProperties="yes">
       
   341                 ant: antProperties()
       
   342             </data>            
       
   343         </fmpp>
       
   344         <fmpp sourceFile="${helium.doc.dir}/src/manual/APIs.rst.ftl" outputFile="${helium.build.dir}/temp/doc/manual/APIs.rst">
       
   345             <data expandProperties="yes">
       
   346                 ant: antProperties()
       
   347             </data>            
       
   348         </fmpp>
       
   349         <fmpp sourceFile="${helium.doc.dir}/src/manual/stages.rst.ftl" outputFile="${helium.build.dir}/temp/doc/manual/stages.rst">
       
   350             <data expandProperties="yes">
       
   351                 ant: antProperties()
       
   352             </data>            
       
   353         </fmpp>
       
   354         
       
   355         <copy todir="${helium.build.dir}/temp/doc">
       
   356             <fileset dir="${helium.doc.dir}/src">
       
   357                 <include name="conf.py"/>
       
   358                 <include name=".static"/>
       
   359                 <include name=".templates/**"/>
       
   360                 <include name="*.jpg"/>
       
   361             </fileset>
       
   362         </copy>
       
   363 
       
   364         <!-- Including Helium antlib doc -->
       
   365         <mkdir dir="${helium.build.dir}/temp/doc/helium-antlib"/>
       
   366         <copy todir="${helium.build.dir}/temp/doc/helium-antlib" failonerror="false">
       
   367             <fileset dir="${helium.dir}/external/helium-antlib/doc/src">
       
   368                 <include name="**/*.rst"/>
       
   369                 <include name="**/*.css"/>
       
   370                 <include name="**/*.jpg"/>
       
   371             </fileset>
       
   372         </copy>
       
   373         
       
   374         <for param="dot.file">
       
   375             <fileset dir="${helium.build.dir}/temp/doc/manual" includes="*.dot"/>
       
   376             <sequential>
       
   377                 <exec executable="dot">
       
   378                     <arg line="-Tpng @{dot.file} -O"/>
       
   379                 </exec>
       
   380             </sequential>
       
   381         </for>
       
   382     </target>
       
   383     
       
   384     <!-- Generate HTML documentation from .rst documents with Sphinx.
       
   385     
       
   386     All doc .rst files should be generated or copied into build/temp/doc before being processed into HTML.    
       
   387     -->
       
   388     <target name="textdocs" depends="prep-textdocs">        
       
   389         <hlm:rstMacro />
       
   390         
       
   391         <copy file="${database.file}" todir="${helium.build.dir}/doc"/>
       
   392         <copy file="${helium.build.dir}/temp/doc/default.css" todir="${helium.build.dir}/doc/_static" overwrite="true"/>
       
   393         <copy file="${helium.build.dir}/temp/doc/helium_pallot_small.jpg" todir="${helium.build.dir}/doc/_static" overwrite="true"/>
       
   394         <copy todir="${helium.build.dir}/doc" overwrite="true">
       
   395             <fileset dir="${helium.doc.dir}/src">
       
   396                 <include name="**/*.zip"/>
       
   397             </fileset>
       
   398         </copy>
       
   399     </target>
       
   400     
   114     
   401     <!-- Generate search index for apis -->
   115     <!-- Generate search index for apis -->
   402     <target name="apidocs-search">
   116     <target name="apidocs-search">
   403         <hlm:python>
   117         <hlm:python>
   404 import html2rest
   118 import html2rest
   405 import os
   119 import os
   406 import codecs
   120 import codecs
   407 #import traceback
   121 #import traceback
   408 for root, dirs, files in os.walk(r'${helium.build.dir}/doc/api', topdown=False):
   122 for root, dirs, files in os.walk(r'${docs.build.dir}/api', topdown=False):
   409     for fname in files:
   123     for fname in files:
   410         if '.html' in fname:
   124         if '.html' in fname:
   411             filename = os.path.abspath(os.path.join(root, fname))
   125             filename = os.path.abspath(os.path.join(root, fname))
   412             rstfilename = filename.replace('.html', '.rst')
   126             rstfilename = filename.replace('.html', '.rst')
   413             try:
   127             try:
   426                 print rstfilename + ' has invalid unicode'
   140                 print rstfilename + ' has invalid unicode'
   427                 rstfile.close()
   141                 rstfile.close()
   428                 os.remove(rstfilename)
   142                 os.remove(rstfilename)
   429         </hlm:python>
   143         </hlm:python>
   430         
   144         
   431         <move todir="${helium.build.dir}/temp_search/doc" overwrite="true">
   145         <move todir="${docs.build.dir}/temp_search/doc" overwrite="true">
   432             <fileset dir="${helium.build.dir}/doc/api">
   146             <fileset dir="${docs.build.dir}/api">
   433                 <include name="**/*.rst"/>
   147                 <include name="**/*.rst"/>
   434             </fileset>
   148             </fileset>
   435         </move>
   149         </move>
   436         
   150         
   437         <move todir="${helium.build.dir}/doc/api_backup" overwrite="true">
   151         <move todir="${docs.build.dir}/api_backup" overwrite="true">
   438             <fileset dir="${helium.build.dir}/doc/api"/>
   152             <fileset dir="${docs.build.dir}/api"/>
   439         </move>
   153         </move>
   440         
   154         
   441         <copy file="${helium.doc.dir}/src/api/apisearchindex.rst" tofile="${helium.build.dir}/temp_search/doc/index.rst"/>
   155         <copy file="${helium.dir}/doc/src/api/apisearchindex.rst" tofile="${docs.build.dir}/temp_search/doc/index.rst"/>
   442         
   156         
   443         <copy todir="${helium.build.dir}/temp_search/doc">
   157         <copy todir="${docs.build.dir}/temp_search/doc">
   444             <fileset dir="${helium.doc.dir}/src">
   158             <fileset refid="static.doc.files"/>
   445                 <include name="conf.py"/>
   159         </copy>
   446                 <include name=".static"/>
   160         
   447                 <include name=".templates/**"/>
   161         <hlm:rstMacro src="${docs.build.dir}/temp_search/doc" output="${docs.build.dir}/api"/>
   448                 <include name="*.jpg"/>
   162         
   449             </fileset>
   163         <move todir="${docs.build.dir}/api" overwrite="true">
   450         </copy>
   164             <fileset dir="${docs.build.dir}/api_backup"/>
   451         
   165         </move>
   452         <hlm:rstMacro src="${helium.build.dir}/temp_search/doc" output="${helium.build.dir}/doc/api"/>
   166     </target>
   453         
   167 
   454         <move todir="${helium.build.dir}/doc/api" overwrite="true">
   168     
   455             <fileset dir="${helium.build.dir}/doc/api_backup"/>
   169     <!-- Generate API documentation from the source code. -->
   456         </move>
   170     <target name="apidocs" depends="helium-apidocs,apidocs-search"/>
   457     </target>
   171     
   458     
   172     
   459     <!-- Generate all documentation. -->
   173     <!-- Macro to generate HTML docs from rst. -->
   460     <target name="add-policies-to-docs" unless="env.HLM_SUBCON">
   174     <macrodef name="rstMacro" uri="http://www.nokia.com/helium">
   461         <hlm:updatePolicy policy="7" filename="distribution.policy.S60">         
   175         <attribute name="version" default="${helium.version}"/>
   462             <dirset dir="${helium.dir}" includes="${helium.build.dir}/doc/**/*"/>        
   176         <attribute name="src" default="${docs.build.dir}/temp/doc"/>
   463         </hlm:updatePolicy>   
   177         <attribute name="output" default="${docs.build.dir}"/>
   464     </target>
   178         <sequential>
   465     
   179             <property name="sphinx.lib.dir" location="${helium.dir}/external/python/lib/common/Sphinx-0.5.1-py2.5.egg/sphinx" />
   466     
   180             <if>
   467     <!-- Creates XML and .rst documents describing the difference between
   181                 <available file="${nokia.python.tools}/sphinxfixsearch.diff"/>
   468     this version of Helium and the previous major release. -->
   182                 <then>
   469     <target name="release-diff" depends="database" unless="env.HLM_SUBCON">
   183                     <patch patchfile="${nokia.python.tools}/sphinxfixsearch.diff" originalfile="${sphinx.lib.dir}/search.py"/>
   470         <mkdir dir="${helium.build.dir}/doc"/>
   184                 </then>
   471         <property name="last.major.release.database.url" value="${documentation.url.root}/${last.major.helium.version}/database.xml"/>
   185             </if>
   472         <hlm:python>
   186             <if>
   473 import urllib
   187                 <resourcecount when="greater" count="0">
   474 import helium.documentation
   188                     <fileset dir="@{src}" includes="**/*.rst"/>
   475 
   189                 </resourcecount>
   476 old_db_file = urllib.urlopen(r'${last.major.release.database.url}')
   190                 <then>
   477 writer = helium.documentation.APIDeltaWriter(old_db_file, r'${database.file}')
   191                     <exec executable="python" failonerror="true">        
   478 writer.write(r'${helium.build.dir}/doc/api_changes.xml')
   192                         <arg file="${python.dir}/common/sphinx-build.py"/>
   479         </hlm:python>
   193                         <arg value="-b" />
   480         <fmpp sourceFile="${helium.doc.dir}/src/api_changes.rst.ftl" outputFile="${helium.build.dir}/temp/doc/api_changes.rst">
   194                         <arg value="html" />            
   481             <data expandProperties="yes">
   195                         <arg value="-D" />
   482                 doc: xml(${helium.build.dir}/doc/api_changes.xml)
   196                         <arg value="version=@{version}" />
   483                 old_release: ${last.major.helium.version}
   197                         <arg value="-D" />
   484                 new_release: ${helium.version}
   198                         <arg value="release=@{version}" />
   485             </data>
   199                         <arg file="@{src}" />
   486         </fmpp>
   200                         <arg file="@{output}" />
   487     </target>
   201                     </exec>
   488     
   202                 </then>
   489     <!-- Generate docs for Symbian Foundataion -->
   203             </if>
   490     <target name="docs-sf">
   204             <if>
   491         <delete dir="${helium.build.dir}"/>
   205                 <available file="${nokia.python.tools}/sphinxfixsearch.diff"/>
   492         <antcall target="helium-subcon-release"/>
   206                 <then>
   493         <unzip src="${helium.build.dir}/helium_${helium.version}_subcon.zip" dest="${helium.build.dir}/helium_${helium.version}_subcon" overwrite="true" />
   207                     <patch reverse="true" patchfile="${nokia.python.tools}/sphinxfixsearch.diff" originalfile="${sphinx.lib.dir}/search.py"/>
   494         <!---->
   208                 </then>
   495         <exec executable="cmd" dir="${helium.build.dir}/helium_${helium.version}_subcon/helium">
   209             </if>
   496             <env key="HELIUM_HOME" value="${helium.build.dir}/helium_${helium.version}_subcon/helium"/>
   210         </sequential>
   497             <env key="PYTHONPATH" value="${env.PYTHONPATH}"/>
   211     </macrodef>
   498             <env key="ANT_ARGS" value="${env.ANT_ARGS}"/>
   212     
   499             <arg line="/C hlm.bat"/>
   213     
   500             <arg value="docs"/>
   214     <!-- Generate rst files for docs -->
   501             <arg value="-Dpython.tools=${python.tools}"/>
   215     <target name="prep-textdocs">
   502             <arg value="-Dsf=true"/>
   216         <echo>Building docs into ${docs.build.dir}.</echo>
   503         </exec>
   217         <mkdir dir="${docs.build.dir}/images"/>
   504     </target>
   218         
   505     
   219         <delete dir="${docs.build.dir}/.doctrees"/>
   506     <!-- generate all the user documentation for helium -->
   220         <delete file="${docs.build.dir}/searchindex.json"/>
   507     <target name="docs" depends="clean-doc-dir,database,apidocs,textdocs,add-policies-to-docs"/>
   221         
   508     
   222         <copy todir="${docs.build.dir}/images" failonerror="false">
   509     <!-- Clean old build/doc dir. -->
   223             <fileset dir="${doc.src.dir}/images"/>
   510     <target name="clean-doc-dir">
   224         </copy>
   511         <delete dir="build/doc"/>
   225 
   512         <delete dir="build/temp/doc"/>        
   226         <!-- Temporarily copy the image directory so that doc generation will complete happily.-->
   513     </target>
   227         <copy todir="${docs.build.dir}/temp/doc/images" failonerror="false">
   514     
   228             <fileset dir="${docs.build.dir}/images"/>
   515     <!-- Connect to home drive if it is not connected for .netrc file. -->
   229         </copy>
   516     <target name="check-home-drive">
   230 
   517         <exec executable="cmd">
   231         <if>
   518             <arg value="/c"/>
   232             <available file="${doc.src.dir}/src"/>
   519             <arg value="${helium.dir}/tools/common/bin/check_home_drv.bat"/>
   233             <then>
   520             <arg value=">nul"/>
   234                 <copy todir="${docs.build.dir}/temp/doc">
   521         </exec>
   235                     <fileset dir="${doc.src.dir}/src">
   522     </target>
   236                         <include name="**/*.rst"/>
   523     
   237                         <include name="**/*.css"/>
   524     <!-- Upload generated HTML docs to the Helium server. -->
   238                         <include name="**/*.jpg"/>
   525     <target name="upload-docs" depends="check-home-drive">
   239                         <include name="**/*.dot"/>
   526         <property name="documentation.path" value="${documentation.path.root}"/>
   240                     </fileset>
   527         <property name="docs.zip" value="${helium.build.dir}/helium-docs.zip"/>
   241                 </copy>
   528 
   242                 
   529         <!-- Python API docs. -->
   243                 <!--<fileset id="internal.ref.minibuilds" dir="${docs.build.dir}/temp/doc/minibuilds" includes="*/**/index.rst"/>-->
   530         <delete file="${docs.zip}"/>
   244                 <fmpp sourceRoot="${doc.src.dir}/src"
   531         <zip destfile="${docs.zip}">
   245                       outputRoot="${docs.build.dir}/temp/doc" includes="*.rst.ftl" removeExtensions="ftl" excludes="api_changes.rst.ftl,minibuilds.rst.ftl">
   532             <fileset dir="${helium.build.dir}/doc" includes="**/*"/>
   246                     <data expandProperties="yes">
   533         </zip>
   247                         ant: antProperties()
   534         <sshexec host="${documentation.host}"
   248                         project: antProject()
   535                  username="${user.name}"
   249                     </data>
   536                  keyfile="${env.HOME}/.ssh/id_rsa_openssh.ppk"
   250                 </fmpp>
   537                  trust="true"
   251             </then>
   538                  command="mkdir -p ${documentation.path}"/>
   252         </if>
   539         <scp todir="${user.name}@${documentation.host}:${documentation.path}"
   253         
   540           keyfile="${env.HOME}/.ssh/id_rsa_openssh.ppk"
   254         <!-- Copy static content files from Helium -->
   541           passphrase=""
   255         <copy todir="${docs.build.dir}/temp/doc">
   542           trust="true"
   256             <fileset refid="static.doc.files"/>
   543           sftp="true"
   257         </copy>
   544           file="${docs.zip}"/>
   258         
   545         <sshexec host="${documentation.host}"
   259         <for param="dot.file">
   546                  username="${user.name}"
   260             <fileset dir="${docs.build.dir}/temp/doc" includes="manual/*.dot"/>
   547                  keyfile="${env.HOME}/.ssh/id_rsa_openssh.ppk"
       
   548                  trust="true"
       
   549                  command="cd ${documentation.path}; unzip -u -o helium-docs.zip"/>
       
   550     </target>
       
   551     
       
   552     
       
   553     <!-- Upload generated HTML docs to the Helium server. -->
       
   554     <target name="upload-release-docs">
       
   555         <property name="documentation.path" value="${documentation.path.root}/${helium.version}"/>
       
   556         <antcall target="upload-docs"/>
       
   557     </target>
       
   558     
       
   559     
       
   560   <!-- create slides from images -->
       
   561     <target name="slides">
       
   562         <mkdir dir="${helium.build.dir}/slides"/>
       
   563     
       
   564         <copy todir="${helium.build.dir}/slides">
       
   565             <fileset dir="${helium.doc.dir}/slides"/>
       
   566         </copy>
       
   567 
       
   568         <copy todir="${helium.build.dir}/slides/images">
       
   569             <fileset dir="${helium.doc.dir}/slides/images"/>
       
   570         </copy>
       
   571     
       
   572         <for param="document">
       
   573             <fileset dir="${helium.build.dir}/slides" includes="**/*.rst"/>
       
   574             <sequential>
   261             <sequential>
   575                 <propertyregex property="document.no.ext" input="@{document}" regexp="\.rst$" replace="" override="true"/>
   262                 <echo>Building dot file: @{dot.file}</echo>
   576                 <if>
   263                 <exec executable="dot">
   577                     <not>
       
   578                         <uptodate srcfile="@{document}" targetfile="${document.no.ext}.html"/>
       
   579                     </not>
       
   580                     <then>
       
   581                         <echo>Building doc: @{document}</echo>
       
   582                         <exec executable="python" dir="${helium.doc.dir}" failonerror="${failonerror}">
       
   583                             <arg value="${nokia.python.tools}/rst2s5.py"/>
       
   584                             <arg value="@{document}"/>
       
   585                             <arg value="${document.no.ext}.html"/>
       
   586                         </exec>
       
   587                     </then>
       
   588                 </if>
       
   589             </sequential>
       
   590         </for>
       
   591     </target>
       
   592 
       
   593         
       
   594     <!-- Generate HTML documentation from .rst documents.
       
   595     
       
   596     TODO: Remove this old method. -->
       
   597     <target name="textdocs-old" depends="overview-to-html">
       
   598         <mkdir dir="${helium.build.dir}/doc"/>
       
   599         <copy todir="${helium.build.dir}/doc-old">
       
   600             <fileset dir="${helium.doc.dir}/src" excludes="cover.rst"/>
       
   601             <fileset dir="${nokia.dir}/doc/src"/>
       
   602         </copy>
       
   603         
       
   604         <copy todir="${helium.build.dir}/doc-old/images">
       
   605             <fileset dir="${helium.doc.dir}/images"/>
       
   606         </copy>
       
   607         
       
   608         <for param="document">
       
   609             <fileset dir="${helium.build.dir}/doc-old">
       
   610                 <include name="**/*.rst" />
       
   611                 <exclude name="index.rst" /><!-- index.rst is the top-level doc for new-style docs -->
       
   612             </fileset>
       
   613             <sequential>
       
   614                 <propertyregex property="document.no.ext" input="@{document}" regexp="\.rst$" replace="" override="true"/>
       
   615                 <if>
       
   616                     <not>
       
   617                         <uptodate srcfile="@{document}" targetfile="${document.no.ext}.html"/>
       
   618                     </not>
       
   619                     <then>
       
   620                         <echo>Building doc: @{document}</echo>                        
       
   621                         <exec executable="python" dir="${helium.doc.dir}" failonerror="${failonerror}">
       
   622                             <!--<env key="PYTHONPATH" value="${helium.dir}\${python25.lib};tools\common\python\lib"/>-->
       
   623                             <arg value="${nokia.python.tools}\rst2html.py"/>
       
   624                             <arg line="--traceback --no-toc-backlinks"/>
       
   625                             <!-- -stylesheet-path nokia_style.css -->
       
   626                             <arg value="@{document}"/>
       
   627                             <arg value="${document.no.ext}.html"/>
       
   628                         </exec>
       
   629                     </then>
       
   630                 </if>
       
   631             </sequential>
       
   632         </for>
       
   633     </target>
       
   634     
       
   635     
       
   636     <!-- Search Python internal module used in helium -->
       
   637     <target name="find-python-dependencies" depends="database">    
       
   638         <hlm:assertPropertySet property="helium.dir" message="Property helium.dir is not defined." />
       
   639         <hlm:assertPropertySet property="database.file" message="Property database.file is not defined."/>
       
   640         <hlm:python>
       
   641 from __future__ import with_statement
       
   642 import re
       
   643 import os
       
   644 import string
       
   645 import amara
       
   646 import codecs
       
   647 import ant
       
   648 
       
   649 setpath = r'${helium.dir}'+'/tools'
       
   650 
       
   651 print "Searching under "+setpath
       
   652 
       
   653 dbPath = r'${database.file}'
       
   654 dbPath = 'file:///'+ dbPath.replace('\\','/')
       
   655 dbPrj = amara.parse(dbPath)
       
   656 
       
   657 for root, dirs, files in os.walk(setpath, topdown=False):
       
   658     for fname in files:
       
   659         filePattern = re.compile('.ant.xml$')
       
   660         fileMatch = filePattern.search(fname)
       
   661         modulelist = []
       
   662         if (fileMatch):
       
   663             filePath = os.path.abspath(os.path.join(root, fname))
       
   664             with open(filePath) as f:
       
   665                 filePathAmara = 'file:///'+ filePath.replace('\\','/')
       
   666                 curPrj=amara.parse(filePathAmara)
       
   667                 for line in f:
       
   668                     linePattern = re.compile('^import')
       
   669                     lineMatch = linePattern.search(line)
       
   670                     if ((lineMatch) and (line.find('.')==-1)):
       
   671                         newLine = line.replace('import','')
       
   672                         newLine = newLine.replace(',','')
       
   673                         moduleArray = newLine.split()
       
   674                         for curModule in moduleArray:
       
   675                             try:
       
   676                                 importModule = __import__(curModule)
       
   677                                 modulePath=importModule.__file__
       
   678                                 if (modulePath.find('\\helium\\tools')!= -1):
       
   679                                     for projectList in dbPrj.antDatabase.project:
       
   680                                         if (projectList.name==curPrj.project.name):
       
   681                                             if not (curModule in modulelist):
       
   682                                                 print " Python module : " +curModule
       
   683                                                 moduleElement = projectList.pythonDependency.xml_create_element(u'module', content=u''+curModule)
       
   684                                                 projectList.pythonDependency.xml_append(moduleElement)
       
   685                                             modulelist = modulelist + [curModule]
       
   686                             except Exception, e:
       
   687                                 error ="yes"
       
   688 
       
   689 
       
   690 file_object = codecs.open(r'${database.file}', 'w', "utf_8")
       
   691 file_object.write(dbPrj.xml(indent=u"yes"))
       
   692 file_object.close()
       
   693     
       
   694         </hlm:python>
       
   695     </target>
       
   696     
       
   697     
       
   698     <!-- Reads the Java libraries and extracts a list of their versions. -->
       
   699     <target name="library-versions">    
       
   700         <script language="jython" setbeans="false">
       
   701 import java.io
       
   702 import java.util.jar
       
   703 antlibsDir = java.io.File('external/antlibs')
       
   704 print antlibsDir
       
   705 jarFiles = antlibsDir.listFiles()
       
   706 for jar in jarFiles:
       
   707     if jar.getName().endswith('jar'):
       
   708         jarFile = java.util.jar.JarFile(jar)
       
   709         manifest = jarFile.getManifest()
       
   710         attributes = manifest.getMainAttributes()
       
   711         implementationVersion = attributes.getValue('Implementation-Version')
       
   712         print jar.getName() + ': ' + str(implementationVersion)
       
   713         </script>
       
   714     </target>
       
   715     
       
   716     <!-- Generates a subcon dependancy diagram based on Egg and Jars files -->
       
   717     <target name="dependency-diagram-subcon">
       
   718         <fileset id="subcon.jar.files" dir="${helium.dir}">
       
   719             <include name="external/antlibs/*.jar"/>
       
   720             <include name="external/jep/**/*.jar"/>
       
   721             <include name="external/helium-antlib/bin/**/*.jar"/>
       
   722             <include name="tools/**/*.jar"/>
       
   723         </fileset>
       
   724         <antcall target="dependency-diagram">
       
   725             <reference refid="subcon.jar.files" torefid="jar.files"/>
       
   726             <param name="python.exclude.dir" value="${helium.dir}\external\python\lib\2.5\internal"/>
       
   727             <param name="dependency.grph" value="${helium.build.dir}/doc/images/dependencies_subcon.grph"/>
       
   728             <param name="subcon" value="true"/>
       
   729         </antcall>
       
   730     </target>
       
   731     
       
   732     <fileset id="jar.files" dir="${helium.dir}">
       
   733         <include name="external/antlibs/**/*.jar"/>
       
   734         <include name="external/jep/**/*.jar"/>
       
   735         <include name="external/helium-antlib/**/*.jar"/>
       
   736         <include name="tools/**/*.jar"/>
       
   737         <include name="extensions/nokia/external/antlibs/**/*.jar"/>
       
   738     </fileset>
       
   739     
       
   740     <!-- Generates a dependancy diagram based on Egg and Jars files -->
       
   741     <target name="dependency-diagram">
       
   742         <mkdir dir="${helium.build.dir}/doc/images"/>
       
   743         <mkdir dir="${temp.build.dir}"/>
       
   744         <property name="dependency.grph" value="${helium.build.dir}/doc/images/dependencies.grph"/>
       
   745         
       
   746         <!---->
       
   747         <copy todir="${temp.build.dir}/dependencylibs" flatten="true">
       
   748             <fileset refid="jar.files"/>
       
   749         </copy>
       
   750         
       
   751         <hlm:antdependency outputFile="${temp.build.dir}/antdependencies.grph">
       
   752             <fileset dir="${temp.build.dir}/dependencylibs" includes="*.jar"/>
       
   753         </hlm:antdependency>
       
   754         
       
   755         <taskdef name="jaranalyzer" classname="com.kirkk.analyzer.textui.JarAnalyzerTask"/>
       
   756         <jaranalyzer srcdir="${temp.build.dir}/dependencylibs" destfile="${dependency.grph}" summaryclass="com.kirkk.analyzer.textui.DOTSummary"/>
       
   757         
       
   758         <loadfile srcfile="${temp.build.dir}/antdependencies.grph" property="antdependencies"/>
       
   759         <replace file="${dependency.grph}" token="}" value="${antdependencies}}"/>
       
   760         
       
   761         <antcall target="dependency-grouping"/>
       
   762         
       
   763         <exec executable="dot">
       
   764             <arg line="-Tpng -Grankdir=LR -Nshape=box -Nfontsize=9 -Nwidth=0.3 -Nheight=0.2 ${dependency.grph} -O"/>
       
   765         </exec>
       
   766         
       
   767         <delete dir="${temp.build.dir}/dependencylibs"/>
       
   768         
       
   769     </target>
       
   770     
       
   771     <!-- Private: -->
       
   772     <target name="dependency-grouping">
       
   773         <property name="dependency.grph" value="${helium.build.dir}/doc/images/dependencies.grph"/>
       
   774         <mkdir dir="${helium.build.dir}/doc/images"/>
       
   775         <property name="python.internal.dir" value="${nokia.dir}\external\python\lib\2.5"/>
       
   776         <property name="subcon" value=""/>
       
   777         <property name="ivy.xml.file" value="${helium.dir}/config/ivy/ivy.xml"/>
       
   778         <hlm:python>
       
   779 import os
       
   780 import dependancygraph
       
   781 
       
   782 dependancygraph.createGraph(r'${ivy.xml.file}', r'${dependency.grph}', r'${python.dir}', r'${python.internal.dir}', r'${subcon}')
       
   783         </hlm:python>
       
   784         <!--
       
   785         <exec executable="dot">
       
   786             <arg line="-Tpng -Grankdir=LR -Nshape=box -Nfontsize=9 -Nwidth=0.3 -Nheight=0.2 ${dependency.egg.grph} -O"/>
       
   787         </exec>
       
   788         -->
       
   789     </target>
       
   790     
       
   791     <!-- Generates a dependancy diagram of ant projects to helium external files -->
       
   792     <target name="dependency-external">
       
   793         <property name="dependency.external.grph" value="${helium.build.dir}/doc/images/dependencies_external.grph"/>
       
   794         <copy file="${database.file}" tofile="${database.file}.parsed" overwrite="true">
       
   795             <filterchain>
       
   796                 <expandproperties/>
       
   797             </filterchain>
       
   798         </copy>
       
   799         <hlm:python>
       
   800 import os
       
   801 import dependancygraph
       
   802 
       
   803 dependancygraph.externalDependancies(r'${database.file}.parsed', r'${dependency.external.grph}')
       
   804         </hlm:python>
       
   805         <!---->
       
   806         <exec executable="dot">
       
   807             <arg line="-Tpng -Grankdir=LR -Nshape=box -Nfontsize=9 -Nwidth=0.3 -Nheight=0.2 ${dependency.external.grph} -O"/>
       
   808         </exec>
       
   809         
       
   810     </target>
       
   811     
       
   812     <!-- Private: Convert db file -->
       
   813     <target name="dependency-db-convert" depends="database">
       
   814         <copy file="${database.file}" tofile="${database.file}.parsed" overwrite="true">
       
   815             <filterchain>
       
   816                 <expandproperties/>
       
   817             </filterchain>
       
   818         </copy>
       
   819     </target>
       
   820     
       
   821     <!-- Generates a dependancy diagram of log files -->
       
   822     <target name="dependency-logs">
       
   823         <property name="dependency.external.grph" value="${helium.build.dir}/doc/images/dependencies_log.grph"/>
       
   824         
       
   825         <antcall target="dependency-db-convert" inheritAll="false">
       
   826             <param name="build.drive" value="build.drive"/>
       
   827             <param name="build.id" value="build.id"/>
       
   828             <param name="build.log.dir" value="/output/logs"/>
       
   829         </antcall>
       
   830         
       
   831         <hlm:python>
       
   832 import os
       
   833 import dependancygraph
       
   834 
       
   835 dependancygraph.findLogFiles(r'${database.file}.parsed', r'${dependency.external.grph}')
       
   836         </hlm:python>
       
   837         <!---->
       
   838         <exec executable="dot">
       
   839             <arg line="-Tpng -Grankdir=LR -Nshape=box -Nfontsize=9 -Nwidth=0.3 -Nheight=0.2 ${dependency.external.grph} -O"/>
       
   840         </exec>
       
   841         
       
   842     </target>
       
   843     
       
   844     <!-- Download data listening logs and extract data -->
       
   845     <target name="parse-datalistening">
       
   846         <exec executable="python" dir="${helium.dir}/tools/common/python/lib" failonerror="${failonerror}">
       
   847             <arg value="parsedatalistening.py"/>
       
   848         </exec>
       
   849     </target>
       
   850 
       
   851     <!-- Creates user flow diagram -->
       
   852     <target name="helium-user-graph">
       
   853         <mkdir dir="${helium.build.dir}/doc/api"/>
       
   854         <fmpp sourcefile="${helium.doc.dir}/src/user-graph.dot.ftl" outputfile="${helium.build.dir}/temp/doc/user-graph.dot">
       
   855             <data expandProperties="yes">
       
   856               ant: antProperties()
       
   857             </data>
       
   858         </fmpp>
       
   859         <for param="dot.file">
       
   860             <fileset dir="${helium.build.dir}/temp/doc" includes="user-graph.dot"/>
       
   861             <sequential>
       
   862                 <echo>Processing dot file: @{dot.file}</echo>
       
   863                 <exec executable="dot" dir="${helium.build.dir}/temp/doc/">
       
   864                     <arg line="-Tcmap @{dot.file} -O"/>
       
   865                 </exec>
       
   866                 <exec executable="dot" dir="${helium.build.dir}/doc/api">
       
   867                     <arg line="-Tpng @{dot.file} -O"/>
   264                     <arg line="-Tpng @{dot.file} -O"/>
   868                 </exec>
   265                 </exec>
   869             </sequential>
   266             </sequential>
   870         </for>
   267         </for>
   871         <move todir="${helium.build.dir}/doc/images" overwrite="true">
   268     </target>
   872             <fileset dir="${helium.build.dir}/temp/doc" includes="user-graph.dot.png"/>
   269     
   873         </move>
   270     
   874     </target>
   271     <!-- Generate HTML documentation from .rst documents with Sphinx.
       
   272     
       
   273     All doc .rst files should be generated or copied into build/temp/doc before being processed into HTML.    
       
   274     -->
       
   275     <target name="textdocs" depends="prep-textdocs">        
       
   276         <hlm:rstMacro />
       
   277         
       
   278         <copy file="${database.file}" todir="${docs.build.dir}"/>
       
   279         <copy file="${docs.build.dir}/temp/doc/default.css" todir="${docs.build.dir}/_static" overwrite="true" failonerror="true"/>
       
   280         <copy file="${docs.build.dir}/temp/doc/helium_pallot_small.jpg" todir="${docs.build.dir}/_static" overwrite="true"/>
       
   281         <copy todir="${docs.build.dir}" overwrite="true">
       
   282             <fileset dir="${doc.src.dir}/src">
       
   283                 <include name="**/*.zip"/>
       
   284             </fileset>
       
   285         </copy>
       
   286     </target>
       
   287 
       
   288     
       
   289     <!-- Clean old build/doc dir. -->
       
   290     <target name="clean-docs">
       
   291         <delete dir="${docs.build.dir}"/>
       
   292     </target>
       
   293     
       
   294     
       
   295     <!-- generate all the user documentation for helium -->
       
   296     <target name="docs" depends="clean-docs,apidocs,textdocs"/>
   875 
   297 
   876 </project>
   298 </project>