buildframework/helium/tools/common/docs.ant.xml
author timothy.murphy@nokia.com
Tue, 25 May 2010 12:38:07 +0100
branchfix
changeset 574 819bc4ffb37b
parent 217 0f5e3a7fb6af
child 587 85df38eb4012
permissions -rw-r--r--
Release note: Bug 2809 - [Raptor] Intermediate Resource Filenames not unique, rom fails to boot
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     1
<?xml version="1.0" encoding="UTF-8"?>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     2
<!-- 
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     3
============================================================================ 
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     4
Name        : docs.ant.xml 
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     5
Part of     : Helium 
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     6
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     7
Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     8
All rights reserved.
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     9
This component and the accompanying materials are made available
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    10
under the terms of the License "Eclipse Public License v1.0"
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    11
which accompanies this distribution, and is available
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    12
at the URL "http://www.eclipse.org/legal/epl-v10.html".
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    13
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    14
Initial Contributors:
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    15
Nokia Corporation - initial contribution.
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    16
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    17
Contributors:
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    18
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    19
Description:
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    20
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    21
============================================================================
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    22
-->
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    23
<!--* @package framework -->
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    24
<project name="internal.docs" xmlns:hlm="http://www.nokia.com/helium" xmlns:ivy="antlib:org.apache.ivy.ant">
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    25
    <description>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    26
    Documentation generation targets.
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    27
    </description>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    28
    
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    29
    <!-- Location of documentation source.
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    30
    @type string
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    31
    @scope public
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    32
    -->
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    33
    <property name="doc.src.dir" location="${basedir}/doc" />
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    34
    
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    35
    <!-- The location where the docs will be built.
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    36
    @type string
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    37
    @scope private -->
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    38
    <property name="docs.build.dir" location="${basedir}/build/doc" />
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    39
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    40
    <fileset id="python.library.files" dir="${helium.dir}">
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    41
        <include name="extensions/nokia/tools/common/python/lib/**/*.py"/>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    42
        <include name="tools/common/python/lib/**/*.py"/>
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    43
        <include name="external/helium-antlib/python/**/*.py"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    44
        <include name="extensions/nokia/external/helium-nokia-antlib/python/**/*.py"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    45
    </fileset>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    46
    
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    47
    <fileset id="static.doc.files" dir="${helium.dir}/doc/src">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    48
        <include name="conf.py"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    49
        <include name=".static"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    50
        <include name=".templates/**"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    51
        <include name="*.jpg"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    52
        <include name="*.css"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    53
    </fileset>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    54
        
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    55
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    56
    <!-- Cleans the Helium API documentation. -->
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    57
    <target name="clean-helium-apidocs">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    58
        <delete dir="${docs.build.dir}/api/helium"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    59
        <delete dir="${docs.build.dir}/temp/doc/api/helium"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    60
    </target>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    61
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    62
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    63
    <!-- Creates images of the dependencies for all Ant targets.
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    64
        
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    65
    This includes creating a cmap file that is included in the HTML document,
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    66
    so the boxes in the image are linked to their targets. -->
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    67
    <target name="helium-api-dependency-images">
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    68
        <mkdir dir="${docs.build.dir}/api/helium"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    69
        <fmpp sourceRoot="${helium.dir}/doc/src/api" includes="*.dot.ftl" outputRoot="${docs.build.dir}/temp/doc/api/helium"
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    70
              replaceExtension="dot.ftl, dot">
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    71
            <data expandProperties="yes">
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    72
                doc: xml(${database.file})
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    73
            </data>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    74
        </fmpp>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    75
        <for param="dot.file" parallel="true" threadCount="${number.of.threads}">
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    76
            <fileset dir="${docs.build.dir}/temp/doc/api/helium" includes="*.dot"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    77
            <sequential>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    78
                <echo>Processing dot file: @{dot.file}</echo>
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    79
                <exec executable="dot" dir="${docs.build.dir}/temp/doc/api/helium">
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    80
                    <arg line="-Tcmap @{dot.file} -O"/>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    81
                </exec>
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    82
                <exec executable="dot" dir="${docs.build.dir}/api">
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    83
                    <arg line="-Tpng @{dot.file} -O"/>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    84
                </exec>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    85
            </sequential>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    86
        </for>
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    87
        <move todir="${docs.build.dir}/api/helium" overwrite="true">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    88
            <fileset dir="${docs.build.dir}/temp/doc/api/helium" includes="*.dot.png"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    89
        </move>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    90
    </target>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    91
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    92
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    93
    <!-- Builds the HTML files for the Helium API documentation. -->
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    94
    <target name="helium-api-html-docs">
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    95
        <mkdir dir="${docs.build.dir}/api/helium"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    96
        <copy todir="${docs.build.dir}/temp/doc/api/helium" overwrite="true">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    97
            <fileset dir="${helium.dir}/doc/src/api"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    98
        </copy>
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
    99
        <fmpp sourceRoot="${docs.build.dir}/temp/doc/api/helium" excludes="*.dot.png,*.dot.ftl,**/*.dot,**/*.cmap,*.bak"
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   100
              outputRoot="${docs.build.dir}/api/helium"
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   101
              replaceExtension="html.ftl, html">
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   102
            <data expandProperties="yes">
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   103
                ant: antProperties()
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   104
                doc: xml(${database.file})
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   105
            </data>            
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   106
        </fmpp>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   107
    </target>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   108
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   109
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   110
    <!-- Builds the Helium API documentation. -->
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   111
    <target name="helium-apidocs" depends="clean-helium-apidocs,database,
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   112
                    helium-api-dependency-images,helium-api-html-docs"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   113
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   114
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   115
    <!-- Generate search index for apis -->
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   116
    <target name="apidocs-search">
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   117
        <hlm:python>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   118
