buildframework/helium/sf/doc/src/structure.rst
author wbernard
Thu, 22 Jul 2010 17:09:34 +0300
branchhelium-9.0
changeset 619 f5b4d1b4622d
parent 587 85df38eb4012
permissions -rw-r--r--
Added tag helium-9.0.5 for changeset df88fead2976
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
Project Development guidelines
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     3
==============================
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     4
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     5
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     6
Helium now contains its Java and Python components into its structure. Its main requirements to build the delivery are:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     7
 * Ant 1.7.0
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     8
 * JDK 1.6 or newer
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     9
 * Python 2.6
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    10
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    11
The project is split in several sub-modules which cover specific features.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    12
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    13
Anatomy of the project
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    14
======================
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    15
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    16
::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    17
   
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    18
   + builder
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    19
      - build.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    20
      - bld.bat
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    21
      - bld
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    22
      + antlibs
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    23
         Ant specific dependencies needed to execute ant properly
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    24
         e.g: Java checkstyle, Code coverage tools
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    25
         The jar in that folder will not be used as compilation dependencies
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    26
   + <layer>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    27
       + doc
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    28
          General documentation of the project
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    29
       + settings
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    30
          + ivysettings.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    31
       + deps
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    32
          + <org>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    33
             + <name>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    34
                + <rev>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    35
                   - <name>-<rev>.jar
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    36
          + ...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    37
       + java
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    38
          + component1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    39
          + componentn ...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    40
       + python
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    41
          + component1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    42
          + componentn ...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    43
   + <layer> ...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    44
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    45
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    46
Anatomy of a Component
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    47
======================
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    48
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    49
A component is a self contained structure which implements a set of feature related to a specific domain (e.g: Diamonds, SCM). The following diagram shows 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    50
the physical structure of a component.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    51
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    52
::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    53
   
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    54
   + <component_name>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    55
         - build.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    56
         - ivy.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    57
         + src
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    58
            + com
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    59
               + nokia
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    60
                   + helium
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    61
                      + <component_name>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    62
                          + ant
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    63
                             + taskdefs
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    64
                               source of the Ant tasks
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    65
                             + types
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    66
                               source of the Ant DataType 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    67
                             + listeners
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    68
                               source of the Ant Listener
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    69
                             + conditions
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    70
                               source of the Ant Conditions
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    71
         + tests
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    72
           - build.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    73
           - bld.bat
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    74
           - bld.sh
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    75
           + antunits
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    76
              - test_xxx.ant.xml* - Unittest implemented using AntUnit  
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    77
           + data
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    78
             data used for the the unittests.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    79
           + src
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    80
             + com
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    81
                + nokia
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    82
                   + helium
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    83
                      + <component_name>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    84
                         + tests
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    85
                            source of junit unittests.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    86
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    87
The build.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    88
-------------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    89
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    90
This is simplest file you must have at component level, **<name of the component>** is really important
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    91
as it defines the future name of the jar file.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    92
::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    93
   
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    94
   <project name="<name of the component>">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    95
       <description>Component build file.</description>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    96
       <import file="../../builder/java/macros.ant.xml"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    97
   </project>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    98
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    99
The ivy.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   100
-----------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   101
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   102
The ivy.xml is used to gather the relevant dependencies to build your component, and to order
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   103
the build of the components correctly:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   104
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   105
::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   106
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   107
   <?xml version="1.0" encoding="ISO-8859-1"?>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   108
   <ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   109
          xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   110
       <info
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   111
          organisation="com.nokia.helium"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   112
           module="<name of the component>"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   113
           status="integration">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   114
       </info>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   115
       <dependencies>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   116
          <dependency name="<name of an another component>" rev="latest.integration" conf="default" />
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   117
          <dependency org="dom4j" name="dom4j" rev="1.2.9" conf="default" />
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   118
       </dependencies>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   119
   </ivy-module>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   120
   
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   121
More info about Ivy can be found from: http://ant.apache.org/ivy/
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   122
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   123
Antunit files
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   124
-------------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   125
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   126
The builder will automatically test all the antunit files from <base_component>/tests/antunits.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   127
Test must be written by keeping in mind that src tree must remain unmodified after the testing (please use the test.temp.dir).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   128
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   129
Example of test file:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   130
::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   131
   
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   132
   <project name="test-<component>-<feature>" xmlns:au="antlib:org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   133
      <description>Helium unittests.</description>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   134
   
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   135
      <target name="setUp">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   136
         <delete dir="${test.temp.dir}" failonerror="false" />
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   137
         <mkdir dir="${test.temp.dir}" />
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   138
      </target>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   139
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   140
      <target name="tearDown">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   141
         <delete dir="${test.temp.dir}" failonerror="false" />
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   142
         <mkdir dir="${test.temp.dir}" />
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   143
      </target>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   144
      
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   145
      <target name="test-file-generation">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   146
         <echo message="foo-bar" file="${test.temp.dir}/demo.txt" />
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   147
         <au:assertFileExists file="${test.temp.dir}/demo.txt" />
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   148
      </target>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   149
   </project>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   150
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   151
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   152
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   153
General guidelines
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   154
==================
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   155
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   156
Source code license
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   157
-------------------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   158
Each file added to the project should include the following license header.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   159
::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   160
   
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   161
   /*
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   162
    * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   163
    * All rights reserved.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   164
    * This component and the accompanying materials are made available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   165
    * under the terms of the License "Eclipse Public License v1.0"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   166
    * which accompanies this distribution, and is available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   167
    * at the URL "http://www.eclipse.org/legal/epl-v10.html".
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   168
    *
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   169
    * Initial Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   170
    * Nokia Corporation - initial contribution.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   171
    *
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   172
    * Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   173
    *
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   174
    * Description:  
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   175
    *
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   176
    */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   177
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   178
Documentation
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   179
-------------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   180
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   181
All classes and methods must be documented. Ant facade classes (like Task or DataType)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   182
must be Antdoclet documented (preferably with usage example).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   183
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   184
You can find more information on how to document Ant task using the Antdoclet plugin on http://antdoclet.neuroning.com/.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   185
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   186
General coding guidelines
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   187
-------------------------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   188
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   189
 * Java components must not use getProperty() with hardcoded name coming from helium (e.g: getProject().getProperty("helium.dir")), only exceptions:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   190
    * Ant Listeners (name of the property must be link to the listener not to helium!)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   191
    * Code under the legacy component.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   192
 * It is forbidden to share unittest data between components (else it breaks the self-contained principle).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   193
 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   194
