diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/doc/src/index.rst.ftl
--- a/buildframework/helium/doc/src/index.rst.ftl Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/doc/src/index.rst.ftl Wed Dec 23 19:29:07 2009 +0200
@@ -78,20 +78,11 @@
tutorials/configuration/SimplestConfiguration
tutorials/configuration/UseHlmTasksInConfiguration
- tutorials/configuration/HowtoCreateANewSignal
tutorials/rom_image
tutorials/variant
tutorials/qt_build
<#if !ant?keys?seq_contains("sf")>
nokia/blacktusk/howto-setup-blacktusk-with-helium
-
-* IDO_
-
-.. _IDO: ido
-
-* TeamCI_
-
-.. _TeamCI: teamci
#if>
.. raw:: html
@@ -112,36 +103,135 @@
:maxdepth: 1
<#if !ant?keys?seq_contains("sf")>
+ nokia/support
nokia/nokia
nokia/retrieving
#if>
sf
manual/running
manual/configuring
- manual/configuringdiamonds
- manual/signaling
+
+.. raw:: html
+
+
+
+
+
+.. toctree::
+ :maxdepth: 2
+
manual/stages
+
+.. raw:: html
+
+
<#if !ant?keys?seq_contains("sf")>
+
+
+
+.. toctree::
+ :maxdepth: 2
+
nokia/nokiastages
+
+.. raw:: html
+
+
+#if>
+.. toctree::
+ :maxdepth: 1
+
+<#if !ant?keys?seq_contains("sf")>
nokia/rndsdk_user_manual
nokia/quality
#if>
- manual/cruisecontrol
manual/debugging
metrics
- manual/APIs
-<#if !ant?keys?seq_contains("sf")>
- api_changes
+
+.. raw:: html
+
+
+
-* helium-antlib_
+* `Helium API`_
+* `Helium Antlib`_
+* `Ant Tasks`_
+
+.. _`Ant Tasks`: api/ant/index.html
+.. _`Helium API`: api/helium/index.html
+.. _`Helium Antlib`: helium-antlib/index.html
+
+<#if !(ant?keys?seq_contains("sf"))>
+* `Python API`_
+* `Java API`_
+* `IDO API`_
+* `DFS70501 API`_
-.. _helium-antlib: helium-antlib
+.. _`Python API`: api/python/index.html
+.. _`Java API`: api/java/index.html
+.. _`IDO API`: <#if ant['helium.version']?matches("^\\d+\\.0(?:\\.\\d+)?$")>../#if>ido/api/helium/index.html
+.. _`DFS70501 API`: dfs70501/api/helium/index.html
+#if>
+
+.. raw:: html
+
+
+
+<#if !ant?keys?seq_contains("sf")>
+.. toctree::
+ :maxdepth: 1
+
+ api_changes
+ nokia/releasenotes
#if>
.. raw:: html
+Helium Framework configuration
+==============================
+
+.. toctree::
+ :maxdepth: 1
+
+ tutorials/configuration/HowtoCreateANewSignal
+ manual/signaling
+ manual/configuringdiamonds
+ manual/cruisecontrol
+ manual/antlogging
+* helium-antlib_
+
+.. _helium-antlib: helium-antlib
+
+<#if !ant?keys?seq_contains("sf")>
+Customer docs
+=============
+
+* IDO_
+
+.. _IDO: <#if ant['helium.version']?matches("^\\d+\\.0(?:\\.\\d+)?$")>../#if>ido
+
+* TeamCI_
+
+.. _TeamCI: <#if ant['helium.version']?matches("^\\d+\\.0(?:\\.\\d+)?$")>../#if>teamci
+
+#if>
+
Helium Architecture
===================
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/doc/src/manual/antlogging.rst
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/doc/src/manual/antlogging.rst Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,105 @@
+Configuring Logging
+=====================
+
+Features:
+-----------------
+* Will be initiated by the ANT Listener.
+* Logging will starts whenever build starts.
+* Helium logging framework offers you to configure the ant logging system for different stages of builds.
+* You can log the build process into seperate ant log files for each stage.
+* You can configure the log system to log different level of information (ex: debug, vebose, error).
+
+The configuration:
+-----------------
+
+We can configure the stages for which helium should log the build process.
+
+ * Stages
+
+ * Stages are like preparation, compilation, postbuild etc.. for which we need to log build process.
+ * Stages will have attributes for start and end targets.
+ * Stages will specify from which target we need log the build process and at which target we need to end logging build process.
+
+ .. csv-table::
+ :header: "Attribute", "Description", "Required"
+
+ "id", "Name of Stage (preparation, compilation)","Yes"
+ "starttarget", "Name of target to start logging.","Yes"
+ "endtarget", "Name of target to end logging.","Yes"
+
+ * Stagerecord
+
+ * Will record/log the build process from start target to end target mentioned in the Stage type.
+ * Need provide attributes like output log file, loglevel.
+ * Supports passwordfilterset datatype. If we need to filter any passwords from specific stage log files.
+
+ .. csv-table::
+ :header: "Attribute", "Description", "Required"
+
+ "id", "ID for stage record entry.", "Yes"
+ "defaultoutput", "File to record main ant log file" "Yes (should not have stagerefid attribute if stage record has defaultoutput)"
+ "stagerefid", "Stage reference ID. Exactly as given in the Stage", "Yes"
+ "output", "File to record the build process.", "Yes"
+ "loglevel", "Loglevel to record type of information. ex: debug, info, vebose", "No, Default it will be info"
+ "append", "To append the logging into existing file.", "No, Default it will be false"
+
+Example:
+-----------------
+.. code-block:: xml
+
+
+
+
+
+
+
+
+logreplace Task (hlm:logreplace)
+-----------------
+* LogReplace task will filter out the string from stage logging files.
+* If we need to filter out any user passwords and specific word which should n't be logged can passed to stage logging through this task.
+* Specified string will be filtered out from all the stages logging files.
+* It will not be filtered our by hlm:record task. To filter out the same need to passed to hlm:record task through recorderfilterset or recordfilter.
+
+Example:
+-----------------
+This example will filter out unix password value from all the stage logging files.
+
+.. code-block:: xml
+
+
+
+
+Record Task (hlm:record)
+-----------------
+* Behaviour is same ANT record task with some addon features.
+* Filerts the logging messages which are passed through the filters to hlm:record task.
+* Will stops the logging happening by listener for any stages and resumes to stage logging once hlm:record task finishes.
+
+Example:
+-----------------
+
+Below example
+ * Will sets one recoderfilteset.
+ * Will record the given target/tasks into ${build.id}_stagetest.log file by filtering the regexp mentioned in the recorderfilterset and recordfilter.
+
+.. code-block:: xml
+
+
+
+
+
+
+
+
+
+
+ ... Call tasks you would like to record the output ...
+
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/doc/src/manual/product_example.rst
--- a/buildframework/helium/doc/src/manual/product_example.rst Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/doc/src/manual/product_example.rst Wed Dec 23 19:29:07 2009 +0200
@@ -390,12 +390,6 @@
-
-
-
-
-
-
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/doc/src/manual/signaling.rst
--- a/buildframework/helium/doc/src/manual/signaling.rst Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/doc/src/manual/signaling.rst Wed Dec 23 19:29:07 2009 +0200
@@ -35,7 +35,7 @@
-
+
A signal will then be triggered each time the **target-name** completed. The signalInput will then defined how it should be handled.
@@ -162,12 +162,12 @@
-
+ >
-
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/doc/src/manual/stages.rst.ftl
--- a/buildframework/helium/doc/src/manual/stages.rst.ftl Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/doc/src/manual/stages.rst.ftl Wed Dec 23 19:29:07 2009 +0200
@@ -229,10 +229,25 @@
The build preparation consists in two parts:
- * Getting delivery content (Synergy, zips...),
+ * Getting delivery content (SCM, zips...),
* Preparing the build area.
-How to get delivery content from Synergy?
+To get SCM source you just have to run::
+
+ hlm prep-work-area
+
+To create 'build of materials'::
+
+ hlm create-bom
+
+Synergy
+-------
+
+In order for the synergy commands to be executed you must define the property ccm.enabled=true in one of the your config files or on the command line. e.g.
+
+.. code-block:: xml
+
+
It is possible to automatically get content from Synergy using the Helium framework.
To handle that you have to configure the delivery.xml file from your family build configuration folder and reference by the property prep.delivery.file.
@@ -320,9 +335,23 @@
The following properties are required:
- database: the name of the synergy database you want to use.
-To get synergy source you just have to run::
-
- hlm prep-work-area
+Mercurial
+---------
+
+Add to ant configuration:
+
+.. code-block:: xml
+
+
+
+
+
+
+
+
+For more information see API_
+
+.. _API: ../helium-antlib/api/doclet/index.SCM.html
.. index::
single: Stage - Compilation
@@ -355,7 +384,7 @@
- The order of the files is significant. If building Symbian OS, the Symbian System Definition file must come first. Here both ``fileset`` and ``pathelement`` are used. ``pathelement`` selects just one file whereas a ``fileset`` can use wildcards to select multiple files or handle problems of filenames changing across different platform releases.
+The order of the files is significant. If building Symbian OS, the Symbian System Definition file must come first. Here both ``fileset`` and ``pathelement`` are used. ``pathelement`` selects just one file whereas a ``fileset`` can use wildcards to select multiple files or handle problems of filenames changing across different platform releases.
2. Determine if an existing build configuration in any of the build model sections of the files are suitable for what needs to be built. A build configuration typically looks something like this:
@@ -377,7 +406,7 @@
- A ``unitListRef`` includes a ``unitList`` defined somewhere else as part of this configuration. The ``buildLayer`` elements define ``abld`` steps to run on each component. If an existing configuration is not sufficient a new one must be defined in a separate file (which should be included in the ``path`` type).
+A ``unitListRef`` includes a ``unitList`` defined somewhere else as part of this configuration. The ``buildLayer`` elements define ``abld`` steps to run on each component. If an existing configuration is not sufficient a new one must be defined in a separate file (which should be included in the ``path`` type).
3. Define the ``sysdef.configurations`` Ant property to contain a comma-separated list of build configuration names that must match the ``name`` attribute of the ``configuration``. Each configuration will be built in turn in the ``compile-main`` Ant target.
@@ -465,6 +494,26 @@
"``name``", "The name of the .pkg file to parse.", ""
"``sis.name``", "The name of the .sis file to create. If omitted it will default to the name of the .pkg file.", ""
"``path``", "The path where the .pkg file exists as input to building the .sis file.", ""
+
+Configuration enhancements
+::::::::::::::::::::::::::
+
+*Since Helium 7.0.*
+
+The configuration method above will be replaced by a more flexible approach:
+
+.. csv-table:: Property descriptions
+ :header: "Property", "Description", "Values"
+
+ "``makesis.tool``", "The path for the makesis tool that builds a .sis file.", ""
+ "``signsis.tool``", "The path for the signsis tool that signs a .sis file to create a .sisx file.", ""
+ "``build.sisfiles.dir``", "The directory where the .sis file should be put.", ""
+ "``key``", "The key to use for signing.", ""
+ "``cert``", "The certificate to use for signing.", ""
+ "``input``", "The full path and filename of the input file. This can be a .pkg file, for generating a SIS file, a .sis file for signing, or a .sisx file for multiple signing.", ""
+ "``output``", "The full path and filename of the output file. This is only needed if the location or name needs to be different from the default, which is that the file extension changes appropriately.", ""
+
+Also a ``sis.config.name`` property is added that allows the name of a block to be supplied. This can be overridden to allow particular subsets of configurations to be built.
Checking Stub SIS files
-----------------------
@@ -522,7 +571,7 @@
.. csv-table:: Ant properties to modify
:header: "Attribute", "Description", "Values"
- "``regionalVariation``", "Enable regional variation switching.", "false"
+ "``regionalVariation``", "Enable regional variation switching. - Deprecated (always false)", "false"
The imakerconfiguration supports three sub-types:
@@ -537,62 +586,78 @@
Example of configuration:
.. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Other example using product list and variable group:
+
+.. code-block:: xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
.. index::
single: The iMaker Task
-The imaker task
----------------
-
-.. csv-table:: Ant properties to modify
- :header: "Attribute", "Description", "Values"
-
- "``executor``", "Name of the build system to be used.", "ebs, helium-ec and ec"
- "``name``", "Log and intermediate file differentiator.", ""
- "``signal``", "Enable/disable signaling mechanism.", "true, false"
-
-Example:
+How to configure the target
+---------------------------
+
+The target can be configured by defining an hlm:imakerconfigurationset element with the '''imaker.rom.config''' reference.
.. code-block:: xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ ...
+
+
+The other configurable element is the engine. The '''imaker.engine''' property defines the reference
+to the engine configuration to use for building the roms. Helium defines two engines by default:
+* imaker.engine.default: multithreaded engine (hlm:defaultEngine type)
+* imaker.engine.ec: ECA engine - cluster base execution (hlm:emakeEngine type)
+
+If the property is not defined Helium will guess the best engine to used based on the build.system property.
+
.. index::
single: Legacy ROM creation
@@ -1224,35 +1289,58 @@
Cenrep creation (S60 3.2.3 - 5.x)
:::::::::::::::::::::::::::::::::
<#if !(ant?keys?seq_contains("sf"))>
-See: http://s60wiki.nokia.com/S60Wiki/Central_Repository_Usage
+See: http://configurationtools.nmp.nokia.com/builds/cone/docs/cli/generate.html?highlight=generate
#if>
-The target ``configtool`` can be used to run the Configuration Tool.
-
-Currently supported Configuration Tool arguments are:
-
-command_line | name
-
--master_conf : master_conf
--confml : confml
--impl : impl
--iby : iby
--ignore_errors : keepgoing(true - uses -ignore_errors, otherwise not, setting
- true generates cenrep incase of errors, and signals has to be configured to stop the build
- in case of errors).
-
-Default values are:
+The target ``ido-gen-cenrep`` can be used to run the ConE Tool to generate cenreps.
+
+* IDO can use the ido-gen-cenrep to generate the cenreps which are IDO specific.
+* We should pass the sysdef.configurations.list as parameter to ido-gen-cenrep target. Else it will use the defualt one of helium.
+
+Example:
+:::::::::::::::::::::::::::::::::
+
+Below example will generate the cenrep only for IDO specific confml files.
+
+.. code-block:: xml
+
+
+
+
+
+
+
+Below example will generate the cenreps for S60 SDK.
.. code-block:: xml
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+By using conEToolMacro you can pass any arguments which are mentioned in the above link.
+
+.. code-block:: xml
+
+
+
+
+
+
+
+
+
+
+
+
+After running this command generated file can be found from /_cenrep_includefile.txt
Running individual build commands
@@ -1341,7 +1429,7 @@
Variation (S60 3.2.3 - 5.x)
---------------------------
-See ../tutorials/imaker/iMakerUseCaseCustomerVariantConfml.html
+See http://delivery.nmp.nokia.com/trac/imaker/wiki/iMakerUseCaseCustomerVariantConfml
Variation (S60 3.2)
-------------------
@@ -1594,16 +1682,16 @@
.. index::
- single: ATS3 - STIF, TEF, RTEST, MTF and EUnit
-
-.. _`Stage-ATS3-label`:
-
-Stage: ATS3 - STIF, TEF, RTEST, MTF and EUnit (also Qt)
+ single: ATS - STIF, TEF, RTEST, MTF and EUnit
+
+.. _`Stage-ATS-label`:
+
+Stage: ATS - STIF, TEF, RTEST, MTF and EUnit (also Qt)
=======================================================
ATS testing is the automatic testing of the phone code once it has been compiled and linked to create a ROM image.
-Explanation of the process for getting ATS3 (`STIF`_ and `EUnit`_) tests compiled and executed by Helium, through the use of the ``ats-test`` target.
+Explanation of the process for getting ATS (`STIF`_ and `EUnit`_) tests compiled and executed by Helium, through the use of the ``ats-test`` target.
http://developer.symbian.org/wiki/index.php/Symbian_Test_Tools
@@ -1618,7 +1706,7 @@
----------------
* `Harmonized Test Interface (HTI)`_ needs to be compiled and into the image.
-* The reader is expected to already have a working ATS3 setup in which test cases can be executed. ATS3 server names,
+* The reader is expected to already have a working ATS setup in which test cases can be executed. ATS server names,
access rights and authentication etc. is supposed to be already taken care of.
<#if !(ant?keys?seq_contains("sf"))>
@@ -1672,7 +1760,7 @@
**STEP 2: Configure ATS properties in build.xml**
-**(A)** Username and Password for the ATS3 should be set in the `.netrc file`_
+**(A)** Username and Password for the ATS should be set in the `.netrc file`_
.. code-block:: text
@@ -1698,14 +1786,14 @@
**eunitexerunner.flags** [recommended] Flags for EUnit exerunner can be set by setting the value of this variable. The default flags are set to "/E S60AppEnv /R Off".
**ats.email.list** [recommended] The property is needed if you want to get an email from ATS server after the tests are executed. There can be one to many semicolon(s) ";" separated email addresses.
**ats.flashfiles.minlimit** [recommended] Limit of minimum number of flash files to execute ats-test target, otherwise ATSDrop.zip will not be generated. Default value is "2" files.
- **ats.plan.name** [recommended] Modify the plan name if you have understanding of test.xml file or leave it as it is. Deafault value is "plan".
+ **ats.plan.name** [recommended] Modify the plan name if you have understanding of test.xml file or leave it as it is. Default value is "plan".
**ats.product.hwid** [recommended] Product HardWare ID (HWID) attached to ATS. By default the value of HWID is not set.
**ats.script.type** [recommended] There are two types of ats script files to send drop to ATS server, "runx" and "import"; only difference is that with "import" ATS doesn't have to have access rights to testdrop.zip file, as it is sent to the system over http and import doesn't need network shares. If that is not needed "import" should not be used. Default value is "runx" as "import" involves heavy processing on ATS server.
**ats.target.platform** [recommended] Sets target platform for compiling test components. Default value is "armv5 urel".
- **ats.test.timeout** [recommended] To set test commands execution time limit on ATS3 server, in seconds. Default value is "60".
- **ats.testrun.name** [recommended] Modify the test-run name if you have understanding of test.xml file or leave it as it is. Deafault value is a string consist of build id, product name, major and minor versions.
- **ats.trace.enabled** [recommended] Should be "True" if tracing is needed during the tests running on ATS3. Deafault value is "False", the values are case-sensitive.
- **ats.ctc.enabled** [recommended] Should be "True" if coverage measurement and dynamic analysis (CTC) tool support is to be used by ATS. Deafault value is "False", the values are case-sensitive.
+ **ats.test.timeout** [recommended] To set test commands execution time limit on ATS server, in seconds. Default value is "60".
+ **ats.testrun.name** [recommended] Modify the test-run name if you have understanding of test.xml file or leave it as it is. Default value is a string consist of build id, product name, major and minor versions.
+ **ats.trace.enabled** [recommended] Should be "True" if tracing is needed during the tests running on ATS. Default value is "False", the values are case-sensitive. See http://s60wiki.nokia.com/S60Wiki/CATS/TraceTools
+ **ats.ctc.enabled** [recommended] Should be "True" if coverage measurement and dynamic analysis (CTC) tool support is to be used by ATS. Default value is "False", the values are case-sensitive.
**ats.ctc.host** [recommended] CTC host, provided by CATS used to create coverage measurement reports. MON.sym files are copied to this location, for example "10.0.0.1". If not given, code coverage reports are not created
**ats.obey.pkgfiles.rule** [recommended] If the property is set to "True", then the only test components which will have PKG files, will be included into the test.xml as a test-set. Which means, even if there's a test component (executable) but there's no PKG file, it should not be considered as a test component and hence not included into the test.xml as a separate test. By default the property value is False.
**reference.ats.flash.images** [recommended] Fileset for list of flash images (can be .fpsx, .C00, .V01 etc) It is recommended to set the fileset, default filset is given below which can be overwritten. set *dir=""* attribute of the filset to "${r'$'}{build.output.dir}/variant_images" if "variant-image-creation" target is being used.
@@ -1713,7 +1801,9 @@
**tsrc.path.list** [allowed] Contains list of the tsrc directories. Gets the list from system definition layer files. Assuming that the test components are defined already in te layers.sysdef.xml files to get compiled. Not recommended, but the property value can be set if there are no system definition file(s), and tsrc directories paths to set manually.
**ats.report.location** [allowed] Sets ATS reports store location. Default location is "${r'$'}{publish.dir}/${r'$'}{publish.subdir}".
**ats.multiset.enabled** [allowed] Should be "True" so a set is used for each pkg file in a component, this allows tests to run in parallel on several devices.
-
+ **ats.diamonds.signal** [allowed] Should be "true" so at end of the build diamonds is checked for test results and helium fails if tests failed.
+ **ats.delta.enabled** [allowed] Should be "true" so only ado's changed during do-prep-work-area are tested by ats.
+ **ats4.enabled** [allowed] Should be "true" if ats4 is to be used.
============================== =============== ===============
@@ -1722,7 +1812,7 @@
.. code-block:: xml
-
+
@@ -1747,10 +1837,6 @@
-
-
-
-
@@ -1758,7 +1844,7 @@
**STEP 3: Call target ats-test**
-To execute the target, a property should be set(````).
+To execute the target, a property should be set(````).
Then call ``ats-test``, which will create the ATSDrop.zip (test package).
@@ -1767,9 +1853,20 @@
CTC:
----
-CTC code coverage measurement can be created automatically by enabling property ``ats.ctc.enabled``
-
-Also, property ``ats.ctc.host`` must be defined (See the description above)
+CTC code coverage measurements reports can be created as part of Test Automation process.
+
+1. Build the src using ``build_ctc`` configuration, which is in ``build.sysdef.xml`` file, to create ``MON.sym`` files. It means that a property ``sysdef.configurations.list`` should be modified either add or replace current build configuration with ``build_ctc``
+
+2. Set the property, ``ats.ctc.host``, as described above, for sending the ``MON.sym`` files to the network drive. *(Please contact ATS server administrator and ask for the value to set this property)*
+
+3. Enable CTC process by setting up property ``ats.ctc.enabled`` to "true"
+
+4. Test drops are sent to the ATS server, where, after executing tests ``ctcdata.txt`` files are created. ``ctcdata.txt`` and ``MON.sym`` files are then further processed to create code coverage reports.
+
+5. View or download the Code coverage reports by following the link provided in the ATS report email (sent after the tests are executed on ATS)
+
+*NOTE: After receiving the email notification, it may take a few minutes before the code coverage reports are available.*
+
Qt Tests:
---------
@@ -1782,12 +1879,12 @@
.. _`Skip-Sending-AtsDrop-label`:
-Skip Sending AtsDrop to ATS3
+Skip Sending AtsDrop to ATS
----------------------------
-By setting property of ``skip.ats.sending``, ``ats-test`` target only creates a drop file, and does not send the drop (or package) to ATS3 server.
-
-Customizing the test.xml in ATS3
+By setting property of ``skip.ats.sending``, ``ats-test`` target only creates a drop file, and does not send the drop (or package) to ATS server.
+
+Customizing the test.xml in ATS
--------------------------------
The user can customize the generated test.xml with files:
@@ -1887,12 +1984,12 @@
.. index::
- single: ATS3 - ASTE
-
-Stage: ATS3 - ASTE
+ single: ATS - ASTE
+
+Stage: ATS - ASTE
===================
-Explanation of the process for getting ATS3 `ASTE`_ tests compiled and executed by Helium, through the use of the ``ats-aste`` target.
+Explanation of the process for getting ATS `ASTE`_ tests compiled and executed by Helium, through the use of the ``ats-aste`` target.
<#if !(ant?keys?seq_contains("sf"))>
.. _`ASTE`: http://s60wiki.nokia.com/S60Wiki/ASTE
@@ -1902,7 +1999,7 @@
--------------
* `Harmonized Test Interface (HTI)`_ needs to be compiled and into the image.
-* The reader is expected to already have a working ATS3 setup in which test cases can be executed. ATS3 server names, access rights and authentication etc. is supposed to be already taken care of.
+* The reader is expected to already have a working ATS setup in which test cases can be executed. ATS server names, access rights and authentication etc. is supposed to be already taken care of.
* `SW Test Asset`_ location and type of test should be known.
<#if !(ant?keys?seq_contains("sf"))>
@@ -1920,7 +2017,7 @@
**STEP 1: Configure ASTE properties in build.xml**
-**(A)** Username and Password for the ATS3 should be set in the `.netrc file`_
+**(A)** Username and Password for the ATS should be set in the `.netrc file`_
.. code-block:: text
@@ -1943,16 +2040,16 @@
**Property Name** **Edit Status** **Description**
=============================== =============== ===============
**ats.server** [must] For example: "4fio00105" or "catstresrv001.cats.noklab.net:80". Default server port is "8080", but it is not allowed between intra and Noklab. Because of this we need to define server port as 80. The host can be different depending on site and/or product.
- **ats.drop.location** [must] Server location (UNC path) to save the ATS3Drop file, before sending to the ATS. For example: \\\\trwsem00\\some_folder\\. In case, ``ats.script.type`` is set to "import", ATS doesn't need to have access to ats.drop.location, its value can be any local folder on build machine, for example c:/temp (no network share needed).
+ **ats.drop.location** [must] Server location (UNC path) to save the ATSDrop file, before sending to the ATS. For example: \\\\trwsem00\\some_folder\\. In case, ``ats.script.type`` is set to "import", ATS doesn't need to have access to ats.drop.location, its value can be any local folder on build machine, for example c:/temp (no network share needed).
**ats.product.name** [must] Name of the product to be tested. For example: "PRODUCT".
**ats.aste.testasset.location** [must] Location of SW Test Assets, if the TestAsset is not packaged then it is first compressed to a ``.zip`` file. It should be a UNC path.
**ats.aste.software.release** [must] Flash images releases, for example "SPP 51.32".
**ats.aste.software.version** [must] Version of the software to be tested. For example: "W810"
**ats.aste.email.list** [recommended] The property is needed if you want to get an email from ATS server after the tests are executed. There can be one to many semicolon(s) ";" separated email addresses.
**ats.flashfiles.minlimit** [recommended] Limit of minimum number of flash files to execute ats-test target, otherwise ATSDrop.zip will not be generated. Default value is "2" files.
- **ats.aste.plan.name** [recommended] Modify the plan name if you have understanding of test.xml file or leave it as it is. Deafault value is "plan".
+ **ats.aste.plan.name** [recommended] Modify the plan name if you have understanding of test.xml file or leave it as it is. Default value is "plan".
**ats.product.hwid** [recommended] Product HardWare ID (HWID) attached to ATS. By default the value of HWID is not set.
- **ats.test.timeout** [recommended] To set test commands execution time limit on ATS3 server, in seconds. Default value is "60".
+ **ats.test.timeout** [recommended] To set test commands execution time limit on ATS server, in seconds. Default value is "60".
**ats.aste.testrun.name** [recommended] Modify the test-run name if you have understanding of test.xml file or leave it as it is. Default value is a string consists of build id, product name, major and minor versions.
**ats.aste.test.type** [recommended] Type of test to run. Default is "smoke".
**ats.aste.testasset.caseids** [recommended] These are the cases that which tests should be run from the TestAsset. For example, value can be set as "100,101,102,103,105,106,". A comma is needed to separate case IDs
@@ -1966,7 +2063,7 @@
.. code-block:: xml
-
+
@@ -1989,10 +2086,6 @@
-
-
-
-
@@ -2000,14 +2093,14 @@
**STEP 2: Call target ats-aste**
-To execute the target, a property should be set(````).
+To execute the target, a property should be set(````).
Then call ``ats-aste``, which will create the ATSDrop.zip (test package).
If property ``ats.aste.email.list`` is set, an email (test report) will be sent when the tests are ready on ATS/ASTE.
-Skip Sending AtsDrop to ATS3
+Skip Sending AtsDrop to ATS
------------------------------
click :ref:`Skip-Sending-AtsDrop-label`:
@@ -2018,15 +2111,15 @@
Stage: MATTI
=============
-MATTI testing is very similar to ATS3 testing, so for details of how it all links together see :ref:`Stage-ATS3-label`: `and the matti website`_.
+MATTI testing is very similar to ATS testing, so for details of how it all links together see :ref:`Stage-ATS-label`: `and the matti website`_.
<#if !(ant?keys?seq_contains("sf"))>
.. _`and the matti website`: http://trmatti1.nmp.nokia.com/help/
#if>
-The set up of parameters is very similar (a few less parameters and it mostly uses ATS3 values). The main difference is that once the drop file has been uploaded to the ATS3 server it uses MATTI to perform the tests and not ATS3, this is achieved by calling the MATTIDrop.py script instead of the ATSE or ATS3 scripts when creating the drop file (the drop file contains the flash files and the ruby tests to be performed).
-
-The following parameters are the ones that are not listed in the ATS3 parameters, all other parameters required are as listed in the ATS3 section above.
+The set up of parameters is very similar (a few less parameters and it mostly uses ATS values). The main difference is that once the drop file has been uploaded to the ATS server it uses MATTI to perform the tests and not ATS, this is achieved by calling the MATTIDrop.py script instead of the ATSE or ATS scripts when creating the drop file (the drop file contains the flash files and the ruby tests to be performed).
+
+The following parameters are the ones that are not listed in the ATS parameters, all other parameters required are as listed in the ATS section above.
* [must] - must be set by user
* [recommended] - should be set by user but not mandatory
@@ -2053,36 +2146,25 @@
.. code-block:: xml
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-In order to upload and view the test run you need to have a valid user id and password that matches that in your .netrc file. To create the account open a web browser window and enter the name of the ats.server with /ats3 at the end e.g. http://123456:80/ats3. Click on the link in the top right hand corner to create the account. To view the test run once your account is active you need to click on the 'test runs' tab.
+In order to upload and view the test run you need to have a valid user id and password that matches that in your .netrc file. To create the account open a web browser window and enter the name of the ats.server with /ATS at the end e.g. http://123456:80/ATS. Click on the link in the top right hand corner to create the account. To view the test run once your account is active you need to click on the 'test runs' tab.
To run the tests call the target `matti-test` (you will need to define the 'build.drive', 'build.number' and it is best to create the 'core.build.version' on the command line as well if you do not add it to the list of targets run that create the ROM image). e.g.
::
hlm -Dbuild.number=001 -Dbuild.drive=z: -Dcore.build.version=001 matti-test
-If it displays the message 'Testdrop created!' with the file name then the MATTIDrops.py script has done what it needs to do. The next thing to check is that the drop file has been uploaded to the ATS3 server OK. If that is performed successfully then the rest of the testing needs to be performed by the ATS3 server. There is also a test.xml file created that contains details needed for debugging any problems that might occur. To determine if the tests have run correctly you need to read the test run details from the server.
+If it displays the message 'Testdrop created!' with the file name then the MATTIDrops.py script has done what it needs to do. The next thing to check is that the drop file has been uploaded to the ATS server OK. If that is performed successfully then the rest of the testing needs to be performed by the ATS server. There is also a test.xml file created that contains details needed for debugging any problems that might occur. To determine if the tests have run correctly you need to read the test run details from the server.
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/doc/src/sf.rst
--- a/buildframework/helium/doc/src/sf.rst Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/doc/src/sf.rst Wed Dec 23 19:29:07 2009 +0200
@@ -7,9 +7,9 @@
Install the following tools:
-* `ActivePython 2.5`_
+* `ActivePython 2.6`_
-.. _`ActivePython 2.5`: http://www.activestate.com/activepython/downloads
+.. _`ActivePython 2.6`: http://www.activestate.com/activepython/downloads
* `ActivePerl 5.6.1`_
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/doc/src/tutorials/configuration/HowtoCreateANewSignal.rst
--- a/buildframework/helium/doc/src/tutorials/configuration/HowtoCreateANewSignal.rst Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/doc/src/tutorials/configuration/HowtoCreateANewSignal.rst Wed Dec 23 19:29:07 2009 +0200
@@ -48,14 +48,14 @@
-To declare a new signal to the framework you need to define a new signalConfig reference.
+To declare a new signal to the framework you need to define a new signalListenerConfig reference.
You also need to create a signalInput configuration to define your signal behaviour.
.. code-block:: xml
-
+
@@ -63,13 +63,13 @@
-
+
-The signalListenerConfig defines which target to listen and raise signal for. The target name is defined through the **name** attribute.
+The signalListenerConfig defines which target to listen and raise signal for. The target name is defined through the **target** attribute.
Then the nested **targetCondition** element is used to configure how the signal should be triggered.
This element accepts any nested `Ant conditions `_.
-In this case the signal will get raised only id the file is not present after the execution of the **custom-action** target.
+In this case the signal will get raised only if the file is not present after the execution of the **custom-action** target.
The framework then uses the defined signalInput from the signalNotifierInput configuration to know how to behave when the signal is raised. In the previous example it will
simply keep running and fail the build at the end. Then files defined by the nested notifierInput will be passed to the notifier.
@@ -110,4 +110,4 @@
BUILD SUCCESSFUL
Total time: 2 seconds
-
\ No newline at end of file
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/doc/src/tutorials/qt_build.rst
--- a/buildframework/helium/doc/src/tutorials/qt_build.rst Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/doc/src/tutorials/qt_build.rst Wed Dec 23 19:29:07 2009 +0200
@@ -9,17 +9,6 @@
This tutorial explains how to update your configuration to enable Qt building.
-Configuring Qt
-==============
-
-Helium has a ready to use target which allows you to configure Qt. You just need to make sure the qt.dir
-property is configured with the correct location of your Qt source.
-Then you can run the target as follow::
-
- > hlm -Dbuild.drive=Q: -Dbuild.number=1 configure-qt
- ...
-
-This target has now been depreciated in Helium 6.0, please consider building Qt using Symbian toolchain (SBS or SBSv2).
Building Qt components
======================
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/COPYING.TXT
--- a/buildframework/helium/external/filedisk/COPYING.TXT Wed Oct 28 14:39:48 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- , 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/example.txt
--- a/buildframework/helium/external/filedisk/example.txt Wed Oct 28 14:39:48 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-C:\>filedisk
-syntax:
-filedisk /mount [size[k|M|G] | /ro | /cd]
-filedisk /umount
-filedisk /status
-
-filename formats:
- c:\path\filedisk.img
- \Device\Harddisk0\Partition1\path\filedisk.img
- \\server\share\path\filedisk.img
-
-example:
-filedisk /mount 0 c:\temp\filedisk.img 8M f:
-filedisk /mount 1 c:\temp\cdimage.iso /cd i:
-filedisk /umount f:
-filedisk /umount i:
-
-C:\>filedisk /mount 0 c:\temp\filedisk.img 8M f:
-
-C:\>format /fs:fat f:
-The type of the file system is RAW.
-The new file system is FAT.
-
-WARNING, ALL DATA ON NON-REMOVABLE DISK
-DRIVE F: WILL BE LOST!
-Proceed with Format (Y/N)? y
-Verifying 7M
-Initializing the File Allocation Table (FAT)...
-Volume label (11 characters, ENTER for none)? filedisk
-Format complete.
-
- 8 353 792 bytes total disk space.
- 8 353 792 bytes available on disk.
-
- 2 048 bytes in each allocation unit.
- 4 079 allocation units available on disk.
-
- 12 bits in each FAT entry.
-
-Volume Serial Number is 28DF-0C81
-
-C:\>dir f:
- Volume in drive F is FILEDISK
- Volume Serial Number is 28DF-0C81
-
- Directory of F:\
-
-File Not Found
-
-C:\>chkdsk f:
-The type of the file system is FAT.
-Volume FILEDISK created 2002-11-24 14:25
-Volume Serial Number is 28DF-0C81
-Windows is verifying files and folders...
-File and folder verification is complete.
-Windows has checked the file system and found no problems.
-
- 8 353 792 bytes total disk space.
- 8 353 792 bytes available on disk.
-
- 2 048 bytes in each allocation unit.
- 4 079 total allocation units on disk.
- 4 079 allocation units available on disk.
-
-C:\>filedisk /status f:
-f: \??\c:\temp\filedisk.img Size: 8388608 bytes
-
-C:\>filedisk /umount f:
-
-C:\>
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/exe/MAKEFILE
--- a/buildframework/helium/external/filedisk/exe/MAKEFILE Wed Oct 28 14:39:48 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
-# file to this component. This file merely indirects to the real make file
-# that is shared by all the driver components of the Windows NT DDK
-#
-
-!INCLUDE $(NTMAKEENV)\makefile.def
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/exe/filedisk.c
--- a/buildframework/helium/external/filedisk/exe/filedisk.c Wed Oct 28 14:39:48 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,423 +0,0 @@
-/*
- Control program for a virtual disk driver for Windows NT/2000/XP.
- Copyright (C) 1999, 2000, 2001, 2002 Bo Brantén.
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#include
-#include
-#include
-#include
-#include "filedisk.h"
-
-int FileDiskSyntax(void)
-{
- fprintf(stderr, "syntax:\n");
- fprintf(stderr, "filedisk /mount [size[k|M|G] | /ro | /cd] \n");
- fprintf(stderr, "filedisk /umount \n");
- fprintf(stderr, "filedisk /status \n");
- fprintf(stderr, "\n");
- fprintf(stderr, "filename formats:\n");
- fprintf(stderr, " c:\\path\\filedisk.img\n");
- fprintf(stderr, " \\Device\\Harddisk0\\Partition1\\path\\filedisk.img\n");
- fprintf(stderr, " \\\\server\\share\\path\\filedisk.img\n");
- fprintf(stderr, "\n");
- fprintf(stderr, "example:\n");
- fprintf(stderr, "filedisk /mount 0 c:\\temp\\filedisk.img 8M f:\n");
- fprintf(stderr, "filedisk /mount 1 c:\\temp\\cdimage.iso /cd i:\n");
- fprintf(stderr, "filedisk /umount f:\n");
- fprintf(stderr, "filedisk /umount i:\n");
-
- return -1;
-}
-
-void PrintLastError(char* Prefix)
-{
- LPVOID lpMsgBuf;
-
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- 0,
- (LPTSTR) &lpMsgBuf,
- 0,
- NULL
- );
-
- fprintf(stderr, "%s %s", Prefix, (LPTSTR) lpMsgBuf);
-
- LocalFree(lpMsgBuf);
-}
-
-int
-FileDiskMount(
- int DeviceNumber,
- POPEN_FILE_INFORMATION OpenFileInformation,
- char DriveLetter,
- BOOLEAN CdImage
-)
-{
- char VolumeName[] = "\\\\.\\ :";
- char DeviceName[255];
- HANDLE Device;
- DWORD BytesReturned;
-
- VolumeName[4] = DriveLetter;
-
- Device = CreateFile(
- VolumeName,
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- FILE_FLAG_NO_BUFFERING,
- NULL
- );
-
- if (Device != INVALID_HANDLE_VALUE)
- {
- SetLastError(ERROR_BUSY);
- PrintLastError(&VolumeName[4]);
- return -1;
- }
-
- if (CdImage)
- {
- sprintf(DeviceName, DEVICE_NAME_PREFIX "Cd" "%u", DeviceNumber);
- }
- else
- {
- sprintf(DeviceName, DEVICE_NAME_PREFIX "%u", DeviceNumber);
- }
-
- if (!DefineDosDevice(
- DDD_RAW_TARGET_PATH,
- &VolumeName[4],
- DeviceName
- ))
- {
- PrintLastError(&VolumeName[4]);
- return -1;
- }
-
- Device = CreateFile(
- VolumeName,
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- FILE_FLAG_NO_BUFFERING,
- NULL
- );
-
- if (Device == INVALID_HANDLE_VALUE)
- {
- PrintLastError(&VolumeName[4]);
- DefineDosDevice(DDD_REMOVE_DEFINITION, &VolumeName[4], NULL);
- return -1;
- }
-
- if (!DeviceIoControl(
- Device,
- IOCTL_FILE_DISK_OPEN_FILE,
- OpenFileInformation,
- sizeof(OPEN_FILE_INFORMATION) + OpenFileInformation->FileNameLength - 1,
- NULL,
- 0,
- &BytesReturned,
- NULL
- ))
- {
- PrintLastError("FileDisk:");
- DefineDosDevice(DDD_REMOVE_DEFINITION, &VolumeName[4], NULL);
- return -1;
- }
-
- return 0;
-}
-
-int FileDiskUmount(char DriveLetter)
-{
- char VolumeName[] = "\\\\.\\ :";
- HANDLE Device;
- DWORD BytesReturned;
-
- VolumeName[4] = DriveLetter;
-
- Device = CreateFile(
- VolumeName,
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- FILE_FLAG_NO_BUFFERING,
- NULL
- );
-
- if (Device == INVALID_HANDLE_VALUE)
- {
- PrintLastError(&VolumeName[4]);
- return -1;
- }
-
- if (!DeviceIoControl(
- Device,
- FSCTL_LOCK_VOLUME,
- NULL,
- 0,
- NULL,
- 0,
- &BytesReturned,
- NULL
- ))
- {
- PrintLastError(&VolumeName[4]);
- return -1;
- }
-
- if (!DeviceIoControl(
- Device,
- IOCTL_FILE_DISK_CLOSE_FILE,
- NULL,
- 0,
- NULL,
- 0,
- &BytesReturned,
- NULL
- ))
- {
- PrintLastError("FileDisk:");
- return -1;
- }
-
- if (!DeviceIoControl(
- Device,
- FSCTL_DISMOUNT_VOLUME,
- NULL,
- 0,
- NULL,
- 0,
- &BytesReturned,
- NULL
- ))
- {
- PrintLastError(&VolumeName[4]);
- return -1;
- }
-
- if (!DeviceIoControl(
- Device,
- FSCTL_UNLOCK_VOLUME,
- NULL,
- 0,
- NULL,
- 0,
- &BytesReturned,
- NULL
- ))
- {
- PrintLastError(&VolumeName[4]);
- return -1;
- }
-
- CloseHandle(Device);
-
- if (!DefineDosDevice(
- DDD_REMOVE_DEFINITION,
- &VolumeName[4],
- NULL
- ))
- {
- PrintLastError(&VolumeName[4]);
- return -1;
- }
-
- return 0;
-}
-
-int FileDiskStatus(char DriveLetter)
-{
- char VolumeName[] = "\\\\.\\ :";
- HANDLE Device;
- POPEN_FILE_INFORMATION OpenFileInformation;
- DWORD BytesReturned;
-
- VolumeName[4] = DriveLetter;
-
- Device = CreateFile(
- VolumeName,
- GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- FILE_FLAG_NO_BUFFERING,
- NULL
- );
-
- if (Device == INVALID_HANDLE_VALUE)
- {
- PrintLastError(&VolumeName[4]);
- return -1;
- }
-
- OpenFileInformation = malloc(sizeof(OPEN_FILE_INFORMATION) + MAX_PATH);
-
- if (!DeviceIoControl(
- Device,
- IOCTL_FILE_DISK_QUERY_FILE,
- NULL,
- 0,
- OpenFileInformation,
- sizeof(OPEN_FILE_INFORMATION) + MAX_PATH,
- &BytesReturned,
- NULL
- ))
- {
- PrintLastError(&VolumeName[4]);
- return -1;
- }
-
- if (BytesReturned < sizeof(OPEN_FILE_INFORMATION))
- {
- SetLastError(ERROR_INSUFFICIENT_BUFFER);
- PrintLastError(&VolumeName[4]);
- return -1;
- }
-
- printf("%c: %.*s Size: %I64u bytes%s\n",
- DriveLetter,
- OpenFileInformation->FileNameLength,
- OpenFileInformation->FileName,
- OpenFileInformation->FileSize,
- OpenFileInformation->ReadOnly ? ", ReadOnly" : ""
- );
-
- return 0;
-}
-
-int __cdecl main(int argc, char* argv[])
-{
- char* Command;
- int DeviceNumber;
- char* FileName;
- char* Option;
- char DriveLetter;
- BOOLEAN CdImage = FALSE;
- POPEN_FILE_INFORMATION OpenFileInformation;
-
- Command = argv[1];
-
- if ((argc == 5 || argc == 6) && !strcmp(Command, "/mount"))
- {
- DeviceNumber = atoi(argv[2]);
- FileName = argv[3];
-
- if (strlen(FileName) < 2)
- {
- return FileDiskSyntax();
- }
-
- OpenFileInformation =
- malloc(sizeof(OPEN_FILE_INFORMATION) + strlen(FileName) + 7);
-
- memset(
- OpenFileInformation,
- 0,
- sizeof(OPEN_FILE_INFORMATION) + strlen(FileName) + 7
- );
-
- if (FileName[0] == '\\')
- {
- if (FileName[1] == '\\')
- // \\server\share\path\filedisk.img
- {
- strcpy(OpenFileInformation->FileName, "\\??\\UNC");
- strcat(OpenFileInformation->FileName, FileName + 1);
- }
- else
- // \Device\Harddisk0\Partition1\path\filedisk.img
- {
- strcpy(OpenFileInformation->FileName, FileName);
- }
- }
- else
- // c:\path\filedisk.img
- {
- strcpy(OpenFileInformation->FileName, "\\??\\");
- strcat(OpenFileInformation->FileName, FileName);
- }
-
- OpenFileInformation->FileNameLength =
- (USHORT) strlen(OpenFileInformation->FileName);
-
- if (argc > 5)
- {
- Option = argv[4];
- DriveLetter = argv[5][0];
-
- if (!strcmp(Option, "/ro"))
- {
- OpenFileInformation->ReadOnly = TRUE;
- }
- else if (!strcmp(Option, "/cd"))
- {
- CdImage = TRUE;
- }
- else
- {
- if (Option[strlen(Option) - 1] == 'G')
- {
- OpenFileInformation->FileSize.QuadPart =
- _atoi64(Option) * 1024 * 1024 * 1024;
- }
- else if (Option[strlen(Option) - 1] == 'M')
- {
- OpenFileInformation->FileSize.QuadPart =
- _atoi64(Option) * 1024 * 1024;
- }
- else if (Option[strlen(Option) - 1] == 'k')
- {
- OpenFileInformation->FileSize.QuadPart =
- _atoi64(Option) * 1024;
- }
- else
- {
- OpenFileInformation->FileSize.QuadPart =
- _atoi64(Option);
- }
- }
- }
- else
- {
- DriveLetter = argv[4][0];
- }
- return FileDiskMount(DeviceNumber, OpenFileInformation, DriveLetter, CdImage);
- }
- else if (argc == 3 && !strcmp(Command, "/umount"))
- {
- DriveLetter = argv[2][0];
- return FileDiskUmount(DriveLetter);
- }
- else if (argc == 3 && !strcmp(Command, "/status"))
- {
- DriveLetter = argv[2][0];
- return FileDiskStatus(DriveLetter);
- }
- else
- {
- return FileDiskSyntax();
- }
-}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/exe/filedisk.rc
--- a/buildframework/helium/external/filedisk/exe/filedisk.rc Wed Oct 28 14:39:48 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-//Microsoft Developer Studio generated resource script.
-//
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,11
- PRODUCTVERSION 1,0,0,11
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "Bo Brantén\0"
- VALUE "FileDescription", "FileDisk Virtual Disk Driver\0"
- VALUE "FileVersion", "1.0.0.11\0"
- VALUE "InternalName", "filedisk\0"
- VALUE "LegalCopyright", "Copyright © 1999-2002 Bo Brantén\0"
- VALUE "OriginalFilename", "filedisk.exe\0"
- VALUE "ProductName", "filedisk\0"
- VALUE "ProductVersion", "1.0.0.11\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif // !_MAC
-
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE DISCARDABLE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE DISCARDABLE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE DISCARDABLE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/exe/sources
--- a/buildframework/helium/external/filedisk/exe/sources Wed Oct 28 14:39:48 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-TARGETNAME=filedisk
-TARGETPATH=obj
-TARGETTYPE=PROGRAM
-UMTYPE=console
-INCLUDES=..\sys\inc
-SOURCES=filedisk.c filedisk.rc
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/filedisk.exe
Binary file buildframework/helium/external/filedisk/filedisk.exe has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/filedisk.reg
--- a/buildframework/helium/external/filedisk/filedisk.reg Wed Oct 28 14:39:48 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-REGEDIT4
-
-[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FileDisk]
-
-"ErrorControl"=dword:00000001
-
-#
-# When to start the driver:
-# At boot: Start=1
-# Manually: Start=3
-#
-"Start"=dword:00000001
-
-"Type"=dword:00000001
-
-[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FileDisk\Parameters]
-
-"NumberOfDevices"=dword:00000004
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/filedisk.sys
Binary file buildframework/helium/external/filedisk/filedisk.sys has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/install.txt
--- a/buildframework/helium/external/filedisk/install.txt Wed Oct 28 14:39:48 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-Copy the driver (filedisk.sys) to %systemroot%\system32\drivers\.
-
-Optionally edit filedisk.reg for automatic/manually start and
-number of devices.
-
-Import filedisk.reg to the Registry.
-
-Reboot.
-
-Use the program filedisk.exe to mount/umount files, for an example
-of use see the file example.txt.
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/readme.txt
--- a/buildframework/helium/external/filedisk/readme.txt Wed Oct 28 14:39:48 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-
- This is a virtual disk driver for Windows NT/2000/XP that uses
- one or more files to emulate physical disks.
- Copyright (C) 1999-2006 Bo Brantén.
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- The GNU General Public License is also available from:
- http://www.gnu.org/copyleft/gpl.html
-
- Windows and Windows NT are either registered trademarks or trademarks of
- Microsoft Corporation in the United States and/or other countries.
-
- Please send comments, corrections and contributions to bosse@acc.umu.se
-
- The most recent version of this program is available from:
- http://www.acc.umu.se/~bosse/
-
- Revision history:
-
- 14. 2006-01-05
- Updated impersonation so that use of image files stored on network
- drives work on Windows 2000 SP4, Windows XP SP2 and
- Windows Server 2003 SP1.
-
- 13. 2004-06-09
- Small fix in file size handling.
-
- 12. 2004-05-27
- Possible fix for memory leak.
-
- 11. 2002-11-30
- Added ioctl to query information about mounted disk image files by
- request from developer of GUI.
-
- 10. 2002-11-24
- Added a check so that FileDisk doesn't use compressed or encrypted
- images. For an explanation why this doesn't work see comment in the
- source code.
-
- 9. 2002-08-26
- Corrected the share access for read-only FileDisk images.
-
- 8. 2002-08-11
- Updated the control application to support UNC paths.
- Changed the handling of CD-ROM device objects to avoid some problems on
- Windows XP.
- Corrected the handling of file sizes so that FileDisk images can be
- sparse files.
-
- 7. 2002-02-28
- Added support for CD-images.
-
- 6. 2002-01-21
- Added support for impersonation so that FileDisk images can be stored
- on network drives.
-
- 5. 2002-01-18
- Updated for Windows XP by Robert A. Rose.
-
- 4. 2001-07-08
- Formating to FAT on Windows 2000 now works.
-
- 3. 2001-05-14
- Corrected the error messages from the usermode control application.
-
- 2. 2000-03-15
- Added handling of IOCTL_DISK_CHECK_VERIFY to make the driver work on
- Windows 2000 (tested on beta 3, build 2031). Formating to FAT still
- doesn't work but formating to NTFS does.
-
- 1. 1999-06-09
- Initial release.
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/sys/inc/filedisk.h
--- a/buildframework/helium/external/filedisk/sys/inc/filedisk.h Wed Oct 28 14:39:48 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- This is a virtual disk driver for Windows NT/2000/XP that uses one or more
- files to emulate physical disks.
- Copyright (C) 1999, 2000, 2001, 2002 Bo Brantén.
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifndef _FILE_DISK_
-#define _FILE_DISK_
-
-#ifndef __T
-#ifdef _NTDDK_
-#define __T(x) L ## x
-#else
-#define __T(x) x
-#endif
-#endif
-
-#ifndef _T
-#define _T(x) __T(x)
-#endif
-
-#define DEVICE_BASE_NAME _T("\\FileDisk")
-#define DEVICE_DIR_NAME _T("\\Device") DEVICE_BASE_NAME
-#define DEVICE_NAME_PREFIX DEVICE_DIR_NAME DEVICE_BASE_NAME
-
-#define FILE_DEVICE_FILE_DISK 0x8000
-
-#define IOCTL_FILE_DISK_OPEN_FILE CTL_CODE(FILE_DEVICE_FILE_DISK, 0x800, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
-#define IOCTL_FILE_DISK_CLOSE_FILE CTL_CODE(FILE_DEVICE_FILE_DISK, 0x801, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
-#define IOCTL_FILE_DISK_QUERY_FILE CTL_CODE(FILE_DEVICE_FILE_DISK, 0x802, METHOD_BUFFERED, FILE_READ_ACCESS)
-
-typedef struct _OPEN_FILE_INFORMATION {
- LARGE_INTEGER FileSize;
- BOOLEAN ReadOnly;
- USHORT FileNameLength;
- UCHAR FileName[1];
-} OPEN_FILE_INFORMATION, *POPEN_FILE_INFORMATION;
-
-#endif
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/sys/obj/i386/checked/filedisk.sys
Binary file buildframework/helium/external/filedisk/sys/obj/i386/checked/filedisk.sys has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/sys/obj/i386/free/filedisk.sys
Binary file buildframework/helium/external/filedisk/sys/obj/i386/free/filedisk.sys has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/sys/src/MAKEFILE
--- a/buildframework/helium/external/filedisk/sys/src/MAKEFILE Wed Oct 28 14:39:48 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
-# file to this component. This file merely indirects to the real make file
-# that is shared by all the driver components of the Windows NT DDK
-#
-
-!INCLUDE $(NTMAKEENV)\makefile.def
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/sys/src/Sources
--- a/buildframework/helium/external/filedisk/sys/src/Sources Wed Oct 28 14:39:48 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-TARGETNAME=filedisk
-TARGETPATH=..\obj
-TARGETTYPE=DRIVER
-INCLUDES=..\inc
-SOURCES=filedisk.c filedisk.rc
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/sys/src/filedisk.c
--- a/buildframework/helium/external/filedisk/sys/src/filedisk.c Wed Oct 28 14:39:48 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1537 +0,0 @@
-/*
- This is a virtual disk driver for Windows NT/2000/XP that uses
- one or more files to emulate physical disks.
- Copyright (C) 1999-2006 Bo Brantén.
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#include
-#include
-#include
-#include
-
-//
-// We include some stuff from newer DDK:s here so that one
-// version of the driver for all versions of Windows can
-// be compiled with the Windows NT 4.0 DDK.
-//
-#if (VER_PRODUCTBUILD < 2195)
-
-#define FILE_DEVICE_MASS_STORAGE 0x0000002d
-#define IOCTL_STORAGE_CHECK_VERIFY2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
-
-#endif
-
-#if (VER_PRODUCTBUILD < 2600)
-
-#define IOCTL_DISK_GET_PARTITION_INFO_EX CTL_CODE(IOCTL_DISK_BASE, 0x0012, METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define IOCTL_DISK_GET_LENGTH_INFO CTL_CODE(IOCTL_DISK_BASE, 0x0017, METHOD_BUFFERED, FILE_READ_ACCESS)
-
-typedef enum _PARTITION_STYLE {
- PARTITION_STYLE_MBR,
- PARTITION_STYLE_GPT
-} PARTITION_STYLE;
-
-typedef unsigned __int64 ULONG64, *PULONG64;
-
-typedef struct _PARTITION_INFORMATION_MBR {
- UCHAR PartitionType;
- BOOLEAN BootIndicator;
- BOOLEAN RecognizedPartition;
- ULONG HiddenSectors;
-} PARTITION_INFORMATION_MBR, *PPARTITION_INFORMATION_MBR;
-
-typedef struct _PARTITION_INFORMATION_GPT {
- GUID PartitionType;
- GUID PartitionId;
- ULONG64 Attributes;
- WCHAR Name[36];
-} PARTITION_INFORMATION_GPT, *PPARTITION_INFORMATION_GPT;
-
-typedef struct _PARTITION_INFORMATION_EX {
- PARTITION_STYLE PartitionStyle;
- LARGE_INTEGER StartingOffset;
- LARGE_INTEGER PartitionLength;
- ULONG PartitionNumber;
- BOOLEAN RewritePartition;
- union {
- PARTITION_INFORMATION_MBR Mbr;
- PARTITION_INFORMATION_GPT Gpt;
- };
-} PARTITION_INFORMATION_EX, *PPARTITION_INFORMATION_EX;
-
-typedef struct _GET_LENGTH_INFORMATION {
- LARGE_INTEGER Length;
-} GET_LENGTH_INFORMATION, *PGET_LENGTH_INFORMATION;
-
-#endif // (VER_PRODUCTBUILD < 2600)
-
-//
-// We include some stuff from ntifs.h here so that
-// the driver can be compiled with only the DDK.
-//
-
-#define TOKEN_SOURCE_LENGTH 8
-
-typedef enum _TOKEN_TYPE {
- TokenPrimary = 1,
- TokenImpersonation
-} TOKEN_TYPE;
-
-typedef struct _TOKEN_SOURCE {
- CCHAR SourceName[TOKEN_SOURCE_LENGTH];
- LUID SourceIdentifier;
-} TOKEN_SOURCE, *PTOKEN_SOURCE;
-
-typedef struct _TOKEN_CONTROL {
- LUID TokenId;
- LUID AuthenticationId;
- LUID ModifiedId;
- TOKEN_SOURCE TokenSource;
-} TOKEN_CONTROL, *PTOKEN_CONTROL;
-
-typedef struct _SECURITY_CLIENT_CONTEXT {
- SECURITY_QUALITY_OF_SERVICE SecurityQos;
- PACCESS_TOKEN ClientToken;
- BOOLEAN DirectlyAccessClientToken;
- BOOLEAN DirectAccessEffectiveOnly;
- BOOLEAN ServerIsRemote;
- TOKEN_CONTROL ClientTokenControl;
-} SECURITY_CLIENT_CONTEXT, *PSECURITY_CLIENT_CONTEXT;
-
-#define PsDereferenceImpersonationToken(T) \
- {if (ARGUMENT_PRESENT(T)) { \
- (ObDereferenceObject((T))); \
- } else { \
- ; \
- } \
-}
-
-#define PsDereferencePrimaryToken(T) (ObDereferenceObject((T)))
-
-NTKERNELAPI
-VOID
-PsRevertToSelf (
- VOID
-);
-
-NTKERNELAPI
-NTSTATUS
-SeCreateClientSecurity (
- IN PETHREAD Thread,
- IN PSECURITY_QUALITY_OF_SERVICE QualityOfService,
- IN BOOLEAN RemoteClient,
- OUT PSECURITY_CLIENT_CONTEXT ClientContext
-);
-
-#define SeDeleteClientSecurity(C) { \
- if (SeTokenType((C)->ClientToken) == TokenPrimary) { \
- PsDereferencePrimaryToken( (C)->ClientToken ); \
- } else { \
- PsDereferenceImpersonationToken( (C)->ClientToken ); \
- } \
-}
-
-NTKERNELAPI
-VOID
-SeImpersonateClient (
- IN PSECURITY_CLIENT_CONTEXT ClientContext,
- IN PETHREAD ServerThread OPTIONAL
-);
-
-NTKERNELAPI
-TOKEN_TYPE
-SeTokenType (
- IN PACCESS_TOKEN Token
-);
-
-#ifndef SE_IMPERSONATE_PRIVILEGE
-#define SE_IMPERSONATE_PRIVILEGE (29L)
-#endif
-
-#define TOKEN_ASSIGN_PRIMARY (0x0001)
-#define TOKEN_DUPLICATE (0x0002)
-#define TOKEN_IMPERSONATE (0x0004)
-#define TOKEN_QUERY (0x0008)
-#define TOKEN_QUERY_SOURCE (0x0010)
-#define TOKEN_ADJUST_PRIVILEGES (0x0020)
-#define TOKEN_ADJUST_GROUPS (0x0040)
-#define TOKEN_ADJUST_DEFAULT (0x0080)
-
-#define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
- TOKEN_ASSIGN_PRIMARY |\
- TOKEN_DUPLICATE |\
- TOKEN_IMPERSONATE |\
- TOKEN_QUERY |\
- TOKEN_QUERY_SOURCE |\
- TOKEN_ADJUST_PRIVILEGES |\
- TOKEN_ADJUST_GROUPS |\
- TOKEN_ADJUST_DEFAULT)
-
-typedef struct _TOKEN_PRIVILEGES {
- ULONG PrivilegeCount;
- LUID_AND_ATTRIBUTES Privileges[1];
-} TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
-
-NTSYSAPI
-NTSTATUS
-NTAPI
-ZwOpenProcessToken (
- IN HANDLE ProcessHandle,
- IN ACCESS_MASK DesiredAccess,
- OUT PHANDLE TokenHandle
-);
-
-NTSYSAPI
-NTSTATUS
-NTAPI
-NtAdjustPrivilegesToken (
- IN HANDLE TokenHandle,
- IN BOOLEAN DisableAllPrivileges,
- IN PTOKEN_PRIVILEGES NewState,
- IN ULONG BufferLength,
- OUT PTOKEN_PRIVILEGES PreviousState OPTIONAL,
- OUT PULONG ReturnLength
-);
-
-//
-// For backward compatibility with Windows NT 4.0 by Bruce Engle.
-//
-#ifndef MmGetSystemAddressForMdlSafe
-#define MmGetSystemAddressForMdlSafe(MDL, PRIORITY) MmGetSystemAddressForMdlPrettySafe(MDL)
-
-PVOID
-MmGetSystemAddressForMdlPrettySafe (
- PMDL Mdl
- )
-{
- CSHORT MdlMappingCanFail;
- PVOID MappedSystemVa;
-
- MdlMappingCanFail = Mdl->MdlFlags & MDL_MAPPING_CAN_FAIL;
-
- Mdl->MdlFlags |= MDL_MAPPING_CAN_FAIL;
-
- MappedSystemVa = MmGetSystemAddressForMdl(Mdl);
-
- if (MdlMappingCanFail == 0)
- {
- Mdl->MdlFlags &= ~MDL_MAPPING_CAN_FAIL;
- }
-
- return MappedSystemVa;
-}
-#endif
-
-#include "filedisk.h"
-
-#define PARAMETER_KEY L"\\Parameters"
-
-#define NUMBEROFDEVICES_VALUE L"NumberOfDevices"
-
-#define DEFAULT_NUMBEROFDEVICES 4
-
-#define SECTOR_SIZE 512
-
-#define TOC_DATA_TRACK 0x04
-
-HANDLE dir_handle;
-
-typedef struct _DEVICE_EXTENSION {
- BOOLEAN media_in_device;
- HANDLE file_handle;
- ANSI_STRING file_name;
- LARGE_INTEGER file_size;
- BOOLEAN read_only;
- PSECURITY_CLIENT_CONTEXT security_client_context;
- LIST_ENTRY list_head;
- KSPIN_LOCK list_lock;
- KEVENT request_event;
- PVOID thread_pointer;
- BOOLEAN terminate_thread;
-} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
-
-NTSTATUS
-DriverEntry (
- IN PDRIVER_OBJECT DriverObject,
- IN PUNICODE_STRING RegistryPath
-);
-
-NTSTATUS
-FileDiskCreateDevice (
- IN PDRIVER_OBJECT DriverObject,
- IN ULONG Number,
- IN DEVICE_TYPE DeviceType
-);
-
-VOID
-FileDiskUnload (
- IN PDRIVER_OBJECT DriverObject
-);
-
-PDEVICE_OBJECT
-FileDiskDeleteDevice (
- IN PDEVICE_OBJECT DeviceObject
-);
-
-NTSTATUS
-FileDiskCreateClose (
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
-);
-
-NTSTATUS
-FileDiskReadWrite (
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
-);
-
-NTSTATUS
-FileDiskDeviceControl (
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
-);
-
-VOID
-FileDiskThread (
- IN PVOID Context
-);
-
-NTSTATUS
-FileDiskOpenFile (
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
-);
-
-NTSTATUS
-FileDiskCloseFile (
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
-);
-
-NTSTATUS
-FileDiskAdjustPrivilege (
- IN ULONG Privilege,
- IN BOOLEAN Enable
-);
-
-int swprintf(wchar_t *, const wchar_t *, ...);
-
-#pragma code_seg("INIT")
-
-NTSTATUS
-DriverEntry (
- IN PDRIVER_OBJECT DriverObject,
- IN PUNICODE_STRING RegistryPath
- )
-{
- UNICODE_STRING parameter_path;
- RTL_QUERY_REGISTRY_TABLE query_table[2];
- ULONG n_devices;
- NTSTATUS status;
- UNICODE_STRING device_dir_name;
- OBJECT_ATTRIBUTES object_attributes;
- ULONG n;
- USHORT n_created_devices;
-
- parameter_path.Length = 0;
-
- parameter_path.MaximumLength = RegistryPath->Length + sizeof(PARAMETER_KEY);
-
- parameter_path.Buffer = (PWSTR) ExAllocatePool(PagedPool, parameter_path.MaximumLength);
-
- if (parameter_path.Buffer == NULL)
- {
- return STATUS_INSUFFICIENT_RESOURCES;
- }
-
- RtlCopyUnicodeString(¶meter_path, RegistryPath);
-
- RtlAppendUnicodeToString(¶meter_path, PARAMETER_KEY);
-
- RtlZeroMemory(&query_table[0], sizeof(query_table));
-
- query_table[0].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_REQUIRED;
- query_table[0].Name = NUMBEROFDEVICES_VALUE;
- query_table[0].EntryContext = &n_devices;
-
- status = RtlQueryRegistryValues(
- RTL_REGISTRY_ABSOLUTE,
- parameter_path.Buffer,
- &query_table[0],
- NULL,
- NULL
- );
-
- ExFreePool(parameter_path.Buffer);
-
- if (!NT_SUCCESS(status))
- {
- KdPrint(("FileDisk: Query registry failed, using default values.\n"));
- n_devices = DEFAULT_NUMBEROFDEVICES;
- }
-
- RtlInitUnicodeString(&device_dir_name, DEVICE_DIR_NAME);
-
- InitializeObjectAttributes(
- &object_attributes,
- &device_dir_name,
- OBJ_PERMANENT,
- NULL,
- NULL
- );
-
- status = ZwCreateDirectoryObject(
- &dir_handle,
- DIRECTORY_ALL_ACCESS,
- &object_attributes
- );
-
- if (!NT_SUCCESS(status))
- {
- return status;
- }
-
- ZwMakeTemporaryObject(dir_handle);
-
- for (n = 0, n_created_devices = 0; n < n_devices; n++)
- {
- status = FileDiskCreateDevice(DriverObject, n, FILE_DEVICE_DISK);
-
- if (NT_SUCCESS(status))
- {
- n_created_devices++;
- }
- }
-
- for (n = 0; n < n_devices; n++)
- {
- status = FileDiskCreateDevice(DriverObject, n, FILE_DEVICE_CD_ROM);
-
- if (NT_SUCCESS(status))
- {
- n_created_devices++;
- }
- }
-
- if (n_created_devices == 0)
- {
- ZwClose(dir_handle);
- return status;
- }
-
- DriverObject->MajorFunction[IRP_MJ_CREATE] = FileDiskCreateClose;
- DriverObject->MajorFunction[IRP_MJ_CLOSE] = FileDiskCreateClose;
- DriverObject->MajorFunction[IRP_MJ_READ] = FileDiskReadWrite;
- DriverObject->MajorFunction[IRP_MJ_WRITE] = FileDiskReadWrite;
- DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = FileDiskDeviceControl;
-
- DriverObject->DriverUnload = FileDiskUnload;
-
- return STATUS_SUCCESS;
-}
-
-NTSTATUS
-FileDiskCreateDevice (
- IN PDRIVER_OBJECT DriverObject,
- IN ULONG Number,
- IN DEVICE_TYPE DeviceType
- )
-{
- WCHAR device_name_buffer[MAXIMUM_FILENAME_LENGTH];
- UNICODE_STRING device_name;
- NTSTATUS status;
- PDEVICE_OBJECT device_object;
- PDEVICE_EXTENSION device_extension;
- HANDLE thread_handle;
-
- ASSERT(DriverObject != NULL);
-
- if (DeviceType == FILE_DEVICE_CD_ROM)
- {
- swprintf(
- device_name_buffer,
- DEVICE_NAME_PREFIX L"Cd" L"%u",
- Number
- );
- }
- else
- {
- swprintf(
- device_name_buffer,
- DEVICE_NAME_PREFIX L"%u",
- Number
- );
- }
-
- RtlInitUnicodeString(&device_name, device_name_buffer);
-
- status = IoCreateDevice(
- DriverObject,
- sizeof(DEVICE_EXTENSION),
- &device_name,
- DeviceType,
- 0,
- FALSE,
- &device_object
- );
-
- if (!NT_SUCCESS(status))
- {
- return status;
- }
-
- device_object->Flags |= DO_DIRECT_IO;
-
- device_extension = (PDEVICE_EXTENSION) device_object->DeviceExtension;
-
- device_extension->media_in_device = FALSE;
-
- if (DeviceType == FILE_DEVICE_CD_ROM)
- {
- device_object->Characteristics |= FILE_READ_ONLY_DEVICE;
- device_extension->read_only = TRUE;
- }
-
- InitializeListHead(&device_extension->list_head);
-
- KeInitializeSpinLock(&device_extension->list_lock);
-
- KeInitializeEvent(
- &device_extension->request_event,
- SynchronizationEvent,
- FALSE
- );
-
- device_extension->terminate_thread = FALSE;
-
- status = PsCreateSystemThread(
- &thread_handle,
- (ACCESS_MASK) 0L,
- NULL,
- NULL,
- NULL,
- FileDiskThread,
- device_object
- );
-
- if (!NT_SUCCESS(status))
- {
- IoDeleteDevice(device_object);
- return status;
- }
-
- status = ObReferenceObjectByHandle(
- thread_handle,
- THREAD_ALL_ACCESS,
- NULL,
- KernelMode,
- &device_extension->thread_pointer,
- NULL
- );
-
- if (!NT_SUCCESS(status))
- {
- ZwClose(thread_handle);
-
- device_extension->terminate_thread = TRUE;
-
- KeSetEvent(
- &device_extension->request_event,
- (KPRIORITY) 0,
- FALSE
- );
-
- IoDeleteDevice(device_object);
-
- return status;
- }
-
- ZwClose(thread_handle);
-
- return STATUS_SUCCESS;
-}
-
-#pragma code_seg("PAGE")
-
-VOID
-FileDiskUnload (
- IN PDRIVER_OBJECT DriverObject
- )
-{
- PDEVICE_OBJECT device_object;
-
- PAGED_CODE();
-
- device_object = DriverObject->DeviceObject;
-
- while (device_object)
- {
- device_object = FileDiskDeleteDevice(device_object);
- }
-
- ZwClose(dir_handle);
-}
-
-PDEVICE_OBJECT
-FileDiskDeleteDevice (
- IN PDEVICE_OBJECT DeviceObject
- )
-{
- PDEVICE_EXTENSION device_extension;
- PDEVICE_OBJECT next_device_object;
-
- PAGED_CODE();
-
- ASSERT(DeviceObject != NULL);
-
- device_extension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
-
- device_extension->terminate_thread = TRUE;
-
- KeSetEvent(
- &device_extension->request_event,
- (KPRIORITY) 0,
- FALSE
- );
-
- KeWaitForSingleObject(
- device_extension->thread_pointer,
- Executive,
- KernelMode,
- FALSE,
- NULL
- );
-
- ObDereferenceObject(device_extension->thread_pointer);
-
- if (device_extension->security_client_context != NULL)
- {
- SeDeleteClientSecurity(device_extension->security_client_context);
- ExFreePool(device_extension->security_client_context);
- }
-
- next_device_object = DeviceObject->NextDevice;
-
- IoDeleteDevice(DeviceObject);
-
- return next_device_object;
-}
-
-NTSTATUS
-FileDiskCreateClose (
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- PAGED_CODE();
-
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = FILE_OPENED;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return STATUS_SUCCESS;
-}
-
-#pragma code_seg()
-
-NTSTATUS
-FileDiskReadWrite (
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- PDEVICE_EXTENSION device_extension;
- PIO_STACK_LOCATION io_stack;
-
- device_extension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
-
- if (!device_extension->media_in_device)
- {
- Irp->IoStatus.Status = STATUS_NO_MEDIA_IN_DEVICE;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return STATUS_NO_MEDIA_IN_DEVICE;
- }
-
- io_stack = IoGetCurrentIrpStackLocation(Irp);
-
- if (io_stack->Parameters.Read.Length == 0)
- {
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return STATUS_SUCCESS;
- }
-
- IoMarkIrpPending(Irp);
-
- ExInterlockedInsertTailList(
- &device_extension->list_head,
- &Irp->Tail.Overlay.ListEntry,
- &device_extension->list_lock
- );
-
- KeSetEvent(
- &device_extension->request_event,
- (KPRIORITY) 0,
- FALSE
- );
-
- return STATUS_PENDING;
-}
-
-NTSTATUS
-FileDiskDeviceControl (
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- PDEVICE_EXTENSION device_extension;
- PIO_STACK_LOCATION io_stack;
- NTSTATUS status;
-
- device_extension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
-
- io_stack = IoGetCurrentIrpStackLocation(Irp);
-
- if (!device_extension->media_in_device &&
- io_stack->Parameters.DeviceIoControl.IoControlCode !=
- IOCTL_FILE_DISK_OPEN_FILE)
- {
- Irp->IoStatus.Status = STATUS_NO_MEDIA_IN_DEVICE;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return STATUS_NO_MEDIA_IN_DEVICE;
- }
-
- switch (io_stack->Parameters.DeviceIoControl.IoControlCode)
- {
- case IOCTL_FILE_DISK_OPEN_FILE:
- {
- SECURITY_QUALITY_OF_SERVICE security_quality_of_service;
-
- if (device_extension->media_in_device)
- {
- KdPrint(("FileDisk: IOCTL_FILE_DISK_OPEN_FILE: Media already opened\n"));
-
- status = STATUS_INVALID_DEVICE_REQUEST;
- Irp->IoStatus.Information = 0;
- break;
- }
-
- if (io_stack->Parameters.DeviceIoControl.InputBufferLength <
- sizeof(OPEN_FILE_INFORMATION))
- {
- status = STATUS_INVALID_PARAMETER;
- Irp->IoStatus.Information = 0;
- break;
- }
-
- if (io_stack->Parameters.DeviceIoControl.InputBufferLength <
- sizeof(OPEN_FILE_INFORMATION) +
- ((POPEN_FILE_INFORMATION)Irp->AssociatedIrp.SystemBuffer)->FileNameLength -
- sizeof(UCHAR))
- {
- status = STATUS_INVALID_PARAMETER;
- Irp->IoStatus.Information = 0;
- break;
- }
-
- if (device_extension->security_client_context != NULL)
- {
- SeDeleteClientSecurity(device_extension->security_client_context);
- }
- else
- {
- device_extension->security_client_context =
- ExAllocatePool(NonPagedPool, sizeof(SECURITY_CLIENT_CONTEXT));
- }
-
- RtlZeroMemory(&security_quality_of_service, sizeof(SECURITY_QUALITY_OF_SERVICE));
-
- security_quality_of_service.Length = sizeof(SECURITY_QUALITY_OF_SERVICE);
- security_quality_of_service.ImpersonationLevel = SecurityImpersonation;
- security_quality_of_service.ContextTrackingMode = SECURITY_STATIC_TRACKING;
- security_quality_of_service.EffectiveOnly = FALSE;
-
- SeCreateClientSecurity(
- PsGetCurrentThread(),
- &security_quality_of_service,
- FALSE,
- device_extension->security_client_context
- );
-
- IoMarkIrpPending(Irp);
-
- ExInterlockedInsertTailList(
- &device_extension->list_head,
- &Irp->Tail.Overlay.ListEntry,
- &device_extension->list_lock
- );
-
- KeSetEvent(
- &device_extension->request_event,
- (KPRIORITY) 0,
- FALSE
- );
-
- status = STATUS_PENDING;
-
- break;
- }
-
- case IOCTL_FILE_DISK_CLOSE_FILE:
- {
- IoMarkIrpPending(Irp);
-
- ExInterlockedInsertTailList(
- &device_extension->list_head,
- &Irp->Tail.Overlay.ListEntry,
- &device_extension->list_lock
- );
-
- KeSetEvent(
- &device_extension->request_event,
- (KPRIORITY) 0,
- FALSE
- );
-
- status = STATUS_PENDING;
-
- break;
- }
-
- case IOCTL_FILE_DISK_QUERY_FILE:
- {
- POPEN_FILE_INFORMATION open_file_information;
-
- if (io_stack->Parameters.DeviceIoControl.OutputBufferLength <
- sizeof(OPEN_FILE_INFORMATION) + device_extension->file_name.Length - sizeof(UCHAR))
- {
- status = STATUS_BUFFER_TOO_SMALL;
- Irp->IoStatus.Information = 0;
- break;
- }
-
- open_file_information = (POPEN_FILE_INFORMATION) Irp->AssociatedIrp.SystemBuffer;
-
- open_file_information->FileSize.QuadPart = device_extension->file_size.QuadPart;
- open_file_information->ReadOnly = device_extension->read_only;
- open_file_information->FileNameLength = device_extension->file_name.Length;
-
- RtlCopyMemory(
- open_file_information->FileName,
- device_extension->file_name.Buffer,
- device_extension->file_name.Length
- );
-
- status = STATUS_SUCCESS;
- Irp->IoStatus.Information = sizeof(OPEN_FILE_INFORMATION) +
- open_file_information->FileNameLength - sizeof(UCHAR);
-
- break;
- }
-
- case IOCTL_DISK_CHECK_VERIFY:
- case IOCTL_CDROM_CHECK_VERIFY:
- case IOCTL_STORAGE_CHECK_VERIFY:
- case IOCTL_STORAGE_CHECK_VERIFY2:
- {
- status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
- break;
- }
-
- case IOCTL_DISK_GET_DRIVE_GEOMETRY:
- case IOCTL_CDROM_GET_DRIVE_GEOMETRY:
- {
- PDISK_GEOMETRY disk_geometry;
- ULONGLONG length;
-
- if (io_stack->Parameters.DeviceIoControl.OutputBufferLength <
- sizeof(DISK_GEOMETRY))
- {
- status = STATUS_BUFFER_TOO_SMALL;
- Irp->IoStatus.Information = 0;
- break;
- }
-
- disk_geometry = (PDISK_GEOMETRY) Irp->AssociatedIrp.SystemBuffer;
-
- length = device_extension->file_size.QuadPart;
-
- disk_geometry->Cylinders.QuadPart = length / SECTOR_SIZE / 32 / 2;
- disk_geometry->MediaType = FixedMedia;
- disk_geometry->TracksPerCylinder = 2;
- disk_geometry->SectorsPerTrack = 32;
- disk_geometry->BytesPerSector = SECTOR_SIZE;
-
- status = STATUS_SUCCESS;
- Irp->IoStatus.Information = sizeof(DISK_GEOMETRY);
-
- break;
- }
-
- case IOCTL_DISK_GET_LENGTH_INFO:
- {
- PGET_LENGTH_INFORMATION get_length_information;
-
- if (io_stack->Parameters.DeviceIoControl.OutputBufferLength <
- sizeof(GET_LENGTH_INFORMATION))
- {
- status = STATUS_BUFFER_TOO_SMALL;
- Irp->IoStatus.Information = 0;
- break;
- }
-
- get_length_information = (PGET_LENGTH_INFORMATION) Irp->AssociatedIrp.SystemBuffer;
-
- get_length_information->Length.QuadPart = device_extension->file_size.QuadPart;
-
- status = STATUS_SUCCESS;
- Irp->IoStatus.Information = sizeof(GET_LENGTH_INFORMATION);
-
- break;
- }
-
- case IOCTL_DISK_GET_PARTITION_INFO:
- {
- PPARTITION_INFORMATION partition_information;
- ULONGLONG length;
-
- if (io_stack->Parameters.DeviceIoControl.OutputBufferLength <
- sizeof(PARTITION_INFORMATION))
- {
- status = STATUS_BUFFER_TOO_SMALL;
- Irp->IoStatus.Information = 0;
- break;
- }
-
- partition_information = (PPARTITION_INFORMATION) Irp->AssociatedIrp.SystemBuffer;
-
- length = device_extension->file_size.QuadPart;
-
- partition_information->StartingOffset.QuadPart = 0;
- partition_information->PartitionLength.QuadPart = length;
- partition_information->HiddenSectors = 1;
- partition_information->PartitionNumber = 0;
- partition_information->PartitionType = 0;
- partition_information->BootIndicator = FALSE;
- partition_information->RecognizedPartition = FALSE;
- partition_information->RewritePartition = FALSE;
-
- status = STATUS_SUCCESS;
- Irp->IoStatus.Information = sizeof(PARTITION_INFORMATION);
-
- break;
- }
-
- case IOCTL_DISK_GET_PARTITION_INFO_EX:
- {
- PPARTITION_INFORMATION_EX partition_information_ex;
- ULONGLONG length;
-
- if (io_stack->Parameters.DeviceIoControl.OutputBufferLength <
- sizeof(PARTITION_INFORMATION_EX))
- {
- status = STATUS_BUFFER_TOO_SMALL;
- Irp->IoStatus.Information = 0;
- break;
- }
-
- partition_information_ex = (PPARTITION_INFORMATION_EX) Irp->AssociatedIrp.SystemBuffer;
-
- length = device_extension->file_size.QuadPart;
-
- partition_information_ex->PartitionStyle = PARTITION_STYLE_MBR;
- partition_information_ex->StartingOffset.QuadPart = 0;
- partition_information_ex->PartitionLength.QuadPart = length;
- partition_information_ex->PartitionNumber = 0;
- partition_information_ex->RewritePartition = FALSE;
- partition_information_ex->Mbr.PartitionType = 0;
- partition_information_ex->Mbr.BootIndicator = FALSE;
- partition_information_ex->Mbr.RecognizedPartition = FALSE;
- partition_information_ex->Mbr.HiddenSectors = 1;
-
- status = STATUS_SUCCESS;
- Irp->IoStatus.Information = sizeof(PARTITION_INFORMATION_EX);
-
- break;
- }
-
- case IOCTL_DISK_IS_WRITABLE:
- {
- if (!device_extension->read_only)
- {
- status = STATUS_SUCCESS;
- }
- else
- {
- status = STATUS_MEDIA_WRITE_PROTECTED;
- }
- Irp->IoStatus.Information = 0;
- break;
- }
-
- case IOCTL_DISK_MEDIA_REMOVAL:
- case IOCTL_STORAGE_MEDIA_REMOVAL:
- {
- status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
- break;
- }
-
- case IOCTL_CDROM_READ_TOC:
- {
- PCDROM_TOC cdrom_toc;
-
- if (io_stack->Parameters.DeviceIoControl.OutputBufferLength <
- sizeof(CDROM_TOC))
- {
- status = STATUS_BUFFER_TOO_SMALL;
- Irp->IoStatus.Information = 0;
- break;
- }
-
- cdrom_toc = (PCDROM_TOC) Irp->AssociatedIrp.SystemBuffer;
-
- RtlZeroMemory(cdrom_toc, sizeof(CDROM_TOC));
-
- cdrom_toc->FirstTrack = 1;
- cdrom_toc->LastTrack = 1;
- cdrom_toc->TrackData[0].Control = TOC_DATA_TRACK;
-
- status = STATUS_SUCCESS;
- Irp->IoStatus.Information = sizeof(CDROM_TOC);
-
- break;
- }
-
- case IOCTL_DISK_SET_PARTITION_INFO:
- {
- if (device_extension->read_only)
- {
- status = STATUS_MEDIA_WRITE_PROTECTED;
- Irp->IoStatus.Information = 0;
- break;
- }
-
- if (io_stack->Parameters.DeviceIoControl.InputBufferLength <
- sizeof(SET_PARTITION_INFORMATION))
- {
- status = STATUS_INVALID_PARAMETER;
- Irp->IoStatus.Information = 0;
- break;
- }
-
- status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
-
- break;
- }
-
- case IOCTL_DISK_VERIFY:
- {
- PVERIFY_INFORMATION verify_information;
-
- if (io_stack->Parameters.DeviceIoControl.InputBufferLength <
- sizeof(VERIFY_INFORMATION))
- {
- status = STATUS_INVALID_PARAMETER;
- Irp->IoStatus.Information = 0;
- break;
- }
-
- verify_information = (PVERIFY_INFORMATION) Irp->AssociatedIrp.SystemBuffer;
-
- status = STATUS_SUCCESS;
- Irp->IoStatus.Information = verify_information->Length;
-
- break;
- }
-
- default:
- {
- KdPrint((
- "FileDisk: Unknown IoControlCode %#x\n",
- io_stack->Parameters.DeviceIoControl.IoControlCode
- ));
-
- status = STATUS_INVALID_DEVICE_REQUEST;
- Irp->IoStatus.Information = 0;
- }
- }
-
- if (status != STATUS_PENDING)
- {
- Irp->IoStatus.Status = status;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- }
-
- return status;
-}
-
-VOID
-FileDiskThread (
- IN PVOID Context
- )
-{
- PDEVICE_OBJECT device_object;
- PDEVICE_EXTENSION device_extension;
- PLIST_ENTRY request;
- PIRP irp;
- PIO_STACK_LOCATION io_stack;
- PUCHAR system_buffer;
- PUCHAR buffer;
-
- ASSERT(Context != NULL);
-
- device_object = (PDEVICE_OBJECT) Context;
-
- device_extension = (PDEVICE_EXTENSION) device_object->DeviceExtension;
-
- KeSetPriorityThread(KeGetCurrentThread(), LOW_REALTIME_PRIORITY);
-
- FileDiskAdjustPrivilege(SE_IMPERSONATE_PRIVILEGE, TRUE);
-
- for (;;)
- {
- KeWaitForSingleObject(
- &device_extension->request_event,
- Executive,
- KernelMode,
- FALSE,
- NULL
- );
-
- if (device_extension->terminate_thread)
- {
- PsTerminateSystemThread(STATUS_SUCCESS);
- }
-
- while (request = ExInterlockedRemoveHeadList(
- &device_extension->list_head,
- &device_extension->list_lock
- ))
- {
- irp = CONTAINING_RECORD(request, IRP, Tail.Overlay.ListEntry);
-
- io_stack = IoGetCurrentIrpStackLocation(irp);
-
- switch (io_stack->MajorFunction)
- {
- case IRP_MJ_READ:
- system_buffer = (PUCHAR) MmGetSystemAddressForMdlSafe(irp->MdlAddress, NormalPagePriority);
- if (system_buffer == NULL)
- {
- irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
- irp->IoStatus.Information = 0;
- break;
- }
- buffer = (PUCHAR) ExAllocatePool(PagedPool, io_stack->Parameters.Read.Length);
- if (buffer == NULL)
- {
- irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
- irp->IoStatus.Information = 0;
- break;
- }
- ZwReadFile(
- device_extension->file_handle,
- NULL,
- NULL,
- NULL,
- &irp->IoStatus,
- buffer,
- io_stack->Parameters.Read.Length,
- &io_stack->Parameters.Read.ByteOffset,
- NULL
- );
- RtlCopyMemory(system_buffer, buffer, io_stack->Parameters.Read.Length);
- ExFreePool(buffer);
- break;
-
- case IRP_MJ_WRITE:
- if ((io_stack->Parameters.Write.ByteOffset.QuadPart +
- io_stack->Parameters.Write.Length) >
- device_extension->file_size.QuadPart)
- {
- irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
- irp->IoStatus.Information = 0;
- }
- ZwWriteFile(
- device_extension->file_handle,
- NULL,
- NULL,
- NULL,
- &irp->IoStatus,
- MmGetSystemAddressForMdlSafe(irp->MdlAddress, NormalPagePriority),
- io_stack->Parameters.Write.Length,
- &io_stack->Parameters.Write.ByteOffset,
- NULL
- );
- break;
-
- case IRP_MJ_DEVICE_CONTROL:
- switch (io_stack->Parameters.DeviceIoControl.IoControlCode)
- {
- case IOCTL_FILE_DISK_OPEN_FILE:
-
- SeImpersonateClient(device_extension->security_client_context, NULL);
-
- irp->IoStatus.Status = FileDiskOpenFile(device_object, irp);
-
- PsRevertToSelf();
-
- break;
-
- case IOCTL_FILE_DISK_CLOSE_FILE:
- irp->IoStatus.Status = FileDiskCloseFile(device_object, irp);
- break;
-
- default:
- irp->IoStatus.Status = STATUS_DRIVER_INTERNAL_ERROR;
- }
- break;
-
- default:
- irp->IoStatus.Status = STATUS_DRIVER_INTERNAL_ERROR;
- }
-
- IoCompleteRequest(
- irp,
- (CCHAR) (NT_SUCCESS(irp->IoStatus.Status) ?
- IO_DISK_INCREMENT : IO_NO_INCREMENT)
- );
- }
- }
-}
-
-#pragma code_seg("PAGE")
-
-NTSTATUS
-FileDiskOpenFile (
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- PDEVICE_EXTENSION device_extension;
- POPEN_FILE_INFORMATION open_file_information;
- UNICODE_STRING ufile_name;
- NTSTATUS status;
- OBJECT_ATTRIBUTES object_attributes;
- FILE_END_OF_FILE_INFORMATION file_eof;
- FILE_BASIC_INFORMATION file_basic;
- FILE_STANDARD_INFORMATION file_standard;
- FILE_ALIGNMENT_INFORMATION file_alignment;
-
- PAGED_CODE();
-
- ASSERT(DeviceObject != NULL);
- ASSERT(Irp != NULL);
-
- device_extension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
-
- open_file_information = (POPEN_FILE_INFORMATION) Irp->AssociatedIrp.SystemBuffer;
-
- if (DeviceObject->DeviceType != FILE_DEVICE_CD_ROM)
- {
- device_extension->read_only = open_file_information->ReadOnly;
- }
-
- device_extension->file_name.Length = open_file_information->FileNameLength;
- device_extension->file_name.MaximumLength = open_file_information->FileNameLength;
- device_extension->file_name.Buffer = ExAllocatePool(NonPagedPool, open_file_information->FileNameLength);
-
- RtlCopyMemory(
- device_extension->file_name.Buffer,
- open_file_information->FileName,
- open_file_information->FileNameLength
- );
-
- status = RtlAnsiStringToUnicodeString(
- &ufile_name,
- &device_extension->file_name,
- TRUE
- );
-
- if (!NT_SUCCESS(status))
- {
- ExFreePool(device_extension->file_name.Buffer);
- Irp->IoStatus.Status = status;
- Irp->IoStatus.Information = 0;
- return status;
- }
-
- InitializeObjectAttributes(
- &object_attributes,
- &ufile_name,
- OBJ_CASE_INSENSITIVE,
- NULL,
- NULL
- );
-
- status = ZwCreateFile(
- &device_extension->file_handle,
- device_extension->read_only ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE,
- &object_attributes,
- &Irp->IoStatus,
- NULL,
- FILE_ATTRIBUTE_NORMAL,
- device_extension->read_only ? FILE_SHARE_READ : 0,
- FILE_OPEN,
- FILE_NON_DIRECTORY_FILE |
- FILE_RANDOM_ACCESS |
- FILE_NO_INTERMEDIATE_BUFFERING |
- FILE_SYNCHRONOUS_IO_NONALERT,
- NULL,
- 0
- );
-
- if (status == STATUS_OBJECT_NAME_NOT_FOUND || status == STATUS_NO_SUCH_FILE)
- {
- if (device_extension->read_only || open_file_information->FileSize.QuadPart == 0)
- {
- ExFreePool(device_extension->file_name.Buffer);
- RtlFreeUnicodeString(&ufile_name);
-
- Irp->IoStatus.Status = STATUS_NO_SUCH_FILE;
- Irp->IoStatus.Information = 0;
-
- return STATUS_NO_SUCH_FILE;
- }
- else
- {
- status = ZwCreateFile(
- &device_extension->file_handle,
- GENERIC_READ | GENERIC_WRITE,
- &object_attributes,
- &Irp->IoStatus,
- &open_file_information->FileSize,
- FILE_ATTRIBUTE_NORMAL,
- 0,
- FILE_OPEN_IF,
- FILE_NON_DIRECTORY_FILE |
- FILE_RANDOM_ACCESS |
- FILE_NO_INTERMEDIATE_BUFFERING |
- FILE_SYNCHRONOUS_IO_NONALERT,
- NULL,
- 0
- );
-
- if (!NT_SUCCESS(status))
- {
- ExFreePool(device_extension->file_name.Buffer);
- RtlFreeUnicodeString(&ufile_name);
- return status;
- }
-
- if (Irp->IoStatus.Information == FILE_CREATED)
- {
- file_eof.EndOfFile.QuadPart = open_file_information->FileSize.QuadPart;
-
- status = ZwSetInformationFile(
- device_extension->file_handle,
- &Irp->IoStatus,
- &file_eof,
- sizeof(FILE_END_OF_FILE_INFORMATION),
- FileEndOfFileInformation
- );
-
- if (!NT_SUCCESS(status))
- {
- ExFreePool(device_extension->file_name.Buffer);
- RtlFreeUnicodeString(&ufile_name);
- ZwClose(device_extension->file_handle);
- return status;
- }
- }
- }
- }
- else if (!NT_SUCCESS(status))
- {
- ExFreePool(device_extension->file_name.Buffer);
- RtlFreeUnicodeString(&ufile_name);
- return status;
- }
-
- RtlFreeUnicodeString(&ufile_name);
-
- status = ZwQueryInformationFile(
- device_extension->file_handle,
- &Irp->IoStatus,
- &file_basic,
- sizeof(FILE_BASIC_INFORMATION),
- FileBasicInformation
- );
-
- if (!NT_SUCCESS(status))
- {
- ExFreePool(device_extension->file_name.Buffer);
- ZwClose(device_extension->file_handle);
- return status;
- }
-
-/*
- //
- // The NT cache manager can deadlock if a filesystem that is using the cache
- // manager is used in a virtual disk that stores its file on a filesystem
- // that is also using the cache manager, this is why we open the file with
- // FILE_NO_INTERMEDIATE_BUFFERING above, however if the file is compressed
- // or encrypted NT will not honor this request and cache it anyway since it
- // need to store the decompressed/unencrypted data somewhere, therefor we put
- // an extra check here and don't alow disk images to be compressed/encrypted.
- //
- if (file_basic.FileAttributes & (FILE_ATTRIBUTE_COMPRESSED | FILE_ATTRIBUTE_ENCRYPTED))
- {
- ExFreePool(device_extension->file_name.Buffer);
- ZwClose(device_extension->file_handle);
- Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
- Irp->IoStatus.Information = 0;
- return STATUS_ACCESS_DENIED;
- }
-*/
-
- status = ZwQueryInformationFile(
- device_extension->file_handle,
- &Irp->IoStatus,
- &file_standard,
- sizeof(FILE_STANDARD_INFORMATION),
- FileStandardInformation
- );
-
- if (!NT_SUCCESS(status))
- {
- ExFreePool(device_extension->file_name.Buffer);
- ZwClose(device_extension->file_handle);
- return status;
- }
-
- device_extension->file_size.QuadPart = file_standard.EndOfFile.QuadPart;
-
- status = ZwQueryInformationFile(
- device_extension->file_handle,
- &Irp->IoStatus,
- &file_alignment,
- sizeof(FILE_ALIGNMENT_INFORMATION),
- FileAlignmentInformation
- );
-
- if (!NT_SUCCESS(status))
- {
- ExFreePool(device_extension->file_name.Buffer);
- ZwClose(device_extension->file_handle);
- return status;
- }
-
- DeviceObject->AlignmentRequirement = file_alignment.AlignmentRequirement;
-
- if (device_extension->read_only)
- {
- DeviceObject->Characteristics |= FILE_READ_ONLY_DEVICE;
- }
- else
- {
- DeviceObject->Characteristics &= ~FILE_READ_ONLY_DEVICE;
- }
-
- device_extension->media_in_device = TRUE;
-
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
-
- return STATUS_SUCCESS;
-}
-
-NTSTATUS
-FileDiskCloseFile (
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- PDEVICE_EXTENSION device_extension;
-
- PAGED_CODE();
-
- ASSERT(DeviceObject != NULL);
- ASSERT(Irp != NULL);
-
- device_extension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
-
- ExFreePool(device_extension->file_name.Buffer);
-
- ZwClose(device_extension->file_handle);
-
- device_extension->media_in_device = FALSE;
-
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
-
- return STATUS_SUCCESS;
-}
-
-NTSTATUS
-FileDiskAdjustPrivilege (
- IN ULONG Privilege,
- IN BOOLEAN Enable
- )
-{
- NTSTATUS status;
- HANDLE token_handle;
- TOKEN_PRIVILEGES token_privileges;
-
- PAGED_CODE();
-
- status = ZwOpenProcessToken(
- NtCurrentProcess(),
- TOKEN_ALL_ACCESS,
- &token_handle
- );
-
- if (!NT_SUCCESS(status))
- {
- return status;
- }
-
- token_privileges.PrivilegeCount = 1;
- token_privileges.Privileges[0].Luid = RtlConvertUlongToLuid(Privilege);
- token_privileges.Privileges[0].Attributes = Enable ? SE_PRIVILEGE_ENABLED : 0;
-
- //
- // Normaly one would use ZwAdjustPrivilegesToken but it is only available
- // on Windows 2000 and later versions, however since we are in a system
- // thread does ExGetPreviousMode always return KernelMode and therefore
- // can NtAdjustPrivilegesToken be used directly.
- //
- status = NtAdjustPrivilegesToken(
- token_handle,
- FALSE,
- &token_privileges,
- sizeof(token_privileges),
- NULL,
- NULL
- );
-
- ZwClose(token_handle);
-
- return status;
-}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/filedisk/sys/src/filedisk.rc
--- a/buildframework/helium/external/filedisk/sys/src/filedisk.rc Wed Oct 28 14:39:48 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-//Microsoft Developer Studio generated resource script.
-//
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifndef _MAC
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,14
- PRODUCTVERSION 1,0,0,14
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x3L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "Bo Brantén\0"
- VALUE "FileDescription", "FileDisk Virtual Disk Driver\0"
- VALUE "FileVersion", "1.0.0.14\0"
- VALUE "InternalName", "filedisk\0"
- VALUE "LegalCopyright", "Copyright © 1999-2006 Bo Brantén\0"
- VALUE "OriginalFilename", "filedisk.sys\0"
- VALUE "ProductName", "filedisk\0"
- VALUE "ProductVersion", "1.0.0.14\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif // !_MAC
-
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE DISCARDABLE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE DISCARDABLE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE DISCARDABLE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/bin/helium-core.jar
Binary file buildframework/helium/external/helium-antlib/bin/helium-core.jar has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/bin/helium-diamonds.jar
Binary file buildframework/helium/external/helium-antlib/bin/helium-diamonds.jar has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/bin/helium-imaker.jar
Binary file buildframework/helium/external/helium-antlib/bin/helium-imaker.jar has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/bin/helium-logging.jar
Binary file buildframework/helium/external/helium-antlib/bin/helium-logging.jar has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/bin/helium-metadata.jar
Binary file buildframework/helium/external/helium-antlib/bin/helium-metadata.jar has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/bin/helium-quality.jar
Binary file buildframework/helium/external/helium-antlib/bin/helium-quality.jar has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/bin/helium-sbs.jar
Binary file buildframework/helium/external/helium-antlib/bin/helium-sbs.jar has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/bin/helium-scm.jar
Binary file buildframework/helium/external/helium-antlib/bin/helium-scm.jar has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/bin/helium-signaling.jar
Binary file buildframework/helium/external/helium-antlib/bin/helium-signaling.jar has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/bin/helium-sysdef.jar
Binary file buildframework/helium/external/helium-antlib/bin/helium-sysdef.jar has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/build.xml
--- a/buildframework/helium/external/helium-antlib/build.xml Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/build.xml Wed Dec 23 19:29:07 2009 +0200
@@ -24,7 +24,9 @@
Helium Antlib build file.
-
+
+
+
@@ -52,23 +54,41 @@
+
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/EmailDataSender.java
--- a/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/EmailDataSender.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/EmailDataSender.java Wed Dec 23 19:29:07 2009 +0200
@@ -150,15 +150,16 @@
toListLength = toAddressList.length;
InternetAddress[] addressList = new InternetAddress[toListLength];
try {
- log.debug("EmailDataSender:getToAddressList:length: "
+ log.debug("getToAddressList:length: "
+ toListLength);
for (int i = 0; i < toListLength; i++) {
- log.debug("EmailDataSender:getToAddressList:address:"
+ log.debug("getToAddressList:address:"
+ toAddressList[i]);
addressList[i] = new InternetAddress(toAddressList[i]);
}
} catch (Exception aex) {
- log.error("EmailDataSender:AddressException: " + aex);
+ // We are Ignoring the errors as no need to fail the build.
+ log.error("AddressException: " + aex);
}
return addressList;
}
@@ -217,10 +218,9 @@
public void sendData(String purpose, String fileToSend, String mimeType,
String subject, String header, boolean compressData) {
try {
- log.debug("EmailDataSender:sendData:file: " + fileToSend);
- log.debug("EmailDataSender:sendData:mimetype: " + mimeType);
+ log.debug("sendData:Send file: " + fileToSend + " and mimetype: " + mimeType);
if (fileToSend != null) {
- log.debug("EmailDataSender:sendData:smtp address: "
+ log.debug("sendData:smtp address: "
+ smtpServerAddress);
InternetAddress[] toAddresses = getToAddressList();
Properties props = new Properties();
@@ -235,15 +235,14 @@
MimeMultipart multipart = new MimeMultipart("related");
BodyPart messageBodyPart = new MimeBodyPart();
ByteArrayDataSource dataSrc = null;
- log.debug("EmailDataSender:sendData:Send file: " + fileToSend);
String fileName = new File(fileToSend).getName();
if (compressData) {
- log.debug("EmailDataSender: Sending compressed data");
+ log.debug("Sending compressed data");
dataSrc = compressFile(fileToSend);
dataSrc.setName(fileName + ".gz");
messageBodyPart.setFileName(fileName + ".gz");
} else {
- log.debug("EmailDataSender: Sending uncompressed data:");
+ log.debug("Sending uncompressed data:");
dataSrc = new ByteArrayDataSource(new FileInputStream(
new File(fileToSend)), mimeType);
@@ -267,15 +266,21 @@
InternetAddress fromAddress = getFromAddress();
message.setFrom(fromAddress);
} catch (Exception e) {
- log.debug("Error retrieving current user email address: " + e.getMessage());
+ // We are Ignoring the errors as no need to fail the build.
+ log.debug("Error retrieving current user email address: " + e.getMessage(), e);
}
message.addRecipients(Message.RecipientType.TO, toAddresses);
log.info("Sending email alert: " + subject);
Transport.send(message);
}
} catch (Exception e) {
- log.info("Not sending e-mail signal because of errors");
- log.debug("Failed sending e-mail: " + purpose + ": ", e);
+ String errorMessage = e.getMessage();
+ String fullErrorMessage = "Failed sending e-mail: " + purpose;
+ if (errorMessage != null) {
+ fullErrorMessage += " " + errorMessage;
+ }
+ // We are Ignoring the errors as no need to fail the build.
+ log.info(fullErrorMessage);
}
}
@@ -342,12 +347,11 @@
if (en.hasMore()) {
SearchResult sr = en.next();
String email = (String) sr.getAttributes().get("mail").get();
- log.debug("EmailDataSender:getUserEmail:" + email);
+ log.debug("getUserEmail:" + email);
return email;
}
} catch (javax.naming.NameNotFoundException ex) {
- log.debug("EmailDataSender:username:" + username + "finding error");
- throw new HlmAntLibException("Error find user email");
+ throw new HlmAntLibException("Error finding user email for " + username );
}
throw new HlmAntLibException("Could not find user email in LDAP.");
}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/TemplateProcessor.java
--- a/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/TemplateProcessor.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/TemplateProcessor.java Wed Dec 23 19:29:07 2009 +0200
@@ -68,15 +68,12 @@
}
}
} catch (java.io.IOException e) {
- log.warn("I/O Error during template conversion: " + e.getMessage());
throw new TemplateProcessorException(
"I/O Error during template conversion: " + e.getMessage());
} catch (org.xml.sax.SAXException e1) {
- log.warn("XML parser error: " + e1);
throw new TemplateProcessorException("XML parser error: "
+ e1.getMessage());
} catch (javax.xml.parsers.ParserConfigurationException e3) {
- log.warn("Parser error: " + e3);
throw new TemplateProcessorException("Parser error: "
+ e3.getMessage());
}
@@ -111,7 +108,6 @@
convertTemplate(templateFile.getParent(), templateFile.getName(),
outputFile.toString(), sourceList);
} else {
- log.error("Template file is not defined.");
throw new TemplateProcessorException("Template file not defined.");
}
}
@@ -145,16 +141,10 @@
.debug("diamonds:TemplateProcessor:adding template directory loader: "
+ templateDir);
} catch (java.io.IOException ie) {
- log.debug("Template directory configuring error.");
- log.info("Template directory configuring error.");
throw new TemplateProcessorException(
"Template directory configuring error: " + ie);
}
} else {
- log.debug("Template directory does not exist: "
- + templateDirFile.getAbsolutePath());
- log.info("Template directory does not exist: "
- + templateDirFile.getAbsolutePath());
throw new TemplateProcessorException(
"Template directory does not exist: "
+ templateDirFile.getAbsolutePath());
@@ -164,14 +154,11 @@
Map templateMap = getTemplateMap(sourceList);
template.process(templateMap, new FileWriter(outputFile));
} catch (freemarker.core.InvalidReferenceException ivx) {
- log.warn("Invalid reference in configuration: ", ivx);
throw new TemplateProcessorException(
"Invalid reference in config: " + ivx);
} catch (freemarker.template.TemplateException e2) {
- log.warn("TemplateException: ", e2);
throw new TemplateProcessorException("TemplateException: " + e2);
} catch (java.io.IOException e) {
- log.warn("I/O Error during template conversion: " + e.getMessage());
throw new TemplateProcessorException(
"I/O Error during template conversion: " + e);
}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/HeliumExecutor.java
--- a/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/HeliumExecutor.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/HeliumExecutor.java Wed Dec 23 19:29:07 2009 +0200
@@ -67,7 +67,7 @@
*/
public void executeTargets(Project project, String[] targetNames) {
this.project = project;
- log.debug("[HeliumExecutor] Running executeTargets");
+ log.debug("Running executeTargets");
BuildException failure = null;
try {
loadModules(project);
@@ -75,6 +75,7 @@
super.executeTargets(project, targetNames);
} catch (BuildException e) {
// Saving current issue
+ // We are Ignoring the errors as no need to fail the build.
failure = e;
}
@@ -119,7 +120,7 @@
if (file == null) {
return;
}
- log.debug("[HeliumExecutor] Loading " + moduleLib.getName());
+ log.debug("Loading " + moduleLib.getName());
ImportTask task = new ImportTask();
Target target = new Target();
target.setName("");
@@ -152,13 +153,13 @@
if (tempExceptionDefList != null) {
exceptionHandlers.put(moduleName, tempExceptionDefList);
}
- log.debug("HeliumExecutor:loadModule:pre-opsize"
+ log.debug("loadModule:pre-opsize"
+ preOperations.size());
- log.debug("HeliumExecutor:loadModule:post-opsize"
+ log.debug("loadModule:post-opsize"
+ postOperations.size());
- log.debug("HeliumExecutor:loadModule:exception-opsize"
+ log.debug("loadModule:exception-opsize"
+ exceptionHandlers.size());
- log.debug("[HeliumExecutor] Checking " + moduleLib);
+ log.debug("Checking " + moduleLib);
}
}
@@ -195,7 +196,7 @@
URL url = findHeliumAntlibXml(moduleLib);
if (url == null)
return null;
- log.debug("[HeliumExecutor] Getting " + url);
+ log.debug("Getting " + url);
JarURLConnection jarConnection = (JarURLConnection) url
.openConnection();
@@ -213,10 +214,10 @@
}
writer.close();
reader.close();
- log.debug("[HeliumExecutor] Temp file " + file.getAbsolutePath());
+ log.debug("Temp file " + file.getAbsolutePath());
return file.getAbsolutePath();
} catch (Exception ex) {
- log.error("[HeliumExecutor] Error: ", ex);
+ log.error("Error: " + ex.getMessage(), ex);
return null;
}
}
@@ -224,9 +225,9 @@
private void doOperations(
HashMap> operations, Project prj,
String[] targetNames) {
- log.debug("HeliumExecutor:doOperations: start");
+ log.debug("doOperations: start");
for (String moduleName : operations.keySet()) {
- log.debug("HeliumExecutor:doOperations: module" + moduleName);
+ log.debug("doOperations: module" + moduleName);
for (HlmDefinition definition : operations.get(moduleName)) {
definition.execute(prj, moduleName, targetNames);
}
@@ -234,9 +235,8 @@
}
private void handleExceptions(Project prj, Exception e) {
- log.debug("HeliumExecutor:handleExceptions: start");
for (String moduleName : this.exceptionHandlers.keySet()) {
- log.debug("HeliumExecutor:handleExceptions: module" + moduleName);
+ log.debug("handleExceptions: module" + moduleName);
for (HlmExceptionHandler exceptionHandler : this.exceptionHandlers
.get(moduleName)) {
exceptionHandler.handleException(prj, moduleName, e);
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/VariableIFImpl.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/VariableIFImpl.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.helium.core.ant;
+
+import org.apache.tools.ant.types.DataType;
+import com.nokia.helium.core.ant.types.Variable;
+import java.util.Collection;
+
+/**
+ * Interface to get the list of variables of type VariableSet
+ */
+public class VariableIFImpl extends DataType
+{
+
+
+ /**
+ * Get the name of the variable.
+ * @return name.
+ */
+ public Collection getVariables() {
+ //Implemented by sub class
+ return null;
+ }
+
+}
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/VariableInterface.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/VariableInterface.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.helium.core.ant;
+
+import com.nokia.helium.core.ant.types.Variable;
+import java.util.Collection;
+
+/**
+ * Interface to get the list of variables of type VariableSet
+ */
+public interface VariableInterface
+{
+
+
+ /**
+ * Get the name of the variable.
+ * @return name.
+ */
+ Collection getVariables();
+
+}
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/antlib.xml
--- a/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/antlib.xml Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/antlib.xml Wed Dec 23 19:29:07 2009 +0200
@@ -24,10 +24,14 @@
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/conditions/XMLLogCondition.java
--- a/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/conditions/XMLLogCondition.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/conditions/XMLLogCondition.java Wed Dec 23 19:29:07 2009 +0200
@@ -87,8 +87,7 @@
if (severity == null)
throw new BuildException("'severity' attribute is not defined");
- this.log("Looking for severity '" + severity + "' under '"
- + fileName.getAbsolutePath() + "'");
+ //this.log("Looking for severity '" + severity + "' under '" + fileName.getAbsolutePath() + "'");
SAXParserFactory factory = SAXParserFactory.newInstance();
try {
SAXParser saxParser = factory.newSAXParser();
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/helium.antlib.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/helium.antlib.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,33 @@
+
+
+
+
+ Ant task definition declarations.
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/taskdefs/GetValueFromVariableSet.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/taskdefs/GetValueFromVariableSet.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.helium.core.ant.taskdefs;
+
+import org.apache.tools.ant.BuildException;
+import java.util.Vector;
+import java.util.Collection;
+import com.nokia.helium.core.ant.VariableIFImpl;
+import org.apache.tools.ant.Task;
+import com.nokia.helium.core.ant.types.Variable;
+
+
+/**
+ * To retrive a variable value from a collection of variable set based on name, which contains property-value in pair.
+ *
+ *
+ * Example:
+ *
+ * <hlm:argSet id="test.variableSet">
+ * <variable name="v1" value="the_value_1"/>
+ * <variable name="v2" value="the_value_2"/>
+ * <variable name="v3" value="the_value_3"/>
+ * </hlm:argSet>
+ *
+ * <hlm:getVariableValue name="v3" property="v1.value">
+ * <hlm:argSet refid="test.variableSet"/>
+ * </hlm:getVariableValue>
+ *
+ * @ant.task name="getVariableValue"
+ */
+public class GetValueFromVariableSet extends Task {
+ private String name;
+ private String property;
+ private boolean failOnError = true;
+
+ private Vector variableIntefaces = new Vector();
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Helper function to set failonerror attribute for the task.
+ * @param failStatus, if true will fail the build if no variable is found for
+ * matching name.
+ */
+ public void setFailOnError(boolean failStatus) {
+ failOnError = failStatus;
+ }
+
+ /**
+ * Helper function to store the name of the property where the value to be stored
+ * @param property name of the property where the result to be stored
+ */
+ public void setProperty(String property) {
+ this.property = property;
+ }
+
+ /**
+ * Helper function to create the VariableIFImpl object.
+ * @return created VariableIFImpl instance
+ */
+ public VariableIFImpl createVariableIFImpl() {
+ VariableIFImpl var = new VariableIFImpl();
+ add(var);
+ return var;
+ }
+
+
+ /**
+ * Helper function to add the newly created variable set. Called by ant.
+ * @param vs variable set to be added.
+ */
+ public void add(VariableIFImpl vs) {
+ variableIntefaces.add(vs);
+ }
+
+ public VariableIFImpl getVariableInterface() {
+ if (variableIntefaces.isEmpty()) {
+ throw new BuildException("variable interface cannot be null");
+ }
+ if (variableIntefaces.size() > 1 ) {
+ throw new BuildException("maximum one variable interface can be set");
+ }
+ return variableIntefaces.elementAt(0);
+ }
+
+
+ /**
+ * Task to get the name / value pair
+ * @return return the name / value pair for the variable set.
+ */
+ public void execute() {
+ if (name == null)
+ throw new BuildException("'name' attribute has not been defined.");
+ if (property == null)
+ throw new BuildException(
+ "'property' attribute has not been defined.");
+ VariableIFImpl varInterface = getVariableInterface();
+ Collection variables = varInterface.getVariables();
+ for (Variable var : variables) {
+ if (var.getName().equals(name)) {
+ getProject().setProperty(property, var.getValue());
+ return;
+ }
+ }
+ if (failOnError) {
+ throw new BuildException("Could not find '" + name + "' variable.");
+ }
+ }
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/taskdefs/ValidateUserLogin.java
--- a/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/taskdefs/ValidateUserLogin.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/taskdefs/ValidateUserLogin.java Wed Dec 23 19:29:07 2009 +0200
@@ -18,6 +18,7 @@
package com.nokia.helium.core.ant.taskdefs;
import org.apache.tools.ant.Task;
+import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildException;
import javax.naming.*;
import javax.naming.directory.*;
@@ -138,6 +139,8 @@
DirContext authContext = new InitialDirContext(env);
return true;
} catch (NamingException e) {
+ // We are Ignoring the errors as no need to fail the build.
+ log("Not able to validate the user. " + e.getMessage(), Project.MSG_DEBUG);
return false;
}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/types/HlmFinalTargetDef.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/types/HlmFinalTargetDef.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.helium.core.ant.types;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Target;
+import java.util.Hashtable;
+import org.apache.log4j.Logger;
+
+
+/**
+ * Class to execute the final target as post operation.
+ */
+public class HlmFinalTargetDef extends HlmPostDefImpl
+{
+ private Logger log = Logger.getLogger(HlmFinalTargetDef.class);
+
+ /**
+ * This post action will execute the final target if any to be executed.
+ * @param prj
+ * @param module
+ * @param targetNames
+ *
+ */
+ public void execute(Project prj, String module, String[] targetNames) {
+ String finalTargetName = prj.getProperty("hlm.target.final");
+ log.debug("Calling final target" + finalTargetName);
+ if (finalTargetName != null) {
+ Hashtable targets = prj.getTargets();
+ Target finalTarget = (Target)targets.get(finalTargetName);
+ if (finalTarget == null) {
+ log.info("The final target : " + finalTargetName + " not available skipping");
+ return;
+ }
+ finalTarget.execute();
+ }
+ }
+}
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/types/HlmImportDef.java
--- a/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/types/HlmImportDef.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/types/HlmImportDef.java Wed Dec 23 19:29:07 2009 +0200
@@ -45,8 +45,7 @@
* Will import the given file.
*/
public void execute(Project prj, String module, String[] targetNames) {
- log.debug("importdef:fileName" + file.toString());
- log.debug("importdef:prj name" + prj.getName());
+ log.debug("importdef:prj name" + prj.getName() + ". fileName" + file.toString());
ImportTask task = new ImportTask();
Target target = new Target();
target.setName("");
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/types/HlmListenerDef.java
--- a/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/types/HlmListenerDef.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/types/HlmListenerDef.java Wed Dec 23 19:29:07 2009 +0200
@@ -20,6 +20,7 @@
import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildListener;
+import org.apache.log4j.Logger;
/**
* This class implements a listener registration action.
@@ -29,6 +30,7 @@
public class HlmListenerDef extends HlmPreDefImpl {
private String classname;
+ private Logger log = Logger.getLogger(HlmListenerDef.class);
public void setClassname(String classname) {
this.classname = classname;
@@ -44,11 +46,11 @@
.newInstance();
prj.addBuildListener(listener);
} catch (ClassNotFoundException ex) {
- ex.printStackTrace();
+ log.debug("Class not found exception:" + ex.getMessage(), ex);
} catch (InstantiationException ex1) {
- ex1.printStackTrace();
+ log.debug("Class Instantiation exception:" + ex1.getMessage(), ex1);
} catch (IllegalAccessException ex1) {
- ex1.printStackTrace();
+ log.debug("Illegal Class Access exception:" + ex1.getMessage(), ex1);
}
}
}
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/types/HlmPostDefImpl.java
--- a/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/types/HlmPostDefImpl.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/types/HlmPostDefImpl.java Wed Dec 23 19:29:07 2009 +0200
@@ -35,6 +35,6 @@
* Do nothing.
*/
public void execute(Project prj, String module, String[] targetNames) {
- log.debug("HlmPostDefImpl:execute:" + module);
+ // Empty method. Implemented by extending classes.
}
}
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/types/Variable.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/types/Variable.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.helium.core.ant.types;
+
+import org.apache.tools.ant.types.DataType;
+import org.apache.tools.ant.BuildException;
+import org.apache.log4j.Logger;
+
+/**
+ * Helper class to store the command line variables
+ * with name / value pair.
+ * @ant.type name="arg"
+ * @ant.type name="makeOption"
+ */
+public class Variable extends DataType
+{
+ private static Logger log = Logger.getLogger(Variable.class);
+ private String name;
+ private String value;
+ private String cmdLine;
+
+
+ public Variable() {
+ }
+
+ /**
+ * Set the name of the variable.
+ * @param name
+ */
+ public void setName(String nm) {
+ name = nm;
+ }
+
+
+ /**
+ * Get the name of the variable.
+ * @return name.
+ */
+ public String getName() {
+ if ( cmdLine == null) {
+ if (name == null ) {
+ throw new BuildException( "name should not be null");
+ }
+ if (value == null) {
+ throw new BuildException( "value should not be null");
+ }
+ return name;
+ } else {
+ if (name != null && value != null) {
+ throw new BuildException( "you can define either name, value or line attribute and not both");
+ }
+ String cmdPart = cmdLine.trim();
+ String[] cmdArgs = cmdPart.split(" ");
+ return cmdArgs[0];
+ }
+ }
+
+ /**
+ * Set the value of the variable.
+ * @param value
+ */
+ public void setValue(String vlue) {
+ value = vlue;
+ }
+
+ /**
+ * Helper function to set the command line string
+ * @param line, string as input to command line.
+ */
+ public void setLine(String line) {
+ cmdLine = line;
+ }
+
+ /**
+ * Get the value of the variable.
+ * @return value.
+ */
+ public String getValue() {
+ if ( cmdLine == null) {
+ if (name == null ) {
+ throw new BuildException( "name should not be null");
+ }
+ if (value == null) {
+ throw new BuildException( "value should not be null");
+ }
+ return value;
+ } else {
+ if (name != null && value != null) {
+ throw new BuildException( "you can define either name, value or line attribute and not both");
+ }
+ return cmdLine;
+ }
+ }
+ /**
+ * Get the command line parameter
+ * @return command line string.
+ */
+ public String getParameter() {
+ if ( cmdLine == null) {
+ if (name == null ) {
+ throw new BuildException( "name should not be null");
+ }
+ if (value == null) {
+ throw new BuildException( "value should not be null");
+ }
+ return name + "=" + value;
+ } else {
+ if (name != null && value != null) {
+ throw new BuildException( "you can define either name, value or line attribute and not both");
+ }
+ return cmdLine;
+ }
+ }
+
+}
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/types/VariableSet.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/ant/types/VariableSet.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,160 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.helium.core.ant.types;
+
+import java.util.Vector;
+import java.util.HashMap;
+import java.util.List;
+import com.nokia.helium.core.ant.VariableIFImpl;
+import java.util.Collection;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Reference;
+import java.util.ArrayList;
+import org.apache.log4j.Logger;
+
+/**
+ * Helper class to store the variable set (list of variables
+ * with name / value pair)
+ * @ant.type name="argSet"
+ */
+public class VariableSet extends VariableIFImpl {
+
+ private static Logger log = Logger.getLogger(VariableSet.class);
+
+ private HashMap variablesMap = new HashMap();
+
+ private List variables = new ArrayList ();
+
+ private Vector varSets = new Vector();
+
+ private VariableSet currentSet;
+
+ /**
+ * Constructor
+ */
+ public VariableSet() {
+ }
+
+ /**
+ * Helper function to add the created varset
+ * @param filter to be added to the varset
+ */
+ public void add(VariableSet varSet) {
+ currentSet = null;
+ if (varSet != null) {
+ varSets.add(varSet);
+ }
+ }
+
+ /**
+ * Creates an empty variable element and adds
+ * it to the variables list
+ * @return empty Variable pair
+ */
+ public VariableSet createArgSet() {
+ VariableSet varSet = new VariableSet();
+ add(varSet);
+ return varSet;
+ }
+
+ /**
+ * Creates an empty variable element and adds
+ * it to the variables list
+ * @return empty Variable pair
+ */
+ public Variable createArg() {
+ Variable var = new Variable();
+ add(var);
+ return var;
+ }
+
+ private void addVariable(Variable var) {
+ variables.add(var);
+ }
+
+ /**
+ * Add a given variable to the list
+ * @param var variable to add
+ */
+ public void add(Variable var) {
+ if ( currentSet == null) {
+ currentSet = new VariableSet();
+ varSets.add(currentSet);
+ }
+ currentSet.addVariable(var);
+ }
+
+ /**
+ * Helper function to get the list of variables defined for this set.
+ * @return variable list for this set.
+ */
+ public List getVariablesList() {
+ return variables;
+ }
+
+ public List getVariableSets() {
+ return varSets;
+ }
+
+
+ /**
+ * Helper function to return the list of variables and its references
+ * @return variable list for this set and its references.
+ */
+ public Collection getVariables() {
+ HashMap varMap = getVariablesMap();
+ //if (varMap.isEmpty()) {
+ // throw new BuildException("Variable should not be empty and should contain one arg");
+ //}
+ return getVariablesMap().values();
+ }
+ /**
+ * Returns the list of variables available in the VariableSet
+ * @return variable list
+ */
+ public HashMap getVariablesMap() {
+ HashMap allVariables = new HashMap();
+ // Then filters as reference in filterset
+ Reference refId = getRefid();
+ Object varSetObject = null;
+ if (refId != null) {
+ try {
+ varSetObject = refId.getReferencedObject();
+ } catch ( Exception ex) {
+ log.debug("exception in getting variable", ex);
+ throw new BuildException("Not found: " + ex.getMessage());
+ }
+ if (varSetObject != null && varSetObject instanceof VariableSet) {
+ HashMap varSetMap = ((VariableSet)varSetObject).getVariablesMap();
+ allVariables.putAll(varSetMap);
+ }
+ }
+ if (varSets != null && (!varSets.isEmpty())) {
+ for (VariableSet varSet : varSets) {
+ HashMap variablesMap = varSet.getVariablesMap();
+ allVariables.putAll(variablesMap);
+ }
+ }
+ if (variables != null && !variables.isEmpty()) {
+ for (Variable var : variables) {
+ allVariables.put(var.getName(), var);
+ }
+ }
+ return allVariables;
+ }
+}
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/plexus/AntStreamConsumer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/plexus/AntStreamConsumer.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.core.plexus;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+/**
+ * Handle the output lines and redirect them to Ant logging.
+ * The logging level is configurable.
+ *
+ */
+public class AntStreamConsumer implements StreamConsumer {
+
+ private Task task;
+ private int level = Project.MSG_INFO;
+
+ /**
+ * Initialize the consumer with the task that will be used to
+ * redirect the consumed lines. Default logging level will be
+ * Project.MSG_INFO.
+ * @param task an Ant task
+ */
+ public AntStreamConsumer(Task task) {
+ this.task = task;
+ }
+
+ /**
+ * Initialize the consumer with the task that will be used to
+ * redirect the consumed lines, and the level of logging.
+ * @param task ant Ant task.
+ * @param level ant logging level to use.
+ */
+ public AntStreamConsumer(Task task, int level) {
+ this.task = task;
+ this.level = level;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void consumeLine(String line) {
+ task.log(line, level);
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/plexus/CommandBase.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/plexus/CommandBase.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,214 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.core.plexus;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+import org.codehaus.plexus.util.Os;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+/**
+ * This abstract class implements some basic support to execute commands and
+ * redirect outputs to StreamConsumer. You can have common stream consumers or
+ * execution base streamconsumers. The exception type raised
+ * can be controlled by the implementing class.
+ *
+ * @param
+ */
+public abstract class CommandBase {
+ private final Logger log = Logger.getLogger(getClass());
+ private Vector outputHandlers = new Vector();
+ private Vector errorHandlers = new Vector();
+
+ /**
+ * Get the executable name.
+ * @return
+ */
+ protected abstract String getExecutable();
+
+ /**
+ * Throw an exception with message and cause.
+ * @param message
+ * @param t
+ * @throws T
+ */
+ protected abstract void throwException(String message, Throwable t) throws T;
+
+ /**
+ * Throw an exception with message only.
+ * @param message
+ * @throws T
+ */
+ protected void throwException(String message) throws T {
+ throwException(message, null);
+ }
+
+ /**
+ * Location where to execute the command. The default location
+ * is the current directory.
+ * @return a File object pointing to a directory.
+ */
+ public File getWorkingDir() {
+ return new File(".");
+ }
+
+ /**
+ * Add a LineHandler to the CommandBase instance.
+ * LineHandlers could be used to record/log the output stream
+ * command invocation.
+ * @param lineHandler a lineHandle instance
+ */
+ public void addOutputLineHandler(StreamConsumer lineHandler) {
+ if (lineHandler != null) {
+ outputHandlers.add(lineHandler);
+ }
+ }
+
+ /**
+ * Add a LineHandler to the CommandBase instance.
+ * LineHandlers could be used to record/log the output error stream
+ * command invocation.
+ * @param lineHandler a lineHandle instance
+ */
+ public void addErrorLineHandler(StreamConsumer lineHandler) {
+ if (lineHandler != null) {
+ errorHandlers.add(lineHandler);
+ }
+ }
+
+ /**
+ * Execute the command defined by getExecutable with args as list of arguments.
+ *
+ * @param args
+ * @throws T extends
+ */
+ public void execute(String[] args) throws T {
+ execute(args, null);
+ }
+
+ /**
+ * Execute the command given by getExecutable with args as list of arguments and custom StreamConsumer.
+ *
+ * @param args
+ * an array representing blocks arguments
+ * @param output
+ * the StreamConsumer to analyze the output with. If null it is
+ * ignored.
+ * @throws T
+ */
+ public void execute(String[] args, StreamConsumer output) throws T {
+ execute(args, null, output);
+ }
+
+ /**
+ * Execute the command given by getExecutable with args as list of arguments and custom StreamConsumer.
+ * Also env content will be added to the environment.
+ *
+ * @param args
+ * an array representing blocks arguments
+ * @param env
+ * additional key to add the environment
+ * @param output
+ * the StreamConsumer to analyze the output with. If null it is
+ * ignored.
+ * @throws T
+ */
+ public void executeCmdLine(String argLine, Map env, StreamConsumer output)
+ throws T {
+ Commandline cmdLine = new Commandline();
+ cmdLine.createArg().setValue(getExecutable());
+ if (argLine != null) {
+ cmdLine.createArg().setLine(argLine);
+ }
+ executeCmd(cmdLine, env, output);
+ }
+
+ private void executeCmd(Commandline cmdLine, Map env, StreamConsumer output) throws T {
+ if (env != null) {
+ for (Map.Entry entry : env.entrySet()) {
+ cmdLine.addEnvironment(entry.getKey(), entry.getValue());
+ }
+ }
+ cmdLine.setWorkingDirectory(getWorkingDir());
+
+ // This is only needed on windows.
+ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+ cmdLine.createArg().setLine("&& exit %%ERRORLEVEL%%");
+ }
+
+
+ StreamMultiplexer inputMux = new StreamMultiplexer();
+ if (output != null) {
+ inputMux.addHandler(output);
+ }
+ for (StreamConsumer lh : outputHandlers) {
+ inputMux.addHandler(lh);
+ }
+
+ StreamMultiplexer errorMux = new StreamMultiplexer();
+ StreamRecorder errorRecorder = new StreamRecorder();
+ errorMux.addHandler(errorRecorder);
+ for (StreamConsumer lh : errorHandlers) {
+ errorMux.addHandler(lh);
+ }
+
+ try {
+ int err = CommandLineUtils.executeCommandLine(cmdLine, inputMux,
+ errorMux);
+ // check its exit value
+ log.debug("Execution of " + getExecutable() + " returned: " + err);
+ if (err != 0) {
+ throwException(errorRecorder.getBuffer() + " (return code: " + err
+ + ")");
+ }
+ } catch (CommandLineException e) {
+ throwException(
+ "Error executing " + getExecutable() + ": "
+ + e.toString());
+ }
+ }
+
+ /**
+ * Execute the command given by getExecutable with args as list of arguments and custom StreamConsumer.
+ * Also env content will be added to the environment.
+ *
+ * @param args
+ * an array representing blocks arguments
+ * @param env
+ * additional key to add the environment
+ * @param output
+ * the StreamConsumer to analyze the output with. If null it is
+ * ignored.
+ * @throws T
+ */
+ public void execute(String[] args, Map env, StreamConsumer output)
+ throws T {
+ Commandline cmdLine = new Commandline();
+ cmdLine.createArg().setValue(getExecutable());
+ if (args != null) {
+ cmdLine.addArguments(args);
+ }
+ executeCmd(cmdLine, env, output);
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/plexus/FileStreamConsumer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/plexus/FileStreamConsumer.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.core.plexus;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+import org.apache.log4j.Logger;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+/**
+ * Record a stream into a file.
+ *
+ */
+public class FileStreamConsumer implements StreamConsumer {
+ private Logger log = Logger.getLogger(getClass());
+ private Writer writer;
+
+ /**
+ * Create a FileStreamConsumer which will record content to
+ * the output file.
+ * @param output the file to write the output to.
+ * @throws FileNotFoundException if an error occur while opening the file.
+ */
+ public FileStreamConsumer(File output) throws FileNotFoundException {
+ writer = new OutputStreamWriter(new FileOutputStream(output));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public synchronized void consumeLine(String line) {
+ try {
+ writer.append(line + "\n");
+ } catch (IOException e) {
+ log.error("Error while writing to file: " + e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Closing the file.
+ */
+ public void close() {
+ try {
+ writer.flush();
+ writer.close();
+ } catch (IOException e) {
+ log.error("Error while writing to file: " + e.getMessage(), e);
+ }
+ }
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/plexus/StreamMultiplexer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/plexus/StreamMultiplexer.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.core.plexus;
+
+import java.util.Vector;
+
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+/**
+ * Get the line consumed by a set of StreamConsumer.
+ *
+ */
+public class StreamMultiplexer implements StreamConsumer {
+
+ private Vector handlers = new Vector();
+
+ /**
+ * Add an StreamConsumer to the multiplexing.
+ * @param handler the StreamConsumer to add.
+ */
+ public void addHandler(StreamConsumer handler) {
+ handlers.add(handler);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void consumeLine(String line) {
+ for (StreamConsumer handler : handlers) {
+ handler.consumeLine(line);
+ }
+ }
+
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/plexus/StreamRecorder.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/src/com/nokia/helium/core/plexus/StreamRecorder.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.core.plexus;
+
+import org.apache.log4j.Logger;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+/**
+ * Record the consumed lines into a StringBuffer.
+ *
+ */
+public class StreamRecorder implements StreamConsumer {
+ private Logger log = Logger.getLogger(this.getClass());
+ private StringBuffer buffer = new StringBuffer();
+
+ /**
+ * Default constructor.
+ */
+ public StreamRecorder() {
+ }
+
+ /**
+ * This constructor allows you to set a custom
+ * buffer.
+ * @param buffer custom buffer object.
+ */
+ public StreamRecorder(StringBuffer buffer) {
+ this.buffer = buffer;
+ }
+
+ /**
+ * Get the current buffer.
+ * @return the current buffer object
+ */
+ public StringBuffer getBuffer() {
+ return buffer;
+ }
+
+ /**
+ * Set the buffer object.
+ * @param buffer custom buffer object.
+ */
+ public synchronized void setBuffer(StringBuffer buffer) {
+ this.buffer = buffer;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public synchronized void consumeLine(String line) {
+ log.debug(line);
+ buffer.append(line + "\n");
+ }
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/tests/bld.sh
--- a/buildframework/helium/external/helium-antlib/core/tests/bld.sh Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/core/tests/bld.sh Wed Dec 23 19:29:07 2009 +0200
@@ -19,5 +19,5 @@
module load java/1.6.0
-setenv ANT_ARGS "-lib ../../antlibs -lib ../../bin/helium-core.jar -lib ../../lib"
+setenv ANT_ARGS "-lib ../../antlibs -lib ../lib -lib ../../lib -lib ../../bin/helium-core.jar "
ant -Dant.executor.class="com.nokia.helium.core.ant.HeliumExecutor" $*
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/tests/build.bat
--- a/buildframework/helium/external/helium-antlib/core/tests/build.bat Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/core/tests/build.bat Wed Dec 23 19:29:07 2009 +0200
@@ -21,6 +21,6 @@
set TESTED_JAVA=C:\Apps\j2sdk_1.6.0_02
) ELSE set TESTED_JAVA=%JAVA_6_HOME%
if exist %TESTED_JAVA% (set JAVA_HOME=%TESTED_JAVA%)
-set ANT_ARGS=-lib %CD%\lib -lib %CD%\..\..\lib -lib %CD%\..\..\antlibs -lib %CD%\..\..\bin\helium-core.jar
+set ANT_ARGS=-lib %CD%\..\lib -lib %CD%\..\..\lib -lib %CD%\..\..\antlibs -lib %CD%\..\..\bin\helium-core.jar
ant -Dant.executor.class=com.nokia.helium.core.ant.HeliumExecutor %*
endlocal
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/tests/build.xml
--- a/buildframework/helium/external/helium-antlib/core/tests/build.xml Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/core/tests/build.xml Wed Dec 23 19:29:07 2009 +0200
@@ -22,13 +22,13 @@
-->
Helium antlib core tests.
+
+
+
-
-
-
-
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/tests/core/executor/test_executor.ant.xml
--- a/buildframework/helium/external/helium-antlib/core/tests/core/executor/test_executor.ant.xml Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/core/tests/core/executor/test_executor.ant.xml Wed Dec 23 19:29:07 2009 +0200
@@ -23,24 +23,59 @@
Helium antlib core executor tests.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/tests/core/variableset/build.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/tests/core/variableset/build.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,30 @@
+
+
+
+ Helium antlib core executor test config.
+
+
+ Running target.
+
+
+
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/tests/core/variableset/test_variableset.ant.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/tests/core/variableset/test_variableset.ant.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,127 @@
+
+
+
+ Helium antlib core variableset tests.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/tests/lib/ant-antunit-1.0.jar
Binary file buildframework/helium/external/helium-antlib/core/tests/lib/ant-antunit-1.0.jar has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/tests/src/com/nokia/helium/core/plexus/tests/TestAntStreamConsumer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/tests/src/com/nokia/helium/core/plexus/tests/TestAntStreamConsumer.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.core.plexus.tests;
+
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Echo;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import com.nokia.helium.core.plexus.AntStreamConsumer;
+
+public class TestAntStreamConsumer {
+
+ public class AntBuildListener implements BuildListener {
+ private StringBuffer log = new StringBuffer();
+
+ public StringBuffer getLog() {
+ return log;
+ }
+
+ @Override
+ public void buildFinished(BuildEvent arg0) {
+ }
+
+ @Override
+ public void buildStarted(BuildEvent arg0) {
+ }
+
+ @Override
+ public void messageLogged(BuildEvent arg0) {
+ log.append(arg0.getMessage());
+ }
+
+ @Override
+ public void targetFinished(BuildEvent arg0) {
+ }
+
+ @Override
+ public void targetStarted(BuildEvent arg0) {
+ }
+
+ @Override
+ public void taskFinished(BuildEvent arg0) {
+ }
+
+ @Override
+ public void taskStarted(BuildEvent arg0) {
+ }
+
+ }
+
+ @Test
+ public void testLoggingThroughAnt() {
+ // Setting up an Ant task
+ Project project = new Project();
+ AntBuildListener listener = new AntBuildListener();
+ project.addBuildListener(listener);
+ project.init();
+ Echo echo = new Echo();
+ echo.setProject(project);
+ echo.setMessage("From the echo task");
+
+
+ // Configuring the Ant consumer
+ AntStreamConsumer consumer = new AntStreamConsumer(echo);
+ consumer.consumeLine("consumed line!");
+ echo.execute();
+ assertTrue(listener.getLog().toString().contains("From the echo task"));
+ assertTrue(listener.getLog().toString().contains("consumed line!"));
+
+ }
+
+ @Test
+ public void testLoggingThroughAntAsError() {
+ // Setting up an Ant task
+ Project project = new Project();
+ AntBuildListener listener = new AntBuildListener();
+ project.addBuildListener(listener);
+ project.init();
+ Echo echo = new Echo();
+ echo.setProject(project);
+ echo.setMessage("From the echo task");
+
+
+ // Configuring the Ant consumer
+ AntStreamConsumer consumer = new AntStreamConsumer(echo, Project.MSG_ERR);
+ consumer.consumeLine("consumed line!");
+ echo.execute();
+ assertTrue(listener.getLog().toString().contains("From the echo task"));
+ assertTrue(listener.getLog().toString().contains("consumed line!"));
+
+ }
+
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/tests/src/com/nokia/helium/core/plexus/tests/TestCommandBase.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/tests/src/com/nokia/helium/core/plexus/tests/TestCommandBase.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.core.plexus.tests;
+
+import hidden.org.codehaus.plexus.interpolation.os.Os;
+
+import java.util.Hashtable;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import com.nokia.helium.core.plexus.CommandBase;
+import com.nokia.helium.core.plexus.StreamRecorder;
+
+/**
+ * Unittests for the CommandBase class.
+ *
+ */
+public class TestCommandBase {
+
+ /**
+ * The simplest possible implementation possible.
+ *
+ */
+ public class CommandImpl extends CommandBase {
+
+ @Override
+ protected String getExecutable() {
+ return "echo";
+ }
+
+ @Override
+ protected void throwException(String message, Throwable t)
+ throws Exception {
+ throw new Exception(message, t);
+ }
+
+ }
+
+ @Test
+ public void simpleExecution() {
+ CommandImpl cmd = new CommandImpl();
+ try {
+ cmd.execute(null);
+ } catch (Exception e) {
+ fail("Exception should not happen.");
+ }
+
+ }
+
+ @Test
+ public void simpleExecutionWithArgs() {
+ CommandImpl cmd = new CommandImpl();
+ String args[] = new String[2];
+ args[0] = "foo";
+ args[1] = "bar";
+ try {
+ cmd.execute(args);
+ } catch (Exception e) {
+ fail("Exception should not happen.");
+ }
+ }
+
+ @Test
+ public void simpleExecutionWithArgsAndRecorder() throws Exception {
+ CommandImpl cmd = new CommandImpl();
+ String args[] = new String[2];
+ args[0] = "foo";
+ args[1] = "bar";
+ StreamRecorder rec = new StreamRecorder();
+ cmd.execute(args, rec);
+ assertTrue(rec.getBuffer().toString().startsWith("foo bar"));
+ }
+
+ @Test
+ public void simpleExecutionWithArgsAndRecorderAsOutputHandler() throws Exception {
+ CommandImpl cmd = new CommandImpl();
+ StreamRecorder rec = new StreamRecorder();
+ cmd.addOutputLineHandler(rec);
+ String args[] = new String[2];
+ args[0] = "foo";
+ args[1] = "bar";
+ cmd.execute(args, rec);
+ assertTrue(rec.getBuffer().toString().startsWith("foo bar"));
+ }
+
+ @Test
+ public void simpleExecutionWithEnv() throws Exception {
+ CommandImpl cmd = new CommandImpl();
+ StreamRecorder rec = new StreamRecorder();
+ cmd.addOutputLineHandler(rec);
+ String args[] = new String[2];
+ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+ args[0] = "%TEST_FOO%";
+ args[1] = "%TEST_BAR%";
+ } else {
+ args[0] = "$TEST_FOO";
+ args[1] = "$TEST_BAR";
+ }
+ Hashtable env = new Hashtable();
+ env.put("TEST_FOO", "foo");
+ env.put("TEST_BAR", "bar");
+ cmd.execute(args, env, rec);
+ assertTrue(rec.getBuffer().toString().startsWith("foo bar"));
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/tests/src/com/nokia/helium/core/plexus/tests/TestFileStreamConsumer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/tests/src/com/nokia/helium/core/plexus/tests/TestFileStreamConsumer.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.core.plexus.tests;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+import com.nokia.helium.core.plexus.FileStreamConsumer;
+
+public class TestFileStreamConsumer {
+
+ @Test
+ public void testContentGoesToFile() throws FileNotFoundException, IOException {
+ // Setting up an Ant task
+ File temp = File.createTempFile("temp_",".log");
+ temp.deleteOnExit();
+ FileStreamConsumer consumer = new FileStreamConsumer(temp);
+ consumer.consumeLine("Hello World!");
+ consumer.consumeLine("Bonjour monde!");
+ consumer.close();
+ assertTrue(temp.length() == 28);
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/tests/src/com/nokia/helium/core/plexus/tests/TestStreamMultiplexer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/tests/src/com/nokia/helium/core/plexus/tests/TestStreamMultiplexer.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.core.plexus.tests;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.nokia.helium.core.plexus.StreamMultiplexer;
+import com.nokia.helium.core.plexus.StreamRecorder;
+
+/**
+ * Testing the StreamMultiplexer class.
+ *
+ */
+public class TestStreamMultiplexer {
+
+ /**
+ * Having an empty list of handler should not cause any problem.
+ */
+ @Test
+ public void noHandler() {
+ StreamMultiplexer mux = new StreamMultiplexer();
+ mux.consumeLine("1st line");
+ mux.consumeLine("2nd line");
+ }
+
+ /**
+ * The two recorders should record the same stuff.
+ */
+ @Test
+ public void recordSomeLines() {
+ StreamMultiplexer mux = new StreamMultiplexer();
+ StreamRecorder rec = new StreamRecorder();
+ StreamRecorder rec2 = new StreamRecorder();
+ mux.addHandler(rec);
+ mux.addHandler(rec2);
+ mux.consumeLine("1st line");
+ mux.consumeLine("2nd line");
+ assertTrue(rec.getBuffer().toString().equals("1st line\n2nd line\n"));
+ assertTrue(rec2.getBuffer().toString().equals("1st line\n2nd line\n"));
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/core/tests/src/com/nokia/helium/core/plexus/tests/TestStreamRecorder.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/core/tests/src/com/nokia/helium/core/plexus/tests/TestStreamRecorder.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.core.plexus.tests;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.nokia.helium.core.plexus.StreamRecorder;
+
+/**
+ * Unittests for the TestStreamRecorder class.
+ *
+ */
+public class TestStreamRecorder {
+
+ @Test
+ public void recordSomeLines() {
+ StreamRecorder rec = new StreamRecorder();
+ rec.consumeLine("1st line");
+ rec.consumeLine("2nd line");
+ assertTrue(rec.getBuffer().toString().equals("1st line\n2nd line\n"));
+ }
+
+ @Test
+ public void recordSomeLinesWithOwnBuffer() {
+ StringBuffer buffer = new StringBuffer();
+ StreamRecorder rec = new StreamRecorder(buffer);
+ assertTrue(rec.getBuffer() == buffer);
+ rec.consumeLine("1st line");
+ rec.consumeLine("2nd line");
+ assertTrue(rec.getBuffer().toString().equals("1st line\n2nd line\n"));
+ }
+
+ @Test
+ public void setGetBuffer() {
+ StringBuffer buffer = new StringBuffer();
+ StreamRecorder rec = new StreamRecorder();
+ assertTrue(rec.getBuffer() != buffer);
+ rec.setBuffer(buffer);
+ }
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/diamonds/lib/dom4j-1.6.1.jar
Binary file buildframework/helium/external/helium-antlib/diamonds/lib/dom4j-1.6.1.jar has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/DiamondsClient.java
--- a/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/DiamondsClient.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/DiamondsClient.java Wed Dec 23 19:29:07 2009 +0200
@@ -71,10 +71,8 @@
try {
result = httpClient.executeMethod(postMethod);
} catch (IOException e) {
- log.info("IOException while sending http request");
- log.debug("IOException while sending http request: ", e);
isRecordOnly = true;
- throw new DiamondsException("Exception in executeMethod");
+ throw new DiamondsException("IOException while sending http request." + e.getMessage());
// e.printStackTrace();
}
return result;
@@ -89,8 +87,7 @@
} catch (Exception ex) {
// ex.printStackTrace();
isRecordOnly = true;
- log.info("Failed to check url, defaulting to input.");
- throw new DiamondsException("Exception verifying URL");
+ throw new DiamondsException("Failed to check url, defaulting to input. " + ex.getMessage());
}
return retURL;
}
@@ -175,23 +172,19 @@
log.debug("diamondsBuildID: " + diamondsBuildID);
} else {
isRecordOnly = true;
- log.debug("Connection Failed.");
- log
- .info("Diamonds data not sent, because of connection failure.");
+ log.error("Diamonds data not sent, because of connection failure.");
//throw new DiamondsException("Connection Failed");
}
}
} catch (HttpException ex) {
isRecordOnly = true;
- log.debug("Connection Failed", ex);
- log.info("Diamonds data not sent, because of httpexception.");
+ log.error("Diamonds data not sent, because of httpexception.", ex);
// log.error("Failed: " + ex.toString());
//throw new DiamondsException("Http Exception see the logs: "
// + ex.getMessage());
} catch (IOException ex1) {
isRecordOnly = true;
- log.debug("Connection Failed. ", ex1);
- log.info("Diamonds data not sent, because of io exception.");
+ log.error("Diamonds data not sent, because of io exception.", ex1);
// log.error("Failed: " + ex.toString());
//throw new DiamondsException("Network error, see the logs: "
// + ex1.getMessage());
@@ -215,8 +208,7 @@
result = processPostMethodResult(httpClient
.executeMethod(postMethod));
} catch (Exception e) {
- log.debug("DiamondsClient:sendData by Http: ", e);
- log.info("The final data via http not sent because errors: ", e);
+ log.error("sendData:The final data via http not sent because errors: ", e);
}
}
return result;
@@ -233,8 +225,7 @@
"[DIAMONDS_DATA]", null);
log.debug("DiamondsClient:sendDataByEmail:succeeds");
} catch (Exception e) {
- log.debug("DiamondsClient:sendDataByEmail: ", e);
- log.info("The final data via http not sent because errors: ", e);
+ log.error("sendDataByMail:The final data via http not sent because errors: ", e);
return -1;
}
return 0;
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/DiamondsConfig.java
--- a/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/DiamondsConfig.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/DiamondsConfig.java Wed Dec 23 19:29:07 2009 +0200
@@ -65,11 +65,11 @@
SAXReader saxReader = new SAXReader();
Document document = null;
try {
- log.debug("diamonds:DiamondsConfig:reading configuration");
+ log.debug("Reading diamonds configuration.");
document = saxReader.read(configFile);
} catch (Exception e) {
- log.debug("diamonds:DiamondsConfig:", e);
- throw new DiamondsException("Diamonds configuration parsing error: "
+ // No need to fail the build due to internal Helium configuration errors.
+ log.debug("Diamonds configuration parsing error: "
+ e.getMessage());
}
parseConfig(document);
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/DiamondsExceptionStatusUpdate.java
--- a/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/DiamondsExceptionStatusUpdate.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/DiamondsExceptionStatusUpdate.java Wed Dec 23 19:29:07 2009 +0200
@@ -91,7 +91,7 @@
if (SignalStatusList.getDeferredSignalList().hasSignalInList()) {
Vector signalList = SignalStatusList.getDeferredSignalList().getSignalStatusList();
timeFormat = new SimpleDateFormat(DiamondsConfig.getDiamondsProperties().getProperty("tstampformat"));
- log.debug("[DiamondsExceptionStatusUpdate] => Build Status = " + buildStatus);
+ log.debug("Build Status = " + buildStatus);
int i = 0;
for (SignalStatus status : signalList) {
signalInformation.put("diamond.signal.name." + i, status.getName());
@@ -108,12 +108,12 @@
templateProcessor.convertTemplate(templateDir, templateFile, outputFile,sourceList);
/* send the generated XML file for diamonds client to update the signals information into Diamonds */
- log.debug("[DiamondsExceptionStatusUpdate] => sending data to diamonds ..." + outputFile);
+ log.debug("sending data to diamonds ..." + outputFile);
diamondsClient.sendData(outputFile, DiamondsConfig.getDiamondsProperties().getDiamondsBuildID());
try {
DiamondsListenerImpl.mergeToFullResults(new File(outputFile));
} catch (DiamondsException de) {
- log.debug("[DiamondsExceptionStatusUpdate] => " + de.getMessage());
+ log.error("Not able to merge into full results XML file " + de.getMessage(), de);
}
}
/* Check, is the signal is in now signal list?
@@ -124,7 +124,7 @@
Vector signalList = SignalStatusList.getNowSignalList().getSignalStatusList();
buildStatus = "failed";
timeFormat = new SimpleDateFormat(DiamondsConfig.getDiamondsProperties().getProperty("tstampformat"));
- log.debug("[DiamondsExceptionStatusUpdate] => Build Status = " + buildStatus);
+ log.debug("Build Status = " + buildStatus);
int i = 0;
for (SignalStatus status : signalList) {
signalInformation.put("diamond.signal.name." + i, status.getName());
@@ -141,12 +141,12 @@
templateProcessor.convertTemplate(templateDir, templateFile, outputFile,sourceList);
/* send the generated XML file for diamonds client to update the signals information into Diamonds */
- log.debug("[DiamondsExceptionStatusUpdate] => sending data to diamonds ..." + outputFile);
+ log.debug("sending data to diamonds ..." + outputFile);
diamondsClient.sendData(outputFile, DiamondsConfig.getDiamondsProperties().getDiamondsBuildID());
try {
DiamondsListenerImpl.mergeToFullResults(new File(outputFile));
} catch (DiamondsException de) {
- log.debug("[DiamondsExceptionStatusUpdate] => " + de.getMessage());
+ log.error("Not able to merge into full results XML file " + de.getMessage(), de);
}
}
/* Generate the build status XML file required for diamonds to update the build status information,
@@ -165,7 +165,7 @@
try {
DiamondsListenerImpl.mergeToFullResults(new File(outputFile));
} catch (DiamondsException de) {
- log.debug("[DiamondsExceptionStatusUpdate] => " + de.getMessage());
+ log.error("Not able to merge into full results XML file " + de.getMessage(), de);
}
}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/DiamondsListenerImpl.java
--- a/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/DiamondsListenerImpl.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/DiamondsListenerImpl.java Wed Dec 23 19:29:07 2009 +0200
@@ -106,7 +106,6 @@
.getTemplateDir(), finishTemplateFile, output,
sourceList);
} catch (Exception e) {
- log.debug("diamonds:DiamondsListenerImpl:exception: ", e);
throw new DiamondsException(
"failed to convert the build finish template: "
+ e.getMessage());
@@ -118,7 +117,6 @@
diamondsClient.sendData(output, DiamondsConfig
.getDiamondsProperties().getDiamondsBuildID());
} catch (Exception e) {
- log.debug("diamonds:DiamondsListenerImpl: exception: ", e);
throw new DiamondsException("Failed to send data to diamonds: "
+ e.getMessage());
}
@@ -149,7 +147,7 @@
fullResultsFile.getAbsolutePath(), smtpServer,
ldapServer);
} catch (Exception e) {
- log.debug("Error sending diamonds final log: ", e);
+ log.error("Error sending diamonds final log: ", e);
}
}
}
@@ -278,7 +276,6 @@
}
isInitialized = true;
} catch (Exception e) {
- log.debug("diamonds:DiamondsListenerImpl: ", e);
throw new DiamondsException("failed to connect to diamonds: "
+ e.getMessage());
}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/DiamondsPostBuildStatusUpdate.java
--- a/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/DiamondsPostBuildStatusUpdate.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/DiamondsPostBuildStatusUpdate.java Wed Dec 23 19:29:07 2009 +0200
@@ -92,7 +92,7 @@
try {
DiamondsListenerImpl.mergeToFullResults(new File(outputFile));
} catch (DiamondsException de) {
- log.debug("[DiamondsExceptionStatusUpdate] => " + de.getMessage());
+ log.error("Not able to merge into full results XML file " + de.getMessage(), de);
}
}
}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/StageDiamondsListener.java
--- a/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/StageDiamondsListener.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/StageDiamondsListener.java Wed Dec 23 19:29:07 2009 +0200
@@ -80,6 +80,7 @@
initStageTargetsMap();
isTargetMapInitialized = true;
}
+ log.debug("targetBegin targetName: " + targetName + " - currentStartTargetName:" + currentStartTargetName);
if (currentStartTargetName == null) {
findAndSetStartTimeForTargetInStageList(targetName);
}
@@ -158,10 +159,8 @@
getDiamondsClient().sendData(output, DiamondsConfig
.getDiamondsProperties().getDiamondsBuildID());
} catch (com.nokia.helium.core.TemplateProcessorException e1) {
- log.debug("diamonds:StageDiamondsListener:exception: ", e1);
- throw new DiamondsException(
- "template conversion error while sending data for stage: "
- + stageName + " : " + e1.getMessage());
+ throw new DiamondsException("template conversion error while sending data for stage: "
+ + stageName + " : " + e1.getMessage());
}
}
}
@@ -199,11 +198,13 @@
log.debug("Diamonds target missing: ", be);
}
if (arrayList != null) {
+ log.debug(" + Stage definition: " + stage.getStageName());
Enumeration targetEnum = arrayList.elements();
while (targetEnum.hasMoreElements()) {
// fast lookup
Target target = targetEnum.nextElement();
stageMap.put(target.getName(), INVALID_DATE);
+ log.debug(" - Start target: " + target.getName());
}
stageTargetBeginList.add(stageMap);
@@ -211,6 +212,7 @@
String endTargetName = stage.getEndTargetName();
// fast lookup
stageTargetEndMap.put(endTargetName, stage);
+ log.debug(" - End target: " + endTargetName);
}
}
}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/TargetDiamondsListener.java
--- a/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/TargetDiamondsListener.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/TargetDiamondsListener.java Wed Dec 23 19:29:07 2009 +0200
@@ -166,17 +166,13 @@
}
} else {
log
- .debug("diamonds:TargetDiamondsListener:sendTargetData: exists("
+ .debug("sendTargetData: exists("
+ templateFile.getAbsolutePath() + ") => false");
}
} catch (com.nokia.helium.core.TemplateProcessorException e1) {
- log.debug(
- "diamonds:TargetDiamondsListener:sendTargetData:exception",
- e1);
- throw new DiamondsException(
- "template conversion error while sending data for target:"
- + target + ":" + e1.getMessage());
+ throw new DiamondsException("template conversion error while sending data for target:"
+ + target + ":" + e1.getMessage());
}
File outputFile = new File(output);
if (outputFile.exists()) {
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/XMLMerger.java
--- a/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/XMLMerger.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/XMLMerger.java Wed Dec 23 19:29:07 2009 +0200
@@ -84,7 +84,6 @@
mergeNode(root, dataRoot);
write();
} catch (DocumentException e) {
- log.debug("Error merging: " + e);
throw new XMLMergerException(e.getMessage());
}
}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/ant/HeliumListener.java
--- a/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/ant/HeliumListener.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/diamonds/src/com/nokia/helium/diamonds/ant/HeliumListener.java Wed Dec 23 19:29:07 2009 +0200
@@ -121,8 +121,7 @@
if (errorMessage == null) {
errorMessage = "";
}
- log
- .info("Diamonds Error, might not be logged properly, see debug log. "
+ log.error("Diamonds Error, might not be logged properly, see debug log. "
+ errorMessage);
}
if (diamondsListeners != null) {
@@ -135,8 +134,7 @@
if (errorMessage == null) {
errorMessage = "";
}
- log
- .info("Diamonds Error, might not be logged properly, see debug log. "
+ log.error("Diamonds Error, might not be logged properly, see debug log. "
+ errorMessage);
}
}
@@ -158,7 +156,6 @@
templateProcessor.convertTemplate(configFile,
outputFile.toString(), sourceList);
} catch (Exception e) {
- log.debug("Error: ", e);
throw new BuildException(
"Diamonds configuration pre-parsing error: "
+ e.getMessage());
@@ -166,7 +163,6 @@
try {
DiamondsConfig.parseConfiguration(outputFile.toString());
} catch (Exception e) {
- log.debug("Error: ", e);
throw new BuildException("Diamonds configuration parsing error: "
+ e.getMessage());
}
@@ -199,8 +195,7 @@
if (errorMessage == null) {
errorMessage = "";
}
- log
- .info("Diamonds Error, might not be logged properly, see debug log. "
+ log.error("Diamonds Error, might not be logged properly, see debug log. "
+ errorMessage);
}
@@ -217,8 +212,7 @@
try {
diamondsListener.buildEnd(event);
} catch (Exception e) {
- log.debug("Error: ", e);
- log.info("Failed to log in diamonds: " + e);
+ log.error("Failed to log in diamonds: " + e);
}
}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/diamonds/tests/src/com/nokia/helium/diamonds/tests/TestXMLMerger.java
--- a/buildframework/helium/external/helium-antlib/diamonds/tests/src/com/nokia/helium/diamonds/tests/TestXMLMerger.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/diamonds/tests/src/com/nokia/helium/diamonds/tests/TestXMLMerger.java Wed Dec 23 19:29:07 2009 +0200
@@ -25,6 +25,7 @@
import java.io.BufferedReader;
import java.io.IOException;
import com.nokia.helium.diamonds.XMLMerger;
+import com.nokia.helium.diamonds.XMLMerger.XMLMergerException;
import org.junit.*;
import static org.junit.Assert.*;
@@ -142,6 +143,35 @@
}
/**
+ * Test the XMLMerger with xml file with no Root node.
+ */
+ @Test(expected=XMLMergerException.class)
+ public void test_mergeWithNoRootNode() throws Exception{
+ File merge = createTextFile("\n");
+ XMLMerger merger = new XMLMerger(merge);
+ }
+ /**
+ * Test the XMLMerger with xml files with different root nodes to merge.
+ */
+ @Test(expected=XMLMergerException.class)
+ public void test_mergeWithDifferentRootNodes() throws Exception{
+ File merge = createTextFile("\n");
+ File toBeMerged = createTextFile("\n\n");
+ XMLMerger merger = new XMLMerger(merge);
+ merger.merge(toBeMerged);
+ }
+ /**
+ * Test the XMLMerger with xml files with Wrong xml format
+ */
+ @Test(expected=XMLMergerException.class)
+ public void test_mergeWithWrongXML() throws Exception{
+ File merge = createTextFile("\n");
+ File toBeMerged = createTextFile("\n\n");
+ XMLMerger merger = new XMLMerger(merge);
+ merger.merge(toBeMerged);
+ }
+
+ /**
* Load file content into a string.
* @param fullPathFilename
* @return the file content as a string
@@ -188,4 +218,4 @@
}
}
-}
\ No newline at end of file
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/doc/src/build.rst
--- a/buildframework/helium/external/helium-antlib/doc/src/build.rst Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/doc/src/build.rst Wed Dec 23 19:29:07 2009 +0200
@@ -76,6 +76,11 @@
[echo] Cleaning helium-signaling
[delete] Deleting directory C:\development\workspace\helium-antlib-dragonfly-trunk\sf\build\signaling\classes
[delete] Deleting: C:\development\workspace\helium-antlib-dragonfly-trunk\sf\bin\helium-signaling.jar
+
+ clean:
+ [echo] Cleaning helium-logging
+ [delete] Deleting directory C:\development\workspace\helium-antlib-dragonfly-trunk\sf\build\logging\classes
+ [delete] Deleting: C:\development\workspace\helium-antlib-dragonfly-trunk\sf\bin\helium-logging.jar
BUILD SUCCESSFUL
Total time: 1 second
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/doc/src/structure.rst
--- a/buildframework/helium/external/helium-antlib/doc/src/structure.rst Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/doc/src/structure.rst Wed Dec 23 19:29:07 2009 +0200
@@ -125,9 +125,29 @@
Logging
-------
-Developer must use standard Ant logging for any user log output.
+Developer must preferably use standard Ant logging for any user log output.
Internal debug logging must be implemented using Log4J framework.
+ * ANT Listeners must use log4j logging framework - using Ant logging system might cause some looping issues.
+ * Ant Type and Task must use the Ant logging mechanism to report to the user.
+ * Generic framework (part of the code which doesn't links to Ant directly) must use Log4J.
+ * Usage of System.out.println should be avoided.
+ * All the non-handled exceptions should be considered as errors and should be reported as such:
+ * use log("message", Project.MSG_ERR) under Ant
+ * log.error() otherwise.
+ * Exception to this rule must be clearly commented under the code.
+ * Debug information:
+ * Log4J framework (log.debug()) must be used to push information to the Helium debug log - so debug information are not
+ directly visible by the user.
+ * Ant logging framework can also be use to log Type/Task debug info (but log4j is preferred).
+ * PrintStackTrace method should be used on below scenario's:
+ * At the time of unknown exception.
+ * Should be used with exceptions other than BuildException.
+ * In case it is difficult to debug the issue with Exception.getMessage().
+ * use this method during debugging complex issue (this doesn't mean the line should remain in the code after development).
+ * When it is required to print the all the information about the occurring Exception.
+
+
This is an example on how to use logging:
::
@@ -144,3 +164,17 @@
Please find more information on Log4J from the online manual: http://logging.apache.org/log4j/1.2/manual.html.
+
+
+Exception
+---------
+
+Exceptional event reporting and handling is crutial in software development. Developer must make sure it is done accordingly
+to the framework it is currently using:
+
+ * To report a build failure under Ant the BuildException must be used.
+ But we have to keep in mind that a BuildException is not tracked because it derives from the RuntimeError type.
+ So we have to be careful with those and try to limit their puprose to the original usage: Ant build failure.
+ * It is preferable to have meaningful exception type like: FileNotFoundException.
+ * Developer should try to avoid as much as possible the throw or catch raw type of exception like Exception, RuntimeError.
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/bld.bat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/bld.bat Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,60 @@
+@echo off
+
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the License "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+setlocal
+if not defined JAVA_6_HOME (
+set TESTED_JAVA=C:\Apps\j2sdk_1.6.0_02
+) ELSE set TESTED_JAVA=%JAVA_6_HOME%
+if exist %TESTED_JAVA% (set JAVA_HOME=%TESTED_JAVA%)
+
+REM Configure Ant
+if not defined TESTED_ANT_HOME (
+set TESTED_ANT_HOME=C:\Apps\ant_1.7
+)
+if exist %TESTED_ANT_HOME% (set ANT_HOME=%TESTED_ANT_HOME%)
+
+REM Configure the expected Ant Version details below
+SET expMajorVer=1
+SET expMinorVer=7
+
+rem *** Verify Ant Version ***
+rem -- Run the 'ant -version' command and capture the output to a variable
+for /f "tokens=*" %%a in ('ant -version') do (set antversion=%%a)
+echo *** Installed Version : %antversion%
+
+rem -- Parse the version string obtained above and get the version number
+for /f "tokens=4 delims= " %%a in ("%antversion%") do set val=%%a
+rem -- Parse the version number delimiting the '.' and set the major and
+rem minor versions
+for /f "tokens=1-2 delims=." %%a in ("%val%") do (
+set /A majorVersion=%%a
+set /A minorVersion=%%b
+)
+rem -- Check whether major version is greater than or equal to the expected.
+if %majorVersion% geq %expMajorVer% (
+rem -- if major version is valid, check minor version. If minor version is less
+rem than expected display message and abort the execution.
+if %minorVersion% lss %expMinorVer% (echo *** Incorrect version of Ant found. Please check you have atleast Ant 1.7.0 & goto :errorstop )
+)
+
+ant %*
+endlocal
+
+:errorstop
+@echo *** Build aborted with error
+exit /b 1
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/build.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/build.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,37 @@
+
+
+
+ Helium Antlib iMaker build file.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/demo/build.bat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/demo/build.bat Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,27 @@
+@echo off
+
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the License "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+setlocal
+if not defined JAVA_6_HOME (
+set TESTED_JAVA=C:\Apps\j2sdk_1.6.0_02
+) ELSE set TESTED_JAVA=%JAVA_6_HOME%
+if exist %TESTED_JAVA% (set JAVA_HOME=%TESTED_JAVA%)
+set ANT_ARGS=-lib %CD%\..\lib -lib %CD%\..\..\lib -lib %CD%\..\..\bin\helium-core.jar -lib %CD%\..\..\bin\helium-imaker.jar -lib %CD%\..\..\antlibs
+ant %*
+endlocal
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/demo/build.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/demo/build.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,66 @@
+
+
+
+ Helium Antlib imaker demo.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/HelpConfigStreamConsumer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/HelpConfigStreamConsumer.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+/**
+ * This class implements the help-config output parser for iMaker.
+ * The list of configuration will be stored into an internal list
+ * object.
+ *
+ */
+public class HelpConfigStreamConsumer implements StreamConsumer {
+ private List configurations = new ArrayList();
+
+ /**
+ * {@inheritDoc}
+ * Only list starting with '/' and ending with '.mk' will be considered.
+ */
+ @Override
+ public void consumeLine(String line) {
+ line = line.trim();
+ if (line.startsWith("/") && line.endsWith(".mk")) {
+ configurations.add(line);
+ }
+ }
+
+ /**
+ * Get the list of configurations as File objects.
+ * @return
+ */
+ public List getConfigurations(File epocroot) {
+ List confs = new ArrayList();
+ for (String config : configurations) {
+ confs.add(new File(epocroot, config));
+ }
+ return confs;
+ }
+
+ /**
+ * Get the list of configuration as strings.
+ * @return the list of configurations
+ */
+ public List getConfigurations() {
+ return configurations;
+ }
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/HelpTargetListStreamConsumer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/HelpTargetListStreamConsumer.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+/**
+ * Helper class to parse the output form help-target-*-list.
+ *
+ */
+public class HelpTargetListStreamConsumer implements StreamConsumer {
+
+ private List targets = new ArrayList();
+
+ /**
+ * {@inheritDoc}
+ * iMaker targets should match the following patterns to be selected: [A-za-z0-9\\-_%]+.
+ */
+ @Override
+ public void consumeLine(String line) {
+ line = line.trim();
+ if (line.matches("^[A-za-z0-9\\-_%]+$")) {
+ targets.add(line);
+ }
+ }
+
+ /**
+ * Get the list of found targets.
+ * @return the target list.
+ */
+ public List getTargets() {
+ return targets;
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/IMaker.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/IMaker.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+
+import com.nokia.helium.core.plexus.CommandBase;
+import com.nokia.helium.core.plexus.StreamRecorder;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This class implements a wrapper around iMaker.
+ * It helps to introspect:
+ * variables
+ * targets
+ * configurations
+ *
+ */
+public class IMaker extends CommandBase {
+ private static final String TEMP_ROMBUILD_DIR = "epoc32/rombuild/temp";
+ private final Logger log = Logger.getLogger(getClass());
+ private File epocroot;
+
+ /**
+ * Create an iMaker wrapper class with a specific epocroot.
+ * @param epocroot
+ */
+ public IMaker(File epocroot) {
+ this.epocroot = epocroot;
+
+ }
+
+ /**
+ * Creates a temp working dir for the rom image creation.
+ * @return
+ * @throws IOException
+ */
+ public File createWorkDir() throws IMakerException {
+ try {
+ File tempRootDir = new File(getEpocroot(), TEMP_ROMBUILD_DIR);
+ tempRootDir.mkdirs();
+ File tempDir = File.createTempFile("helium-imaker", "", tempRootDir);
+ tempDir.delete();
+ tempDir.mkdirs();
+ return tempDir;
+ } catch (IOException e) {
+ throw new IMakerException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Epocroot location.
+ * @return the epocroot location
+ */
+ public File getEpocroot() {
+ return epocroot;
+ }
+
+ /**
+ * Get the iMaker version.
+ * @return the current iMaker version.
+ * @throws IMakerException is thrown in case of an iMaker execution error.
+ */
+ public String getVersion() throws IMakerException {
+ log.debug("getVersion");
+ String[] args = new String[1];
+ args[0] = "version";
+ StreamRecorder rec = new StreamRecorder();
+ execute(args, rec);
+ return rec.getBuffer().toString().trim();
+ }
+
+ /**
+ * Get the value of a particular variable from iMaker configuration.
+ * @param name the variable name
+ * @return the value or null if the variable does not exist.
+ * @throws IMakerException
+ */
+ public String getVariable(String name) throws IMakerException {
+ log.debug("getVariable: " + name);
+ String[] args = new String[1];
+ args[0] = "print-" + name;
+ PrintVarSteamConsumer consumer = new PrintVarSteamConsumer(name);
+ execute(args, consumer);
+ return consumer.getValue();
+ }
+
+ /**
+ * Get the value of a particular variable from iMaker configuration for a particular
+ * configuration.
+ * @param name the variable name
+ * @return the value or null if the variable does not exist.
+ * @throws IMakerException
+ */
+ public String getVariable(String name, File configuration) throws IMakerException {
+ log.debug("getVariable: " + name + " - " + configuration);
+ String[] args = new String[3];
+ args[0] = "-f";
+ args[1] = configuration.getAbsolutePath();
+ args[2] = "print-" + name;
+ PrintVarSteamConsumer consumer = new PrintVarSteamConsumer(name);
+ execute(args, consumer);
+ return consumer.getValue();
+ }
+
+ /**
+ * Get the list of available iMaker configurations.
+ * @return a list of configurations
+ * @throws IMakerException
+ */
+ public List getConfigurations() throws IMakerException {
+ log.debug("getConfigurations");
+ String[] args = new String[1];
+ args[0] = "help-config";
+ HelpConfigStreamConsumer consumer = new HelpConfigStreamConsumer();
+ execute(args, consumer);
+ return consumer.getConfigurations();
+ }
+
+ /**
+ * Get the a list of target supported by a specific configuration.
+ * @param configuration the configuration to use
+ * @return the list of targets.
+ * @throws IMakerException
+ */
+ public List getTargets(String configuration) throws IMakerException {
+ log.debug("getConfigurations");
+ String[] args = new String[3];
+ args[0] = "-f";
+ args[1] = configuration;
+ args[2] = "help-target-*-list";
+ HelpTargetListStreamConsumer consumer = new HelpTargetListStreamConsumer();
+ execute(args, consumer);
+ return consumer.getTargets();
+ }
+
+ /**
+ * Get the target list for the configuration.
+ * @param configuration a File object representing the configuration location.
+ * @return a list of targets.
+ * @throws IMakerException
+ */
+ public List getTargets(File configuration) throws IMakerException {
+ return getTargets(configuration.getAbsolutePath());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getExecutable() {
+ return "imaker";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public File getWorkingDir() {
+ return getEpocroot();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void throwException(String message, Throwable t)
+ throws IMakerException {
+ throw new IMakerException(message, t);
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/IMakerException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/IMakerException.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker;
+
+/**
+ * Exception raise by the iMaker framework.
+ *
+ */
+public class IMakerException extends Exception {
+
+ private static final long serialVersionUID = -6918895304070211899L;
+
+ /**
+ * An exception with message.
+ * @param message
+ */
+ public IMakerException(String message) {
+ super(message);
+ }
+
+ /**
+ * An exception with message and cause.
+ * @param message
+ */
+ public IMakerException(String message, Throwable t) {
+ super(message, t);
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/PrintVarSteamConsumer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/PrintVarSteamConsumer.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker;
+
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+/**
+ * Parsing iMaker printvar calls.
+ * Output from iMaker should match:
+ * NAME = `some content'
+ *
+ */
+public class PrintVarSteamConsumer implements StreamConsumer {
+
+ private String name;
+ private String value;
+ private boolean inParsing;
+
+ /**
+ * Construct a PrintVarSteamConsumer for a variable named by name.
+ * @param name
+ */
+ public PrintVarSteamConsumer(String name) {
+ this.name = name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void consumeLine(String line) {
+ String varPrefix = name + " = `";
+ if (!inParsing && line.startsWith(varPrefix)) {
+ value = line.substring(varPrefix.length());
+ inParsing = true;
+ } else if (inParsing) {
+ value += "\n" + line;
+ }
+ if (value != null && value.endsWith("'")) {
+ value = value.substring(0, value.length() - 1);
+ inParsing = false;
+ }
+ }
+
+ /**
+ * Get the variable value returned by iMaker.
+ * @return the variable content return by iMaker.
+ */
+ public String getValue() {
+ return value;
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/Command.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/Command.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker.ant;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * Abstract a command call. The default command will be imaker.
+ *
+ */
+public class Command {
+ // default command is iMaker
+ private String command = "imaker";
+ private List args = new ArrayList();
+ private Map variables = new Hashtable();
+ private String target = "";
+
+ /**
+ * Get the target name.
+ * @return the target name.
+ */
+ public String getTarget() {
+ return target;
+ }
+
+ /**
+ * Set the command name
+ * @param target the command name.
+ */
+ public void setTarget(String target) {
+ this.target = target;
+ }
+
+ /**
+ * Get the command name.
+ * @return the command name.
+ */
+ public String getCommand() {
+ return command;
+ }
+
+ /**
+ * Set the command name
+ * @param command the command name.
+ */
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
+ /**
+ * Set the list of arguments based on a list of String.
+ * @param args the arg list.
+ */
+ public void setArguments(List args) {
+ this.args.clear();
+ this.args.addAll(args);
+ }
+
+ /**
+ * Append an argument to the argument list.
+ * @param arg the argument to add.
+ */
+ public void addArgument(String arg) {
+ this.args.add(arg);
+ }
+
+ /**
+ * Get the list of arguments.
+ * @return the list of arguments
+ */
+ public List getArguments() {
+ return args;
+ }
+
+ /**
+ * Get the map of variables.
+ * @return a map representing variables for current object.
+ */
+ public Map getVariables() {
+ return variables;
+ }
+
+ /**
+ * Set variables using vars set of variables.
+ * @param vars
+ */
+ public void setVariables(Map vars) {
+ variables.clear();
+ variables.putAll(vars);
+ }
+
+ /**
+ * Add all the variables from vars.
+ * @param vars a set of variables
+ */
+ public void addVariables(Map vars) {
+ variables.putAll(vars);
+ }
+
+ /**
+ * Add a variable to the command.
+ * @param name the variable name
+ * @param value the variable value
+ */
+ public void addVariable(String name, String value) {
+ variables.put(name, value);
+ }
+
+ /**
+ * Convert the current object as a command line string.
+ * The final string will be contains the data in the following
+ * order:
+ * command
+ * arguments
+ * variables
+ * target
+ * @return
+ */
+ public String getCmdLine() {
+ String cmdLine = getCommand();
+ for (String arg : getArguments()) {
+ cmdLine += " " + arg;
+ }
+ for (Entry e : getVariables().entrySet()) {
+ cmdLine += " " + e.getKey() + "=" + e.getValue();
+ }
+ cmdLine += " " + getTarget();
+ return cmdLine;
+ }
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/Engine.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/Engine.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker.ant;
+
+import java.util.List;
+
+import com.nokia.helium.imaker.IMakerException;
+import com.nokia.helium.imaker.ant.taskdefs.IMakerTask;
+
+/**
+ * Engine interface. Methods needed by the IMaker task to
+ * build the roms.
+ *
+ */
+public interface Engine {
+
+ /**
+ * Set the current IMakerTask.
+ * @param task the task instance.
+ */
+ void setTask(IMakerTask task);
+
+ /**
+ * Build the Commands.
+ * The sublist will be build in a serialize way,
+ * the content of each sublist will be built in parallel.
+ * @param cmdSet
+ * @throws IMakerException
+ */
+ void build(List> cmdSet) throws IMakerException;
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/IMakerCommandSet.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/IMakerCommandSet.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker.ant;
+
+import java.util.List;
+
+import com.nokia.helium.imaker.IMaker;
+
+/**
+ * This interface describes the API a configuration object should define.
+ *
+ */
+public interface IMakerCommandSet {
+
+ /**
+ * Returns a list of command List.
+ * The sublist will be build sequentially. Their content can be built
+ * in parallel.
+ * @return a list of Command list
+ */
+ List> getCommands(IMaker imaker);
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/antlib.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/antlib.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/engines/Emake.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/engines/Emake.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker.ant.engines;
+
+import java.io.File;
+
+import com.nokia.helium.core.plexus.CommandBase;
+import com.nokia.helium.imaker.IMakerException;
+
+/**
+ * Simple emake wrapper based on the CommandBase class.
+ *
+ */
+public class Emake extends CommandBase {
+
+ private File workingDir = new File(".");
+
+ /**
+ * @return emake.
+ */
+ @Override
+ protected String getExecutable() {
+ return "emake";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void throwException(String message, Throwable t) throws IMakerException {
+ throw new IMakerException(message, t);
+ }
+
+ /**
+ * Set the working directory where emake should be called.
+ * @param workingDir the working directory.
+ */
+ public void setWorkingDir(File workingDir) {
+ this.workingDir = workingDir;
+ }
+
+ /**
+ * Get the workingDir defined by the user.
+ * @return the working dir.
+ */
+ @Override
+ public File getWorkingDir() {
+ return workingDir;
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/engines/EmakeEngine.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/engines/EmakeEngine.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,250 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker.ant.engines;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.FileNotFoundException;
+import java.io.OutputStreamWriter;
+import java.io.StringWriter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.DataType;
+
+import com.nokia.helium.core.plexus.AntStreamConsumer;
+import com.nokia.helium.core.plexus.FileStreamConsumer;
+import com.nokia.helium.imaker.IMakerException;
+import com.nokia.helium.imaker.ant.Command;
+import com.nokia.helium.imaker.ant.Engine;
+import com.nokia.helium.imaker.ant.taskdefs.IMakerTask;
+
+import freemarker.cache.ClassTemplateLoader;
+import freemarker.cache.FileTemplateLoader;
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+
+/**
+ *
+ * Simplest possible definition of the type, e.g:
+ *
+ * <emakeEngine id="imaker.ec" />
+ *
+ *
+ * Emake engine with some custom configuration.
+ *
+ * <emakeEngine id="imaker.ec" >
+ * <arg value="--emake-annofile=imaker.anno.xml" />
+ * </emakeEngine>
+ *
+ *
+ * @ant.type name=emakeEngine category=imaker
+ */
+public class EmakeEngine extends DataType implements Engine {
+ private Logger log = Logger.getLogger(getClass());
+ private IMakerTask task;
+ private List customArgs = new ArrayList();
+ private File template;
+
+ /**
+ * Holder for emake custom args.
+ */
+ public class Arg {
+ private String value;
+
+ /**
+ * Get the value of the argument.
+ * @return the argument
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Define the additional command line parameter you want to add to emake
+ * invocation.
+ * @param value the additional command line parameter
+ * @ant.required
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void build(List> cmdSet) throws IMakerException {
+ File makefile = null;
+ try {
+ // Writing the makefile.
+ makefile = writeMakefile(cmdSet);
+
+ // Running Emake
+ runEmake(makefile);
+ } finally {
+ if (makefile != null) {
+ makefile.delete();
+ }
+ }
+ }
+
+ /**
+ * Returns the jar file name containing this class
+ * @return a File object or null if not found.
+ * @throws IMakerException
+ */
+ protected File getJarFile() throws IMakerException {
+ URL url = this.getClass().getClassLoader().getResource(this.getClass().getName().replace('.', '/') + ".class");
+ if (url.getProtocol().equals("jar") && url.getPath().contains("!/")) {
+ String fileUrl = url.getPath().split("!/")[0];
+ try {
+ return new File(new URL(fileUrl).getPath());
+ } catch (MalformedURLException e) {
+ throw new IMakerException("Error determining the jar file where "
+ + this.getClass().getName() + " is located.", e);
+ }
+ }
+ return null;
+ }
+ /**
+ * Run emake using defined makefile.
+ * @param makefile the makefile to build
+ * @throws IMakerException
+ */
+ private void runEmake(File makefile) throws IMakerException {
+ FileStreamConsumer output = null;
+ if (task.getOutput() != null) {
+ try {
+ output = new FileStreamConsumer(task.getOutput());
+ } catch (FileNotFoundException e) {
+ throw new IMakerException("Error creating the stream recorder: " + e.getMessage(), e);
+ }
+ }
+ try {
+ Emake emake = new Emake();
+ emake.setWorkingDir(task.getEpocroot());
+ List args = new ArrayList();
+ for (Arg arg : customArgs) {
+ if (arg.getValue() != null) {
+ args.add(arg.getValue());
+ }
+ }
+ args.add("-f");
+ args.add(makefile.getAbsolutePath());
+ args.add("all");
+ if (task.isVerbose()) {
+ emake.addOutputLineHandler(new AntStreamConsumer(task));
+ }
+ emake.addErrorLineHandler(new AntStreamConsumer(task, Project.MSG_ERR));
+ if (output != null) {
+ emake.addOutputLineHandler(output);
+ emake.addErrorLineHandler(output);
+ }
+ emake.execute(args.toArray(new String[args.size()]));
+ } catch (IMakerException e) {
+ throw new IMakerException("Error executing emake: " + e.getMessage(), e);
+ } finally {
+ if (output != null) {
+ output.close();
+ }
+ }
+ }
+
+ /**
+ * Create the Makefile based on the cmdSet build sequence.
+ * @param cmdSet
+ * @return
+ * @throws IMakerException
+ * @throws IOException
+ */
+ private File writeMakefile(List> cmdSet) throws IMakerException {
+ try {
+ Configuration cfg = new Configuration();
+ Template template = null;
+ if (this.template != null) {
+ if (!this.template.exists()) {
+ throw new IMakerException("Could not find template file: " + this.template.getAbsolutePath());
+ }
+ task.log("Loading template: " + this.template.getAbsolutePath());
+ cfg.setTemplateLoader(new FileTemplateLoader(this.template.getParentFile()));
+ template = cfg.getTemplate(this.template.getName());
+ } else {
+ cfg.setTemplateLoader(new ClassTemplateLoader(this.getClass(), ""));
+ template = cfg.getTemplate("build_imaker_roms_signing.mk.ftl");
+ }
+ File makefile = File.createTempFile("helium-imaker", ".mk", task.getEpocroot());
+ makefile.deleteOnExit();
+ StringWriter out = new StringWriter();
+ Map data = new Hashtable();
+ data.put("cmdSets", cmdSet);
+ data.put("makefile", makefile.getAbsoluteFile());
+ data.put("java_home", System.getProperty("java.home"));
+ File jar = getJarFile();
+ if (jar != null) {
+ task.log("Using " + jar + " as the utility container, make sure the file is available under an emake root.");
+ data.put("java_utils_classpath", jar.getAbsolutePath());
+ }
+ template.process(data, out);
+ log.debug(out.getBuffer().toString());
+
+ OutputStreamWriter output = new OutputStreamWriter(new FileOutputStream(makefile));
+ output.append(out.getBuffer().toString());
+ output.close();
+ return makefile;
+ } catch (IOException e) {
+ throw new IMakerException("Error generating the makefile: " + e.getMessage(), e);
+ } catch (TemplateException e) {
+ throw new IMakerException("Error while rendering the makefile template: " + e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Add custom parameters for the emake invocation.
+ * @return a new Arg object.
+ */
+ public Arg createArg() {
+ Arg arg = new Arg();
+ customArgs.add(arg);
+ return arg;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setTask(IMakerTask task) {
+ this.task = task;
+ }
+
+ /**
+ * Defines an alternate template to use to generate the build sequence for emake.
+ * @ant.not-required
+ */
+ public void setTemplate(File template) {
+ this.template = template;
+ }
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/engines/JavaEngine.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/engines/JavaEngine.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,194 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker.ant.engines;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.DataType;
+
+import com.nokia.helium.core.plexus.StreamRecorder;
+import com.nokia.helium.imaker.IMaker;
+import com.nokia.helium.imaker.IMakerException;
+import com.nokia.helium.imaker.ant.Command;
+import com.nokia.helium.imaker.ant.Engine;
+import com.nokia.helium.imaker.ant.taskdefs.IMakerTask;
+
+/**
+ * Engine purely based on Java. Parallelisation is
+ * implemented using multithreading.
+ *
+ *
+ * <defaultEngine id="imaker.default" threads="4" />
+ *
+ *
+ * @ant.type name=defaultEngine category=imaker
+ */
+public class JavaEngine extends DataType implements Engine {
+
+ private IMakerTask task;
+ private OutputStreamWriter output;
+ private int threads = 1;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setTask(IMakerTask task) {
+ this.task = task;
+ }
+
+ /**
+ * Defines the number of iMaker jobs running in
+ * parallel.
+ * @ant.not-required Default value is 1.
+ */
+ public void setThreads(int threads) {
+ this.threads = threads;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void build(List> cmds) throws IMakerException {
+ task.log("Building with Ant engine.");
+ if (threads <= 0) {
+ throw new BuildException("'threads' must be >= 0. (current value: " + threads + ")");
+ }
+ openLog();
+ // Do something with the configurations
+ for (List cmdlist : cmds) {
+ task.log("Building command list in parallel.");
+ if (cmdlist.size() > 0) {
+ ArrayBlockingQueue queue = new ArrayBlockingQueue(cmdlist.size());
+ ThreadPoolExecutor threadPool = new ThreadPoolExecutor(threads, threads, 10, TimeUnit.MILLISECONDS, queue);
+ task.log("Adding " + cmdlist.size() + " to queue.");
+ for (final Command cmd : cmdlist) {
+ // Create a Runnable to wrap the image
+ // building.
+ threadPool.execute(new Runnable() {
+ public void run() {
+ try {
+ buildCommand(cmd);
+ } catch (IMakerException e) {
+ task.log(e.getMessage(), Project.MSG_ERR);
+ }
+ }
+ });
+ }
+ threadPool.shutdown();
+ try {
+ while (!threadPool.isTerminated()) {
+ threadPool.awaitTermination(100, TimeUnit.MILLISECONDS);
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ closeLog();
+ }
+
+
+ /**
+ * Build a Command.
+ * @param cmd
+ * @throws IMakerException
+ */
+ protected void buildCommand(Command cmd) throws IMakerException {
+ IMaker imaker = task.getIMaker();
+ StreamRecorder rec = new StreamRecorder();
+ imaker.addOutputLineHandler(rec);
+ imaker.addErrorLineHandler(rec);
+
+ rec.consumeLine("-- " + cmd.getCmdLine());
+ rec.consumeLine("++ Started at " + new Date());
+ rec.consumeLine("+++ HiRes Start " + new Date().getTime());
+
+ List args = new ArrayList();
+ args.addAll(cmd.getArguments());
+ // Setting the working dir for the image creation.
+ File tempDir = imaker.createWorkDir();
+ args.add("WORKDIR=" + tempDir.getAbsolutePath());
+ // Pushing custom variables
+ for (Entry e : cmd.getVariables().entrySet()) {
+ if (e.getKey().equals("WORKDIR")) {
+ task.log("WORKDIR cannot be defined by the user, the value will be ignored.", Project.MSG_WARN);
+ } else {
+ args.add(e.getKey() + "=" + e.getValue());
+ }
+ }
+ // Setting the target
+ args.add(cmd.getTarget());
+ try {
+ imaker.execute(args.toArray(new String[args.size()]));
+ } catch (IMakerException e) {
+ // logging iMaker execution error to the
+ // task and the output log.
+ task.log(e.getMessage(), Project.MSG_ERR);
+ rec.consumeLine(e.getMessage());
+ } finally {
+ rec.consumeLine("+++ HiRes End " + new Date().getTime());
+ rec.consumeLine("++ Finished at " + new Date());
+ }
+ // writing data
+ writeLog(rec.getBuffer().toString());
+ }
+
+ private void openLog() throws IMakerException {
+ if (task.getOutput() != null) {
+ try {
+ output = new OutputStreamWriter(new FileOutputStream(task.getOutput()));
+ } catch (FileNotFoundException e) {
+ throw new IMakerException(e.getMessage(), e);
+ }
+ }
+ }
+
+ private synchronized void writeLog(String str) throws IMakerException {
+ if (output != null) {
+ try {
+ output.write(str);
+ } catch (IOException e) {
+ throw new IMakerException(e.getMessage(), e);
+ }
+ }
+ }
+
+ private void closeLog() throws IMakerException {
+ if (output != null) {
+ try {
+ output.close();
+ } catch (IOException e) {
+ throw new IMakerException(e.getMessage(), e);
+ }
+ }
+ }
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/engines/build_imaker_roms_signing.mk.ftl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/engines/build_imaker_roms_signing.mk.ftl Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,128 @@
+<#--
+============================================================================
+Name : build_imaker_roms_signing.mk.ftl
+Part of : Helium
+
+Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+All rights reserved.
+This component and the accompanying materials are made available
+under the terms of the License "Eclipse Public License v1.0"
+which accompanies this distribution, and is available
+at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+Initial Contributors:
+Nokia Corporation - initial contribution.
+
+Contributors:
+
+Description:
+
+============================================================================
+-->
+############################################################################
+# Makefile generated by the emake engine
+############################################################################
+
+# Are we using linux?
+USE_UNIX := $(if $(findstring cmd.exe,$(SHELL))$(findstring mingw,$(call lcase,$(MAKE))),0,1)
+EXECUTOR_CLASS = com.nokia.helium.imaker.utils.ParallelExecutor
+
+# Path conversion macro
+true = $(if $(filter-out 0,$(subst 0,0 ,$1)),1)
+iif = $(if $(call true,$1),$2,$3)
+lcase = $(call tr,$([A-Z]),$([a-z]),$1)
+pathconv = $(call iif,$(USE_UNIX),$(subst \,/,$1),$(subst /,\,$1))
+
+# Some variables
+ROMBUILD_TEMPDIR=$(call pathconv,epoc32/rombuild/temp)
+
+
+$(ROMBUILD_TEMPDIR)/:
+ -mkdir $(ROMBUILD_TEMPDIR)
+
+<#assign cid=0>
+<#assign iid=0>
+<#assign deps="">
+<#list cmdSets as cmds>
+<#assign configdeps="">
+<#assign configimagedeps="">
+<#assign firstiid=iid>
+
+#pragma runlocal
+configuration_${cid}-dir: $(ROMBUILD_TEMPDIR)/config_${iid} <#if (cid>0)>configuration_${cid-1}#if> <#if (cmds?size == 0)>;#if>
+ $(call iif,$(USE_UNIX),touch,@echo off >) $(ROMBUILD_TEMPDIR)/command-dir-list-${cid}.txt
+ <#list cmds as cmd>
+ <#assign cmdline="">
+ <#list cmd.getArguments() as arg>
+ <#assign cmdline="${cmdline} ${arg}">
+ #list>
+ <#assign vars=cmd.getVariables()>
+ <#list vars?keys as var>
+ <#assign cmdline="${cmdline} ${var}=${vars[var]}">
+ #list>
+ @echo $(call iif,$(USE_UNIX),,cmd /c) ${cmd.getCommand()} WORKDIR=$(ROMBUILD_TEMPDIR)/config_${iid} ${cmdline} ${cmd.getTarget()}-dir >> $(ROMBUILD_TEMPDIR)/command-dir-list-${cid}.txt
+<#assign iid=iid+1>
+ #list>
+ -@${java_home}/bin/java -cp "${java_utils_classpath}" $(EXECUTOR_CLASS) $(ROMBUILD_TEMPDIR)/command-dir-list-${cid}.txt
+
+
+<#assign iid=firstiid>
+ <#list cmds as cmd>
+ <#assign cmdline="">
+ <#list cmd.getArguments() as arg>
+ <#assign cmdline="${cmdline} ${arg}">
+ #list>
+ <#assign vars=cmd.getVariables()>
+ <#list vars?keys as var>
+ <#assign cmdline="${cmdline} ${var}=${vars[var]}">
+ #list>
+#
+# Building configuration ${iid}.
+#
+$(ROMBUILD_TEMPDIR)/config_${iid}/: $(ROMBUILD_TEMPDIR)
+ -mkdir $(call pathconv,$(ROMBUILD_TEMPDIR)/config_${iid})
+
+
+rom_${iid}-image: configuration_${cid}-dir
+ @echo -- ${cmd.getCmdLine()}-image
+ -@perl -e "print '++ Started at '.localtime().\"\n\""
+ -@perl -e "use Time::HiRes; print '+++ HiRes Start '.Time::HiRes::time().\"\n\";"
+ -${cmd.getCommand()} WORKDIR=$(ROMBUILD_TEMPDIR)/config_${iid} ${cmdline} ${cmd.getTarget()}-image
+ -@perl -e "use Time::HiRes; print '+++ HiRes End '.Time::HiRes::time().\"\n\";"
+ -@perl -e "print '++ Finished at '.localtime().\"\n\""
+
+<#assign configimagedeps="${configimagedeps} rom_${iid}-image">
+<#assign iid=iid+1>
+ #list>
+
+configuration_${cid}-image: ${configimagedeps} ;
+
+<#assign iid=firstiid>
+#pragma runlocal
+configuration_${cid}-e2flash: configuration_${cid}-image
+ $(call iif,$(USE_UNIX),touch,@echo off >) $(ROMBUILD_TEMPDIR)/command-e2flash-list-${cid}.txt
+ <#list cmds as cmd>
+ <#assign cmdline="">
+ <#list cmd.getArguments() as arg>
+ <#assign cmdline="${cmdline} ${arg}">
+ #list>
+ <#assign vars=cmd.getVariables()>
+ <#list vars?keys as var>
+ <#assign cmdline="${cmdline} ${var}=${vars[var]}">
+ #list>
+ @echo $(call iif,$(USE_UNIX),,cmd /c) ${cmd.getCommand()} WORKDIR=$(ROMBUILD_TEMPDIR)/config_${iid} ${cmdline} ${cmd.getTarget()}-e2flash >> $(ROMBUILD_TEMPDIR)/command-e2flash-list-${cid}.txt
+<#assign iid=iid+1>
+ #list>
+ -@${java_home}/bin/java -cp "${java_utils_classpath}" $(EXECUTOR_CLASS) $(ROMBUILD_TEMPDIR)/command-e2flash-list-${cid}.txt
+
+
+configuration_${cid}: <#if (cid>0)>configuration_${cid-1}#if> configuration_${cid}-dir configuration_${cid}-image configuration_${cid}-e2flash ;
+
+
+<#assign deps="configuration_${cid}">
+<#assign cid=cid+1>
+#list>
+
+all: ${deps} ;
+
+# End of config
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/taskdefs/IMakerTask.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/taskdefs/IMakerTask.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,286 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker.ant.taskdefs;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.DataType;
+
+import com.nokia.helium.core.plexus.AntStreamConsumer;
+import com.nokia.helium.imaker.IMaker;
+import com.nokia.helium.imaker.IMakerException;
+import com.nokia.helium.imaker.ant.Command;
+import com.nokia.helium.imaker.ant.Engine;
+import com.nokia.helium.imaker.ant.IMakerCommandSet;
+import com.nokia.helium.imaker.ant.engines.JavaEngine;
+
+/**
+ * The imaker task will allow you to efficiently use iMaker to
+ * build rom images in parallel.
+ *
+ * The task is actually base on two concepts:
+ *
+ * - content configuration: what needs to be built.
+ *
- acceleration engine: how to build roms in an efficient way.
+ *
+ *
+ * In the following example the task is configured to use the emake engine
+ * to accelerate the rom image creation and an imakerconfiguration configuration
+ * element to configure the content of the building:
+ *
+ *
+ * <hlm:emakeEngine id="imaker.ec" />
+ * <hlm:imaker epocroot="${epocroot}"
+ * output="${epocroot}/imaker.log"
+ * engineRefid="imaker.ec"
+ * verbose="true">
+ <hlm:imakerconfiguration>
+ * <makefileset>
+ * <include name="**/product/*ui.mk" />
+ * </makefileset>
+ * <targetset>
+ * <include name="core" />
+ * <include name="langpack_01" />
+ * </targetset>
+ </hlm:imakerconfiguration>
+ * </hlm:imaker>
+ *
+ * @ant.task name=imaker category=imaker
+ */
+public class IMakerTask extends Task {
+
+ private File epocroot;
+ private boolean verbose;
+ private boolean failOnError = true;
+ private List commandSets = new ArrayList();
+ private String engineRefId;
+ private AntStreamConsumer stdout = new AntStreamConsumer(this);
+ private AntStreamConsumer stderr = new AntStreamConsumer(this, Project.MSG_ERR);
+ private File output;
+
+ /**
+ * Add iMaker Task compatible configuration. The task will
+ * accept any Ant type implementing the IMakerCommandSet
+ * interface like the imakerconfiguration type.
+ *
+ * @param cmdSet an iMaker configuration which will defines
+ * what needs to be built.
+ *
+ * @ant.required
+ */
+ public void add(IMakerCommandSet cmdSet) {
+ commandSets.add(cmdSet);
+ }
+
+ /**
+ * Defines the reference id of the engine to use.
+ * @ant.not-required Default Java implementation will be used.
+ */
+ public void setEngineRefId(String engineRefId) {
+ this.engineRefId = engineRefId;
+ }
+
+ /**
+ * Retrieve the engine to be used. If the engineRefId
+ * attribute is not defined then the JavaEngine is used
+ * as the default one.
+ * @return An instance of engine.
+ * @throws a BuildException if the engineRefId attribute doesn't define an Engine
+ * object.
+ */
+ protected Engine getEngine() {
+ if (engineRefId == null) {
+ log("Using default engine (Java threading)");
+ JavaEngine engine = new JavaEngine();
+ engine.setProject(getProject());
+ engine.setTask(this);
+ return engine;
+ } else {
+ try {
+ Engine engine = (Engine)this.getProject().getReference(engineRefId);
+ engine.setTask(this);
+ return engine;
+ } catch (ClassCastException e) {
+ throw new BuildException("Reference '" + engineRefId + "' is not referencing an Engine configuration.");
+ }
+ }
+ }
+
+ /**
+ * Get current epocroot location (build environment).
+ * @return a File object.
+ */
+ public File getEpocroot() {
+ File epocroot = this.epocroot;
+ if (epocroot == null) {
+ epocroot = new File(System.getenv("EPOCROOT"));
+ if (epocroot == null) {
+ throw new BuildException("'epocroot' attribute has not been defined.");
+ } else {
+ log("Using EPOCROOT: " + epocroot.getAbsolutePath());
+ }
+ }
+
+ if (!epocroot.exists() || !epocroot.isDirectory()) {
+ throw new BuildException("Invalid epocroot directory: " + epocroot);
+ }
+ return epocroot;
+ }
+
+ /**
+ * Defines the EPOCROOT location.
+ * @param epocroot
+ * @ant.not-required Will use EPOCROOT environment variable if not defined.
+ */
+ public void setEpocroot(File epocroot) {
+ this.epocroot = epocroot;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void execute() {
+ try {
+ // Simple way to verify if iMaker is installed under
+ // then environment.
+ IMaker imaker = getIMaker();
+ log("Using iMaker: " + imaker.getVersion());
+
+ // build the content.
+ build();
+ } catch (IMakerException e) {
+ if (shouldFailOnError()) {
+ throw new BuildException(e.getMessage(), e);
+ } else {
+ log(e.getMessage(), Project.MSG_ERR);
+ }
+ }
+ }
+
+ /**
+ * Should the task be verbose.
+ * @return Returns true if the task should display all iMaker outputs.
+ */
+ public boolean isVerbose() {
+ return verbose;
+ }
+
+ /**
+ * Defines if the task should log all the output through Ant.
+ * by default only error/warnings are printed.
+ * @param verbose set the verbosity status.
+ * @ant.not-required Default is false.
+ */
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+
+ /**
+ * Get the output filename.
+ * @return the output filename.
+ */
+ public File getOutput() {
+ return output;
+ }
+
+ /**
+ * Defined the output log filename.
+ * @param output
+ * @ant.not-required
+ */
+ public void setOutput(File output) {
+ this.output = output;
+ }
+
+ /**
+ * Concatenate all the configuration content and
+ * delegate the building to the engine.
+ * @throws IMakerException
+ */
+ protected void build() throws IMakerException {
+ List> cmds = new ArrayList>();
+ for (IMakerCommandSet cmdSet : commandSets) {
+ if (cmdSet instanceof DataType) {
+ DataType dataType = (DataType)cmdSet;
+ if (dataType.isReference()) {
+ cmdSet = (IMakerCommandSet)dataType.getRefid().getReferencedObject();
+ }
+ }
+ cmds.addAll(cmdSet.getCommands(getIMaker()));
+ }
+ if (cmds.size() > 0) {
+ getEngine().build(cmds);
+ } else {
+ log("Nothing to build.");
+ }
+ }
+
+ /**
+ * Get a configured IMaker instance. The created object
+ * is configured with output stream redirected to
+ * the task logging. Stderr is always redirected,
+ * stdout is only redirected if the task is configured
+ * to be verbose.
+ *
+ * @return an IMaker instance.
+ */
+ public IMaker getIMaker() {
+ return getIMaker(verbose, true);
+ }
+
+ /**
+ * Get a configured IMaker instance. The created object
+ * is configured with output stream redirected to
+ * the task logging. Stderr is always redirected,
+ * the stdout will be configured by the verbose parameter.
+ * @param verbose enable stdout redirection to the task logging.
+ * @return an IMaker instance.
+ */
+ public IMaker getIMaker(boolean verbose, boolean verboseError) {
+ IMaker imaker = new IMaker(getEpocroot());
+ if (verbose) {
+ imaker.addOutputLineHandler(stdout);
+ }
+ if (verboseError) {
+ imaker.addErrorLineHandler(stderr);
+ }
+ return imaker;
+ }
+
+ /**
+ * Defines if the task should fail in case of error.
+ * @ant.not-required Default is true
+ */
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ /**
+ * Should the task should fail in case of error?
+ * @return true if the task should fail on error.
+ */
+ public boolean shouldFailOnError() {
+ return this.failOnError;
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/types/Configuration.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/types/Configuration.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,356 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.helium.imaker.ant.types;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.DataType;
+import org.apache.tools.ant.types.PatternSet;
+
+import com.nokia.helium.imaker.IMaker;
+import com.nokia.helium.imaker.IMakerException;
+import com.nokia.helium.imaker.ant.Command;
+import com.nokia.helium.imaker.ant.IMakerCommandSet;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+import java.util.regex.Pattern;
+
+/**
+ * The imakerconfiguration enables the build manager to configure his iMaker
+ * builds based on introspection.
+ *
+ * The makefileset element will configure the filtering of the "imaker help-config"
+ * command. Then for each of the configuration found the targetset elements will be used
+ * to filter the output from the "imaker -f configuration.mk help-target-*-list"
+ * command. Finally a set of command will be generated.
+ *
+ * Each command will then be configure using the set of variables defined by the variableset
+ * elements. Only the WORKDIR variable is under the task control to ensure call safety during the
+ * parallelization.
+ *
+ * The usage of the variablegroup will allow you to duplicate the common set of commands
+ * and apply additional variables.
+ *
+ * Example:
+ *
+ * <imakerconfiguration regionalVariation="true">
+ * <makefileset>
+ * <include name="**/product/*ui.mk"/>
+ * </makefileset>
+ * <targetset>
+ * <include name="^core$" />
+ * <include name="langpack_\d+" />
+ * <include name="^custvariant_.*$" />
+ * <include name="^udaerase$" />
+ * </targetset>
+ * <variableset>
+ * <variable name="USE_FOTI" value="0"/>
+ * <variable name="USE_FOTA" value="1"/>
+ * </variableset>
+ * <variablegroup>
+ * <variable name="TYPE" value="rnd"/>
+ * </variablegroup>
+ * <variablegroup>
+ * <variable name="TYPE" value="subcon"/>
+ * </variablegroup>
+ * </imakerconfiguration>
+ *
+ *
+ * This configuration might produce the following calls :
+ *
+ * imaker -f /epoc32/rom/config/platform/product/image_conf_product_ui.mk TYPE=rnd USE_FOTI=0 USE_FOTA=1 core
+ * imaker -f /epoc32/rom/config/platform/product/image_conf_product_ui.mk TYPE=subcon USE_FOTI=0 USE_FOTA=1 core
+ * imaker -f /epoc32/rom/config/platform/product/image_conf_product_ui.mk TYPE=rnd USE_FOTI=0 USE_FOTA=1 langpack_01
+ * imaker -f /epoc32/rom/config/platform/product/image_conf_product_ui.mk TYPE=subcon USE_FOTI=0 USE_FOTA=1 langpack_01
+ *
+ *
+ * @ant.type name="imakerconfiguration" category="imaker"
+ */
+public class Configuration extends DataType implements IMakerCommandSet {
+
+ private Vector makefiles = new Vector();
+ private Vector selectors = new Vector();
+ private Vector targets = new Vector();
+ private Vector variables = new Vector();
+ private Vector variablegroups = new Vector();
+ private boolean regionalVariation;
+
+ /**
+ * Create a makefileset element.
+ * Makefileset elements are based on regular Ant PatternSet.
+ * @return a PatternSet object.
+ */
+ public PatternSet createMakefileSet() {
+ PatternSet makefile = new PatternSet();
+ makefiles.add(makefile);
+ return makefile;
+ }
+
+ /**
+ * Get the list of makefileset element.
+ * @return a vector of PatternSet objects.
+ */
+ public Vector getMakefileSet() {
+ return makefiles;
+ }
+
+ /**
+ * Add a Makefile selector configuration (e.g: products)
+ * @param filter
+ */
+ public void add(MakefileSelector filter) {
+ selectors.add(filter);
+ }
+
+ /**
+ * Create a targetset element.
+ * Targetset elements are based on regular Ant PatternSet.
+ * @return a PatternSet object.
+ */
+ public PatternSet createTargetSet() {
+ PatternSet target = new PatternSet();
+ targets.add(target);
+ return target;
+ }
+
+ /**
+ * Get the list of targetset.
+ * @return a vector of PatternSet objects.
+ */
+ public Vector getTargetSet() {
+ return targets;
+ }
+
+ /**
+ * Create a VariableSet element.
+ * @return a VariableSet object.
+ */
+ public VariableSet createVariableSet() {
+ VariableSet var = new VariableSet();
+ variables.add(var);
+ return var;
+ }
+
+ /**
+ * Create a VariableSet element.
+ * @return a VariableSet object.
+ */
+ public VariableGroup createVariableGroup() {
+ VariableGroup var = new VariableGroup();
+ variablegroups.add(var);
+ return var;
+ }
+
+ /**
+ * Get the list of variableset.
+ * @return a vector of VariableSet objects.
+ */
+ public Vector getVariableSet() {
+ return variables;
+ }
+
+ /**
+ * Enables the sorting of images per region.
+ * @deprecated The usage of this feature is now ignored.
+ * @param value the state of the regional variation
+ * @ant.not-required Default is false - The usage of this feature is now ignored.
+ */
+ @Deprecated
+ public void setRegionalVariation(boolean value) {
+ log(this.getDataTypeName() + ": the usage of the regionalVariation attribute is now ignored.", Project.MSG_WARN);
+ regionalVariation = value;
+ }
+
+ /**
+ * Get the status of the regional variation enabling.
+ * @deprecated The usage of this feature is now ignored.
+ * @return returns true is the regional variation should be enabled.
+ */
+ public boolean getRegionalVariation() {
+ return regionalVariation;
+ }
+
+ /**
+ * Check if name is matching any of the pattern under patterns list.
+ * @param name the string to match
+ * @param patterns a list of PatternSet
+ * @return Returns true if name matches at least one pattern.
+ */
+ protected boolean isIncluded(String name, Vector patterns) {
+ for (PatternSet patternSet : patterns) {
+ if (patternSet.isReference()) {
+ patternSet = (PatternSet) patternSet.getRefid().getReferencedObject();
+ }
+ String[] includes = patternSet.getIncludePatterns(getProject());
+ if (includes != null) {
+ for (String pattern : includes) {
+ if (Pattern.matches(pattern, name)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Check if name is matching any of the pattern under patterns list.
+ * @param name the string to match
+ * @param patterns a list of PatternSet
+ * @return Returns true if name matches at least one pattern.
+ */
+ protected boolean isExcluded(String name, Vector patterns) {
+ for (PatternSet patternSet : patterns) {
+ if (patternSet.isReference()) {
+ patternSet = (PatternSet) patternSet.getRefid().getReferencedObject();
+ }
+ String[] excludes = patternSet.getExcludePatterns(getProject());
+ if (excludes != null) {
+ for (String pattern : excludes) {
+ if (Pattern.matches(pattern, name)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Get a configured matcher.
+ * @return a configured makefile matcher.
+ */
+ protected Matcher getMakefileMatcher() {
+ Matcher matcher = new Matcher();
+ List includes = new ArrayList();
+ List excludes = new ArrayList();
+ for (PatternSet patternSet : makefiles) {
+ if (patternSet.isReference()) {
+ patternSet = (PatternSet) patternSet.getRefid().getReferencedObject();
+ }
+ String[] patterns = patternSet.getIncludePatterns(getProject());
+ if (patterns != null) {
+ for (String pattern : patterns) {
+ includes.add(pattern);
+ }
+ }
+ patterns = patternSet.getExcludePatterns(getProject());
+ if (patterns != null) {
+ for (String pattern : patterns) {
+ excludes.add(pattern);
+ }
+ }
+ }
+ matcher.setIncludes(includes.toArray(new String[includes.size()]));
+ matcher.setExcludes(excludes.toArray(new String[excludes.size()]));
+ return matcher;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List> getCommands(IMaker imaker) {
+ List> cmdSet = new ArrayList>();
+ List cmds = new ArrayList();
+ // Let's add one fake group.
+ if (variablegroups.size() == 0) {
+ variablegroups.add(new VariableGroup());
+ }
+ try {
+ for (String configuration : getConfigurations(imaker.getConfigurations())) {
+ log("Including configuration: " + configuration);
+ for (String target : imaker.getTargets(configuration)) {
+ if (isIncluded(target, targets) && !isExcluded(target, targets)) {
+ log("Including target: " + target);
+ for (VariableGroup group : variablegroups) {
+ if (group.isReference()) {
+ group = (VariableGroup)group.getRefid().getReferencedObject();
+ }
+ Command cmd = new Command();
+ cmd.setCommand("imaker");
+ cmd.addArgument("-f");
+ cmd.addArgument(configuration);
+ // Adding variables
+ for (VariableSet vs : variables) {
+ cmd.addVariables(vs.toMap());
+ }
+ // Adding variables from groups
+ cmd.addVariables(group.toMap());
+ cmd.setTarget(target);
+ cmds.add(cmd);
+ }
+ }
+ }
+ }
+ } catch (IMakerException e) {
+ throw new BuildException(e.getMessage());
+ }
+ // adding all the commands.
+ if (cmds.size() > 0) {
+ cmdSet.add(cmds);
+ }
+ return cmdSet;
+ }
+
+ /**
+ * Select which iMaker configuration should be built.
+ * @param configurations
+ * @return
+ */
+ protected Set getConfigurations(List configurations) {
+ Set result = new HashSet();
+ if (makefiles.size() > 0) {
+ Matcher matcher = getMakefileMatcher();
+ for (String configuration : configurations) {
+ if (matcher.match(configuration)) {
+ result.add(configuration);
+ }
+ }
+ }
+ for (MakefileSelector selector : selectors) {
+ result.addAll(selector.selectMakefile(configurations));
+ }
+ return result;
+ }
+
+ /**
+ * Matcher object to filter discovered configurations.
+ * iMaker configuration.
+ */
+ public class Matcher extends DirectoryScanner {
+
+ /**
+ * Check is a particular configuration can
+ * is selected.
+ * @param path the string to match.
+ * @return return true is the path is selected.
+ */
+ public boolean match(String path) {
+ String vpath = path.replace('/', File.separatorChar).
+ replace('\\', File.separatorChar);
+ return isIncluded(vpath) && !isExcluded(vpath);
+ }
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/types/ConfigurationSet.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/types/ConfigurationSet.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.helium.imaker.ant.types;
+
+import org.apache.tools.ant.types.DataType;
+
+import com.nokia.helium.imaker.IMaker;
+import com.nokia.helium.imaker.ant.Command;
+import com.nokia.helium.imaker.ant.IMakerCommandSet;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * Set of iMaker configuration.
+ *
+ *
+ * <hlm:imakerconfigurationset>
+ * <imakerconfiguration regionalVariation="true">
+ * <makefileset>
+ * <include name="**/product/*ui.mk"/>
+ * </makefileset>
+ * <targetset>
+ * <include name="^core$" />
+ * <include name="langpack_\d+" />
+ * <include name="^custvariant_.*$" />
+ * <include name="^udaerase$" />
+ * </targetset>
+ * <variableset>
+ * <variable name="USE_FOTI" value="0"/>
+ * <variable name="USE_FOTA" value="1"/>
+ * </variableset>
+ * <variablegroup>
+ * <variable name="TYPE" value="rnd"/>
+ * <variable name="USE_FOTI" value="0"/>
+ * <variable name="USE_FOTA" value="1"/>
+ * </variablegroup>
+ * <variablegroup>
+ * <variable name="TYPE" value="subcon"/>
+ * <variable name="USE_FOTI" value="0"/>
+ * <variable name="USE_FOTA" value="1"/>
+ * </variablegroup>
+ * </imakerconfiguration>
+ * </hlm:imakerconfigurationset>
+ *
+ * @ant.type name="imakerconfigurationset" category="imaker"
+ */
+public class ConfigurationSet extends DataType implements IMakerCommandSet {
+
+ private Vector configurations = new Vector();
+
+ /**
+ * This method create an iMaker Configuration element.
+ */
+ public Configuration createImakerConfiguration() {
+ Configuration config = new Configuration();
+ configurations.add(config);
+ return config;
+ }
+
+ /**
+ * Get the list of iMaker configuration.
+ */
+ public Vector getImakerConfiguration() {
+ return configurations;
+ }
+
+ @Override
+ public List> getCommands(IMaker imaker) {
+ List> cmdset = new ArrayList>();
+ for (Configuration config : configurations) {
+ if (config.isReference()) {
+ config = (Configuration) config.getRefid().getReferencedObject();
+ }
+ cmdset.addAll(config.getCommands(imaker));
+ }
+ return cmdset;
+ }
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/types/MakefileSelector.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/types/MakefileSelector.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker.ant.types;
+
+import java.util.List;
+
+/**
+ * Interface used to extend the Makefile introspection of the
+ * iMaker configuration.
+ *
+ */
+public interface MakefileSelector {
+
+ /**
+ * Select the configurations to be built based on the object settings.
+ * @param configuration
+ * @return a list of selected configuration from the input list.
+ */
+ List selectMakefile(List configurations);
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/types/Product.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/types/Product.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker.ant.types;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.DataType;
+
+/**
+ * The product type will allow you to select iMaker makefile configuration based on
+ * the product name. The search will be done using the following template:
+ * image_conf_[product_name][_ui].mk
+ *
+ *
+ * <hlm:product list="product1,product2" ui="true" failonerror="false" />
+ *
+ * @ant.type name="hlm:product" category="imaker"
+ */
+public class Product extends DataType implements MakefileSelector {
+ private String list;
+ private boolean ui;
+ private boolean failOnError = true;
+
+ /**
+ * Defines a comma separated list of product names.
+ * @param name
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Get the list of products
+ * @return an array of products
+ */
+ public String[] getNames() {
+ Vector names = new Vector();
+ for (String name : this.list.split(",")) {
+ name = name.trim();
+ if (name.length() > 0) {
+ names.add(name);
+ }
+ }
+ return names.toArray(new String[names.size()]);
+ }
+
+ public void setUi(boolean ui) {
+ this.ui = ui;
+ }
+
+ /**
+ * Define if we are looking for a ui configuration (will add _ui to the
+ * makefile name)
+ * @return
+ * @ant.not-required Default false
+ */
+ public boolean isUi() {
+ return ui;
+ }
+
+ /**
+ * Shall we fail the build in case of missing config?
+ * @param failOnError
+ * @ant.not-required Default true
+ */
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ /**
+ * Shall we fail the build in case of missing config.
+ * @return a boolean
+ */
+ public boolean isFailOnError() {
+ return failOnError;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List selectMakefile(List configurations) {
+ List result = new ArrayList();
+ for (String product : getNames()) {
+ String endOfString = "image_conf_" + product + (ui ? "_ui" : "") + ".mk";
+ boolean foundConfig = false;
+ for (String config : configurations) {
+ if (config.endsWith(endOfString)) {
+ foundConfig = true;
+ result.add(config);
+ break;
+ }
+ }
+ if (!foundConfig) {
+ if (isFailOnError()) {
+ throw new BuildException("Could not find a valid configuration for " + product);
+ } else {
+ log("Could not find a valid configuration for " + product, Project.MSG_ERR);
+ }
+ }
+ }
+ return result;
+ }
+
+}
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/types/Variable.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/types/Variable.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.helium.imaker.ant.types;
+
+import org.apache.tools.ant.types.DataType;
+import org.apache.tools.ant.BuildException;
+
+/**
+ * Configure a variable for iMaker.
+ * @ant.type name="variable" category="imaker"
+ */
+public class Variable extends DataType
+{
+ private String mName;
+ private String mValue;
+
+ /**
+ * Set the name of the variable.
+ * @param name
+ */
+ public void setName(String name) {
+ mName = name;
+ }
+
+
+ /**
+ * Get the name of the variable.
+ * @return name.
+ */
+ public String getName() {
+ return mName;
+ }
+
+ /**
+ * Set the value of the variable.
+ * @param value
+ */
+ public void setValue(String value) {
+ mValue = value;
+ }
+
+
+ /**
+ * Get the value of the variable.
+ * @return value.
+ */
+ public String getValue() {
+ return mValue;
+ }
+
+ /**
+ * Validate if the configuration is defined properly.
+ * Throws BuildException in case of error.
+ */
+ public void validate() {
+ if (getName() == null) {
+ throw new BuildException("The variable element doesn't define a 'name' attribute.");
+ }
+ if (getValue() == null) {
+ throw new BuildException("The variable element doesn't define a 'value' attribute.");
+ }
+ }
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/types/VariableGroup.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/types/VariableGroup.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker.ant.types;
+
+/**
+ * This type is a container for variable configuration.
+ * A set of command will be generated for each group
+ * present in the imakerconfiguration.
+ *
+ *
+ * <variablegroup>
+ * <variable name="TYPE" value="rnd" />
+ * </variablegroup>
+ *
+ *
+ * @ant.type name=variablegroup category="imaker"
+ */
+public class VariableGroup extends VariableSet {
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/types/VariableSet.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/ant/types/VariableSet.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.helium.imaker.ant.types;
+import org.apache.tools.ant.types.DataType;
+
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Vector;
+
+/**
+ * This type is a container for variable configuration.
+ *
+ *
+ * <variableset>
+ * <variable name="TYPE" value="rnd" />
+ * </variableset>
+ *
+ *
+ * @ant.type name="variableset" category="imaker"
+ */
+public class VariableSet extends DataType {
+
+ private Vector variables = new Vector();
+
+ /**
+ * Creates a Variable object.
+ * @return a Variable object.
+ */
+ public Variable createVariable() {
+ Variable var = new Variable();
+ add(var);
+ return var;
+ }
+
+ /**
+ * Support the addition of a Variable object.
+ * @param a Variable object.
+ */
+ public void add(Variable var) {
+ variables.add(var);
+ }
+
+ /**
+ * Get the list of Variable object.
+ * @return a vector of Variable objects
+ */
+ public Vector getVariables() {
+ return variables;
+ }
+
+ /**
+ * Convert the set of variable to a Map object.
+ * @return the content of that set into a Map object.
+ */
+ public Map toMap() {
+ Map data = new Hashtable();
+ for (Variable var : variables) {
+ var.validate();
+ data.put(var.getName(), var.getValue());
+ }
+ return data;
+ }
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/utils/ParallelExecutor.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/src/com/nokia/helium/imaker/utils/ParallelExecutor.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker.utils;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+
+/**
+ * Simple application which will execute each line from a text file
+ * as a command. All the command will be executed in parallel.
+ * Default number of threads is 4.
+ *
+ * The implementation must not rely on any external dependencies except JVM and owning jar.
+ *
+ */
+public final class ParallelExecutor {
+
+ /**
+ * Private constructor - not meant to be instantiated.
+ */
+ private ParallelExecutor() {
+ }
+
+ /**
+ * Internal class holding a command to
+ * execute.
+ *
+ */
+ private static class RunCommand implements Runnable {
+ private String cmdline;
+
+ /**
+ * Default constructor
+ * @param cmdline the command to run
+ */
+ public RunCommand(String cmdline) {
+ this.cmdline = cmdline;
+ }
+
+ /**
+ * Running command line and capturing the output.
+ */
+ @Override
+ public void run() {
+ StringTokenizer st = new StringTokenizer(cmdline);
+ String[] cmdArray = new String[st.countTokens()];
+ for (int i = 0; st.hasMoreTokens(); i++) {
+ cmdArray[i] = st.nextToken();
+ }
+ Process p;
+ try {
+ p = new ProcessBuilder(cmdArray).redirectErrorStream(true).start();
+ BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ StringBuffer buffer = new StringBuffer();
+ SimpleDateFormat df = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy");
+
+ Date start = new Date();
+ buffer.append("++ Started at " + df.format(start) + "\n");
+ buffer.append("+++ HiRes Start " + start.getTime() / 1000 + "\n");
+ buffer.append("-- " + cmdline + "\n");
+ while ((line = in.readLine()) != null) {
+ buffer.append(line + "\n");
+ }
+ Date end = new Date();
+ buffer.append("+++ HiRes End " + end.getTime() / 1000 + "\n");
+ buffer.append("++ Finished at " + df.format(end) + "\n");
+ synchronized (System.out) {
+ System.out.print(buffer);
+ }
+ } catch (IOException e) {
+ System.err.println("ERROR: " + e.getMessage());
+ }
+ }
+ }
+
+ /**
+ * This is the entry point of the application.
+ * It will only accept one file name as parameter.
+ * @param args a list of arguments.
+ */
+ public static void main(String[] args) {
+ if (args.length == 1) {
+ try {
+ List cmds = new ArrayList();
+ BufferedReader in = new BufferedReader(new FileReader(args[0]));
+ String line;
+ while ((line = in.readLine()) != null) {
+ if (line.trim().length() > 0) {
+ cmds.add(line);
+ }
+ }
+
+ final ArrayBlockingQueue queue = new ArrayBlockingQueue(cmds.size());
+ int numOfProcessor = Runtime.getRuntime().availableProcessors();
+ System.out.println("Number of threads: " + numOfProcessor);
+ ThreadPoolExecutor executor = new ThreadPoolExecutor(numOfProcessor, numOfProcessor, 100, TimeUnit.MILLISECONDS, queue);
+ for (String cmd : cmds) {
+ executor.execute(new RunCommand(cmd));
+ }
+ executor.shutdown();
+ } catch (IOException e) {
+ System.err.println("ERROR: " + e.getMessage());
+ }
+ } else {
+ System.out.println("ParallelExecutor: nothing to execute.");
+ }
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/antunit/test_emakeengine.ant.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/antunit/test_emakeengine.ant.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,155 @@
+
+
+
+ Helium Antlib imaker unittests.
+
+
+
+
+
+
+
+ -------------------------------------------------------------------------------
+
+
+
+
+
+
+
+
+
+ -------------------------------------------------------------------------------
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/antunit/test_imaker.ant.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/antunit/test_imaker.ant.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,280 @@
+
+
+
+ Helium Antlib imaker unittests.
+
+
+
+
+
+
+
+ -------------------------------------------------------------------------------
+
+
+
+
+
+
+
+
+
+ -------------------------------------------------------------------------------
+
+
+
+ Will fail because it can't find imaker.
+
+
+
+
+
+
+ Usin custom epocroot.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/antunit/test_imaker_invalid.ant.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/antunit/test_imaker_invalid.ant.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,82 @@
+
+
+
+ Helium Antlib imaker unittests.
+
+
+
+
+
+
+
+ -------------------------------------------------------------------------------
+
+
+
+
+
+
+
+
+
+ -------------------------------------------------------------------------------
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/antunit/test_javaengine.ant.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/antunit/test_javaengine.ant.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,63 @@
+
+
+
+ Helium Antlib imaker unittests.
+
+
+
+
+
+
+
+ -------------------------------------------------------------------------------
+
+
+
+
+
+
+
+
+
+ -------------------------------------------------------------------------------
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/bld.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/bld.sh Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,25 @@
+#!/bin/csh
+
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+
+
+module load java/1.6.0
+module load mercurial
+export PATH=$PATH:.
+setenv ANT_ARGS "-lib ../lib -lib ../../lib -lib ../../core/lib -lib ../../bin/helium-core.jar -lib ../../bin/helium-imaker.jar -lib ../../antlibs"
+ant $*
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/build.bat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/build.bat Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,27 @@
+@echo off
+
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the License "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+setlocal
+if not defined JAVA_6_HOME (
+set TESTED_JAVA=C:\Apps\j2sdk_1.6.0_02
+) ELSE set TESTED_JAVA=%JAVA_6_HOME%
+if exist %TESTED_JAVA% (set JAVA_HOME=%TESTED_JAVA%)
+set ANT_ARGS=-lib %CD%\..\lib -lib %CD%\..\..\lib -lib %CD%\..\..\bin\helium-core.jar -lib %CD%\..\..\bin\helium-imaker.jar -lib %CD%\..\..\antlibs
+ant %*
+endlocal
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/build.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/build.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,35 @@
+
+
+
+ Helium Antlib Sysdef unittests.
+
+
+
+
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/emake_data/cust.mk.ftl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/emake_data/cust.mk.ftl Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,30 @@
+<#--
+============================================================================
+Name : cust.mk.ftl
+Part of : Helium
+
+Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+All rights reserved.
+This component and the accompanying materials are made available
+under the terms of the License "Eclipse Public License v1.0"
+which accompanies this distribution, and is available
+at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+Initial Contributors:
+Nokia Corporation - initial contribution.
+
+Contributors:
+
+Description:
+
+============================================================================
+-->
+java_home:${java_home}
+java_utils_classpath:${java_utils_classpath}
+makefile:${makefile}
+<#list cmdSets as cmds>
+Group:
+ <#list cmds as cmd>
+ + <#list cmd.getArguments() as arg>${arg} #list>${cmd.getTarget()}
+ #list>
+#list>
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/emake_data/invalid.mk.ftl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/emake_data/invalid.mk.ftl Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,31 @@
+<#--
+============================================================================
+Name : invalid.mk.ftl
+Part of : Helium
+
+Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+All rights reserved.
+This component and the accompanying materials are made available
+under the terms of the License "Eclipse Public License v1.0"
+which accompanies this distribution, and is available
+at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+Initial Contributors:
+Nokia Corporation - initial contribution.
+
+Contributors:
+
+Description:
+
+============================================================================
+-->
+java_home:${java_home}
+java_utils_classpath:${java_utils_classpath}
+makefile:${makefile}
+<#list cmdSets as cmds>
+Group:
+ <#list cmds as cmd>
+ + <#list cmd.getArguments() as arg>${arg} #list>${cmd.getTarget()}
+ #list>
+<#-- The next line is meant to be invalid! -->
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/epocroot/imaker
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/epocroot/imaker Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+python imaker_mock.p $*
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/epocroot/imaker.bat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/epocroot/imaker.bat Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,19 @@
+@echo off
+
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the License "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+@python imaker_mock.py %*
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/epocroot/imaker_mock.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/epocroot/imaker_mock.py Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,69 @@
+#============================================================================
+#Name : imaler_mock.py
+#Part of : Helium
+
+#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+#All rights reserved.
+#This component and the accompanying materials are made available
+#under the terms of the License "Eclipse Public License v1.0"
+#which accompanies this distribution, and is available
+#at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+#Initial Contributors:
+#Nokia Corporation - initial contribution.
+#
+#Contributors:
+#
+#Description:
+#===============================================================================
+
+import sys
+print "iMaker 09.24.01, 10-Jun-2009."
+
+if sys.argv.count("version"):
+ print ""
+ sys.exit(0)
+
+if sys.argv.count("help-target-*-list") and sys.argv.count("/epoc32/rom/config/platform/product/image_conf_invalid.mk"):
+ print """mingw_make: /epoc32/rom/config/platform/product/image_conf_invalid.mk: No such file or directory
+mingw_make: *** No rule to make target `/epoc32/rom/config/platform/product/image_conf_invalid.mk'. Stop.
+*** Error: Command `\epoc32\tools\rom\imaker\mingw_make.exe -R --no-print-directory SHELL="C:\WINNT\system32\cmd.exe" -I
+ B:/epoc32/rom/config -f B:/epoc32/tools/rom/imaker/imaker.mk TIMESTAMP=2009102317302243 -f /epoc32/rom/config/platform/
+product/image_conf_invalid.mk -f B:/epoc32/tools/rom/imaker/imaker.mk help-target-*-list' failed in `/'.
+"""
+ sys.exit(1)
+
+if sys.argv.count("help-config"):
+ print "Finding available configuration file(s):"
+ print "/epoc32/rom/config/platform/product/image_conf_product.mk"
+ print "/epoc32/rom/config/platform/product/image_conf_product_ui.mk"
+ print ""
+ sys.exit(0)
+
+if sys.argv.count("help-target-*-list"):
+ # start with some kind of warnings...
+ print "B:/epoc32/tools/rom/imaker/imaker_help.mk:55: memory_map_settings2.hrh: No such file or directory"
+ print "all"
+ print "core"
+ print "core-dir"
+ print "help-%-list"
+ print "langpack_01"
+ print ""
+ sys.exit(0)
+
+if sys.argv.count("-f") and sys.argv.count("print-VARIABLE"):
+ print "VARIABLE = `PRODUCT_VALUE'"
+ print ""
+ sys.exit(0)
+
+if sys.argv.count("print-VARIABLE"):
+ print "VARIABLE = `VALUE'"
+ print ""
+ sys.exit(0)
+
+if sys.argv.count("print-NOTEXISTSVARIABLE"):
+ print ""
+ sys.exit(0)
+
+print ""
+sys.exit(0)
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/epocroot_invalid/imaker
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/epocroot_invalid/imaker Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+python imaker_mock.p $*
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/epocroot_invalid/imaker.bat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/epocroot_invalid/imaker.bat Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,19 @@
+@echo off
+
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the License "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+@python imaker_mock.py %*
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/epocroot_invalid/imaker_mock.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/epocroot_invalid/imaker_mock.py Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,28 @@
+#============================================================================
+#Name : imaler_mock.py
+#Part of : Helium
+
+#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+#All rights reserved.
+#This component and the accompanying materials are made available
+#under the terms of the License "Eclipse Public License v1.0"
+#which accompanies this distribution, and is available
+#at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+#Initial Contributors:
+#Nokia Corporation - initial contribution.
+#
+#Contributors:
+#
+#Description:
+#===============================================================================
+
+import sys
+print "iMaker 09.24.01, 10-Jun-2009."
+sys.stderr.write("""mingw_make: /epoc32/rom/config/platform/product/image_conf_invalid.mk: No such file or directory
+mingw_make: *** No rule to make target `/epoc32/rom/config/platform/product/image_conf_invalid.mk'. Stop.
+*** Error: Command `\epoc32\tools\rom\imaker\mingw_make.exe -R --no-print-directory SHELL="C:\WINNT\system32\cmd.exe" -I
+ B:/epoc32/rom/config -f B:/epoc32/tools/rom/imaker/imaker.mk TIMESTAMP=2009102317302243 -f /epoc32/rom/config/platform/
+product/image_conf_invalid.mk -f B:/epoc32/tools/rom/imaker/imaker.mk help-target-*-list' failed in `/'.
+""")
+sys.exit(1)
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/epocroot_task/emake
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/epocroot_task/emake Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+echo $*
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/epocroot_task/emake.cmd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/epocroot_task/emake.cmd Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,21 @@
+@echo off
+
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the License "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+echo %*
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/epocroot_task/imaker
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/epocroot_task/imaker Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+python imaker_mock.p $*
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/epocroot_task/imaker.bat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/epocroot_task/imaker.bat Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,19 @@
+@echo off
+
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the License "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+@python imaker_mock.py %*
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/epocroot_task/imaker_mock.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/epocroot_task/imaker_mock.py Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,167 @@
+#============================================================================
+#Name : imaler_mock.py
+#Part of : Helium
+
+#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+#All rights reserved.
+#This component and the accompanying materials are made available
+#under the terms of the License "Eclipse Public License v1.0"
+#which accompanies this distribution, and is available
+#at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+#Initial Contributors:
+#Nokia Corporation - initial contribution.
+#
+#Contributors:
+#
+#Description:
+#===============================================================================
+
+import sys
+print "iMaker 09.24.01, 10-Jun-2009."
+
+if sys.argv.count("version"):
+ print ""
+ sys.exit(0)
+
+# two product supported by the mock
+if sys.argv.count("help-config"):
+ print "Finding available configuration file(s):"
+ print "/epoc32/rom/config/platform/product/image_conf_product.mk"
+ print "/epoc32/rom/config/platform/product/image_conf_product_ui.mk"
+ print ""
+ sys.exit(0)
+
+# List of targets
+if sys.argv.count("help-target-*-list"):
+ # start with some kind of warnings...
+ print "all"
+ print "core"
+ print "core-dir"
+ print "help-%-list"
+ print "langpack_01"
+ print ""
+ sys.exit(0)
+
+
+
+
+def print_log(log):
+ for line in log:
+ print line
+
+
+core_log = ["iMaker 09.42.01, 13-Oct-2009.",
+"Generating content with ConE",
+"* Writing tmp2.oby - result of substitution phase",
+"* Writing tmp3.oby - result of reorganisation phase",
+"* Writing tmp4.oby - result of Plugin stage",
+"* Writing tmp5.oby - result of choosing language-specific files",
+"* Writing tmp7.oby - result of problem-suppression phase",
+"* Writing tmp8.oby - result of bitmap conversion phase",
+"* Removing previous image and logs...",
+"* Writing tmp9.oby - result of cleaning phase",
+"* Writing NAME_VERSION04_rnd.oby - final OBY file",
+"* Writing NAME_VERSION04_rnd.rom.oby - final OBY file",
+"* Writing NAME_VERSION04_rnd.dir - ROM directory listing",
+"-------------------------------------------------------------------------------",
+"Total duration: 01:42 Status: OK",
+"===============================================================================",
+]
+
+if sys.argv.count("core"):
+ print_log(core_log)
+ print ""
+ sys.exit(0)
+
+rof2_log = ["iMaker 09.42.01, 13-Oct-2009.",
+"Generating content with ConE",
+"Variant target USE_VARIANTBLD = `2'",
+"Variant directory VARIANT_DIR = `/output/release_flash_images/product/rnd/langpack/langpack_01/rofs2/temp/cone'",
+"Variant config makefile VARIANT_MK = `/output/release_flash_images/product/rnd/langpack/langpack_01/rofs2/temp/cone/language_variant.mk'",
+"Variant include directory VARIANT_INCDIR = `/output/release_flash_images/product/rnd/langpack/langpack_01/rofs2/temp/cone/include'",
+"Variant SIS directory VARIANT_SISDIR = -",
+"Variant operator cache dir VARIANT_OPCDIR = -",
+"Variant widget preinst dir VARIANT_WGZDIR = -",
+"Variant zip content dir VARIANT_ZIPDIR = -",
+"Variant copy content dir VARIANT_CPDIR = `/output/release_flash_images/product/rnd/langpack/langpack_01/rofs2/temp/cone/content'",
+"Variant output directory VARIANT_OUTDIR = `/output/release_flash_images/product/rnd/langpack/langpack_01/rofs2/variant'",
+"Generating oby(s) for Variant image creation",
+"Copying copy content directory",
+"Generating Feature manager file(s)",
+"Generating file(s) for ROFS2 image creation",
+"Generating language files for Language Package image creation",
+"Creating ROFS2 SOS image",
+"",
+"ROM_IMAGE[0] non-xip size=0x00000000 xip=0 compress=0 extension=0 composite=none uncompress=0",
+"ROM_IMAGE[1] dummy1 size=0x10000000 xip=0 compress=0 extension=0 composite=none uncompress=0 ",
+"ROM_IMAGE[2] rofs2 size=0x10000000 xip=0 compress=0 extension=0 composite=none uncompress=0 ",
+"ROM_IMAGE[3] dummy3 size=0x10000000 xip=0 compress=0 extension=0 composite=none uncompress=0 ",
+"* Writing tmp2.oby - result of substitution phase",
+"* Writing tmp3.oby - result of reorganisation phase",
+"* Writing tmp4.oby - result of Plugin stage",
+"* Writing tmp5.oby - result of choosing language-specific files",
+"Created ecom-2-0.spi",
+"Created ecom-2-1.s06",
+"Created ecom-2-2.s15",
+"Created ecom-2-3.s07",
+"Created ecom-2-4.s08",
+"Created ecom-2-5.s09",
+"Created ecom-2-6.s01",
+"* Writing tmp6.oby - result of SPI stage",
+"override.pm: ------------------------------------------------------------------",
+"Handling overrides...Replace ROM_IMAGE[2] `data=\epoc32\data\Z\Resource\bootdata\languages.txt resource\Bootdata\languages.txt' with `data=I:/output/release_flash_images/product/rnd/langpack/langpack_01/rofs2/NAME_VERSION04_rnd_rofs2_languages.txt resource\Bootdata\languages.txt'",
+"Replace ROM_IMAGE[2] `data=\epoc32\data\Z\Resource\versions\lang.txt resource\versions\lang.txt' with `data=I:/output/release_flash_images/product/rnd/langpack/langpack_01/rofs2/NAME_VERSION04_rnd_rofs2_lang.txt resource\versions\lang.txt'",
+"Replace ROM_IMAGE[2] `data=\epoc32\data\Z\Resource\versions\langsw.txt resource\versions\langsw.txt' with `data=I:/output/release_flash_images/product/rnd/langpack/langpack_01/rofs2/NAME_VERSION04_rnd_rofs2_langsw.txt resource\versions\langsw.txt'",
+"override.pm: Duration: 1 seconds ----------------------------------------------",
+"obyparse.pm: ------------------------------------------------------------------",
+"Finding include hierarchy from tmp1.oby",
+"Found 730 different include files",
+"Finding SPI input files from tmp5.oby",
+"Found 103 SPI input files",
+"Reading UDEB files from /epoc32/rombuild/mytraces.txt",
+"Found 0 entries",
+"Finding ROM-patched components",
+"Found 0 ROM-patched components",
+"obyparse.pm: Duration: 2 seconds ----------------------------------------------",
+"* Writing tmp7.oby - result of problem-suppression phase",
+"* Writing tmp8.oby - result of bitmap conversion phase",
+"* Removing previous image and logs...",
+"* Writing tmp9.oby - result of cleaning phase",
+"* Writing NAME_VERSION04_rnd.oby - final OBY file",
+"* Writing NAME_VERSION04_rnd.rofs2.oby - final OBY file",
+"* Writing NAME_VERSION04_rnd.dir - ROM directory listing",
+"* Executing rofsbuild -slog -loglevel1 NAME_VERSION04_rnd.rofs2.oby",
+"The number of processors (4) is used as the number of concurrent jobs.",
+"",
+"ROFSBUILD - Rofs/Datadrive image builder V2.6.3",
+"Copyright (c) 1996-2009 Nokia Corporation.",
+"",
+"WARNING: Unknown keyword 'OM_IMAGE[0]'. Line 31 ignored",
+"WARNING: Unknown keyword '-----------------------------------------------------------'. Line 2464 ignored",
+"WARNING: Unknown keyword 'OM_IMAGE[0]'. Line 31 ignored",
+"WARNING: Unknown keyword '-----------------------------------------------------------'. Line 2464 ignored",
+"* rofsbuild failed",
+"",
+"*** Error: (S:ROFS2,C:1,B:1,K:0,V:1): Command `buildrom -loglevel1 -v -nosymbols -DFEATUREVARIANT=product -fm=/epoc32/include/s60regionalfeatures.xml -es60ibymacros -elocalise -oNAME_VERSION04_rnd.img I:/output/release_flash_images/product/rnd/langpack/langpack_01/rofs2/NAME_VERSION04_rnd_rofs2_master.oby' failed (1) in `/output/release_flash_images/product/rnd/langpack/langpack_01/rofs2'.",
+"===============================================================================",
+"Target: langpack_01 Duration: 01:40 Status: FAILED",
+"ConE output dir = `/output/release_flash_images/product/rnd/langpack/langpack_01/rofs2/temp/cone'",
+"ConE log file = `/output/release_flash_images/product/rnd/langpack/langpack_01/rofs2/NAME_VERSION04_rnd_cone_langpack_01.log'",
+"ROFS2 dir = `/output/release_flash_images/product/rnd/langpack/langpack_01/rofs2'",
+"ROFS2 symbols = `/output/release_flash_images/product/rnd/langpack/langpack_01/rofs2/NAME_VERSION04_rnd.rofs2.symbol'",
+"ROFS2 flash = `/output/release_flash_images/product/rnd/langpack/langpack_01/NAME_VERSION04_rnd.rofs2.fpsx'",
+"-------------------------------------------------------------------------------",
+"Total duration: 01:42 Status: FAILED",
+"===============================================================================",
+]
+
+if sys.argv.count("langpack_01"):
+ print_log(rof2_log)
+ sys.stderr.write("*** Error: (S:ROFS2,C:1,B:1,K:0,V:1): Command `buildrom -loglevel1 -v -nosymbols -DFEATUREVARIANT=product -fm=/epoc32/include/s60regionalfeatures.xml -es60ibymacros -elocalise -oNAME_VERSION04_rnd.img /output/release_flash_images/product/rnd/langpack/langpack_01/rofs2/NAME_VERSION04_rnd_rofs2_master.oby' failed (1) in `/output/release_flash_images/product/rnd/langpack/langpack_01/rofs2'.\n")
+ print ""
+ sys.exit(1)
+
+
+print ""
+sys.exit(0)
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/parallelexecutor_data/linux.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/parallelexecutor_data/linux.txt Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,2 @@
+ls -l
+ls -l
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/parallelexecutor_data/windows.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/parallelexecutor_data/windows.txt Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,2 @@
+cmd /c dir
+cmd /c dir
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/src/com/nokia/helium/imaker/tests/TestHelpConfigStreamConsumer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/src/com/nokia/helium/imaker/tests/TestHelpConfigStreamConsumer.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker.tests;
+
+import java.io.File;
+
+import org.junit.*;
+
+import com.nokia.helium.imaker.HelpConfigStreamConsumer;
+
+import static org.junit.Assert.*;
+
+/**
+ * Test the HelpTargetStreamConsumer.
+ *
+ */
+public class TestHelpConfigStreamConsumer {
+
+ /**
+ * Checking if the consumer is parsing correctly the output.
+ */
+ @Test
+ public void introspectConfiguration() {
+ HelpConfigStreamConsumer consumer = new HelpConfigStreamConsumer();
+ consumer.consumeLine("iMaker 09.24.01, 10-Jun-2009.");
+ consumer.consumeLine("Finding available configuration file(s):");
+ consumer.consumeLine("/epoc32/rom/config/platform/product/image_conf_product.mk");
+ consumer.consumeLine("/epoc32/rom/config/platform/product/image_conf_product_ui.mk");
+ consumer.consumeLine("");
+
+ // Verifying string output
+ String[] expected = new String[2];
+ expected[0] = "/epoc32/rom/config/platform/product/image_conf_product.mk";
+ expected[1] = "/epoc32/rom/config/platform/product/image_conf_product_ui.mk";
+ assertArrayEquals(expected, consumer.getConfigurations().toArray(new String[2]));
+
+ // Verifying the file output
+ File[] expectedFile = new File[2];
+ expectedFile[0] = new File(new File("."), "/epoc32/rom/config/platform/product/image_conf_product.mk");
+ expectedFile[1] = new File(new File("."), "/epoc32/rom/config/platform/product/image_conf_product_ui.mk");
+ assertArrayEquals(expectedFile, consumer.getConfigurations(new File(".")).toArray(new File[2]));
+ }
+}
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/src/com/nokia/helium/imaker/tests/TestIMaker.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/src/com/nokia/helium/imaker/tests/TestIMaker.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker.tests;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.List;
+
+import org.junit.Test;
+
+import com.nokia.helium.imaker.IMaker;
+import com.nokia.helium.imaker.IMakerException;
+
+/**
+ * Testing IMaker class.
+ */
+public class TestIMaker {
+
+ private File epocroot = new File(System.getProperty("testdir"), "tests/epocroot");
+
+ /**
+ * Test the getVersion is retrieving the output from imaker correctly.
+ * @throws IMakerException
+ */
+ @Test
+ public void testGetVersion() throws IMakerException {
+ String expectedVersion = "iMaker 09.24.01, 10-Jun-2009.";
+ IMaker imaker = new IMaker(epocroot);
+ assertEquals(expectedVersion, imaker.getVersion());
+ }
+
+ /**
+ * Test the introspection of an existing variable.
+ * @throws IMakerException
+ */
+ @Test
+ public void testGetVariable() throws IMakerException {
+ IMaker imaker = new IMaker(epocroot);
+ assertEquals("VALUE", imaker.getVariable("VARIABLE"));
+ }
+
+ /**
+ * Test the introspection of an existing variable.
+ * @throws IMakerException
+ */
+ @Test
+ public void testGetVariableFromConfiguration() throws IMakerException {
+ IMaker imaker = new IMaker(epocroot);
+ assertEquals("PRODUCT_VALUE", imaker.getVariable("VARIABLE", new File("/epoc32/rom/config/platform/product/image_conf_product.mk")));
+ }
+
+ /**
+ * Test the introspection of a non-existing variable.
+ * @throws IMakerException
+ */
+ @Test
+ public void testGetNotExistingVariable() throws IMakerException {
+ IMaker imaker = new IMaker(epocroot);
+ assertEquals(null, imaker.getVariable("NOTEXISTINGVARIABLE"));
+ }
+
+ /**
+ * Test the introspection of existing configurations.
+ * @throws IMakerException
+ */
+ @Test
+ public void testGetConfigurations() throws IMakerException {
+ IMaker imaker = new IMaker(epocroot);
+ String[] expected = new String[2];
+ expected[0] = "/epoc32/rom/config/platform/product/image_conf_product.mk";
+ expected[1] = "/epoc32/rom/config/platform/product/image_conf_product_ui.mk";
+ assertArrayEquals(expected, imaker.getConfigurations().toArray(new String[2]));
+ }
+
+ /**
+ * Test the introspection of existing target for a configuration.
+ * @throws IMakerException
+ */
+ @Test
+ public void testGetTargets() throws IMakerException {
+ IMaker imaker = new IMaker(epocroot);
+ List targets = imaker.getTargets("/epoc32/rom/config/platform/product/image_conf_product.mk");
+
+ String[] expected = new String[5];
+ expected[0] = "all";
+ expected[1] = "core";
+ expected[2] = "core-dir";
+ expected[3] = "help-%-list";
+ expected[4] = "langpack_01";
+ assertArrayEquals(expected, targets.toArray(new String[5]));
+ }
+
+ /**
+ * Test the introspection of existing target for a configuration using file
+ * object.
+ * @throws IMakerException
+ */
+ @Test
+ public void testGetTargetsFromFile() throws IMakerException {
+ IMaker imaker = new IMaker(epocroot);
+ List targets = imaker.getTargets(new File("/epoc32/rom/config/platform/product/image_conf_product.mk"));
+
+ String[] expected = new String[5];
+ expected[0] = "all";
+ expected[1] = "core";
+ expected[2] = "core-dir";
+ expected[3] = "help-%-list";
+ expected[4] = "langpack_01";
+ assertArrayEquals(expected, targets.toArray(new String[5]));
+ }
+
+ /**
+ * Test the introspection of existing target for a configuration.
+ * @throws IMakerException
+ */
+ @Test
+ public void testGetTargetsWithInvalidProductConf() throws IMakerException {
+ IMaker imaker = new IMaker(epocroot);
+ try {
+ imaker.getTargets("/epoc32/rom/config/platform/product/image_conf_invalid.mk");
+ fail("We should catch a failure from iMaker.");
+ } catch(IMakerException e) {
+ // Exception should be raised
+ }
+ }
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/src/com/nokia/helium/imaker/tests/TestParallelExecutor.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/src/com/nokia/helium/imaker/tests/TestParallelExecutor.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker.tests;
+
+import java.io.File;
+import org.junit.Test;
+import com.nokia.helium.imaker.utils.ParallelExecutor;
+
+/**
+ * Basic testing of the ParallelExecutor
+ *
+ */
+public class TestParallelExecutor {
+ private File testdir = new File(System.getProperty("testdir"));
+
+ /**
+ * Nothing should happen.
+ */
+ @Test
+ public void executionWithNoArgs() {
+ String args[] = new String[0];
+ ParallelExecutor.main(args);
+ }
+
+ /**
+ * Will list current directory content twice.
+ */
+ @Test
+ public void executionWithTextFile() {
+ String args[] = new String[1];
+ if (System.getProperty("os.name").toLowerCase().startsWith("win")) {
+ args[0] = new File(testdir, "tests/parallelexecutor_data/windows.txt").getAbsolutePath();
+ } else {
+ args[0] = new File(testdir, "tests/parallelexecutor_data/linux.txt").getAbsolutePath();
+ }
+ ParallelExecutor.main(args);
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/imaker/tests/src/com/nokia/helium/imaker/tests/TestPrintVarStreamConsumer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/imaker/tests/src/com/nokia/helium/imaker/tests/TestPrintVarStreamConsumer.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.imaker.tests;
+
+import org.junit.*;
+
+import com.nokia.helium.imaker.PrintVarSteamConsumer;
+
+import static org.junit.Assert.*;
+
+public class TestPrintVarStreamConsumer {
+
+ @Test
+ public void readSimpleVar() {
+ PrintVarSteamConsumer consumer = new PrintVarSteamConsumer("WORKDIR");
+ consumer.consumeLine("iMaker 09.24.01, 10-Jun-2009.");
+ consumer.consumeLine("WORKDIR = `/.'");
+ consumer.consumeLine("");
+ assertEquals(consumer.getValue(), "/.");
+ }
+
+ @Test
+ public void readMultilineVar() {
+ PrintVarSteamConsumer consumer = new PrintVarSteamConsumer("LONGVAR");
+ consumer.consumeLine("iMaker 09.24.01, 10-Jun-2009.");
+ consumer.consumeLine("LONGVAR = `some text");
+ consumer.consumeLine("second line");
+ consumer.consumeLine("end of text'");
+ consumer.consumeLine("");
+ assertEquals(consumer.getValue(), "some text\nsecond line\nend of text");
+ }
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/lib/dom4j-1.6.1.jar
Binary file buildframework/helium/external/helium-antlib/lib/dom4j-1.6.1.jar has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/lib/plexus-utils-1.5.6.jar
Binary file buildframework/helium/external/helium-antlib/lib/plexus-utils-1.5.6.jar has changed
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/bld.bat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/bld.bat Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,60 @@
+@echo off
+
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the License "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+setlocal
+if not defined JAVA_6_HOME (
+set TESTED_JAVA=C:\Apps\j2sdk_1.6.0_02
+) ELSE set TESTED_JAVA=%JAVA_6_HOME%
+if exist %TESTED_JAVA% (set JAVA_HOME=%TESTED_JAVA%)
+
+REM Configure Ant
+if not defined TESTED_ANT_HOME (
+set TESTED_ANT_HOME=C:\Apps\ant_1.7
+)
+if exist %TESTED_ANT_HOME% (set ANT_HOME=%TESTED_ANT_HOME%)
+
+REM Configure the expected Ant Version details below
+SET expMajorVer=1
+SET expMinorVer=7
+
+rem *** Verify Ant Version ***
+rem -- Run the 'ant -version' command and capture the output to a variable
+for /f "tokens=*" %%a in ('ant -version') do (set antversion=%%a)
+echo *** Installed Version : %antversion%
+
+rem -- Parse the version string obtained above and get the version number
+for /f "tokens=4 delims= " %%a in ("%antversion%") do set val=%%a
+rem -- Parse the version number delimiting the '.' and set the major and
+rem minor versions
+for /f "tokens=1-2 delims=." %%a in ("%val%") do (
+set /A majorVersion=%%a
+set /A minorVersion=%%b
+)
+rem -- Check whether major version is greater than or equal to the expected.
+if %majorVersion% geq %expMajorVer% (
+rem -- if major version is valid, check minor version. If minor version is less
+rem than expected display message and abort the execution.
+if %minorVersion% lss %expMinorVer% (echo *** Incorrect version of Ant found. Please check you have atleast Ant 1.7.0 & goto :errorstop )
+)
+
+ant %*
+endlocal
+
+:errorstop
+@echo *** Build aborted with error
+exit /b 1
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/build.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/build.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,38 @@
+
+
+
+ Helium Antlib logging.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/antlib.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/antlib.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/helium.antlib.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/helium.antlib.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,28 @@
+
+
+
+
+ Ant task definition declarations.
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/AntLogRecorderEntry.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/AntLogRecorderEntry.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,408 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.logger.ant.listener;
+
+import java.io.PrintStream;
+
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildLogger;
+import org.apache.tools.ant.DefaultLogger;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.SubBuildListener;
+import org.apache.tools.ant.util.StringUtils;
+import org.apache.tools.ant.BuildException;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Vector;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * This is a class that represents a recorder. This is the listener to the
+ * build process.
+ *
+ * @since Ant 1.4
+ */
+public class AntLogRecorderEntry implements BuildLogger, SubBuildListener {
+
+ //////////////////////////////////////////////////////////////////////
+ // ATTRIBUTES
+
+ /** The name of the file associated with this recorder entry. */
+ private String filename;
+ /** The state of the recorder (recorder on or off). */
+ private boolean record = true;
+ /** The current verbosity level to record at. */
+ private int loglevel = Project.MSG_INFO;
+ /** The output PrintStream to record to. */
+ private PrintStream out;
+ /** The start time of the last know target. */
+ private long targetStartTime;
+ /** Strip task banners if true. */
+ private boolean emacsMode;
+ /** project instance the recorder is associated with */
+ private Project project;
+
+ private Pattern pattern;
+
+ private Vector logRegExps = new Vector();
+
+
+ //////////////////////////////////////////////////////////////////////
+ // CONSTRUCTORS / INITIALIZERS
+
+ /**
+ * @param name The name of this recorder (used as the filename).
+ */
+ public AntLogRecorderEntry(String name) {
+ targetStartTime = System.currentTimeMillis();
+ filename = name;
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // ACCESSOR METHODS
+
+ /**
+ * @return the name of the file the output is sent to.
+ */
+ public String getFilename() {
+ return filename;
+ }
+
+ /**
+ * Turns off or on this recorder.
+ *
+ * @param state true for on, false for off, null for no change.
+ */
+ public void setRecordState(Boolean state) {
+ if (state != null) {
+ flush();
+ record = state.booleanValue();
+ }
+ }
+
+ /**
+ * To set the regexp to filter the logging.
+ * @param regexp
+ */
+ public void addRegexp(String regexp) {
+ logRegExps.add(regexp);
+ }
+
+ /**
+ * To clear all regexp set.
+ */
+ public void resetRegExp() {
+ logRegExps.clear();
+ }
+
+ /**
+ * @see org.apache.tools.ant.BuildListener#buildStarted(BuildEvent)
+ */
+ /** {@inheritDoc}. */
+ public void buildStarted(BuildEvent event) {
+ log("> BUILD STARTED", Project.MSG_DEBUG);
+ }
+
+ /**
+ * @see org.apache.tools.ant.BuildListener#buildFinished(BuildEvent)
+ */
+ /** {@inheritDoc}. */
+ public void buildFinished(BuildEvent event) {
+ log("< BUILD FINISHED", Project.MSG_DEBUG);
+
+ if (record && out != null) {
+ Throwable error = event.getException();
+
+ if (error == null) {
+ out.println(StringUtils.LINE_SEP + "BUILD SUCCESSFUL");
+ } else {
+ out.println(StringUtils.LINE_SEP + "BUILD FAILED"
+ + StringUtils.LINE_SEP);
+ error.printStackTrace(out);
+ }
+ }
+ cleanup();
+ }
+
+ /**
+ * Cleans up any resources held by this recorder entry at the end
+ * of a subbuild if it has been created for the subbuild's project
+ * instance.
+ *
+ * @param event the buildFinished event
+ *
+ * @since Ant 1.6.2
+ */
+ public void subBuildFinished(BuildEvent event) {
+ if (event.getProject() == project) {
+ cleanup();
+ }
+ }
+
+ /**
+ * Empty implementation to satisfy the BuildListener interface.
+ *
+ * @param event the buildStarted event
+ *
+ * @since Ant 1.6.2
+ */
+ public void subBuildStarted(BuildEvent event) {
+ }
+
+ /**
+ * @see org.apache.tools.ant.BuildListener#targetStarted(BuildEvent)
+ */
+ /** {@inheritDoc}. */
+ public void targetStarted(BuildEvent event) {
+ log(">> TARGET STARTED -- " + event.getTarget(), Project.MSG_DEBUG);
+ log(StringUtils.LINE_SEP + event.getTarget().getName() + ":",
+ Project.MSG_INFO);
+ targetStartTime = System.currentTimeMillis();
+ }
+
+ /**
+ * @see org.apache.tools.ant.BuildListener#targetFinished(BuildEvent)
+ */
+ /** {@inheritDoc}. */
+ public void targetFinished(BuildEvent event) {
+ log("<< TARGET FINISHED -- " + event.getTarget(), Project.MSG_DEBUG);
+
+ String time = formatTime(System.currentTimeMillis() - targetStartTime);
+
+ log(event.getTarget() + ": duration " + time, Project.MSG_VERBOSE);
+ flush();
+ }
+
+ /**
+ * @see org.apache.tools.ant.BuildListener#taskStarted(BuildEvent)
+ */
+ /** {@inheritDoc}. */
+ public void taskStarted(BuildEvent event) {
+ log(">>> TASK STARTED -- " + event.getTask(), Project.MSG_DEBUG);
+ }
+
+ /**
+ * @see org.apache.tools.ant.BuildListener#taskFinished(BuildEvent)
+ */
+ /** {@inheritDoc}. */
+ public void taskFinished(BuildEvent event) {
+ log("<<< TASK FINISHED -- " + event.getTask(), Project.MSG_DEBUG);
+ flush();
+ }
+
+ /**
+ * @see org.apache.tools.ant.BuildListener#messageLogged(BuildEvent)
+ */
+ /** {@inheritDoc}. */
+ public void messageLogged(BuildEvent event) {
+ log("--- MESSAGE LOGGED", Project.MSG_DEBUG);
+
+ StringBuffer buf = new StringBuffer();
+
+ if (event.getTask() != null) {
+ String name = event.getTask().getTaskName();
+
+ if (!emacsMode) {
+ String label = "[" + name + "] ";
+ int size = DefaultLogger.LEFT_COLUMN_SIZE - label.length();
+
+ for (int i = 0; i < size; i++) {
+ buf.append(" ");
+ }
+ buf.append(label);
+ }
+ }
+ String messgeToUpdate = filterMessage(event.getMessage());
+ buf.append(messgeToUpdate);
+ log(buf.toString(), event.getPriority());
+ }
+
+
+ /**
+ * To replace regExp matching with ****.
+ * @param message
+ * @return
+ */
+ private String filterMessage(String message) {
+ for (String regExp : logRegExps) {
+ pattern = Pattern.compile(regExp);
+ if (pattern != null) {
+ Matcher match = pattern.matcher(message);
+ message = match.replaceAll("********");
+ }
+ }
+ return message;
+ }
+
+
+ /**
+ * The thing that actually sends the information to the output.
+ *
+ * @param mesg The message to log.
+ * @param level The verbosity level of the message.
+ */
+ private void log(String mesg, int level) {
+ if (record && (level <= loglevel) && out != null) {
+ out.println(mesg);
+ }
+ }
+
+ private void flush() {
+ if (record && out != null) {
+ out.flush();
+ }
+ }
+
+ /**
+ * @see BuildLogger#setMessageOutputLevel(int)
+ */
+ /** {@inheritDoc}. */
+ public void setMessageOutputLevel(int level) {
+ if (level >= Project.MSG_ERR && level <= Project.MSG_DEBUG) {
+ loglevel = level;
+ }
+ }
+
+ /**
+ * @see BuildLogger#setOutputPrintStream(PrintStream)
+ */
+ /** {@inheritDoc}. */
+ public void setOutputPrintStream(PrintStream output) {
+ closeFile();
+ out = output;
+ }
+
+
+ /**
+ * @see BuildLogger#setEmacsMode(boolean)
+ */
+ /** {@inheritDoc}. */
+ public void setEmacsMode(boolean emacsMode) {
+ this.emacsMode = emacsMode;
+ }
+
+
+ /**
+ * @see BuildLogger#setErrorPrintStream(PrintStream)
+ */
+ /** {@inheritDoc}. */
+ public void setErrorPrintStream(PrintStream err) {
+ setOutputPrintStream(err);
+ }
+
+
+ private static String formatTime(long millis) {
+ // CheckStyle:MagicNumber OFF
+ long seconds = millis / 1000;
+ long minutes = seconds / 60;
+
+
+ if (minutes > 0) {
+ return Long.toString(minutes) + " minute"
+ + (minutes == 1 ? " " : "s ")
+ + Long.toString(seconds % 60) + " second"
+ + (seconds % 60 == 1 ? "" : "s");
+ } else {
+ return Long.toString(seconds) + " second"
+ + (seconds % 60 == 1 ? "" : "s");
+ }
+ // CheckStyle:MagicNumber ON
+ }
+
+ /**
+ * Set the project associated with this recorder entry.
+ *
+ * @param project the project instance
+ *
+ * @since 1.6.2
+ */
+ public void setProject(Project project) {
+ this.project = project;
+ if (project != null) {
+ project.addBuildListener(this);
+ }
+ }
+
+ /**
+ * @since 1.6.2
+ */
+ public void cleanup() {
+ closeFile();
+ if (project != null) {
+ project.removeBuildListener(this);
+ }
+ project = null;
+ }
+
+ /**
+ * Closes the file associated with this recorder.
+ * Used by Recorder.
+ * @since 1.6.3
+ */
+ public void closeFile() {
+ if (out != null) {
+ out.close();
+ out = null;
+ }
+ }
+
+ /**
+ * Initially opens the file associated with this recorder.
+ * Used by Recorder.
+ * @param append Indicates if output must be appended to the logfile or that
+ * the logfile should be overwritten.
+ * @throws BuildException
+ * @since 1.6.3
+ */
+ public void openFile(boolean append) {
+ openFileImpl(append);
+ }
+
+ /**
+ * Re-opens the file associated with this recorder.
+ * Used by Recorder.
+ * @throws BuildException
+ * @since 1.6.3
+ */
+ public void reopenFile() {
+ openFileImpl(true);
+ }
+
+ private void openFileImpl(boolean append) {
+ if (out == null) {
+ try {
+ out = new PrintStream(new FileOutputStream(filename, append));
+ } catch (IOException ioe) {
+ throw new BuildException("Problems opening file using a "
+ + "recorder entry", ioe);
+ }
+ }
+ }
+
+ /**
+ * To add user message into log file.
+ * @param message
+ */
+ public void addLogMessage(String message) {
+ out.println(StringUtils.LINE_SEP + message);
+
+ }
+
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/AntLoggingHandler.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/AntLoggingHandler.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,581 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.logger.ant.listener;
+
+import java.io.File;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Vector;
+import java.util.Map.Entry;
+
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.LogLevel;
+import org.apache.tools.ant.BuildException;
+import org.apache.log4j.Logger;
+
+import com.nokia.helium.logger.ant.types.*;
+
+
+ /**
+ * Ant logging class for each Stage.
+ *
+ *
+ */
+public class AntLoggingHandler implements Handler {
+
+ private static Hashtable recorderEntries = new Hashtable();
+ private Boolean append ;
+ private int loglevel = -1;
+ private VerbosityLevelChoices antLogLevel;
+ private Map stagesMapping;
+ private Map stageRecordMap;
+ private Map defaultRecordMap;
+ private Map depStartTargetMap;
+ private boolean isStagesIntialized;
+ private boolean isRecordingStarted;
+ private AntLogRecorderEntry recorderEntry;
+ private boolean isRecorderEntryRegistered;
+ private boolean isDefaultRecorderEntryRegistered;
+ private Logger log = Logger.getLogger(AntLoggingHandler.class);
+ private boolean isInitDepStartTarget;
+ private String currentStageName;
+
+
+ public AntLoggingHandler() {
+ antLogLevel = new VerbosityLevelChoices();
+ stagesMapping = new HashMap();
+ stageRecordMap = new HashMap();
+ defaultRecordMap = new HashMap();
+ depStartTargetMap = new HashMap();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void handleTargetFinished(BuildEvent event) {
+ String stageName = getStopStageName (event.getTarget().getName());
+ if (stageName != null && getIsRecordingStarted()) {
+ stopStageAntLog(stageName);
+ startDefaultAntLog();
+
+ }
+ log.debug("Finishing target [" + event.getTarget().getName() + "]");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void handleTargetStarted(BuildEvent event) {
+
+ if (!isDefaultRecorderEntryRegistered ) {
+ log.debug("Intializing deafult recorder information and registering the recorder");
+ initDefaultAntLogStage(event);
+ registerDefaultRecorderEntry();
+ }
+
+ if (!isStagesIntialized()) {
+ log.debug("Intializing stages information");
+ getStagesInformation(event);
+ }
+
+ if (!isInitDepStartTarget() && isStagesIntialized()) {
+ log.debug("Intializing dependent targets stage information.");
+ initDepStartTarget(event);
+ }
+
+ if (!isRecorderEntryRegistered && isStagesIntialized()) {
+ log.debug("Registering recorder entries.");
+ registerRecorderEntry(event);
+ }
+
+ log.debug("Starting target [" + event.getTarget().getName() + "]");
+ String stageName = getStartStageName (event.getTarget().getName());
+ if (stageName != null && !getIsRecordingStarted()) {
+ stopDefaultAntLog(stageName);
+ startStageAntLog(stageName);
+ }
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void handleBuildStarted(BuildEvent event) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void handleBuildFinished(BuildEvent event) {
+ String time = getDateTime();
+ StageLogging stageLogging = defaultRecordMap.get("default");
+ if (stageLogging != null) {
+ // this case might happen if the config has not been loaded because
+ // of an error happening before the start of the build.
+ File logFile = new File(stageLogging.getDefaultOutput());
+ if (logFile.exists()) {
+ recorderEntry = getRecorder(stageLogging.getDefaultOutput(), StatusAndLogListener.getProject());
+ recorderEntry.addLogMessage("Stopping main Ant logging at " + time + " into " + stageLogging.getDefaultOutput());
+ recorderEntry.setRecordState(false);
+ }
+ } else {
+ log.debug("Could not find default recorder configuration.");
+ }
+ this.cleanup();
+ }
+
+ /**
+ * Stage ant logging for respective stage.
+ * @param stageName
+ */
+ public void startStageAntLog(String stageName) {
+ String time = getDateTime();
+ log.debug("Starting stagerecorder for stage [" + stageName + "]");
+ StageLogging startStageLogging = stageRecordMap.get(stageName);
+ File logFile = new File(startStageLogging.getOutput());
+ if (logFile.exists()) {
+ recorderEntry = getRecorder(startStageLogging.getOutput(), StatusAndLogListener.getProject());
+ recorderEntry.setRecordState(true);
+ recorderEntry.addLogMessage("Starting logging for stage \"" + stageName + "\" into " + startStageLogging.getOutput() + " at " + time );
+ this.isRecordingStarted = true;
+ this.currentStageName = stageName;
+ }
+ }
+
+ /**
+ * Stop ant logging for respective stage.
+ * @param stageName
+ */
+
+ public void stopStageAntLog( String stageName) {
+ String time = getDateTime();
+ log.debug("Stopping stagerecorder for stage [" + stageName + "]");
+ StageLogging stopStageLogging = stageRecordMap.get(stageName);
+ StageLogging defaultStageLogging = defaultRecordMap.get("default");
+ recorderEntry.addLogMessage("Stopping logging for stage \"" + stageName + "\" into " + stopStageLogging.getOutput() + " at " + time);
+ recorderEntry.addLogMessage("Starting logging into " + defaultStageLogging.getDefaultOutput());
+ recorderEntry = getRecorder(stopStageLogging.getOutput(), StatusAndLogListener.getProject());
+ recorderEntry.setRecordState(false);
+ this.isRecordingStarted = false;
+ this.currentStageName = null;
+ }
+
+ /**
+ * Returns recorder entry for logging current build process.
+ * @param stageLogging
+ * @param proj
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ protected AntLogRecorderEntry getRecorder(String name, Project proj) {
+
+ Object o = recorderEntries.get(name);
+ AntLogRecorderEntry entry;
+ if (o == null) {
+ // create a recorder entry
+ entry = new AntLogRecorderEntry(name);
+ if (append == null) {
+ entry.openFile(false);
+ } else {
+ entry.openFile(append.booleanValue());
+ }
+ entry.setProject(proj);
+ recorderEntries.put(name, entry);
+ } else {
+ entry = (AntLogRecorderEntry) o;
+ }
+ return entry;
+ }
+
+ /**
+ * Whether or not the logger should append to a previous file.
+ * @param append if true, append to a previous file.
+ */
+ public void setAppend(boolean append) {
+ this.append = append ;
+ }
+
+
+ /**
+ * Sets the level to which this recorder entry should log to.
+ * @param level the level to set.
+ * @see VerbosityLevelChoices
+ */
+ public void setLoglevel(VerbosityLevelChoices level) {
+ loglevel = level.getLevel();
+ }
+
+ /**
+ * A list of possible values for the setLoglevel() method.
+ * Possible values include: error, warn, info, verbose, debug.
+ */
+ public static class VerbosityLevelChoices extends LogLevel {
+ }
+
+ /**
+ * To get the stage information.
+ * @param event
+ */
+ @SuppressWarnings("unchecked")
+ private void getStagesInformation(BuildEvent event) {
+ this.isStagesIntialized = true;
+ Hashtable references = event.getProject().getReferences();
+ Enumeration keyEnum = references.keys();
+ while (keyEnum.hasMoreElements()) {
+ String key = keyEnum.nextElement();
+ if (references.get(key) instanceof Stage) {
+ Stage tempStage = (Stage)references.get(key);
+ log.debug("Found stage [" + key + "] for recording");
+ if (validateStageTargets(event, tempStage.getStartTarget(), tempStage.getEndTarget() )) {
+ log.debug("Start and end targets are valid for stage [" + key + "]");
+ stagesMapping.put(key, (Stage)references.get(key));
+ getStageRecordInformation(event, key, tempStage.getStartTarget(), tempStage.getEndTarget());
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks, is stages are initialized.
+ * @return
+ */
+ private boolean isStagesIntialized() {
+ return this.isStagesIntialized;
+ }
+
+ /**
+ * To initialize stage record mapping.
+ * @param event
+ */
+ @SuppressWarnings("unchecked")
+ private void getStageRecordInformation(BuildEvent event, String stageKey, String startTarget, String endTarget) {
+ Hashtable references = event.getProject().getReferences();
+ Enumeration keyEnum = references.keys();
+ while (keyEnum.hasMoreElements()) {
+ String key = keyEnum.nextElement();
+ if (references.get(key) instanceof StageLogging) {
+ StageLogging tempStageLogging = (StageLogging)references.get(key);
+
+ if (tempStageLogging.getStageRefID() == null && tempStageLogging.getDefaultOutput() == null ) {
+ throw new BuildException("stagefefid attribute should be specified for stagerecord [" + key + "]");
+ }
+ if (tempStageLogging.getStageRefID() != null ) {
+ if (tempStageLogging.getStageRefID().equalsIgnoreCase(stageKey) && tempStageLogging.getDefaultOutput() == null) {
+ log.debug("stagerecord reference for stage [" + stageKey + "] is [" + tempStageLogging.getStageRefID() + "]");
+ if (tempStageLogging.getOutput() == null) {
+ throw new BuildException("output attribute should be specified for stagerecord [" + key + "]");
+ }
+ stageRecordMap.put(stageKey, tempStageLogging);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * First Validate is the default output has been set.
+ * @param event
+ */
+ @SuppressWarnings("unchecked")
+ private void initDefaultAntLogStage(BuildEvent event) {
+ Hashtable references = event.getProject().getReferences();
+ Enumeration keyEnum = references.keys();
+ while (keyEnum.hasMoreElements()) {
+ String key = keyEnum.nextElement();
+ if (references.get(key) instanceof StageLogging) {
+ StageLogging tempStageLogging = (StageLogging)references.get(key);
+
+ if (tempStageLogging.getStageRefID() == null && tempStageLogging.getDefaultOutput() != null ) {
+ defaultRecordMap.put("default", tempStageLogging);
+ }
+ }
+ }
+ }
+
+ /**
+ * To check is the stage start and end targets present in the sequence.
+ * @param event
+ * @param startTarget
+ * @param endTarget
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ private boolean validateStageTargets(BuildEvent event, String startTarget, String endTarget) {
+
+ Hashtable antTargets = event.getProject().getTargets();
+ return antTargets.containsKey(startTarget) && antTargets.containsKey(endTarget);
+ }
+
+ /**
+ * Return mapped stage name to start record.
+ * @param targetName
+ * @return
+ */
+
+ private String getStartStageName(String targetName) {
+
+ for (Map.Entry entry : stagesMapping.entrySet() ) {
+ Stage stage = entry.getValue();
+ if ( stage.getStartTarget().equalsIgnoreCase(targetName)) {
+ log.debug("stageName name for target [" + targetName + "] is [" + entry.getKey() + "]");
+ return entry.getKey();
+ }
+ for (Map.Entry depEntry : depStartTargetMap.entrySet() ) {
+ Stage depStage = depEntry.getKey();
+ if ((depStage.getStartTarget().equalsIgnoreCase(stage.getStartTarget())) && (depEntry.getValue().getName().equalsIgnoreCase(targetName))) {
+ log.debug("stageName name for depending target [" + depStage.getStartTarget() + "] is [" + entry.getKey() + "]");
+ return entry.getKey();
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return mapped stage name to stop record.
+ * @param targetName
+ * @return
+ */
+ private String getStopStageName(String targetName) {
+
+ for (Map.Entry entry : stagesMapping.entrySet() ) {
+ Stage stage = entry.getValue();
+ if ( stage.getEndTarget().equalsIgnoreCase(targetName)) {
+ log.debug("stageName name for end target [" + targetName + "] is [" + entry.getKey() + "]");
+ return entry.getKey();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * To check is recording started.
+ * @return
+ */
+ private boolean getIsRecordingStarted() {
+ return this.isRecordingStarted;
+ }
+
+ /**
+ * To register recorder entries.
+ * @param event
+ */
+ @SuppressWarnings("unchecked")
+ private void registerRecorderEntry(BuildEvent event) {
+ /* Later register stages recorder entries */
+ for (Map.Entry entry : stageRecordMap.entrySet()) {
+ StageLogging stageLogging = entry.getValue();
+ File logFile = new File(stageLogging.getOutput());
+ if (!logFile.getParentFile().exists()) {
+ logFile.getParentFile().mkdirs();
+ }
+ if (logFile.getParentFile().exists()) {
+ log.debug("Registering recorderentry for log file [" + stageLogging.getOutput() + "]");
+ this.setAppend(stageLogging.getAppend().booleanValue());
+ recorderEntry = getRecorder(stageLogging.getOutput(), StatusAndLogListener.getProject());
+ antLogLevel.setValue(stageLogging.getLogLevel());
+ this.setLoglevel(antLogLevel);
+ recorderEntry.setMessageOutputLevel(loglevel);
+ recorderEntry.setEmacsMode(false);
+ recorderEntry.setRecordState(false);
+ isRecorderEntryRegistered = true;
+ }
+ }
+ }
+
+ /**
+ * To register default recorder entry.
+ */
+ @SuppressWarnings("unchecked")
+ private void registerDefaultRecorderEntry() {
+
+ /* First register default recorder */
+ if (defaultRecordMap.size() == 0) {
+ throw new BuildException("There is no stagerecord type with defaultoutput attribute set. please set...");
+ }
+ StageLogging stageLogging = defaultRecordMap.get("default");
+ File logFile = new File(stageLogging.getDefaultOutput());
+ if (!logFile.getParentFile().exists()) {
+ logFile.getParentFile().mkdirs();
+ }
+ if (logFile.getParentFile().exists()) {
+ log.debug("Registering recorderentry for log file [" + stageLogging.getDefaultOutput() + "]");
+ this.setAppend(stageLogging.getAppend().booleanValue());
+ recorderEntry = getRecorder(stageLogging.getDefaultOutput(), StatusAndLogListener.getProject());
+ antLogLevel.setValue(stageLogging.getLogLevel());
+ this.setLoglevel(antLogLevel);
+ recorderEntry.setMessageOutputLevel(loglevel);
+ recorderEntry.setEmacsMode(false);
+ recorderEntry.setRecordState(true);
+ String time = getDateTime();
+ recorderEntry.addLogMessage("Starting main Ant logging at " + time + " into " + stageLogging.getDefaultOutput());
+ isDefaultRecorderEntryRegistered = true;
+ }
+
+ }
+
+
+
+ /**
+ * To clean recorder entries.
+ */
+ private void cleanup() {
+ log.debug("Cleaning up recorder entries of stagerecord");
+ StatusAndLogListener.getProject().removeBuildListener(recorderEntry);
+ recorderEntries.clear();
+
+ }
+
+ /**
+ * To check is the dependent start target map is initialized.
+ * @return
+ */
+ private boolean isInitDepStartTarget() {
+ return isInitDepStartTarget;
+ }
+
+ /**
+ * Initialize the dependent start targets mapping.
+ * @param event
+ */
+ @SuppressWarnings("unchecked")
+ private void initDepStartTarget(BuildEvent event) {
+ Vector arrayList = null;
+ isInitDepStartTarget = true;
+ for (Map.Entry entry : stagesMapping.entrySet() ) {
+ Stage stage = entry.getValue();
+ arrayList = event.getProject().topoSort(stage.getStartTarget(), event.getProject().getTargets(), false);
+ if (arrayList != null && arrayList.size() > 1) {
+ depStartTargetMap.put(stage, arrayList.firstElement());
+ }
+ }
+ }
+
+ /**
+ * To get current date and time.
+ * @return
+ */
+ private String getDateTime() {
+ DateFormat dateFormat = new SimpleDateFormat("EE yyyy/MM/dd HH:mm:ss:SS aaa");
+ Date date = new Date();
+ return dateFormat.format(date);
+ }
+
+ /**
+ * To stop default ant logging.
+ */
+ private void stopDefaultAntLog(String stageName) {
+ String time = getDateTime();
+ StageLogging defaultStageLogging = defaultRecordMap.get("default");
+ StageLogging stageLogging = stageRecordMap.get(stageName);
+ File logFile = new File(defaultStageLogging.getDefaultOutput());
+ if (logFile.exists()) {
+ recorderEntry = getRecorder(defaultStageLogging.getDefaultOutput(), StatusAndLogListener.getProject());
+ recorderEntry.addLogMessage("Stopping logging into " + defaultStageLogging.getDefaultOutput() + " and starting logging for stage \"" + stageName + "\" at " + time);
+ recorderEntry.addLogMessage("Starting logging into " + stageLogging.getOutput());
+ recorderEntry.setRecordState(false);
+ }
+ }
+
+ /**
+ * To start deafult ant logging.
+ */
+
+ private void startDefaultAntLog() {
+ String time = getDateTime();
+ StageLogging stageLogging = defaultRecordMap.get("default");
+ recorderEntry = getRecorder(stageLogging.getDefaultOutput(), StatusAndLogListener.getProject());
+ recorderEntry.addLogMessage("Resuming logging into " + stageLogging.getDefaultOutput() + " at " + time );
+ recorderEntry.setRecordState(true);
+ }
+
+ /**
+ * To get the current stage running.
+ * @return
+ */
+ public String getCurrentStageName() {
+
+ return this.currentStageName;
+ }
+
+ /**
+ * To do the logging actions depending on hlm:record actions.
+ * @param stageName
+ * @param action
+ * @param message
+ */
+ public void doLoggingAction(String stageName, boolean action, String message, Task task) {
+ String time = getDateTime();
+ StageLogging stageLogging = null;
+ String fileName;
+ if (stageName.equalsIgnoreCase("default")) {
+ stageLogging = defaultRecordMap.get(stageName);
+ fileName = stageLogging.getDefaultOutput();
+ } else {
+ stageLogging = stageRecordMap.get(stageName);
+ fileName = stageLogging.getOutput();
+ }
+ File logFile = new File(fileName);
+ if (logFile.exists()) {
+ recorderEntry = getRecorder(fileName, StatusAndLogListener.getProject());
+ recorderEntry.addLogMessage(message + " logging into " + fileName + " from " + task.getTaskName() + " task at " + time);
+ recorderEntry.setRecordState(action);
+ }
+ }
+
+ /**
+ * Called by LogReplace task to find and replace any property values which are not updated.
+ * @param regExp
+ */
+ @SuppressWarnings("unchecked")
+ public void addRegExp (String regExp) {
+
+ if (!regExp.equals("")) {
+
+ for (Map.Entry entry : defaultRecordMap.entrySet() ) {
+ StageLogging stageLogging = entry.getValue();
+ File logFile = new File(stageLogging.getDefaultOutput());
+ if (logFile.exists()) {
+ AntLogRecorderEntry recorderEntry = getRecorder(stageLogging.getDefaultOutput(), StatusAndLogListener.getProject());
+ recorderEntry.addRegexp(regExp);
+ }
+ }
+
+ for (Map.Entry entry : stageRecordMap.entrySet() ) {
+ StageLogging stageLogging = entry.getValue();
+ File logFile = new File(stageLogging.getOutput());
+ if (logFile.exists()) {
+ AntLogRecorderEntry recorderEntry = getRecorder(stageLogging.getOutput(), StatusAndLogListener.getProject());
+ recorderEntry.addRegexp(regExp);
+ }
+ }
+
+ }
+ }
+
+}
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/BuildEventHandler.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/BuildEventHandler.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.logger.ant.listener;
+
+import org.apache.tools.ant.BuildEvent;
+
+/**
+ * Handler is an interface which is used to handle the build events
+ * which are of importance for ant logging and build stage summary display.
+ *
+ *
+ */
+public interface BuildEventHandler {
+
+ /**
+ * Method to handle build start events.
+ *
+ * @param event is the build event to be handled.
+ */
+ void handleBuildStarted( BuildEvent event );
+
+ /**
+ * Method to handle build finish events.
+ *
+ * @param event is the build event to be handled.
+ */
+ void handleBuildFinished( BuildEvent event );
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/BuildStatusReport.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/BuildStatusReport.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+package com.nokia.helium.logger.ant.listener;
+
+import static com.nokia.helium.logger.ant.listener.StageSummaryHandler.FAILED;
+import static com.nokia.helium.logger.ant.listener.StageSummaryHandler.PASSED;
+
+/**
+ * BuildStatusReport is a simple java bean used to hold information pertaining
+ * to various build stages.
+ *
+ */
+public class BuildStatusReport {
+
+ private String phaseName;
+ private String startTime;
+ private String duration;
+ private String reason;
+ private String status;
+
+ /**
+ * Create an instance of {@link BuildStatusReport}.
+ *
+ * @param phaseName is the name of the Phase
+ * @param startTime is the start time of the Phase
+ * @param duration is the duration of the Phase
+ * @param reason is the cause of build failure, if any
+ */
+ public BuildStatusReport(String phaseName, String startTime,
+ String duration, String reason) {
+ this.phaseName = phaseName;
+ this.startTime = startTime;
+ this.duration = duration;
+ this.reason = (reason != null && !reason.isEmpty()) ? reason : "N/A";
+ this.status = (reason != null && !reason.isEmpty()) ? FAILED : PASSED;
+ }
+
+ /**
+ * Get the Build Phase name.
+ *
+ * @return the Build Phase name.
+ */
+ public String getPhaseName() {
+ return phaseName;
+ }
+
+ /**
+ * Set the Build Phase name.
+ *
+ * @param phaseName is the phase name to set.
+ */
+ public void setPhaseName(String phaseName) {
+ this.phaseName = phaseName;
+ }
+
+ /**
+ * Get the start time of this Phase.
+ *
+ * @return the start time of this Phase.
+ */
+ public String getStartTime() {
+ return startTime;
+ }
+
+ /**
+ * Set the start time of this Phase.
+ *
+ * @param startTime is the start time to set.
+ */
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+
+ /**
+ * Get the duration of this Phase.
+ *
+ * @return the duration of this Phase.
+ */
+ public String getDuration() {
+ return duration;
+ }
+
+ /**
+ * Set the duration of this Phase.
+ *
+ * @param duration the duration to set.
+ */
+ public void setDuration(String duration) {
+ this.duration = duration;
+ }
+
+ /**
+ * Get the reason for build failure.
+ *
+ * @return the reason for build failure.
+ */
+ public String getReason() {
+ return reason;
+ }
+
+ /**
+ * Set the reason for build failure.
+ *
+ * @param reason is the reason for build failure.
+ */
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+ /**
+ * Get the build status.
+ *
+ * @return the build status.
+ */
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ * Set the build status.
+ *
+ * @param status is the build status to set.
+ */
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/Handler.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/Handler.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.logger.ant.listener;
+
+
+/**
+ * Handler is an interface which is used to handle the build events
+ * which are of importance for ant logging and build stage summary display.
+ *
+ *
+ */
+public interface Handler extends BuildEventHandler, TargetEventHandler {
+
+
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/StageSummaryHandler.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/StageSummaryHandler.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,447 @@
+/*
+ * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+package com.nokia.helium.logger.ant.listener;
+
+import java.io.File;
+import java.io.StringWriter;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.util.DateUtils;
+
+import com.nokia.helium.logger.ant.types.Stage;
+import com.nokia.helium.logger.ant.types.StageSummary;
+
+import freemarker.cache.FileTemplateLoader;
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+
+/**
+ * StageStatusHandler is the handler class responsible for
+ * displaying the summary of the various configured build stages at the end of
+ * build process.
+ *
+ */
+public class StageSummaryHandler implements Handler {
+
+ public static final String PASSED = "PASSED";
+ public static final String FAILED = "FAILED";
+
+ private Logger log = Logger.getLogger(getClass());
+ private boolean displaySummary;
+ private boolean lookup4Stages;
+ private boolean summarize;
+
+ private List statusReports;
+ private HashSet completedStages;
+ private Hashtable currentStages;
+ private Hashtable currentStagesStartTime;
+ private Hashtable stages;
+ private String template;
+
+ /**
+ * Create an instance of {@link StageSummaryHandler}
+ *
+ */
+ public StageSummaryHandler() {
+ this.statusReports = new ArrayList();
+ this.completedStages = new HashSet();
+ this.currentStages = new Hashtable();
+ this.currentStagesStartTime = new Hashtable();
+ log.debug("StageStatusHandler instantiated");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void handleBuildStarted(BuildEvent event) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void handleBuildFinished(BuildEvent event) {
+ if (summarize && !currentStages.isEmpty()) {
+ Long currTime = getCurrentTime();
+ String reason = getReason(event.getException());
+ Map tempStages = new Hashtable(
+ currentStages);
+ for (String stageName : tempStages.keySet()) {
+ endCurrentStage(stageName, tempStages.get(stageName), reason,
+ currTime);
+ }
+
+ }
+ if (summarize && displaySummary) {
+ generateSummary(event.getProject());
+ displaySummary = false;
+ log.debug("Stage Summary generation completed");
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void handleTargetStarted(BuildEvent event) {
+ Project project = event.getProject();
+ if (!summarize) {
+ StageSummary stageSummary = getStageSummary(project);
+ summarize = stageSummary != null
+ && !stageSummary.getTemplate().trim().isEmpty();
+ lookup4Stages = summarize;
+ template = stageSummary.getTemplate();
+ log.debug("Is Project configured to display Stage Summary ? "
+ + summarize);
+ }
+
+ if (lookup4Stages) {
+ log.debug("Loading stages....");
+ parseStages(event.getProject());
+ log.debug("Total no of stages loaded = " + stages.size());
+ lookup4Stages = false;
+ }
+
+ log.debug("Handling target - " + event.getTarget().getName());
+ if (summarize) {
+ Long currTime = getCurrentTime();
+ TreeMap result = searchNewStage(event);
+ if (result != null && result.size() == 1) {
+ String stageName = result.firstKey();
+ Stage stage = result.get(stageName);
+ startNewStage(stageName, stage, currTime);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void handleTargetFinished(BuildEvent event) {
+ String currentTarget = event.getTarget().getName();
+ Long currTime = getCurrentTime();
+ String reason = getReason(event.getException());
+ if (summarize && !currentStages.isEmpty()) {
+ TreeMap result = getCurrentStageToEnd(currentTarget);
+ if (!result.isEmpty()) {
+ String stageName = result.firstKey();
+ Stage stage = result.get(stageName);
+ endCurrentStage(stageName, stage, reason, currTime);
+ }
+ }
+ }
+
+ private TreeMap getCurrentStageToEnd(String target) {
+ TreeMap result = new TreeMap();
+ for (String stageName : currentStages.keySet()) {
+ Stage stage = currentStages.get(stageName);
+ if (stage.isEndTarget(target)) {
+ result.put(stageName, stage);
+ break;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Method returns the configured {@link StageSummary}.
+ *
+ * @param project
+ * is the project to lookup for stageSummary.
+ * @return the {@link StageSummary}.
+ */
+ @SuppressWarnings("unchecked")
+ private StageSummary getStageSummary(Project project) {
+ StageSummary stageSummary = null;
+ int count = 0;
+ Hashtable references = project.getReferences();
+ for (Enumeration en = references.keys(); en.hasMoreElements();) {
+ Object object = references.get(en.nextElement());
+ if (object instanceof StageSummary) {
+ count++;
+ if (count > 1) {
+ raiseException("Multiple entries of 'hlm:stagesummary' found in "
+ + "stages_config.ant.xml.");
+ }
+ stageSummary = (StageSummary) object;
+ }
+ }
+ return stageSummary;
+ }
+
+ /**
+ * Raise a {@link BuildException} with the specified error message.
+ *
+ * @param message
+ * is the error message to display.
+ */
+ private void raiseException(String message) {
+ throw new BuildException(message);
+ }
+
+ /**
+ * Start the given stage as a new build stage.
+ *
+ * @param stageName
+ * is the name of the new stage.
+ * @param newStage
+ * is the build stage to start as new.
+ * @param startTime
+ * is the start time of the given build stage.
+ */
+ private void startNewStage(String stageName, Stage newStage, Long startTime) {
+ if (!currentStages.containsKey(stageName)) {
+ this.currentStages.put(stageName, newStage);
+ this.currentStagesStartTime.put(stageName, startTime);
+ log.debug("New stage [" + stageName + "] started at "
+ + getTimestamp(startTime));
+ }
+ }
+
+ /**
+ * End the current stage.
+ *
+ * @param reason
+ * is the reason for build failure if any.
+ * @param currTime
+ * is the end time of the current stage.
+ */
+ private void endCurrentStage(String currentStageName, Stage currentStage,
+ String reason, Long currTime) {
+ if (currentStage != null) {
+ BuildStatusReport report = constructBuildStatusReport(
+ currentStageName, currentStagesStartTime
+ .get(currentStageName), currTime, reason);
+ statusReports.add(report);
+ displaySummary = true;
+ log.debug("Stage [" + currentStageName + "] finished at "
+ + getTimestamp(currTime));
+ reset(currentStageName);
+ }
+ }
+
+ /**
+ * Reset the build stage variables to default.
+ */
+ private void reset(String stageName) {
+ this.currentStages.remove(stageName);
+ this.currentStagesStartTime.remove(stageName);
+ this.completedStages.add(stageName);
+ }
+
+ /**
+ * Search for the new Stage based on the given build event.
+ *
+ * @param event
+ * is the build event fired.
+ * @return a map with Stage Name and stage, if the build event marks the
+ * start of a configured Stage.
+ */
+ private TreeMap searchNewStage(BuildEvent event) {
+ TreeMap result = new TreeMap();
+ String target = event.getTarget().getName();
+ for (String stageName : stages.keySet()) {
+ Stage stage = stages.get(stageName);
+ if (!completedStages.contains(stageName)
+ && isStartingTarget(target, event.getProject(), stage)) {
+ result.put(stageName, stage);
+ break;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Return whether the given target is a starting target of the given stage.
+ *
+ * @param targetName
+ * is the target to check.
+ * @param project
+ * is the project to lookup for target
+ * @param stage
+ * is the stage to check.
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ private boolean isStartingTarget(String targetName, Project project,
+ Stage stage) {
+ boolean bool = false;
+ if (project.getTargets().containsKey(stage.getStartTarget())) {
+ Vector dependencies = project.topoSort(stage
+ .getStartTarget(), project.getTargets(), false);
+ if (!dependencies.isEmpty()) {
+ Target target = dependencies.firstElement();
+ bool = target.getName().equals(targetName);
+ }
+ }
+ return bool;
+ }
+
+ /**
+ * Parse and cache the stages configured.
+ *
+ * @param project
+ * is the project to lookup for stages.
+ */
+ @SuppressWarnings("unchecked")
+ private void parseStages(Project project) {
+ stages = new Hashtable();
+ Hashtable references = project.getReferences();
+ for (Enumeration en = references.keys(); en.hasMoreElements();) {
+ String key = en.nextElement();
+ Object value = references.get(key);
+ if (value instanceof Stage) {
+ stages.put(key, (Stage) value);
+ }
+ }
+ }
+
+ /**
+ * Return the reason for build failure in String format.
+ *
+ * @param th
+ * is the cause of build failure if any.
+ * @return String representing the build failure.
+ */
+ private String getReason(Throwable th) {
+ return (th != null) ? th.getMessage() : "";
+ }
+
+ /**
+ * Return the current time in milliseconds.
+ *
+ * @return the current time in milliseconds.
+ */
+ private Long getCurrentTime() {
+ return System.currentTimeMillis();
+ }
+
+ /**
+ * Generate build summary.
+ *
+ */
+ private void generateSummary(Project project) {
+ if (template != null) {
+ try {
+ Configuration cfg = new Configuration();
+ // get base dir and template name
+ StringTokenizer tokenizer = new StringTokenizer(template,
+ File.separator);
+ StringBuffer baseDirBuf = new StringBuffer();
+ String templateName = null;
+ while (tokenizer.hasMoreElements()) {
+ String str = (String) tokenizer.nextElement();
+ if (str.endsWith(".ftl")) {
+ templateName = str;
+ } else {
+ baseDirBuf.append(str).append(File.separator);
+ }
+ }
+ File baseDir = new File(baseDirBuf.toString());
+ cfg.setTemplateLoader(new FileTemplateLoader(baseDir));
+ Template templ = cfg.getTemplate(templateName);
+ StringWriter writer = new StringWriter();
+ templ.process(getTemplateData(), writer);
+ project.log(writer.toString());
+ } catch (freemarker.core.InvalidReferenceException ivx) {
+ project.log("Invalid reference in config: ", ivx,
+ Project.MSG_WARN);
+ } catch (freemarker.template.TemplateException e2) {
+ project.log("TemplateException: ", e2, Project.MSG_WARN);
+ } catch (java.io.IOException e) {
+ project.log("I/O Error during template conversion: ", e,
+ Project.MSG_WARN);
+ }
+ }
+ }
+
+ /**
+ * Return the data-model to be merged with the template.
+ *
+ * @return a Map representing template data-model.
+ */
+ private Map getTemplateData() {
+ Map templateMap = new HashMap();
+ templateMap.put("statusReports", new ArrayList(
+ statusReports));
+ return templateMap;
+ }
+
+ /**
+ * Get the given date as String format.
+ *
+ * @param date
+ * is the date to be formatted as String.
+ * @return given date formated as String
+ */
+ private String getTimestamp(long date) {
+ Date dt = new Date(date);
+ DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT,
+ DateFormat.SHORT);
+ String finishTime = formatter.format(dt);
+ return finishTime;
+ }
+
+ /**
+ * Get the time duration for the given start and end times in String format.
+ *
+ * @param startTime
+ * is the start time.
+ * @param endTime
+ * is the end time.
+ * @return
+ */
+ private String getTimeElapsed(Long startTime, Long endTime) {
+ long timeElapsed = endTime - startTime;
+ return DateUtils.formatElapsedTime(timeElapsed);
+ }
+
+ /**
+ * Construct an instance of {@link BuildStatusReport} with the given
+ * details.
+ *
+ * @param phaseName
+ * is the name of the Phase.
+ * @param startTime
+ * is the start time of the given Phase
+ * @param endTime
+ * is the end time of given phase
+ * @param reason
+ * is the cause of failure
+ * @return
+ */
+ private BuildStatusReport constructBuildStatusReport(String phaseName,
+ Long startTime, Long endTime, String reason) {
+ return new BuildStatusReport(phaseName, getTimestamp(startTime),
+ getTimeElapsed(startTime, endTime), reason);
+ }
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/StatusAndLogListener.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/StatusAndLogListener.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.logger.ant.listener;
+
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.SubBuildListener;
+import org.apache.tools.ant.Project;
+
+/**
+ * StatusAndLogListener implements {@link BuildListener} and
+ * listens to build events in particularly for activities such as ant logging
+ * and displaying build stage summary at the end of build process.
+ *
+ */
+public class StatusAndLogListener implements BuildListener, SubBuildListener {
+
+ private static Vector handlers = new Vector();
+ private static Project project;
+
+ /**
+ * Default constructor
+ */
+ public StatusAndLogListener() {
+ }
+
+ /**
+ * Signals that the last target has finished. This event will still be fired
+ * if an error occurred during the build.
+ *
+ * @param event
+ * An event with any relevant extra information. Must not be
+ * null .
+ *
+ * @see BuildEvent#getException()
+ */
+ public void buildStarted(BuildEvent event) {
+ project = event.getProject();
+ for (Handler handler : handlers) {
+ handler.handleBuildStarted(event);
+ }
+
+ }
+ /**
+ * Signals that a build has started. This event is fired before any targets
+ * have started.
+ *
+ * @param event
+ * An event with any relevant extra information. Must not be
+ * null .
+ */
+ public void buildFinished(BuildEvent event) {
+ for ( Handler handler : handlers ) {
+ handler.handleBuildFinished( event );
+ }
+ }
+
+
+ /**
+ * Signals that a target is starting.
+ *
+ * @param event
+ * An event with any relevant extra information. Must not be
+ * null .
+ *
+ * @see BuildEvent#getTarget()
+ */
+ public void targetStarted(BuildEvent event) {
+ for (Handler handler : handlers) {
+ handler.handleTargetStarted(event);
+ }
+ }
+
+ /**
+ * Signals that a target has finished. This event will still be fired if an
+ * error occurred during the build.
+ *
+ * @param event
+ * An event with any relevant extra information. Must not be
+ * null .
+ *
+ * @see BuildEvent#getException()
+ */
+ public void targetFinished(BuildEvent event) {
+ for (Handler handler : handlers) {
+ handler.handleTargetFinished(event);
+ }
+ }
+
+ /**
+ * Signals that a task is starting.
+ *
+ * @param event
+ * An event with any relevant extra information. Must not be
+ * null .
+ *
+ * @see BuildEvent#getTask()
+ */
+ public void taskStarted(BuildEvent event) {
+ // implement if needed
+ }
+
+ /**
+ * Signals that a task has finished. This event will still be fired if an
+ * error occurred during the build.
+ *
+ * @param event
+ * An event with any relevant extra information. Must not be
+ * null .
+ *
+ * @see BuildEvent#getException()
+ */
+ public void taskFinished(BuildEvent event) {
+ // implement if needed
+ }
+
+ /**
+ * Signals that a subbuild has started. This event is fired before any targets have started.
+ * @param event
+ */
+ public void subBuildStarted(BuildEvent event) {
+
+ }
+
+ /**
+ * Signals that the last target has finished. This event will still be fired if an error occurred during the build.
+ * @param event
+ */
+
+ public void subBuildFinished(BuildEvent event) {
+
+ }
+
+
+
+ /**
+ * Signals a message logging event.
+ *
+ * @param event
+ * An event with any relevant extra information. Must not be
+ * null .
+ *
+ * @see BuildEvent#getMessage()
+ * @see BuildEvent#getException()
+ * @see BuildEvent#getPriority()
+ */
+ public void messageLogged(BuildEvent event) {
+ // implement if needed
+
+ }
+
+ /**
+ * Register the given handler.
+ *
+ * @param handler
+ * is the handler to register
+ */
+ public static void register ( Handler handler ) {
+ handlers.add( handler );
+ }
+
+ /**
+ * Return root project name.
+ * @return
+ */
+ public static Project getProject() {
+ return project;
+ }
+
+
+ /**
+ * Check and return required type handler.
+ * @param handlerType
+ * @return
+ */
+ public static Handler getHandler(Class handlerType) {
+ for (Handler handler : handlers) {
+ if (handlerType.isInstance(handler)) {
+ return handler;
+ }
+ }
+ return null;
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/SubBuildEventHandler.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/SubBuildEventHandler.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.logger.ant.listener;
+
+import org.apache.tools.ant.BuildEvent;
+
+/**
+ * Handler is an interface which is used to handle the build events
+ * which are of importance for ant logging and build stage summary display.
+ *
+ *
+ */
+public interface SubBuildEventHandler {
+
+ /**
+ * Method to handle SubBuild Started events.
+ * @param event
+ */
+ void handleSubBuildStarted( BuildEvent event );
+
+ /**
+ * Method to handle SubBuild Finished events.
+ * @param event
+ */
+ void handleSubBuildFinished( BuildEvent event );
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/TargetEventHandler.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/TargetEventHandler.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.logger.ant.listener;
+
+import org.apache.tools.ant.BuildEvent;
+
+/**
+ * Handler is an interface which is used to handle the build events
+ * which are of importance for ant logging and build stage summary display.
+ *
+ *
+ */
+public interface TargetEventHandler {
+
+ /**
+ * Method to handle Target started Event
+ *
+ * @param event
+ */
+
+ void handleTargetStarted( BuildEvent event );
+
+ /**
+ * Method to handle target finish events.
+ *
+ * @param event is the build event to be handled.
+ */
+ void handleTargetFinished( BuildEvent event );
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/TaskEventHandler.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/listener/TaskEventHandler.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.logger.ant.listener;
+
+import org.apache.tools.ant.BuildEvent;
+
+/**
+ * Handler is an interface which is used to handle the build events
+ * which are of importance for ant logging and build stage summary display.
+ *
+ *
+ */
+public interface TaskEventHandler {
+
+ /**
+ * Method to handle Task Finished events.
+ *
+ * @param event is the build event to be handled.
+ */
+ void handleTaskFinished( BuildEvent event );
+
+ /**
+ * Method to handle Task Started( events.
+ *
+ * @param event is the build event to be handled.
+ */
+ void handleTaskStarted( BuildEvent event );
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/taskdefs/LogRecorder.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/taskdefs/LogRecorder.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,333 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.helium.logger.ant.taskdefs;
+
+import java.util.Hashtable;
+import java.util.Vector;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.EnumeratedAttribute;
+import org.apache.tools.ant.types.LogLevel;
+
+import com.nokia.helium.logger.ant.listener.AntLogRecorderEntry;
+import com.nokia.helium.logger.ant.listener.AntLoggingHandler;
+import com.nokia.helium.logger.ant.listener.Handler;
+import com.nokia.helium.logger.ant.listener.StatusAndLogListener;
+import com.nokia.helium.logger.ant.types.RecordFilter;
+import com.nokia.helium.logger.ant.types.RecordFilterSet;
+
+/**
+ * For recording ant logging output.
+ *
+ *
+ * <hlm:record name="${build.log.dir}/${build.id}_test.log" action="start" append="false" loglevel="info">
+ * <hlm:recordfilterset refid="recordfilter.config"/>
+ * <hlm:recordfilter category="info" regexp="^INFO:" />
+ * </hlm:record>
+ *
+ *
+ *
+ * @ant.task name="Record" category="Logging".
+ *
+ */
+
+public class LogRecorder extends Task implements Handler {
+
+ private static Hashtable recorderEntries = new Hashtable();
+ private String fileName;
+ private Boolean append ;
+ private Boolean start ;
+ private int loglevel = -1;
+ private boolean emacsMode ;
+ private Vector recordFilters = new Vector();
+ private Vector recordFilterSet = new Vector();
+ private Vector regExpList = new Vector();
+
+
+ public LogRecorder() {
+
+ }
+ /**
+ * Run by the task.
+ */
+
+ public void execute () {
+
+ AntLoggingHandler antLoggingHandler = (AntLoggingHandler)StatusAndLogListener.getHandler(AntLoggingHandler.class);
+
+ /* To validate attributes passed. */
+ validateAttributes();
+
+ /* to add regular filters */
+ addAllRecordFilters();
+
+
+ /* Init password/record filter and replace any unset properties */
+ initAndReplaceProperties();
+
+ // get the recorder entry
+ AntLogRecorderEntry recorder = getRecorder(fileName, getProject());
+ // set the values on the recorder
+ recorder.setMessageOutputLevel(loglevel);
+ recorder.setEmacsMode(emacsMode);
+ if (start != null) {
+ if (start.booleanValue()) {
+ if (antLoggingHandler != null) {
+ if (antLoggingHandler.getCurrentStageName() != null) {
+ antLoggingHandler.doLoggingAction(antLoggingHandler.getCurrentStageName(), false, "Stopping", this);
+ } else {
+ antLoggingHandler.doLoggingAction("default", false, "Stopping", this);
+ }
+ }
+ recorder.reopenFile();
+ recorder.setRecordState(start);
+ } else {
+ recorder.setRecordState(start);
+ recorder.closeFile();
+ if (antLoggingHandler != null) {
+ if (antLoggingHandler.getCurrentStageName() != null) {
+ antLoggingHandler.doLoggingAction(antLoggingHandler.getCurrentStageName(), true, "Starting", this);
+ } else {
+ antLoggingHandler.doLoggingAction("default", true, "Starting", this);
+ }
+ }
+ }
+ }
+
+ }
+ /**
+ * To Validate is the fileName set for recording.
+ */
+ private void validateAttributes() {
+ if (fileName == null) {
+ throw new BuildException("filename attribute should be specified for helium recorder task.");
+ }
+
+ }
+
+ /**
+ * Set the file name to recod.
+ * @param fileName
+ * @ant.required
+ */
+ public void setName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ /**
+ * Return the fileName.
+ * @return
+ */
+ public String getName() {
+ return this.fileName;
+ }
+
+ /**
+ * Set the append parameter.
+ * @param append
+ * @ant.not-required
+ */
+ public void setAppend(boolean append) {
+ this.append = append ? Boolean.TRUE : Boolean.FALSE;
+ }
+
+ /**
+ * Set logLevel to log the information.
+ * @param level
+ * @ant.not-required
+ */
+ public void setLoglevel(VerbosityLevelChoices level) {
+ loglevel = level.getLevel();
+ }
+
+ /**
+ * Set the EmacsMode.
+ * @param emacsMode
+ * @ant.not-required
+ */
+ public void setEmacsMode(boolean emacsMode) {
+ this.emacsMode = emacsMode;
+ }
+
+ /**
+ * Return the emacsMode.
+ * @return
+ */
+ public boolean getEmacsMode() {
+ return this.emacsMode;
+ }
+
+ /**
+ * create the type of recorderfilter.
+ * @param logFilter
+ */
+ public void addRecordFilter(RecordFilter logFilter) {
+ if (!recordFilters.contains(logFilter)) {
+ recordFilters.add(logFilter);
+ }
+ }
+
+ /**
+ * Create the type of recoderfilterset
+ * @param logFilterSet
+ */
+ public void addRecordFilterSet(RecordFilterSet logFilterSet) {
+ if (!recordFilterSet.contains(logFilterSet)) {
+ recordFilterSet.add(logFilterSet);
+ }
+ }
+
+ /**
+ * Set the action of stop/start.
+ * @param action
+ * @ant.not-required
+ */
+ public void setAction(ActionChoices action) {
+ if (action.getValue().equalsIgnoreCase("start")) {
+ start = Boolean.TRUE;
+ } else {
+ start = Boolean.FALSE;
+ }
+ }
+
+ /**
+ * To get the action state of current recorder.
+ * @return
+ */
+ public boolean getAction() {
+ return start.booleanValue();
+ }
+
+
+ /**
+ * A list of possible values for the setAction() method.
+ * Possible values include: start and stop.
+ */
+ public static class ActionChoices extends EnumeratedAttribute {
+ private static final String[] VALUES = {"start", "stop"};
+
+ /**
+ * @see EnumeratedAttribute#getValues()
+ */
+ /** {@inheritDoc}. */
+ public String[] getValues() {
+ return VALUES;
+ }
+ }
+
+ /**
+ * To set the verbosity levels
+ *
+ *
+ */
+ public static class VerbosityLevelChoices extends LogLevel {
+ }
+
+
+ /**
+ * To register the recorder entry
+ */
+ @SuppressWarnings("unchecked")
+ protected AntLogRecorderEntry getRecorder(String name, Project proj) {
+ Object o = recorderEntries.get(name);
+ AntLogRecorderEntry entry;
+ if (o == null) {
+ // create a recorder entry
+ entry = new AntLogRecorderEntry(name);
+ for (String regExp : regExpList) {
+ if (!regExp.equals("")) {
+ String pattern = Pattern.quote(regExp);
+ entry.addRegexp(pattern);
+ }
+ }
+
+ if (append == null) {
+ entry.openFile(false);
+ } else {
+ entry.openFile(append.booleanValue());
+ }
+ entry.setProject(proj);
+ recorderEntries.put(name, entry);
+ } else {
+ entry = (AntLogRecorderEntry) o;
+ }
+ return entry;
+ }
+
+ /**
+ * Get all the recorderfilters from recorderfilterset refid.
+ */
+ public void addAllRecordFilters() {
+ for (RecordFilterSet recFilterSet : recordFilterSet ) {
+ recordFilters.addAll(recFilterSet.getAllFilters());
+ }
+ }
+
+ public void handleBuildFinished(BuildEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void handleBuildStarted(BuildEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void handleTargetFinished(BuildEvent event) {
+ // TODO Auto-generated method stub
+ }
+
+ public void handleTargetStarted(BuildEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * To init password and record filters.
+ * Replace with values if any property values are unset.
+ */
+ @SuppressWarnings("unused")
+ public void initAndReplaceProperties() {
+
+ Pattern pattern = null;
+ Matcher match = null;
+ for (RecordFilter recordFilter : recordFilters) {
+ if (recordFilter.getRegExp() == null) {
+ throw new BuildException("\"regexp\" attribute should not have null value for recordfilter");
+ }
+ if (recordFilter.getRegExp() != null) {
+ pattern = Pattern.compile("\\$\\{(.*)}");
+ match = pattern.matcher(recordFilter.getRegExp());
+ if (match.find()) {
+ regExpList.add(getProject().replaceProperties(recordFilter.getRegExp()));
+ } else {
+ regExpList.add(recordFilter.getRegExp());
+ }
+ }
+ }
+ }
+
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/taskdefs/LogReplace.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/taskdefs/LogReplace.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.logger.ant.taskdefs;
+
+import java.util.regex.Pattern;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+import com.nokia.helium.logger.ant.listener.AntLoggingHandler;
+import com.nokia.helium.logger.ant.listener.StatusAndLogListener;
+
+/**
+ * To replace the property values with real values if the properties are not set at the begining of the build.
+ *
+ * pre>
+ * <hlm:logreplace regexp="${property.not.set}"/>
+ *
+ *
+ * @ant.task name="logreplace" category="Logging".
+ */
+public class LogReplace extends Task {
+
+ private String regExp;
+
+ /**
+ * Run by the task.
+ */
+
+ public void execute () {
+
+ AntLoggingHandler antLoggingHandler = (AntLoggingHandler)StatusAndLogListener.getHandler(AntLoggingHandler.class);
+
+ if (regExp == null ) {
+ throw new BuildException ("'regexp' attribute should not be null.");
+ }
+
+ if (antLoggingHandler != null) {
+ String pattern = Pattern.quote(regExp);
+ antLoggingHandler.addRegExp(pattern);
+ }
+ }
+
+ /**
+ * @param regExp the regExp to set
+ * @ant.required
+ */
+ public void setRegExp(String regExp) {
+ this.regExp = regExp;
+ }
+
+ /**
+ * @return the regExp
+ */
+ public String getRegExp() {
+ return regExp;
+ }
+
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/types/RecordFilter.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/types/RecordFilter.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.logger.ant.types;
+
+import org.apache.tools.ant.types.DataType;
+
+/**
+ * Recorder Filter will be used to filter the ant logging output.
+ *
+ * To get the lines which matches the regular expression.
+ *
+ *
+ * <hlm:recordfilter category="info" regexp="ERROR"/>
+ * <hlm:recordfilter category="warn" regexp="^WARN"/>
+ *
+ *
+ * @ant.task name="Recordfilter" category="Logging".
+ *
+ */
+
+public class RecordFilter extends DataType {
+
+ private String category;
+ private String regExp;
+
+
+ /**
+ * Set category.
+ * @param category
+ * @ant.not-required
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ /**
+ * Return the category.
+ * @return
+ */
+ public String getCategory() {
+ return this.category;
+ }
+
+ /**
+ * Sets the regExp.
+ * @param regExp
+ * @ant.required
+ */
+ public void setRegExp(String regExp) {
+ this.regExp = regExp;
+ }
+
+
+ /**
+ * get the regExp.
+ * @return
+ */
+ public String getRegExp() {
+ return this.regExp;
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/types/RecordFilterSet.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/types/RecordFilterSet.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.logger.ant.types;
+
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.DataType;
+import org.apache.tools.ant.types.Reference;
+
+/**
+ * Recorder Filter set will be used to group the recorder filters to filter ant logging output.
+ *
+ * To get the lines which matches the regular expression.
+ *
+ *
+ * <hlm:recordfilterset id="recordfilter.config">
+ * <hlm:recordfilter category="error" regexp="Hello" />
+ * <hlm:recordfilter category="warning" regexp="echo" />
+ * <hlm:recordfilter category="info" regexp="ERROR" />
+ * </hlm:recordfilterset>
+ *
+ *
+ *
+ * @ant.task name="Recordfilterset" category="Logging".
+ *
+ */
+
+public class RecordFilterSet extends DataType {
+
+ private Vector recordFilters = new Vector();
+
+ public RecordFilterSet() {
+ }
+
+ /**
+ * Add the recordefilter type into recordfilterset.
+ * @param logFilter
+ */
+ public void addRecordFilter(RecordFilter logFilter) {
+ if (!recordFilters.contains(logFilter)) {
+ recordFilters.add(logFilter);
+ }
+ }
+
+
+ /**
+ * return all the recorderfilters associated with current recorderfilterset.
+ * @return
+ */
+ public Vector getAllFilters() {
+ Vector allFilters = new Vector();
+ if (recordFilters.size() > 0) {
+ allFilters.addAll(recordFilters);
+ return allFilters;
+ }
+ Reference refId = getRefid();
+ Object filterSetObject = null;
+ if (refId != null) {
+ try {
+ filterSetObject = refId.getReferencedObject();
+ } catch ( Exception ex) {
+ throw new BuildException("Reference id of the record filter is not valid. " + ex.getMessage(), ex);
+ }
+ if (filterSetObject != null && filterSetObject instanceof RecordFilterSet) {
+ allFilters.addAll(((RecordFilterSet)filterSetObject).getAllFilters());
+ return allFilters;
+ }
+ }
+ return allFilters;
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/types/Stage.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/types/Stage.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.logger.ant.types;
+
+import org.apache.tools.ant.types.DataType;
+
+
+/**
+ * A Stage is a Data type which stores Stage information.
+ *
+ *
+ * A Stage is defined by setting three attributes name, start and end targets, both should be a
+ * valid target name in the project.
+ *
+ *
+ * Usage:
+ *
+ *
+ * <hlm:stage id="preparation" starttarget="stagetest" endtarget="stagetest"/>
+ *
+ *
+ * @ant.task name="stage" category="Logging"
+ *
+ */
+public class Stage extends DataType {
+
+ private String startTarget;
+ private String endTarget;
+
+ public Stage() {
+
+ }
+ /**
+ * Get the starting point of this {@link Stage}.
+ *
+ * @return the starting point of this {@link Stage}.
+ */
+ public String getStartTarget() {
+ return this.startTarget;
+ }
+
+ /**
+ * Set the starting target.
+ *
+ * @param start
+ * is the starting point to set.
+ * @ant.required
+ */
+ public void setStartTarget(String startTarget) {
+ this.startTarget = startTarget;
+ }
+
+ /**
+ * Get the end point of this {@link Stage}.
+ *
+ * @return the end point of this {@link Stage}.
+ *
+ */
+ public String getEndTarget() {
+ return this.endTarget;
+ }
+
+ /**
+ * Set the end target.
+ *
+ * @param end
+ * is the end point to set.
+ * @ant.required
+ */
+ public void setEndTarget(String endTarget) {
+ this.endTarget = endTarget;
+ }
+
+ /**
+ * Check is the start target set to current target.
+ * @param target
+ * @return
+ */
+ public boolean isStartTarget ( String target ) {
+ return this.startTarget.equals( target );
+ }
+
+ /** Check is the end target set to current target.
+ *
+ * @param target
+ * @return
+ */
+ public boolean isEndTarget ( String target ) {
+ return this.endTarget.equals( target );
+ }
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/types/StageLogging.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/types/StageLogging.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.helium.logger.ant.types;
+
+import org.apache.tools.ant.types.DataType;
+import com.nokia.helium.logger.ant.listener.AntLoggingHandler;
+import com.nokia.helium.logger.ant.listener.StatusAndLogListener;
+import org.apache.log4j.Logger;
+
+/**
+ * A 'StageRecord' is a Data type which stores attributes for stage recording/logging.
+ *
+ *
+ * Usage:
+ *
+ * <hlm:stagerecord id="record.default" defaultoutput="${build.log.dir}/${build.id}_main.ant.log" loglevel="info" append="false"/>
+ *
+ *
+ * <hlm:stagerecord id="record.prep"
+ * stagerefid="preparation"
+ * output="${build.log.dir}/${build.id}_prep.ant.log"
+ * loglevel="info"
+ * append="false"/>
+ *
+ *
+ *
+ *
+ * @ant.task name="stagerecord" category="Logging"
+ */
+public class StageLogging extends DataType {
+
+ private static boolean isAntLoggerRegistered;
+ private String logLevel = "info";
+ private String logFile;
+ private String defaultLogFile;
+ private Boolean append;
+ private String stageRefId;
+ private Logger log = Logger.getLogger(StageLogging.class);
+ /**
+ * Constructor which will register the logging handler
+ */
+ public StageLogging () {
+ if (!isAntLoggerRegistered) {
+ StatusAndLogListener.register(new AntLoggingHandler());
+ log.debug("Registering stage record to StatusAndLogListener listener");
+ isAntLoggerRegistered = true;
+ }
+ }
+
+ /**
+ * Sets output log file name.
+ * @param outPut
+ * @ant.required
+ */
+
+ public void setOutput(String outPut) {
+ this.logFile = outPut;
+ }
+
+ /**
+ * Returns output log file name.
+ * @return
+ */
+
+ public String getOutput() {
+ return this.logFile;
+ }
+
+ /**
+ * Sets log level for respective stage.
+ * @param logLevel
+ * @ant.not-required
+ */
+
+ public void setLogLevel(String logLevel) {
+ this.logLevel = logLevel;
+ }
+
+ /**
+ * Returns log level of respective stage.
+ * @return
+ */
+
+ public String getLogLevel() {
+ return this.logLevel;
+ }
+
+ /**
+ * Get the name of this StageRefID.
+ *
+ * @return name of the Phase.
+ */
+ public String getStageRefID() {
+ return this.stageRefId;
+ }
+
+ /**
+ * Set the name of the StageRefID.
+ *
+ * @param name
+ * is the name to set.
+ * @ant.required
+ */
+ public void setStageRefId(String name) {
+ this.stageRefId = name;
+ }
+
+ /**
+ * Return default ant log file name.
+ * @return
+ */
+ public String getDefaultOutput() {
+ return this.defaultLogFile;
+ }
+
+ /**
+ * Set the default ant log name.
+ * @param name
+ * @ant.required
+ */
+ public void setDefaultOutput(String name) {
+ this.defaultLogFile = name;
+ }
+
+ /**
+ * Set append value.
+ * @param append
+ * @ant.not-required
+ */
+ public void setAppend(boolean append) {
+ this.append = append ? Boolean.TRUE : Boolean.FALSE;
+ }
+
+ /**
+ * Return the append value.
+ * @param append
+ * @return
+ */
+ public Boolean getAppend() {
+ return this.append;
+ }
+
+
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/types/StageSummary.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/com/nokia/helium/logger/ant/types/StageSummary.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+package com.nokia.helium.logger.ant.types;
+
+import org.apache.tools.ant.types.DataType;
+
+import com.nokia.helium.logger.ant.listener.StageSummaryHandler;
+import com.nokia.helium.logger.ant.listener.StatusAndLogListener;
+
+/**
+ * StageSummary is a Data type when set a build summary is
+ * displayed at the end of build process.
+ *
+ *
+ * Usage:
+ * <hlm:stagesummary id="stage.summary"
+ * template="${template.dir}\build_stages_summary.txt.ftl"/>
+ *
+ *
+ * @ant.task name="stagesummary" category="Logging"
+ *
+ */
+public class StageSummary extends DataType {
+
+ private static boolean isStageSummaryHandlerRegistered;
+
+ private String template;
+
+ public StageSummary () {
+ if ( !isStageSummaryHandlerRegistered ) {
+ StatusAndLogListener.register( new StageSummaryHandler() );
+ isStageSummaryHandlerRegistered = true;
+ }
+ }
+
+ /**
+ * Get the template used for displaying build stage summary.
+ *
+ * @return the template to display build stage summary.
+ */
+ public String getTemplate () {
+ return template;
+ }
+
+ /**
+ * Set the template to be used for displaying build stage summary.
+ *
+ * @param template
+ * the template to set
+ * @ant.required
+ */
+ public void setTemplate ( String template ) {
+ this.template = template;
+ }
+}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/src/templates/build_stages_summary.txt.ftl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/src/templates/build_stages_summary.txt.ftl Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,35 @@
+<#--
+============================================================================
+Name : build_stages_summary.txt.ftl
+Part of : Helium
+
+Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+All rights reserved.
+This component and the accompanying materials are made available
+under the terms of the License "Eclipse Public License v1.0"
+which accompanies this distribution, and is available
+at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+Initial Contributors:
+Nokia Corporation - initial contribution.
+
+Contributors:
+
+Description:
+
+============================================================================
+-->
+
+*** BUILD STAGE SUMMARY ***
+
+<#assign count = 0>
+<#list statusReports as report>
+<#assign count = count + 1>
+${count}) ${report["phaseName"]}
+${""?left_pad(2)} Start Time : ${report["startTime"]}
+${""?left_pad(2)} Duration : ${report["duration"]}
+${""?left_pad(2)} Status : ${report["status"]}
+<#if report["status"] == "FAILED">
+${""?left_pad(2)} Reason : ${report["reason"]}
+#if>
+#list>
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/tests/antunit/test_stageslogging.ant.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/tests/antunit/test_stageslogging.ant.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,80 @@
+
+
+
+ Helium Antlib Signal unittests.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/tests/bld.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/tests/bld.sh Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+if [ -f ~/.bashrc ] ; then
+ . ~/.bashrc
+fi
+MODULE_VERSION="$(module --version 2>&1)"
+if [ "$?" == "0" ] ; then
+ module load "java/1.6.0"
+ module load "tww/ant/1.7.1"
+fi
+export TEMP="/tmp/$USER"
+
+export ANT_ARGS="-lib ../lib -lib ../../lib -lib ../../bin/helium-logging.jar -lib ../../antlibs -listener com.nokia.helium.logger.ant.listener.StatusAndLogListener"
+ant $*
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/tests/build.bat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/tests/build.bat Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,27 @@
+@echo off
+
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the License "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+setlocal
+if not defined JAVA_6_HOME (
+set TESTED_JAVA=C:\Apps\j2sdk_1.6.0_02
+) ELSE set TESTED_JAVA=%JAVA_6_HOME%
+if exist %TESTED_JAVA% (set JAVA_HOME=%TESTED_JAVA%)
+set ANT_ARGS=-lib %CD%\..\lib -lib %CD%\..\..\lib -lib %CD%\..\..\bin\helium-logging.jar -lib %CD%\..\..\antlibs -lib ..\..\bin\helium-core.jar -listener com.nokia.helium.logger.ant.listener.StatusAndLogListener
+ant -Dant.executor.class=com.nokia.helium.core.ant.HeliumExecutor %*
+endlocal
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/tests/build.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/tests/build.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,114 @@
+
+
+
+ Helium Antlib Logging unittests.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Before calling target
+ grace
+
+
+
+
+
+ After calling target
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ unix-password = ${unix.password}
+
+
+ ats-password = ${ats.password}
+
+
+
+
+
+
+ ${unix.password}
+ synergy
+ Hello... inside stagetest target ${display}
+
+
+
+ Hello... inside creatbom target
+
+
+
+ Hello... inside get-env target ${display}
+
+
+
+ Hello... inside hello target ${display}
+
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/tests/build_stages_summary.txt.ftl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/tests/build_stages_summary.txt.ftl Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,35 @@
+<#--
+============================================================================
+Name : build_stages_summary.txt.ftl
+Part of : Helium
+
+Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+All rights reserved.
+This component and the accompanying materials are made available
+under the terms of the License "Eclipse Public License v1.0"
+which accompanies this distribution, and is available
+at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+Initial Contributors:
+Nokia Corporation - initial contribution.
+
+Contributors:
+
+Description:
+
+============================================================================
+-->
+
+*** BUILD STAGE SUMMARY ***
+
+<#assign count = 0>
+<#list statusReports as report>
+<#assign count = count + 1>
+${count}) ${report["phaseName"]}
+${""?left_pad(2)} Start Time : ${report["startTime"]}
+${""?left_pad(2)} Duration : ${report["duration"]}
+${""?left_pad(2)} Status : ${report["status"]}
+<#if report["status"] == "FAILED">
+${""?left_pad(2)} Reason : ${report["reason"]}
+#if>
+#list>
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/tests/prep-ccm-get-input.ant.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/tests/prep-ccm-get-input.ant.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,54 @@
+
+
+
+ Helium Antlib Logging unittests.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hello... Inside Prep target ${display}
+
+
+
+ Hello... Inside ccm-get-input target
+
+
+
+ Hello... Inside init target ${display}
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/logging/tests/stages_config.ant.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/logging/tests/stages_config.ant.xml Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,46 @@
+
+
+
+
+ Definitions of helium stages.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/macros.ant.xml
--- a/buildframework/helium/external/helium-antlib/macros.ant.xml Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/macros.ant.xml Wed Dec 23 19:29:07 2009 +0200
@@ -24,7 +24,7 @@
Helium Antlib build macro.
-
+
@@ -71,7 +71,8 @@
-
+
+
@@ -86,18 +87,67 @@
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -115,60 +165,72 @@
+
+
JUnit test module @{name}
+
+
+
+
+
+
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
-
-
-
+
-
+
+
-
-
+
+
+
+
+
+
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/SQLFMPPLoader.java
--- a/buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/SQLFMPPLoader.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/SQLFMPPLoader.java Wed Dec 23 19:29:07 2009 +0200
@@ -34,6 +34,7 @@
import com.nokia.helium.metadata.db.MetaDataDb;
import org.apache.log4j.Logger;
+
/**
* Utility class to access the data from the database and used by FMPP
* templates.
@@ -52,11 +53,11 @@
* @see fmpp.tdd.DataLoader#load(fmpp.Engine, java.util.List)
*/
public Object load(Engine engine, List args) throws Exception {
- log.debug("args.size:" + args.size());
+ //log.debug("args.size:" + args.size());
java.util.ListIterator iter = args.listIterator();
int argsSize = args.size();
if (argsSize < 1) {
- throw new Exception("input DB path should be provided");
+ throw new Exception("Input DB path should be provided to load into FMPP.");
}
/* arg[0] - dbpath
@@ -82,7 +83,7 @@
* @return returns the template model for the query
*/
public TemplateModel get(String query) {
- log.debug("QueryModel:" + query);
+ //log.debug("QueryModel:" + query);
return new QueryTemplateModel(query);
}
@@ -111,7 +112,7 @@
* @param query for which the template model needs to be returned.
*/
public QueryTemplateModel(String query) {
- log.debug("query in SQLTemplateModel" + query);
+ //log.debug("query in SQLTemplateModel" + query);
this.query = query;
}
@@ -121,9 +122,9 @@
*/
public TemplateModel get(String key) {
checkAndReadData();
- log.debug("QueryModel:" + key);
+ //log.debug("QueryModel:" + key);
List dataList = indexMap.get(key);
- log.debug("datalist size" + dataList.size());
+ //log.debug("datalist size" + dataList.size());
if (dataList.size() == 1 ) {
return new SimpleScalar((String)dataList.get(0));
}
@@ -136,11 +137,11 @@
*/
private void checkAndReadData() {
if (!isDataRead) {
- log.debug("isDataRead:" + isDataRead);
+ //log.debug("isDataRead:" + isDataRead);
isDataRead = true;
indexMap = metadataDb.getIndexMap(query);
}
- log.debug("indexmap size" + indexMap.size());
+ //log.debug("indexmap size" + indexMap.size());
}
/*
@@ -196,7 +197,7 @@
* @return the iterator model from which the data is accessed.
*/
public TemplateModelIterator iterator() {
- log.debug("iterator constructor called");
+ //log.debug("iterator constructor called");
return new SQLTemplateModelIterator(query);
}
}
@@ -218,15 +219,17 @@
public TemplateModel next() {
SimpleHash simpleHash = null;
try {
- log.debug("checking any more element");
+ //log.debug("checking any more element");
if (rowList != null && (count >= rowList.size())) {
finished = true;
}
- log.debug("next:count:" + count);
+ //log.debug("next:count:" + count);
simpleHash = new SimpleHash(rowList.get(count));
count ++;
return simpleHash;
} catch (Exception ex) {
+ // We are Ignoring the errors as no need to fail the build.
+ log.debug("Iteration exception" + ex.getMessage());
ex.printStackTrace();
}
return null;
@@ -235,10 +238,10 @@
public boolean hasNext() {
if (rowList == null || READ_LIMIT <= count) {
if (!finished) {
- log.debug("getting records");
+ //log.debug("Getting records");
rowList = metadataDb.getRecords(query, READ_LIMIT, currentOffsetIndex * READ_LIMIT);
count = 0;
- log.debug("rowList.size : " + rowList.size());
+ //log.debug("rowList.size : " + rowList.size());
if (rowList.size() == 0) {
finished = true;
}
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/antlib.xml
--- a/buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/antlib.xml Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/antlib.xml Wed Dec 23 19:29:07 2009 +0200
@@ -23,6 +23,7 @@
+
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/conditions/MetaDataLogCondition.java
--- a/buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/conditions/MetaDataLogCondition.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/conditions/MetaDataLogCondition.java Wed Dec 23 19:29:07 2009 +0200
@@ -81,8 +81,7 @@
if (severity == null)
throw new BuildException("'severity' attribute is not defined");
- this.log("Looking for severity '" + severity + "' under '"
- + fileName.getAbsolutePath() + "'");
+ //this.log("Looking for severity '" + severity + "' under '" + fileName.getAbsolutePath() + "'");
MetaDataDb.Priority prty = null;
if (severity.equalsIgnoreCase("ERROR")) {
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataDelete.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataDelete.java Wed Dec 23 19:29:07 2009 +0200
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+package com.nokia.helium.metadata.ant.taskdefs;
+
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.log4j.Logger;
+import com.nokia.helium.metadata.db.*;
+import java.util.Date;
+
+/**
+ * This task provide a way to delete the data from db for a log file set.
+ *
+ *
+ * Example 1:
+ * <metadadelete database="compile_log.db">
+ * <fileset casesensitive="false" file="sbs.log.file"/>
+ * </metadadelete>
+ *
+ *
+ * @ant.task name="metadatadelete" category="Metadata"
+ */
+public class MetaDataDelete extends Task {
+
+ private static Logger log = Logger.getLogger(MetaDataDelete.class);
+
+ private String database;
+
+ private boolean failOnError = true;
+
+ private Vector fileSetList = new Vector();
+
+ /**
+ * Helper function to set the database parameter
+ *
+ * @ant.required
+ */
+ public void setDatabase(String dbFile) {
+ database = dbFile;
+ }
+
+ public void setFailOnError(String failNotify) {
+ if (failNotify.equals("false")) {
+ failOnError = false;
+ }
+ }
+
+ /**
+ * Updates the list of filelist from the input fileset.
+ * @param fileSetList input fileset list
+ * @return the matched files including the base dir.
+ */
+ private List getFileListFromFileSet() {
+ List fileList = new ArrayList();
+ for (FileSet fs : fileSetList) {
+ DirectoryScanner ds = fs.getDirectoryScanner(getProject());
+ String[] includedFiles = ds.getIncludedFiles();
+ for ( String file : includedFiles ) {
+ fileList.add(file);
+ log.debug("includedfiles: " + file);
+ }
+ }
+ log.debug("fileList.size" + fileList.size());
+ return fileList;
+ }
+
+ /**
+ * Adds the fileset (list of input log files to be processed).
+ * @param fileSet fileset to be added
+ *
+ */
+ public void add(FileSet fileSet) {
+ fileSetList.add(fileSet);
+ }
+
+ /**
+ * Helper function to get the database
+ *
+ */
+ public String getDatabase() {
+ return database;
+ }
+
+
+ @Override
+ public void execute() {
+ MetaDataDb metadataDb = null;
+ try {
+ log.debug("Initializing DB: " + database + "to delete");
+ log("time before removing entries from db" + new Date());
+ metadataDb = new MetaDataDb(database);
+ metadataDb.removeEntries(getFileListFromFileSet());
+ log("time after removing entries from db" + new Date());
+ } catch (BuildException ex1) {
+ if (failOnError) {
+ throw ex1;
+ }
+ } catch (Exception ex) {
+ if (failOnError) {
+ throw new BuildException("Failed during writing data to db");
+ }
+ } finally {
+ log.debug("finalizing DB: " + database);
+ if (metadataDb != null) {
+ metadataDb.finalizeDB();
+ }
+ }
+ }
+}
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataRecord.java
--- a/buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataRecord.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataRecord.java Wed Dec 23 19:29:07 2009 +0200
@@ -22,10 +22,9 @@
import org.apache.tools.ant.Task;
import java.util.Vector;
import java.util.Iterator;
-//import java.util.ArrayList;
import org.apache.log4j.Logger;
-//import org.apache.tools.ant.types.FileSet;
import com.nokia.helium.metadata.db.*;
+import java.util.Date;
/**
* This task provide a way to record the data in the Database.
@@ -114,6 +113,7 @@
log.debug("Initializing DB: " + database);
metadataDb = new MetaDataDb(database);
log.debug("Parsing the input and writing to DB");
+ log("time before recording to db" + new Date());
for ( MetaDataInput metadataInput : metadataList ) {
boolean removed = false;
Iterator inputIterator = metadataInput.iterator();
@@ -125,6 +125,7 @@
metadataDb.addLogEntry(logEntry);
}
}
+ log("time after recording to db" + new Date());
log.debug("Successfully writen to DB");
} catch (BuildException ex1) {
if (failOnError) {
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/types/AbldLogMetaDataInput.java
--- a/buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/types/AbldLogMetaDataInput.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/types/AbldLogMetaDataInput.java Wed Dec 23 19:29:07 2009 +0200
@@ -60,36 +60,41 @@
public AbldLogMetaDataInput() {
}
- public boolean isEntryAvailable() {
+ /**
+ * Function to check from the input stream if is there any entries available.
+ * @return true if there are any entry available otherwise false.
+ */
+ public boolean isEntryCreated(File currentFile) {
String exceptions = "";
- int currentFileIndex = getCurrentFileIndex();
int lineNumber = getLineNumber();
BufferedReader currentReader = getCurrentReader();
-
log.debug("Getting next set of log entries for Abld Input");
- //log.debug("currentFileIndex" + currentFileIndex);
- List fileList = getFileList();
- int fileListSize = fileList.size();
- log.debug("fileList.size" + fileListSize);
- while (currentFileIndex < fileListSize) {
- try {
- //log.debug("currentfileindex while getting file name: " + currentFileIndex);
- File currentFile = fileList.get(currentFileIndex);
- if (currentReader == null) {
- lineNumber = 0;
- setLineNumber(lineNumber);
- log.debug("Current abld log file name:" + currentFile);
- log.info("Processing file: " + currentFile);
- currentReader = new BufferedReader(new FileReader(currentFile));
- setCurrentReader(currentReader);
- }
- String logText = null;
- while ((logText = currentReader.readLine()) != null) {
- lineNumber ++;
- setLineNumber(lineNumber);
- logText = logText.replaceFirst("'^\\s*\\[.+?\\]\\s*", "");
- if (logText.startsWith("++ Finished at")) {
- //log.debug("matching finished regex");
+ try {
+ if (currentReader == null) {
+ lineNumber = 0;
+ setLineNumber(lineNumber);
+ log.debug("Current abld log file name:" + currentFile);
+ log.debug("Processing file: " + currentFile);
+ currentReader = new BufferedReader(new FileReader(currentFile));
+ setCurrentReader(currentReader);
+ }
+ String logText = null;
+ while ((logText = currentReader.readLine()) != null) {
+ lineNumber ++;
+ setLineNumber(lineNumber);
+ logText = logText.replaceFirst("'^\\s*\\[.+?\\]\\s*", "");
+ if (logText.startsWith("++ Finished at")) {
+ if (currentComponent != null && !entryCreated) {
+ addEntry("DEFAULT", currentComponent, currentFile.toString(),
+ 0, "" );
+ entryCreated = true;
+ recordText = false;
+ return true;
+ }
+ entryCreated = false;
+ } else if (logText.startsWith("=== ")) {
+ Matcher finishMatch = abldFinishedPattern.matcher(logText);
+ if (finishMatch.matches()) {
if (currentComponent != null && !entryCreated) {
addEntry("DEFAULT", currentComponent, currentFile.toString(),
0, "" );
@@ -98,69 +103,46 @@
return true;
}
entryCreated = false;
- } else if (logText.startsWith("=== ")) {
- //log.debug("trying to match with finish pattern =======");
- Matcher finishMatch = abldFinishedPattern.matcher(logText);
- if (finishMatch.matches()) {
- if (currentComponent != null && !entryCreated) {
- addEntry("DEFAULT", currentComponent, currentFile.toString(),
- 0, "" );
- entryCreated = true;
- recordText = false;
- return true;
- }
- entryCreated = false;
- } else {
- //log.debug("trying to match the start pattern");
- Matcher componentMatch = abldComponentPattern.matcher(logText);
- if (componentMatch.matches()) {
- //log.debug("matched abldComponentPattern");
- currentComponent = componentMatch.group(2);
- recordText = true;
- }
+ } else {
+ Matcher componentMatch = abldComponentPattern.matcher(logText);
+ if (componentMatch.matches()) {
+ currentComponent = componentMatch.group(2);
+ recordText = true;
+ }
- Matcher startMatch = abldStartedPattern.matcher(logText);
- if (startMatch.matches()) {
- //log.debug("matched abldStartedPattern");
- currentComponent = startMatch.group(1);
- recordText = true;
- }
+ Matcher startMatch = abldStartedPattern.matcher(logText);
+ if (startMatch.matches()) {
+ currentComponent = startMatch.group(1);
+ recordText = true;
}
- } else {
- if (recordText) {
- String severity = getSeverity(logText);
- if (severity != null) {
- //log.debug("severity:" + severity);
- //log.debug("currentFile:" + currentFile);
- //log.debug("lineNumber:" + lineNumber);
- //log.debug("logText:" + logText);
- entryCreated = true;
- addEntry(severity, currentComponent, currentFile.toString(),
- lineNumber, logText );
- return true;
- }
+ }
+ } else {
+ if (recordText) {
+ String severity = getSeverity(logText);
+ if (severity != null) {
+ entryCreated = true;
+ addEntry(severity, currentComponent, currentFile.toString(),
+ lineNumber, logText );
+ return true;
}
}
}
- currentReader.close();
- currentReader = null;
- setCurrentReader(currentReader);
- currentFileIndex ++;
- setCurrentFileIndex(currentFileIndex);
- //log.debug("currentfileindex: " + currentFileIndex);
- //log.debug("fileListSize: " + fileListSize);
- } catch (Exception ex) {
- log.debug("Exception in AbldLogMetadata", ex);
- try {
- currentReader.close();
- } catch ( IOException iex) {
- log.debug("Exception in closing reader");
- }
- currentReader = null;
- setCurrentReader(null);
- exceptions = exceptions + ex.getMessage() + "\n";
- return false;
}
+ currentReader.close();
+ currentReader = null;
+ setCurrentReader(currentReader);
+ } catch (Exception ex) {
+ log.debug("Exception in AbldLogMetadata", ex);
+ try {
+ currentReader.close();
+ } catch ( IOException iex) {
+ // We are Ignoring the errors as no need to fail the build.
+ log.debug("Exception in closing reader", iex);
+ }
+ currentReader = null;
+ setCurrentReader(null);
+ exceptions = exceptions + ex.getMessage() + "\n";
+ return false;
}
if (!exceptions.equals("")) {
throw new BuildException(exceptions);
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/types/AntLogMetaDataInput.java
--- a/buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/types/AntLogMetaDataInput.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/types/AntLogMetaDataInput.java Wed Dec 23 19:29:07 2009 +0200
@@ -52,82 +52,69 @@
private boolean entryCreated;
+ /**
+ * Constructor
+ */
public AntLogMetaDataInput() {
}
- public boolean isEntryAvailable() {
+ /**
+ * Function to check from the input stream if is there any entries available.
+ * @return true if there are any entry available otherwise false.
+ */
+ public boolean isEntryCreated(File currentFile) {
String exceptions = "";
- int currentFileIndex = getCurrentFileIndex();
int lineNumber = getLineNumber();
BufferedReader currentReader = getCurrentReader();
- log.debug("Getting next set of log entries for Ant Input");
- //log.debug("currentFileIndex" + currentFileIndex);
- List fileList = getFileList();
- //log.debug("is filelist empty" + fileList.isEmpty());
- int fileListSize = fileList.size();
- log.debug("fileList.size" + fileListSize);
- while (currentFileIndex < fileListSize) {
- try {
- lineNumber ++;
- setLineNumber(lineNumber);
- log.debug("currentfileindex while getting file name: " + currentFileIndex);
- File currentFile = fileList.get(currentFileIndex);
- if (currentReader == null) {
- setLineNumber(0);
- log.debug("Current Text log file name:" + currentFile);
- log.info("Processing file: " + currentFile);
- currentReader = new BufferedReader(new FileReader(currentFile));
- setCurrentReader(currentReader);
- }
- String logText = "";
- while ((logText = currentReader.readLine()) != null) {
- //log.debug("logtext : " + logText + " line-number: " + lineNumber);
- //log.debug("logtext : " + logText + " line-number: " + lineNumber);
- Matcher match = antTargetPattern.matcher(logText);
- if (match.matches()) {
- if (currentComponent != null && !entryCreated) {
- addEntry("DEFAULT", currentComponent, currentFile.toString(),
- 0, "" );
- entryCreated = true;
- return true;
- }
- entryCreated = false;
- currentComponent = match.group(1);
- //log.debug("currentComponent:" + currentComponent);
- }
- logText = logText.replaceFirst("^[ ]*\\[.+?\\][ ]*", "");
- String severity = getSeverity(logText);
- if (severity != null) {
-// log.debug("severity:" + severity);
-// log.debug("currentFile:" + currentFile);
-// log.debug("lineNumber:" + lineNumber);
-// log.debug("logText:" + logText);
+ try {
+ if (currentReader == null) {
+ setLineNumber(0);
+ log.debug("Current Text log file name:" + currentFile);
+ log.debug("Processing file: " + currentFile);
+ currentReader = new BufferedReader(new FileReader(currentFile));
+ setCurrentReader(currentReader);
+ }
+ String logText = "";
+ while ((logText = currentReader.readLine()) != null) {
+ Matcher match = antTargetPattern.matcher(logText);
+ if (match.matches()) {
+ if (currentComponent != null && !entryCreated) {
+ addEntry("DEFAULT", currentComponent, currentFile.toString(),
+ 0, "" );
entryCreated = true;
- // If there is no current component which means
- // it is a redirected output, using file name as comp name
- if (currentComponent == null ) {
- currentComponent = currentFile.getName();
- }
- addEntry(severity, currentComponent, currentFile.toString(),
- lineNumber, logText );
- logText = "";
return true;
}
+ entryCreated = false;
+ currentComponent = match.group(1);
}
+ logText = logText.replaceFirst("^[ ]*\\[.+?\\][ ]*", "");
+ String severity = getSeverity(logText);
+ if (severity != null) {
+ entryCreated = true;
+ // If there is no current component which means
+ // it is a redirected output, using file name as comp name
+ if (currentComponent == null ) {
+ currentComponent = currentFile.getName();
+ }
+ addEntry(severity, currentComponent, currentFile.toString(),
+ lineNumber, logText );
+ logText = "";
+ return true;
+ }
+ }
+ currentReader.close();
+ currentReader = null;
+ setCurrentReader(currentReader);
+ if (isAdditionalEntry()) {
+ return true;
+ }
+ } catch (Exception ex) {
+ log.debug("Exception in AntLogMetadata", ex);
+ try {
currentReader.close();
- currentReader = null;
- setCurrentReader(currentReader);
- currentFileIndex ++;
- setCurrentFileIndex(currentFileIndex);
- //log.debug("currentfileindex: " + currentFileIndex);
- //log.debug("fileListSize: " + fileListSize);
- } catch (Exception ex) {
- log.debug("Exception in AntLogMetadata", ex);
- try {
- currentReader.close();
- } catch ( IOException iex) {
- log.debug("Exception in closing reader");
- }
+ } catch ( IOException iex) {
+ // We are Ignoring the errors as no need to fail the build.
+ log.debug("Exception in closing reader", iex);
currentReader = null;
setCurrentReader(null);
exceptions = exceptions + ex.getMessage() + "\n";
@@ -137,7 +124,6 @@
if (!exceptions.equals("")) {
throw new BuildException(exceptions);
}
-
return false;
}
}
\ No newline at end of file
diff -r be27ed110b50 -r d8ac696cc51f buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/types/LogMetaDataInput.java
--- a/buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/types/LogMetaDataInput.java Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/external/helium-antlib/metadata/src/com/nokia/helium/metadata/ant/types/LogMetaDataInput.java Wed Dec 23 19:29:07 2009 +0200
@@ -43,7 +43,11 @@
private static Logger log = Logger.getLogger(LogMetaDataInput.class);
private Vector fileSetList = new Vector();
+
+ private int currentFileIndex;
+ private boolean entryAddedForLog;
+
private List fileList;
private Vector metadataFilterSets = new Vector();
private Vector completeFilterList;
@@ -54,7 +58,6 @@
public LogMetaDataInput() {
- //initRecordInfo();
}
/**
@@ -83,7 +86,11 @@
add(filterSet);
return filterSet;
}
-
+
+ /**
+ * Helper function to return all the filters associated with this metadata input
+ * @return all the filters merged based on the order of definition.
+ */
private Vector getCompleteFilters()throws Exception {
Vector allFilter = new Vector |