buildframework/helium/doc/src/development/developer_guide.rst
author wbernard
Tue, 27 Apr 2010 08:33:08 +0300
changeset 587 85df38eb4012
child 588 c7c26511138f
permissions -rw-r--r--
helium_9.0-a7879c935424
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     1
..  ============================================================================ 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     2
    Name        : developer_guide.rst
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     3
    Part of     : Helium 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     4
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     5
    Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     6
    All rights reserved.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     7
    This component and the accompanying materials are made available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     8
    under the terms of the License "Eclipse Public License v1.0"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     9
    which accompanies this distribution, and is available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    10
    at the URL "http://www.eclipse.org/legal/epl-v10.html".
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    11
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    12
    Initial Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    13
    Nokia Corporation - initial contribution.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    14
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    15
    Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    16
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    17
    Description:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    18
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    19
    ============================================================================
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    20
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    21
.. index::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    22
  module: Developer Guide
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    23
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    24
###################################
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    25
Developer Guide
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    26
###################################
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    27
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    28
.. contents::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    29
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    30
Introduction
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    31
============
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    32
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    33
This describes various practices, procedures and conventions used within Helium. It should be read by all contributors to Helium along with the `Coding Conventions`_.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    34
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    35
.. _`Coding Conventions`: coding_conventions.html
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    36
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    37
.. index::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    38
  single: Directory Structure
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    39
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    40
Directory structure
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    41
===================
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    42
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    43
The ``/helium`` directory structure consists of:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    44
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    45
``/build``
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    46
    This is not under source control. It is created on demand to store generated documentation, testing and coverage output and so on.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    47
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    48
``/config``
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    49
    Configuration files for parts of Helium. Some of these may only need to be defined in Helium, whereas others may be default configuration that may be overridden by a user.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    50
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    51
``/doc``
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    52
    All documentation related to Helium. Files are in .rst format (HTML versions can be generated under ``/build/doc`` using the ``hlm doc`` command).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    53
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    54
``/external``
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    55
    Applications and libraries that are maintained outside of the Helium team.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    56
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    57
``/tests``
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    58
    Test data for unit tests. All unit tests are co-located with the code under test.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    59
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    60
``/tools``
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    61
    A number of subdirectories for each stage of the build. Each directory may contain Ant scripts and other tools and scripts related to that stage.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    62
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    63
``/tools/common``
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    64
    Common libraries for Java, Perl and Python and XML schemas.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    65
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    66
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    67
Ant script structure
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    68
--------------------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    69
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    70
The ``helium.ant.xml`` file in the project root should be imported by each build configuration. This in turn imports the root files for each of the key build stages defined in the ``/tools`` directory. ``helium.ant.xml`` also defines a number of common Ant default properties.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    71
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    72
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    73
.. index::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    74
  single: Custom Ant library
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    75
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    76
Custom Ant library
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    77
==================
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    78
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    79
All custom Ant tasks and loggers should be added as new component under the sf folder. If the component you are creating is Java based, then add
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    80
it inside the java folder. Your component directory must contain a build.xml file that imports the ${builder.dir}/java/macros.ant.xml file. Also the name
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    81
of the project must be the name of the future jar file e.g::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    82
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    83
   <?xml version="1.0"?>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    84
   <project name="mycomponent">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    85
       <import file="${builder.dir}/java/macros.ant.xml" />
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    86
   </project> 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    87
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    88
The component also need an Ivy file (ivy.xml) in order to be detected and built. The file must defined the correct list of 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    89
dependencies for the component so it get built in the correct order.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    90
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    91
.. index::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    92
  single: How to build the delivery?
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    93
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    94
How to build the delivery?
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    95
==========================   
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    96
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    97
From Helium 9.0 onward, the delivery will be released as source code, without any pre-built binaries. In order to build
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    98
the release please follow the next instructions.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    99
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   100
Building the dependencies
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   101
-------------------------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   102
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   103
In order to build the Helium components you need to use the builder available under the helium directory::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   104
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   105
   > cd builder
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   106
   > bld build
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   107
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   108
This will build all the components needed to create the Helium release: egg or jar files.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   109
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   110
Retrieving Helium dependencies
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   111
------------------------------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   112
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   113
Building the dependency will not bring Helium in a workable stage. It is a preparation stage where components could be unit tested in isolation for example.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   114
Retrieving Helium dependencies based on the version of Helium you desire is then needed. The builder can achieve this operation by running the following command::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   115
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   116
   > cd builder
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   117
   > bld -Dconfig=sf get-deps
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   118
  
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   119
The previous command will retrieve Helium sf configuration dependencies.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   120
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   121
Packaging up the built version
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   122
------------------------------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   123
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   124
Deliverable zip pacakge of binary version of Helium can be created using the following command::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   125
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   126
   > cd builder
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   127
   > bld -Dconfig=sf create-releasable
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   128
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   129
The archive can be found under: build/helium-bin.zip
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   130
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   131
.. index::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   132
  single: Assertions
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   133
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   134
Assertions
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   135
==========
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   136
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   137
There are some basic assertion macros defined in ``common.ant.xml``. These can be used to check for correctness at the end of a target, e.g. checking that a file exists which the target was supposed to create.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   138
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   139
The assertions can be enabled by defining the ``hlm.enable.asserts``. If ``hlm.enable.asserts`` is not enabled, macro will print warnings only.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   140
There are several macros:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   141
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   142
``hlm:assert``
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   143
    A basic assertion that will check any task contained within it.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   144
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   145
``hlm:assertFileExists``
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   146
    Takes a file attribute and asserts that the file exists.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   147
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   148
.. index::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   149
  single: Ivy Configuration
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   150
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   151
Ivy Configuration
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   152
=================
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   153
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   154
Ibiblio
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   155
-------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   156
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   157
Libraries in Maven2 Ibiblio_ repository can use: ``helium/config/ivy/ivy.xml``
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   158
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   159
.. _Ibiblio: http://mirrors.ibiblio.org/pub/mirrors/maven2/
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   160
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   161
These parameters should be used, if library has passed legal tests: ``transitive="false"``, ``conf="subcon"``
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   162
Otherwise use: ``transitive="false"``, ``conf="core_install"``
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   163
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   164
Direct URLs
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   165
------------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   166
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   167
Use these for a direct url link, if the library is needed for the subcon release::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   168
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   169
    helium/config/ivy/modules/jars_subcon-1.0.ivy.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   170
    helium/config/ivy/modules/eggs_subcon-1.0.ivy.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   171
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   172
Otherwise add to these files for non subcon libraries::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   173
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   174
    helium/config/ivy/modules/eggs-1.0.ivy.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   175
    helium/config/ivy/modules/jars-1.0.ivy.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   176
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   177
A new Ivy config file can be added for a non-jar or egg type file.