import html2rest
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   119
import os
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   120
import codecs
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   121
#import traceback
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   122
for root, dirs, files in os.walk(r'${docs.build.dir}/api', topdown=False):
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   123
    for fname in files:
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   124
        if '.html' in fname:
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   125
            filename = os.path.abspath(os.path.join(root, fname))
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   126
            rstfilename = filename.replace('.html', '.rst')
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   127
            try:
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   128
                out = open(rstfilename, 'w')
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   129
                html2rest.html2rest(html2rest.readsoup(filename), out)
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   130
            except:
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   131
                #traceback.print_exc()
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   132
                print filename + ' failed to be converted to rst'
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   133
            finally:
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   134
                out.close()
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   135
                
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   136
            try:
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   137
                rstfile = codecs.open(rstfilename, 'r', 'utf8')
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   138
                rstfile.read()
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   139
            except:
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   140
                print rstfilename + ' has invalid unicode'
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   141
                rstfile.close()
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   142
                os.remove(rstfilename)
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   143
        </hlm:python>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   144
        
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   145
        <move todir="${docs.build.dir}/temp_search/doc" overwrite="true">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   146
            <fileset dir="${docs.build.dir}/api">
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   147
                <include name="**/*.rst"/>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   148
            </fileset>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   149
        </move>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   150
        
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   151
        <move todir="${docs.build.dir}/api_backup" overwrite="true">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   152
            <fileset dir="${docs.build.dir}/api"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   153
        </move>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   154
        
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   155
        <copy file="${helium.dir}/doc/src/api/apisearchindex.rst" tofile="${docs.build.dir}/temp_search/doc/index.rst"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   156
        
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   157
        <copy todir="${docs.build.dir}/temp_search/doc">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   158
            <fileset refid="static.doc.files"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   159
        </copy>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   160
        
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   161
        <hlm:rstMacro src="${docs.build.dir}/temp_search/doc" output="${docs.build.dir}/api"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   162
        
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   163
        <move todir="${docs.build.dir}/api" overwrite="true">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   164
            <fileset dir="${docs.build.dir}/api_backup"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   165
        </move>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   166
    </target>
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   167
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   168
    
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   169
    <!-- Generate API documentation from the source code. -->
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   170
    <target name="apidocs" depends="helium-apidocs,apidocs-search"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   171
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   172
    
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   173
    <!-- Macro to generate HTML docs from rst. -->
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   174
    <macrodef name="rstMacro" uri="http://www.nokia.com/helium">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   175
        <attribute name="version" default="${helium.version}"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   176
        <attribute name="src" default="${docs.build.dir}/temp/doc"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   177
        <attribute name="output" default="${docs.build.dir}"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   178
        <sequential>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   179
            <property name="sphinx.lib.dir" location="${helium.dir}/external/python/lib/common/Sphinx-0.5.1-py2.5.egg/sphinx" />
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   180
            <if>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   181
                <available file="${nokia.python.tools}/sphinxfixsearch.diff"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   182
                <then>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   183
                    <patch patchfile="${nokia.python.tools}/sphinxfixsearch.diff" originalfile="${sphinx.lib.dir}/search.py"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   184
                </then>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   185
            </if>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   186
            <if>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   187
                <resourcecount when="greater" count="0">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   188
                    <fileset dir="@{src}" includes="**/*.rst"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   189
                </resourcecount>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   190
                <then>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   191
                    <exec executable="python" failonerror="true">        
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   192
                        <arg file="${python.dir}/common/sphinx-build.py"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   193
                        <arg value="-b" />
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   194
                        <arg value="html" />            
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   195
                        <arg value="-D" />
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   196
                        <arg value="version=@{version}" />
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   197
                        <arg value="-D" />
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   198
                        <arg value="release=@{version}" />
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   199
                        <arg file="@{src}" />
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   200
                        <arg file="@{output}" />
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   201
                    </exec>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   202
                </then>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   203
            </if>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   204
            <if>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   205
                <available file="${nokia.python.tools}/sphinxfixsearch.diff"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   206
                <then>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   207
                    <patch reverse="true" patchfile="${nokia.python.tools}/sphinxfixsearch.diff" originalfile="${sphinx.lib.dir}/search.py"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   208
                </then>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   209
            </if>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   210
        </sequential>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   211
    </macrodef>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   212
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   213
    
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   214
    <!-- Generate rst files for docs -->
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   215
    <target name="prep-textdocs">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   216
        <echo>Building docs into ${docs.build.dir}.</echo>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   217
        <mkdir dir="${docs.build.dir}/images"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   218
        
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   219
        <delete dir="${docs.build.dir}/.doctrees"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   220
        <delete file="${docs.build.dir}/searchindex.json"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   221
        
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   222
        <copy todir="${docs.build.dir}/images" failonerror="false">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   223
            <fileset dir="${doc.src.dir}/images"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   224
        </copy>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   225
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   226
        <!-- Temporarily copy the image directory so that doc generation will complete happily.-->
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   227
        <copy todir="${docs.build.dir}/temp/doc/images" failonerror="false">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   228
            <fileset dir="${docs.build.dir}/images"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   229
        </copy>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   230
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   231
        <if>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   232
            <available file="${doc.src.dir}/src"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   233
            <then>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   234
                <copy todir="${docs.build.dir}/temp/doc">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   235
                    <fileset dir="${doc.src.dir}/src">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   236
                        <include name="**/*.rst"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   237
                        <include name="**/*.css"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   238
                        <include name="**/*.jpg"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   239
                        <include name="**/*.dot"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   240
                    </fileset>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   241
                </copy>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   242
                
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   243
                <!--<fileset id="internal.ref.minibuilds" dir="${docs.build.dir}/temp/doc/minibuilds" includes="*/**/index.rst"/>-->
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   244
                <fmpp sourceRoot="${doc.src.dir}/src"
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   245
                      outputRoot="${docs.build.dir}/temp/doc" includes="*.rst.ftl" removeExtensions="ftl" excludes="api_changes.rst.ftl,minibuilds.rst.ftl">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   246
                    <data expandProperties="yes">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   247
                        ant: antProperties()
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   248
                        project: antProject()
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   249
                    </data>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   250
                </fmpp>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   251
            </then>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   252
        </if>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   253
        
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   254
        <!-- Copy static content files from Helium -->
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   255
        <copy todir="${docs.build.dir}/temp/doc">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   256
            <fileset refid="static.doc.files"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   257
        </copy>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   258
        
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   259
        <for param="dot.file">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   260
            <fileset dir="${docs.build.dir}/temp/doc" includes="manual/*.dot"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   261
            <sequential>
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   262
                <echo>Building dot file: @{dot.file}</echo>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   263
                <exec executable="dot">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   264
                    <arg line="-Tpng @{dot.file} -O"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   265
                </exec>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   266
            </sequential>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   267
        </for>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   268
    </target>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   269
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   270
    
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   271
    <!-- Generate HTML documentation from .rst documents with Sphinx.
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   272
    
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   273
    All doc .rst files should be generated or copied into build/temp/doc before being processed into HTML.    
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   274
    -->
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   275
    <target name="textdocs" depends="prep-textdocs">        
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   276
        <hlm:rstMacro />
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   277
        
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   278
        <copy file="${database.file}" todir="${docs.build.dir}"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   279
        <copy file="${docs.build.dir}/temp/doc/default.css" todir="${docs.build.dir}/_static" overwrite="true" failonerror="true"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   280
        <copy file="${docs.build.dir}/temp/doc/helium_pallot_small.jpg" todir="${docs.build.dir}/_static" overwrite="true"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   281
        <copy todir="${docs.build.dir}" overwrite="true">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   282
            <fileset dir="${doc.src.dir}/src">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   283
                <include name="**/*.zip"/>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   284
            </fileset>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   285
        </copy>
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   286
    </target>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   287
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   288
    
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   289
    <!-- Clean old build/doc dir. -->
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   290
    <target name="clean-docs">
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   291
        <delete dir="${docs.build.dir}"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   292
    </target>
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   293
    
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   294
    
217
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   295
    <!-- generate all the user documentation for helium -->
0f5e3a7fb6af helium_8.0-r15308
wbernard
parents: 179
diff changeset
   296
    <target name="docs" depends="clean-docs,apidocs,textdocs"/>
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   297
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   298
</project>