Logging
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   195
-------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   196
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   197
Developer must preferably use standard Ant logging for any user log output.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   198
Internal debug logging must be implemented using Log4J framework.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   199
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   200
 * ANT Listeners must use log4j logging framework - using Ant logging system might cause some looping issues.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   201
 * Ant Type and Task must use the Ant logging mechanism to report to the user.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   202
 * Generic framework (part of the code which doesn't links to Ant directly) must use Log4J. 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   203
 * Usage of System.out.println should be avoided.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   204
 * All the non-handled exceptions should be considered as errors and should be reported as such:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   205
    * use log("message", Project.MSG_ERR) under Ant
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   206
    * log.error() otherwise.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   207
    * Exception to this rule must be clearly commented under the code.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   208
 * Debug information:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   209
    * Log4J framework (log.debug()) must be used to push information to the Helium debug log - so debug information are not
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   210
      directly visible by the user.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   211
    * Ant logging framework can also be use to log Type/Task debug info (but log4j is preferred).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   212
    * PrintStackTrace method should be used on below scenario's:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   213
       * At the time of unknown exception.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   214
       * Should be used with exceptions other than BuildException.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   215
       * In case it is difficult to debug the issue with Exception.getMessage().
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   216
       * use this method during debugging complex issue (this doesn't mean the line should remain in the code after development).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   217
       * When it is required to print the all the information about the occurring Exception. 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   218
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   219
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   220
This is an example on how to use logging:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   221
::
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   222
   
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   223
   import org.apache.log4j.Logger;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   224
   
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   225
   class MyClass extends Task {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   226
       private static Logger log = Logger.getLogger(MyClass.class);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   227
       
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   228
       public void execute() {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   229
           log("Executing...");
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   230
           log.debug("some useful debug information.");
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   231
       }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   232
   }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   233
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   234
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   235
Please find more information on Log4J from the online manual: http://logging.apache.org/log4j/1.2/manual.html.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   236
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   237
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   238
Exception
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   239
---------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   240
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   241
Exceptional event reporting and handling is crutial in software development. Developer must make sure it is done accordingly
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   242
to the framework it is currently using:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   243
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   244
 * To report a build failure under Ant the BuildException must be used.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   245
    But we have to keep in mind that a BuildException is not tracked because it derives from the RuntimeError type.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   246
    So we have to be careful with those and try to limit their puprose to the original usage: Ant build failure.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   247
 * It is preferable to have meaningful exception type like: FileNotFoundException.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   248
 * Developer should try to avoid as much as possible the throw or catch raw type of exception like Exception, RuntimeError.  
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   249