# HG changeset patch # User wbernard # Date 1276696300 -10800 # Node ID c7c26511138fbd7846a2835fd4dea89aa7038ca7 # Parent 85df38eb40125c279225a0186b5ef9c0d0d4fe83 helium-10.0.0-bc45d50958fe diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/builder/build.xml --- a/buildframework/helium/builder/build.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/builder/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -25,7 +25,7 @@ - + + @@ -63,22 +64,26 @@ + + + + @@ -86,6 +91,7 @@ + @@ -94,6 +100,7 @@ + @@ -101,6 +108,7 @@ + @@ -108,6 +116,7 @@ Testing: @{file} + @@ -115,18 +124,23 @@ - + + + - + + + + @@ -141,6 +155,7 @@ + @@ -154,6 +169,7 @@ + @@ -179,7 +195,7 @@ module="helium-${config}-config" revision="1.0" inline="true" type="egg" pattern="${source.root.dir}/external/python/lib/auto/[artifact]-[revision].[ext]" /> - + project: antProject() @@ -254,6 +270,7 @@ + @@ -268,10 +285,12 @@ + + @@ -287,6 +306,7 @@ + @@ -308,4 +328,7 @@ + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/builder/delivery.ant.xml --- a/buildframework/helium/builder/delivery.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/builder/delivery.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -95,29 +95,35 @@ - - - + + + + + + + + - - + + + + + + + + + + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/builder/java/config/java_checkstyle_config.xml --- a/buildframework/helium/builder/java/config/java_checkstyle_config.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/builder/java/config/java_checkstyle_config.xml Wed Jun 16 16:51:40 2010 +0300 @@ -72,7 +72,11 @@ - + + + + + @@ -189,6 +193,13 @@ + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/builder/java/macros.ant.xml --- a/buildframework/helium/builder/java/macros.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/builder/java/macros.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -29,13 +29,16 @@ + + + @@ -45,12 +48,15 @@ + + + Running checkstyle on ${ant.project.name}. @@ -66,6 +72,7 @@ + @@ -75,6 +82,7 @@ + + + + @@ -122,7 +133,7 @@ diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/config/diamonds_config.xml.ftl --- a/buildframework/helium/config/diamonds_config.xml.ftl Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/config/diamonds_config.xml.ftl Wed Jun 16 16:51:40 2010 +0300 @@ -49,6 +49,8 @@ logfile="${ant['temp.build.dir']}/build/doc/ivy/tool-dependencies-${ant['build.type']}.xml" ant-properties="true"/> + + @@ -76,6 +78,9 @@ + + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/config/ivy/ivy.xml --- a/buildframework/helium/config/ivy/ivy.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/config/ivy/ivy.xml Wed Jun 16 16:51:40 2010 +0300 @@ -59,7 +59,7 @@ - + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/config/ivy/modules/ccm-6.5.ivy.xml --- a/buildframework/helium/config/ivy/modules/ccm-6.5.ivy.xml Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ - - - - - - - - - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/config/ivy/modules/ccm-6.5_7.1.ivy.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/config/ivy/modules/ccm-6.5_7.1.ivy.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,31 @@ + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/config/ivy/tools_ivy_settings.xml --- a/buildframework/helium/config/ivy/tools_ivy_settings.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/config/ivy/tools_ivy_settings.xml Wed Jun 16 16:51:40 2010 +0300 @@ -24,6 +24,8 @@ + + @@ -41,7 +43,7 @@ - + @@ -53,21 +55,20 @@ - + target="install" + event="post-download-artifact" + prefix="artifact"/> - - - - + + + + @@ -78,4 +79,11 @@ + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/config/metadata_filter_config_default.ant.xml --- a/buildframework/helium/config/metadata_filter_config_default.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/config/metadata_filter_config_default.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -57,6 +57,11 @@ + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/config/signaling_config_default.ant.xml --- a/buildframework/helium/config/signaling_config_default.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/config/signaling_config_default.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -25,8 +25,6 @@ Definitions of helium signals. - - +<#include "api.ftllib"/> + +<#list doc.antDatabase.antlib as antlib> +<@pp.changeOutputFile name="antlib-${antlib.name}.rst" /> + + +.. index:: + ${antlib.name} + +========================================================== +Antlib ${antlib.name} +========================================================== + +.. contents:: + +:Location: <@helium_api_location_path location="${antlib.location}"/> + +<#if antlib.macro?size > 0> + +Macros +=========== + +<#assign macroCache = {}> +<#list antlib.macro as macro> + <#assign macroCache = macroCache + {macro.name: macro}> + + +<#list macroCache?keys?sort as name> +<#assign macro=macroCache[name]> + +.. index:: + ${macro.name} + +${macro.name} +---------------------------------------------------------- + +<#if macro.deprecated?length > 0> +..warning:: ${macro.deprecated} + + +:Location: <@helium_api_location_path location="${macro.location}"/> +:Scope: ${macro.scope} + +<#recurse macro.documentation> + +**Usage** + +:: + + ${macro.usage?replace("^", " ", "rm")} + +**Source code** + +:: + + ${macro.source?replace("^", " ", "rm")} + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/doc/api_rst/api.ftllib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/doc/api_rst/api.ftllib Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,80 @@ +<#-- +============================================================================ +Name : +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: + +============================================================================ +--> + +<#if ant?keys?seq_contains("tracurl")> + <#assign helium_browser_trunk=ant.tracurl> +<#else> + <#assign helium_browser_trunk=""> + + +<#macro helium_api_location_path location> + <#assign target_line=""/> + <#assign res = location?matches(":(\\d+):$") /> + <#list res as m> + <#assign target_line="#L${m?groups[1]}"/> + + <#assign location_path=location/> + <#if location?index_of("helium\\") > 0> + <#assign location_path=location?substring(location?last_index_of('helium\\'))/> + +<#-- <#assign target_url=location_path?replace("\\", "/")?replace(":(\\d+):", "", 'ri') /> + ${location_path}--> + ``${location_path}`` + + +<#macro helium_project_path location> + <#assign location_path=location/> + <#if location?index_of("helium\\") > 0> + <#assign location_path=location?substring(location?last_index_of('helium\\'))/> + + <#assign target_url=location_path?replace("\\", "/")?replace(":(\\d+):", "", 'ri') /> + ${target_url} + + +<#-- Macros for recursively handling random HTML elements inside documentation elements. --> +<#macro tt> <#recurse> + +<#macro div><#recurse> + +<#macro p><#recurse> + + + +<#macro ul> + +<#recurse> + + + +<#macro li> - <#recurse> + + +<#macro b>**<#recurse>** + +<#macro pre> + + <#recurse> + + + +<#macro @text>${.node?trim} + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/doc/api_rst/index.rst.ftl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/doc/api_rst/index.rst.ftl Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,35 @@ +<#-- +============================================================================ +Name : packages.rst.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: + +============================================================================ +--> +<#include "api.ftllib"/> + +Helium API Packages +============================================ + +.. toctree:: + :maxdepth: 2 + +<#list doc.antDatabase.package as package> + package-${package.name} + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/doc/api_rst/macros_list.rst.ftl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/doc/api_rst/macros_list.rst.ftl Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,43 @@ +<#-- +============================================================================ +Name : macros_list.rst.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: + +============================================================================ +--> + +============= +Macros list +============= + +<#assign macroCache = {}> +<#list doc.antDatabase.project.macro as macro> + <#assign macroCache = macroCache + {macro.name: macro}> + +<#list doc.antDatabase.antlib.macro as macro> + <#assign macroCache = macroCache + {macro.name: macro}> + + +.. csv-table:: Helium macros + :header: "Macro", "Project", "Summary" + +<#list macroCache?keys?sort as name> +<#assign macro=macroCache[name]> + ":hlm-t:`${name}`", "${macro?parent.name}", "${macro.summary?replace("^", " ", "rm")?replace("\"", "\"\"", "rm")?trim}" + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/doc/api_rst/package.rst.ftl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/doc/api_rst/package.rst.ftl Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,49 @@ +<#-- +============================================================================ +Name : package.rst.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: + +============================================================================ +--> +<#include "api.ftllib"/> + +<#list doc.antDatabase.package as package> +<@pp.changeOutputFile name="package-${package.name}.rst" /> + +.. index:: + ${package.name} + +========================================================== +Package ${package.name} +========================================================== + +.. toctree:: + :maxdepth: 2 + +<#assign projectList=package.projectRef.name?sort> +<#list projectList as project> + project-${project} + +<#assign antlibList=package.antlibRef.name?sort> +<#list antlibList as antlib> + antlib-${antlib} + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/doc/api_rst/project.rst.ftl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/doc/api_rst/project.rst.ftl Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,204 @@ +<#-- +============================================================================ +Name : project.rst.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: + +============================================================================ +--> +<#include "api.ftllib"/> + +<#list doc.antDatabase.project as project> +<@pp.changeOutputFile name="project-${project.name}.rst" /> + + +.. index:: + ${project.name} + +========================================================== +Project ${project.name} +========================================================== + +.. contents:: + +:Location: <@helium_api_location_path location="${project.location}"/> + +<#recurse project.description> + +**Project dependencies** + +<#assign filelist = project.projectDependency> +<#list filelist as filelistvar> +- ``${filelistvar}`` + + +Targets +========= + +<#assign targetCache = {}> +<#list project.target as target> + <#assign targetCache = targetCache + {target.name: target}> + + +<#list targetCache?keys?sort as name> +<#assign target=targetCache[name]> + +.. index:: + ${target.name} + +${target.name} +---------------------------------------------------------- + +<#if target.deprecated?length > 0> +..warning:: ${target.deprecated} + + +<#if target.description?length > 0> +:Description: ${target.description} + +:Location: <@helium_api_location_path location="${target.location}"/> +:Scope: ${target.scope} +<#if target.ifDependency?length > 0> +:Condition: Target **is** run if property defined: :hlm-p:`${target.ifDependency}` + +<#if target.unlessDependency?length > 0> +:Condition: Target **is not** run if property defined: ``${target.unlessDependency}`` + + +<#recurse target.documentation> + +<#assign propertyList=target.propertyDependency?sort> +<#if propertyList?size > 0> +**Property dependencies** + +<#list propertyList as property> +- :hlm-p:`${property}` + + + + +**Target dependencies** + +.. raw:: html + + target-${target.name} + + +.. raw:: html + :file: ../../api/helium/target-${target.name}.dot.cmap + +.. raw:: html + + + +**Source code** + +:: + + ${target.source?replace("^", " ", "rm")} + + + + +<#if project.property?size > 0> + +Properties +=========== + +<#assign propertyCache = {}> +<#list project.property as property> + <#assign propertyCache = propertyCache + {property.name: property}> + + +<#list propertyCache?keys?sort as name> +<#assign property=propertyCache[name]> + +.. index:: + ${property.name} + +${property.name} +---------------------------------------------------------- + +<#if property.deprecated?length > 0> +..warning:: ${property.deprecated} + + +:Location: <@helium_api_location_path location="${property.location}"/> +:Type: ${property.type} +:Scope: ${property.scope} +:Editable: ${property.editable} +<#if property.defaultValue?size > 1> +:Default value: ``${property.defaultValue}`` + + +<#recurse property.documentation> + +**Source code** + +:: + + ${property.source} + + + + +<#if project.macro?size > 0> + +Macros +=========== + +<#assign macroCache = {}> +<#list project.macro as macro> + <#assign macroCache = macroCache + {macro.name: macro}> + + +<#list macroCache?keys?sort as name> +<#assign macro=macroCache[name]> + +.. index:: + ${macro.name} + +${macro.name} +---------------------------------------------------------- + +<#if macro.deprecated?length > 0> +..warning:: ${macro.deprecated} + + +:Location: <@helium_api_location_path location="${macro.location}"/> +:Scope: ${macro.scope} + +<#recurse macro.documentation> + +**Usage** + +:: + + ${macro.usage?replace("^", " ", "rm")} + +**Source code** + +:: + + ${macro.source?replace("^", " ", "rm")} + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/doc/api_rst/properties_list.rst.ftl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/doc/api_rst/properties_list.rst.ftl Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,40 @@ +<#-- +============================================================================ +Name : properties_list.rst.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: + +============================================================================ +--> + +=============== +Properties list +=============== + +<#assign propertyCache = {}> +<#list doc.antDatabase.project.property as property> + <#assign propertyCache = propertyCache + {property.name: property}> + + +.. csv-table:: Helium properties + :header: "Property", "Project", "Summary" + +<#list propertyCache?keys?sort as name> +<#assign property=propertyCache[name]> + ":hlm-t:`${name}`", "${property?parent.name}", "${property.summary?replace("^", " ", "rm")?replace("\"", "\"\"", "rm")?trim}" + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/doc/api_rst/target-dependencies.dot.ftl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/doc/api_rst/target-dependencies.dot.ftl Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,105 @@ +<#-- +============================================================================ +Name : +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: + +============================================================================ +--> +<#list doc.antDatabase.project as project> +<#list project.target as target> +<@pp.changeOutputFile name="target-${target.name}.dot" /> + +strict digraph G { + rankdir=LR; + rotate=180; + ordering=out; +<#assign currentTarget = target.name> + +<#macro targetFunc targetMain caller> +<#-- Define the targets that call this target. --> +<#if caller == 0> + "${targetMain.name}" [fontcolor=blue,fontsize=12,shape=box,style=filled,href="project-${targetMain?parent.name}.html#${targetMain.name}"]; + <#list doc.antDatabase.project.target as callingTarget> + <#list callingTarget.dependency as dependency> + <#if targetMain.name == dependency> + <#if callingTarget.name != currentTarget> + "${callingTarget.name}" [fontcolor=brown,fontsize=12,shape=box,href="project-${callingTarget?parent.name}.html#${callingTarget.name}"]; + + <#if dependency.@type == "direct"> + "${callingTarget.name}" -> "${targetMain.name}" [color=navyblue,fontsize=12]; + + <#if dependency.@type == "exec"> + "${callingTarget.name}" -> "${targetMain.name}" [color=limegreen,fontsize=12]; + + + + + +<#if caller == 1> + "${targetMain.name}" [fontcolor=brown,fontsize=12,shape=box,href="project-${targetMain?parent.name}.html#${targetMain.name}"]; + + +<#if targetMain.dependency?size == 1> + <#list targetMain.dependency as dependency> + "${dependency}" [fontcolor=brown,fontsize=12,shape=box,href="project-${targetMain?parent.name}.html#${dependency}"]; + + + +<#assign depTotal=targetMain.dependency?size> +<#assign depLastIndex=targetMain.dependency?size-1> + +<#if depTotal > 1> + <#list 0..depLastIndex as index> + <#if targetMain.dependency[index].@type == "direct"> + "${targetMain.name}" -> "${targetMain.dependency[index]}" [color=navyblue,label="${index+1}",fontsize=12]; + + <#if targetMain.dependency[index].@type == "exec"> + "${targetMain.name}" -> "${targetMain.dependency[index]}" [color=limegreen,label="${index+1}",fontsize=12]; + + <#list doc.antDatabase.project.target as targetDep> + <#if targetDep.name == targetMain.dependency[index]> + <@targetFunc targetMain=targetDep caller=1 /> + + + + + +<#attempt> +<#if depTotal == 1> + <#if targetMain.dependency.@type == "direct"> + "${targetMain.name}" -> "${targetMain.dependency[depTotal-1]}" [color=navyblue]; + + <#if targetMain.dependency.@type == "exec"> + "${targetMain.name}" -> "${targetMain.dependency[depTotal-1]}" [color=limegreen]; + + <#list doc.antDatabase.project.target as targetDep> + <#if targetDep.name == targetMain.dependency> + <@targetFunc targetMain=targetDep caller=1 /> + + + +<#recover> + + + + + +<@targetFunc targetMain=target caller=0 /> +} + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/doc/api_rst/targets_list.rst.ftl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/doc/api_rst/targets_list.rst.ftl Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,40 @@ +<#-- +============================================================================ +Name : targets_list.rst.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: + +============================================================================ +--> + +============= +Targets list +============= + +<#assign targetCache = {}> +<#list doc.antDatabase.project.target as target> + <#assign targetCache = targetCache + {target.name: target}> + + +.. csv-table:: Helium targets + :header: "Target", "Project", "Summary" + +<#list targetCache?keys?sort as name> +<#assign target=targetCache[name]> + ":hlm-t:`${name}`", "${target?parent.name}", "${target.summary?replace("^", " ", "rm")?replace("\"", "\"\"", "rm")?trim}" + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/doc/src/.templates/indexcontent.html.ftl --- a/buildframework/helium/doc/src/.templates/indexcontent.html.ftl Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/doc/src/.templates/indexcontent.html.ftl Wed Jun 16 16:51:40 2010 +0300 @@ -40,7 +40,7 @@ + or check Targets, Properties, Macros

- + ${macro.summary} + ${wiki(macro.documentation)} <#list macro.signals as signal> @@ -38,18 +38,17 @@ ${macro.source}]]> - - + <#list projects as project> ${project.name} ${project.default} - + ${wiki(project.description)} ${project.scope} ${project.deprecated} ${project.location} - - + ${project.summary} + ${wiki(project.documentation)} <#list project.projectDependencies as dependency> ${dependency} @@ -66,12 +65,12 @@ ${target.name} ${target.if} ${target.unless} - + ${target.description} ${target.scope} ${target.deprecated} ${target.location} - - + ${target.summary} + ${wiki(target.documentation)} <#list target.depends as dependency> ${dependency} @@ -111,8 +110,8 @@ ${property.scope} ${property.deprecated} ${property.location} - - + ${property.summary} + ${wiki(property.documentation)}
@@ -127,8 +126,8 @@ ${property.scope} ${property.deprecated} ${property.location} - - + ${property.summary} + ${wiki(property.documentation)}
diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/AntFile.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/AntFile.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* - * 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.antlint; - -import java.util.ArrayList; - -/** - * AntFile is used to hold information about the antlint checkings - * such as number of errors and warnings found for the given ant file. - * - */ -public class AntFile implements Comparable { - private String name; - private int warningCount; - private int errorCount; - - private ArrayList propertiesVisited = new ArrayList(); - - /** - * Create an instance of {@link AntFile}. - * - * @param name - * is the name of the Ant file. - */ - public AntFile(String name) { - this.name = name; - } - - /** - * Increment warnings count by one. - */ - public void incrementWarningCount() { - warningCount++; - } - - /** - * Return total number of warnings found. - * - * @return the total number of warnings. - */ - public int getWarningCount() { - return warningCount; - } - - /** - * Increment error count by one. - */ - public void incrementErrorCount() { - errorCount++; - } - - /** - * Return total number of errors found. - * - * @return the total number of errors. - */ - public int getErrorCount() { - return errorCount; - } - - /** - * Mark the given property as visited. - * - * @param propertyName - * is the property to be marked. - */ - public void markPropertyAsVisited(String propertyName) { - propertiesVisited.add(propertyName); - } - - /** - * Check whether the given property is already visited or not. - * - * @param propertyName - * is the property to lookup for. - * @return true if the property is marked visited; otherwise false. - */ - public boolean isPropertyVisited(String propertyName) { - return propertiesVisited.contains(propertyName); - } - - /** - * Return a string representation of this object. - * - * @return a string representation of this object. - */ - public String toString() { - return errorCount + " errors and " + warningCount + " warnings " + name; - } - - /** - * {@inheritDoc} - */ - public int compareTo(AntFile otherAntFile) { - return new Integer(otherAntFile.getWarningCount()) - .compareTo(new Integer(this.warningCount)) - * -1; - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/AntLintHandler.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/AntLintHandler.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/AntLintHandler.java Wed Jun 16 16:51:40 2010 +0300 @@ -20,7 +20,8 @@ import org.xml.sax.Locator; import org.xml.sax.helpers.DefaultHandler; -import com.nokia.helium.antlint.checks.Check; +import com.nokia.helium.antlint.ant.types.AbstractCheck; +import com.nokia.helium.antlint.ant.types.Check; /** * AntLintHandler is an SAX2 event handler class used to check for @@ -46,7 +47,7 @@ * @param check * is the check to be performed. */ - public AntLintHandler(Check check) { + public AntLintHandler(AbstractCheck check) { super(); this.check = check; } @@ -66,13 +67,6 @@ } /** - * {@inheritDoc} - */ - public void endDocument() { - - } - - /** * Set whether the handler should check for indentation or not. * * @param indentationCheck @@ -125,7 +119,9 @@ private void checkIndent() { if (indentationCheck) { if ((indentSpace != indentLevel) && !textElement) { - check.log(locator.getLineNumber() + ": Bad indentation!"); + check.getReporter().report(check.getSeverity(), + "Bad indentation", check.getAntFile(), + locator.getLineNumber()); } } } @@ -147,24 +143,25 @@ int numSpaces = 0; for (int i = 0; i < strBuff.length(); i++) { switch (strBuff.charAt(i)) { - case '\t': - numSpaces += 4; - if (tabCharacterCheck) { - check.log(locator.getLineNumber() - + ": Tabs should not be used!"); - } - break; - case '\n': - numSpaces = 0; - break; - case '\r': - break; - case ' ': - numSpaces++; - break; - default: - textElement = true; - break; + case '\t': + numSpaces += 4; + if (tabCharacterCheck) { + check.getReporter().report(check.getSeverity(), + "Tabs should not be used!", check.getAntFile(), + locator.getLineNumber()); + } + break; + case '\n': + numSpaces = 0; + break; + case '\r': + break; + case ' ': + numSpaces++; + break; + default: + textElement = true; + break; } } indentSpace = numSpaces; diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/AntProjectVisitor.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/AntProjectVisitor.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* - * 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.antlint; - -import java.util.Collection; - -import org.dom4j.Element; -import org.dom4j.VisitorSupport; - -import com.nokia.helium.antlint.checks.Check; - -/** - * AntProjectVisitor extends {@link VisitorSupport} and is used to - * visit the various nodes of the given project and run the antlint checklist - * against those nodes. - * - */ -public class AntProjectVisitor extends VisitorSupport { - - private Collection checks; - - /** - * Create an instance of {@link AntProjectVisitor}. - * - * @param checks is the antlint checklist. - */ - public AntProjectVisitor(Collection checks) { - this.checks = checks; - } - - /** - * Visit the given node and run the antlint checklist. - */ - public void visit(Element node) { - for (Check check : checks) { - if (check.isEnabled()) - check.run(node); - } - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/AntlintException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/AntlintException.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.antlint.ant; + +/** + * Exception class for Antlint implementation + * + */ +public class AntlintException extends Exception { + + private static final long serialVersionUID = 3420280191500760182L; + + /** + * Constructor. + * + * @param message + */ + public AntlintException(String message) { + super(message); + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/Reporter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/Reporter.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,59 @@ +/* + * 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.antlint.ant; + +import java.io.File; + +import org.apache.tools.ant.Task; + +/** + * To report the antlint errors into antlint task. + */ + +public interface Reporter { + + /** + * Open the reporting session. + * Ant attribute validation should preferably + * happen here. + * + */ + void open(); + + /** + * Closing the reporting session. + */ + void close(); + + /** + * To report the errors into antlint task. + * + * @param severity + * @param message + * @param filename + * @param lineNo + */ + void report(Severity severity, String message, File filename, int lineNo); + + /** + * To set the task calling reporter. + * + * @param task + */ + void setTask(Task task); + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/Severity.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/Severity.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,38 @@ +/* + * 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.antlint.ant; + +import org.apache.tools.ant.types.EnumeratedAttribute; + +/** + * To store the antlint severties. + */ +public class Severity extends EnumeratedAttribute { + + private static final String[] VALUES = { "error", "warning" }; + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.EnumeratedAttribute#getValues() + */ + @Override + public String[] getValues() { + return VALUES; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/antlib.xml --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/antlib.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/antlib.xml Wed Jun 16 16:51:40 2010 +0300 @@ -24,7 +24,30 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/taskdefs/AntLintTask.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/taskdefs/AntLintTask.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/taskdefs/AntLintTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -19,24 +19,17 @@ import java.io.File; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Vector; - import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; -import org.dom4j.Document; -import org.dom4j.Element; -import org.dom4j.Visitor; -import org.dom4j.io.SAXReader; -import org.dom4j.DocumentException; - -import com.nokia.helium.antlint.AntFile; -import com.nokia.helium.antlint.AntProjectVisitor; -import com.nokia.helium.antlint.ant.types.Checker; -import com.nokia.helium.antlint.checks.Check; +import com.nokia.helium.antlint.ant.AntlintException; +import com.nokia.helium.antlint.ant.Reporter; +import com.nokia.helium.antlint.ant.Severity; +import com.nokia.helium.antlint.ant.types.Check; +import com.nokia.helium.antlint.ant.types.ConsoleReporter; /** * AntLint Task. This task checks for common coding conventions and errors in @@ -56,8 +49,6 @@ *
  • CheckPresetDefMacroDefName : checks the naming convention of presetdef * and macrodef
  • *
  • CheckProjectName : checks the naming convention of project
  • - *
  • CheckPropertiesInDataModel : checks whether the properties are defined in - * data model
  • *
  • CheckPropertyName : checks the naming convention of properties
  • * *
  • CheckPythonTasks : checks the coding convention of python tasks
  • @@ -94,34 +85,23 @@ * <include name="*build.xml"/> * <include name="*.antlib.xml"/> * </fileset> - * <checker name="CheckTabCharacter" severity="error" /> - * . - * . - * <checker name="CheckTargetName" severity="warning">([a-z0-9[\\d\\-]]*)</checker> + * <CheckTabCharacter" severity="error" enabled="true"/> + * <CheckTargetName" severity="warning&quot enabled="true" regexp="([a-z0-9[\\d\\-]]*)"/> + * <CheckScriptDef" severity="error" enabled="true" outputDir="${antlint.test.dir}/output"/> * </antlint> * * * @ant.task name="antlint" category="AntLint" * */ -public class AntLintTask extends Task { - - private List checkerList = new Vector(); - private List antFileSetList = new ArrayList(); - - private List antFilelist = new ArrayList(); - private List checkList = new ArrayList(); +public class AntLintTask extends Task implements Reporter { - /** - * Add the given {@link Checker} to the checklist. - * - * @param checker - * is the checker to be added. - * @ant.required - */ - public void addChecker(Checker checker) { - checkerList.add(checker); - } + private List checkerList = new Vector(); + private List antFileSetList = new ArrayList(); + private List reporters = new ArrayList(); + private int errorCount; + private boolean failOnError = true; + private ConsoleReporter consoleReporter = new ConsoleReporter(); /** * Add a set of files to copy. @@ -138,117 +118,50 @@ * Execute the antlint task. */ public final void execute() { + if (checkerList.size() == 0) { + throw new BuildException("No antlint checks are defined."); + } try { - initialize(); - startAntLintCheck(); // trigger antlint checking - } catch (DocumentException e) { + // Adding console reported by default if no + // other reporter are mentioned. + if (reporters.size() == 0) { + reporters.add(consoleReporter); + } + setTask(this); + open(); + doAntLintCheck(); + } catch (AntlintException e) { throw new BuildException( "Exception occured while running AntLint task " + e.getMessage()); + } finally { + // Closing all reporter session. + close(); } - int errorCount = 0; - for (AntFile antFile : antFilelist) { - errorCount = errorCount + antFile.getErrorCount(); - log(antFile.toString()); - } - if (errorCount > 0) { - throw new BuildException(errorCount + " errors found."); + if (failOnError && (errorCount > 0)) { + throw new BuildException("Build failed because of AntLint errors."); } - } - - /** - * Initialize the checklist setting the checkers against their corresponding - * Checks. - */ - private void initialize() { - Check check = null; - for (Checker checker : checkerList) { - check = getCheckObject(checker.getName()); - if (check != null) { - check.setChecker(checker); - checkList.add(check); - } - } - } - /** - * Instantiate the given {@link Check}. - * - * @param checkerName - * is the name of the Check object to be instantiated. - * @return an instance of requested {@link Check}. - */ - @SuppressWarnings("unchecked") - private Check getCheckObject(String checkerName) { - Check check = null; - try { - Class clazz = Class.forName("com.nokia.helium.antlint.checks." - + checkerName); - if (clazz != null) { - check = (Check) clazz.newInstance(); - } - } catch (ClassNotFoundException th) { - throw new BuildException("Error in Antlint configuration-ClassNotFoundException:", th); - } catch (InstantiationException th) { - throw new BuildException("Error in Antlint configuration-InstantiationException:", th); - } catch (IllegalAccessException th) { - throw new BuildException("Error in Antlint configuration-IllegalAccessException:", th); - } - return check; } /** * Triggers the antlint checking. * + * @throws AntlintException + * * @throws Exception * if the checking fails. */ - private void startAntLintCheck() throws DocumentException { - runOneTimeCheck(); + private void doAntLintCheck() throws AntlintException { for (FileSet fs : antFileSetList) { DirectoryScanner ds = fs.getDirectoryScanner(getProject()); String[] srcFiles = ds.getIncludedFiles(); String basedir = ds.getBasedir().getPath(); - for (int i = 0; i < srcFiles.length; i++) { - String antFileName = basedir + File.separator + srcFiles[i]; - getProject().log("*************** Ant File: " + antFileName); - - run(antFileName); - - SAXReader saxReader = new SAXReader(); - Document doc = saxReader.read(new File(antFileName)); - treeWalk(doc); - } - Collections.sort(antFilelist); - } - } - - /** - * Parse the given document. - * - * @param document - * is the document to be parsed. - */ - private void treeWalk(final Document document) { - Element rootElement = document.getRootElement(); - Visitor visitorRootElement = new AntProjectVisitor(checkList); - rootElement.accept(visitorRootElement); - } - - /** - * Runs one time antlint checks. - * - */ - private void runOneTimeCheck() { - AntFile antFile = new AntFile("General"); - antFilelist.add(antFile); - for (Check check : checkList) { - if (check.isEnabled()) { - check.setAntFile(antFile); - check.run(); + String antFilename = basedir + File.separator + srcFiles[i]; + runChecks(new File(antFilename)); } } } @@ -258,15 +171,89 @@ * * @param antFileName * is the name of the ant file to be checked. + * @throws AntlintException */ - private void run(String antFileName) { - AntFile antFile = new AntFile(antFileName); - antFilelist.add(antFile); - for (Check check : checkList) { + private void runChecks(File antFilename) throws AntlintException { + for (Check check : checkerList) { if (check.isEnabled()) { - check.setAntFile(antFile); - check.run(antFileName); + check.validateAttributes(); + check.setReporter(this); + check.run(antFilename); } } + } + + /** + * To add Antlint checkers. + * + * @param c + */ + public void add(Check c) { + checkerList.add(c); + } + + /** + * To add reporters. + * + * @param reporter + */ + public void add(Reporter reporter) { + reporter.setTask(this); + reporters.add(reporter); + } + + /** + * @param failOnError + * the failOnError to set + */ + public void setFailOnError(boolean failOnError) { + this.failOnError = failOnError; + } + + /* + * (non-Javadoc) + * + * @see + * com.nokia.helium.antlint.ant.Reporter#report(com.nokia.helium.antlint + * .ant.Severity, java.lang.String, java.io.File, int) + */ + public void report(Severity severity, String message, File filename, + int lineNo) { + if (severity.getValue().toUpperCase().equals("ERROR")) { + errorCount++; + } + + for (Reporter reporter : reporters) { + reporter.report(severity, message, filename, lineNo); + } + } + + /* + * (non-Javadoc) + * + * @see + * com.nokia.helium.antlint.ant.Reporter#setTask(org.apache.tools.ant.Task) + */ + @Override + public void setTask(Task task) { + for (Reporter reporter : reporters) { + reporter.setTask(task); + } + } + + @Override + public void close() { + for (Reporter reporter : reporters) { + reporter.close(); + } + } + + @Override + public void open() { + for (Reporter reporter : reporters) { + reporter.open(); + } + } + } \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/AbstractCheck.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/AbstractCheck.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.antlint.ant.types; + +import java.util.List; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.types.DataType; +import org.dom4j.Element; +import org.dom4j.Node; +import com.nokia.helium.antlint.ant.Reporter; +import com.nokia.helium.antlint.ant.Severity; + +/** + * AbstractCheck is an abstract implementation of {@link Check}. + * + */ +public abstract class AbstractCheck extends DataType implements Check { + + private boolean enabled; + private Severity severity; + private Reporter reporter; + + /** + * @param enabled + * the enabled to set + */ + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + /** + * {@inheritDoc} + */ + public boolean isEnabled() { + return enabled; + } + + /* + * (non-Javadoc) + * + * @see + * com.nokia.helium.antlint.ant.types.Check#setReporter(com.nokia.helium + * .antlint.ant.Reporter) + */ + public void setReporter(Reporter reporter) { + this.reporter = reporter; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getReporter() + */ + public Reporter getReporter() { + return this.reporter; + } + + /* + * (non-Javadoc) + * + * @see + * com.nokia.helium.antlint.ant.types.Check#setSeverity(com.nokia.helium + * .antlint.ant.Severity) + */ + public void setSeverity(Severity severity) { + this.severity = severity; + + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getSeverity() + */ + public Severity getSeverity() { + return severity; + } + + /** + * {@inheritDoc} + */ + public void run(Element node) { + // ignore + } + + /** + * Return the nodes matching search element. + * + * @param element + * @param elementName + * @param returnNodes + */ + public void elementTreeWalk(Element element, String elementName, + List returnNodes) { + for (int i = 0, size = element.nodeCount(); i < size; i++) { + Node node = element.node(i); + if (node instanceof Element) { + if (node.getName().equals(elementName)) { + returnNodes.add((Element) node); + } + elementTreeWalk((Element) node, elementName, returnNodes); + } + } + } + + /** + * To validate checker attributes. + * + * @return + */ + public void validateAttributes() { + if (severity == null) { + throw new BuildException( + "'severity' attribute should be specified for checker '" + + this.toString() + "'"); + } + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/AbstractScriptCheck.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/AbstractScriptCheck.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,111 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.io.IOException; + +import org.apache.tools.ant.BuildException; + +/** + * AbstractScriptCheck is an abstract implementation of + * {@link Check} and contains some concrete methods related to script. + * + */ +public abstract class AbstractScriptCheck extends AbstractCheck { + + /** + * Write a script with the given name and the text. + * + * @param name + * is the name of the script + * @param text + * is the script text. + */ + protected void writeJythonFile(String name, String text, File outputDir) { + if (outputDir == null) { + throw new BuildException("'output' attribute for the checker '" + + this.toString() + "' should be specified."); + } + if (text.contains("${")) { + this.getReporter().report(this.getSeverity(), + "${ found in " + name, this.getAntFile(), 0); + } + try { + String heliumpath = outputDir.getCanonicalPath(); + new File(heliumpath + File.separator + "jep").mkdirs(); + File file = new File(heliumpath + File.separator + "jep" + + File.separator + name + "_jep.py"); + PrintWriter output = new PrintWriter(new FileOutputStream(file)); + output.write("def abc():\n"); + output.write(" attributes = {} # pylint: disable-msg=C0103\n"); + output.write(" elements = {} # pylint: disable-msg=C0103\n"); + output.write(" project = None # pylint: disable-msg=C0103\n"); + output.write(" self = None # pylint: disable-msg=C0103\n"); + text = text.replace(" File(", " self.File("); + for (String line : text.split("\n")) { + output.write(" " + line + "\n"); + } + output.close(); + + if (text.contains("import ")) { + File file2 = new File(heliumpath + File.separator + + "test_jython.xml"); + PrintWriter output2 = new PrintWriter(new FileOutputStream( + file2, true)); + output2.write("try:\n"); + for (String line : text.split("\n")) { + if (line.trim().startsWith("import ") + || line.trim().startsWith("from ")) + output2.write(" " + line + "\n"); + } + + output2.write("except ImportError, e:\n"); + output2.write(" print '" + name + " failed: ' + str(e)\n"); + output2.close(); + } + } catch (IOException e) { + throw new BuildException("Not able to write JEP File " + name + + "_jep.py"); + } + } + + /** + * Check for the properties in the given script text. + * + * @param text + * is the script text to lookup. + */ + protected void checkJepPropertiesInText(String text) { + Pattern p1 = Pattern + .compile("getProperty\\([\"']([a-zA-Z0-9\\.]*)[\"']\\)"); + Matcher m1 = p1.matcher(text); + ArrayList props = new ArrayList(); + while (m1.find()) { + props.add(m1.group(1)); + } + /* + * for (String group : props) { checkPropertyInModel(group); } + */ + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/Check.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/Check.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,113 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; + +import org.dom4j.Element; + +import com.nokia.helium.antlint.ant.AntlintException; +import com.nokia.helium.antlint.ant.Reporter; +import com.nokia.helium.antlint.ant.Severity; + +/** + * Check represents a basic antlint component responsible for + * running the user configured checks. + * + */ +public interface Check { + + /** + * Method runs the configured checks against the given node. + * + * @param node + * is the node of the xml to be checked. + */ + void run(Element node); + + /** + * Method runs the configured checks against the given ant file. + * + * @param fileName + * is the name of the ant file. + * @param reporter + * @throws AntlintException + */ + void run(File fileName) throws AntlintException; + + /** + * Return whether this is check is enabled or not. + * + * @return true if a checker is available for this check; otherwise false. + */ + boolean isEnabled(); + + /** + * To set the checker enabled. + * + * @param enabled + */ + void setEnabled(boolean enabled); + + /** + * To set checker Severity. + * + * @param severity + */ + void setSeverity(Severity severity); + + /** + * To return current severity. + * + * @return + */ + Severity getSeverity(); + + /** + * To validate the attributes passed. + */ + void validateAttributes(); + + /** + * To set the reporter. + * + * @param reporter + */ + void setReporter(Reporter reporter); + + /** + * To get the current reporter. + * + * @return + */ + Reporter getReporter(); + + /** + * Return ant file. + * + * @return + */ + File getAntFile(); + + /** + * To return current checker name. + * + * @return + */ + String toString(); + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckAntCall.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckAntCall.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,150 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.tools.ant.Target; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckAntCall is used to check whether antcall is used with no + * param elements and calls the target with no dependencies + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckAntCall" severity="error" enabled="true"/>
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckAntCall" category="AntLint" + */ +public class CheckAntCall extends AbstractCheck { + + private File antFile; + + /** + * {@inheritDoc} + */ + public void run(Element node) { + if (node.getName().equals("target")) { + checkAntCalls(node); + } + } + + /** + * Check against the given node. + * + * @param node + * is the node to check. + */ + @SuppressWarnings("unchecked") + private void checkAntCalls(Element node) { + if (node.elements("antcall") != null) { + List antcallList = node.elements("antcall"); + for (Element antcallElement : antcallList) { + String antcallName = antcallElement.attributeValue("target"); + if (((node.elements("param") == null) || (node + .elements("param") != null && node.elements("param") + .isEmpty())) + && !checkTargetDependency(antcallName)) { + this + .getReporter() + .report( + this.getSeverity(), + " is used with no param elements and calls the target " + + antcallName + + " that has no dependencies! ( could be used instead.)", + this.getAntFile(), 0); + } + } + } + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + List targetNodes = new ArrayList(); + + try { + doc = saxReader.read(antFilename); + elementTreeWalk(doc.getRootElement(), "target", targetNodes); + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + + for (Element targetNode : targetNodes) { + run(targetNode); + } + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckAntCall"; + } + + /** + * Check the availability dependent targets of the given target. + * + * @param targetName + * is the target for which dependent targets to be loked up. + * @return true, if the dependant targets are available; otherwise false + */ + private boolean checkTargetDependency(String targetName) { + boolean dependencyCheck = false; + Target targetDependency = (Target) getProject().getTargets().get( + targetName); + dependencyCheck = targetDependency != null + && targetDependency.getDependencies().hasMoreElements(); + return dependencyCheck; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckDescription.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckDescription.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,97 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckDescription is used to check whether project description is + * present or not. + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckDescription" severity="error" enabled="true"/>
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckDescription" category="AntLint" + */ +public class CheckDescription extends AbstractCheck { + + private File antFile; + + /** + * {@inheritDoc} + */ + public void run(Element node) { + if (node.getName().equals("project") + && node.element("description") == null) { + this.getReporter().report(this.getSeverity(), + "Description not specified!", this.getAntFile(), 0); + } + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + try { + doc = saxReader.read(antFilename); + run(doc.getRootElement()); + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckDescription"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckDuplicateNames.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckDuplicateNames.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.antlint.ant.types; + +import java.io.File; +import java.util.ArrayList; +import java.util.Hashtable; + +/** + * CheckDuplicateNames is used to check for duplicate macro names. + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckDuplicateNames" severity="error" enabled="true"/>
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckDuplicateNames" category="AntLint" + */ +public class CheckDuplicateNames extends AbstractCheck { + + private File antFile; + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + @SuppressWarnings("unchecked") + public void run(File antFilename) { + this.antFile = antFilename; + Hashtable> taskdefs = getProject() + .getTaskDefinitions(); + ArrayList macros = new ArrayList(taskdefs.keySet()); + + for (String macroName : macros) { + if (macros.contains(macroName + "Macro") + || macros.contains(macroName + "macro")) + this.getReporter() + .report( + this.getSeverity(), + macroName + " and " + macroName + "Macro" + + " found duplicate name", + this.getAntFile(), 0); + } + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckDuplicateNames"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckFileName.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckFileName.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,103 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * CheckFileName is used to check the naming convention of the ant + * files. + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckFileName" severity="error" enabled="true" regexp="([a-z0-9[\\d\\-]]*)"/>
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckFileName" category="AntLint" + * + */ +public class CheckFileName extends AbstractCheck { + + private String regExp; + private File antFile; + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) { + if (antFilename != null) { + this.antFile = antFilename; + boolean found = false; + Pattern p1 = Pattern.compile(getRegExp()); + Matcher m1 = p1.matcher(antFilename.getName()); + while (m1.find()) { + found = true; + } + if (!found) { + this.getReporter().report(this.getSeverity(), + "INVALID File Name: " + antFilename.getName(), + this.getAntFile(), 0); + } + } + } + + /** + * @param regExp + * the regExp to set + */ + public void setRegExp(String regExp) { + this.regExp = regExp; + } + + /** + * @return the regExp + */ + public String getRegExp() { + return regExp; + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckFileName"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckIndentation.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckIndentation.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,97 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; + +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; +import javax.xml.parsers.ParserConfigurationException; +import org.xml.sax.SAXException; +import java.io.IOException; + +import com.nokia.helium.antlint.AntLintHandler; +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckIndentation is used to check the indentations in the ant + * files. + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckIndentation" severity="error" enabled="true" />
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckIndentation" category="AntLint" + * + */ +public class CheckIndentation extends AbstractCheck { + private File antFile; + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + try { + this.antFile = antFilename; + SAXParserFactory saxFactory = SAXParserFactory.newInstance(); + saxFactory.setNamespaceAware(true); + saxFactory.setValidating(true); + SAXParser parser = saxFactory.newSAXParser(); + AntLintHandler handler = new AntLintHandler(this); + handler.setIndentationCheck(true); + parser.parse(antFilename, handler); + } catch (ParserConfigurationException e) { + throw new AntlintException("Not able to parse XML file " + + e.getMessage()); + } catch (SAXException e) { + throw new AntlintException("Not able to parse XML file " + + e.getMessage()); + } catch (IOException e) { + throw new AntlintException("Not able to find XML file " + + e.getMessage()); + } + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckIndentation"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckJythonScript.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckJythonScript.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,149 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckJepJythonScript is used to check the coding convention in + * Jep and Jython scripts + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckJepJythonScript" severity="error" enabled="true" />
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckJepJythonScript" category="AntLint" + * + */ +public class CheckJythonScript extends AbstractScriptCheck { + + private File outputDir; + private File antFile; + + /** + * {@inheritDoc} + */ + public void run(Element node) { + if (node.getName().equals("target")) { + checkScripts(node); + } + + if (node.getName().equals("scriptdef")) { + String scriptdefname = node.attributeValue("name"); + String language = node.attributeValue("language"); + if (language.equals("jython")) { + writeJythonFile(scriptdefname, node.getText(), outputDir); + } + } + } + + /** + * Check against the given node. + * + * @param node + * is the node to check. + */ + @SuppressWarnings("unchecked") + private void checkScripts(Element node) { + String target = node.attributeValue("name"); + List scriptList = node.selectNodes("//target[@name='" + target + + "']/descendant::script"); + for (Element scriptElement : scriptList) { + String language = scriptElement.attributeValue("language"); + if (language.equals("jython")) { + writeJythonFile("target_" + target, scriptElement.getText(), + outputDir); + } + } + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + List scriptNodes = new ArrayList(); + + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + try { + doc = saxReader.read(antFilename); + elementTreeWalk(doc.getRootElement(), "target", scriptNodes); + elementTreeWalk(doc.getRootElement(), "scriptdef", scriptNodes); + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + for (Element targetNode : scriptNodes) { + run(targetNode); + } + + } + + /** + * @param outputDir + * the outputDir to set + */ + public void setOutputDir(File outputDir) { + this.outputDir = outputDir; + } + + /** + * @return the outputDir + */ + public File getOutputDir() { + return outputDir; + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckJepJythonScript"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckPresetDefMacroDefName.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckPresetDefMacroDefName.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,149 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckPresetDefMacroDefName is used to check the naming + * convention of presetdef and macrodef + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckPresetDefMacroDefName" severity="error" enabled="true" />
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckPresetDefMacroDefName" category="AntLint" + * + */ +public class CheckPresetDefMacroDefName extends AbstractCheck { + + private String regExp; + private File antFile; + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public void run(Element node) { + if (node.getName().equals("presetdef") + || node.getName().equals("macrodef")) { + String text = node.attributeValue("name"); + if (text != null && !text.isEmpty()) { + checkDefName(text); + + } + + List attributeList = node.elements("attribute"); + for (Element attributeElement : attributeList) { + String attributeName = attributeElement.attributeValue("name"); + checkDefName(attributeName); + } + } + } + + /** + * Check the given text. + * + * @param text + * is the text to check. + */ + private void checkDefName(String text) { + Pattern p1 = Pattern.compile(getRegExp()); + Matcher m1 = p1.matcher(text); + if (!m1.matches()) { + this.getReporter().report(this.getSeverity(), + "INVALID PRESETDEF/MACRODEF Name: " + text, + this.getAntFile(), 0); + } + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + List presetDefNodes = new ArrayList(); + try { + doc = saxReader.read(antFilename); + elementTreeWalk(doc.getRootElement(), "presetdef", presetDefNodes); + elementTreeWalk(doc.getRootElement(), "macrodef", presetDefNodes); + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + for (Element presetDefNode : presetDefNodes) { + run(presetDefNode); + } + } + + /** + * @param regExp + * the regExp to set + */ + public void setRegExp(String regExp) { + this.regExp = regExp; + } + + /** + * @return the regExp + */ + public String getRegExp() { + return regExp; + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckPresetDefMacroDefName"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckProjectName.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckProjectName.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,140 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckProjectName is used to check the naming convention of + * project names. + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckProjectName" severity="error" enabled="true" regexp="([a-z0-9[\\d\\-]]*)" />
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckProjectName" category="AntLint" + * + */ +public class CheckProjectName extends AbstractCheck { + private String regExp; + private File antFile; + + /** + * {@inheritDoc} + * + * @throws SAXException + * @throws ParserConfigurationException + */ + public void run(Element node) { + if (node.getName().equals("project")) { + String text = node.attributeValue("name"); + if (text != null && !text.isEmpty()) { + checkProjectName(text); + } else { + this.getReporter().report(this.getSeverity(), + "Project name not specified!", this.getAntFile(), 0); + } + + } + } + + /** + * Check the given the project name. + * + * @param text + * is the text to check. + */ + private void checkProjectName(String text) { + Pattern p1 = Pattern.compile(getRegExp()); + Matcher m1 = p1.matcher(text); + if (!m1.matches()) { + this.getReporter().report(this.getSeverity(), + "INVALID Project Name: " + text, this.getAntFile(), 0); + } + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + try { + doc = saxReader.read(antFilename); + run(doc.getRootElement()); + + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + + } + + /** + * @param regExp + * the regExp to set + */ + public void setRegExp(String regExp) { + this.regExp = regExp; + } + + /** + * @return the regExp + */ + public String getRegExp() { + return regExp; + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckProjectName"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckPropertyName.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckPropertyName.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,163 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.dom4j.Document; + +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckPropertyName is used to check the naming convention of + * property names. + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckPropertyName" severity="error" enabled="true" regexp="([a-z0-9[\\d\\-]]*)" />
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckPropertyName" category="AntLint" + * + */ +public class CheckPropertyName extends AbstractCheck { + + private ArrayList propertiesVisited = new ArrayList(); + private String regExp; + private File antFile; + + /** + * {@inheritDoc} + */ + public void run(Element node) { + if (node.getName().equals("property")) { + String text = node.attributeValue("name"); + if (text != null && !text.isEmpty()) { + checkPropertyName(text); + } + } + } + + /** + * Check the given property name. + * + * @param propertyName + * is the property name to check. + */ + private void checkPropertyName(String propertyName) { + Pattern p1 = Pattern.compile(getRegExp()); + Matcher m1 = p1.matcher(propertyName); + if (!m1.matches() && !isPropertyAlreadyVisited(propertyName)) { + this.getReporter().report(this.getSeverity(), + "INVALID Property Name: " + propertyName, + this.getAntFile(), 0); + markPropertyAsVisited(propertyName); + } + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + List propertyNodes = new ArrayList(); + + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + try { + doc = saxReader.read(antFilename); + elementTreeWalk(doc.getRootElement(), "property", propertyNodes); + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + for (Element propertyNode : propertyNodes) { + run(propertyNode); + } + } + + /** + * Check whether the property is already visited or not. + * + * @param propertyName + * is the property to be checked. + * @return true, if already been visited; otherwise false + */ + private boolean isPropertyAlreadyVisited(String propertyName) { + return propertiesVisited.contains(propertyName); + } + + /** + * Mark the given property as visited. + * + * @param propertyName + * is the property to be marked. + */ + private void markPropertyAsVisited(String propertyName) { + propertiesVisited.add(propertyName); + } + + /** + * @param regExp + * the regExp to set + */ + public void setRegExp(String regExp) { + this.regExp = regExp; + } + + /** + * @return the regExp + */ + public String getRegExp() { + return regExp; + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckPropertyName"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckPythonTasks.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckPythonTasks.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,161 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.List; +import java.io.IOException; + +import org.apache.tools.ant.BuildException; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckPythonTasks is used to the check the coding convention of + * python tasks. + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckPythonTasks" severity="error" enabled="true" outputDir="${antlint.test.dir}/output"/>
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckPythonTasks" category="AntLint" + */ +public class CheckPythonTasks extends AbstractCheck { + + private File outputDir; + private File antFile; + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + public void run(Element node) { + if (node.getName().equals("target")) { + String target = node.attributeValue("name"); + List pythonList = node.selectNodes("//target[@name='" + + target + "']/descendant::*[name()=\"hlm:python\"]"); + int i = 0; + for (Element pythonElement : pythonList) { + writePythonFile(i + "_" + target, pythonElement.getText()); + i++; + } + } + } + + /** + * Writes the given text to a python file. + * + * @param name + * is the name of the file to be written. + * @param text + * is the text to be written inside the file. + */ + private void writePythonFile(String name, String text) { + if (getOutputDir() == null) { + throw new BuildException("'output' attribute for the checker '" + + this.toString() + "' should be specified."); + } + try { + String heliumpath = getOutputDir().getCanonicalPath(); + new File(heliumpath + File.separator + "python").mkdirs(); + File file = new File(heliumpath + File.separator + "python" + + File.separator + "target" + name + ".py"); + PrintWriter output = new PrintWriter(new FileOutputStream(file)); + if (!text.equals("")) { + output.write("def abc():"); + for (String line : text.split("\n")) + output.write(" " + line + "\n"); + } + output.close(); + } catch (IOException e) { + throw new BuildException( + "IOException:Not able to write python file " + name + ".py"); + } + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + List targetNodes = new ArrayList(); + + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + try { + doc = saxReader.read(antFilename); + elementTreeWalk(doc.getRootElement(), "target", targetNodes); + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + for (Element targetNode : targetNodes) { + run(targetNode); + } + + } + + /** + * @param outputDir + * the outputDir to set + */ + public void setOutputDir(File outputDir) { + this.outputDir = outputDir; + } + + /** + * @return the outputDir + */ + public File getOutputDir() { + return outputDir; + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckPythonTasks"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckRunTarget.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckRunTarget.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,145 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.tools.ant.Target; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckRunTarget is used to check whether runtarget calls a target + * that has dependencies. + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckRunTarget" severity="error" enabled="true" />
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckRunTarget" category="AntLint" + * + */ +public class CheckRunTarget extends AbstractCheck { + + private File antFile; + + /** + * {@inheritDoc} + */ + public void run(Element node) { + if (node.getName().equals("target")) { + checkRunTargets(node); + } + } + + /** + * Check against the given node. + * + * @param node + * is the node to check. + */ + @SuppressWarnings("unchecked") + private void checkRunTargets(Element node) { + if (node.elements("runtarget") != null) { + List runTargetList = node.elements("runtarget"); + for (Element runTargetElement : runTargetList) { + String runTargetName = runTargetElement + .attributeValue("target"); + if (checkTargetDependency(runTargetName)) { + this.getReporter().report( + this.getSeverity(), + " calls the target " + runTargetName + + " that has dependencies!", + this.getAntFile(), 0); + } + } + } + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + List targetNodes = new ArrayList(); + + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + try { + doc = saxReader.read(antFilename); + elementTreeWalk(doc.getRootElement(), "target", targetNodes); + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + for (Element targetNode : targetNodes) { + run(targetNode); + } + + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckRunTarget"; + } + + /** + * Check the availability dependent targets of the given target. + * + * @param targetName + * is the target for which dependent targets to be loked up. + * @return true, if the dependant targets are available; otherwise false + */ + private boolean checkTargetDependency(String targetName) { + boolean dependencyCheck = false; + Target targetDependency = (Target) getProject().getTargets().get( + targetName); + dependencyCheck = targetDependency != null + && targetDependency.getDependencies().hasMoreElements(); + return dependencyCheck; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckScriptCondition.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckScriptCondition.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,139 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckScriptCondition is used to check the coding convention in + * script condition + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckScriptCondition" severity="error" enabled="true" />
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckScriptCondition" category="AntLint" + * + */ +public class CheckScriptCondition extends AbstractScriptCheck { + + private File outputDir; + private File antFile; + + /** + * {@inheritDoc} + */ + public void run(Element node) { + if (node.getName().equals("target")) { + checkScriptConditions(node); + } + } + + /** + * Check against the given node. + * + * @param node + * is the node to check. + */ + @SuppressWarnings("unchecked") + private void checkScriptConditions(Element node) { + String target = node.attributeValue("name"); + List scriptList = node.selectNodes("//target[@name='" + target + + "']/descendant::scriptcondition"); + for (Element scriptElement : scriptList) { + String language = scriptElement.attributeValue("language"); + if (language.equals("jython")) { + writeJythonFile("scriptcondition_" + target, scriptElement + .getText(), outputDir); + } + } + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + List targetNodes = new ArrayList(); + + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + try { + doc = saxReader.read(antFilename); + elementTreeWalk(doc.getRootElement(), "target", targetNodes); + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + for (Element targetNode : targetNodes) { + run(targetNode); + } + + } + + /** + * @param outputDir + * the outputDir to set + */ + public void setOutputDir(File outputDir) { + this.outputDir = outputDir; + } + + /** + * @return the outputDir + */ + public File getOutputDir() { + return outputDir; + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckScriptCondition"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckScriptDef.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckScriptDef.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,205 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.io.IOException; + +import org.apache.tools.ant.BuildException; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.Node; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckScriptDef is used to check the coding convention in + * scriptdef. + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckScriptDef" severity="error" enabled="true" outputDir="${antlint.test.dir}/output"/>
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckScriptDef" category="AntLint" + * + */ +public class CheckScriptDef extends AbstractScriptCheck { + + private File outputDir; + private File antFile; + + /** + * {@inheritDoc} + */ + public void run(Element node) { + if (node.getName().equals("scriptdef")) { + String scriptdefname = node.attributeValue("name"); + String language = node.attributeValue("language"); + + checkScriptDef(scriptdefname, node); + + if (language.equals("beanshell")) { + writeBeanshellFile(scriptdefname, node.getText()); + } + } + } + + /** + * Check against the given node. + * + * @param node + * is the node to check. + */ + @SuppressWarnings("unchecked") + public void checkScriptDef(String name, Node node) { + List statements = node.selectNodes("//scriptdef[@name='" + name + + "']/attribute"); + Pattern p1 = Pattern.compile("attributes.get\\([\"']([^\"']*)[\"']\\)"); + Matcher m1 = p1.matcher(node.getText()); + ArrayList props = new ArrayList(); + while (m1.find()) { + props.add(m1.group(1)); + } + + if (!statements.isEmpty() && !props.isEmpty()) { + for (Node statement : statements) { + if (!props.contains(statement.valueOf("@name"))) { + this.getReporter().report( + this.getSeverity(), + "Scriptdef " + name + " does not use " + + statement.valueOf("@name"), + this.getAntFile(), 0); + } + } + } + } + + /** + * Write a bean shell file with the given text. + * + * @param scriptdefname + * is the name of the file to be written. + * @param text + * is the text to be written inside the file. + */ + private void writeBeanshellFile(String scriptdefname, String text) { + if (getOutputDir() == null) { + throw new BuildException("'output' attribute for the checker '" + + this.toString() + "' should be specified."); + } + scriptdefname = "Beanshell" + scriptdefname; + try { + String heliumpath = getOutputDir().getCanonicalPath(); + new File(heliumpath + File.separator + "beanshell").mkdirs(); + File file = new File(heliumpath + File.separator + "beanshell" + + File.separator + scriptdefname + ".java"); + PrintWriter output = new PrintWriter(new FileOutputStream(file)); + + for (String line : text.split("\n")) { + if (line.trim().startsWith("import")) + output.write(line + "\n"); + } + + output.write("/**\n * x\n */\npublic final class " + scriptdefname + + " {\n"); + output.write("private " + scriptdefname + "() { }\n"); + output.write("public static void main(String[] args) {\n"); + for (String line : text.split("\n")) { + if (!line.trim().startsWith("import")) + output.write(line + "\n"); + } + output.write("} }"); + output.close(); + } catch (IOException e) { + throw new BuildException("Not able to write Beanshell File " + + scriptdefname + ".java"); + } + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + + List scriptDefNodes = new ArrayList(); + + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + try { + doc = saxReader.read(antFilename); + elementTreeWalk(doc.getRootElement(), "scriptdef", scriptDefNodes); + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + for (Element scriptDefNode : scriptDefNodes) { + run(scriptDefNode); + } + } + + /** + * @param outputDir + * the outputDir to set + */ + public void setOutputDir(File outputDir) { + this.outputDir = outputDir; + } + + /** + * @return the outputDir + */ + public File getOutputDir() { + return outputDir; + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckScriptDef"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckScriptDefNameAttributes.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckScriptDefNameAttributes.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,136 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.Node; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckScriptDefNameAttributes is used to check the naming + * convention of scriptdef name attributes + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckScriptDefNameAttributes" severity="error" enabled="true" />
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckScriptDefNameAttributes" category="AntLint" + */ +public class CheckScriptDefNameAttributes extends AbstractCheck { + + private File antFile; + + /** + * {@inheritDoc} + */ + public void run(Element node) { + if (node.getName().equals("scriptdef")) { + String scriptdefname = node.attributeValue("name"); + checkScriptDefNameAttributes(scriptdefname, node); + } + } + + /** + * Check against the given node. + * + * @param node + * is the node to check. + */ + @SuppressWarnings("unchecked") + public void checkScriptDefNameAttributes(String name, Node node) { + List statements = node.selectNodes("//scriptdef[@name='" + name + + "']/attribute"); + Pattern p1 = Pattern.compile("attributes.get\\([\"']([^\"']*)[\"']\\)"); + Matcher m1 = p1.matcher(node.getText()); + ArrayList props = new ArrayList(); + while (m1.find()) { + props.add(m1.group(1)); + } + + ArrayList attributes = new ArrayList(); + for (Node statement : statements) { + attributes.add(statement.valueOf("@name")); + } + for (String attribute : props) { + if (!attributes.contains(attribute)) { + this.getReporter().report(this.getSeverity(), + "Scriptdef " + name + " does not have attribute " + attribute, + this.getAntFile(), 0); + } + } + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + + List scriptDefNodes = new ArrayList(); + + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + try { + doc = saxReader.read(antFilename); + elementTreeWalk(doc.getRootElement(), "scriptdef", scriptDefNodes); + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + for (Element scriptDefNode : scriptDefNodes) { + run(scriptDefNode); + } + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckScriptDefNameAttributes"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckScriptDefStyle.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckScriptDefStyle.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.antlint.ant.types; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.Node; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckScriptDefStyle is used to check the coding style of + * scriptdef. + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckScriptDefStyle" severity="error" enabled="true" />
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckScriptDefStyle" category="AntLint" + * + */ +public class CheckScriptDefStyle extends AbstractCheck { + + private File antFile; + + /** + * {@inheritDoc} + */ + public void run(Element node) { + if (node.getName().equals("scriptdef")) { + String scriptdefname = node.attributeValue("name"); + checkScriptDefStyle(scriptdefname, node); + } + } + + /** + * Check against the given node. + * + * @param node + * is the node to check. + */ + @SuppressWarnings("unchecked") + public void checkScriptDefStyle(String name, Node node) { + List statements = node.selectNodes("//scriptdef[@name='" + name + + "']/attribute"); + Pattern p1 = Pattern.compile("attributes.get\\([\"']([^\"']*)[\"']\\)"); + Matcher m1 = p1.matcher(node.getText()); + ArrayList props = new ArrayList(); + while (m1.find()) { + props.add(m1.group(1)); + } + + ArrayList attributes = new ArrayList(); + for (Node statement : statements) { + attributes.add(statement.valueOf("@name")); + } + + if (!statements.isEmpty() && props.isEmpty()) { + this + .getReporter() + .report( + this.getSeverity(), + "Scriptdef " + + name + + " doesn't reference attributes directly, poor style", + this.getAntFile(), 0); + } + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + + List scriptDefNodes = new ArrayList(); + + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + try { + doc = saxReader.read(antFilename); + elementTreeWalk(doc.getRootElement(), "scriptdef", scriptDefNodes); + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + for (Element scriptDefNode : scriptDefNodes) { + run(scriptDefNode); + } + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckScriptDefStyle"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckScriptSize.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckScriptSize.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,131 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.Node; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckScriptSize is used to check the size of script. By default, + * the script should not contain more than 1000 characters. + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckScriptSize" severity="error" enabled="true" />
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckScriptSize" category="AntLint" + * + */ +public class CheckScriptSize extends AbstractCheck { + + private File antFile; + + /** + * {@inheritDoc} + */ + public void run(Element node) { + if (node.getName().equals("target")) { + checkSizeOfScript(node); + } + } + + /** + * Check against the given node. + * + * @param node + * is the node to check. + */ + @SuppressWarnings("unchecked") + private void checkSizeOfScript(Element node) { + String target = node.attributeValue("name"); + + List statements = node.selectNodes("//target[@name='" + target + + "']/script | //target[@name='" + target + + "']/*[name()=\"hlm:python\"]"); + + for (Node statement : statements) { + int size = statement.getText().length(); + if (size > 1000) { + this + .getReporter() + .report( + this.getSeverity(), + "Target " + + target + + " has a script with " + + size + + " characters, code should be inside a python file", + this.getAntFile(), 0); + } + } + } + + public void run(File antFilename) throws AntlintException { + + List targetNodes = new ArrayList(); + + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + try { + doc = saxReader.read(antFilename); + elementTreeWalk(doc.getRootElement(), "target", targetNodes); + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + for (Element targetNode : targetNodes) { + run(targetNode); + } + + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckScriptSize"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckTabCharacter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckTabCharacter.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.antlint.ant.types; + +import java.io.File; +import java.util.List; +import java.io.IOException; + +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; +import javax.xml.parsers.ParserConfigurationException; +import org.xml.sax.SAXException; +import org.dom4j.Element; +import org.dom4j.Node; + +import com.nokia.helium.antlint.AntLintHandler; +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckTabCharacter is used to check the tab characters inside the + * ant files. + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckTabCharacter" severity="error" enabled="true" />
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckTabCharacter" category="AntLint" + * + */ +public class CheckTabCharacter extends AbstractCheck { + + private File antFile; + + /** + * {@inheritDoc} + */ + public void run(Element node) { + checkTabsInScript(node); + } + + /** + * Check against the given node. + * + * @param node + * is the node to check. + */ + @SuppressWarnings("unchecked") + private void checkTabsInScript(Element node) { + if (node.getName().equals("target")) { + String target = node.attributeValue("name"); + + List statements = node.selectNodes("//target[@name='" + + target + "']/script | //target[@name='" + target + + "']/*[name()=\"hlm:python\"]"); + + for (Node statement : statements) { + if (statement.getText().contains("\t")) { + this.getReporter().report(getSeverity(), + "Target " + target + " has a script with tabs", + getAntFile(), 0); + } + } + } + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + try { + this.antFile = antFilename; + SAXParserFactory saxFactory = SAXParserFactory.newInstance(); + saxFactory.setNamespaceAware(true); + saxFactory.setValidating(true); + SAXParser parser = saxFactory.newSAXParser(); + AntLintHandler handler = new AntLintHandler(this); + handler.setTabCharacterCheck(true); + parser.parse(antFilename, handler); + } catch (ParserConfigurationException e) { + throw new AntlintException("Not able to parse XML file " + + e.getMessage()); + } catch (SAXException e) { + throw new AntlintException("Not able to parse XML file " + + e.getMessage()); + } catch (IOException e) { + throw new AntlintException("Not able to find XML file " + + e.getMessage()); + } + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckTabCharacter"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckTargetName.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckTargetName.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,147 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckTargetName is used to check the naming convention of the + * target names. + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckTargetName" severity="error" enabled="true" regexp="([a-z0-9[\\d\\-]]*)" />
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckTargetName" category="AntLint" + * + */ +public class CheckTargetName extends AbstractCheck { + + private String regExp; + private File antFile; + + /** + * {@inheritDoc} + */ + public void run(Element node) { + if (node.getName().equals("target")) { + String target = node.attributeValue("name"); + if (!target.equals("tearDown") && !target.equals("setUp") + && !target.equals("suiteTearDown") + && !target.equals("suiteSetUp")) { + checkTargetName(target); + } + } + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + + List targetNodes = new ArrayList(); + + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + try { + doc = saxReader.read(antFilename); + elementTreeWalk(doc.getRootElement(), "target", targetNodes); + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + for (Element targetNode : targetNodes) { + run(targetNode); + } + + } + + /** + * Check the given target name. + * + * @param targetName + * is the target name to check. + */ + private void checkTargetName(String targetName) { + if (targetName != null && !targetName.isEmpty()) { + Pattern p1 = Pattern.compile(getRegExp()); + Matcher m1 = p1.matcher(targetName); + if (!m1.matches()) { + this.getReporter().report(this.getSeverity(), + "INVALID Target Name: " + targetName, + this.getAntFile(), 0); + } + } else { + log("Target name not specified!"); + } + } + + /** + * @return the regExp + */ + public String getRegExp() { + return regExp; + } + + /** + * @param regExp + * the regExp to set + */ + public void setRegExp(String regExp) { + this.regExp = regExp; + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckTargetName"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckUseOfEqualsTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckUseOfEqualsTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,111 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckUseOfEqualsTask is used to check the usage of equals task + * as against istrue task. + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckUseOfEqualsTask" severity="error" enabled="true" />
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckUseOfEqualsTask" category="AntLint" + */ +public class CheckUseOfEqualsTask extends AbstractCheck { + + private File antFile; + + /** + * {@inheritDoc} + */ + public void run(Element node) { + if (node.getName().equals("equals")) { + String text = node.attributeValue("arg2"); + if (text.equals("true") || text.equals("yes")) { + this.getReporter().report( + this.getSeverity(), + node.attributeValue("arg1") + + " uses 'equals' should use 'istrue' task", + this.getAntFile(), 0); + } + } + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#run(java.io.File) + */ + public void run(File antFilename) throws AntlintException { + + List equalNodes = new ArrayList(); + + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + try { + doc = saxReader.read(antFilename); + elementTreeWalk(doc.getRootElement(), "equals", equalNodes); + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + for (Element equalNode : equalNodes) { + run(equalNode); + } + + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckUseOfEqualsTask"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckUseOfIfInTargets.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckUseOfIfInTargets.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,163 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.Node; +import org.dom4j.io.SAXReader; + +import com.nokia.helium.antlint.ant.AntlintException; + +/** + * CheckUseOfIfInTargets is used to check the usage of if task as + * against the condition task or <target if|unless="property.name"> inside + * targets. + * + *
    + * Usage:
    + * 
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       <CheckUseOfIfInTargets" severity="error" enabled="true" />
    + *  </antlint>
    + * 
    + * + * @ant.task name="CheckUseOfIfInTargets" category="AntLint" + * + */ +public class CheckUseOfIfInTargets extends AbstractCheck { + + private File antFile; + + /** + * {@inheritDoc} + */ + public void run(Element node) { + if (node.getName().equals("target")) { + checkUseOfIf(node); + } + } + + /** + * Check against the given node. + * + * @param node + * is the node to check. + */ + @SuppressWarnings("unchecked") + private void checkUseOfIf(Element node) { + String target = node.attributeValue("name"); + String targetxpath = "//target[@name='" + target + "']//if"; + + List statements2 = node.selectNodes(targetxpath); + for (Node statement : statements2) { + List conditiontest = statement.selectNodes("./then/property"); + if (conditiontest != null && conditiontest.size() == 1) { + List conditiontest2 = statement + .selectNodes("./else/property"); + if (conditiontest2 != null && conditiontest2.size() == 1) { + this + .getReporter() + .report( + this.getSeverity(), + "Target " + + target + + " poor use of if-else-property statement, use condition task", + this.getAntFile(), 0); + } else if (statement.selectNodes("./else").size() == 0) { + this + .getReporter() + .report( + this.getSeverity(), + "Target " + + target + + " poor use of if-then-property statement, use condition task", + this.getAntFile(), 0); + } + } + } + List statements = node.selectNodes("//target[@name='" + target + + "']/*"); + if (!(statements.size() > 1)) { + if (node.selectSingleNode(targetxpath + "/else") == null) { + if (node.selectSingleNode(targetxpath + "/isset") != null + || node.selectSingleNode(targetxpath + "/not/isset") != null) { + this + .getReporter() + .report( + this.getSeverity(), + "Target " + + target + + " poor use of if statement, use targetNodes = new ArrayList(); + + this.antFile = antFilename; + SAXReader saxReader = new SAXReader(); + Document doc; + try { + doc = saxReader.read(antFilename); + elementTreeWalk(doc.getRootElement(), "target", targetNodes); + } catch (DocumentException e) { + throw new AntlintException("Invalid XML file " + e.getMessage()); + } + for (Element targetNode : targetNodes) { + run(targetNode); + } + + } + + /* + * (non-Javadoc) + * + * @see org.apache.tools.ant.types.DataType#toString() + */ + public String toString() { + return "CheckUseOfIfInTargets"; + } + + /* + * (non-Javadoc) + * + * @see com.nokia.helium.antlint.ant.types.Check#getAntFile() + */ + public File getAntFile() { + return this.antFile; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/Checker.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/Checker.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* - * 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.antlint.ant.types; - -import org.apache.tools.ant.types.DataType; - -/** - * Checker is a datatype used to hold information related to - * antlint check configurations. - * - *
    - * Usage:
    - *  
    - *      <checker name="CheckTargetName" severity="warning">([a-z0-9[\\d\\-]]*)</checker>
    - * 
    - * - */ -public class Checker extends DataType { - - private String name; - private String text; - private String severity; - - /** - * Set the pattern text. - * - * @param text - * is the pattern text to set. - */ - public void addText(String text) { - this.text = text; - } - - /** - * Get the name of the Checker. - * - * @return name of the checker. - */ - public String getName() { - return name; - } - - /** - * Set the name of the Checker. - * - * @param name - * is the name of the checker to set. - * @ant.required - */ - public void setName(String name) { - this.name = name; - } - - /** - * Get the pattern set for this Checker. - * - * @return the pattern. - */ - public String getPattern() { - return text; - } - - /** - * Get the severity. - * - * @return the severity - */ - public String getSeverity() { - return severity; - } - - /** - * Set the severity. (Valid values : error|warning) - * - * @param severity - * is the severity to set. - * @ant.required - */ - public void setSeverity(String severity) { - this.severity = severity; - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckstyleXmlReporter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/CheckstyleXmlReporter.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,161 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import org.apache.tools.ant.types.DataType; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import com.nokia.helium.antlint.ant.Reporter; +import com.nokia.helium.antlint.ant.Severity; + +/** + * This reporter will generate a Checkstyle compatible XML to + * report Antlint issues. + * + * Usage: + * + *
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       
    + *       ...
    + *       
    + *       <antlintCheckstyleReporter file="report.xml" />
    + *  </antlint>
    + * 
    + * + * @ant.type name="antlintCheckstyleReporter" category="AntLint" + */ +public class CheckstyleXmlReporter extends DataType implements Reporter { + + private Task task; + private Document doc; + private File file; + private Element currentFileNode; + private File currentFile; + + /** + * {@inheritDoc} + */ + @Override + public void report(Severity severity, String message, File filename, + int lineNo) { + if (doc != null) { + if (currentFile == null || !currentFile.equals(filename)) { + currentFileNode = doc.createElement("file"); + doc.getDocumentElement().appendChild(currentFileNode); + currentFile = filename; + currentFileNode.setAttribute("name", currentFile.getAbsolutePath()); + } + Element element = doc.createElement("error"); + element.setAttribute("severity", severity.getValue()); + element.setAttribute("message", message); + element.setAttribute("line", "" + lineNo); + element.setAttribute("source", "antlint"); + currentFileNode.appendChild(element); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void setTask(Task task) { + this.task = task; + } + + /** + * Closing the reporting session. It will generates + * the xml file. + */ + @Override + public void close() { + task.log("Creating " + file); + try { + // set up a transformer + TransformerFactory transfac = TransformerFactory.newInstance(); + Transformer trans = transfac.newTransformer(); + trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + trans.setOutputProperty(OutputKeys.INDENT, "yes"); + + // create string from xml tree + Writer writer = new FileWriter(file); + StreamResult result = new StreamResult(writer); + DOMSource source = new DOMSource(doc); + trans.transform(source, result); + } catch (TransformerException e) { + throw new BuildException(e.getMessage(), e); + } catch (IOException e) { + throw new BuildException(e.getMessage(), e); + } finally { + task = null; + } + } + + /** + * {@inheritDoc} + */ + @Override + public void open() { + if (file == null) { + throw new BuildException("'file' attribute is not defined."); + } + try { + DocumentBuilderFactory builder = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder; + docBuilder = builder.newDocumentBuilder(); + doc = docBuilder.newDocument(); + Element root = doc.createElement("checkstyle"); + root.setAttribute("version", "5.0"); + doc.appendChild(root); + } catch (ParserConfigurationException e) { + throw new BuildException(e.getMessage(), e); + } + } + + /** + * Defines the output file. + * @param file + * @ant.required + */ + public void setFile(File file) { + this.file = file; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/ConsoleReporter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/ant/types/ConsoleReporter.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,113 @@ +/* + * 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.antlint.ant.types; + +import java.io.File; + +import org.apache.tools.ant.Task; +import org.apache.tools.ant.types.DataType; + +import com.nokia.helium.antlint.ant.Reporter; +import com.nokia.helium.antlint.ant.Severity; + +/** + * This reporter will produce Antlint reporting using ant logging + * system. + * + * Usage: + * + *
    + *  <antlint>
    + *       <fileset id="antlint.files" dir="${antlint.test.dir}/data">
    + *               <include name="*.ant.xml"/>
    + *               <include name="*build.xml"/>
    + *               <include name="*.antlib.xml"/>
    + *       </fileset>
    + *       
    + *       ...
    + *       
    + *       <antlintCheckstyleReporter />
    + *  </antlint>
    + * 
    + * + * @ant.type name="antlintConsoleReporter" category="AntLint" + */ +public class ConsoleReporter extends DataType implements Reporter { + + private Task task; + private File antFilename; + + /* + * (non-Javadoc) + * + * @see + * com.nokia.helium.antlint.ant.Reporter#report(com.nokia.helium.antlint + * .ant.Severity, java.lang.String, java.io.File, int) + */ + @Override + public void report(Severity severity, String message, File filename, + int lineNo) { + String errorMessage; + if (this.antFilename == null) { + this.antFilename = filename; + task.log("\nError(s)/Warning(s) for: " + this.antFilename); + task + .log("----------------------------------------------------------"); + } else if (!this.antFilename.equals(filename)) { + this.antFilename = filename; + task.log("\nError(s)/Warning(s) for: " + this.antFilename); + task + .log("----------------------------------------------------------"); + } + if (lineNo > 0) { + errorMessage = severity.getValue().toUpperCase() + ": " + lineNo + + ": " + message; + + } else { + errorMessage = severity.getValue().toUpperCase() + ": " + message; + } + task.log(errorMessage); + + } + + /* + * (non-Javadoc) + * + * @see + * com.nokia.helium.antlint.ant.Reporter#setTask(org.apache.tools.ant.Task) + */ + @Override + public void setTask(Task task) { + this.task = task; + } + + /** + * {@inheritDoc} + */ + @Override + public void close() { + this.task = null; + } + + /** + * {@inheritDoc} + */ + @Override + public void open() { + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/AbstractCheck.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/AbstractCheck.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,199 +0,0 @@ -/* - * 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.antlint.checks; - -//import java.io.File; -//import java.util.List; - -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Target; -import org.dom4j.Document; -import org.dom4j.Element; -//import org.dom4j.Node; -import org.dom4j.io.SAXReader; - -import com.nokia.helium.antlint.AntFile; -import com.nokia.helium.antlint.ant.types.Checker; - -/** - * AbstractCheck is an abstract implementation of {@link Check}. - * - */ -public abstract class AbstractCheck implements Check { - - private Checker checker; - private AntFile antFile; - private boolean enabled; - - /** - * {@inheritDoc} - */ - public void setChecker(Checker checker) { - this.checker = checker; - this.enabled = true; - } - - /** - * {@inheritDoc} - */ - public void setAntFile(AntFile antFile) { - this.antFile = antFile; - } - - /** - * {@inheritDoc} - */ - public boolean isEnabled() { - return enabled; - } - - /** - * {@inheritDoc} - */ - public Checker getChecker() { - return this.checker; - } - - /** - * Return the {@link AntFile} set. - * - * @return the {@link AntFile} - */ - protected AntFile getAntFile() { - return antFile; - } - - /** - * {@inheritDoc} - */ - public void log(String message) { - if (checker.getSeverity() != null - && checker.getSeverity().equalsIgnoreCase("error")) { - logError(message); - antFile.incrementErrorCount(); - } else { - logWarning(message); - antFile.incrementWarningCount(); - } - } - - /** - * Get the {@link Pattern} associated with current {@link Check}. - * - * @return the Pattern. - */ - protected String getPattern() { - return checker.getPattern(); - } - - /** - * Get the {@link Project}. - * - * @return the {@link Project} - */ - protected Project getProject() { - return checker.getProject(); - } - - /** - * Check the availability dependent targets of the given target. - * - * @param targetName - * is the target for which dependent targets to be loked up. - * @return true, if the dependant targets are available; otherwise false - */ - protected boolean checkTargetDependency(String targetName) { - boolean dependencyCheck = false; - Target targetDependency = (Target) getProject().getTargets().get( - targetName); - dependencyCheck = targetDependency != null - && targetDependency.getDependencies().hasMoreElements(); - return dependencyCheck; - } - - /** - * Check the whether the given property is defined in the data model. - * - * @param customerProp - * is the property to check for. - */ - @SuppressWarnings("unchecked") - protected void checkPropertyInModel(String customerProp) { - SAXReader xmlReader = new SAXReader(); - Document antDoc = null; - - // TODO - -// try { -// File model = new File(getProject().getProperty("data.model.parsed")); -// antDoc = xmlReader.read(model); -// } catch (Exception e) { -// throw new BuildException("Not able to read data model file " -// + getProject().getProperty("data.model.parsed")); -// } -// -// List statements = antDoc.selectNodes("//property"); -// -// for (Node statement : statements) { -// if (customerProp.equals(statement.valueOf("name"))) { -// return; -// } -// } -// log(customerProp + " not in data model"); - } - - /** - * Log the given message as an error. - * - * @param message - * is the message to log. - */ - private void logError(String message) { - getProject().log("E: " + message); - } - - /** - * Log the given message as an warning. - * - * @param message - * is the message to log. - */ - private void logWarning(String message) { - getProject().log("W: " + message); - } - - /** - * {@inheritDoc} - */ - public void run(Element node) { - // ignore - } - - /** - * {@inheritDoc} - */ - public void run(String text) { - // ignore - } - - /** - * {@inheritDoc} - */ - public void run() { - // ignore - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/AbstractScriptCheck.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/AbstractScriptCheck.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* - * 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.antlint.checks; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.io.IOException; - -import org.apache.tools.ant.BuildException; - -/** - * AbstractScriptCheck is an abstract implementation of - * {@link Check} and contains some concrete methods related to script. - * - */ -public abstract class AbstractScriptCheck extends AbstractCheck { - - /** - * Write a script with the given name and the text. - * - * @param name is the name of the script - * @param text is the script text. - */ - protected void writeJepFile(String name, String text) { - if (text.contains("${")) { - log("${ found in " + name); - } - try { - String heliumpath = new File(getProject().getProperty( - "helium.build.dir")).getCanonicalPath(); - new File(heliumpath + File.separator + "jep").mkdirs(); - File file = new File(heliumpath + File.separator + "jep" - + File.separator + name + "_jep.py"); - PrintWriter output = new PrintWriter(new FileOutputStream(file)); - output.write("def abc():\n"); - output.write(" attributes = {} # pylint: disable-msg=C0103\n"); - output.write(" elements = {} # pylint: disable-msg=C0103\n"); - output.write(" project = None # pylint: disable-msg=C0103\n"); - output.write(" self = None # pylint: disable-msg=C0103\n"); - text = text.replace(" File(", " self.File("); - for (String t : text.split("\n")) - output.write(" " + t + "\n"); - output.close(); - - if (text.contains("import ")) { - File file2 = new File(heliumpath + File.separator - + "test_jython.xml"); - PrintWriter output2 = new PrintWriter(new FileOutputStream( - file2, true)); - output2.write("try:\n"); - for (String line : text.split("\n")) { - if (line.trim().startsWith("import ") - || line.trim().startsWith("from ")) - output2.write(" " + line + "\n"); - } - - output2.write("except ImportError, e:\n"); - output2.write(" print '" + name - + " failed: ' + str(e)\n"); - output2.close(); - } - } catch (IOException e) { - throw new BuildException("Not able to write JEP File " - + name + "_jep.py"); - } - } - - /** - * Check for the properties in the given script text. - * - * @param text is the script text to lookup. - */ - protected void checkJepPropertiesInText(String text) { - Pattern p1 = Pattern - .compile("getProperty\\([\"']([a-zA-Z0-9\\.]*)[\"']\\)"); - Matcher m1 = p1.matcher(text); - ArrayList props = new ArrayList(); - while (m1.find()) { - props.add(m1.group(1)); - } - for (String group : props) - checkPropertyInModel(group); - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/Check.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/Check.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* - * 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.antlint.checks; - -import org.dom4j.Element; - -import com.nokia.helium.antlint.AntFile; -import com.nokia.helium.antlint.ant.types.Checker; - -/** - * Check represents a basic antlint component responsible for - * running the user configured checks. - * - */ -public interface Check { - - /** - * Method runs the configured checks. Usually checks which have to be run - * only time should be used here. - */ - void run(); - - /** - * Method runs the configured checks against the given node. - * - * @param node - * is the node of the xml to be checked. - */ - void run(Element node); - - /** - * Method runs the configured checks against the given ant file. - * - * @param fileName - * is the name of the ant file. - */ - void run(String fileName); - - /** - * Set the {@link Checker} configured for this check. - * - * @param checker - * is the {@link Checker} to set. - */ - void setChecker(Checker checker); - - /** - * Set the ant file to hold information about the checks conducted on the - * file. - * - * @param antFile - * is the {@link AntFile} to set. - */ - void setAntFile(AntFile antFile); - - /** - * Return whether this is check is enabled or not. - * - * @return true if a checker is available for this check; otherwise false. - */ - boolean isEnabled(); - - /** - * Log the given message. - * - * @param message is the message to be logged. - */ - void log(String message); - - /** - * Return the {@link Checker} configured for this {@link Check}. - * - * @return the {@link Checker}. - */ - Checker getChecker(); -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckAntCall.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckAntCall.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* - * 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.antlint.checks; - -import java.util.List; - -import org.dom4j.Element; - -/** - * CheckAntCall is used to check whether antcall is used with no param - * elements and calls the target with no dependencies - * - */ -public class CheckAntCall extends AbstractCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - if (node.getName().equals("target")) { - checkAntCalls(node); - } - } - - /** - * Check against the given node. - * - * @param node is the node to check. - */ - @SuppressWarnings("unchecked") - private void checkAntCalls(Element node) { - if (node.elements("antcall") != null) { - List antcallList = node.elements("antcall"); - for (Element antcallElement : antcallList) { - String antcallName = antcallElement.attributeValue("target"); - if (((node.elements("param") == null) || (node - .elements("param") != null && node.elements("param") - .isEmpty())) - && !checkTargetDependency(antcallName)) { - log(" is used with no param elements and calls the target " - + antcallName - + " that has no dependencies! ( could be used instead.)"); - } - } - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckDescription.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckDescription.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - * 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.antlint.checks; - -import org.dom4j.Element; - -/** - * CheckDescription is used to check whether project description is - * present or not. - * - */ -public class CheckDescription extends AbstractCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - if (node.getName().equals("project") - && node.element("description") == null) { - log("Description not specified!"); - } - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckDuplicateNames.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckDuplicateNames.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * 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.antlint.checks; - -import java.util.ArrayList; -import java.util.Hashtable; - -/** - * CheckDuplicateNames is used to check for duplicate macro names. - * - */ -public class CheckDuplicateNames extends AbstractCheck { - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public void run() { - - Hashtable> taskdefs = getProject() - .getTaskDefinitions(); - ArrayList macros = new ArrayList(taskdefs.keySet()); - for (String macroName : macros) { - if (macros.contains(macroName + "Macro") - || macros.contains(macroName + "macro")) - log(macroName + " and " + macroName + "Macro" - + " found duplicate name"); - } - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckFileName.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckFileName.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * 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.antlint.checks; - -import java.io.File; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * CheckFileName is used to check the naming convention of the ant files. - * - */ -public class CheckFileName extends AbstractCheck { - - /** - * {@inheritDoc} - */ - public void run(String arg) { - if (arg != null) { - boolean found = false; - Pattern p1 = Pattern.compile(getPattern()); - Matcher m1 = p1.matcher(new File(arg).getName()); - while (m1.find()) { - found = true; - } - if (!found) { - log("INVALID File Name: " + arg); - } - } - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckIndentation.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckIndentation.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* - * 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.antlint.checks; - -import java.io.File; - -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import javax.xml.parsers.ParserConfigurationException; -import org.xml.sax.SAXException; -import java.io.IOException; - -import com.nokia.helium.antlint.AntLintHandler; - -/** - * CheckIndentation is used to check the indentations in the ant files. - * - */ -public class CheckIndentation extends AbstractCheck { - - /** - * {@inheritDoc} - */ - public void run(String antFileName) { - try { - SAXParserFactory saxFactory = SAXParserFactory.newInstance(); - saxFactory.setNamespaceAware(true); - saxFactory.setValidating(true); - SAXParser parser = saxFactory.newSAXParser(); - AntLintHandler handler = new AntLintHandler(this); - handler.setIndentationCheck(true); - parser.parse(new File(antFileName), handler); - } catch (ParserConfigurationException e) { - throw new RuntimeException(e); - } catch (SAXException e) { - throw new RuntimeException(e); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckJepJythonScript.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckJepJythonScript.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * 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.antlint.checks; - -import java.util.List; - -import org.dom4j.Element; - -/** - * CheckJepJythonScript is used to check the coding convention in Jep and - * Jython scripts - * - */ -public class CheckJepJythonScript extends AbstractScriptCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - if (node.getName().equals("target")) { - checkScripts(node); - } - - if (node.getName().equals("scriptdef")) { - String scriptdefname = node.attributeValue("name"); - String language = node.attributeValue("language"); - if (language.equals("jep") || language.equals("jython")) { - writeJepFile(scriptdefname, node.getText()); - } - } - } - - /** - * Check against the given node. - * - * @param node is the node to check. - */ - @SuppressWarnings("unchecked") - private void checkScripts(Element node) { - String target = node.attributeValue("name"); - List scriptList = node.selectNodes("//target[@name='" + target - + "']/descendant::script"); - for (Element scriptElement : scriptList) { - String language = scriptElement.attributeValue("language"); - if (language.equals("jep") || language.equals("jython")) { - writeJepFile("target_" + target, scriptElement.getText()); - } - } - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckPresetDefMacroDefName.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckPresetDefMacroDefName.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * 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.antlint.checks; - -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.dom4j.Element; - -/** - * CheckPresetDefMacroDefName is used to check the naming - * convention of presetdef and macrodef - * - */ -public class CheckPresetDefMacroDefName extends AbstractCheck { - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public void run(Element node) { - if (node.getName().equals("presetdef") - || node.getName().equals("macrodef")) { - String text = node.attributeValue("name"); - if (text != null && !text.isEmpty()) { - checkDefName(text); - } - - List attributeList = node.elements("attribute"); - for (Element attributeElement : attributeList) { - String attributeName = attributeElement.attributeValue("name"); - checkDefName(attributeName); - } - } - } - - /** - * Check the given text. - * - * @param text - * is the text to check. - */ - private void checkDefName(String text) { - Pattern p1 = Pattern.compile(getPattern()); - Matcher m1 = p1.matcher(text); - if (!m1.matches()) { - log("INVALID PRESETDEF/MACRODEF Name: " + text); - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckProjectName.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckProjectName.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * 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.antlint.checks; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.dom4j.Element; - -/** - * CheckProjectName is used to check the naming convention of - * project names. - * - */ -public class CheckProjectName extends AbstractCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - if (node.getName().equals("project")) { - String text = node.attributeValue("name"); - if (text != null && !text.isEmpty()) { - checkProjectName(text); - } else { - log("Project name not specified!"); - } - - } - } - - /** - * Check the given the project name. - * - * @param text is the text to check. - */ - private void checkProjectName(String text) { - Pattern p1 = Pattern.compile(getPattern()); - Matcher m1 = p1.matcher(text); - if (!m1.matches()) { - log("INVALID Project Name: " + text); - } - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckPropertiesInDataModel.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckPropertiesInDataModel.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* - * 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.antlint.checks; - -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.dom4j.Element; - -/** - * CheckPropertiesInDataModel is used to check whether the properties are - * defined in data model - * - */ -public class CheckPropertiesInDataModel extends AbstractScriptCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - if (node.getName().equals("target")) { - checkInScripts(node); - checkInScriptConditions(node); - checkInPythonTasks(node); - } - - if (node.getName().equals("scriptdef")) { - String language = node.attributeValue("language"); - - if (language.equals("jep") || language.equals("jython")) { - checkJepPropertiesInText(node.getText()); - } - } - } - - /** - * Check the properties defined inside script condition. - * - * @param node is the node to check. - */ - @SuppressWarnings("unchecked") - private void checkInScriptConditions(Element node) { - String target = node.attributeValue("name"); - List scriptList = node.selectNodes("//target[@name='" + target - + "']/descendant::scriptcondition"); - for (Element scriptElement : scriptList) { - String language = scriptElement.attributeValue("language"); - if (language.equals("jep") || language.equals("jython")) { - checkJepPropertiesInText(scriptElement.getText()); - } - } - } - - /** - * Check the properties defined inside scripts. - * - * @param node is the node to check. - */ - @SuppressWarnings("unchecked") - private void checkInScripts(Element node) { - String target = node.attributeValue("name"); - List scriptList = node.selectNodes("//target[@name='" + target - + "']/descendant::script"); - for (Element scriptElement : scriptList) { - String language = scriptElement.attributeValue("language"); - if (language.equals("jep") || language.equals("jython")) { - checkJepPropertiesInText(scriptElement.getText()); - } - } - } - - /** - * Check the properties defined inside python tasks. - * - * @param node is the node to check. - */ - @SuppressWarnings("unchecked") - private void checkInPythonTasks(Element node) { - String target = node.attributeValue("name"); - List pythonList = node.selectNodes("//target[@name='" + target - + "']/descendant::*[name()=\"hlm:python\"]"); - for (Element pythonElement : pythonList) { - checkPropertiesInText(pythonElement.getText()); - } - } - - /** - * Check for the properties in the given text. - * - * @param text is the text to lookup. - */ - private void checkPropertiesInText(String text) { - Pattern p1 = Pattern.compile("r[\"']\\$\\{([a-zA-Z0-9\\.]*)\\}[\"']"); - Matcher m1 = p1.matcher(text); - ArrayList props = new ArrayList(); - while (m1.find()) { - props.add(m1.group(1)); - } - for (String group : props) - checkPropertyInModel(group); - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckPropertyName.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckPropertyName.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * 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.antlint.checks; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.dom4j.Element; - -/** - * CheckPropertyName is used to check the naming convention of - * property names. - * - */ -public class CheckPropertyName extends AbstractCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - if (node.getName().equals("property")) { - String text = node.attributeValue("name"); - if (text != null && !text.isEmpty()) { - checkPropertyName(text); - } - } - } - - /** - * Check the given property name. - * - * @param propertyName is the property name to check. - */ - private void checkPropertyName(String propertyName) { - Pattern p1 = Pattern.compile(getPattern()); - Matcher m1 = p1.matcher(propertyName); - if (!m1.matches() && !isPropertyAlreadyVisited(propertyName)) { - log("INVALID Property Name: " + propertyName); - getAntFile().markPropertyAsVisited(propertyName); - } - } - - /** - * Check whether the property is already visited or not. - * - * @param propertyName is the property to be checked. - * @return true, if already been visited; otherwise false - */ - private boolean isPropertyAlreadyVisited(String propertyName) { - return getAntFile().isPropertyVisited(propertyName); - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckPythonTasks.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckPythonTasks.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* - * 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.antlint.checks; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.PrintWriter; -import java.util.List; -import java.io.IOException; - -import org.apache.tools.ant.BuildException; -import org.dom4j.Element; - -/** - * CheckPythonTasks is used to the check the coding convention of - * python tasks. - * - */ -public class CheckPythonTasks extends AbstractCheck { - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - public void run(Element node) { - if (node.getName().equals("target")) { - String target = node.attributeValue("name"); - List pythonList = node.selectNodes("//target[@name='" - + target + "']/descendant::*[name()=\"hlm:python\"]"); - int i = 0; - for (Element pythonElement : pythonList) { - writePythonFile(i + "_" + target, pythonElement.getText()); - i++; - } - } - } - - /** - * Writes the given text to a python file. - * - * @param name - * is the name of the file to be written. - * @param text - * is the text to be written inside the file. - */ - private void writePythonFile(String name, String text) { - try { - String heliumpath = new File(getProject().getProperty( - "helium.build.dir")).getCanonicalPath(); - new File(heliumpath + File.separator + "python").mkdirs(); - File file = new File(heliumpath + File.separator + "python" - + File.separator + "target" + name + ".py"); - PrintWriter output = new PrintWriter(new FileOutputStream(file)); - if (!text.equals("")) { - output.write("def abc():"); - for (String t : text.split("\n")) - output.write(" " + t + "\n"); - } - output.close(); - } catch (IOException e) { - e.printStackTrace(); - throw new BuildException("IOException:Not able to write python file " + name - + ".py"); - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckRunTarget.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckRunTarget.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* - * 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.antlint.checks; - -import java.util.List; - -import org.dom4j.Element; - -/** - * CheckRunTarget is used to check whether runtarget calls a target - * that has dependencies. - * - */ -public class CheckRunTarget extends AbstractCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - if (node.getName().equals("target")) { - checkRunTargets(node); - } - } - - /** - * Check against the given node. - * - * @param node - * is the node to check. - */ - @SuppressWarnings("unchecked") - private void checkRunTargets(Element node) { - if (node.elements("runtarget") != null) { - List runTargetList = node.elements("runtarget"); - for (Element runTargetElement : runTargetList) { - String runTargetName = runTargetElement - .attributeValue("target"); - if (checkTargetDependency(runTargetName)) { - log(" calls the target " + runTargetName - + " that has dependencies!"); - } - } - } - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckScriptCondition.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckScriptCondition.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * 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.antlint.checks; - -import java.util.List; - -import org.dom4j.Element; - -/** - * CheckScriptCondition is used to check the coding convention in - * script condition - * - */ -public class CheckScriptCondition extends AbstractScriptCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - if (node.getName().equals("target")) { - checkScriptConditions(node); - } - } - - /** - * Check against the given node. - * - * @param node - * is the node to check. - */ - @SuppressWarnings("unchecked") - private void checkScriptConditions(Element node) { - String target = node.attributeValue("name"); - List scriptList = node.selectNodes("//target[@name='" + target - + "']/descendant::scriptcondition"); - for (Element scriptElement : scriptList) { - String language = scriptElement.attributeValue("language"); - if (language.equals("jep") || language.equals("jython")) { - writeJepFile("scriptcondition_" + target, scriptElement - .getText()); - } - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckScriptDef.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckScriptDef.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/* - * 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.antlint.checks; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.io.IOException; - -import org.apache.tools.ant.BuildException; -import org.dom4j.Element; -import org.dom4j.Node; - -/** - * CheckScriptDef is used to check the coding convention in - * scriptdef. - * - */ -public class CheckScriptDef extends AbstractScriptCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - if (node.getName().equals("scriptdef")) { - String scriptdefname = node.attributeValue("name"); - String language = node.attributeValue("language"); - - checkScriptDef(scriptdefname, node); - - if (language.equals("beanshell")) { - writeBeanshellFile(scriptdefname, node.getText()); - } - } - } - - /** - * Check against the given node. - * - * @param node - * is the node to check. - */ - @SuppressWarnings("unchecked") - public void checkScriptDef(String name, Node node) { - List statements = node.selectNodes("//scriptdef[@name='" + name - + "']/attribute"); - Pattern p1 = Pattern.compile("attributes.get\\([\"']([^\"']*)[\"']\\)"); - Matcher m1 = p1.matcher(node.getText()); - ArrayList props = new ArrayList(); - while (m1.find()) { - props.add(m1.group(1)); - } - - if (!statements.isEmpty() && !props.isEmpty()) { - for (Node statement : statements) { - if (!props.contains(statement.valueOf("@name"))) { - // for (String x : props) - // log(x); - log("Scriptdef " + name + " does not use " - + statement.valueOf("@name")); - } - } - } - } - - /** - * Write a bean shell file with the given text. - * - * @param scriptdefname - * is the name of the file to be written. - * @param text - * is the text to be written inside the file. - */ - private void writeBeanshellFile(String scriptdefname, String text) { - scriptdefname = "Beanshell" + scriptdefname; - try { - String heliumpath = new File(getProject().getProperty( - "helium.build.dir")).getCanonicalPath(); - new File(heliumpath + File.separator + "beanshell").mkdirs(); - File file = new File(heliumpath + File.separator + "beanshell" - + File.separator + scriptdefname + ".java"); - PrintWriter output = new PrintWriter(new FileOutputStream(file)); - - for (String line : text.split("\n")) { - if (line.trim().startsWith("import")) - output.write(line + "\n"); - } - - output.write("/**\n * x\n */\npublic final class " + scriptdefname - + " {\n"); - output.write("private " + scriptdefname + "() { }\n"); - output.write("public static void main(String[] args) {\n"); - for (String line : text.split("\n")) { - if (!line.trim().startsWith("import")) - output.write(line + "\n"); - } - output.write("} }"); - output.close(); - } catch (IOException e) { - throw new BuildException("Not able to write Beanshell File " - + scriptdefname + ".java"); - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckScriptDefNameAttributes.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckScriptDefNameAttributes.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* - * 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.antlint.checks; - -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.dom4j.Element; -import org.dom4j.Node; - -/** - * CheckScriptDefNameAttributes is used to check the naming - * convention of scriptdef name attributes - * - */ -public class CheckScriptDefNameAttributes extends AbstractCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - if (node.getName().equals("scriptdef")) { - String scriptdefname = node.attributeValue("name"); - checkScriptDefNameAttributes(scriptdefname, node); - } - } - - /** - * Check against the given node. - * - * @param node - * is the node to check. - */ - @SuppressWarnings("unchecked") - public void checkScriptDefNameAttributes(String name, Node node) { - List statements = node.selectNodes("//scriptdef[@name='" + name - + "']/attribute"); - Pattern p1 = Pattern.compile("attributes.get\\([\"']([^\"']*)[\"']\\)"); - Matcher m1 = p1.matcher(node.getText()); - ArrayList props = new ArrayList(); - while (m1.find()) { - props.add(m1.group(1)); - } - - ArrayList attributes = new ArrayList(); - for (Node statement : statements) { - attributes.add(statement.valueOf("@name")); - } - for (String x : props) { - if (!attributes.contains(x)) { - log("Scriptdef " + name + " does not have attribute " + x); - } - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckScriptDefStyle.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckScriptDefStyle.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* - * 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.antlint.checks; - -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.dom4j.Element; -import org.dom4j.Node; - -/** - * CheckScriptDefStyle is used to check the coding style of - * scriptdef. - * - */ -public class CheckScriptDefStyle extends AbstractCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - if (node.getName().equals("scriptdef")) { - String scriptdefname = node.attributeValue("name"); - checkScriptDefStyle(scriptdefname, node); - } - } - - /** - * Check against the given node. - * - * @param node - * is the node to check. - */ - @SuppressWarnings("unchecked") - public void checkScriptDefStyle(String name, Node node) { - List statements = node.selectNodes("//scriptdef[@name='" + name - + "']/attribute"); - Pattern p1 = Pattern.compile("attributes.get\\([\"']([^\"']*)[\"']\\)"); - Matcher m1 = p1.matcher(node.getText()); - ArrayList props = new ArrayList(); - while (m1.find()) { - props.add(m1.group(1)); - } - - ArrayList attributes = new ArrayList(); - for (Node statement : statements) { - attributes.add(statement.valueOf("@name")); - } - - if (!statements.isEmpty() && props.isEmpty()) { - log("Scriptdef " + name - + " doesn't reference attributes directly, poor style"); - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckScriptSize.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckScriptSize.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * 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.antlint.checks; - -import java.util.List; - -import org.dom4j.Element; -import org.dom4j.Node; - -/** - * CheckScriptSize is used to check the size of script. By default, - * the script should not contain more than 1000 characters. - * - */ -public class CheckScriptSize extends AbstractCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - if (node.getName().equals("target")) { - checkSizeOfScript(node); - } - } - - /** - * Check against the given node. - * - * @param node is the node to check. - */ - @SuppressWarnings("unchecked") - private void checkSizeOfScript(Element node) { - String target = node.attributeValue("name"); - - List statements = node.selectNodes("//target[@name='" + target - + "']/script | //target[@name='" + target - + "']/*[name()=\"hlm:python\"]"); - - for (Node statement : statements) { - int size = statement.getText().length(); - if (size > 1000) { - log("Target " + target + " has a script with " + size - + " characters, code should be inside a python file"); - } - } - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckTabCharacter.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckTabCharacter.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* - * 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.antlint.checks; - -import java.io.File; -import java.util.List; -import java.io.IOException; - -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import javax.xml.parsers.ParserConfigurationException; -import org.xml.sax.SAXException; -import org.dom4j.Element; -import org.dom4j.Node; - -import com.nokia.helium.antlint.AntLintHandler; - -/** - * CheckTabCharacter is used to check the tab characters inside the - * ant files. - * - */ -public class CheckTabCharacter extends AbstractCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - checkTabsInScript(node); - } - - /** - * Check against the given node. - * - * @param node - * is the node to check. - */ - @SuppressWarnings("unchecked") - private void checkTabsInScript(Element node) { - if (node.getName().equals("target")) { - String target = node.attributeValue("name"); - - List statements = node.selectNodes("//target[@name='" - + target + "']/script | //target[@name='" + target - + "']/*[name()=\"hlm:python\"]"); - - for (Node statement : statements) { - if (statement.getText().contains("\t")) { - log("Target " + target + " has a script with tabs"); - } - } - } - } - - /** - * {@inheritDoc} - */ - public void run(String antFileName) { - try { - SAXParserFactory saxFactory = SAXParserFactory.newInstance(); - saxFactory.setNamespaceAware(true); - saxFactory.setValidating(true); - SAXParser parser = saxFactory.newSAXParser(); - AntLintHandler handler = new AntLintHandler(this); - handler.setTabCharacterCheck(true); - parser.parse(new File(antFileName), handler); - } catch (ParserConfigurationException e) { - throw new RuntimeException(e); - } catch (SAXException e) { - throw new RuntimeException(e); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckTargetName.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckTargetName.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * 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.antlint.checks; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.dom4j.Element; - -/** - * CheckTargetName is used to check the naming convention of the - * target names. - * - */ -public class CheckTargetName extends AbstractCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - if (node.getName().equals("target")) { - String target = node.attributeValue("name"); - checkTargetName(target); - } - } - - /** - * Check the given target name. - * - * @param targetName - * is the target name to check. - */ - private void checkTargetName(String targetName) { - if (targetName != null && !targetName.isEmpty()) { - Pattern p1 = Pattern.compile(getPattern()); - Matcher m1 = p1.matcher(targetName); - if (!m1.matches()) { - log("INVALID Target Name: " + targetName); - } - } else { - log("Target name not specified!"); - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckUseOfEqualsTask.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckUseOfEqualsTask.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * 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.antlint.checks; - -import org.dom4j.Element; - -/** - * CheckUseOfEqualsTask is used to check the usage of equals task - * as against istrue task. - * - */ -public class CheckUseOfEqualsTask extends AbstractCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - if (node.getName().equals("equals")) { - String text = node.attributeValue("arg2"); - if (text.equals("true") || text.equals("yes")) { - log(node.attributeValue("arg1") - + " uses 'equals' should use 'istrue' task"); - } - } - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckUseOfIfInTargets.java --- a/buildframework/helium/sf/java/antlint/src/com/nokia/helium/antlint/checks/CheckUseOfIfInTargets.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * 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.antlint.checks; - -import java.util.List; - -import org.dom4j.Element; -import org.dom4j.Node; - -/** - * CheckUseOfIfInTargets is used to check the usage of if task as - * against the condition task or <target if|unless="property.name"> inside - * targets. - * - */ -public class CheckUseOfIfInTargets extends AbstractCheck { - - /** - * {@inheritDoc} - */ - public void run(Element node) { - if (node.getName().equals("target")) { - checkUseOfIf(node); - } - } - - /** - * Check against the given node. - * - * @param node - * is the node to check. - */ - @SuppressWarnings("unchecked") - private void checkUseOfIf(Element node) { - String target = node.attributeValue("name"); - String targetxpath = "//target[@name='" + target + "']//if"; - - List statements2 = node.selectNodes(targetxpath); - for (Node statement : statements2) { - List conditiontest = statement.selectNodes("./then/property"); - if (conditiontest != null && conditiontest.size() == 1) { - List conditiontest2 = statement - .selectNodes("./else/property"); - if (conditiontest2 != null && conditiontest2.size() == 1) { - log("Target " - + target - + " poor use of if-else-property statement, use condition task"); - } else if (statement.selectNodes("./else").size() == 0) { - log("Target " - + target - + " poor use of if-then-property statement, use condition task"); - } - } - } - List statements = node.selectNodes("//target[@name='" + target - + "']/*"); - if (!(statements.size() > 1)) { - if (node.selectSingleNode(targetxpath + "/else") == null) { - if (node.selectSingleNode(targetxpath + "/isset") != null - || node.selectSingleNode(targetxpath + "/not/isset") != null) { - log("Target " - + target - + " poor use of if statement, use + + - ------------------------------------------------------------------------------- - + + - - ------------------------------------------------------------------------------- + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - ([a-z0-9[\\d\\_\\.\\@\\{\\}\\$]]*) - ([a-z0-9[\\d\\-]]*) - - ([a-z0-9][a-zA-Z0-9]*) - ([a-z0-9[\\d\\.\\_\\-]]*) - - ^build.xml$|ant.xml$|antlib.xml$ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${report.xml} + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/tests/data/build.xml --- a/buildframework/helium/sf/java/antlint/tests/data/build.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/antlint/tests/data/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -22,4 +22,8 @@ --> + + Test target + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/tests/data/invalid.build.xml --- a/buildframework/helium/sf/java/antlint/tests/data/invalid.build.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/antlint/tests/data/invalid.build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -21,5 +21,8 @@ ============================================================================ --> + + Testing for invalid file name + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/tests/data/sample.ant.xml --- a/buildframework/helium/sf/java/antlint/tests/data/sample.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/antlint/tests/data/sample.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -26,7 +26,15 @@ - + + + + + pow + + + + @@ -35,6 +43,13 @@ check PresetDef Name + + + + @{parameter} + + + Hello Checking Tab Character @@ -231,4 +246,6 @@ checking indentation + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antlint/tests/data/sample.antlib.xml --- a/buildframework/helium/sf/java/antlint/tests/data/sample.antlib.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/antlint/tests/data/sample.antlib.xml Wed Jun 16 16:51:40 2010 +0300 @@ -31,11 +31,7 @@ - - - pow - - + result = None @@ -47,6 +43,12 @@ target = str(attributes.get('attr0')) + + + + + +target = str(attributes.get('attr0')) @@ -67,4 +69,8 @@ target = str(attributes.get('target')) + + +target = str(attributes.get('target')) + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/antunit/src/com/nokia/helium/antunit/ant/types/CustomListener.java --- a/buildframework/helium/sf/java/antunit/src/com/nokia/helium/antunit/ant/types/CustomListener.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/antunit/src/com/nokia/helium/antunit/ant/types/CustomListener.java Wed Jun 16 16:51:40 2010 +0300 @@ -110,9 +110,9 @@ @Override public void startTest(String name) { listeners.clear(); - for (Listener l : listenerDefinitions) { - BuildListener bl = l.instantiate(); - l.setProject(currentProject); + for (Listener listener : listenerDefinitions) { + BuildListener bl = listener.instantiate(); + listener.setProject(currentProject); if (bl != null) { listeners.add(bl); bl.buildStarted(new BuildEvent(currentProject)); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,30 @@ + + + + Helium Antlib Legacy build file. + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/ivy.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/ivy.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,33 @@ + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/antlib.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/antlib.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,27 @@ + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/AddTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/AddTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,68 @@ +/* +* 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.ccmtask.ant.commands; + +import java.util.Vector; + +import com.nokia.helium.ccmtask.ant.types.Task; + +/** + * This object creates new ccm task and contains all the Tasks in a list. + * + */ +public class AddTask extends CcmCommand +{ + private String folder; + private Vector tasks = new Vector(); + + /** + * Get the dest folder. + * @return the dest folder, or null if not defined. + */ + public String getFolder() + { + return folder; + } + + /** + * Define the folder to add the task in. + * @param folder + */ + public void setFolder(String folder) + { + this.folder = folder; + } + + /** + * Add a nested task element. + * @return a Task element + */ + public Task createTask() { + Task task = new Task(); + tasks.add(task); + return task; + } + + /** + * Get all nested tasks + * @return an array of nested tasks + */ + public Task[] getTasks() { + return tasks.toArray(new Task[tasks.size()]); + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/CcmCommand.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/CcmCommand.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.ccmtask.ant.commands; + +import com.nokia.helium.ccmtask.ant.taskdefs.CcmTask; + +/** + * Creates command string based on runtime class name. + * + */ +public class CcmCommand +{ + private CcmTask task; + + /** + * @return the task + */ + public CcmTask getTask() + { + return task; + } + + /** + * @param task + * the task to set + */ + public void setTask(CcmTask task) + { + this.task = task; + } + + + public String getName() + { + String className = getClass().getName(); + String commandName = className.substring(className.lastIndexOf('.') + 1).toLowerCase(); + return commandName; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/ChangeReleaseTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/ChangeReleaseTag.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.ccmtask.ant.commands; + +/** + * This object contains the current release tag. + * + */ +public class ChangeReleaseTag extends CcmCommand +{ + private String folder; + private String newreleasetag; + + /** + * Get the folder to scan. + * @return the folder, or null if not defined. + */ + public String getFolder() + { + return folder; + } + + /** + * Set the folder to update the task. + * @param folder + */ + public void setFolder(String folder) + { + this.folder = folder; + } + + /** + * Get the release to re-tag the tasks with. + * @param newreleasetag + */ + public String getReleaseTag() + { + return newreleasetag; + } + + /** + * Set the release to re-tag the tasks with. + * @param newreleasetag + */ + public void setReleasetag(String newreleasetag) + { + this.newreleasetag = newreleasetag; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Checkout.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Checkout.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.ccmtask.ant.commands; + +/** + * This object is used to check out a ccm project. + * + */ +public class Checkout extends CcmCommand +{ + private String project; + private String release; + private String version; + private String purpose; + private String wa; + private boolean recursive; + private boolean relative; + + /** + * Get the project to checkout. + * @return + */ + public String getProject() + { + return project; + } + + /** + * Set the project to checkout. + * @return the project four part name + */ + public void setProject(String project) + { + this.project = project; + } + + /** + * Get the release to use for the checkout. + * @return + */ + public String getRelease() + { + return release; + } + + /** + * Set the release to use for the checkout. + * @return the release + */ + public void setRelease(String release) + { + this.release = release; + } + + /** + * Get the version to set while checking out. + * @return + */ + public String getVersion() + { + return version; + } + + /** + * Set the version + * @param version + */ + public void setVersion(String version) + { + this.version = version; + } + + /** + * Get the purpose of the checkout + */ + public String getPurpose() + { + return purpose; + } + + /** + * Set the purpose of the checkout + * @param purpose + */ + public void setPurpose(String purpose) + { + this.purpose = purpose; + } + + /** + * Get the workarea location + * @return + */ + public String getWa() + { + return wa; + } + + /** + * Set the workarea location + * @param wa + */ + public void setWa(String wa) + { + this.wa = wa; + } + + /** + * Shall it be a recursive checkout + * @return + */ + public boolean getRecursive() + { + return recursive; + } + + /** + * Set if the checkout should be a recursive. + * @param recursive + */ + public void setRecursive(boolean recursive) + { + this.recursive = recursive; + } + + /** + * Shall subprojects workarea be maintained relatively to the parent. + * @return + */ + public boolean getRelative() + { + return relative; + } + + /** + * Set if the subprojects workarea be maintained relatively to the parent. + * @param relative + */ + public void setRelative(boolean relative) + { + this.relative = relative; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Close.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Close.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,25 @@ +/* +* 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.ccmtask.ant.commands; +/** + * To close the ccm session + * + */ +public class Close extends CcmCommand +{ +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/CreateReleaseTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/CreateReleaseTag.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,80 @@ +/* +* 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.ccmtask.ant.commands; + +/** + * This object stores the new releast tag creation information. + * + */ +public class CreateReleaseTag extends CcmCommand +{ + private String newtag; + + private String release; + + private String project; + + public String getProject() + { + return project; + } + + /* + * Helper function to set the project information for creating the new release. + * @param prj - project info to be set for creating a new release tag. + */ + public void setProject(String prj) { + project = prj; + } + + /* + * Helper function to get the release information for creating the new release tag. + * @return - release info to be used to create the new release tag. + */ + public String getRelease() + { + return release; + } + + /* + * Helper function to set the release information for creating the new release tag. + * @param rel - release info to be used to create the new release tag. + */ + public void setRelease(String rel) + { + release = rel; + } + + /** + * Get the release tag to be created. + * @return newreleasetag to create it. + */ + public String getNewTag() + { + return newtag; + } + + /** + * Set the new release tag to be used. + * @param newtag + */ + public void setNewTag(String tag) + { + newtag = tag; + } +} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/DeleteReleaseTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/DeleteReleaseTag.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.ccmtask.ant.commands; + +/** + * This object contains info requred to delete the release tag. + * + */ +public class DeleteReleaseTag extends CcmCommand +{ + + private String newtag; + + private String release; + + private String purpose; + + private String project; + + /* + * Helper function to get the project information for delete the new release tag. + * @return the project used for creating new release tag. + */ + public String getProject() + { + return project; + } + + /* + * Helper function to set the project information for delete the new release tag. + * @param prj - project info to be set for deleting a new release tag. + */ + public void setProject(String prj) { + project = prj; + } + + /* + * Helper function to get the release information for delete the new release tag. + * @param prj - project info to be set for deleting a new release tag. + */ + public String getRelease() + { + return release; + } + + /* + * Helper function to set the release information for delete the new release tag. + * @param rel - project info to be set for deleting a new release tag. + */ + public void setRelease(String rel) + { + release = rel; + } + + /** + * Get the new release tag info. + * @return newtag + */ + public String getNewTag() + { + return newtag; + } + + /** + * Set the new release tag info. + * @param tag - newtag information to be used to create the new release tag. + */ + public void setNewTag(String tag) + { + newtag = tag; + } +} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Reconcile.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Reconcile.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.ccmtask.ant.commands; + +/** + * This object is used to reconcile a ccm project. + * + */ +public class Reconcile extends CcmCommand +{ + private String project; + + /** + * Get the project to reconcile. + * @return + */ + public String getProject() + { + return project; + } + + /** + * Set the project to reconcile. + * @param project + */ + public void setProject(String project) + { + this.project = project; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Role.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Role.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,42 @@ +/* +* 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.ccmtask.ant.commands; + +/** + * This object is used to switch synergy role. + * + */ +public class Role extends CcmCommand { + private String role; + + /** + * Set the role to switch to. + * @param role + */ + public void setRole(String role) { + this.role = role; + } + + /** + * Get the role to switch to. + * @return + */ + public String getRole() { + return role; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Snapshot.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Snapshot.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,102 @@ +/* +* 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.ccmtask.ant.commands; + +/** + * This object is used to snap shot a ccm project. + * + */ +public class Snapshot extends CcmCommand +{ + private String project; + private String dir; + private boolean recursive; + private boolean fast; + + /** + * Get the project to snapshot. + * @return + */ + public String getProject() + { + return project; + } + + /** + * Set the project to snapshot. + * @param project + */ + public void setProject(String project) + { + this.project = project; + } + + /** + * Get the location where to snapshot + * @return + */ + public String getDir() + { + return dir; + } + + /** + * Set the location where to snapshot + * @param dir + */ + public void setDir(String dir) + { + this.dir = dir; + } + + /** + * Shall sub-projects be snapshotted? + * @return + */ + public boolean getRecursive() + { + return recursive; + } + + /** + * Set if sub-projects should be snapshotted. + * @return + */ + public void setRecursive(boolean recursive) + { + this.recursive = recursive; + } + + /** + * Shall multi-threaded snapshot be used.? + * @return + */ + public boolean getFast() + { + return fast; + } + + /** + * Set if multi-threaded snapshot should be used. + * @param fast + */ + public void setFast(boolean fast) + { + this.fast = fast; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Synchronize.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Synchronize.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,66 @@ +/* +* 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.ccmtask.ant.commands; + +/** + * This object is used to Synchronize a ccm project. + * + */ +public class Synchronize extends CcmCommand +{ + private String project; + private boolean recursive = true; + + + /** + * Get the project to checkout. + * @return + */ + public String getProject() + { + return project; + } + + /** + * Set the project to checkout. + * @return the project four part name + */ + public void setProject(String project) + { + this.project = project; + } + + /** + * Shall subprojects workarea be maintained relatively to the parent. + * @return + */ + public boolean getRecursive() + { + return recursive; + } + + /** + * Set if the checkout should be a recursive. + * @param recursive + */ + public void setRecursive(boolean recursive) + { + this.recursive = recursive; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Update.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Update.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.ccmtask.ant.commands; + +/** + * This object is used to update a ccm project. + * + */ +public class Update extends CcmCommand +{ + private String project; + + /** + * Get the project to update + * @return + */ + public String getProject() + { + return project; + } + + /** + * De + * @param project + */ + public void setProject(String project) + { + this.project = project; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Workarea.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/commands/Workarea.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,102 @@ +/* +* 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.ccmtask.ant.commands; +/** + * Creates interface to get\set workarea informations for a given project. + * + */ +public class Workarea extends CcmCommand +{ + private String project; + private String path; + private String pst; + private boolean maintain; + private boolean recursive; + private boolean relative; + private boolean wat; + + public String getProject() + { + return project; + } + + public void setProject(String project) + { + this.project = project; + } + + public boolean getMaintain() + { + return maintain; + } + + public void setMaintain(boolean maintain) + { + this.maintain = maintain; + } + + public boolean getRecursive() + { + return recursive; + } + + public void setRecursive(boolean recursive) + { + this.recursive = recursive; + } + + public boolean getRelative() + { + return relative; + } + + public void setRelative(boolean relative) + { + this.relative = relative; + } + + public String getPath() + { + return path; + } + + public void setPath(String path) + { + this.path = path; + } + + public String getPst() + { + return pst; + } + + public void setPst(String pst) + { + this.pst = pst; + } + + public boolean getWat() + { + return wat; + } + + public void setWat(boolean wat) + { + this.wat = wat; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/taskdefs/CcmTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/taskdefs/CcmTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,238 @@ +/* +* 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.ccmtask.ant.taskdefs; + +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Vector; +import java.util.jar.JarFile; +import java.util.zip.ZipEntry; + +import org.python.util.PythonInterpreter; + +import com.nokia.helium.ccmtask.ant.commands.AddTask; +import com.nokia.helium.ccmtask.ant.commands.CcmCommand; +import com.nokia.helium.ccmtask.ant.commands.ChangeReleaseTag; +import com.nokia.helium.ccmtask.ant.commands.Checkout; +import com.nokia.helium.ccmtask.ant.commands.Close; +import com.nokia.helium.ccmtask.ant.commands.Reconcile; +import com.nokia.helium.ccmtask.ant.commands.Role; +import com.nokia.helium.ccmtask.ant.commands.Snapshot; +import com.nokia.helium.ccmtask.ant.commands.Synchronize; +import com.nokia.helium.ccmtask.ant.commands.Update; +import com.nokia.helium.ccmtask.ant.commands.Workarea; +import com.nokia.helium.ccmtask.ant.types.SessionSet; +import com.nokia.helium.ccmtask.ant.commands.CreateReleaseTag; +import com.nokia.helium.ccmtask.ant.commands.DeleteReleaseTag; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; + +/** + * Synergy task. + *
    + * <hlm:createSessionMacro database="to1tobet" reference="test.session" />
    + * <hlm:ccm verbose="false">
    + *     <hlm:sessionset refid="test.session" />
    + *     <hlm:addtask folder="tr1test1#2079">
    + *         <task name="tr1test1#5310" />
    + *     </hlm:addtask>
    + *     <hlm:snapshot project="helium-to1tobet#helium_3.0:project:vc1s60p1#1" dir="c:\test" fast="true" recursive="true" />
    + *     <hlm:synchronize project="helium-to1tobet#helium_3.0:project:vc1s60p1#1" recursive="true" />
    + *     <hlm:close />
    + * </hlm:ccm>
    + * 
    + * @ant.task category="SCM" + */ +public class CcmTask extends Task +{ + private String username; + + private String password; + + private List commands = new ArrayList(); + private Vector sessionSets = new Vector(); + private boolean verbose; + + public void setVerbose(boolean value) { + verbose = value; + } + + public boolean getVerbose() { + return verbose; + } + + public String getUsername() + { + return username; + } + + public final void setUsername(final String username) + { + this.username = username; + } + + public String getPassword() + { + return password; + } + + public final void setPassword(final String password) + { + this.password = password; + } + + public CcmCommand[] getCommands() + { + return commands.toArray(new CcmCommand[commands.size()]); + } + + public void addUpdate(Update a) + { + addCommand(a); + } + + public void addSynchronize(Synchronize a) + { + addCommand(a); + } + + public void addReconcile(Reconcile a) + { + addCommand(a); + } + + public void addSnapshot(Snapshot a) + { + addCommand(a); + } + + public void addChangeReleaseTag(ChangeReleaseTag a) + { + addCommand(a); + } + + public void addCreateReleaseTag(CreateReleaseTag a) + { + addCommand(a); + } + + public void addDeleteReleaseTag(DeleteReleaseTag a) + { + addCommand(a); + } + + public void addCheckout(Checkout a) + { + addCommand(a); + } + + public void addWorkarea(Workarea a) + { + addCommand(a); + } + + public void addRole(Role a) + { + addCommand(a); + } + + private void addCommand(CcmCommand cmd) + { + cmd.setTask(this); + commands.add(cmd); + } + + public AddTask createAddTask() + { + AddTask cmd = new AddTask(); + addCommand(cmd); + return cmd; + } + + public Role createRole() + { + Role cmd = new Role(); + addCommand(cmd); + return cmd; + } + + public Close createClose() + { + Close cmd = new Close(); + addCommand(cmd); + return cmd; + } + + public SessionSet createSessionSet() + { + SessionSet sessionSet = new SessionSet(); + sessionSets.add(sessionSet); + return sessionSet; + } + + public SessionSet[] getSessionSets() { + SessionSet[] result = new SessionSet[sessionSets.size()]; + sessionSets.copyInto(result); + return result; + } + + public final void execute() + { + File jar = getJarFile(); + if (jar == null) { + throw new BuildException("Could not find the jar file for class " + this.getClass().getCanonicalName()); + } + try { + JarFile jarFile = new JarFile(jar); + String entryName = this.getClass().getPackage().getName().replace('.', '/') + "/ccmtask.py"; + ZipEntry entry = jarFile.getEntry(entryName); + if (entry == null) { + throw new BuildException("CcmTask internal error: Could not find the following entry: " + entryName); + } + PythonInterpreter pi = new PythonInterpreter(); + pi.set("java_ccmtask", this); + pi.set("project", getProject()); + pi.execfile(jarFile.getInputStream(entry), "ccmtask.py"); + } catch (IOException e) { + throw new BuildException(e.getMessage(), e); + } + } + + /** + * Returns the jar file name containing this class + * @return a File object or null if not found. + * @throws IMakerException + */ + protected File getJarFile() { + 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 BuildException("Error determining the jar file where " + + this.getClass().getName() + " is located.", e); + } + } + return null; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/taskdefs/ccmtask.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/taskdefs/ccmtask.py Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,260 @@ +#============================================================================ +#Name : ccmtask.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: +#=============================================================================== +""" Script to process Ant task commands. """ + +import ccm +import ccm.extra +import sys +import logging +import ant +import string + +logging.basicConfig(level=logging.INFO) +antlogger = ant.AntHandler(java_ccmtask) +rlogger = logging.getLogger('') +# replacing default handler by Ant one. +if len(rlogger.handlers) > 0: + rlogger.removeHandler(rlogger.handlers[0]) +rlogger.addHandler(antlogger) +logging.getLogger("ccm").setLevel(logging.INFO) +logger = logging.getLogger("ccm.ant") +session = None + +def execute_update(command): + java_ccmtask.log(str('Updating project: ' + command.getProject())) + project = session.create(command.getProject()) + project.update() + +def execute_role(command): + if not command.getRole(): + raise Exception("The 'role' attribute has not been defined.") + java_ccmtask.log(str('Updating role: ' + command.getRole())) + session.role = command.getRole() + +def execute_synchronize(command): + if not command.getProject(): + raise Exception("The 'project' attribute has not been defined.") + java_ccmtask.log(str('Synchronizing project: ' + command.getProject())) + java_ccmtask.log(str("Recursive: %s" % command.getRecursive())) + project = session.create(command.getProject()) + project.sync(command.getRecursive()) + +def execute_reconcile(command): + if not command.getProject(): + raise Exception("The 'project' attribute has not been defined.") + java_ccmtask.log(str('Reconciling project: ' + command.getProject())) + project = session.create(command.getProject()) + project.reconcile() + +def execute_snapshot(command): + if not command.getProject(): + raise Exception("The 'project' attribute has not been defined.") + if not command.getDir(): + raise Exception("The 'dir' attribute has not been defined.") + java_ccmtask.log(str('Snapshot of project: ' + command.getProject() + ' to ' + command.getDir())) + project = session.create(command.getProject()) + if command.getFast()== True: + ccm.extra.FastSnapshot(project, command.getDir()) + else: + project.snapshot(command.getDir(), command.getRecursive()) + +def execute_changereleasetag(command): + if not command.getFolder(): + raise Exception("The 'folder' attribute has not been defined.") + if not command.getReleaseTag(): + raise Exception("The 'releaseTag' attribute has not been defined.") + java_ccmtask.log(str('Changing release tag for all tasks in the folder : ' + command.getFolder() + ' as ' + command.getReleaseTag())) + #Search all task from the folder + folder = session.create("Folder " + str(command.getFolder())) + for task in folder.tasks: + if task.release != str(command.getReleaseTag()): + task.release = str(command.getReleaseTag()) + +def execute_checkout(command): + if not command.getProject(): + raise Exception("The 'project' attribute has not been defined.") + java_ccmtask.log(str('Checking out project: ' + command.getProject() + ' with release tag ' + command.getRelease())) + project = session.create(command.getProject()) + if (command.getRelease()): + if command.getWa(): + wa = command.getWa() + else: + wa = None + if command.getRecursive(): + recursive = command.getRecursive() + else: + recursive = None + if command.getRelative(): + relative = command.getRelative() + else: + relative = None + if command.getVersion(): + version = command.getVersion() + else: + version = None + if command.getPurpose(): + purpose = command.getPurpose() + else: + purpose = None + project.checkout(session.create(command.getRelease()), version, purpose, recursive) + +def execute_createreleasetag(command): + java_ccmtask.log(str('creating a release tag')) + if not command.getProject(): + raise Exception("The 'project' attribute has not been defined.") + project = session.create(command.getProject()) + if (command.getNewTag()): + new_release_tag = command.getNewTag(); + project.create_release_tag(command.getRelease(), new_release_tag) + +def execute_deletereleasetag(command): + java_ccmtask.log(str('deleting a release tag')) + if not command.getProject(): + raise Exception("The 'project' attribute has not been defined.") + project = session.create(command.getProject()) + if (command.getNewTag()): + new_release_tag = command.getNewTag(); + project.delete_release_tag(command.getRelease(), new_release_tag) + +def execute_workarea(command): + if not command.getProject(): + raise Exception("The 'project' attribute has not been defined.") + java_ccmtask.log(str('Modifying work area for the project : ' + command.getProject())) + project = session.create(command.getProject()) + if command.getMaintain(): + maintain = command.getMaintain() + else: + maintain = None + if command.getRecursive(): + recursive = command.getRecursive() + else: + recursive = None + if command.getRelative(): + relative = command.getRelative() + else: + relative = None + if command.getPath(): + path = command.getPath() + else: + path = None + if command.getPst(): + pst = command.getPst() + else: + pst = None + if command.getWat(): + wat = command.getWat() + else: + wat = None + project.work_area(maintain, recursive, relative, path, pst, wat) + +def execute_addtask(command): + if command.getFolder() != None: + tasks = [] + ccmfolder = session.create("Folder " + command.getFolder()) + role = find_folder_information(command) + if role == "build_mgr": + java_ccmtask.log("Changing role to %s" % role) + session.role = "build_mgr" + + folder = session.create("Folder %s" % str(command.getFolder())) + for task in folder.tasks: + folder.remove(task) + + java_ccmtask.log("Adding task to folder %s" % ccmfolder) + tasks.extend(map(lambda task: session.create("Task " + task.getName()), command.getTasks())) + for task in tasks: + ccmfolder.append(task) + +def find_folder_information(command): + cmdline = "folder -sh i " + command.getFolder() + result = session.execute(cmdline) + result_array = str(result).split('\r') + for ldata in result_array : + if ldata.find('Writable By:') > 0: + wb,wd = ldata.split(':',1) + if wd.lstrip() == "Build Manager": + return "build_mgr" + else: + return "developer" + +def execute_exists(command): + fpn = None + if command.getObject() != None: + fpn = command.getObject() + elif command.getFolder() != None: + fpn = "Folder " + command.getFolder() + elif command.getTask() != None: + fpn = "Task " + command.getTask() + + if fpn == None: + raise Exception("You need to define either a 'task'/'folder'/'object' attribute.") + ccmo = session.create(fpn) + if ccmo.exists(): + java_ccmtask.log("'%s' exists." % ccmo) + else: + raise Exception("Could not find '%s'." % ccmo) + +def execute_close(command): + global session + java_ccmtask.log(str("Closing session %s." % session)) + session.close_on_exit = True + session.close() + session = None + +def referenceToObject(obj): + if obj.isReference() == 1: + ref = project.getReference(str(obj.getRefid().getRefId())) + if ref == None: + raise Exception("Could not find reference '%s'" % str(obj.getRefid().getRefId())) + return ref + else: + return obj + +sessionIds = [] +for session_set in java_ccmtask.getSessionSets(): + sessionIds.extend(map(lambda session: session.getAddr(), referenceToObject(session_set).getSessions())) + +print "Session list: ", sessionIds +if len(sessionIds) > 0: + sessionid = sessionIds.pop() + session = ccm.Session(username=None, engine=None, dbpath=None, ccm_addr=sessionid, close_on_exit=False) +else: + username = java_ccmtask.getUsername() + password = java_ccmtask.getPassword() + session = ccm.open_session(username=username, password=password) + +if java_ccmtask.getVerbose() == 1: + logging.getLogger("ccm").setLevel(logging.DEBUG) + +#print dir(sys.modules['__main__'] ) +ccm_commands = java_ccmtask.getCommands() +for command in ccm_commands: + print "Running command '%s'" % command.getName() + method_name = 'execute_' + command.getName() + method = sys.modules['__main__'].__dict__[method_name] + try: + method(command) + except Exception, e: + if java_ccmtask.getVerbose() == 1: + import traceback + logger.error(traceback.print_exc(file=sys.stdout)) + if 'result' in e: + logger.error(e.result) + logger.error(e) + raise e diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/types/Session.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/types/Session.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,47 @@ +/* +* 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.ccmtask.ant.types; + +import org.apache.tools.ant.types.DataType; + +/** + * This class abstract a synergy session. + * It store the address to an already existing session. + * @ant.type name="session" category="SCM" + */ +public class Session extends DataType { + // store the ccm_addr value + private String addr; + + /** + * Sets the synergy address. + * @param addr string representing the ccm_addr + */ + public void setAddr(String addr) { + this.addr = addr; + } + + /** + * Get the synergy address. + * @return string representing the ccm_addr + */ + public String getAddr() { + return this.addr; + } +} + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/types/SessionSet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/types/SessionSet.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,51 @@ +/* +* 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.ccmtask.ant.types; + +import org.apache.tools.ant.types.DataType; +import java.util.Vector; + +/** + * This class implement an Ant Datatype that represents a set of + * synergy sessions. + * @ant.type name="sessionset" category="SCM" + */ +public class SessionSet extends DataType { + private Vector sessions = new Vector(); + + /** + * Create and register a Session object. + * @return a Session object. + */ + public Session createSession() { + Session session = new Session(); + sessions.add(session); + return session; + } + + /** + * Returns an array of Session object. + * @returns an array of Session object + */ + public Session[] getSessions() { + Session[] result = new Session[sessions.size()]; + sessions.copyInto(result); + return result; + } +} + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/types/Task.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/types/Task.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.ccmtask.ant.types; + +import org.apache.tools.ant.types.DataType; + +/** + * This class abstract a synergy session. + * It store the address to an already existing session. + */ +public class Task extends DataType { + // store the ccm_addr value + private String name; + + /** + * Sets the synergy address. + * @param name string representing the ccm_addr + */ + public void setName(String name) { + this.name = name; + } + + /** + * Get the synergy address. + * @return string representing the ccm_addr + */ + public String getName() { + return name; + } +} + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/types/TaskSet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/src/com/nokia/helium/ccmtask/ant/types/TaskSet.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,51 @@ +/* +* 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.ccmtask.ant.types; + +import org.apache.tools.ant.types.DataType; +import java.util.Vector; + +/** + * This class abstract a synergy session. + * It store the address to an already existing session. + */ +public class TaskSet extends DataType { + // store the Task objects + private Vector tasks = new Vector(); + + /** + * Create and register a Session object. + * @return a Session object. + */ + public Task createTask() { + Task task = new Task(); + tasks.add(task); + return task; + } + + /** + * Returns an array of Session object. + * @returns an array of Session object + */ + public Task[] getSessions() { + Task[] result = new Task[tasks.size()]; + tasks.copyInto(result); + return result; + } +} + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/tests/antunit/test_ccmtask.ant.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/tests/antunit/test_ccmtask.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,194 @@ + + + + + Testing the ccm task + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/tests/bld.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/tests/bld.sh Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,26 @@ +#!/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 + +# Adding custom mock up tools to the path +export PATH=$(dirname $(readlink /proc/$$/fd/255))/ccm_mock:$PATH + +ant $* diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/tests/build.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/tests/build.bat Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,35 @@ +@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 Adding custom mock up tools to the path +set PATH=%~dp0ccm_mock;%PATH% + +call ant %* +if "%ERRORLEVEL%" neq "0" (goto error) +endlocal +goto :eof + +:error +endlocal +if "%OS%"=="Windows_NT" color 00 diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/tests/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/tests/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,27 @@ + + + + Helium antlib legacy tests. + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/tests/ccm_mock/ccm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/tests/ccm_mock/ccm Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,24 @@ +#!/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 + +unset PYTHONPATH +python $(dirname $(readlink -f $0))/ccm_mock.py $* diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/tests/ccm_mock/ccm.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/tests/ccm_mock/ccm.bat Wed Jun 16 16:51:40 2010 +0300 @@ -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 +setlocal +set PYTHONPATH= +@python %~dp0ccm_mock.py %* +endlocal diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/ccmtask/tests/ccm_mock/ccm_mock.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/ccmtask/tests/ccm_mock/ccm_mock.py Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,34 @@ +#============================================================================ +#Name : ccmtask.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 + +if len(sys.argv) == 4 and sys.argv[1] == 'set' and sys.argv[2] == 'role': + sys.exit(0) +elif len(sys.argv) == 2 and sys.argv[1] == 'status': + print """Sessions for user wbernard: + +Command Interface @ FAKESESSION:9999:192.168.0.1 (current session) +Database: /path/to/db/database + +Current project could not be identified. +""" +elif len(sys.argv) == 6 and sys.argv[1] == 'folder': + print "Added 1 task to " + sys.argv[5] + +sys.exit(0) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/demo/build.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/core/demo/build.bat Wed Jun 16 16:51:40 2010 +0300 @@ -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%\..\..\..\..\external\antlibs2 -lib %HELIUM_HOME%\build\components\helium-core\bin\helium-core.jar +ant %* +endlocal + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/demo/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/core/demo/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,73 @@ + + + + Helium java core demo. + + + + + + + + + + + + + + + + + + + + + + + ${drive.variable} is substituted + + + + + + + + + + Letters @{drive.letter} is unsubstituted + + + + + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/ivy.xml --- a/buildframework/helium/sf/java/core/ivy.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/core/ivy.xml Wed Jun 16 16:51:40 2010 +0300 @@ -33,6 +33,7 @@ + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/EmailDataSender.java --- a/buildframework/helium/sf/java/core/src/com/nokia/helium/core/EmailDataSender.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/EmailDataSender.java Wed Jun 16 16:51:40 2010 +0300 @@ -268,6 +268,9 @@ try { InternetAddress fromAddress = getFromAddress(); message.setFrom(fromAddress); + } catch (HlmAntLibException e) { + // We are Ignoring the errors as no need to fail the build. + log.debug("Error retrieving current user email address: " + e.getMessage(), e); } catch (javax.mail.internet.AddressException e) { // We are Ignoring the errors as no need to fail the build. log.debug("Error retrieving current user email address: " + e.getMessage(), e); @@ -358,9 +361,11 @@ NamingEnumeration en = ctx.search("", "uid=" + username, controls); if (en.hasMore()) { SearchResult sr = en.next(); - String email = (String) sr.getAttributes().get("mail").get(); - log.debug("getUserEmail:" + email); - return email; + if (sr.getAttributes().get("mail") != null) { + String email = (String) sr.getAttributes().get("mail").get(); + log.debug("getUserEmail:" + email); + return email; + } } } catch (javax.naming.NameNotFoundException ex) { throw new HlmAntLibException("Error finding user email for " + username ); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/FileUtils.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/FileUtils.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,81 @@ +/* + * 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; + +import java.io.File; + +/** + * This tool class provides file or system functionalities: + * - Find executable location + * + */ +public final class FileUtils { + + private FileUtils() { + } + + /** + * Find an executable based on given name from the PATH. PATHEXT will be used on windows plaform + * to search by extension. + * @param executableName the executable name + * @return the executable as a File, or null if not found. + */ + public static File findExecutableOnPath(String executableName) { + String systemPath = System.getenv("PATH"); + String[] pathDirs = systemPath.split(File.pathSeparator); + return findExecutableOnPath(executableName, pathDirs); + } + + /** + * Find an executable based on given name from the PATH. PATHEXT will be used on windows plaform + * to search by extension. + * @param executableName the executable name. + * @param pathDirs array of directory to look for + * @return the executable as a File, or null if not found. + */ + public static File findExecutableOnPath(String executableName, String[] pathDirs) { + String[] extensions = {""}; + + // Using PATHEXT to get the supported extensions on windows platform + if (System.getProperty("os.name").toLowerCase().startsWith("win")) { + extensions = System.getenv("PATHEXT").split(File.pathSeparator); + } + + for (String extension : extensions) { + String checkName = executableName; + if (System.getProperty("os.name").toLowerCase().startsWith("win") && !executableName.toLowerCase().endsWith(extension.toLowerCase())) { + checkName = executableName + extension; + } + + File file = new File(checkName); + if (file.isAbsolute()) { + if (file.isFile()) { + return file; + } + } + for (String pathDir : pathDirs) { + file = new File(pathDir, checkName); + if (file.isFile()) { + return file; + } + } + } + return null; + } + + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/AntCall.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/AntCall.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.taskdefs.Ant; +import org.apache.tools.ant.taskdefs.CallTarget; + +/** + * This task extends current AntCall task by + * supporting any kind of Reference object. + * + * @ant.task name="antcall" category="Core" + */ +public class AntCall extends CallTarget { + + /** + * Add a Reference object. + * @param ref the reference object. + */ + public void add(Ant.Reference ref) { + this.addReference(ref); + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/MappedVariable.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/MappedVariable.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.core.ant; + +/** + * This interface describe the methods a Mapped + * parameter must implement. + */ +public interface MappedVariable extends Variable { + + /** + * Get the name of the parameter. + * @return the parameter name + */ + String getName(); + + /** + * Get the value of the parameter + * @return the value. + */ + String getValue(); + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/Variable.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/Variable.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,42 @@ +/* +* 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; + +/** + * This interface describe the methods a command line variable + * must implement. + */ +public interface Variable +{ + + /** + * Get the command line parameter. It uses '=' character as the default + * separator. + * @return the parameter as a command line string + */ + String getParameter(); + + /** + * Get the command line parameter. Use custom parameter for joining + * the mapped parameters. + * @param separator mapped value separator + * @return the parameter as a command line string + */ + String getParameter(String separator); + +} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/VariableIFImpl.java --- a/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/VariableIFImpl.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* 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 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/VariableInterface.java --- a/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/VariableInterface.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* 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 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/VariableMap.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/VariableMap.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,35 @@ +/* +* 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 java.util.Collection; + +/** + * This interface describe the method a Map of variable must + * implements. + */ +public interface VariableMap +{ + + /** + * Get the name of the variable. + * @return name. + */ + Collection getVariables(); + +} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/antlib.xml --- a/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/antlib.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/antlib.xml Wed Jun 16 16:51:40 2010 +0300 @@ -23,17 +23,18 @@ - - + + + - - + + - + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/listener/TargetTimesLogGeneratorListener.java --- a/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/listener/TargetTimesLogGeneratorListener.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/listener/TargetTimesLogGeneratorListener.java Wed Jun 16 16:51:40 2010 +0300 @@ -92,8 +92,8 @@ targetTimesLogCsv, true); timesLogOut = new DataOutputStream(timesLogFileStream); // Display (sorted) hashtable. - for (String s : targetTimesTable) - timesLogOut.writeBytes(s + "\n"); + for (String targetTime : targetTimesTable) + timesLogOut.writeBytes(targetTime + "\n"); timesLogOut.close(); } } catch (java.io.FileNotFoundException ex) { diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/AntCall.java --- a/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/AntCall.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* 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.taskdefs.Ant; -import org.apache.tools.ant.taskdefs.CallTarget; - -/** - * This task extends current AntCall task by - * supporting any kind of Reference object. - * - * @ant.task name="antcall" category="Core" - */ -public class AntCall extends CallTarget { - - /** - * Add a Reference object. - * @param ref the reference object. - */ - public void add(Ant.Reference ref) { - this.addReference(ref); - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/GetFreeDriveTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/GetFreeDriveTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2010-2011 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 org.apache.tools.ant.Task; +import java.io.File; +import org.apache.tools.ant.taskdefs.condition.Os; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * Returns Next Free Drive available to use + * + *
    + * Usage: <hlm:getfreedrive property="build.drive"/>
    + * 
    + * @ant.task name="getfreedrive" category="Core" + */ +public class GetFreeDriveTask extends Task { + // property to set with the available drive + private String property; + + /** + * To find the free drives available to use + * + * @return First free drive available + */ + private String getNextFreeDrive() { + List drives = new ArrayList(Arrays.asList(File.listRoots())); + for (char i = 'Z'; i >= 'A'; i--) { + File file = new File(i + ":" + File.separator); + if (!drives.contains(file)) { + return i + ":"; + } + } + return null; + } + + /** + * Name of the property to be set. + * + * @param property + * the property name + * @ant.required + */ + public void setProperty(String property) { + this.property = property; + } + + @Override + public void execute() { + if (property == null) { + throw new BuildException("'property' attribute is not defined"); + } + if (!Os.isFamily(Os.FAMILY_WINDOWS)) { + throw new BuildException("Task getfreedrive is supported only on windows"); + } + String returnValue = getNextFreeDrive(); + if (returnValue != null) { + getProject().setNewProperty(property, returnValue); + } + else { + throw new BuildException("No free drive available"); + } + + + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/GetValueFromVariableSet.java --- a/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/GetValueFromVariableSet.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* 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 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/GetValueFromVariableSetTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/GetValueFromVariableSetTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -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 com.nokia.helium.core.ant.MappedVariable; +import com.nokia.helium.core.ant.VariableMap; +import org.apache.tools.ant.Task; +import com.nokia.helium.core.ant.types.VariableSet; + + +/** + * 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 GetValueFromVariableSetTask extends Task { + private String name; + private String property; + private boolean failOnError = true; + + private Vector variableMaps = 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 VariableSet createVariableIFImpl() { + VariableSet var = new VariableSet(); + 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(VariableMap vs) { + variableMaps.add(vs); + } + + public VariableMap getVariableInterface() { + if (variableMaps.isEmpty()) { + throw new BuildException("variable interface cannot be null"); + } + if (variableMaps.size() > 1 ) { + throw new BuildException("maximum one variable interface can be set"); + } + return variableMaps.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."); + VariableMap variableMap = getVariableInterface(); + for (MappedVariable var : variableMap.getVariables()) { + if (var.getName().equals(name)) { + getProject().setProperty(property, var.getValue()); + return; + } + } + if (failOnError) { + throw new BuildException("Could not find '" + name + "' variable."); + } + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/LDAP.java --- a/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/LDAP.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +0,0 @@ -/* - * 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.Task; -import org.apache.tools.ant.BuildException; -import javax.naming.*; -import javax.naming.directory.*; -import java.util.Hashtable; - -/** - * Task is to search data from LDAP server. - * - *
    - * Usage: <hlm:ldap url="${ldap.server.url}" 
    - *                  rootdn="${ldap.root.dn}" 
    - *                  filter="uid=${env.USERNAME}" 
    - *                  outputproperty="email.from" 
    - *                  key="mail"/>
    - * 
    - * @ant.task name="ldap" category="Core" - */ -public class LDAP extends Task { - private String url; - private String rootdn; - private String filter; - private String key; - private String property; - - /** - * Method executes current task. - */ - public void execute() { - if (url == null) - throw new BuildException("'url' attribute is not defined"); - if (rootdn == null) - throw new BuildException("'rootdn' attribute is not defined"); - if (filter == null) - throw new BuildException("'filter' attribute is not defined"); - if (property == null) - throw new BuildException("'property' attribute is not defined"); - if (key == null) - throw new BuildException("'key' attribute is not defined"); - - // Set up environment for creating initial context - Hashtable env = new Hashtable(); - env.put(Context.INITIAL_CONTEXT_FACTORY, - "com.sun.jndi.ldap.LdapCtxFactory"); - env.put(Context.PROVIDER_URL, url + "/" + rootdn); - - // Create initial context - try { - DirContext ctx = new InitialDirContext(env); - SearchControls controls = new SearchControls(); - controls.setSearchScope(SearchControls.SUBTREE_SCOPE); - NamingEnumeration en = ctx.search("", filter, - controls); - if (en.hasMore()) { - SearchResult sr = en.next(); - getProject().setProperty(property, - (String) sr.getAttributes().get(key).get()); - return; - } - } catch (NamingException exc) { - throw new BuildException(exc.getMessage()); - } - } - - /** - * Return the LDAP server URL. - * - * @return the LDAP server URL. - */ - public String getUrl() { - return url; - } - - /** - * Set LDAP server URL. - * - * @param url is the LDAP server URL to set. - * @ant.required - */ - public void setUrl(String url) { - this.url = url; - } - - /** - * Return LDAP root distinguished name. - * - * @return LDAP root distinguished name - */ - public String getRootdn() { - return rootdn; - } - - /** - * Set LDAP root distinguished name. - * - * @param rootdn is the LDAP root distinguished name to set. - * @ant.required - */ - public void setRootdn(String rootdn) { - this.rootdn = rootdn; - } - - /** - * Return object name to search in the LDAP. - * - * @return the object name to search in the LDAP - */ - public String getFilter() { - return filter; - } - - /** - * Set the object name to search in the LDAP. - * - * @param filter is the object name to set. - * @ant.required - */ - public void setFilter(String filter) { - this.filter = filter; - } - - /** - * Return the output property to set. - * - * @return is the output property to set. - */ - public String getOutputProperty() { - return property; - } - - /** - * Set the output property if the user found. - * - * @param property is the property to be set. - * @ant.required - */ - public void setOutputProperty(String property) { - this.property = property; - } - - /** - * Return the key search element to search user information. - * - * @return the key search element. - */ - public String getKey() { - return key; - } - - /** - * Set the key search element to search the user information. - * - * @param key is the key search element to set. - * @ant.required - */ - public void setKey(String key) { - this.key = key; - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/LDAPTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/LDAPTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,178 @@ +/* + * 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.Task; +import org.apache.tools.ant.BuildException; +import javax.naming.*; +import javax.naming.directory.*; +import java.util.Hashtable; + +/** + * Task is to search data from LDAP server. + * + *
    + * Usage: <hlm:ldap url="${ldap.server.url}" 
    + *                  rootdn="${ldap.root.dn}" 
    + *                  filter="uid=${env.USERNAME}" 
    + *                  outputproperty="email.from" 
    + *                  key="mail"/>
    + * 
    + * @ant.task name="ldap" category="Core" + */ +public class LDAPTask extends Task { + private String url; + private String rootdn; + private String filter; + private String key; + private String property; + + /** + * Method executes current task. + */ + public void execute() { + if (url == null) + throw new BuildException("'url' attribute is not defined"); + if (rootdn == null) + throw new BuildException("'rootdn' attribute is not defined"); + if (filter == null) + throw new BuildException("'filter' attribute is not defined"); + if (property == null) + throw new BuildException("'property' attribute is not defined"); + if (key == null) + throw new BuildException("'key' attribute is not defined"); + + // Set up environment for creating initial context + Hashtable env = new Hashtable(); + env.put(Context.INITIAL_CONTEXT_FACTORY, + "com.sun.jndi.ldap.LdapCtxFactory"); + env.put(Context.PROVIDER_URL, url + "/" + rootdn); + + // Create initial context + try { + DirContext ctx = new InitialDirContext(env); + SearchControls controls = new SearchControls(); + controls.setSearchScope(SearchControls.SUBTREE_SCOPE); + NamingEnumeration en = ctx.search("", filter, + controls); + if (en.hasMore()) { + SearchResult sr = en.next(); + getProject().setProperty(property, + (String) sr.getAttributes().get(key).get()); + return; + } + } catch (NamingException exc) { + throw new BuildException(exc.getMessage()); + } + } + + /** + * Return the LDAP server URL. + * + * @return the LDAP server URL. + */ + public String getUrl() { + return url; + } + + /** + * Set LDAP server URL. + * + * @param url is the LDAP server URL to set. + * @ant.required + */ + public void setUrl(String url) { + this.url = url; + } + + /** + * Return LDAP root distinguished name. + * + * @return LDAP root distinguished name + */ + public String getRootdn() { + return rootdn; + } + + /** + * Set LDAP root distinguished name. + * + * @param rootdn is the LDAP root distinguished name to set. + * @ant.required + */ + public void setRootdn(String rootdn) { + this.rootdn = rootdn; + } + + /** + * Return object name to search in the LDAP. + * + * @return the object name to search in the LDAP + */ + public String getFilter() { + return filter; + } + + /** + * Set the object name to search in the LDAP. + * + * @param filter is the object name to set. + * @ant.required + */ + public void setFilter(String filter) { + this.filter = filter; + } + + /** + * Return the output property to set. + * + * @return is the output property to set. + */ + public String getOutputProperty() { + return property; + } + + /** + * Set the output property if the user found. + * + * @param property is the property to be set. + * @ant.required + */ + public void setOutputProperty(String property) { + this.property = property; + } + + /** + * Return the key search element to search user information. + * + * @return the key search element. + */ + public String getKey() { + return key; + } + + /** + * Set the key search element to search the user information. + * + * @param key is the key search element to set. + * @ant.required + */ + public void setKey(String key) { + this.key = key; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/ValidateUserLogin.java --- a/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/ValidateUserLogin.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,239 +0,0 @@ -/* -* 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.Task; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.BuildException; -import javax.naming.*; -import javax.naming.directory.*; -import java.util.Hashtable; -import org.apache.tools.ant.taskdefs.condition.Condition; - -/** - * Task is to validate noe user with LDAP server. - *
    - * Usage: <hlm:ldapauthenticate url="${email.ldap.server}" 
    -                                rootdn="${email.ldap.rootdn}" 
    -                                searchdn="${ldap.organization.unit.rootdn}, ${ldap.people.rootdn}" 
    -                                filter="uid=${env.USERNAME}" 
    -                                outputproperty="is.authentication.sucess" 
    -                                key="employeeNumber"
    -                                password="${noe.password}"/>
    -   
    -
    - * Usage:   <condition property="is.authentication.sucess" >
    -                <hlm:ldapauthenticate url="${email.ldap.server}" 
    -                                rootdn="${email.ldap.rootdn}" 
    -                                searchdn="${ldap.organization.unit.rootdn}, ${ldap.people.rootdn}" 
    -                                filter="uid=${env.USERNAME}" 
    -                                key="employeeNumber"
    -                                password="${noe.password}"/>
    -            <condition/>
    -   
    - @ant.task name="ldapauthenticate" category="Core" - */ -public class ValidateUserLogin extends Task implements Condition -{ - private String url; - private String rootdn; - private String filter; - private String key; - private String property; - private String searchdn; - private String password; - - public void execute() - { - - if (property == null) - throw new BuildException("'property' attribute is not defined"); - validateParameters(url, rootdn, filter, key, searchdn, password); - log("Authenticating the user..."); - if (authenticateUser(url, searchUser(url, rootdn, filter, key, searchdn))) { - getProject().setProperty(property, "true"); - } - else { - getProject().setProperty(property, "false"); - } - } - - public boolean eval() { - - validateParameters(url, rootdn, filter, key, searchdn, password); - return authenticateUser(url, searchUser(url, rootdn, filter, key, searchdn)); - - } - - public String searchUser(String url, String rootdn, String filter, String key, String searchdn) { - - String userSearchDN = null; - // Set up environment for creating initial context - Hashtable env = new Hashtable(); - env.put(Context.INITIAL_CONTEXT_FACTORY, - "com.sun.jndi.ldap.LdapCtxFactory"); - env.put(Context.PROVIDER_URL, url + "/" + rootdn); - - // Create initial context - env.put(Context.SECURITY_AUTHENTICATION, "simple"); - DirContext ctx = null; - NamingEnumeration results = null; - try { - ctx = new InitialDirContext(env); - SearchControls controls = new SearchControls(); - controls.setSearchScope(SearchControls.SUBTREE_SCOPE); - results = ctx.search("", filter, controls); - while (results.hasMore()) { - SearchResult searchResult = (SearchResult) results.next(); - Attributes attributes = searchResult.getAttributes(); - Attribute attr = attributes.get(key); - userSearchDN = key + "=" + (String) attr.get() + ", " + searchdn + ", " + rootdn; - } - } catch (NamingException e) { - e.printStackTrace(); - throw new BuildException("LDAP Naming exception"); - } - return userSearchDN; - } - - public void validateParameters(String url, String rootdn, String filter, String key, String searchdn, String password) { - - if (url == null) - throw new BuildException("'url' attribute is not defined"); - if (rootdn == null) - throw new BuildException("'rootdn' attribute is not defined"); - if (filter == null) - throw new BuildException("'filter' attribute is not defined"); - if (key == null) - throw new BuildException("'key' attribute is not defined"); - if (searchdn == null) - throw new BuildException("'searchdn' attribute is not defined"); - if (password == null) - throw new BuildException("'password' attribute is not defined"); - } - - public boolean authenticateUser(String ldapurl, String rooTdn) { - - Hashtable env = new Hashtable(11); - env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); - env.put(Context.PROVIDER_URL, ldapurl); - env.put(Context.SECURITY_AUTHENTICATION, "simple"); - env.put(Context.SECURITY_PRINCIPAL, rooTdn); - env.put(Context.SECURITY_CREDENTIALS, password); - try { - 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; - } - - } - public String getUrl() - { - return url; - } - /** - * ldap URL - * @ant.required - */ - public void setUrl(String url) - { - this.url = url; - } - - - public String getRootdn() - { - return rootdn; - } - /** - * user password to authenticate - * @ant.required - */ - public void setpassword(String password) - { - this.password = password; - } - - public String getpassword() - { - return password; - } - /** - * ldap root distinguished name to search user. - * @ant.required - */ - public void setRootdn(String rootdn) - { - this.rootdn = rootdn; - } - - public String getsearchdn() - { - return searchdn; - } - /** - * ldap distinguished name to search user - * @ant.required - */ - public void setsearchdn(String searchdn) - { - this.searchdn = searchdn; - } - - public String getFilter() - { - return filter; - } - /** - * object name to search in the ldap. - * @ant.required - */ - public void setFilter(String filter) - { - this.filter = filter; - } - - public String getOutputProperty() - { - return property; - } - /** - * output property to set if the user found. - * @ant.required - */ - public void setOutputProperty(String property) - { - this.property = property; - } - - public String getKey() - { - return key; - } - /** - * key to search the user information - * @ant.required - */ - public void setKey(String key) - { - this.key = key; - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/ValidateUserLoginTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/ValidateUserLoginTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,239 @@ +/* +* 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.Task; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.BuildException; +import javax.naming.*; +import javax.naming.directory.*; +import java.util.Hashtable; +import org.apache.tools.ant.taskdefs.condition.Condition; + +/** + * Task is to validate noe user with LDAP server. + *
    + * Usage: <hlm:ldapauthenticate url="${email.ldap.server}" 
    +                                rootdn="${email.ldap.rootdn}" 
    +                                searchdn="${ldap.organization.unit.rootdn}, ${ldap.people.rootdn}" 
    +                                filter="uid=${env.USERNAME}" 
    +                                outputproperty="is.authentication.sucess" 
    +                                key="employeeNumber"
    +                                password="${noe.password}"/>
    +   
    +
    + * Usage:   <condition property="is.authentication.sucess" >
    +                <hlm:ldapauthenticate url="${email.ldap.server}" 
    +                                rootdn="${email.ldap.rootdn}" 
    +                                searchdn="${ldap.organization.unit.rootdn}, ${ldap.people.rootdn}" 
    +                                filter="uid=${env.USERNAME}" 
    +                                key="employeeNumber"
    +                                password="${noe.password}"/>
    +            <condition/>
    +   
    + @ant.task name="ldapauthenticate" category="Core" + */ +public class ValidateUserLoginTask extends Task implements Condition +{ + private String url; + private String rootdn; + private String filter; + private String key; + private String property; + private String searchdn; + private String password; + + public void execute() + { + + if (property == null) + throw new BuildException("'property' attribute is not defined"); + validateParameters(url, rootdn, filter, key, searchdn, password); + log("Authenticating the user..."); + if (authenticateUser(url, searchUser(url, rootdn, filter, key, searchdn))) { + getProject().setProperty(property, "true"); + } + else { + getProject().setProperty(property, "false"); + } + } + + public boolean eval() { + + validateParameters(url, rootdn, filter, key, searchdn, password); + return authenticateUser(url, searchUser(url, rootdn, filter, key, searchdn)); + + } + + public String searchUser(String url, String rootdn, String filter, String key, String searchdn) { + + String userSearchDN = null; + // Set up environment for creating initial context + Hashtable env = new Hashtable(); + env.put(Context.INITIAL_CONTEXT_FACTORY, + "com.sun.jndi.ldap.LdapCtxFactory"); + env.put(Context.PROVIDER_URL, url + "/" + rootdn); + + // Create initial context + env.put(Context.SECURITY_AUTHENTICATION, "simple"); + DirContext ctx = null; + NamingEnumeration results = null; + try { + ctx = new InitialDirContext(env); + SearchControls controls = new SearchControls(); + controls.setSearchScope(SearchControls.SUBTREE_SCOPE); + results = ctx.search("", filter, controls); + while (results.hasMore()) { + SearchResult searchResult = (SearchResult) results.next(); + Attributes attributes = searchResult.getAttributes(); + Attribute attr = attributes.get(key); + userSearchDN = key + "=" + (String) attr.get() + ", " + searchdn + ", " + rootdn; + } + } catch (NamingException e) { + e.printStackTrace(); + throw new BuildException("LDAP Naming exception"); + } + return userSearchDN; + } + + public void validateParameters(String url, String rootdn, String filter, String key, String searchdn, String password) { + + if (url == null) + throw new BuildException("'url' attribute is not defined"); + if (rootdn == null) + throw new BuildException("'rootdn' attribute is not defined"); + if (filter == null) + throw new BuildException("'filter' attribute is not defined"); + if (key == null) + throw new BuildException("'key' attribute is not defined"); + if (searchdn == null) + throw new BuildException("'searchdn' attribute is not defined"); + if (password == null) + throw new BuildException("'password' attribute is not defined"); + } + + public boolean authenticateUser(String ldapurl, String rooTdn) { + + Hashtable env = new Hashtable(11); + env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); + env.put(Context.PROVIDER_URL, ldapurl); + env.put(Context.SECURITY_AUTHENTICATION, "simple"); + env.put(Context.SECURITY_PRINCIPAL, rooTdn); + env.put(Context.SECURITY_CREDENTIALS, password); + try { + 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; + } + + } + public String getUrl() + { + return url; + } + /** + * ldap URL + * @ant.required + */ + public void setUrl(String url) + { + this.url = url; + } + + + public String getRootdn() + { + return rootdn; + } + /** + * user password to authenticate + * @ant.required + */ + public void setpassword(String password) + { + this.password = password; + } + + public String getpassword() + { + return password; + } + /** + * ldap root distinguished name to search user. + * @ant.required + */ + public void setRootdn(String rootdn) + { + this.rootdn = rootdn; + } + + public String getsearchdn() + { + return searchdn; + } + /** + * ldap distinguished name to search user + * @ant.required + */ + public void setsearchdn(String searchdn) + { + this.searchdn = searchdn; + } + + public String getFilter() + { + return filter; + } + /** + * object name to search in the ldap. + * @ant.required + */ + public void setFilter(String filter) + { + this.filter = filter; + } + + public String getOutputProperty() + { + return property; + } + /** + * output property to set if the user found. + * @ant.required + */ + public void setOutputProperty(String property) + { + this.property = property; + } + + public String getKey() + { + return key; + } + /** + * key to search the user information + * @ant.required + */ + public void setKey(String key) + { + this.key = key; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/XMLLogCount.java --- a/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/XMLLogCount.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* - * 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 java.io.File; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import com.nokia.helium.core.ant.conditions.XMLLogCondition; - -/** - * This class sets a property to the number of matching severity inside a XML log. - * - * @ant.task name="countSeverity" category="Core" - */ -public class XMLLogCount extends Task { - - private File fileName; - private String severity; - private String logRegexp; - private String property; - - /** - * File to be parsed. - * - * @param filename - * @ant.required - */ - public void setFile(File filename) { - fileName = filename; - } - - /** - * Defines the severity name to be counted. - * - * @param severity - * @ant.required - */ - public void setSeverity(String severity) { - this.severity = severity; - } - - /** - * Name of the property to be set. - * @param property the property name - * @ant.required - */ - public void setProperty(String property) { - this.property = property; - } - - /** - * Regular expression which used to match a specific log filename. - * @param regex - * @ant.not-required - */ - public void setLogMatcher(String regex) { - this.logRegexp = regex; - } - - /** - * Execute the task. Set the property with number of severities. - * @throws BuildException - */ - public void execute() { - if (property == null) - throw new BuildException("'property' attribute is not defined"); - - XMLLogCondition cond = new XMLLogCondition(); - cond.setFile(fileName); - cond.setLogMatcher(logRegexp); - cond.setSeverity(severity); - getProject().setNewProperty(property, "" + cond.getSeverity()); - } -} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/XMLLogCountTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/taskdefs/XMLLogCountTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,90 @@ +/* + * 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 java.io.File; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import com.nokia.helium.core.ant.conditions.XMLLogCondition; + +/** + * This class sets a property to the number of matching severity inside a XML log. + * + * @ant.task name="countSeverity" category="Core" + */ +public class XMLLogCountTask extends Task { + + private File fileName; + private String severity; + private String logRegexp; + private String property; + + /** + * File to be parsed. + * + * @param filename + * @ant.required + */ + public void setFile(File filename) { + fileName = filename; + } + + /** + * Defines the severity name to be counted. + * + * @param severity + * @ant.required + */ + public void setSeverity(String severity) { + this.severity = severity; + } + + /** + * Name of the property to be set. + * @param property the property name + * @ant.required + */ + public void setProperty(String property) { + this.property = property; + } + + /** + * Regular expression which used to match a specific log filename. + * @param regex + * @ant.not-required + */ + public void setLogMatcher(String regex) { + this.logRegexp = regex; + } + + /** + * Execute the task. Set the property with number of severities. + * @throws BuildException + */ + public void execute() { + if (property == null) + throw new BuildException("'property' attribute is not defined"); + + XMLLogCondition cond = new XMLLogCondition(); + cond.setFile(fileName); + cond.setLogMatcher(logRegexp); + cond.setSeverity(severity); + getProject().setNewProperty(property, "" + cond.getSeverity()); + } +} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/types/Variable.java --- a/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/types/Variable.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -/* -* 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" category="Core" - * @ant.type name="makeOption" category="Core" - */ -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 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/types/VariableImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/types/VariableImpl.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,145 @@ +/* +* 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.ArrayList; +import java.util.List; + +import org.apache.tools.ant.types.DataType; +import org.apache.tools.ant.BuildException; +import org.apache.commons.lang.StringUtils; + +import com.nokia.helium.core.ant.MappedVariable; +import java.util.Arrays; + +/** + * Helper class to store the command line variables + * with name / value pair. + * @ant.type name="arg" category="Core" + * @ant.type name="makeOption" category="Core" + */ +public class VariableImpl extends DataType implements MappedVariable +{ + private String name; + private String value; + private String cmdLine; + + /** + * Set the name of the variable. + * @param name + */ + public void setName(String name) { + this.name = name; + } + + /** + * Get the name of the variable. Will return name is name attribute is set + * or first command line parameter if line is used. + * @return name. + */ + public String getName() { + if ( cmdLine == null) { + if (name == null ) { + throw new BuildException( "'name' attribute must be defined"); + } + if (value == null) { + throw new BuildException( "'value' attribute must be defined"); + } + 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 value) { + this.value = value; + } + + /** + * 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. Returns value if name/value are used, or the line attribute minus + * the first command line parameter. + * @return value. + */ + public String getValue() { + if ( cmdLine == null) { + if (name == null ) { + throw new BuildException( "'name' attribute must be defined"); + } + if (value == null) { + throw new BuildException( "'value' attribute must be defined"); + } + return value; + } else { + if (name != null && value != null) { + throw new BuildException( "You can define either name, value or line attribute but not both"); + } + + String cmdPart = cmdLine.trim(); + List cmdList = new ArrayList(Arrays.asList(cmdPart.split(" "))); + if (cmdList.size() > 0) { + cmdList.remove(0); + } + return StringUtils.join(cmdList.toArray(), " "); // "-c armv5 -c foobar" : " armv5 -c foobar" + } + } + + /** + * {@inheritDoc} + */ + public String getParameter() { + return getParameter("="); + } + + /** + * {@inheritDoc} + */ + public String getParameter(String separator) { + if ( cmdLine == null) { + if (name == null ) { + throw new BuildException( "'name' attribute must be defined"); + } + if (value == null) { + throw new BuildException( "'value' attribute must be defined"); + } + return name + separator + value; + } else { + if (name != null && value != null) { + throw new BuildException( "You can define either name, value or line attribute but not both"); + } + return cmdLine; + } + } + +} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/types/VariableSet.java --- a/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/types/VariableSet.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/types/VariableSet.java Wed Jun 16 16:51:40 2010 +0300 @@ -17,48 +17,27 @@ package com.nokia.helium.core.ant.types; -import java.util.Vector; +import java.util.Collection; import java.util.HashMap; import java.util.List; -import com.nokia.helium.core.ant.VariableIFImpl; -import java.util.Collection; -import org.apache.tools.ant.types.Reference; + +import com.nokia.helium.core.ant.MappedVariable; +import com.nokia.helium.core.ant.Variable; +import com.nokia.helium.core.ant.VariableMap; + + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.types.DataType; 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" category="Core" */ -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(); +public class VariableSet extends DataType implements Variable, VariableMap { - 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); - } - } + private List variables = new ArrayList(); /** * Creates an empty variable element and adds @@ -66,9 +45,9 @@ * @return empty Variable pair */ public VariableSet createArgSet() { - VariableSet varSet = new VariableSet(); - add(varSet); - return varSet; + VariableSet variableSet = new VariableSet(); + variables.add(variableSet); + return variableSet; } /** @@ -77,25 +56,17 @@ * @return empty Variable pair */ public Variable createArg() { - Variable var = new Variable(); - add(var); - return var; + Variable variable = new VariableImpl(); + variables.add(variable); + return variable; } - - 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); + public void add(Variable variable) { + variables.add(variable); } /** @@ -106,49 +77,81 @@ return variables; } + /** + * Get the list of nested VariableSet. + * @return the list of VariableSet. + */ public List getVariableSets() { - return varSets; + List variableSets = new ArrayList(); + for (Variable variable : variables) { + if (variable instanceof VariableSet) { + variableSets.add((VariableSet)variable); + } + } + return variableSets; } - - - /** - * 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) { - varSetObject = refId.getReferencedObject(); + public HashMap getVariablesMap() { + if (this.isReference()) { + Object varSetObject = this.getRefid().getReferencedObject(); if (varSetObject != null && varSetObject instanceof VariableSet) { - HashMap varSetMap = ((VariableSet)varSetObject).getVariablesMap(); - allVariables.putAll(varSetMap); + return ((VariableSet)varSetObject).getVariablesMap(); + } else { + throw new BuildException("The '" + this.getRefid().getRefId() + "' reference is not referencing a VariableSet"); } + } else { + HashMap allVariables = new HashMap(); + for (Variable variable : variables) { + if (variable instanceof MappedVariable) { + allVariables.put(((MappedVariable)variable).getName(), (MappedVariable)variable); + } else if (variable instanceof VariableSet) + allVariables.putAll(((VariableSet)variable).getVariablesMap()); + } + return allVariables; } - if (varSets != null && (!varSets.isEmpty())) { - for (VariableSet varSet : varSets) { - HashMap variablesMap = varSet.getVariablesMap(); - allVariables.putAll(variablesMap); + } + + /** + * {@inheritDoc} + */ + @Override + public String getParameter() { + return getParameter("="); + } + + /** + * {@inheritDoc} + */ + @Override + public String getParameter(String separator) { + if (this.isReference()) { + Object varSetObject = this.getRefid().getReferencedObject(); + if (varSetObject != null && varSetObject instanceof VariableSet) { + return ((VariableSet)varSetObject).getParameter(separator); + } else { + throw new BuildException("The '" + this.getRefid().getRefId() + "' reference is not referencing a VariableSet"); } + } else { + String parameter = ""; + for (Variable variable : variables) { + + parameter += " " + variable.getParameter(separator); + } + return parameter; } - if (variables != null && !variables.isEmpty()) { - for (Variable var : variables) { - allVariables.put(var.getName(), var); - } - } - return allVariables; } + + /** + * {@inheritDoc} + */ + @Override + public Collection getVariables() { + return this.getVariablesMap().values(); + } + + } \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/tests/antunit/ldap/test_ldap.ant.xml --- a/buildframework/helium/sf/java/core/tests/antunit/ldap/test_ldap.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/core/tests/antunit/ldap/test_ldap.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -23,7 +23,6 @@ Helium antlib core ldap tests. - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/tests/antunit/pythontask/test_pythontask.ant.xml --- a/buildframework/helium/sf/java/core/tests/antunit/pythontask/test_pythontask.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/core/tests/antunit/pythontask/test_pythontask.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -23,7 +23,6 @@ Helium antlib core ldap tests. - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/tests/antunit/retrytask/test_retrytask.ant.xml --- a/buildframework/helium/sf/java/core/tests/antunit/retrytask/test_retrytask.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/core/tests/antunit/retrytask/test_retrytask.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -23,7 +23,6 @@ Helium antlib core ldap tests. - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/tests/antunit/test_getfreedrive.ant.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/core/tests/antunit/test_getfreedrive.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,64 @@ + + + + + + Testing getFreeDrive targets + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/tests/antunit/variableset/test_variableset.ant.xml --- a/buildframework/helium/sf/java/core/tests/antunit/variableset/test_variableset.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/core/tests/antunit/variableset/test_variableset.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -23,12 +23,11 @@ Helium antlib core variableset tests. - + - - + @@ -55,9 +54,9 @@ - + - + @@ -66,16 +65,16 @@ - + - + - + - + @@ -83,9 +82,9 @@ - + - + @@ -94,33 +93,33 @@ - + - + - + - + - + - + - + - + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/core/tests/src/com/nokia/helium/core/tests/TestFileUtils.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/core/tests/src/com/nokia/helium/core/tests/TestFileUtils.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.core.tests; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import com.nokia.helium.core.FileUtils; + +public class TestFileUtils { + + /** + * This test search the foobar excutable that should not exists. + */ + @Test + public void findNonExistingBinary() { + assertTrue(FileUtils.findExecutableOnPath("foobar") == null); + } + + /** + * This test is looking for ant executable, which must exists as + * we are running the test through Ant. + */ + @Test + public void findExistingBinary() { + assertTrue(FileUtils.findExecutableOnPath("ant") != null); + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/DiamondsClient.java --- a/buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/DiamondsClient.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/DiamondsClient.java Wed Jun 16 16:51:40 2010 +0300 @@ -197,6 +197,10 @@ postMethod = getPostMethod(fileName, strURL); result = processPostMethodResult(httpClient .executeMethod(postMethod)); + } catch (IllegalArgumentException e) { + // Catching this exception is needed because it is raised by httpclient + // library if the server is under update. + log.error("sendData:The final data via http not sent because errors:IllegalArgumentException ", e); } catch (DiamondsException e) { log.error("sendData:The final data via http not sent because errors:DiamondsException ", e); } catch (IOException e) { diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/DiamondsListenerImpl.java --- a/buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/DiamondsListenerImpl.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/DiamondsListenerImpl.java Wed Jun 16 16:51:40 2010 +0300 @@ -126,10 +126,10 @@ + "diamonds-full-results.xml"); FileUtils.getFileUtils().copyFile(first, fullResultsFile); XMLMerger merger = new XMLMerger(fullResultsFile); - HashSet h = new HashSet(finalLogList); - for (File f : h) { + HashSet fileHash = new HashSet(finalLogList); + for (File file : fileHash) { try { - merger.merge(f); + merger.merge(file); } catch (XMLMerger.XMLMergerException xe) { log.debug("Error during the merge: ", xe); } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/StageDiamondsListener.java --- a/buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/StageDiamondsListener.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/StageDiamondsListener.java Wed Jun 16 16:51:40 2010 +0300 @@ -18,14 +18,14 @@ package com.nokia.helium.diamonds; import org.apache.tools.ant.BuildEvent; + + import org.apache.tools.ant.Target; import org.apache.tools.ant.Project; import org.apache.tools.ant.BuildException; - - - import java.util.Date; - +import java.util.LinkedHashMap; +import java.util.Set; import java.util.HashMap; import java.util.List; import java.util.Enumeration; @@ -35,11 +35,8 @@ import java.util.Vector; import java.util.ArrayList; import org.apache.log4j.Logger; - import com.nokia.helium.core.PropertiesSource; import com.nokia.helium.core.TemplateInputSource; - - import com.nokia.helium.core.XMLTemplateSource; /** @@ -57,15 +54,16 @@ private Map stageTargetEndMap = new HashMap(); + private Map stageStartTargetMap = new HashMap(); + + private Map stageStartTargetTimeMap = new HashMap(); + private boolean isTargetMapInitialized; private Project project; - private String currentStartTargetName; - private List stages; - private Date currentStartTargetTime; public StageDiamondsListener() { stages = DiamondsConfig.getStages(); @@ -73,6 +71,7 @@ public void targetBegin(BuildEvent buildEvent) throws DiamondsException { project = buildEvent.getProject(); + int hashCode = project.hashCode(); String targetName = buildEvent.getTarget().getName(); if (!isTargetMapInitialized && stages != null) { log @@ -80,104 +79,150 @@ initStageTargetsMap(); isTargetMapInitialized = true; } - log.debug("targetBegin targetName: " + targetName + " - currentStartTargetName:" + currentStartTargetName); - if (currentStartTargetName == null) { - findAndSetStartTimeForTargetInStageList(targetName); + String targetNameWithHashCode = targetName + "-" + hashCode; + log.debug("targetBegin: targetNameWithHashCode: " + targetNameWithHashCode); + log.debug("targetBegin targetName: " + targetName + + " - currentStartTargetName:" + stageStartTargetMap.get(targetNameWithHashCode)); + if (stageStartTargetMap.get(targetNameWithHashCode) == null) { + log.debug("looking for start target match and associating time to it"); + findAndSetStartTimeForTargetInStageList(targetName, targetNameWithHashCode); } } + + private Date getStartTime(Stage stage, int hasCode) { + String startTargetName = stage.getStartTargetName(); + String endTargetName = stage.getEndTargetName(); + for (Iterator> listIter = stageTargetBeginList.iterator(); listIter + .hasNext();) { + Map stageMap = listIter.next(); + if (stageMap.get(startTargetName) != null) { + Set targetSet = stageMap.keySet(); + for (String key : targetSet) { + log.debug("key: " + key); + Date time = stageMap.get(key); + log.debug("time: " + time); + if ( time != INVALID_DATE) { + return time; + } + } + } + } + throw new BuildException("No time recorded " + + "for stage:" + stage.getStageName()); + } + private Stage getStageBasedOnEndTarget(String targetName, int hashCode) { + Stage stage = stageTargetEndMap.get(targetName); + if (stage != null) { + String currentStageTargetName = stageStartTargetMap.get( + stage.getStartTargetName() + "-" + hashCode); + log.debug("getStageBasedOnEndTarget: currentStargetTargetName" + currentStageTargetName); + if (currentStageTargetName != null) { + return stage; + } + } + return null; + } @SuppressWarnings("unchecked") public void targetEnd(BuildEvent buildEvent) throws DiamondsException { - if (currentStartTargetName != null) { - String targetName = buildEvent.getTarget().getName(); - Stage stage = stageTargetEndMap.get(targetName); - if (stage != null && getIsInitialized() ) { - //initDiamondsClient(); - String stageName = stage.getStageName(); - String sourceFile = stage.getSourceFile(); - log - .debug("diamonds:StageDiamondsListener: finished recording for stage: " - + stageName); - if (sourceFile == null) { - sourceFile = getSourceFile(stageName); - } - project.setProperty("logical.stage", stageName); - project.setProperty("stage.start.time", getTimeFormat() - .format(currentStartTargetTime)); - project.setProperty("stage.end.time", getTimeFormat() - .format(new Date())); - currentStartTargetName = null; - // Look for template file with stage name - String stageTemplateFileName = stageName + ".xml.ftl"; - File stageTemplateFile = new File(stageTemplateFileName); - if (stageTemplateFile.exists()) { - String output = DiamondsConfig.getOutputDir() - + File.separator + stageName + ".xml"; - try { - List sourceList = new ArrayList(); - sourceList.add(new PropertiesSource("ant", project - .getProperties())); - sourceList - .add(new XMLTemplateSource("doc", new File(sourceFile))); - getTemplateProcessor().convertTemplate(DiamondsConfig - .getTemplateDir(), stageTemplateFileName, - output, sourceList); - mergeToFullResults(new File(output)); - - // String mergedFile = mergeFiles(new File(output)); - - log.info("Sending data to diamonds for stage: " - + stageName); - getDiamondsClient().sendData(output, DiamondsConfig - .getDiamondsProperties().getDiamondsBuildID()); - } catch (com.nokia.helium.core.TemplateProcessorException e1) { - throw new DiamondsException( - "template conversion error for stage: " - + stageName + " : " + e1.getMessage()); - } - } else { - log.debug("diamonds:StageDiamondsListener:tempalte file: " - + stageTemplateFile + " does not exist"); - } - - String output = DiamondsConfig.getOutputDir() + File.separator - + stageName + "-time.xml"; - // Store the time for the current stage and send it - stageTemplateFileName = "diamonds_stage.xml.ftl"; + String targetName = buildEvent.getTarget().getName(); + project = buildEvent.getProject(); + int hashCode = project.hashCode(); + String targetNameWithHashCode = targetName + "-" + hashCode; + log.debug("targetEnd: targetNamewith-hashcode: " + targetNameWithHashCode); + + Stage stage = getStageBasedOnEndTarget(targetName, hashCode); + if (stage != null && getIsInitialized() ) { + //initDiamondsClient(); + String stageName = stage.getStageName(); + String sourceFile = stage.getSourceFile(); + log.debug("targetEnd: stageName: " + stageName); + log + .debug("diamonds:StageDiamondsListener: finished recording for stage: " + + stageName); + if (sourceFile == null) { + sourceFile = getSourceFile(stageName); + } + log.debug("targetEnd: logical.stage: " + stageName); + Date startTime = getStartTime(stage, hashCode); + log.debug("targetEnd: starttime: " + startTime); + log.debug("targetEnd: endtime: " + + getTimeFormat().format(new Date())); + project.setProperty("logical.stage", stageName); + project.setProperty("stage.start.time", getTimeFormat() + .format(startTime)); + project.setProperty("stage.end.time", getTimeFormat() + .format(new Date())); + // Look for template file with stage name + String stageTemplateFileName = stageName + ".xml.ftl"; + File stageTemplateFile = new File(stageTemplateFileName); + if (stageTemplateFile.exists()) { + String output = DiamondsConfig.getOutputDir() + + File.separator + stageName + ".xml"; try { List sourceList = new ArrayList(); sourceList.add(new PropertiesSource("ant", project .getProperties())); - sourceList.add(new XMLTemplateSource("doc", new File(sourceFile))); + sourceList + .add(new XMLTemplateSource("doc", new File(sourceFile))); getTemplateProcessor().convertTemplate(DiamondsConfig - .getTemplateDir(), stageTemplateFileName, output, - sourceList); + .getTemplateDir(), stageTemplateFileName, + output, sourceList); mergeToFullResults(new File(output)); - // List filesToMerge = new ArrayList(); - - // mergedFile = mergeFiles(output); + log.info("Sending data to diamonds for stage: " + + stageName); getDiamondsClient().sendData(output, DiamondsConfig .getDiamondsProperties().getDiamondsBuildID()); } catch (com.nokia.helium.core.TemplateProcessorException e1) { - throw new DiamondsException("template conversion error while sending data for stage: " - + stageName + " : " + e1.getMessage()); + throw new DiamondsException( + "template conversion error for stage: " + + stageName + " : " + e1.getMessage()); } + } else { + log.debug("diamonds:StageDiamondsListener:tempalte file: " + + stageTemplateFile + " does not exist"); + } + + String output = DiamondsConfig.getOutputDir() + File.separator + + stageName + "-time.xml"; + log.debug("targetEnd: output " + output); + // Store the time for the current stage and send it + stageTemplateFileName = "diamonds_stage.xml.ftl"; + try { + List sourceList = new ArrayList(); + sourceList.add(new PropertiesSource("ant", project + .getProperties())); + sourceList.add(new XMLTemplateSource("doc", new File(sourceFile))); + getTemplateProcessor().convertTemplate(DiamondsConfig + .getTemplateDir(), stageTemplateFileName, output, + sourceList); + mergeToFullResults(new File(output)); + // List filesToMerge = new ArrayList(); + + // mergedFile = mergeFiles(output); + getDiamondsClient().sendData(output, DiamondsConfig + .getDiamondsProperties().getDiamondsBuildID()); + } catch (com.nokia.helium.core.TemplateProcessorException e1) { + throw new DiamondsException("template conversion error while sending data for stage: " + + stageName + " : " + e1.getMessage()); } } } - private void findAndSetStartTimeForTargetInStageList(String targetName) - throws DiamondsException { + private void findAndSetStartTimeForTargetInStageList(String targetName, + String targetNameWithHashCode) throws DiamondsException { for (Iterator> listIter = stageTargetBeginList.iterator(); listIter .hasNext();) { Map stageMap = listIter.next(); Date targetTime = stageMap.get(targetName); if (targetTime != null && targetTime.equals(INVALID_DATE)) { - log.debug("diamonds:StageDiamondsListener: started recording for stage-target: " + log.debug("diamonds:StageDiamondsListener: started recording for stage-target-----: " + targetName); + log.debug("findtime: targetNamewith-hashcode: " + targetNameWithHashCode); + log.debug("findtime: time: " + new Date()); stageMap.put(targetName, new Date()); - currentStartTargetName = targetName; - currentStartTargetTime = new Date(); + stageStartTargetMap.put(targetNameWithHashCode, targetName); + stageStartTargetTimeMap.put(targetNameWithHashCode, new Date()); } } } @@ -189,7 +234,7 @@ // stage begin process Stage stage = iter.next(); String startTargetName = stage.getStartTargetName(); - Map stageMap = new HashMap(); + Map stageMap = new LinkedHashMap(); Vector arrayList = null; try { arrayList = project.topoSort(startTargetName, project @@ -211,6 +256,13 @@ // stage end process String endTargetName = stage.getEndTargetName(); // fast lookup + Stage existingStage = stageTargetEndMap.get(endTargetName); + if (existingStage != null) { + throw new BuildException("Not supported: two stages with" + + "same ending target defined by:stage1: " + + existingStage.getStageName() + + "stage2: " + stage.getStageName()); + } stageTargetEndMap.put(endTargetName, stage); log.debug(" - End target: " + endTargetName); } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/XMLMerger.java --- a/buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/XMLMerger.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/XMLMerger.java Wed Jun 16 16:51:40 2010 +0300 @@ -100,22 +100,22 @@ @SuppressWarnings("unchecked") protected void mergeNode(Element dest, Element src) { for (Iterator node = src.elements().iterator(); node.hasNext();) { - Element e = node.next(); + Element element = node.next(); - List ses = dest.elements(e.getName()); + List ses = dest.elements(element.getName()); boolean add = true; for (Element se : ses) { - if (areSame(se, e)) { - log.debug("Element " + e.getName() + " already found in dest."); + if (areSame(se, element)) { + log.debug("Element " + element.getName() + " already found in dest."); add = false; } } if (add) { - log.debug("Adding node " + e.getName() + " to " + dest.getName()); - dest.add(e.detach()); + log.debug("Adding node " + element.getName() + " to " + dest.getName()); + dest.add(element.detach()); } else if (ses.size() > 0) { - log.debug("Merging " + ses.get(0).getName() + " to " + e.getName()); - mergeNode(ses.get(0), e); + log.debug("Merging " + ses.get(0).getName() + " to " + element.getName()); + mergeNode(ses.get(0), element); } } } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/ant/HeliumListener.java --- a/buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/ant/HeliumListener.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/ant/HeliumListener.java Wed Jun 16 16:51:40 2010 +0300 @@ -229,9 +229,9 @@ private void cleanup() { String loggingoutputfile = project.getProperty("logging.output.file"); if (loggingoutputfile != null) { - File f = new File(loggingoutputfile); - if (f.exists()) - f.delete(); + File file = new File(loggingoutputfile); + if (file.exists()) + file.delete(); } } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/diamonds/tests/antunit/run-scenario.ant.xml --- a/buildframework/helium/sf/java/diamonds/tests/antunit/run-scenario.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/diamonds/tests/antunit/run-scenario.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -24,7 +24,7 @@ Helium Antlib logger macro. - + @@ -36,15 +36,16 @@ + - + - + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/diamonds/tests/antunit/test_diamonds.ant.xml --- a/buildframework/helium/sf/java/diamonds/tests/antunit/test_diamonds.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/diamonds/tests/antunit/test_diamonds.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -25,7 +25,7 @@ - + @@ -43,5 +43,10 @@ + + + + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/diamonds/tests/config/diamonds_config.xml.ftl --- a/buildframework/helium/sf/java/diamonds/tests/config/diamonds_config.xml.ftl Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/diamonds/tests/config/diamonds_config.xml.ftl Wed Jun 16 16:51:40 2010 +0300 @@ -43,10 +43,25 @@ - + + + + + + + + -${count} \ No newline at end of file +${count} + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/diamonds/tests/scenarii/build/build.xml --- a/buildframework/helium/sf/java/diamonds/tests/scenarii/build/build.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/diamonds/tests/scenarii/build/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -40,6 +40,7 @@ + @@ -155,8 +156,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + test-invalid-target-input-file,test-invalid-stage-input-file, test-depend-target, + test-ant-call, test-ant-call-multiple, test-ant-call-multiple-parallel, + sequence-config-test-target-1,sequence-config-test-target-2 " /> \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/diamonds/tests/scenarii/invalid-address/build.xml --- a/buildframework/helium/sf/java/diamonds/tests/scenarii/invalid-address/build.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/diamonds/tests/scenarii/invalid-address/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -20,7 +20,7 @@ ============================================================================ --> - + Helium Antlib diamonds unittests. @@ -29,7 +29,7 @@ - + @@ -43,7 +43,6 @@ - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/diamonds/tests/scenarii/invalid-templates-1/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/diamonds/tests/scenarii/invalid-templates-1/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,53 @@ + + + + Helium Antlib diamonds unittests. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/diamonds/tests/scenarii/invalid-templates-1/diamonds_config.xml.ftl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/diamonds/tests/scenarii/invalid-templates-1/diamonds_config.xml.ftl Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/diamonds/tests/scenarii/invalid-templates/build.xml --- a/buildframework/helium/sf/java/diamonds/tests/scenarii/invalid-templates/build.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/diamonds/tests/scenarii/invalid-templates/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -20,11 +20,11 @@ ============================================================================ --> - + Helium Antlib diamonds unittests. - + @@ -40,7 +40,6 @@ - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/Command.java --- a/buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/Command.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/Command.java Wed Jun 16 16:51:40 2010 +0300 @@ -139,8 +139,8 @@ for (String arg : getArguments()) { cmdLine += " " + arg; } - for (Entry e : getVariables().entrySet()) { - cmdLine += " " + e.getKey() + "=" + e.getValue(); + for (Entry varEnum : getVariables().entrySet()) { + cmdLine += " " + varEnum.getKey() + "=" + varEnum.getValue(); } cmdLine += " " + getTarget(); return cmdLine; diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/engines/JavaEngine.java --- a/buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/engines/JavaEngine.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/engines/JavaEngine.java Wed Jun 16 16:51:40 2010 +0300 @@ -138,11 +138,11 @@ File tempDir = imaker.createWorkDir(); args.add("WORKDIR=" + tempDir.getAbsolutePath()); // Pushing custom variables - for (Entry e : cmd.getVariables().entrySet()) { - if (e.getKey().equals("WORKDIR")) { + for (Entry cmdEnum : cmd.getVariables().entrySet()) { + if (cmdEnum.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()); + args.add(cmdEnum.getKey() + "=" + cmdEnum.getValue()); } } // Setting the target diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/engines/build_imaker_roms_signing.mk.ftl --- a/buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/engines/build_imaker_roms_signing.mk.ftl Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/engines/build_imaker_roms_signing.mk.ftl Wed Jun 16 16:51:40 2010 +0300 @@ -54,11 +54,11 @@ <#list cmds as cmd> <#assign cmdline=""> <#list cmd.getArguments() as arg> - <#assign cmdline="${cmdline} ${arg}"> + <#assign cmdline="${cmdline} \"${arg}\""> <#assign vars=cmd.getVariables()> <#list vars?keys as var> - <#assign cmdline="${cmdline} ${var}=${vars[var]}"> + <#assign cmdline="${cmdline} \"${var}=${vars[var]}\""> @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> @@ -70,11 +70,11 @@ <#list cmds as cmd> <#assign cmdline=""> <#list cmd.getArguments() as arg> - <#assign cmdline="${cmdline} ${arg}"> + <#assign cmdline="${cmdline} \"${arg}\""> <#assign vars=cmd.getVariables()> <#list vars?keys as var> - <#assign cmdline="${cmdline} ${var}=${vars[var]}"> + <#assign cmdline="${cmdline} \"${var}=${vars[var]}\""> # # Building configuration ${iid}. @@ -104,11 +104,11 @@ <#list cmds as cmd> <#assign cmdline=""> <#list cmd.getArguments() as arg> - <#assign cmdline="${cmdline} ${arg}"> + <#assign cmdline="${cmdline} \"${arg}\""> <#assign vars=cmd.getVariables()> <#list vars?keys as var> - <#assign cmdline="${cmdline} ${var}=${vars[var]}"> + <#assign cmdline="${cmdline} \"${var}=${vars[var]}\""> @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> diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/taskdefs/IMakerTask.java --- a/buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/taskdefs/IMakerTask.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/taskdefs/IMakerTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -115,6 +115,10 @@ engine.setTask(this); return engine; } else { + log("Using engine: " + engineRefId); + if (this.getProject().getReference(engineRefId) == null) { + throw new BuildException("Could not find engine reference: '" + engineRefId + "'."); + } try { Engine engine = (Engine)this.getProject().getReference(engineRefId); engine.setTask(this); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/utils/ParallelExecutor.java --- a/buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/utils/ParallelExecutor.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/utils/ParallelExecutor.java Wed Jun 16 16:51:40 2010 +0300 @@ -71,10 +71,10 @@ for (int i = 0; st.hasMoreTokens(); i++) { cmdArray[i] = st.nextToken(); } - Process p; + Process process; try { - p = new ProcessBuilder(cmdArray).redirectErrorStream(true).start(); - BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); + process = new ProcessBuilder(cmdArray).redirectErrorStream(true).start(); + BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; StringBuffer buffer = new StringBuffer(); SimpleDateFormat df = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy"); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/imaker/tests/antunit/test_imaker.ant.xml --- a/buildframework/helium/sf/java/imaker/tests/antunit/test_imaker.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/imaker/tests/antunit/test_imaker.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -278,4 +278,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/imaker/tests/antunit/test_imaker_drive_letter.ant.xml --- a/buildframework/helium/sf/java/imaker/tests/antunit/test_imaker_drive_letter.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/imaker/tests/antunit/test_imaker_drive_letter.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -41,13 +41,15 @@ ------------------------------------------------------------------------------- - + + Usin custom epocroot. diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/internaldata/bin/com/nokia/helium/internaldata/ant/antlib.xml --- a/buildframework/helium/sf/java/internaldata/bin/com/nokia/helium/internaldata/ant/antlib.xml Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ - - - - - - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/internaldata/bin/com/nokia/helium/internaldata/ant/helium.antlib.xml --- a/buildframework/helium/sf/java/internaldata/bin/com/nokia/helium/internaldata/ant/helium.antlib.xml Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ - - - - - Ant task definition declarations. - - - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/antlib.xml --- a/buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/antlib.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/antlib.xml Wed Jun 16 16:51:40 2010 +0300 @@ -22,5 +22,5 @@ --> - + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/listener/AssertNode.java --- a/buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/listener/AssertNode.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/listener/AssertNode.java Wed Jun 16 16:51:40 2010 +0300 @@ -18,7 +18,7 @@ package com.nokia.helium.internaldata.ant.listener; //import com.nokia.ant.taskdefs.HlmAssertMessage; -import com.nokia.helium.internaldata.ant.taskdefs.HlmAssertMessage; +import com.nokia.helium.internaldata.ant.taskdefs.HlmAssertMessageTask; /** * Object to set end time for a task. * @@ -34,7 +34,7 @@ private int line = -1; private String assertName; - public AssertNode(DataNode parent, HlmAssertMessage task) { + public AssertNode(DataNode parent, HlmAssertMessageTask task) { super(parent, task); name = task.getTaskName(); this.setFilename(task.getLocation().getFileName()); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/listener/Listener.java --- a/buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/listener/Listener.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/listener/Listener.java Wed Jun 16 16:51:40 2010 +0300 @@ -19,7 +19,7 @@ import java.util.Hashtable; import java.util.Date; -import com.nokia.helium.internaldata.ant.taskdefs.HlmAssertMessage; +import com.nokia.helium.internaldata.ant.taskdefs.HlmAssertMessageTask; import org.apache.tools.ant.BuildEvent; import org.apache.tools.ant.BuildListener; import org.apache.tools.ant.Project; @@ -187,7 +187,7 @@ // Ignoring task information } - public void addAssertTask(HlmAssertMessage assertTask) { + public void addAssertTask(HlmAssertMessageTask assertTask) { if (buildNode != null) { DataNode parentNode = buildNode.find(assertTask.getOwningTarget()); if (parentNode != null) { diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/listener/XMLRenderer.java --- a/buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/listener/XMLRenderer.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/listener/XMLRenderer.java Wed Jun 16 16:51:40 2010 +0300 @@ -191,8 +191,8 @@ protected void createProperties(Element statistics) { Element propertiesElt = statistics.addElement("properties"); if (properties != null) { - for (Enumeration e = properties.keys(); e.hasMoreElements() ; ) { - String key = e.nextElement(); + for (Enumeration propertyEnum = properties.keys(); propertyEnum.hasMoreElements() ; ) { + String key = propertyEnum.nextElement(); Element propertyElt = propertiesElt.addElement("property"); propertyElt.addAttribute("name", key); propertyElt.addAttribute("value", properties.get(key)); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/taskdefs/HlmAssertMessage.java --- a/buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/taskdefs/HlmAssertMessage.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* -* 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.internaldata.ant.taskdefs; - -import org.apache.tools.ant.Task; -import org.apache.tools.ant.BuildException; -import com.nokia.helium.internaldata.*; -import com.nokia.helium.internaldata.ant.listener.Listener; - -import javax.naming.*; -import javax.naming.directory.*; - -/** - * Task to identify failing assert. - * - * Usage: <hlm:hlmassertmessage assertName="hlm:assertPropertySet" message="Warning: @{message}"/> - */ - -public class HlmAssertMessage extends Task { - - private String message; - private String assertName; - - public void execute() { - - if (assertName == null) - throw new BuildException("'assertName' attribute is not defined"); - if (message == null) - throw new BuildException("'message' attribute is not defined"); - - for (int i = 0 ; i < getProject().getBuildListeners().size() ; i++) { - if (getProject().getBuildListeners().get(i) instanceof Listener) { - Listener listen = (Listener)getProject().getBuildListeners().get(i); - listen.addAssertTask(this); - break; - } - } - } - /** - * Returns assert name. - * @return - */ - public String getAssertName() - { - return assertName; - } - /** - * Set the assertname. - * @param assertName - */ - public void setAssertName(String assertName) - { - this.assertName = assertName; - } - /** - * Return the assert message. - * @return - */ - public String getMessage() - { - return message; - } - /** - * Set the assert message. - * @param message - */ - public void setMessage(String message) - { - this.message = message; - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/taskdefs/HlmAssertMessageTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/taskdefs/HlmAssertMessageTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,91 @@ +/* +* 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.internaldata.ant.taskdefs; + +import org.apache.tools.ant.Task; +import org.apache.tools.ant.BuildException; +import com.nokia.helium.internaldata.ant.listener.Listener; + + +/** + * Task to identify failing assert and push them to the internal data database. + * + * Usage: + *
    + * <hlm:hlmassertmessage assertName="hlm:assertPropertySet" message="Warning: @{message}"/>
    + * 
    + * + * @ant.task name=hlmassertmessage category=internaldata + */ +public class HlmAssertMessageTask extends Task { + + private String message; + private String assertName; + + /** + * {@inheritDoc} + */ + public void execute() { + + if (assertName == null) + throw new BuildException("'assertName' attribute is not defined"); + if (message == null) + throw new BuildException("'message' attribute is not defined"); + + for (int i = 0 ; i < getProject().getBuildListeners().size() ; i++) { + if (getProject().getBuildListeners().get(i) instanceof Listener) { + Listener listen = (Listener)getProject().getBuildListeners().get(i); + listen.addAssertTask(this); + break; + } + } + } + /** + * Returns assert name. + * @return + */ + public String getAssertName() + { + return assertName; + } + /** + * Set the assertname. + * @param assertName + */ + public void setAssertName(String assertName) + { + this.assertName = assertName; + } + /** + * Return the assert message. + * @return + */ + public String getMessage() + { + return message; + } + /** + * Set the assert message. + * @param message + */ + public void setMessage(String message) + { + this.message = message; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/internaldata/tests/antunit/test_HlmAssertMessage.ant.xml --- a/buildframework/helium/sf/java/internaldata/tests/antunit/test_HlmAssertMessage.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/internaldata/tests/antunit/test_HlmAssertMessage.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -23,15 +23,14 @@ Helium Antlib internal unittests. - - + - + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMEntityManager.java --- a/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMEntityManager.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMEntityManager.java Wed Jun 16 16:51:40 2010 +0300 @@ -129,7 +129,7 @@ * @return entity manager */ public EntityManager getEntityManager() { - log.debug("ORMEntityManager: getEntityManager: " + entityManager); + //log.debug("ORMEntityManager: getEntityManager: " + entityManager); return entityManager; } @@ -178,11 +178,13 @@ entityManager = null; } if (factory != null) { + log.debug("closing the factory"); factory.close(); factory = null; } // Shutting down the derby database access, so files get unlocked. try { + log.debug("shutting down the db"); DriverManager.getConnection("jdbc:derby:" + urlPath + ";shutdown=true"); } catch (SQLException e) { log.debug(e.getMessage()); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMReader.java --- a/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMReader.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMReader.java Wed Jun 16 16:51:40 2010 +0300 @@ -22,7 +22,7 @@ import org.apache.log4j.Logger; import java.util.List; import javax.persistence.Query; - +import javax.persistence.FlushModeType; /** * This class provides an interface to read data from the * database using JPA. @@ -36,11 +36,14 @@ private ORMEntityManager manager; private int startPos; + + private String dbPath; /**Constructor: * @param dbPath - path of the database to connect to. */ - public ORMReader(String dbPath) { + public ORMReader(String path) { + dbPath = path; ORMUtil.initializeORM(dbPath); manager = ORMUtil.getEntityManager(dbPath); } @@ -54,28 +57,31 @@ */ public List executeNativeQuery(String queryString, String type) { int maxResults = READ_CACHE_LIMIT; - String queryWithSubSet = queryString + " OFFSET " + startPos + - " ROWS FETCH FIRST " + maxResults + " ROW ONLY"; - Query query = null; - if (type != null) { - try { - query = manager.getEntityManager().createNativeQuery(queryWithSubSet, - Class.forName(type)); - } catch (ClassNotFoundException ex) { - log.debug("Exception during native query", ex); + Object mutexObject = ORMUtil.getMutexObject(); + synchronized (mutexObject) { + String queryWithSubSet = queryString + " OFFSET " + startPos + + " ROWS FETCH FIRST " + maxResults + " ROW ONLY"; + Query query = null; + if (type != null) { + try { + query = manager.getEntityManager().createNativeQuery(queryWithSubSet, + Class.forName(type)); + } catch (ClassNotFoundException ex) { + log.debug("Exception during native query", ex); + } + } else { + query = manager.getEntityManager().createNativeQuery(queryWithSubSet); } - } else { - query = manager.getEntityManager().createNativeQuery(queryWithSubSet); + query.setHint("eclipselink.maintain-cache", "false"); + List results = query.getResultList(); + int resultsSize = results.size(); + if (resultsSize == 0 || resultsSize < READ_CACHE_LIMIT) { + startPos += resultsSize; + } else { + startPos += maxResults; + } + return results; } - query.setHint("eclipselink.maintain-cache", "false"); - List results = query.getResultList(); - int resultsSize = results.size(); - if (resultsSize == 0 || resultsSize < READ_CACHE_LIMIT) { - startPos += resultsSize; - } else { - startPos += maxResults; - } - return results; } /** @@ -85,20 +91,23 @@ * @return an Object of return type. */ public Object executeSingleResult(String queryString, String type) { - log.debug("executeSingleResult: " + queryString); - Query query = manager.getEntityManager().createQuery(queryString); - query.setHint("eclipselink.persistence-context.reference-mode", "WEAK"); - query.setHint("eclipselink.maintain-cache", "false"); - query.setHint("eclipselink.read-only", "true"); - Object obj = null; - try { - obj = query.getSingleResult(); - } catch (javax.persistence.NoResultException nex) { - log.debug("no results:", nex); - } catch (javax.persistence.NonUniqueResultException nux) { - log.debug("more than one result returned:", nux); + Object mutexObject = ORMUtil.getMutexObject(); + synchronized (mutexObject) { + Query query = manager.getEntityManager().createQuery(queryString); + query.setHint("eclipselink.persistence-context.reference-mode", "WEAK"); + query.setHint("eclipselink.maintain-cache", "false"); + query.setHint("eclipselink.read-only", "true"); + query.setFlushMode(FlushModeType.COMMIT); + Object obj = null; + try { + obj = query.getSingleResult(); + } catch (javax.persistence.NoResultException nex) { + log.debug("no results:", nex); + } catch (javax.persistence.NonUniqueResultException nux) { + log.debug("more than one result returned:", nux); + } + return obj; } - return obj; } /** @@ -106,22 +115,29 @@ * @param queryString - jpa query string * @return List of objects read from database. */ - public List executeQuery (String queryString) { - int maxResults = READ_CACHE_LIMIT; - Query query = manager.getEntityManager().createQuery(queryString); - query.setHint("eclipselink.persistence-context.reference-mode", "WEAK"); - query.setHint("eclipselink.maintain-cache", "false"); - query.setHint("eclipselink.read-only", "true"); - query.setFirstResult(startPos); - query.setMaxResults(maxResults); - List results = (List) query.getResultList(); - int resultsSize = results.size(); - log.debug("result size: " + resultsSize); - if (results.size() == 0 || resultsSize < READ_CACHE_LIMIT) { - startPos += resultsSize; - } else { - startPos += maxResults; + public List executeQuery(String queryString) { + Object mutexObject = ORMUtil.getMutexObject(); + synchronized (mutexObject) { + int maxResults = READ_CACHE_LIMIT; + Query query = manager.getEntityManager().createQuery(queryString); + query.setHint("eclipselink.persistence-context.reference-mode", "WEAK"); + query.setHint("eclipselink.maintain-cache", "false"); + query.setHint("eclipselink.read-only", "true"); + query.setFirstResult(startPos); + query.setMaxResults(maxResults); + List results = (List) query.getResultList(); + int resultsSize = results.size(); + log.debug("result size: " + resultsSize); + if (results.size() == 0 || resultsSize < READ_CACHE_LIMIT) { + startPos += resultsSize; + } else { + startPos += maxResults; + } + return results; } - return results; + } + + public void close() { + ORMUtil.finalizeORM(dbPath); } } \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMUtil.java --- a/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMUtil.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMUtil.java Wed Jun 16 16:51:40 2010 +0300 @@ -38,6 +38,10 @@ private static HashMap emMap = new HashMap(); + private static HashMap emMapCount = + new HashMap(); + + private static Object mutexObject = new Object(); private ORMUtil() { } @@ -50,13 +54,22 @@ log.debug("initializeORM: urlpath: " + urlPath); if (manager == null) { try { + log.debug("initializing for the first time"); manager = new ORMEntityManager(urlPath); emMap.put(urlPath, manager); + Integer countObj = new Integer(1); + emMapCount.put(urlPath, countObj); log.debug("initializeORM: manager: " + manager); log.debug("initializeORM: manager: " + manager.getEntityManager()); } catch ( IOException ex ) { throw new BuildException("Entity Manager creation failure"); } + } else { + Integer countObj = emMapCount.get(urlPath); + log.debug("object exists and incrementing the value"); + countObj = new Integer(countObj.intValue() + 1); + log.debug("object exists count value: " + countObj.intValue()); + emMapCount.put(urlPath, countObj); } } @@ -64,7 +77,7 @@ * Helper Function to return the entity manager. * @return entity manager created during initialization. */ - public static ORMEntityManager getEntityManager(String urlPath) { + public static synchronized ORMEntityManager getEntityManager(String urlPath) { log.debug("getEntityManager: urlpath: " + urlPath); ORMEntityManager manager = emMap.get(urlPath); if (manager != null) { @@ -80,14 +93,30 @@ /** * Finalize the entity manager and release all the objects. */ - public static void finalizeORM(String urlPath) { + public static synchronized void finalizeORM(String urlPath) { ORMEntityManager manager = emMap.get(urlPath); log.debug("finalizeORM: urlpath: " + urlPath); if (manager != null) { - manager.finalizeEntityManager(); - manager = null; - log.debug("finalizeORM: manager" + manager); - emMap.remove(urlPath); + Integer countObj = emMapCount.get(urlPath); + if (countObj != null) { + int count = countObj.intValue(); + count = count - 1; + if (count > 0) { + countObj = new Integer(count); + log.debug("countOBj value: " + countObj.intValue()); + emMapCount.put(urlPath, countObj); + } else { + manager.finalizeEntityManager(); + manager = null; + log.debug("finalizeORM: manager" + manager); + emMap.remove(urlPath); + emMapCount.remove(urlPath); + } + } } } + + public static Object getMutexObject() { + return mutexObject; + } } \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/entity/metadata/Metadata.java --- a/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/entity/metadata/Metadata.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/entity/metadata/Metadata.java Wed Jun 16 16:51:40 2010 +0300 @@ -35,6 +35,7 @@ import javax.persistence.Query; import javax.persistence.CascadeType; import com.nokia.helium.jpa.ORMCommitCount; +import com.nokia.helium.jpa.ORMUtil; import com.nokia.helium.jpa.ORMEntityManager; /** @@ -236,9 +237,10 @@ private void loadFromDB(String path) { LogFile logFile = null; logFiles = new Hashtable(); + Query query = manager.getEntityManager().createQuery("SELECT l FROM LogFile l"); + query.setFlushMode(FlushModeType.COMMIT); List logFilesList = - (List) manager.getEntityManager().createQuery( - "SELECT l FROM LogFile l").getResultList(); + (List) query.getResultList(); for (LogFile file : logFilesList) { log.debug("getting logfile from db: " + file.getPath()); logFiles.put(file.getPath(), file); @@ -260,18 +262,20 @@ * @param obj - object to be stored in the data. */ private void persist(Object obj) { - synchronized (manager) { - EntityManager em = manager.getEntityManager(); - ORMCommitCount countObject = manager.getCommitCountObject(); - //log.debug("object: " + obj); - //log.debug("object: " + em); - em.persist(obj); - countObject.decreaseCount(); - if (countObject.isCommitRequired()) { - countObject.reset(); - em.getTransaction().commit(); - em.clear(); - em.getTransaction().begin(); + Object mutexObject = ORMUtil.getMutexObject(); + synchronized (mutexObject) { + synchronized (manager) { + EntityManager em = manager.getEntityManager(); + ORMCommitCount countObject = manager.getCommitCountObject(); + //log.debug("object: " + em); + em.persist(obj); + countObject.decreaseCount(); + if (countObject.isCommitRequired()) { + countObject.reset(); + em.getTransaction().commit(); + em.clear(); + em.getTransaction().begin(); + } } } } @@ -315,11 +319,13 @@ * Internal function to cache the logpath for performance. */ private void initializeLogPath() { - EntityManager em = manager.getEntityManager(); - Query q = em.createQuery("select m from LogFile m"); + EntityManager entityManager = manager.getEntityManager(); + Query query = entityManager.createQuery("select m from LogFile m"); + query.setFlushMode(FlushModeType.COMMIT); + name = "metadata"; - if (q.getResultList().size() == 0) { - log.debug("query result: size" + q.getResultList().size()); + if (query.getResultList().size() == 0) { + log.debug("query result: size" + query.getResultList().size()); populatePriorities(); populateDB(logPath); } else { @@ -474,7 +480,7 @@ private void addMetadata(String priority, Component component, int lineNo, String logText) { MetadataEntry entry = new MetadataEntry(); - log.debug("logfile : " + component.getLogFile().getPath()); + log.debug("logfile: " + component.getLogFile().getPath()); entry.setLogFile(component.getLogFile()); entry.setComponent(component); entry.setLineNumber(lineNo); @@ -489,7 +495,6 @@ * priority. */ public final void removeEntries() { - EntityManager em = manager.getEntityManager(); LogFile file = (LogFile)executeSingleQuery("select l from LogFile l where l.path like '%" + logPath + "'"); if ( file != null ) { log.debug("removing entries for : " + file.getPath()); @@ -510,19 +515,22 @@ * @return object - record from the executed query. */ private Object executeSingleQuery (String queryString) { - EntityManager em = manager.getEntityManager(); - Query query = em.createQuery(queryString); - query.setHint("eclipselink.persistence-context.reference-mode", "WEAK"); - query.setHint("eclipselink.maintain-cache", "false"); - query.setHint("eclipselink.read-only", "true"); - query.setFlushMode(FlushModeType.COMMIT); + Object mutexObject = ORMUtil.getMutexObject(); Object obj = null; - try { - obj = query.getSingleResult(); - } catch (javax.persistence.NoResultException nex) { - log.debug("no results for query: " + queryString, nex); - } catch (javax.persistence.NonUniqueResultException nux) { - log.debug("more than one result returned by query: " + queryString, nux); + synchronized (mutexObject) { + EntityManager em = manager.getEntityManager(); + Query query = em.createQuery(queryString); + query.setHint("eclipselink.persistence-context.reference-mode", "WEAK"); + query.setHint("eclipselink.maintain-cache", "false"); + query.setHint("eclipselink.read-only", "true"); + query.setFlushMode(FlushModeType.COMMIT); + try { + obj = query.getSingleResult(); + } catch (javax.persistence.NoResultException nex) { + log.debug("no results for query: " + queryString, nex); + } catch (javax.persistence.NonUniqueResultException nux) { + log.debug("more than one result returned by query: " + queryString, nux); + } } return obj; } @@ -532,19 +540,22 @@ * @param queryString - query string for whcih the result to be obtained. */ private void removeEntries(String queryString) { - EntityManager em = manager.getEntityManager(); - Query query = em.createNativeQuery(queryString); - query.setHint("eclipselink.persistence-context.reference-mode", "WEAK"); - query.setHint("eclipselink.maintain-cache", "false"); - query.setFlushMode(FlushModeType.COMMIT); - try { - int deletedRecords = query.executeUpdate(); - log.debug("total records deleted " + deletedRecords - + "for query:" + queryString); - } catch (javax.persistence.NoResultException nex) { - log.debug("no results:", nex); - } catch (javax.persistence.NonUniqueResultException nux) { - log.debug("more than one result returned:", nux); + Object mutexObject = ORMUtil.getMutexObject(); + synchronized (mutexObject) { + EntityManager em = manager.getEntityManager(); + Query query = em.createNativeQuery(queryString); + query.setHint("eclipselink.persistence-context.reference-mode", "WEAK"); + query.setHint("eclipselink.maintain-cache", "false"); + query.setFlushMode(FlushModeType.COMMIT); + try { + int deletedRecords = query.executeUpdate(); + log.debug("total records deleted " + deletedRecords + + "for query:" + queryString); + } catch (javax.persistence.NoResultException nex) { + log.debug("no results:", nex); + } catch (javax.persistence.NonUniqueResultException nux) { + log.debug("more than one result returned:", nux); + } } } @@ -567,7 +578,7 @@ private float elapsedTime; - private String priroityText; + private String priorityText; private WhatEntry whatEntry; @@ -604,7 +615,7 @@ int lineNumber, float time, WhatEntry entry) { PriorityEnum prty = null; String prtyText = priorityTxt.trim().toLowerCase(); - priroityText = prtyText; + priorityText = prtyText; if (prtyText.equals("error")) { prty = PriorityEnum.ERROR; } else if (prtyText.equals("warning")) { @@ -622,7 +633,7 @@ } else { log.debug("Error: priority " + prtyText + " is not acceptable by metadata and set to Error"); prty = PriorityEnum.ERROR; - priroityText = "error"; + priorityText = "error"; //throw new Exception("priority should not be null"); } @@ -647,7 +658,6 @@ { return logPath; } - public int getLineNumber() { @@ -670,7 +680,7 @@ } public String getPriorityText() { - return priroityText; + return priorityText; } public float getElapsedTime() { @@ -696,6 +706,10 @@ return whatEntry; } + public String toString() { + return "file:" + logPath + "[" + lineNumber + "], component:" + component + ", priority:" + + priorityText + " \n" + text; + } } /** Levels of log entry types. */ diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/entity/metadata/MetadataUtil.java --- a/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/entity/metadata/MetadataUtil.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/entity/metadata/MetadataUtil.java Wed Jun 16 16:51:40 2010 +0300 @@ -69,9 +69,11 @@ * Finalize the orm, calls ORMUtil finalize function to close * entity manager. */ - public static void finalizeMetadata(String logPath) { + public static void finalizeMetadata(String urlPath, String logPath) { synchronized (mutexObject) { - log.debug("finalizing metadata"); + ORMEntityManager manager = ORMUtil.getEntityManager(urlPath); + manager.commitToDB(); + log.debug("finalizing metadata: " + logPath); metadataMap.remove(logPath); } } @@ -106,7 +108,7 @@ synchronized (mutexObject) { metadata = getMetadata(logPath, urlPath); metadata.removeEntries(); - finalizeMetadata(logPath); + finalizeMetadata(urlPath, logPath); } } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/Antlib.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/Antlib.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/ant/Antlib.java Wed Jun 16 16:51:40 2010 +0300 @@ -143,9 +143,9 @@ * any tasks that derive from Definer. */ public final void execute() { - for (Task t : tasks) { - if (t instanceof UnknownElement) { - UnknownElement ue = (UnknownElement)t; + for (Task task : tasks) { + if (task instanceof UnknownElement) { + UnknownElement ue = (UnknownElement)task; setLocation(ue.getLocation()); ue.maybeConfigure(); Object configuredObject = ue.getRealThing(); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/BuildStatusDef.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/BuildStatusDef.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/ant/BuildStatusDef.java Wed Jun 16 16:51:40 2010 +0300 @@ -67,8 +67,8 @@ if (!output.isEmpty()) { log("*** Configuration report ***", Project.MSG_INFO); - for (String x : output) - log(x, Project.MSG_INFO); + for (String outputStr : output) + log(outputStr, Project.MSG_INFO); } } @@ -94,11 +94,11 @@ sorted = project.topoSort(targetNames[0], targets); // Find the desiredTarget Target object - for (Target t : sorted) + for (Target target : sorted) { - if (t.getName().equals(desiredTarget)) + if (target.getName().equals(desiredTarget)) { - return t; + return target; } } throw new BuildException("Could not find target matching " + desiredTarget + "\n"); @@ -114,49 +114,49 @@ String location = target.getLocation().getFileName(); try { - String heliumpath = new File(project.getProperty("helium.dir")).getCanonicalPath(); - String targetpath = new File(location).getCanonicalPath(); - - if (!targetpath.contains(heliumpath)) - { - ArrayList antcallTargets = new ArrayList(); - Visitor visitorTarget = new AntTargetVisitor(antcallTargets, project); + String heliumpath = new File(project.getProperty("helium.dir")).getCanonicalPath(); + String targetpath = new File(location).getCanonicalPath(); - Element element = findTargetElement(target, project); - if (element != null) - element.accept(visitorTarget); - for (String depTargetString : antcallTargets) + if (!targetpath.contains(heliumpath)) + { + ArrayList antcallTargets = new ArrayList(); + Visitor visitorTarget = new AntTargetVisitor(antcallTargets, project); + + Element element = findTargetElement(target, project); + if (element != null) + element.accept(visitorTarget); + for (String depTargetString : antcallTargets) + { + String[] array = { depTargetString }; + try { + Target depTarget = findTarget(depTargetString, project, array); + targetCallsHeliumTarget(depTarget, project); + } catch (BuildException x) { + // We are Ignoring the errors as no need to fail the build. + log("Exception occured while target defined outside helium are calling a private Helium target " + x.toString(), Project.MSG_DEBUG); + x = null; + } + } + + + for (Enumeration depsEnum = target.getDependencies(); depsEnum.hasMoreElements();) + { + String depTargetString = depsEnum.nextElement(); + String[] array = { depTargetString }; + try { + Target depTarget = findTarget(depTargetString, project, array); + targetCallsHeliumTarget(depTarget, project); + } catch (BuildException x) { + //We are Ignoring the errors as no need to fail the build. + log("Exception occured while target defined outside helium are calling a private Helium target " + x.toString(), Project.MSG_DEBUG); + x = null; + } + } + } + else { - String[] array = { depTargetString }; - try { - Target depTarget = findTarget(depTargetString, project, array); - targetCallsHeliumTarget(depTarget, project); - } catch (BuildException x) { - // We are Ignoring the errors as no need to fail the build. - log("Exception occured while target defined outside helium are calling a private Helium target " + x.toString(), Project.MSG_DEBUG); - x = null; - } + checkIfTargetPrivate(target, project); } - - - for (Enumeration e = target.getDependencies(); e.hasMoreElements();) - { - String depTargetString = e.nextElement(); - String[] array = { depTargetString }; - try { - Target depTarget = findTarget(depTargetString, project, array); - targetCallsHeliumTarget(depTarget, project); - } catch (BuildException x) { - //We are Ignoring the errors as no need to fail the build. - log("Exception occured while target defined outside helium are calling a private Helium target " + x.toString(), Project.MSG_DEBUG); - x = null; - } - } - } - else - { - checkIfTargetPrivate(target, project); - } } catch (IOException e) { //We are Ignoring the errors as no need to fail the build. @@ -218,11 +218,11 @@ String projectName = antDoc.valueOf("/project/@name"); for (Iterator iterator = antDoc.selectNodes("//target").iterator(); iterator.hasNext();) { - Element e = iterator.next(); + Element element = iterator.next(); - String targetName = e.attributeValue("name"); + String targetName = element.attributeValue("name"); if (targetName.equals(target.getName()) || (projectName + "." + targetName).equals(target.getName())) - return e; + return element; } return null; } @@ -281,11 +281,11 @@ com.nokia.helium.ant.data.Database db = new com.nokia.helium.ant.data.Database(project, "private"); ArrayList customerProps = getCustomerProperties(project); - for (PropertyMeta x : db.getProperties()) + for (PropertyMeta propertyMeta : db.getProperties()) { - if (x.getLocation().contains(heliumpath) && x.getScope().equals("private") && customerProps.contains(x.getName())) + if (propertyMeta.getLocation().contains(heliumpath) && propertyMeta.getScope().equals("private") && customerProps.contains(propertyMeta.getName())) { - output.add("Warning: " + x.getName() + " property has been overridden"); + output.add("Warning: " + propertyMeta.getName() + " property has been overridden"); } } } catch (IOException e) { e.printStackTrace(); } @@ -299,9 +299,9 @@ try { String heliumpath = new File(project.getProperty("helium.dir")).getCanonicalPath(); - for (Object o : db.getAntFiles(project)) + for (Object object : db.getAntFiles(project)) { - String antFile = (String)o; + String antFile = (String)object; antFile = new File(antFile).getCanonicalPath(); if (!antFile.contains(heliumpath)) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/Database.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/Database.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/ant/Database.java Wed Jun 16 16:51:40 2010 +0300 @@ -105,12 +105,12 @@ public void setRefid(Reference r) { - Object o = r.getReferencedObject(); - if (!(o instanceof ResourceCollection)) + Object object = r.getReferencedObject(); + if (!(object instanceof ResourceCollection)) { throw new BuildException(r.getRefId() + " doesn\'t denote a ResourceCollection"); } - rc = (ResourceCollection) o; + rc = (ResourceCollection) object; } public Document createDOM() throws DocumentException, IOException { @@ -337,10 +337,10 @@ Iterator extraFilesIter = rc.iterator(); while (extraFilesIter.hasNext()) { - FileResource f = (FileResource) extraFilesIter.next(); - String extrafile = f.getFile().getCanonicalPath(); + FileResource fileResource = (FileResource) extraFilesIter.next(); + String extrafile = fileResource.getFile().getCanonicalPath(); - if (!antFiles.contains(f.toString()) && !f.getFile().getName().startsWith("test_")) + if (!antFiles.contains(fileResource.toString()) && !fileResource.getFile().getName().startsWith("test_")) { if (homeOnly) { @@ -742,11 +742,11 @@ * @param allTaskdefs * @param criteria */ - private HashMap < String, String > filterTasks ( Hashtable > allTaskdefs ) { + private HashMap < String, String > filterTasks( Hashtable > allTaskdefs ) { HashMap tasks = new HashMap (); Enumeration taskdefsenum = allTaskdefs.keys(); - while ( taskdefsenum.hasMoreElements () ) { + while ( taskdefsenum.hasMoreElements() ) { String key = taskdefsenum.nextElement(); Class clazz = allTaskdefs.get(key); String className = clazz.getName(); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/HeliumLogger.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/HeliumLogger.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/ant/HeliumLogger.java Wed Jun 16 16:51:40 2010 +0300 @@ -131,9 +131,9 @@ private void cleanup() { String loggingoutputfile = project.getProperty("logging.output.file"); if (loggingoutputfile != null) { - File f = new File(loggingoutputfile); - if (f.exists()) { - f.delete(); + File file = new File(loggingoutputfile); + if (file.exists()) { + file.delete(); } } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/Signal.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/ant/Signal.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.ant; + +/** + * This class stores a signal while being deferred. + * + */ +public class Signal { + + private String name; + private String message; + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/XmlLogger.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/XmlLogger.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/ant/XmlLogger.java Wed Jun 16 16:51:40 2010 +0300 @@ -159,8 +159,8 @@ event.getException().toString()); // print the stacktrace in the build file it is always useful... // better have too much info than not enough. - Throwable t = event.getException(); - Text errText = doc.createCDATASection(StringUtils.getStackTrace(t)); + Throwable exception = event.getException(); + Text errText = doc.createCDATASection(StringUtils.getStackTrace(exception)); Element stacktrace = doc.createElement(STACKTRACE_TAG); stacktrace.appendChild(errText); buildElement.element.appendChild(stacktrace); @@ -279,8 +279,8 @@ return element; } - for (Enumeration e = tasks.keys(); e.hasMoreElements();) { - Task key = (Task) e.nextElement(); + for (Enumeration taskEnum = tasks.keys(); taskEnum.hasMoreElements();) { + Task key = (Task) taskEnum.nextElement(); if (key instanceof UnknownElement) { if (((UnknownElement) key).getTask() == task) { return (TimedElement) tasks.get(key); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/antlib.xml --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/antlib.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/ant/antlib.xml Wed Jun 16 16:51:40 2010 +0300 @@ -23,19 +23,12 @@ - - - + - - - - - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/conditions/AtsCondition.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/conditions/AtsCondition.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/ant/conditions/AtsCondition.java Wed Jun 16 16:51:40 2010 +0300 @@ -73,16 +73,16 @@ for (Iterator iterator = antDoc.selectNodes("//test/failed").iterator(); iterator.hasNext();) { testsfound = true; - Element e = (Element) iterator.next(); - String failed = e.getText(); + Element element = (Element) iterator.next(); + String failed = element.getText(); if (!failed.equals("0")) { log.error("ATS tests failed"); for (Iterator iterator2 = antDoc.selectNodes("//actual_result").iterator(); iterator2.hasNext();) { - Element e2 = (Element) iterator2.next(); - log.error(e2.getText()); + Element resultElement = (Element) iterator2.next(); + log.error(resultElement.getText()); } return false; } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/listener/CoverageRecorderEntry.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/ant/listener/CoverageRecorderEntry.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,451 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/* Portion Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. */ + +package com.nokia.ant.listener; + +import java.io.*; +import org.apache.tools.ant.util.DOMElementWriter; +import org.apache.tools.ant.util.DateUtils; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.apache.tools.ant.*; +import java.util.*; +import javax.xml.parsers.ParserConfigurationException; + +/** + * This is a class that represents a XML recorder. This is the listener to the + * build process. + * + */ +public class CoverageRecorderEntry implements BuildLogger, SubBuildListener { + + ////////////////////////////////////////////////////////////////////// + // ATTRIBUTES + + /** XML element name for a build. */ + private static final String BUILD_TAG = "build"; + /** XML element name for a target. */ + private static final String TARGET_TAG = "target"; + /** XML element name for a task. */ + private static final String TASK_TAG = "task"; + /** XML attribute name for a name. */ + private static final String NAME_ATTR = "name"; + /** XML attribute name for a time. */ + private static final String TIME_ATTR = "time"; + /** XML attribute name for a file location. */ + private static final String LOCATION_ATTR = "location"; + + /** DocumentBuilder to use when creating the document to start with. */ + private static DocumentBuilder builder = getDocumentBuilder(); + + private String recordTaskName; + + /** 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 outStream; + /** The start time of the last know target. */ + private long targetStartTime; + /** project instance the recorder is associated with */ + private Project project; + + /** The complete log document for this build. */ + private Document doc = builder.newDocument(); + /** Mapping for when tasks started (Task to TimedElement). */ + private Hashtable tasks = new Hashtable(); + /** Mapping for when targets started (Task to TimedElement). */ + private Hashtable targets = new Hashtable(); + /** + * Mapping of threads to stacks of elements + * (Thread to Stack of TimedElement). + */ + private Hashtable> threadStacks = new Hashtable>(); + /** + * When the build started. + */ + private TimedElement buildElement; + + ////////////////////////////////////////////////////////////////////// + // CONSTRUCTORS / INITIALIZERS + + /** + * @param name The name of this recorder (used as the filename). + */ + public CoverageRecorderEntry(String name, String recordTaskName) { + filename = name; + this.recordTaskName = recordTaskName; + startBuild(); + } + + /** + * Returns a default DocumentBuilder instance or throws an + * ExceptionInInitializerError if it can't be created. + * + * @return a default DocumentBuilder instance. + */ + protected static DocumentBuilder getDocumentBuilder() { + try { + return DocumentBuilderFactory.newInstance().newDocumentBuilder(); + } catch (ParserConfigurationException exc) { + throw new ExceptionInInitializerError(exc.getMessage()); + } + } + + /** Utility class representing the time an element started. */ + protected static class TimedElement { + /** + * Start time in milliseconds + * (as returned by System.currentTimeMillis()). + */ + private long startTime; + /** Element created at the start time. */ + private Element element; + public String toString() { + return element.getTagName() + ":" + element.getAttribute("name"); + } + } + + /** + * Returns the stack of timed elements for the current thread. + * @return the stack of timed elements for the current thread + */ + protected Stack getStack() { + Stack threadStack = threadStacks.get(Thread.currentThread()); + if (threadStack == null) { + threadStack = new Stack(); + threadStacks.put(Thread.currentThread(), threadStack); + } + /* For debugging purposes uncomment: + org.w3c.dom.Comment s = doc.createComment("stack=" + threadStack); + buildElement.element.appendChild(s); + */ + return threadStack; + } + + ////////////////////////////////////////////////////////////////////// + // 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) { + record = state.booleanValue(); + } + } + + /** + * @see org.apache.tools.ant.BuildListener#buildStarted(BuildEvent) + */ + /** {@inheritDoc}. */ + public void buildStarted(BuildEvent event) { + + } + + /** + * @see org.apache.tools.ant.BuildListener#buildFinished(BuildEvent) + */ + /** {@inheritDoc}. */ + public void buildFinished(BuildEvent event) { + 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) { + Target target = event.getTarget(); + TimedElement targetElement = new TimedElement(); + targetElement.startTime = System.currentTimeMillis(); + targetElement.element = doc.createElement(TARGET_TAG); + targetElement.element.setAttribute(NAME_ATTR, target.getName()); + targets.put(target, targetElement); + getStack().push(targetElement); + } + + /** + * @see org.apache.tools.ant.BuildListener#targetFinished(BuildEvent) + */ + /** {@inheritDoc}. */ + public void targetFinished(BuildEvent event) { + Target target = event.getTarget(); + TimedElement targetElement = (TimedElement) targets.get(target); + if (targetElement != null) { + long totalTime + = System.currentTimeMillis() - targetElement.startTime; + targetElement.element.setAttribute(TIME_ATTR, + DateUtils.formatElapsedTime(totalTime)); + + TimedElement parentElement = null; + Stack threadStack = getStack(); + if (!threadStack.empty()) { + threadStack.pop(); +// if (poppedStack != targetElement) { +// throw new RuntimeException("Mismatch - popped element = " +// + poppedStack +// + " finished target element = " +// + targetElement); +// } + if (!threadStack.empty()) { + parentElement = threadStack.peek(); + } + } + if (parentElement == null) { + buildElement.element.appendChild(targetElement.element); + } else { + parentElement.element.appendChild(targetElement.element); + } + } + targets.remove(target); + } + + /** + * @see org.apache.tools.ant.BuildListener#taskStarted(BuildEvent) + */ + /** {@inheritDoc}. */ + public void taskStarted(BuildEvent event) { + TimedElement taskElement = new TimedElement(); + taskElement.startTime = System.currentTimeMillis(); + taskElement.element = doc.createElement(TASK_TAG); + + Task task = event.getTask(); + String name = event.getTask().getTaskName(); + if (name == null) { + name = ""; + } + taskElement.element.setAttribute(NAME_ATTR, name); + taskElement.element.setAttribute(LOCATION_ATTR, + event.getTask().getLocation().toString()); + tasks.put(task, taskElement); + getStack().push(taskElement); + } + + /** + * @see org.apache.tools.ant.BuildListener#taskFinished(BuildEvent) + */ + /** {@inheritDoc}. */ + public void taskFinished(BuildEvent event) { + +// if (event.getTask().getTaskName() != recordTaskName) { + Task task = event.getTask(); + TimedElement taskElement = tasks.get(task); + if (taskElement != null) { + long totalTime = System.currentTimeMillis() - taskElement.startTime; + taskElement.element.setAttribute(TIME_ATTR, + DateUtils.formatElapsedTime(totalTime)); + Target target = task.getOwningTarget(); + TimedElement targetElement = null; + if (target != null) { + targetElement = (TimedElement) targets.get(target); + } + if (targetElement == null) { + buildElement.element.appendChild(taskElement.element); + } else { + targetElement.element.appendChild(taskElement.element); + } + Stack threadStack = getStack(); + if (!threadStack.empty()) { + threadStack.pop(); +// if (poppedStack != taskElement) { +// throw new RuntimeException("Mismatch - popped element = " +// + poppedStack + " finished task element = " +// + taskElement); +// } + } + tasks.remove(task); +// } else { +// throw new RuntimeException("Unknown task " + task + " not in " + tasks); +// } + } + } + + /** + * Get the TimedElement associated with a task. + * + * Where the task is not found directly, search for unknown elements which + * may be hiding the real task + */ + protected TimedElement getTaskElement(Task task) { + TimedElement element = (TimedElement) tasks.get(task); + if (element != null) { + return element; + } + + for (Task key : tasks.keySet()) { + if (key instanceof UnknownElement) { + if (((UnknownElement) key).getTask() == task) { + return tasks.get(key); + } + } + } + return null; + } + + /** + * @see org.apache.tools.ant.BuildListener#messageLogged(BuildEvent) + */ + /** {@inheritDoc}. */ + public void messageLogged(BuildEvent event) { + + } + + /** + * @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) { + outStream = output; + } + + + /** + * @see BuildLogger#setErrorPrintStream(PrintStream) + */ + /** {@inheritDoc}. */ + public void setErrorPrintStream(PrintStream err) { + setOutputPrintStream(err); + } + + /** + * 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 + */ + void closeFile() { + finishBuild(); + Writer out = null; + try { + // specify output in UTF8 otherwise accented characters will blow + // up everything + OutputStream stream = outStream; + if (stream == null) { + stream = new FileOutputStream(filename); + } + out = new OutputStreamWriter(stream, "UTF8"); + out.write("\n"); + (new DOMElementWriter()).write(buildElement.element, out, 0, "\t"); + out.flush(); + } catch (IOException exc) { + throw new BuildException("Unable to write log file " + exc.getMessage(), exc); + } finally { + if (out != null) { + try { + out.close(); + } catch (IOException e) { + e = null; // ignore + } + } + } + buildElement = null; + } + + void startBuild() { + buildElement = new TimedElement(); + buildElement.startTime = System.currentTimeMillis(); + buildElement.element = doc.createElement(BUILD_TAG); + } + + void finishBuild() { + long totalTime = System.currentTimeMillis() - buildElement.startTime; + buildElement.element.setAttribute(TIME_ATTR, + DateUtils.formatElapsedTime(totalTime)); + } + + @Override + public void setEmacsMode(boolean emacsMode) { + // Not needed. + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/AbstractScmBaseTask.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/AbstractScmBaseTask.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,446 +0,0 @@ -/* - * 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.ant.taskdefs; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; -import java.io.IOException; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.taskdefs.Execute; -import org.apache.tools.ant.taskdefs.LogStreamHandler; - -/** - * AbstractScmBaseTask is an abstract class for GSCM related tasks - * such as rebaseline and deconfigure. - * - * @ant.task category="SCM" - * - */ -public abstract class AbstractScmBaseTask extends Task { - - // common attributes - private String database; // -d dbname = Database name (or database path) - private String password; // -U password = UNIX password - private String ccmProject; // -p projectname = Project name (incompatible - // with -B) - - private Integer verbosity; - - private StringBuffer commandString = new StringBuffer(); - private List commands = new ArrayList(); - - /** - * Return the Synergy project name. - * - * @return the Synergy project name. - */ - public String getCcmProject() { - return ccmProject; - } - - /** - * Set Synergy Project Name to be used. - * - * @param ccmProject - * is the Synergy project name to set - * @ant.required - */ - public void setCcmProject(String ccmProject) { - this.ccmProject = ccmProject; - log("Set ccmProject to " + ccmProject); - } - - /** - * Return the database name. - * - * @return the database name. - */ - public String getDatabase() { - return database; - } - - /** - * Set Synergy Database name to be used. - * - * @param database - * is the name of the Synergy database to set. - * @ant.required - */ - public void setDatabase(String database) { - this.database = database; - log("Set database to " + database); - } - - /** - * Return the Synergy password. - * - * @return the Synergy password. - */ - public String getPassword() { - return password; - } - - /** - * Set Synergy Password to be used. - * - * @param password - * is the password to set. - * @ant.required - */ - public void setPassword(String password) { - this.password = password; - log("Set password to ****** "); - } - - /** - * Return the verbosity. - * - * @return the verbosity. - */ - public Integer getVerbosity() { - return verbosity; - } - - /** - * Set verbosity level to be used. Verbosity level ( 0 - quiet, 1 - verbose, - * 2 - very verbose). Exception will be raised for any other value. - * - * @param verbosity - * is the verbosity level to set. - * @ant.not-required - */ - public void setVerbosity(Integer verbosity) { - this.verbosity = verbosity; - log("Set verbosity to " + verbosity); - } - - /** - * Method executes the current task. - * - */ - @Override - public void execute() { - // Set execution script - setExecutionScript(); - - // Build command argument list - buildCommandList(); - - // handle the command arguments - handleCommandArguments(); - - // configure verbosity - configureVerbosity(); - - // Execute the command-line launching as a separate process - runCommand(); - log("Completed successfully."); - } - - /** - * Method appends the given prefix and the command to the command string if - * the input cmd string is not null. - * - * @param prefix - * is the prefix of the cmd string input. - * @param cmd - * is the cmd string to be appended to main command string. - */ - protected void append2CommandString(String prefix, Object cmd) { - if (cmd != null) { - commandString.append(prefix); - commandString.append(" "); - commandString.append(cmd); - commandString.append(" "); - } - } - - /** - * Method appends the given prefix to the command string if the boolean - * value input is set true. - * - * @param prefix - * is the prefix to be appended to the command string. - * @param bool - * indicates whether to append the prefix or not. - */ - protected void append2CommandString(String prefix, Boolean bool) { - if (bool != null && bool) { - append2CommandString(prefix); - } - } - - /** - * Method appends the given cmd to the command string. - * - * @param cmd - * is the command string to be appended. - */ - protected void append2CommandString(String cmd) { - commandString.append(cmd); - commandString.append(" "); - } - - /** - * Method is used to throw a {@link BuildException} with the specified error - * message. - * - * @param errorMessage - * is the error message. - */ - protected void raiseError(String errorMessage) { - StringBuffer buffer = new StringBuffer("[").append(getTaskName()) - .append("] Error: ").append(errorMessage); - throw new BuildException(buffer.toString()); - } - - /** - * Add the given command argument to the command list. - * - * @param fieldName - * is the name of the task field. - * @param cmdArg - * is the command argument to be added to the command list. - * @param required - * indicates whether the command argument is mandatory or not. - * @param fieldValue is the value of the given field - */ - protected void addCommandArg(String fieldName, String cmdArg, - Boolean required, Object fieldValue ) { - SCMCommandArgument cmdObj = new SCMCommandArgument(fieldName, cmdArg, - required, fieldValue ); - commands.add(cmdObj); - } - - /** - * Add the given command argument to the command list. By default, the input - * command argument will be optional. - * - * @param fieldName - * is the name of the task field. - * @param cmdArg - * is the command argument to be added to the command list. - * @param fieldValue is the value of the given field - */ - protected void addCommandArg(String fieldName, String cmdArg, Object fieldValue ) { - addCommandArg(fieldName, cmdArg, false, fieldValue); - } - - /** - * Method validates the given arguments. - */ - protected abstract void validateArguments(); - - /** - * Set the execution script. - * - */ - protected abstract void setExecutionScript(); - - /** - * Build a command list consisting of all the required and optional command - * arguments of the current task. - */ - protected abstract void buildCommandList(); - - /** - * Method returns the correct verbosity level for the input choice. - * - * @param choice - * is the verbosity choice set by user. - * @return the verbosity level to set. - */ - protected abstract String getVerbosity(int choice); - - // ----------------------------------- PRIVATE METHODS -------------------------------------- - - /** - * Method returns the requested {@link Field} object from the input - * {@link Class}. If the requested field is not found in the given - * {@link Class} then all its super classes are searched recursively. - * - * @param clazz - * is the {@link Class} of which the field is requested. - * @param fieldName - * is the name of the requested field. - * @return the requested field. - */ - private Field getField(Class clazz, String fieldName) { - Field field = null; - if (clazz != null) { - try { - field = clazz.getDeclaredField(fieldName); - } catch (NoSuchFieldException nsfe) { - field = getField(clazz.getSuperclass(), fieldName); - } - } - return field; - } - - /** - * Method process the command arguments set in the command list. - * - * @throws Exception - * if any error occurs while processing the command arguments. - */ - private void handleCommandArguments() { - StringBuffer missingArgs = new StringBuffer(); - Field field = null; - for (SCMCommandArgument cmdObj : commands) { - field = getField(getClass(), cmdObj.fieldName); - if (field != null) { - Object fieldValue = field.getType().cast( cmdObj.fieldValue ); - check4MandatoryCmdArguments(cmdObj, fieldValue, missingArgs); - buildCommand(cmdObj, fieldValue); - } - } - // handle missing args if any - handleMissingArguments(missingArgs); - validateArguments(); - } - - /** - * Method checks for the mandatory command arguments. - * - * @param cmdObj - * is the {@link SCMCommandArgument} used in verification - * @param fieldValue - * is the field value to verify - * @param missingArgs - * contains the mandatory command arguments which are missing. - */ - private void check4MandatoryCmdArguments(SCMCommandArgument cmdObj, - Object fieldValue, StringBuffer missingArgs) { - if (cmdObj.required && fieldValue == null) { - missingArgs.append(cmdObj.fieldName); - missingArgs.append(" "); - } - } - - /** - * Method is used to construct an executable command string. - * - * @param cmdObj - * is the {@link SCMCommandArgument} - * @param fieldValue - * is the fieldValue containing the actual command argument. - */ - private void buildCommand(SCMCommandArgument cmdObj, Object fieldValue) { - if (fieldValue instanceof Boolean) { - append2CommandString(cmdObj.commandArgument, (Boolean) fieldValue); - } else { - append2CommandString(cmdObj.commandArgument, fieldValue); - } - } - - /** - * Method throws a {@link BuildException} if any mandatory command arguments - * are missing. - * - * @param missingArgs - * is the {@link StringBuffer} consisting of mandatory command - * arguments which are missing. - */ - private void handleMissingArguments(StringBuffer missingArgs) { - if (missingArgs.length() > 0) { - raiseError("mandatory attributes are not defined - " - + missingArgs.toString()); - } - } - - /** - * Configure the verbosity set by the user. - */ - private void configureVerbosity() { - if (verbosity != null) { - append2CommandString(getVerbosity(verbosity)); - } - } - - /** - * Execute the specified command. - * - * @throws Exception - * if execution fails or any error occurs while execution of the - * command. - */ - private void runCommand() { - String[] cmdline = commandString.toString().split(" "); - /* - * Note: static method call to Execute.runCommand doesnot run the given - * perl script here due to the setting of vmLauncher which acutally - * tries executing the script using Runtime.getRuntime().exec() method - * and this method cannot run the script without reference to the cmd or - * shell. (Similar with ExecTask) - * - * So creating an instance of Execute class helps to disable the - * vmLauncher and an OS dependent shellLauncher will be available for - * the execution of the script. - */ - Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO, - Project.MSG_ERR)); - exe.setAntRun(getProject()); - exe.setCommandline(cmdline); - exe.setVMLauncher(false); - try { - int retval = exe.execute(); - if (Execute.isFailure(retval)) { - raiseError("Script execution failure."); - } - } catch (IOException th) { - th.printStackTrace(); - raiseError("Script execution failure."); - } - } - - // ************************************* PRIVATE CLASSES *************************************** - - /** - * SCMCommandArgument is a private class and represents a - * normal java bean which is used to hold the information related to SCM - * command arguments. - */ - private class SCMCommandArgument { - - private String fieldName; - private Object fieldValue; - private String commandArgument; - private Boolean required; - - /** - * Create an instance of {@link SCMCommandArgument}. - * - * @param fieldName - * is the name of the task field - * @param commandArg - * is the SCM command argument - * @param reqd - * indicates the input command argument is mandatory or not. - */ - protected SCMCommandArgument(String fieldName, String commandArg, - Boolean reqd, Object fieldValue ) { - this.fieldName = fieldName; - this.commandArgument = commandArg; - this.required = reqd; - this.fieldValue = fieldValue; - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/AntDependencyTask.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/AntDependencyTask.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/AntDependencyTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -202,7 +202,7 @@ String mavenUrl = "http://repo2.maven.org/maven2/"; Enumeration jarfiles = jar.entries(); boolean found = false; - while (!found && jarfiles.hasMoreElements ()) { + while (!found && jarfiles.hasMoreElements()) { ZipEntry file = (ZipEntry) jarfiles.nextElement(); if (file.isDirectory()) { @@ -301,7 +301,7 @@ HashSet classlist = new HashSet(); Enumeration taskdefsenum = taskdefs.keys(); - while (taskdefsenum.hasMoreElements ()) { + while (taskdefsenum.hasMoreElements()) { String key = (String) taskdefsenum.nextElement(); Class value = (Class) taskdefs.get(key); if (!key.contains("nokia") && !value.toString().contains("org.apache.tools.ant")) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/CcmTask.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/CcmTask.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +0,0 @@ -/* -* 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.ant.taskdefs; - -import java.util.ArrayList; -import java.util.List; -import java.util.Vector; - -import org.python.util.PythonInterpreter; - -import com.nokia.ant.taskdefs.ccm.commands.*; -import com.nokia.ant.types.ccm.SessionSet; - -import org.apache.tools.ant.Task; - -/** - * Synergy task. - *
    - * <hlm:createSessionMacro database="to1tobet" reference="test.session" />
    - * <hlm:ccm verbose="false">
    - *     <hlm:sessionset refid="test.session" />
    - *     <hlm:addtask folder="tr1test1#2079">
    - *         <task name="tr1test1#5310" />
    - *     </hlm:addtask>
    - *     <hlm:snapshot project="helium-to1tobet#helium_3.0:project:vc1s60p1#1" dir="c:\test" fast="true" recursive="true" />
    - *     <hlm:synchronize project="helium-to1tobet#helium_3.0:project:vc1s60p1#1" recursive="true" />
    - *     <hlm:close />
    - * </hlm:ccm>
    - * 
    - * @ant.task category="SCM" - */ -public class CcmTask extends Task -{ - private String username; - - private String password; - - private List commands = new ArrayList(); - private Vector sessionSets = new Vector(); - private boolean verbose; - - public void setVerbose(boolean value) { - verbose = value; - } - - public boolean getVerbose() { - return verbose; - } - - public String getUsername() - { - return username; - } - - public final void setUsername(final String username) - { - this.username = username; - } - - public String getPassword() - { - return password; - } - - public final void setPassword(final String password) - { - this.password = password; - } - - public CcmCommand[] getCommands() - { - return commands.toArray(new CcmCommand[0]); - } - - public void addUpdate(Update a) - { - addCommand(a); - } - - public void addSynchronize(Synchronize a) - { - addCommand(a); - } - - public void addReconcile(Reconcile a) - { - addCommand(a); - } - - public void addSnapshot(Snapshot a) - { - addCommand(a); - } - - public void addChangeReleaseTag(ChangeReleaseTag a) - { - addCommand(a); - } - - public void addCheckout(Checkout a) - { - addCommand(a); - } - - public void addWorkarea(Workarea a) - { - addCommand(a); - } - - private void addCommand(CcmCommand cmd) - { - cmd.setTask(this); - commands.add(cmd); - } - - public AddTask createAddTask() - { - AddTask cmd = new AddTask(); - addCommand(cmd); - return cmd; - } - - public Close createClose() - { - Close cmd = new Close(); - addCommand(cmd); - return cmd; - } - - public SessionSet createSessionSet() - { - SessionSet sessionSet = new SessionSet(); - sessionSets.add(sessionSet); - return sessionSet; - } - - public SessionSet[] getSessionSets() { - SessionSet[] result = new SessionSet[sessionSets.size()]; - sessionSets.copyInto(result); - return result; - } - - public final void execute() - { - String ccmtaskScript = getProject().getProperty("ccmtask.python.script.file"); - PythonInterpreter pi = new PythonInterpreter(); - pi.set("java_ccmtask", this); - pi.set("project", getProject()); - pi.execfile(ccmtaskScript); - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/CopyParallelTask.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/CopyParallelTask.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/CopyParallelTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -62,10 +62,10 @@ */ public final void execute() { - super.execute(); - //wait until all copy threads are dead - while (copyThreadCount > 0) - { + super.execute(); + //wait until all copy threads are dead + while (copyThreadCount > 0) + { try { Thread.sleep(500); } catch (InterruptedException e) { @@ -74,7 +74,7 @@ } log("Copy parallel task has been interrupted " + e.getMessage(), Project.MSG_ERR); } - } + } } @@ -117,10 +117,10 @@ + " to " + destDir.getAbsolutePath() + " using " + maxThreadCount + " threads in parallel."); - Enumeration e = fileCopyMap.keys(); - while (e.hasMoreElements()) + Enumeration fileEnum = fileCopyMap.keys(); + while (fileEnum.hasMoreElements()) { - String fromFile = (String) e.nextElement(); + String fromFile = (String) fileEnum.nextElement(); String[] toFiles = (String[]) fileCopyMap.get(fromFile); for (int i = 0; i < toFiles.length; i++) { @@ -145,28 +145,28 @@ while (true) { - if ( copyThreadCount < maxThreadCount) - { - CopyThread copyThread = new CopyThread(fromFile, toFile, executionFilters); - copyThread.start(); - copyThreadCount++; - break; - } + if ( copyThreadCount < maxThreadCount) + { + CopyThread copyThread = new CopyThread(fromFile, toFile, executionFilters); + copyThread.start(); + copyThreadCount++; + break; + } } } } } if (includeEmpty) { - Enumeration e = dirCopyMap.elements(); + Enumeration dirEnum = dirCopyMap.elements(); int createCount = 0; - while (e.hasMoreElements()) { - String[] dirs = (String[]) e.nextElement(); + while (dirEnum.hasMoreElements()) { + String[] dirs = (String[]) dirEnum.nextElement(); for (int i = 0; i < dirs.length; i++) { - File d = new File(dirs[i]); - if (!d.exists()) { - if (!d.mkdirs()) { + File file = new File(dirs[i]); + if (!file.exists()) { + if (!file.mkdirs()) { log("Unable to create directory " - + d.getAbsolutePath(), Project.MSG_ERR); + + file.getAbsolutePath(), Project.MSG_ERR); } else { createCount++; } @@ -208,7 +208,7 @@ message.append(LINE_SEPARATOR); message.append( "This is normally due to the input file containing invalid"); - message.append(LINE_SEPARATOR); + message.append(LINE_SEPARATOR); message.append("bytes for the character encoding used : "); message.append( getEncoding() == null @@ -244,7 +244,7 @@ public void run() { try { - fileUtils.copyFile(fromFile, toFile, executionFilters, + fileUtils.copyFile(fromFile, toFile, executionFilters, filterChains, forceOverwrite, preserveLastModified, inputEncoding, outputEncoding, getProject()); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/CoverageRecorderEntry.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/CoverageRecorderEntry.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,451 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/* Portion Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. */ - -package com.nokia.ant.taskdefs; - -import java.io.*; -import org.apache.tools.ant.util.DOMElementWriter; -import org.apache.tools.ant.util.DateUtils; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.apache.tools.ant.*; -import java.util.*; -import javax.xml.parsers.ParserConfigurationException; - -/** - * This is a class that represents a XML recorder. This is the listener to the - * build process. - * - */ -public class CoverageRecorderEntry implements BuildLogger, SubBuildListener { - - ////////////////////////////////////////////////////////////////////// - // ATTRIBUTES - - /** XML element name for a build. */ - private static final String BUILD_TAG = "build"; - /** XML element name for a target. */ - private static final String TARGET_TAG = "target"; - /** XML element name for a task. */ - private static final String TASK_TAG = "task"; - /** XML attribute name for a name. */ - private static final String NAME_ATTR = "name"; - /** XML attribute name for a time. */ - private static final String TIME_ATTR = "time"; - /** XML attribute name for a file location. */ - private static final String LOCATION_ATTR = "location"; - - /** DocumentBuilder to use when creating the document to start with. */ - private static DocumentBuilder builder = getDocumentBuilder(); - - private String recordTaskName; - - /** 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 outStream; - /** The start time of the last know target. */ - private long targetStartTime; - /** project instance the recorder is associated with */ - private Project project; - - /** The complete log document for this build. */ - private Document doc = builder.newDocument(); - /** Mapping for when tasks started (Task to TimedElement). */ - private Hashtable tasks = new Hashtable(); - /** Mapping for when targets started (Task to TimedElement). */ - private Hashtable targets = new Hashtable(); - /** - * Mapping of threads to stacks of elements - * (Thread to Stack of TimedElement). - */ - private Hashtable> threadStacks = new Hashtable>(); - /** - * When the build started. - */ - private TimedElement buildElement; - - ////////////////////////////////////////////////////////////////////// - // CONSTRUCTORS / INITIALIZERS - - /** - * @param name The name of this recorder (used as the filename). - */ - protected CoverageRecorderEntry(String name, String recordTaskName) { - filename = name; - this.recordTaskName = recordTaskName; - startBuild(); - } - - /** - * Returns a default DocumentBuilder instance or throws an - * ExceptionInInitializerError if it can't be created. - * - * @return a default DocumentBuilder instance. - */ - protected static DocumentBuilder getDocumentBuilder() { - try { - return DocumentBuilderFactory.newInstance().newDocumentBuilder(); - } catch (ParserConfigurationException exc) { - throw new ExceptionInInitializerError(exc.getMessage()); - } - } - - /** Utility class representing the time an element started. */ - protected static class TimedElement { - /** - * Start time in milliseconds - * (as returned by System.currentTimeMillis()). - */ - private long startTime; - /** Element created at the start time. */ - private Element element; - public String toString() { - return element.getTagName() + ":" + element.getAttribute("name"); - } - } - - /** - * Returns the stack of timed elements for the current thread. - * @return the stack of timed elements for the current thread - */ - protected Stack getStack() { - Stack threadStack = threadStacks.get(Thread.currentThread()); - if (threadStack == null) { - threadStack = new Stack(); - threadStacks.put(Thread.currentThread(), threadStack); - } - /* For debugging purposes uncomment: - org.w3c.dom.Comment s = doc.createComment("stack=" + threadStack); - buildElement.element.appendChild(s); - */ - return threadStack; - } - - ////////////////////////////////////////////////////////////////////// - // 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) { - record = state.booleanValue(); - } - } - - /** - * @see org.apache.tools.ant.BuildListener#buildStarted(BuildEvent) - */ - /** {@inheritDoc}. */ - public void buildStarted(BuildEvent event) { - - } - - /** - * @see org.apache.tools.ant.BuildListener#buildFinished(BuildEvent) - */ - /** {@inheritDoc}. */ - public void buildFinished(BuildEvent event) { - 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) { - Target target = event.getTarget(); - TimedElement targetElement = new TimedElement(); - targetElement.startTime = System.currentTimeMillis(); - targetElement.element = doc.createElement(TARGET_TAG); - targetElement.element.setAttribute(NAME_ATTR, target.getName()); - targets.put(target, targetElement); - getStack().push(targetElement); - } - - /** - * @see org.apache.tools.ant.BuildListener#targetFinished(BuildEvent) - */ - /** {@inheritDoc}. */ - public void targetFinished(BuildEvent event) { - Target target = event.getTarget(); - TimedElement targetElement = (TimedElement) targets.get(target); - if (targetElement != null) { - long totalTime - = System.currentTimeMillis() - targetElement.startTime; - targetElement.element.setAttribute(TIME_ATTR, - DateUtils.formatElapsedTime(totalTime)); - - TimedElement parentElement = null; - Stack threadStack = getStack(); - if (!threadStack.empty()) { - threadStack.pop(); -// if (poppedStack != targetElement) { -// throw new RuntimeException("Mismatch - popped element = " -// + poppedStack -// + " finished target element = " -// + targetElement); -// } - if (!threadStack.empty()) { - parentElement = threadStack.peek(); - } - } - if (parentElement == null) { - buildElement.element.appendChild(targetElement.element); - } else { - parentElement.element.appendChild(targetElement.element); - } - } - targets.remove(target); - } - - /** - * @see org.apache.tools.ant.BuildListener#taskStarted(BuildEvent) - */ - /** {@inheritDoc}. */ - public void taskStarted(BuildEvent event) { - TimedElement taskElement = new TimedElement(); - taskElement.startTime = System.currentTimeMillis(); - taskElement.element = doc.createElement(TASK_TAG); - - Task task = event.getTask(); - String name = event.getTask().getTaskName(); - if (name == null) { - name = ""; - } - taskElement.element.setAttribute(NAME_ATTR, name); - taskElement.element.setAttribute(LOCATION_ATTR, - event.getTask().getLocation().toString()); - tasks.put(task, taskElement); - getStack().push(taskElement); - } - - /** - * @see org.apache.tools.ant.BuildListener#taskFinished(BuildEvent) - */ - /** {@inheritDoc}. */ - public void taskFinished(BuildEvent event) { - -// if (event.getTask().getTaskName() != recordTaskName) { - Task task = event.getTask(); - TimedElement taskElement = tasks.get(task); - if (taskElement != null) { - long totalTime = System.currentTimeMillis() - taskElement.startTime; - taskElement.element.setAttribute(TIME_ATTR, - DateUtils.formatElapsedTime(totalTime)); - Target target = task.getOwningTarget(); - TimedElement targetElement = null; - if (target != null) { - targetElement = (TimedElement) targets.get(target); - } - if (targetElement == null) { - buildElement.element.appendChild(taskElement.element); - } else { - targetElement.element.appendChild(taskElement.element); - } - Stack threadStack = getStack(); - if (!threadStack.empty()) { - threadStack.pop(); -// if (poppedStack != taskElement) { -// throw new RuntimeException("Mismatch - popped element = " -// + poppedStack + " finished task element = " -// + taskElement); -// } - } - tasks.remove(task); -// } else { -// throw new RuntimeException("Unknown task " + task + " not in " + tasks); -// } - } - } - - /** - * Get the TimedElement associated with a task. - * - * Where the task is not found directly, search for unknown elements which - * may be hiding the real task - */ - protected TimedElement getTaskElement(Task task) { - TimedElement element = (TimedElement) tasks.get(task); - if (element != null) { - return element; - } - - for (Task key : tasks.keySet()) { - if (key instanceof UnknownElement) { - if (((UnknownElement) key).getTask() == task) { - return tasks.get(key); - } - } - } - return null; - } - - /** - * @see org.apache.tools.ant.BuildListener#messageLogged(BuildEvent) - */ - /** {@inheritDoc}. */ - public void messageLogged(BuildEvent event) { - - } - - /** - * @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) { - outStream = output; - } - - - /** - * @see BuildLogger#setErrorPrintStream(PrintStream) - */ - /** {@inheritDoc}. */ - public void setErrorPrintStream(PrintStream err) { - setOutputPrintStream(err); - } - - /** - * 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 - */ - void closeFile() { - finishBuild(); - Writer out = null; - try { - // specify output in UTF8 otherwise accented characters will blow - // up everything - OutputStream stream = outStream; - if (stream == null) { - stream = new FileOutputStream(filename); - } - out = new OutputStreamWriter(stream, "UTF8"); - out.write("\n"); - (new DOMElementWriter()).write(buildElement.element, out, 0, "\t"); - out.flush(); - } catch (IOException exc) { - throw new BuildException("Unable to write log file " + exc.getMessage(), exc); - } finally { - if (out != null) { - try { - out.close(); - } catch (IOException e) { - e = null; // ignore - } - } - } - buildElement = null; - } - - void startBuild() { - buildElement = new TimedElement(); - buildElement.startTime = System.currentTimeMillis(); - buildElement.element = doc.createElement(BUILD_TAG); - } - - void finishBuild() { - long totalTime = System.currentTimeMillis() - buildElement.startTime; - buildElement.element.setAttribute(TIME_ATTR, - DateUtils.formatElapsedTime(totalTime)); - } - - @Override - public void setEmacsMode(boolean emacsMode) { - // Not needed. - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/CoverageRecorderTask.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/CoverageRecorderTask.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/CoverageRecorderTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -25,6 +25,8 @@ import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Recorder; +import com.nokia.ant.listener.CoverageRecorderEntry; + /** * Adds a listener, which inherits the Ant Record task, to the current build process that records the * output to a XML file. diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/DeconfigureTask.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/DeconfigureTask.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* - * 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.ant.taskdefs; - - -/** - * ANT wrapper task for the GSCM deconfigure.pl script. - * - * @ant.task category="SCM" - */ -public class DeconfigureTask extends AbstractScmBaseTask { - // The attributes of this task - private Boolean considerBranchReleases; - - /** - * Return the considerBranchReleases. - * - * @return the considerBranchReleases. - */ - public Boolean getConsiderBranchReleases() { - return considerBranchReleases; - } - - /** - * Set if we want deconfigure.pl script to check for branch differences - * based on the 'included_releases' attribute of project. - * - * @param considerBranchReleases - * @ant.not-required Default is no. - */ - public void setconsiderBranchReleases(Boolean considerBranchReleases) { - this.considerBranchReleases = considerBranchReleases; - log("Set considerBranchReleases to " + considerBranchReleases); - } - - /** - * Build a command list consisting of all the required and optional command - * arguments of the current task. - */ - protected void buildCommandList() { - addCommandArg("database", "-d", true, getDatabase()); - addCommandArg("password", "-P", true, getPassword()); - addCommandArg("ccmProject", "-p", true, getCcmProject()); - addCommandArg("considerBranchReleases", "-b", getConsiderBranchReleases()); - } - - /** - * Method validates the given arguments. - */ - protected void validateArguments() { - // Do nothing - } - - /** - * Set the execution script. - * - */ - protected void setExecutionScript() { - append2CommandString("deconfigure.pl"); - } - - /** - * Method returns the correct verbosity level for the input choice. - * - * @param choice - * is the verbosity choice set by user. - * @return the verbosity level to set. - */ - protected String getVerbosity(int choice) { - String cmd = ""; - switch (choice) { - case 0: - cmd = "-q "; - break; - case 1: - cmd = "-V "; - break; - case 2: - cmd = "-W "; - break; - default: - raiseError("Verbosity level is not recognised. " - + "Legal values are: 0 - quiet, 1 - verbose or 2 - very verbose"); - } - return cmd; - } - -} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/HlmExecTask.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/HlmExecTask.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/HlmExecTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -38,28 +38,28 @@ */ public void execute() { - String p = getProject().getProperty("number.of.threads"); - if (p != null) + String property = getProject().getProperty("number.of.threads"); + if (property != null) { - ((ThreadPoolExecutor)threadPool).setCorePoolSize(Integer.parseInt(p)); - ((ThreadPoolExecutor)threadPool).setMaximumPoolSize(Integer.parseInt(p)); + ((ThreadPoolExecutor)threadPool).setCorePoolSize(Integer.parseInt(property)); + ((ThreadPoolExecutor)threadPool).setMaximumPoolSize(Integer.parseInt(property)); } - TaskRunnable tr = new TaskRunnable(); - threadPool.submit(tr); + TaskRunnable taskRunnable = new TaskRunnable(); + threadPool.submit(taskRunnable); try { synchronized (semaphore) { - while (!tr.isFinished()) + while (!taskRunnable.isFinished()) semaphore.wait(); } } catch (InterruptedException e) { e.printStackTrace(); } - Throwable t = tr.getException(); - if (t != null) + Throwable exception = taskRunnable.getException(); + if (exception != null) { - if (t instanceof BuildException) - throw (BuildException)t; + if (exception instanceof BuildException) + throw (BuildException)exception; else - t.printStackTrace(); + exception.printStackTrace(); } } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/RBTTask.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/RBTTask.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,502 +0,0 @@ -/* - * 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.ant.taskdefs; - - -/** - * ANT wrapper task for the GSCM rbt.pl script. - * - *
    - * Deconfigure Only:
    - * 
    - * Usage: <hlm:rebaseanddeconf database="${dbname}"
    - *                              password="${UNIX-password}" 
    - *                              verbosity="${0-3}"
    - *                              ccmProject="${ccm.project.name}" 
    - *                              release="${release.name}"
    - *                              deconfigure="yes" />
    - * 
    - * - *
    - * Rebaseline Only:
    - * 
    - * Usage:   <hlm:rebaseanddeconf database="${dbname}"
    - *                              password="${UNIX-password}" 
    - *                              verbosity="${0-3}"
    - *                              ccmProject="${ccm.project.name}"
    - *                              release="${release.name}" 
    - *                              releaseBaseline="yes" 
    - *                              skipDeconfigure="yes" />
    - * 
    - * - *
    - * Rebaseline with deconfigure:
    - * 
    - * Usage:   <hlm:rebaseanddeconf database="${dbname}"
    - *                              password="${UNIX-password}" 
    - *                              verbosity="${0-3}"
    - *                              ccmProject="${ccm.project.name}"
    - *                              release="${release.name}" 
    - *                              releaseBaseline="yes" 
    - *                              deconfigure="yes" />
    - * 
    - * - * @ant.task name="rebaseanddeconf" category="SCM" - */ -public class RBTTask extends AbstractScmBaseTask { - - // The attributes of this task - private String baseline; // -B baselinename = Four-part name of existing - // baseline (incompatible with -p and -n) - private String version; // -v version = New project hierarchy version - private String release; // -r release = New release object name (Two-part - // name) - private String newBaselineName; // -n name = New baseline name - - private Boolean releaseBaseline; // -R = Release the newly created baseline - private Boolean publish; // -P = Publish the newly created baseline - private Boolean deconfigure; // -s = Replace subprojects only (NO - // REBASELINE) - private Boolean leaveFoldersWritable; // -F = Don't freeze folders (Leave - // folders writable) - private Boolean enableTaskRebadgingGenericRelease; // -t = Enable task - // rebadging (associated - // modifiable tasks with - // generic release only) - private Boolean enableTaskRebadging; // -T = Enable task rebadging (all - // associated modifiable tasks) - private Boolean rebadgeObjectVersions; // -o = Rebadge object versions - // (requires ccm_admin) - private Boolean createBaselineForRollingReleaseTag; // -i = Create - // additional - // integration baseline - // for rolling-release - // tag - private Boolean skipDeconfigure; // -S = Do NOT replace subprojects (NO - // DECONFIGURE) - private Boolean active; // -a = Specified release remains active - private Boolean useBranchReleaseMethodology; // -b = Utilize branch release - - // methodology - - /** - * Return the baseline. - * - * @return the baseline. - */ - public String getBaseline() { - return baseline; - } - - /** - * Set four-part name of existing baseline (incompatible with 'projectName' - * and 'baselineName' attributes) to be used by rebaseline.pl script. - * - * @param baseline - * is the baseline to set - * @ant.not-required - */ - public void setBaseline(String baseline) { - this.baseline = baseline; - log("Set baseline to " + baseline); - } - - /** - * Return the version. - * - * @return the version. - */ - public String getVersion() { - return version; - } - - /** - * Set version of new project created. - * - * @param version - * is the version to set. - * @ant.not-required - */ - public void setVersion(String version) { - this.version = version; - log("Set version to " + version); - } - - /** - * Return the leaveFoldersWritable. - * - * @return the leaveFoldersWritable. - */ - public Boolean getLeaveFoldersWritable() { - return leaveFoldersWritable; - } - - /** - * Set whether to leave the folders writable in the baseline project - * created. - * - * @param leaveFoldersWritable - * indicates whether to leave folders writable. - * @ant.not-required Default is no. - */ - public void setLeaveFoldersWritable(Boolean leaveFoldersWritable) { - this.leaveFoldersWritable = leaveFoldersWritable; - log("Set leaveFoldersWritable to " + leaveFoldersWritable); - } - - /** - * Return the rebadgeObjectVersions - * - * @return the rebadgeObjectVersions. - */ - public Boolean getRebadgeObjectVersions() { - return rebadgeObjectVersions; - } - - /** - * Set whether to rebadge object versions in the rebaseline.pl script. - * - * @param rebadgeObjectVersions - * indicates whether to rebadge object versions to a given release tag. - * @ant.not-required Default is no. - */ - public void setRebadgeObjectVersions(Boolean rebadgeObjectVersions) { - this.rebadgeObjectVersions = rebadgeObjectVersions; - log("Set rebadgeObjectVersions to " + rebadgeObjectVersions); - } - - /** - * Return the releaseBaseline. - * - * @return the releaseBaseline. - */ - public Boolean getReleaseBaseline() { - return releaseBaseline; - } - - /** - * Set whether to release the newly created baseline or not. - * - * @param releaseBaseline - * indicates whether to release the newly created baseline - */ - public void setReleaseBaseline(Boolean releaseBaseline) { - this.releaseBaseline = releaseBaseline; - log("Set releaseBaseline to " + releaseBaseline); - } - - /** - * Return the publish. - * - * @return the publish. - */ - public Boolean getPublish() { - return publish; - } - - /** - * Set whether to publish the newly created baseline or not. - * - * @param publish - * the publish to set - */ - public void setPublish(Boolean publish) { - this.publish = publish; - log("Set publish to " + publish); - } - - /** - * Return the createBaselineForRollingReleaseTag. - * - * @return the createBaselineForRollingReleaseTag. - */ - public Boolean getCreateBaselineForRollingReleaseTag() { - return createBaselineForRollingReleaseTag; - } - - /** - * Set whether to create additional integration baseline for rolling-release - * tag. - * - * @param createBaselineForRollingReleaseTag - * @ant.not-required Default is no. - */ - public void setCreateBaselineForRollingReleaseTag( - Boolean createBaselineForRollingReleaseTag) { - this.createBaselineForRollingReleaseTag = createBaselineForRollingReleaseTag; - log("Set createBaselineForRollingReleaseTag to " - + createBaselineForRollingReleaseTag); - } - - /** - * Return the enableTaskRebadgingGenericRelease. - * - * @return the enableTaskRebadgingGenericRelease. - */ - public Boolean getEnableTaskRebadgingGenericRelease() { - return enableTaskRebadgingGenericRelease; - } - - /** - * Set enable task rebadging (associated modifiable tasks with generic - * release only). Not supported in rebaseline.pl - * - * @param enableTaskRebadgingGenericRelease - * the enableTaskRebadgingGenericRelease to set - */ - public void setEnableTaskRebadgingGenericRelease( - Boolean enableTaskRebadgingGenericRelease) { - this.enableTaskRebadgingGenericRelease = enableTaskRebadgingGenericRelease; - log("Set enableTaskRebadgingGenericRelease to " - + enableTaskRebadgingGenericRelease); - } - - /** - * Return the enableTaskRebadging - * - * @return the enableTaskRebadging. - */ - public Boolean getEnableTaskRebadging() { - return enableTaskRebadging; - } - - /** - * Set enable task rebadging (all associated modifiable tasks). Not supported in rebaseline.pl - * - * @param enableTaskRebadging - * the enableTaskRebadging to set - */ - public void setEnableTaskRebadging(Boolean enableTaskRebadging) { - this.enableTaskRebadging = enableTaskRebadging; - log("Set enableTaskRebadging to " + enableTaskRebadging); - } - - /** - * Return the skipDeconfigure. - * - * @return the skipDeconfigure. - */ - public Boolean getSkipDeconfigure() { - return skipDeconfigure; - } - - /** - * Set to skip deconfigure. - * - * @param skipDeconfigure - * the skipDeconfigure to set - */ - public void setSkipDeconfigure(Boolean skipDeconfigure) { - this.skipDeconfigure = skipDeconfigure; - log("Set skipDeconfigure to " + skipDeconfigure); - } - - /** - * Return the deconfigure - * - * @return the deconfigure. - */ - public Boolean getDeconfigure() { - return deconfigure; - } - - /** - * Set deconfigure. - * - * @param deconfigure - * the deconfigure to set - */ - public void setDeconfigure(Boolean deconfigure) { - this.deconfigure = deconfigure; - log("Set deconfigure to " + deconfigure); - } - - /** - * Return the active. - * - * @return the active. - */ - public Boolean getActive() { - return active; - } - - /** - * Set whether the current release is active or not. - * - * @param active - * the active to set - */ - public void setActive(Boolean active) { - this.active = active; - log("Set active to " + active); - } - - /** - * Return useBranchReleaseMethodology. - * - * @return the useBranchReleaseMethodology. - */ - public Boolean getUseBranchReleaseMethodology() { - return useBranchReleaseMethodology; - } - - /** - * Set whether to utilize branch release methodology or not. - * - * @param useBranchReleaseMethodology - * is the boolean value to set. - * @ant.not-required Default is no. - */ - public void setUseBranchReleaseMethodology( - Boolean useBranchReleaseMethodology) { - this.useBranchReleaseMethodology = useBranchReleaseMethodology; - log("Set useBranchReleaseMethodology to " + useBranchReleaseMethodology); - } - - /** - * Return the release tag. - * - * @return the release tag. - */ - public String getRelease() { - return release; - } - - /** - * Set release tag (Two-part name) for the release project created. - * - * @param release - * is the release tag to set - * @ant.not-required - */ - public void setRelease(String release) { - this.release = release; - log("Set release to " + release); - } - - /** - * Return the newBaselineName. - * - * @return the newBaselineName. - */ - public String getNewBaselineName() { - return newBaselineName; - } - - /** - * Set new baseline name to use. - * - * @param newBaselineName - * is the new baseline name to set. - * @ant.not-required - */ - public void setNewBaselineName(String newBaselineName) { - this.newBaselineName = newBaselineName; - log("Set newBaselineName to " + newBaselineName); - } - - /** - * Set the execution script. - * - */ - protected void setExecutionScript() { - append2CommandString("rbt.pl"); - } - - /** - * Build a command list consisting of all the required and optional command - * arguments of the current task. - */ - protected void buildCommandList() { - addCommandArg("database", "-d", true, getDatabase()); - addCommandArg("password", "-U", true, getPassword()); - addCommandArg("ccmProject", "-p", getCcmProject()); - addCommandArg("baseline", "-B", getBaseline()); - addCommandArg("version", "-v", getVersion()); - addCommandArg("releaseBaseline", "-R", getReleaseBaseline()); - addCommandArg("publish", "-P", getPublish()); - addCommandArg("deconfigure", "-s", getDeconfigure()); - addCommandArg("leaveFoldersWritable", "-F", getLeaveFoldersWritable()); - addCommandArg("enableTaskRebadgingGenericRelease", "-t", getEnableTaskRebadgingGenericRelease()); - addCommandArg("enableTaskRebadging", "-T", getEnableTaskRebadging()); - addCommandArg("rebadgeObjectVersions", "-o", getRebadgeObjectVersions()); - addCommandArg("createBaselineForRollingReleaseTag", "-i", getCreateBaselineForRollingReleaseTag()); - addCommandArg("active", "-a", getActive()); - addCommandArg("skipDeconfigure", "-S", getSkipDeconfigure()); - addCommandArg("useBranchReleaseMethodology", "-b", getUseBranchReleaseMethodology()); - addCommandArg("release", "-r", getRelease()); - addCommandArg("newBaselineName", "-n", getNewBaselineName()); - } - - /** - * Method validates the given arguments. - */ - protected void validateArguments() { - - if (baseline != null && (getCcmProject() != null || newBaselineName != null)) { - raiseError("Option 'baseline' cannot be used with 'ccmProject' and 'newBaselineName'"); - } - - if (deconfigure != null && deconfigure && skipDeconfigure != null - && skipDeconfigure) { - raiseError("Use option either 'deconfigure' or 'skipDeconfigure'"); - } - - if (deconfigure != null && deconfigure && release == null) { - raiseError("Option 'release' is mandatory if 'deconfigure' is set"); - } - - if (publish != null && publish && releaseBaseline != null - && releaseBaseline) { - raiseError("Use Option either 'publish' or 'releaseBaseline'"); - } - - if (enableTaskRebadging != null && enableTaskRebadging - && enableTaskRebadgingGenericRelease != null - && enableTaskRebadgingGenericRelease) { - raiseError("Use Option either 'enableTaskRebadging' or 'enableTaskRebadgingGenericRelease'"); - } - } - - /** - * {@inheritDoc} - */ - protected String getVerbosity(int choice) { - String cmd = ""; - switch (choice) { - case 0: - cmd = "-Q"; - break; - case 1: - cmd = "-V"; - break; - case 2: - cmd = "-I"; - break; - case 3: - cmd = "-W"; - break; - default: - raiseError("Verbosity level is not recognised. " - + "Legal values are: 0 - quiet, 1 - verbose, 2 - Interactive " - + "or 3 - Walk-through Rehearsal"); - } - return cmd; - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/RebaselineTask.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/RebaselineTask.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* - * 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.ant.taskdefs; - - -/** - * ANT wrapper task for the GSCM rebaseline.pl script. - * <hlm:rebaseline database="to1tobet" ccmProject="helium-to1tobet#helium_4.49:project:vc1s60p1#1" password="test"/> - * @ant.task name="rebaseline" category="SCM" - */ -public class RebaselineTask extends RBTTask { - // The attributes of this task - private Boolean disableTaskRebadging; - - /** - * Return disableTaskRebadging - * - * @return the disableTaskRebadging. - */ - public Boolean getDisableTaskRebadging() { - return disableTaskRebadging; - } - - /** - * Set whether to disable task rebadging (incompatible with - * 'rebadgeObjectVersions' attribute) in the rebaseline.pl script. - * - * @param disableTaskRebadging - * @ant.not-required Default is no. - */ - public void setdisableTaskRebadging(Boolean disableTaskRebadging) { - this.disableTaskRebadging = disableTaskRebadging; - log("Set disableTaskRebadging to " + disableTaskRebadging); - } - - /** - * Set the execution script. - * - */ - protected void setExecutionScript() { - append2CommandString("rebaseline.pl"); - } - - /** - * Build a command list consisting of all the required and optional command - * arguments of the current task. - */ - protected void buildCommandList() { - addCommandArg("database", "-d", true, getDatabase()); - addCommandArg("password", "-P", true, getPassword()); - addCommandArg("ccmProject", "-p", true, getCcmProject()); - addCommandArg("release", "-r", getRelease()); - addCommandArg("baseline", "-B", getBaseline()); - addCommandArg("version", "-v", getVersion()); - addCommandArg("newBaselineName", "-n", getNewBaselineName()); - addCommandArg("releaseBaseline", "-R", getReleaseBaseline()); - addCommandArg("leaveFolderswritable", "-w", getLeaveFoldersWritable()); - addCommandArg("disableTaskRebadging", "-x", getDisableTaskRebadging()); - addCommandArg("rebadgeObjectVersions", "-a", getRebadgeObjectVersions()); - addCommandArg("useBranchReleaseMethodology", "-b", getUseBranchReleaseMethodology()); - addCommandArg("createBaselineForRollingReleaseTag", "-i", getCreateBaselineForRollingReleaseTag()); - } - - /** - * Method returns the correct verbosity level for the input choice. - * - * @param choice - * is the verbosity choice set by user. - * @return the verbosity level to set. - */ - protected String getVerbosity(int choice) { - String cmd = ""; - switch (choice) { - case 0: - cmd = "-q "; - break; - case 1: - cmd = "-V "; - break; - default: - raiseError("Verbosity level is not recognised. " - + "Legal values are: 0 - quiet, 1 - verbose."); - } - return cmd; - } - - /** - * Method validates the given arguments. - */ - protected void validateArguments() { - // Do nothing - } - -} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/Signal.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/Signal.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* 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.ant.taskdefs; - -/** - * This class stores a signal while being deferred. - * - */ -public class Signal { - - private String name; - private String message; - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/StopLogToConsole.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/StopLogToConsole.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* -* 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.ant.taskdefs; - -import org.apache.tools.ant.Task; -import com.nokia.ant.HeliumLogger; - -/** - * This task will control the outputing of the Helium logger. - * - * Example of usage, to stop logging to console: - *
    - * <hlm:logtoconsole action="stop"/>
    - * 
    - * - * To resume logging to console: - *
    - * <hlm:logtoconsole action="start"/>
    - * 
    - * - * @ant.task name="logtoconsole" category="Logging" - */ -public class StopLogToConsole extends Task -{ - private boolean stopLogToConsole; - - /** - * Action to perform, stop/start logging. - * @ant.not-required Default value is start. - */ - public void setAction(String msg) - { - if ( msg.equalsIgnoreCase("stop") ) - { - stopLogToConsole = true; - } - else - { - stopLogToConsole = false; - } - } - - @Override - public void execute() - { - super.execute(); - if (HeliumLogger.getStopLogToConsole() != stopLogToConsole) - { - if (stopLogToConsole) - log("Logging to console suspended."); - HeliumLogger.setStopLogToConsole(stopLogToConsole); - if (!stopLogToConsole) - log("Logging to console resumed."); - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/StopLogToConsoleTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/StopLogToConsoleTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,72 @@ +/* +* 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.ant.taskdefs; + +import org.apache.tools.ant.Task; +import com.nokia.ant.HeliumLogger; + +/** + * This task will control the outputing of the Helium logger. + * + * Example of usage, to stop logging to console: + *
    + * <hlm:logtoconsole action="stop"/>
    + * 
    + * + * To resume logging to console: + *
    + * <hlm:logtoconsole action="start"/>
    + * 
    + * + * @ant.task name="logtoconsole" category="Logging" + */ +public class StopLogToConsoleTask extends Task +{ + private boolean stopLogToConsole; + + /** + * Action to perform, stop/start logging. + * @ant.not-required Default value is start. + */ + public void setAction(String msg) + { + if ( msg.equalsIgnoreCase("stop") ) + { + stopLogToConsole = true; + } + else + { + stopLogToConsole = false; + } + } + + @Override + public void execute() + { + super.execute(); + if (HeliumLogger.getStopLogToConsole() != stopLogToConsole) + { + if (stopLogToConsole) + log("Logging to console suspended."); + HeliumLogger.setStopLogToConsole(stopLogToConsole); + if (!stopLogToConsole) + log("Logging to console resumed."); + } + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/AddTask.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/AddTask.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* 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.ant.taskdefs.ccm.commands; - -import java.util.Vector; -import com.nokia.ant.types.ccm.Task; - -/** - * This object creates new ccm task and contains all the Tasks in a list. - * - */ -public class AddTask extends CcmCommand -{ - private String folder; - private Vector tasks = new Vector(); - - public String getFolder() - { - return folder; - } - - public void setFolder(String folder) - { - this.folder = folder; - } - - public Task createTask() { - Task task = new Task(); - tasks.add(task); - return task; - } - - public Task[] getTasks() { - Task[] result = new Task[tasks.size()]; - tasks.copyInto(result); - return result; - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/CcmCommand.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/CcmCommand.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* 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.ant.taskdefs.ccm.commands; - -import com.nokia.ant.taskdefs.CcmTask; - -/** - * Creates command string based on runtime class name. - * - */ -public class CcmCommand -{ - private CcmTask task; - - /** - * @return the task - */ - public CcmTask getTask() - { - return task; - } - - /** - * @param task - * the task to set - */ - public void setTask(CcmTask task) - { - this.task = task; - } - - - public String getName() - { - String className = getClass().getName(); - String commandName = className.substring(className.lastIndexOf('.') + 1).toLowerCase(); - return commandName; - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/ChangeReleaseTag.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/ChangeReleaseTag.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* 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.ant.taskdefs.ccm.commands; - -/** - * This object contains the current release tag. - * - */ -public class ChangeReleaseTag extends CcmCommand -{ - private String folder; - private String newreleasetag; - - - public String getFolder() - { - return folder; - } - - public void setFolder(String folder) - { - this.folder = folder; - } - - public String getReleaseTag() - { - return newreleasetag; - } - - public void setReleasetag(String newreleasetag) - { - this.newreleasetag = newreleasetag; - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/Checkout.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/Checkout.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* -* 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.ant.taskdefs.ccm.commands; - -/** - * This object is used to check out a ccm project. - * - */ -public class Checkout extends CcmCommand -{ - private String project; - private String release; - private String version; - private String purpose; - private String wa; - private boolean recursive; - private boolean relative; - - public String getProject() - { - return project; - } - - public void setProject(String project) - { - this.project = project; - } - - public String getRelease() - { - return release; - } - - public void setRelease(String release) - { - this.release = release; - } - - public String getVersion() - { - return version; - } - - public void setVersion(String version) - { - this.version = version; - } - - public String getPurpose() - { - return purpose; - } - - public void setPurpose(String purpose) - { - this.purpose = purpose; - } - - public String getWa() - { - return wa; - } - - public void setWa(String wa) - { - this.wa = wa; - } - - public boolean getRecursive() - { - return recursive; - } - - public void setRecursive(boolean recursive) - { - this.recursive = recursive; - } - - public boolean getRelative() - { - return relative; - } - - public void setRelative(boolean relative) - { - this.relative = relative; - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/Close.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/Close.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* 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.ant.taskdefs.ccm.commands; -/** - * To close the ccm session - * - */ -public class Close extends CcmCommand -{ -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/Reconcile.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/Reconcile.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* 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.ant.taskdefs.ccm.commands; - -/** - * This object is used to reconcile a ccm project. - * - */ -public class Reconcile extends CcmCommand -{ - private String project; - - public String getProject() - { - return project; - } - - public void setProject(String project) - { - this.project = project; - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/Snapshot.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/Snapshot.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* 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.ant.taskdefs.ccm.commands; - -/** - * This object is used to snap shot a ccm project. - * - */ -public class Snapshot extends CcmCommand -{ - private String project; - private String dir; - private boolean recursive; - private boolean fast; - - public String getProject() - { - return project; - } - - public void setProject(String project) - { - this.project = project; - } - - public String getDir() - { - return dir; - } - - public void setDir(String dir) - { - this.dir = dir; - } - - public boolean getRecursive() - { - return recursive; - } - - public void setRecursive(boolean recursive) - { - this.recursive = recursive; - } - - public boolean getFast() - { - return fast; - } - - public void setFast(boolean fast) - { - this.fast = fast; - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/Synchronize.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/Synchronize.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* 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.ant.taskdefs.ccm.commands; - -/** - * This object is used to Synchronize a ccm project. - * - */ -public class Synchronize extends CcmCommand -{ - private String project; - private boolean recursive = true; - - - public String getProject() - { - return project; - } - - public void setProject(String project) - { - this.project = project; - } - - public boolean getRecursive() - { - return recursive; - } - - public void setRecursive(boolean recursive) - { - this.recursive = recursive; - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/Update.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/Update.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* 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.ant.taskdefs.ccm.commands; -/** - * This object is used to update a ccm project. - * - */ -public class Update extends CcmCommand -{ - private String project; - - public String getProject() - { - return project; - } - - public void setProject(String project) - { - this.project = project; - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/Workarea.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/taskdefs/ccm/commands/Workarea.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* 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.ant.taskdefs.ccm.commands; -/** - * Creates interface to get\set workarea informations for a given project. - * - */ -public class Workarea extends CcmCommand -{ - private String project; - private String path; - private String pst; - private boolean maintain; - private boolean recursive; - private boolean relative; - private boolean wat; - - public String getProject() - { - return project; - } - - public void setProject(String project) - { - this.project = project; - } - - public boolean getMaintain() - { - return maintain; - } - - public void setMaintain(boolean maintain) - { - this.maintain = maintain; - } - - public boolean getRecursive() - { - return recursive; - } - - public void setRecursive(boolean recursive) - { - this.recursive = recursive; - } - - public boolean getRelative() - { - return relative; - } - - public void setRelative(boolean relative) - { - this.relative = relative; - } - - public String getPath() - { - return path; - } - - public void setPath(String path) - { - this.path = path; - } - - public String getPst() - { - return pst; - } - - public void setPst(String pst) - { - this.pst = pst; - } - - public boolean getWat() - { - return wat; - } - - public void setWat(boolean wat) - { - this.wat = wat; - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/types/ccm/Session.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/types/ccm/Session.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* 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.ant.types.ccm; - -import org.apache.tools.ant.types.DataType; - -/** - * This class abstract a synergy session. - * It store the address to an already existing session. - * @ant.type name="session" category="SCM" - */ -public class Session extends DataType { - // store the ccm_addr value - private String addr; - - /** - * Sets the synergy address. - * @param addr string representing the ccm_addr - */ - public void setAddr(String addr) { - this.addr = addr; - } - - /** - * Get the synergy address. - * @return string representing the ccm_addr - */ - public String getAddr() { - return this.addr; - } -} - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/types/ccm/SessionSet.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/types/ccm/SessionSet.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* 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.ant.types.ccm; - -import org.apache.tools.ant.types.DataType; -import java.util.Vector; - -/** - * This class implement an Ant Datatype that represents a set of - * synergy sessions. - * @ant.type name="sessionset" category="SCM" - */ -public class SessionSet extends DataType { - private Vector sessions = new Vector(); - - /** - * Create and register a Session object. - * @return a Session object. - */ - public Session createSession() { - Session session = new Session(); - sessions.add(session); - return session; - } - - /** - * Returns an array of Session object. - * @returns an array of Session object - */ - public Session[] getSessions() { - Session[] result = new Session[sessions.size()]; - sessions.copyInto(result); - return result; - } -} - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/types/ccm/Task.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/types/ccm/Task.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* 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.ant.types.ccm; - -import org.apache.tools.ant.types.DataType; - -/** - * This class abstract a synergy session. - * It store the address to an already existing session. - */ -public class Task extends DataType { - // store the ccm_addr value - private String name; - - /** - * Sets the synergy address. - * @param name string representing the ccm_addr - */ - public void setName(String name) { - this.name = name; - } - - /** - * Get the synergy address. - * @return string representing the ccm_addr - */ - public String getName() { - return name; - } -} - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ant/types/ccm/TaskSet.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ant/types/ccm/TaskSet.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* 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.ant.types.ccm; - -import org.apache.tools.ant.types.DataType; -import java.util.Vector; - -/** - * This class abstract a synergy session. - * It store the address to an already existing session. - */ -public class TaskSet extends DataType { - // store the Task objects - private Vector tasks = new Vector(); - - /** - * Create and register a Session object. - * @return a Session object. - */ - public Task createTask() { - Task task = new Task(); - tasks.add(task); - return task; - } - - /** - * Returns an array of Session object. - * @returns an array of Session object - */ - public Task[] getSessions() { - Task[] result = new Task[tasks.size()]; - tasks.copyInto(result); - return result; - } -} - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/ivy/ToolResolver.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/ivy/ToolResolver.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/ivy/ToolResolver.java Wed Jun 16 16:51:40 2010 +0300 @@ -132,8 +132,8 @@ continue; } if (versionMatcher.needModuleDescriptor(mrid, foundMrid)) { - ResolvedResource r = rmdparser.parse(rres.getResource(), rres.getRevision()); - ModuleDescriptor md = ((MDResolvedResource)r).getResolvedModuleRevision().getDescriptor(); + ResolvedResource resolvedResource = rmdparser.parse(rres.getResource(), rres.getRevision()); + ModuleDescriptor md = ((MDResolvedResource)resolvedResource).getResolvedModuleRevision().getDescriptor(); if (md.isDefault()) { Message.debug("\t" + name + ": default md rejected by version matcher requiring module descriptor: " + rres); rejected.add(rres.getRevision() + " (MD)"); @@ -143,7 +143,7 @@ rejected.add(rres.getRevision() + " (MD)"); continue; } else { - found = r; + found = resolvedResource; } } else { found = rres; @@ -242,13 +242,13 @@ Message.debug("\t\tm2compatible: " + isM2compatible()); Message.debug("\t\tivy patterns:"); for (ListIterator iter = getIvyPatterns().listIterator(); iter.hasNext();) { - String p = (String)iter.next(); - Message.debug("\t\t\t" + p); + String pattern = (String)iter.next(); + Message.debug("\t\t\t" + pattern); } Message.debug("\t\tartifact patterns:"); for (ListIterator iter = getArtifactPatterns().listIterator(); iter.hasNext();) { - String p = (String)iter.next(); - Message.debug("\t\t\t" + p); + String pattern = (String)iter.next(); + Message.debug("\t\t\t" + pattern); } } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/src/com/nokia/tools/configuration/CONFIGURATIONTool.java --- a/buildframework/helium/sf/java/legacy/src/com/nokia/tools/configuration/CONFIGURATIONTool.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/legacy/src/com/nokia/tools/configuration/CONFIGURATIONTool.java Wed Jun 16 16:51:40 2010 +0300 @@ -17,8 +17,8 @@ package com.nokia.tools.configuration; +import com.nokia.helium.core.ant.MappedVariable; import com.nokia.helium.core.ant.types.VariableSet; -import com.nokia.helium.core.ant.types.Variable; import com.nokia.tools.*; import org.apache.tools.ant.Project; @@ -45,7 +45,7 @@ String report = null; String varName; String value; - for (Variable variable : varSet.getVariables()) { + for (MappedVariable variable : varSet.getVariables()) { varName = variable.getName(); value = variable.getValue(); if (varName.equals("path")) { diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/tests/antunit/test_deconfigure_task.ant.xml --- a/buildframework/helium/sf/java/legacy/tests/antunit/test_deconfigure_task.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ - - - - - Deconfigure testing targets for script deconfigure.pl - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/tests/antunit/test_rebaseanddeconf_task.ant.xml --- a/buildframework/helium/sf/java/legacy/tests/antunit/test_rebaseanddeconf_task.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,263 +0,0 @@ - - - - - Rebaseline and Deconfigure testing targets for script rbt.pl - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/legacy/tests/antunit/test_rebaseline_task.ant.xml --- a/buildframework/helium/sf/java/legacy/tests/antunit/test_rebaseline_task.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,189 +0,0 @@ - - - - - Rebaseline testing targets for script rebaseline.pl - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/antlib.xml --- a/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/antlib.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/antlib.xml Wed Jun 16 16:51:40 2010 +0300 @@ -22,9 +22,9 @@ --> - - - + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/listener/AntLoggingHandler.java --- a/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/listener/AntLoggingHandler.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/listener/AntLoggingHandler.java Wed Jun 16 16:51:40 2010 +0300 @@ -44,15 +44,14 @@ */ public class AntLoggingHandler implements Handler { private static Hashtable recorderEntries = new Hashtable(); + private static HashMap fileCreatedMap = new HashMap(); + private static boolean isDefaultStageStarted; private Map stagesMapping; private Map stageRecordMap; private HashMap> depStartTargetMap; private HashMap stageStartTargetMap; - private HashMap fileCreatedMap; private boolean isStageRecordingHappening; private boolean loggingStarted; - private boolean isStageInformationInited; - private boolean isDefaultStageStarted; private int loglevel = -1; private VerbosityLevelChoices antLogLevel; private Logger log = Logger.getLogger(AntLoggingHandler.class); @@ -71,7 +70,7 @@ stageRecordMap = new HashMap(); depStartTargetMap = new HashMap>(); stageStartTargetMap = new HashMap(); - fileCreatedMap = new HashMap(); + initStagesInformation(project); } /** @@ -93,7 +92,11 @@ log.debug("Stopping stage logging for [" + currentStageName + "] for target [" + event.getTarget().getName() + "]"); stopLog(currentStageName, "default"); - startLog("default"); + if (!isDefaultStageStarted) + { + startLog("default"); + isDefaultStageStarted = true; + } currentStageName = null; } } @@ -104,25 +107,23 @@ public void handleTargetStarted(BuildEvent event) { // log.debug("Started target [" + event.getTarget().getName() + "]"); - if (!this.isStageInformationInited) { - initStagesInformation(event.getProject()); - this.isStageInformationInited = true; + + if (getLoggingStarted() && !isDefaultStageStarted) { + startLog("default"); + isDefaultStageStarted = true; } - if (this.isStageInformationInited && getLoggingStarted() - && !this.isDefaultStageStarted) { - startLog("default"); - this.isDefaultStageStarted = true; - } - - if (currentStageName == null && !getIsStageRecordingHappening() - && (getLoggingStarted())) { - String stageName = isStageValid(event.getTarget(), event - .getProject()); + if (currentStageName == null && !getIsStageRecordingHappening() && getLoggingStarted()) { + String stageName = isStageValid(event.getTarget(), event.getProject()); if (stageName != null) { log.debug("Started stage logging for [" + stageName + "] for target [" + event.getTarget().getName() + "]"); - stopLog("default", stageName); + + if (isDefaultStageStarted) + { + stopLog("default", stageName); + isDefaultStageStarted = false; + } startLog(stageName); currentStageName = stageName; } @@ -147,7 +148,11 @@ */ if (getLoggingStarted() && getIsStageRecordingHappening()) { stopLog(currentStageName, "default"); - startLog("default"); + if (!isDefaultStageStarted) + { + startLog("default"); + isDefaultStageStarted = true; + } currentStageName = null; } @@ -155,8 +160,9 @@ * If default stage logging happening stop logging into default ant log * file. */ - if (this.isDefaultStageStarted && getLoggingStarted()) { + if (isDefaultStageStarted && getLoggingStarted()) { stopLog("default", null, event); + isDefaultStageStarted = false; } this.cleanup(); } @@ -202,6 +208,7 @@ private void cleanup() { log.debug("Cleaning up recorder entries of stagerecord"); recorderEntries.clear(); + fileCreatedMap.clear(); } @@ -239,6 +246,8 @@ String time = getDateTime(); File fileName; if (stageName.equalsIgnoreCase("default")) { + if (stageRecordMap.get("default") == null) + throw new BuildException("stageRecordMap.get('default') is null"); fileName = stageRecordMap.get("default").getDefaultOutput(); } else { fileName = stageRecordMap.get(stageName).getOutput(); @@ -337,7 +346,6 @@ * @param stageName */ private void startLog(String stageName) { - File fileName; String message; String time = getDateTime(); @@ -371,8 +379,7 @@ * @param stageLogging * @return */ - private boolean isFilePresent(RecorderEntry recorderEntry, File fileName, - StageLogging stageLogging) { + private boolean isFilePresent(RecorderEntry recorderEntry, File fileName, StageLogging stageLogging) { log.debug("isFilePresent? " + fileName); if (!fileCreatedMap.get(fileName)) { if (!fileName.getParentFile().exists()) { @@ -381,12 +388,8 @@ } if (fileName.exists()) { long timestamp = System.currentTimeMillis(); - StatusAndLogListener.getStatusAndLogListener().getProject() - .log( - "Backing up of " + fileName + " into " - + fileName + "." + timestamp); - fileName.renameTo(new File(fileName.getAbsoluteFile() + "." - + timestamp)); + getProject().log("Backing up of " + fileName + " into " + fileName + "." + timestamp); + fileName.renameTo(new File(fileName.getAbsoluteFile() + "." + timestamp)); } recorderEntry.openFile(stageLogging.getAppend()); fileCreatedMap.put(fileName, true); @@ -416,7 +419,6 @@ */ private void stopLog(String stopStageName, String startStageName, BuildEvent event) { - File fileName; String message; String time = getDateTime(); @@ -463,7 +465,8 @@ recorderEntry.setMessageOutputLevel(loglevel); recorderEntry.setEmacsMode(false); recorderEntry.setRecordState(false); - fileCreatedMap.put(fileName, false); + if (fileCreatedMap.get(fileName) == null) + fileCreatedMap.put(fileName, false); } /** @@ -474,14 +477,9 @@ * @return */ private String isStageValid(Target target, Project proj) { - - if (!proj.getName().equals( - StatusAndLogListener.getStatusAndLogListener().getProject() - .getName()) - && (StatusAndLogListener.getStatusAndLogListener().getProject() - .getName() != null)) { + //if (!proj.getName().equals(StatusAndLogListener.getStatusAndLogListener().getProject().getName()) && (StatusAndLogListener.getStatusAndLogListener().getProject().getName() != null)) { initSubProjectDependentTarget(proj); - } + //} for (Map.Entry entry : stagesMapping.entrySet()) { Stage stage = entry.getValue(); if (stage.getStartTarget().equals(target.getName()) @@ -672,8 +670,7 @@ } } } - throw new BuildException( - "There should be one default stagerecord datatype."); + throw new BuildException("There should be one default stagerecord datatype."); } /** diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/listener/RecorderEntry.java --- a/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/listener/RecorderEntry.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/listener/RecorderEntry.java Wed Jun 16 16:51:40 2010 +0300 @@ -333,14 +333,14 @@ * Registering ourselves to the StatusAndLogListener. */ public void register() { - StatusAndLogListener l = StatusAndLogListener.getStatusAndLogListener(); - if (l != null) { + StatusAndLogListener listener = StatusAndLogListener.getStatusAndLogListener(); + if (listener != null) { this.log.debug("register"); - synchronized (l) { - l.register((BuildEventHandler)this); - l.register((TargetEventHandler)this); - l.register((TaskEventHandler)this); - l.register((MessageEventHandler)this); + synchronized (listener) { + listener.register((BuildEventHandler)this); + listener.register((TargetEventHandler)this); + listener.register((TaskEventHandler)this); + listener.register((MessageEventHandler)this); } } } @@ -349,14 +349,14 @@ * Unregistering ourselves from the StatusAndLogListener. */ public void unregister() { - StatusAndLogListener l = StatusAndLogListener.getStatusAndLogListener(); - if (l != null) { + StatusAndLogListener listener = StatusAndLogListener.getStatusAndLogListener(); + if (listener != null) { this.log.debug("unregister"); - synchronized (l) { - l.remove((MessageEventHandler)this); - l.remove((TaskEventHandler)this); - l.remove((TargetEventHandler)this); - l.remove((BuildEventHandler)this); + synchronized (listener) { + listener.remove((MessageEventHandler)this); + listener.remove((TaskEventHandler)this); + listener.remove((TargetEventHandler)this); + listener.remove((BuildEventHandler)this); } } } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/listener/StatusAndLogListener.java --- a/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/listener/StatusAndLogListener.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/listener/StatusAndLogListener.java Wed Jun 16 16:51:40 2010 +0300 @@ -188,7 +188,7 @@ * @param handler * is the handler to register */ - public synchronized void register ( Handler handler ) { + public synchronized void register( Handler handler ) { Vector tmpBuildHandlers = new Vector(buildHandlers); tmpBuildHandlers.add( handler ); buildHandlers = tmpBuildHandlers; @@ -203,7 +203,7 @@ * @param handler * is the handler to register */ - public synchronized void remove ( Handler handler ) { + public synchronized void remove( Handler handler ) { Vector tmpBuildHandlers = new Vector(buildHandlers); tmpBuildHandlers.remove( handler ); buildHandlers = tmpBuildHandlers; @@ -218,7 +218,7 @@ * @param handler * is the handler to register */ - public synchronized void register ( BuildEventHandler handler ) { + public synchronized void register( BuildEventHandler handler ) { Vector tmp = new Vector(buildHandlers); tmp.add( handler ); buildHandlers = tmp; @@ -230,7 +230,7 @@ * @param handler * is the handler to register */ - public synchronized void remove ( BuildEventHandler handler ) { + public synchronized void remove( BuildEventHandler handler ) { Vector tmp = new Vector(buildHandlers); tmp.remove( handler ); buildHandlers = tmp; @@ -242,7 +242,7 @@ * @param handler * is the handler to register */ - public synchronized void register ( TargetEventHandler handler ) { + public synchronized void register( TargetEventHandler handler ) { Vector tmp = new Vector(targetHandlers); tmp.add( handler ); targetHandlers = tmp; @@ -254,7 +254,7 @@ * @param handler * is the handler to register */ - public synchronized void remove ( TargetEventHandler handler ) { + public synchronized void remove( TargetEventHandler handler ) { Vector tmp = new Vector(targetHandlers); tmp.remove( handler ); targetHandlers = tmp; @@ -267,7 +267,7 @@ * @param handler * is the handler to register */ - public synchronized void register ( SubBuildEventHandler handler ) { + public synchronized void register( SubBuildEventHandler handler ) { Vector tmp = new Vector(subBuildHandlers); tmp.add( handler ); subBuildHandlers = tmp; @@ -279,7 +279,7 @@ * @param handler * is the handler to register */ - public synchronized void remove ( SubBuildEventHandler handler ) { + public synchronized void remove( SubBuildEventHandler handler ) { Vector tmp = new Vector(subBuildHandlers); tmp.remove( handler ); subBuildHandlers = tmp; @@ -291,7 +291,7 @@ * @param handler * is the handler to register */ - public synchronized void register ( MessageEventHandler handler ) { + public synchronized void register( MessageEventHandler handler ) { Vector tmp = new Vector(messageHandlers); tmp.add( handler ); messageHandlers = tmp; @@ -303,7 +303,7 @@ * @param handler * is the handler to register */ - public synchronized void remove ( MessageEventHandler handler ) { + public synchronized void remove( MessageEventHandler handler ) { Vector tmp = new Vector(messageHandlers); tmp.remove( handler ); messageHandlers = tmp; @@ -315,7 +315,7 @@ * @param handler * is the handler to register */ - public synchronized void register ( TaskEventHandler handler ) { + public synchronized void register( TaskEventHandler handler ) { Vector tmp = new Vector(taskHandlers); tmp.add( handler ); taskHandlers = tmp; @@ -327,7 +327,7 @@ * @param handler * is the handler to register */ - public synchronized void remove ( TaskEventHandler handler ) { + public synchronized void remove( TaskEventHandler handler ) { Vector tmp = new Vector(taskHandlers); tmp.remove( handler ); taskHandlers = tmp; @@ -339,7 +339,7 @@ * @return */ public Project getProject() { - return project; + return project; } /** diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/taskdefs/LogRecorder.java --- a/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/taskdefs/LogRecorder.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,368 +0,0 @@ -/* -* 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.io.File; -import java.io.IOException; -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.AntLoggingHandler; -import com.nokia.helium.logger.ant.listener.Handler; -import com.nokia.helium.logger.ant.listener.RecorderEntry; -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" backup="true" 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 File fileName; - private boolean append ; - private Boolean start ; - private boolean backup; - private String backupProperty; - private int loglevel = -1; - private boolean emacsMode ; - private Vector recordFilters = new Vector(); - private Vector recordFilterSet = new Vector(); - private Vector regExpList = new Vector(); - - - /** - * Run by the task. - */ - public void execute () { - if (StatusAndLogListener.getStatusAndLogListener() == null) { - log("The StatusAndLogListener is not available.", Project.MSG_WARN); - return; - } - AntLoggingHandler antLoggingHandler = (AntLoggingHandler)StatusAndLogListener.getStatusAndLogListener().getHandler(AntLoggingHandler.class); - - /* To validate attributes passed. */ - validateAttributes(); - - /* to add regular filters */ - addAllRecordFilters(); - - - /* Init password/record filter and replace any unset properties */ - initAndReplaceProperties(); - - //Create the root folder path. - if (this.start && this.start.booleanValue() && this.backup) { - if (fileName.exists()) { - File backupFile; - try { - backupFile = File.createTempFile(fileName.getName(), null, fileName.getParentFile()); - backupFile.delete(); - log("Backing up " + fileName + " as " + backupFile); - if (!fileName.renameTo(backupFile)) { - log("Error renaming the backup file.", Project.MSG_ERR); - } - if (backupFile.exists() && backupProperty != null) { - getProject().setNewProperty(backupProperty, backupFile.getAbsolutePath()); - } - } catch (IOException e) { - log("Error creating the backup file: " + e, Project.MSG_ERR); - } - } - } - if (!fileName.getParentFile().exists()) { - fileName.getParentFile().mkdirs(); - } - - RecorderEntry 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, getOwningTarget()); - } else { - antLoggingHandler.doLoggingAction("default", false, "Stopping", this, getOwningTarget()); - } - } - recorder.reopenFile(); - recorder.setRecordState(start.booleanValue()); - } else { - recorder.setRecordState(start.booleanValue()); - recorder.closeFile(); - if (antLoggingHandler != null) { - if (antLoggingHandler.getCurrentStageName() != null) { - antLoggingHandler.doLoggingAction(antLoggingHandler.getCurrentStageName(), true, "Starting", this, getOwningTarget()); - } else { - antLoggingHandler.doLoggingAction("default", true, "Starting", this, getOwningTarget()); - } - } - } - } - - } - /** - * 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 record. - * @param fileName - * @ant.required - */ - public void setName(File fileName) { - this.fileName = fileName; - } - - /** - * Return the fileName. - * @return - */ - public File getName() { - return this.fileName; - } - - /** - * Set the append parameter. - * @param append - * @ant.not-required Default is false - */ - public void setAppend(boolean append) { - this.append = append; - } - - - - /** - * Enable backup of - * @param backup - * @ant.not-required - */ - public void setBackup(boolean backup) { - this.backup = backup; - } - - /** - * Name of the property that will contains the backed up log. - * @param property a property name. - * @ant.not-required Only works if backup is true. - */ - public void setBackupProperty(String property) { - this.backupProperty = property; - } - - /** - * 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 - */ - protected RecorderEntry getRecorder(File name, Project proj) { - RecorderEntry entry = recorderEntries.get(name); - if (entry == null) { - // create a recorder entry - entry = new RecorderEntry(name); - for (String regExp : regExpList) { - if (!regExp.equals("")) { - String pattern = Pattern.quote(regExp); - entry.addRegexp(pattern); - } - } - entry.openFile(append); - recorderEntries.put(fileName, entry); - } - 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. - */ - 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 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/taskdefs/LogRecorderTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/taskdefs/LogRecorderTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,368 @@ +/* +* 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.io.File; +import java.io.IOException; +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.AntLoggingHandler; +import com.nokia.helium.logger.ant.listener.Handler; +import com.nokia.helium.logger.ant.listener.RecorderEntry; +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" backup="true" loglevel="info">
    + *           <hlm:recordfilterset refid="recordfilter.config"/>
    + *           <hlm:recordfilter category="info" regexp="^INFO:" />
    + *      </hlm:record>
    + *      
    + * 
    + * + * @ant.task name="Record" category="Logging". + * + */ + +public class LogRecorderTask extends Task implements Handler { + + private static Hashtable recorderEntries = new Hashtable(); + private File fileName; + private boolean append ; + private Boolean start ; + private boolean backup; + private String backupProperty; + private int loglevel = -1; + private boolean emacsMode ; + private Vector recordFilters = new Vector(); + private Vector recordFilterSet = new Vector(); + private Vector regExpList = new Vector(); + + + /** + * Run by the task. + */ + public void execute() { + StatusAndLogListener statusAndLogListener = new StatusAndLogListener(); + AntLoggingHandler antLoggingHandler = new AntLoggingHandler(getProject()); + antLoggingHandler.setLoggingStarted(true); + statusAndLogListener.register(antLoggingHandler); + + /* To validate attributes passed. */ + validateAttributes(); + + /* to add regular filters */ + addAllRecordFilters(); + + /* Init password/record filter and replace any unset properties */ + initAndReplaceProperties(); + + //Create the root folder path. + if (this.start && this.start.booleanValue() && this.backup) { + if (fileName.exists()) { + File backupFile; + try { + backupFile = File.createTempFile(fileName.getName(), null, fileName.getParentFile()); + backupFile.delete(); + log("Backing up " + fileName + " as " + backupFile); + if (!fileName.renameTo(backupFile)) { + log("Error renaming the backup file.", Project.MSG_ERR); + } + if (backupFile.exists() && backupProperty != null) { + getProject().setNewProperty(backupProperty, backupFile.getAbsolutePath()); + } + } catch (IOException e) { + log("Error creating the backup file: " + e, Project.MSG_ERR); + } + } + } + if (!fileName.getParentFile().exists()) { + fileName.getParentFile().mkdirs(); + } + + RecorderEntry recorder = getRecorder(fileName, getProject()); + // set the values on the recorder + recorder.setMessageOutputLevel(loglevel); + recorder.setEmacsMode(emacsMode); + if (start != null) { + if (start.booleanValue()) { + getProject().addBuildListener(statusAndLogListener); + if (antLoggingHandler != null) { + if (antLoggingHandler.getCurrentStageName() != null) { + antLoggingHandler.doLoggingAction(antLoggingHandler.getCurrentStageName(), false, "Stopping", this, getOwningTarget()); + } else { + antLoggingHandler.doLoggingAction("default", false, "Stopping", this, getOwningTarget()); + } + } + recorder.reopenFile(); + recorder.setRecordState(start.booleanValue()); + } else { + recorder.setRecordState(start.booleanValue()); + recorder.closeFile(); + getProject().removeBuildListener(statusAndLogListener); + if (antLoggingHandler != null) { + if (antLoggingHandler.getCurrentStageName() != null) { + antLoggingHandler.doLoggingAction(antLoggingHandler.getCurrentStageName(), true, "Starting", this, getOwningTarget()); + } else { + antLoggingHandler.doLoggingAction("default", true, "Starting", this, getOwningTarget()); + } + } + } + } + + } + /** + * 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 record. + * @param fileName + * @ant.required + */ + public void setName(File fileName) { + this.fileName = fileName; + } + + /** + * Return the fileName. + * @return + */ + public File getName() { + return this.fileName; + } + + /** + * Set the append parameter. + * @param append + * @ant.not-required Default is false + */ + public void setAppend(boolean append) { + this.append = append; + } + + + + /** + * Enable backup of + * @param backup + * @ant.not-required + */ + public void setBackup(boolean backup) { + this.backup = backup; + } + + /** + * Name of the property that will contains the backed up log. + * @param property a property name. + * @ant.not-required Only works if backup is true. + */ + public void setBackupProperty(String property) { + this.backupProperty = property; + } + + /** + * 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 + */ + protected RecorderEntry getRecorder(File name, Project proj) { + RecorderEntry entry = recorderEntries.get(name); + if (entry == null) { + // create a recorder entry + entry = new RecorderEntry(name); + for (String regExp : regExpList) { + if (!regExp.equals("")) { + String pattern = Pattern.quote(regExp); + entry.addRegexp(pattern); + } + } + entry.openFile(append); + recorderEntries.put(fileName, entry); + } + 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. + */ + 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 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/taskdefs/LogReplace.java --- a/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/taskdefs/LogReplace.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* 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.Project; -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 () { - if (StatusAndLogListener.getStatusAndLogListener() == null) { - this.log("The StatusAndLogListener is not available.", Project.MSG_WARN); - return; - } - - AntLoggingHandler antLoggingHandler = (AntLoggingHandler)StatusAndLogListener.getStatusAndLogListener().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 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/taskdefs/LogReplaceTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/taskdefs/LogReplaceTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,79 @@ +/* +* 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.Project; +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 LogReplaceTask extends Task { + + private String regExp; + + /** + * Run by the task. + */ + + public void execute() { + if (StatusAndLogListener.getStatusAndLogListener() == null) { + this.log("The StatusAndLogListener is not available.", Project.MSG_WARN); + return; + } + + AntLoggingHandler antLoggingHandler = (AntLoggingHandler)StatusAndLogListener.getStatusAndLogListener().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 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/taskdefs/TriggerLogger.java --- a/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/taskdefs/TriggerLogger.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* 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 org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; - -import com.nokia.helium.logger.ant.listener.AntLoggingHandler; -import com.nokia.helium.logger.ant.listener.StatusAndLogListener; -import org.apache.log4j.Logger; - -/** - * This task is used to start the helium logging listener. - * @ant.task name="triggerlogger" category="Logging" - */ -public class TriggerLogger extends Task { - - private Logger log = Logger.getLogger(TriggerLogger.class); - - public void execute() { - log.debug("Registering Ant logging to StatusAndLogListener listener"); - if (StatusAndLogListener.getStatusAndLogListener() == null) { - this.log("The StatusAndLogListener is not available.", Project.MSG_WARN); - return; - } - AntLoggingHandler antLoggingHandler = (AntLoggingHandler)StatusAndLogListener.getStatusAndLogListener().getHandler(AntLoggingHandler.class); - if (antLoggingHandler != null ) { - if (!antLoggingHandler.getLoggingStarted()) { - log.debug("Starting Logging using 'AntLoggingHandler' first time."); - antLoggingHandler.setLoggingStarted(true); - } else { - log.debug("'AntLoggingHandler' is already started logging."); - } - } else { - log.debug("Could not find the AntLoggingHandler instance."); - } - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/taskdefs/TriggerLoggerTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/taskdefs/TriggerLoggerTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.logger.ant.taskdefs; + +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; + +import com.nokia.helium.logger.ant.listener.AntLoggingHandler; +import com.nokia.helium.logger.ant.listener.StatusAndLogListener; +import org.apache.log4j.Logger; + +/** + * This task is used to start the helium logging listener. + * @ant.task name="triggerlogger" category="Logging" + */ +public class TriggerLoggerTask extends Task { + + private Logger log = Logger.getLogger(TriggerLoggerTask.class); + + public void execute() { + log.debug("Registering Ant logging to StatusAndLogListener listener"); + if (StatusAndLogListener.getStatusAndLogListener() == null) { + this.log("The StatusAndLogListener is not available.", Project.MSG_WARN); + return; + } + AntLoggingHandler antLoggingHandler = new AntLoggingHandler(getProject()); + StatusAndLogListener.getStatusAndLogListener().register(antLoggingHandler); + if (antLoggingHandler != null ) { + if (!antLoggingHandler.getLoggingStarted()) { + log.debug("Starting Logging using 'AntLoggingHandler' first time."); + antLoggingHandler.setLoggingStarted(true); + } else { + log.debug("'AntLoggingHandler' is already started logging."); + } + } else { + log.debug("Could not find the AntLoggingHandler instance."); + } + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/types/Stage.java --- a/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/types/Stage.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/types/Stage.java Wed Jun 16 16:51:40 2010 +0300 @@ -90,7 +90,7 @@ * @param target * @return */ - public boolean isStartTarget ( String target ) { + public boolean isStartTarget( String target ) { return this.startTarget.equals( target ); } @@ -99,7 +99,7 @@ * @param target * @return */ - public boolean isEndTarget ( String target ) { + public boolean isEndTarget( String target ) { return this.endTarget.equals( target ); } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/types/StageLogging.java --- a/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/types/StageLogging.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/types/StageLogging.java Wed Jun 16 16:51:40 2010 +0300 @@ -19,8 +19,6 @@ import java.io.File; 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; /** @@ -53,16 +51,6 @@ private String stageRefId; private Logger log = Logger.getLogger(getClass()); - /** - * Constructor which will register the logging handler - */ - public StageLogging () { - if (!isAntLoggerRegistered && StatusAndLogListener.getStatusAndLogListener() != null) { - log.debug("Registering stage record to the StatusAndLogListener listener"); - StatusAndLogListener.getStatusAndLogListener().register(new AntLoggingHandler(getProject())); - isAntLoggerRegistered = true; - } - } /** * Sets output log file name. diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/types/StageSummary.java --- a/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/types/StageSummary.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/logging/src/com/nokia/helium/logger/ant/types/StageSummary.java Wed Jun 16 16:51:40 2010 +0300 @@ -17,7 +17,7 @@ package com.nokia.helium.logger.ant.types; import java.io.File; - +import org.apache.tools.ant.Project; import org.apache.log4j.Logger; import org.apache.tools.ant.types.DataType; @@ -43,7 +43,9 @@ private File template; private Logger log = Logger.getLogger(getClass()); - public StageSummary () { + public void setProject(Project project) + { + super.setProject(project); if ( !isStageSummaryHandlerRegistered && StatusAndLogListener.getStatusAndLogListener() != null) { log.debug("Registering stage summary to the StatusAndLogListener listener"); StatusAndLogListener.getStatusAndLogListener().register( new StageSummaryHandler() ); @@ -56,7 +58,7 @@ * * @return the template to display build stage summary. */ - public File getTemplate () { + public File getTemplate() { return template; } @@ -67,7 +69,7 @@ * the template to set * @ant.required */ - public void setTemplate ( File template ) { + public void setTemplate( File template ) { this.template = template; } } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/tests/antunit/run-scenario.ant.xml --- a/buildframework/helium/sf/java/logging/tests/antunit/run-scenario.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/logging/tests/antunit/run-scenario.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -20,7 +20,7 @@ ============================================================================ --> - + Helium Antlib logger macro. @@ -36,18 +36,28 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/tests/scenarii/logger/build.xml --- a/buildframework/helium/sf/java/logging/tests/scenarii/logger/build.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/logging/tests/scenarii/logger/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -22,7 +22,8 @@ --> Helium Antlib logger unittests. - + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/tests/scenarii/valid_build/build.xml --- a/buildframework/helium/sf/java/logging/tests/scenarii/valid_build/build.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/logging/tests/scenarii/valid_build/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -63,6 +63,7 @@ + @@ -255,5 +256,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/logging/tests/scenarii/valid_build/prep-ccm-get-input.ant.xml --- a/buildframework/helium/sf/java/logging/tests/scenarii/valid_build/prep-ccm-get-input.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/logging/tests/scenarii/valid_build/prep-ccm-get-input.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -22,7 +22,7 @@ --> Helium Antlib Logging unittests. - + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ORMFMPPLoader.java --- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ORMFMPPLoader.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ORMFMPPLoader.java Wed Jun 16 16:51:40 2010 +0300 @@ -31,8 +31,6 @@ import freemarker.template.SimpleNumber; import freemarker.template.TemplateModelIterator; import com.nokia.helium.jpa.ORMReader; -import com.nokia.helium.jpa.ORMUtil; - import org.apache.log4j.Logger; import freemarker.ext.beans.BeanModel; import freemarker.ext.beans.BeansWrapper; @@ -113,10 +111,10 @@ @Override public void notifyProgressEvent(Engine engine, int event, File src, int pMode, Throwable error, Object param) throws Exception { - if (event == ProgressListener.EVENT_END_PROCESSING_SESSION) { - log.debug("notifyProgressEvent - finalizeORM"); - ORMUtil.finalizeORM(dbPath); - } + //if (event == ProgressListener.EVENT_END_PROCESSING_SESSION) { + // log.debug("notifyProgressEvent - finalizeORM"); + // ORMUtil.finalizeORM(dbPath); + //} } } @@ -144,16 +142,21 @@ //log.debug("QueryTemplateModel: query" + query); if (queryMode.equals("jpasingle")) { //log.debug("query executing with single result mode"); - resultObject = getModel((new ORMReader(dbPath)).executeSingleResult(query, returnType)); + resultObject = getModel(dbPath, query, returnType); + } else { //log.debug("query executing with multiple result mode"); - resultObject = new ORMQueryModel(new ORMReader(dbPath), query, queryMode, returnType); + resultObject = new ORMQueryModel(dbPath, query, queryMode, returnType); } return resultObject; } - private TemplateModel getModel(Object result) { - return new ORMSequenceModel(result); + private TemplateModel getModel(String dbPath, String query, + String returnType) { + ORMReader reader = new ORMReader(dbPath); + ORMSequenceModel model = new ORMSequenceModel(reader.executeSingleResult(query, returnType)); + reader.close(); + return model; } public boolean isEmpty() { @@ -199,8 +202,8 @@ private String query; private String returnType; - public ORMQueryModel (ORMReader reader, String queryString, String type, String retType) { - ormReader = reader; + public ORMQueryModel(String dbPath, String queryString, String type, String retType) { + ormReader = new ORMReader(dbPath); queryType = type; query = queryString; returnType = retType; @@ -275,6 +278,7 @@ } if (rowList == null || rowList.size() == 0) { finished = true; + ormReader.close(); } } } @@ -286,6 +290,5 @@ public ORMObjectModel(Object obj) { super(obj, new BeansWrapper()); } - } } \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/antlib.xml --- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/antlib.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/antlib.xml Wed Jun 16 16:51:40 2010 +0300 @@ -22,18 +22,19 @@ --> - - + + + - + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/conditions/MetaDataLogCondition.java --- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/conditions/MetaDataLogCondition.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/conditions/MetaDataLogCondition.java Wed Jun 16 16:51:40 2010 +0300 @@ -105,14 +105,17 @@ // log file under the DB is always represented with / and not \. String logname = logFile.replace('\\', '/'); String query = "select Count(m.id) from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p where l.path like '%" + logname + "' and UPPER(p.priority)='" + severity.toUpperCase() + "'"; - Number number = (Number) (new ORMReader(fileName.getAbsolutePath())).executeSingleResult(query, null); + ORMReader reader = new ORMReader(fileName.getAbsolutePath()); + Number number = (Number)reader.executeSingleResult(query, null); + int retValue = number.intValue(); // Looking for missing file as error if (countMissing && prty == Metadata.PriorityEnum.ERROR) { String queryMissing = "select Count(m.id) from WhatLogEntry m JOIN m.component as c JOIN c.logFile as l where l.path like '%" + logname + "' and m.missing=1"; - Number numberMissing = (Number) (new ORMReader(fileName.getAbsolutePath())).executeSingleResult(queryMissing, null); - return number.intValue() + numberMissing.intValue(); + Number numberMissing = (Number) reader.executeSingleResult(queryMissing, null); + retValue = number.intValue() + numberMissing.intValue(); } - return number.intValue(); + reader.close(); + return retValue; } /** diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/conditions/MetaDataRegexTestCondition.java --- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/conditions/MetaDataRegexTestCondition.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/conditions/MetaDataRegexTestCondition.java Wed Jun 16 16:51:40 2010 +0300 @@ -93,19 +93,19 @@ * @return true if the string is matched with any of the pattern in the given priority, false otherwise. */ public boolean eval() { - if (this.severity == null || (this.severity != null && this.severity.trim().isEmpty())) - throw new BuildException("'severity' attribute is not defined"); - if (this.string == null || (this.string != null && this.string.isEmpty())) - throw new BuildException("'string' attribute is not defined"); - for (MetaDataFilterSet set : filterSets) { - for (MetaDataFilter filter : set.getAllFilters()) { - Pattern p = filter.getPattern(); - Matcher m = p.matcher(this.string); - if (m.matches()) { - return this.severity.equalsIgnoreCase(filter.getPriority()); - } - } - } - return false; + if (this.severity == null || (this.severity != null && this.severity.trim().isEmpty())) + throw new BuildException("'severity' attribute is not defined"); + if (this.string == null || (this.string != null && this.string.isEmpty())) + throw new BuildException("'string' attribute is not defined"); + for (MetaDataFilterSet set : filterSets) { + for (MetaDataFilter filter : set.getAllFilters()) { + Pattern pattern = filter.getPattern(); + Matcher matcher = pattern.matcher(this.string); + if (matcher.matches()) { + return this.severity.equalsIgnoreCase(filter.getPriority()); + } + } + } + return false; } } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataDelete.java --- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataDelete.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -/* - * 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.Task; -import java.util.Vector; -import java.util.ArrayList; -import java.util.List; -import org.apache.log4j.Logger; -import com.nokia.helium.metadata.db.*; - -/** - * 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 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataDeleteTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataDeleteTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.metadata.ant.taskdefs; + +import org.apache.tools.ant.types.FileSet; + +import org.apache.tools.ant.DirectoryScanner; +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.*; + +/** + * 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 MetaDataDeleteTask extends Task { + + private static Logger log = Logger.getLogger(MetaDataDeleteTask.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 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataLogCount.java --- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataLogCount.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -/* - * 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 java.io.File; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import com.nokia.helium.metadata.ant.conditions.MetaDataLogCondition; - -/** - * This class sets a property to the number of matching severity inside a Metadata db for a log. - * Example: - *
    - *     <hlm:metadataCountSeverity severity="error" log="*_fixslashes_raptor.log" db="${build.log.dir}/metadata.db" property="fixslashes.error"/>
    - * 
    - - * @ant.task name="metadataCountSeverity" category="Metadata" - */ -public class MetaDataLogCount extends Task { - - private File fileName; - private String logFile; - private String severity; - private String property; - private boolean countMissing = true; - - /** - * File to be parsed. - * - * @param filename - * @ant.required - */ - public void setDb(File filename) { - fileName = filename; - } - - public void setLog(String log) { - logFile = log; - } - - /** - * Defines the severity name to be counted. - * - * @param severity - * @ant.required - */ - public void setSeverity(String severity) { - this.severity = severity; - } - - /** - * Name of the property to be set. - * @param property the property name - * @ant.required - */ - public void setProperty(String property) { - this.property = property; - } - - /** - * Should the count of missing files for error severity. - * @param countMissing enable the count of missing files - * for error severity - * @ant.not-required Default is true - */ - public void setCountMissing(boolean countMissing) { - this.countMissing = countMissing; - } - - /** - * Execute the task. Set the property with number of severities. - * @throws BuildException - */ - public void execute() { - if (property == null) - throw new BuildException("'property' attribute is not defined"); - - MetaDataLogCondition cond = new MetaDataLogCondition(); - cond.setDb(fileName); - cond.setLog(logFile); - cond.setSeverity(severity); - cond.setCountMissing(countMissing); - getProject().setNewProperty(property, "" + cond.getSeverity()); - } -} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataLogCountTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataLogCountTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,101 @@ +/* + * 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 java.io.File; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import com.nokia.helium.metadata.ant.conditions.MetaDataLogCondition; + +/** + * This class sets a property to the number of matching severity inside a Metadata db for a log. + * Example: + *
    + *     <hlm:metadataCountSeverity severity="error" log="*_fixslashes_raptor.log" db="${build.log.dir}/metadata.db" property="fixslashes.error"/>
    + * 
    + + * @ant.task name="metadataCountSeverity" category="Metadata" + */ +public class MetaDataLogCountTask extends Task { + + private File fileName; + private String logFile; + private String severity; + private String property; + private boolean countMissing = true; + + /** + * File to be parsed. + * + * @param filename + * @ant.required + */ + public void setDb(File filename) { + fileName = filename; + } + + public void setLog(String log) { + logFile = log; + } + + /** + * Defines the severity name to be counted. + * + * @param severity + * @ant.required + */ + public void setSeverity(String severity) { + this.severity = severity; + } + + /** + * Name of the property to be set. + * @param property the property name + * @ant.required + */ + public void setProperty(String property) { + this.property = property; + } + + /** + * Should the count of missing files for error severity. + * @param countMissing enable the count of missing files + * for error severity + * @ant.not-required Default is true + */ + public void setCountMissing(boolean countMissing) { + this.countMissing = countMissing; + } + + /** + * Execute the task. Set the property with number of severities. + * @throws BuildException + */ + public void execute() { + if (property == null) + throw new BuildException("'property' attribute is not defined"); + + MetaDataLogCondition cond = new MetaDataLogCondition(); + cond.setDb(fileName); + cond.setLog(logFile); + cond.setSeverity(severity); + cond.setCountMissing(countMissing); + getProject().setNewProperty(property, "" + cond.getSeverity()); + } +} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataRecord.java --- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataRecord.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -/* - * 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 com.nokia.helium.metadata.CustomMetaDataProvider; -import com.nokia.helium.metadata.MetaDataInput; -import com.nokia.helium.jpa.entity.metadata.Metadata; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import java.util.Vector; -import java.util.Iterator; -import org.apache.log4j.Logger; -import com.nokia.helium.metadata.db.*; -import java.util.Date; - -/** - * This task provide a way to record the data in the Database. - * - *
    - * Example 1:
    - * <metadatarecord database="compile_log.db">
    - *     <sbsmetadatainput>
    - *     <fileset casesensitive="false" file="sbs.log.file"/>
    - *         <metadatafiltelistref refid="compilation"/>
    - *     </sbsmetadatainput>
    - * </metadatarecord>
    - * 
    - * Example 2:
    - * 
    - * <metadatarecord database="metadata.db">
    - *     <antmetadatainput>
    - *     <fileset casesensitive="false" file="${build.id}_ant_build.log"/>
    - *         <metadatafiltelistref refid="compilation"/>
    - *     </antmetadatainput>
    - * </metadatarecord>
    -
    - * 
    - * - * @ant.task name="metadatarecord" category="Metadata" - */ -public class MetaDataRecord extends Task { - - private static Logger log = Logger.getLogger(MetaDataRecord.class); - - private String database; - - private boolean failOnError = true; - - private Vector metadataList = 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; - } - } - /** - * Helper function to get the database - * - */ - public String getDatabase() { - return database; - } - - /** - * Helper function to return the metadatalist - * @return build metadata object - * - */ - public Vector getMetaDataList() throws Exception { - if (metadataList.isEmpty()) { - throw new Exception("metadata list is empty"); - } - return metadataList; - } - - /** - * Helper function to add the metadatalist - * @param build metadata list to add - * - */ - public void add(MetaDataInput interf) { - metadataList.add(interf); - } - - - @Override - public void execute() { - ORMMetadataDB ormDB = null; - try { - log.debug("Getting Contents to write to db: " + database); - log.debug("Initializing DB: " + database); - log.debug("initializing ORM db"); - ormDB = new ORMMetadataDB(database); - log.debug("Parsing the input and writing to DB"); - Date before = new Date(); - log("Time before recording to db: " + before); - for (MetaDataInput metadataInput : metadataList) { - boolean removed = false; - String logPath = null; - Iterator inputIterator = metadataInput.iterator(); - while (inputIterator.hasNext()) { - Metadata.LogEntry logEntry = inputIterator.next(); - if (!removed) { - logPath = logEntry.getLogPath(); - ormDB.removeEntries(logPath); - removed = true; - } - //initializes the metadata if none exists - ormDB.addLogEntry(logEntry); - } - if (logPath != null && metadataInput instanceof CustomMetaDataProvider) { - CustomMetaDataProvider provider = (CustomMetaDataProvider)metadataInput; - provider.provide(ormDB, logPath); - } - if (logPath != null) { - ormDB.finalizeMetadata(logPath); - } - } - Date after = new Date(); - log("Time after recording to db: " + after); - log("Elapsed time: " + (after.getTime() - before.getTime()) + " ms"); - log.debug("Successfully writen to DB"); - } catch (BuildException ex1) { - log.debug("BuildException during writing to db: ", ex1); - if (failOnError) { - throw ex1; - } - } finally { - if (ormDB != null) { - ormDB.finalizeDB(); - } - } - } -} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataRecordTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataRecordTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,177 @@ +/* + * 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 com.nokia.helium.metadata.CustomMetaDataProvider; +import com.nokia.helium.metadata.MetaDataInput; +import com.nokia.helium.jpa.entity.metadata.Metadata; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import java.util.Vector; +import java.util.Iterator; +import org.apache.log4j.Logger; +import com.nokia.helium.metadata.db.*; +import java.util.Date; + +/** + * This task provide a way to record the data in the Database. + * + *
    + * Example 1:
    + * <metadatarecord database="compile_log.db">
    + *     <sbsmetadatainput>
    + *     <fileset casesensitive="false" file="sbs.log.file"/>
    + *         <metadatafiltelistref refid="compilation"/>
    + *     </sbsmetadatainput>
    + * </metadatarecord>
    + * 
    + * Example 2:
    + * 
    + * <metadatarecord database="metadata.db">
    + *     <antmetadatainput>
    + *     <fileset casesensitive="false" file="${build.id}_ant_build.log"/>
    + *         <metadatafiltelistref refid="compilation"/>
    + *     </antmetadatainput>
    + * </metadatarecord>
    +
    + * 
    + * + * @ant.task name="metadatarecord" category="Metadata" + */ +public class MetaDataRecordTask extends Task { + + private static Logger log = Logger.getLogger(MetaDataRecordTask.class); + + private String database; + + private boolean failOnError = true; + + private Vector metadataList = 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; + } + } + /** + * Helper function to get the database + * + */ + public String getDatabase() { + return database; + } + + /** + * Helper function to return the metadatalist + * @return build metadata object + * + */ + public Vector getMetaDataList() throws Exception { + if (metadataList.isEmpty()) { + throw new Exception("metadata list is empty"); + } + return metadataList; + } + + /** + * Helper function to add the metadatalist + * @param build metadata list to add + * + */ + public void add(MetaDataInput interf) { + metadataList.add(interf); + } + + + @Override + public void execute() { + ORMMetadataDB ormDB = null; + try { + log.debug("Getting Contents to write to db: " + database); + log.debug("Initializing DB: " + database); + log.debug("initializing ORM db"); + ormDB = new ORMMetadataDB(database); + log.debug("Parsing the input and writing to DB"); + Date before = new Date(); + log("Time before recording to db: " + before); + for (MetaDataInput metadataInput : metadataList) { + boolean removed = false; + String logPath = null; + String currentLogPath = null; + Iterator inputIterator = metadataInput.iterator(); + while (inputIterator.hasNext()) { + //Todo: better way of log handling, with metadatainput + // metadata initialization for each logfile within + //metadatainput itself would be better. this is temporary. + Metadata.LogEntry logEntry = inputIterator.next(); + logPath = logEntry.getLogPath(); + if (currentLogPath == null) { + currentLogPath = logPath; + removed = false; + } else if (!currentLogPath.equals(logPath)) { + finalizeForLogPath(currentLogPath, metadataInput, ormDB); + currentLogPath = logPath; + removed = false; + } + if (!removed ) { + log.debug("processing for log: " + logPath); + ormDB.removeEntries(logPath); + removed = true; + } + //initializes the metadata if none exists + ormDB.addLogEntry(logEntry); + } + finalizeForLogPath(currentLogPath, metadataInput, ormDB); + } + Date after = new Date(); + log("Time after recording to db: " + after); + log("Elapsed time: " + (after.getTime() - before.getTime()) + " ms"); + log.debug("Successfully writen to DB"); + } catch (BuildException ex1) { + log.debug("BuildException during writing to db: ", ex1); + if (failOnError) { + throw ex1; + } + } finally { + if (ormDB != null) { + ormDB.finalizeDB(); + } + } + } + + private void finalizeForLogPath(String currentLogPath, + MetaDataInput metadataInput, ORMMetadataDB ormDB) { + if (currentLogPath != null) { + if (metadataInput instanceof CustomMetaDataProvider) { + CustomMetaDataProvider provider = + (CustomMetaDataProvider)metadataInput; + provider.provide(ormDB, currentLogPath); + } + ormDB.finalizeMetadata(currentLogPath); + } + } +} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/AbldLogMetaDataInput.java --- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/AbldLogMetaDataInput.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/AbldLogMetaDataInput.java Wed Jun 16 16:51:40 2010 +0300 @@ -133,28 +133,28 @@ setCurrentReader(currentReader); } catch (FileNotFoundException ex) { log.debug("FileNotFoundException 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; + 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; } catch (IOException ex) { log.debug("IOException in AbldLogMetadata", ex); - try { - currentReader.close(); - } catch ( IOException iex) { + try { + currentReader.close(); + } catch ( IOException iex) { // We are Ignoring the errors as no need to fail the build. log.debug("IOException in closing reader", iex); - } - currentReader = null; - setCurrentReader(null); - exceptions = exceptions + ex.getMessage() + "\n"; - return false; + } + currentReader = null; + setCurrentReader(null); + exceptions = exceptions + ex.getMessage() + "\n"; + return false; } if (!exceptions.equals("")) { throw new BuildException(exceptions); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/IMakerLogMetaDataInput.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/IMakerLogMetaDataInput.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,215 @@ +/* + * 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.types; + +import java.io.*; +import org.apache.tools.ant.BuildException; +import java.util.*; + +import org.apache.log4j.Logger; +import java.util.regex.Pattern; +import java.util.regex.Matcher; + +/** + * This Type is to specify and use the abld logparser type to parse and store + * the data. + * + *
    + * <hlm:metadatafilterset id="abld.metadata.filter">
    + *    <metadatafilterset filterfile="common.csv" />
    + * </hlm:metadatafilterset>
    + * 
    + * <hlm:imakermetadatainput>
    + *    <fileset dir="${project.dir}/../data/">
    + *        <include name="*_compile*.log"/>
    + *    </fileset>
    + *    <metadatafilterset refid="abld.metadata.filter" />
    + * </hlm:imakermetadatainput>
    + * 
    + * + * @ant.task name="imakermetadatainput" category="Metadata" + */ +public class IMakerLogMetaDataInput extends TextLogMetaDataInput { + + /** Internal data storage. */ + private class Entry { + + private String fileName; + private int lineNumber; + private String text; + private String severity; + + public Entry(String fileName, int lineNumber, String text, String severity) { + super(); + this.text = text; + this.lineNumber = lineNumber; + this.fileName = fileName; + this.severity = severity; + } + + public String getText() { + return text; + } + + public int getLineNumber() { + return lineNumber; + } + + public String getFileName() { + return fileName; + } + + public String getSeverity() { + return severity; + } + + } + + private Logger log = Logger.getLogger(AbldLogMetaDataInput.class); + + private Pattern iMakerFpsxPattern = Pattern.compile("/([^/]*?\\.fpsx)"); + + private String currentComponent; + + private boolean entryCreated; + + private boolean isRecordingIssues; + + public IMakerLogMetaDataInput() { + } + + /** + * 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 = ""; + entryCreated = false; + int lineNumber = getLineNumber(); + BufferedReader currentReader = getCurrentReader(); + log.debug("Getting next set of log entries for iMaker input"); + try { + if (currentReader == null) { + lineNumber = 0; + setLineNumber(lineNumber); + log.debug("Processing iMaker log file name: " + currentFile); + currentReader = new BufferedReader(new FileReader(currentFile)); + setCurrentReader(currentReader); + } + + List entriesCache = new ArrayList(); + String logText = null; + while ((logText = currentReader.readLine()) != null) { + lineNumber++; + setLineNumber(lineNumber); + + // Remove Ant task comment text, e.g. "[imaker]" + logText = logText.replaceFirst("'^\\s*\\[.+?\\]\\s*", ""); + // log.debug("Parsing log line: " + logText); + + // See if the line should be captured + if (isRecordingIssues) { + // Check for a line with an issue + String severity = getSeverity(logText); + if (severity != null) { + Entry entry = new Entry(currentFile.toString(), lineNumber, logText, severity); + entriesCache.add(entry); + } + + // Check if the iMaker FPSX image name is on this line, to + // get the component + if (currentComponent == null) { + Matcher componentMatch = iMakerFpsxPattern.matcher(logText); + if (componentMatch.find()) { + currentComponent = componentMatch.group(1); + log.debug("Matched component: " + currentComponent); + } + } + + // See if the component log block has ended + if (logText.startsWith("++ Finished at")) { + // Add all cached issues + if (currentComponent != null && entriesCache.size() > 0) { + for (int i = 0; i < entriesCache.size(); i++) { + Entry entry = entriesCache.get(i); + addEntry(entry.getSeverity(), currentComponent, entry.getFileName(), entry.getLineNumber(), entry.getText()); + } + entryCreated = true; + currentComponent = null; + return true; + } + // Or add a default entry to record the logfile + else { + addEntry("DEFAULT", currentComponent, currentFile.toString(), lineNumber, ""); + entryCreated = true; + currentComponent = null; + return true; + } + } + } + else { + // Check for the start of a block + if (logText.startsWith("++ Started at")) { + isRecordingIssues = true; + } + } + } + currentReader.close(); + currentReader = null; + setCurrentReader(currentReader); + } + catch (FileNotFoundException ex) { + log.debug("FileNotFoundException in AbldLogMetadata", ex); + try { + if (currentReader != null) { + 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; + } + catch (IOException ex) { + log.debug("IOException in AbldLogMetadata", ex); + try { + if (currentReader != null) { + currentReader.close(); + } + } + catch (IOException iex) { + // We are Ignoring the errors as no need to fail the build. + log.debug("IOException in closing reader", iex); + } + currentReader = null; + setCurrentReader(null); + exceptions = exceptions + ex.getMessage() + "\n"; + return false; + } + if (!exceptions.equals("")) { + throw new BuildException(exceptions); + } + return entryCreated; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/LogMetaDataInput.java --- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/LogMetaDataInput.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/LogMetaDataInput.java Wed Jun 16 16:51:40 2010 +0300 @@ -147,29 +147,29 @@ */ boolean isEntryAvailable() { - int fileListSize = getFileList().size(); - while (currentFileIndex < fileListSize) { - boolean entryCreated = false; - File currentFile = getCurrentFile(); - entryCreated = isEntryCreated(currentFile); - if (entryCreated) { - if (!entryAddedForLog) { - entryAddedForLog = true; - } - return entryCreated; - } + int fileListSize = getFileList().size(); + while (currentFileIndex < fileListSize) { + boolean entryCreated = false; + File currentFile = getCurrentFile(); + entryCreated = isEntryCreated(currentFile); + if (entryCreated) { if (!entryAddedForLog) { - // If no entry, then logfile is added to the database. - addEntry("default", "general", - getCurrentFile().toString(), -1, "", -1, null); entryAddedForLog = true; - return true; } - if (isAdditionalEntry()) { - return true; - } - currentFileIndex ++; + return entryCreated; } + if (!entryAddedForLog) { + // If no entry, then logfile is added to the database. + addEntry("default", "general", + getCurrentFile().toString(), -1, "", -1, null); + entryAddedForLog = true; + return true; + } + if (isAdditionalEntry()) { + return true; + } + currentFileIndex ++; + } return false; } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/MetaDataFilterSet.java --- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/MetaDataFilterSet.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/MetaDataFilterSet.java Wed Jun 16 16:51:40 2010 +0300 @@ -97,7 +97,7 @@ return allFilters; } log.debug("Filterset object is not instance of MetaDataFilterSet"); - throw new BuildException ("Filterset object is not instance of MetaDataFilterSet"); + throw new BuildException("Filterset object is not instance of MetaDataFilterSet"); } // Add any nested filtersets for (MetaDataFilterSet filterSet : filterSets) { @@ -188,22 +188,22 @@ throw iex; } int size = 0; - log.debug("filter CSV record size: " + csvs.size()); - size = csvs.size(); - for (int i = 0; i < size; i++) { - TemplateSequenceModel model = (TemplateSequenceModel) csvs - .get(i); - int modelSize = model.size(); - if (modelSize != 3 ) { - log.debug("Metadata CSV file filter file format is invalid. It has row size " + size); - throw new Exception("Metadata CSV file filter file format is invalid. It has row size " + size); - } - MetaDataFilter filter = new MetaDataFilter(); - filter.setPriority(model.get(0).toString()); - filter.setRegex(model.get(1).toString()); - filter.setDescription(model.get(2).toString()); - filters.add(filter); + log.debug("filter CSV record size: " + csvs.size()); + size = csvs.size(); + for (int i = 0; i < size; i++) { + TemplateSequenceModel model = (TemplateSequenceModel) csvs + .get(i); + int modelSize = model.size(); + if (modelSize != 3 ) { + log.debug("Metadata CSV file filter file format is invalid. It has row size " + size); + throw new Exception("Metadata CSV file filter file format is invalid. It has row size " + size); } + MetaDataFilter filter = new MetaDataFilter(); + filter.setPriority(model.get(0).toString()); + filter.setRegex(model.get(1).toString()); + filter.setDescription(model.get(2).toString()); + filters.add(filter); + } } } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/PolicyLogMetaDataInput.java --- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/PolicyLogMetaDataInput.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/PolicyLogMetaDataInput.java Wed Jun 16 16:51:40 2010 +0300 @@ -77,7 +77,7 @@ * @param streamReader: the input stream reader which contains the xml data to be parsed for recording data. * @return true if there are any element to be added to the database. */ - boolean startElement (XMLStreamReader streamReader) { + boolean startElement(XMLStreamReader streamReader) { String tagName = streamReader.getLocalName(); if (tagName.equalsIgnoreCase("error")) { currentAttributeMap = getAttributes(streamReader); @@ -92,33 +92,33 @@ */ boolean endElement(XMLStreamReader streamReader) { boolean retValue = false; - String tagName = streamReader.getLocalName(); - String priority = "ERROR"; - log.debug("endElement: " + tagName); - if (tagName.equalsIgnoreCase("error")) { - log.debug("tagName matches error"); - String errorType = currentAttributeMap.get("type"); - log.debug("errorType:" + errorType); - if (errorType.equals("unknownstatus")) { - addEntry(priority, "CSV validation", getCurrentFile().toString(), -1, currentAttributeMap.get("message") + - currentAttributeMap.get("value")); - retValue = true; - } else if (errorType.equals("A") || errorType.equals("B") - || errorType.equals("C") || errorType.equals("D")) { - int flags = Pattern.CASE_INSENSITIVE | Pattern.DOTALL ; - Pattern pattern = Pattern.compile("([\\\\/][^\\\\/]+?)$", flags); - addEntry(priority, "Issues", getCurrentFile().toString(), -1, - errorType + "Found incorrect value for" + - pattern.matcher(currentAttributeMap.get("message")).replaceAll("")); - retValue = true; - } else if (errorType.equals("missing")) { - addEntry(priority, "Missing", getCurrentFile().toString(), -1, currentAttributeMap.get("message")); - retValue = true; - } else if (errorType.equals("invalidencoding")) { - addEntry(priority, "Incorrect policy files", getCurrentFile().toString(), -1, currentAttributeMap.get("message")); - retValue = true; - } + String tagName = streamReader.getLocalName(); + String priority = "ERROR"; + log.debug("endElement: " + tagName); + if (tagName.equalsIgnoreCase("error")) { + log.debug("tagName matches error"); + String errorType = currentAttributeMap.get("type"); + log.debug("errorType:" + errorType); + if (errorType.equals("unknownstatus")) { + addEntry(priority, "CSV validation", getCurrentFile().toString(), -1, currentAttributeMap.get("message") + + currentAttributeMap.get("value")); + retValue = true; + } else if (errorType.equals("A") || errorType.equals("B") + || errorType.equals("C") || errorType.equals("D")) { + int flags = Pattern.CASE_INSENSITIVE | Pattern.DOTALL ; + Pattern pattern = Pattern.compile("([\\\\/][^\\\\/]+?)$", flags); + addEntry(priority, "Issues", getCurrentFile().toString(), -1, + errorType + "Found incorrect value for" + + pattern.matcher(currentAttributeMap.get("message")).replaceAll("")); + retValue = true; + } else if (errorType.equals("missing")) { + addEntry(priority, "Missing", getCurrentFile().toString(), -1, currentAttributeMap.get("message")); + retValue = true; + } else if (errorType.equals("invalidencoding")) { + addEntry(priority, "Incorrect policy files", getCurrentFile().toString(), -1, currentAttributeMap.get("message")); + retValue = true; } + } return retValue; } @@ -126,7 +126,7 @@ * @param streamReader: the input stream reader which contains the xml data to be parsed for recording data. * @return true if there are any element to be added to the database. */ - boolean characters (XMLStreamReader streamReader) { + boolean characters(XMLStreamReader streamReader) { return false; } } \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/SBSLogMetaDataInput.java --- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/SBSLogMetaDataInput.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/SBSLogMetaDataInput.java Wed Jun 16 16:51:40 2010 +0300 @@ -159,7 +159,7 @@ */ @Deprecated public void setCleanLogFile(File logFile) { - log("The usage of the cleanLogFile is deprecated."); + log("The usage of the cleanLogFile is deprecated."); } /** @@ -217,7 +217,7 @@ toProcess.put(text.trim(), streamReader.getLocation().getLineNumber() + i); } i++; - } + } boolean entryCreated = false; //Check for any general errors. for (String textString : toProcess.keySet()) { @@ -238,64 +238,64 @@ * @return true if there are any element to be added to the database. */ public boolean startElement (XMLStreamReader streamReader) { - String tagName = streamReader.getLocalName(); - if (tagName.equalsIgnoreCase("buildlog")) { - logger.debug("starting with buildlog"); - inMainDataSection = true; + String tagName = streamReader.getLocalName(); + if (tagName.equalsIgnoreCase("buildlog")) { + logger.debug("starting with buildlog"); + inMainDataSection = true; + } + if (tagName.equalsIgnoreCase("recipe") ) { + lineNumber = streamReader.getLocation().getLineNumber(); + currentComponent = getComponent(streamReader); + recordText = true; + inMainDataSection = false; + recipeStatus = "ok"; + } if (tagName.equalsIgnoreCase("status") ) { + String exit = streamReader.getAttributeValue(null, "exit"); + recipeStatus = (exit != null) ? exit : "ok"; + } else if (tagName.equalsIgnoreCase("error") + || tagName.equalsIgnoreCase("warning")) { + lineNumber = streamReader.getLocation().getLineNumber(); + currentComponent = getComponent(streamReader); + recordText = true; + inMainDataSection = false; + } else if (tagName.equalsIgnoreCase("whatlog")) { + members.clear(); + currentComponent = getComponent(streamReader); + inMainDataSection = false; + inWhatLogSection = true; + } else if (inWhatLogSection && tagName.equals("export")) { + String text = SBSLogMetaDataInput.getAttribute("destination", streamReader); + if (text != null && text.trim().length() > 0) { + String member = SBSLogMetaDataInput.removeDriveAndBldInf(text); + boolean exists = (new File(text)).exists(); + Metadata.WhatLogMember entry = new Metadata.WhatLogMember(member, exists); + members.add(entry); } - if (tagName.equalsIgnoreCase("recipe") ) { - lineNumber = streamReader.getLocation().getLineNumber(); - currentComponent = getComponent(streamReader); - recordText = true; - inMainDataSection = false; - recipeStatus = "ok"; - } if (tagName.equalsIgnoreCase("status") ) { - String exit = streamReader.getAttributeValue(null, "exit"); - recipeStatus = (exit != null) ? exit : "ok"; - } else if (tagName.equalsIgnoreCase("error") - || tagName.equalsIgnoreCase("warning")) { - lineNumber = streamReader.getLocation().getLineNumber(); - currentComponent = getComponent(streamReader); - recordText = true; - inMainDataSection = false; - } else if (tagName.equalsIgnoreCase("whatlog")) { - members.clear(); - currentComponent = getComponent(streamReader); - inMainDataSection = false; - inWhatLogSection = true; - } else if (inWhatLogSection && tagName.equals("export")) { - String text = SBSLogMetaDataInput.getAttribute("destination", streamReader); - if (text != null && text.trim().length() > 0) { - String member = SBSLogMetaDataInput.removeDriveAndBldInf(text); - boolean exists = (new File(text)).exists(); - Metadata.WhatLogMember entry = new Metadata.WhatLogMember(member, exists); - members.add(entry); + } else if (inWhatLogSection && !tagName.equals("export")) { + logTextInfo = ""; + recordText = true; + } else if (tagName.equalsIgnoreCase("time")) { + inMainDataSection = false; + currentElapsedTime = Float.valueOf(getAttribute("elapsed", streamReader)).floatValue(); + logger.debug("currentElapsedTime: " + currentElapsedTime); + if (currentComponent != null) { + TimeEntry timeObject = componentTimeMap.get(currentComponent); + logger.debug("currentComponent:" + currentComponent); + if (timeObject == null) { + timeObject = new TimeEntry(currentElapsedTime, getCurrentFile().toString()); + componentTimeMap.put(currentComponent, timeObject); + logger.debug("creating to new time object"); + } else { + timeObject.addElapsedTime(currentElapsedTime); + logger.debug("adding it to existing time object"); } - } else if (inWhatLogSection && !tagName.equals("export")) { - logTextInfo = ""; - recordText = true; - } else if (tagName.equalsIgnoreCase("time")) { - inMainDataSection = false; - currentElapsedTime = Float.valueOf(getAttribute("elapsed", streamReader)).floatValue(); - logger.debug("currentElapsedTime: " + currentElapsedTime); - if (currentComponent != null) { - TimeEntry timeObject = componentTimeMap.get(currentComponent); - logger.debug("currentComponent:" + currentComponent); - if (timeObject == null) { - timeObject = new TimeEntry(currentElapsedTime, getCurrentFile().toString()); - componentTimeMap.put(currentComponent, timeObject); - logger.debug("creating to new time object"); - } else { - timeObject.addElapsedTime(currentElapsedTime); - logger.debug("adding it to existing time object"); - } - } - } else if (tagName.equalsIgnoreCase("clean")) { - inMainDataSection = false; - } else if (tagName.equalsIgnoreCase("info")) { - inMainDataSection = false; - recordText = true; } + } else if (tagName.equalsIgnoreCase("clean")) { + inMainDataSection = false; + } else if (tagName.equalsIgnoreCase("info")) { + inMainDataSection = false; + recordText = true; + } return false; } @@ -306,40 +306,40 @@ * @return true if there are any element to be added to the database. */ public boolean isAdditionalEntry() { - if (!componentTimeMap.isEmpty()) { - Set componentSet = componentTimeMap.keySet(); - for (String component : componentSet) { - - TimeEntry entry = componentTimeMap.get(component); - addEntry("default", component, entry.getFilePath(), -1, - null, entry.getElapsedTime(), null); - componentTimeMap.remove(component); - return true; + if (!componentTimeMap.isEmpty()) { + Set componentSet = componentTimeMap.keySet(); + for (String component : componentSet) { + + TimeEntry entry = componentTimeMap.get(component); + addEntry("default", component, entry.getFilePath(), -1, + null, entry.getElapsedTime(), null); + componentTimeMap.remove(component); + return true; + } + } + if (!categorizationCompleted) { + if (cleanLogFile != null) { + if (categorizationHandler == null ) { + logger.debug("initializing categorization handler"); + categorizationHandler = + new CategorizationHandler(cleanLogFile, generalTextEntries); } } - if (!categorizationCompleted) { - if (cleanLogFile != null) { - if (categorizationHandler == null ) { - logger.debug("initializing categorization handler"); - categorizationHandler = - new CategorizationHandler(cleanLogFile, generalTextEntries); + if (categorizationHandler != null && categorizationHandler.hasNext()) { + try { + CategoryEntry entry = categorizationHandler.getNext(); + if (entry != null) { + addEntry(entry.getSeverity(), entry.getCategory(), entry.getLogFile(), + entry.getLineNumber(), entry.getText()); + return true; } + } catch (XMLStreamException ex) { + logger.debug("Exception during categorization handler", ex); + return false; } - if (categorizationHandler != null && categorizationHandler.hasNext()) { - try { - CategoryEntry entry = categorizationHandler.getNext(); - if (entry != null) { - addEntry(entry.getSeverity(), entry.getCategory(), entry.getLogFile(), - entry.getLineNumber(), entry.getText()); - return true; - } - } catch (XMLStreamException ex) { - logger.debug("Exception during categorization handler", ex); - return false; - } - } - categorizationCompleted = true; } + categorizationCompleted = true; + } return false; } @@ -349,68 +349,68 @@ * @return true if there are any element to be added to the database. */ public boolean endElement(XMLStreamReader streamReader) { - String tagName = streamReader.getLocalName(); - if (tagName.equalsIgnoreCase("recipe")) { - inMainDataSection = true; - recordText = false; - if (logTextInfo != null) { - if (currentComponent == null) { - currentComponent = "general"; - } - Statistics stat = new Statistics(); - boolean entryCreated = findAndAddEntries(logTextInfo, currentComponent, - getCurrentFile().toString(), lineNumber, stat); - if (stat.getSeveriry("error") == 0 && recipeStatus.equals("failed")) { - addEntry("error", currentComponent, getCurrentFile().toString(), - lineNumber, FAILED_STATUS_MESSAGE); - entryCreated = true; - } - logTextInfo = ""; - recipeStatus = "ok"; - return entryCreated; - } - } else if (tagName.equalsIgnoreCase("error") - || tagName.equalsIgnoreCase("warning")) { - inMainDataSection = true; - recordText = false; + String tagName = streamReader.getLocalName(); + if (tagName.equalsIgnoreCase("recipe")) { + inMainDataSection = true; + recordText = false; + if (logTextInfo != null) { if (currentComponent == null) { currentComponent = "general"; } - addEntry(tagName, currentComponent, getCurrentFile().toString(), lineNumber, - logTextInfo); - logTextInfo = ""; - return true; - } else if (tagName.equalsIgnoreCase("whatlog") ) { - inWhatLogSection = false; - inMainDataSection = true; - recordText = false; - logTextInfo = ""; - addEntry("default", currentComponent, getCurrentFile().toString(), - streamReader.getLocation().getLineNumber(), "what log info", -1, new Metadata.WhatEntry(currentComponent, members)); - return true; - } else if (inWhatLogSection && !tagName.equalsIgnoreCase("export") && !tagName.equalsIgnoreCase("whatlog")) { - if (logTextInfo.trim().length() > 0) { - String member = SBSLogMetaDataInput.removeDriveAndBldInf(logTextInfo.trim()); - boolean exists = (new File(logTextInfo.trim())).exists(); - Metadata.WhatLogMember entry = new Metadata.WhatLogMember(member, exists); - members.add(entry); + Statistics stat = new Statistics(); + boolean entryCreated = findAndAddEntries(logTextInfo, currentComponent, + getCurrentFile().toString(), lineNumber, stat); + if (stat.getSeveriry("error") == 0 && recipeStatus.equals("failed")) { + addEntry("error", currentComponent, getCurrentFile().toString(), + lineNumber, FAILED_STATUS_MESSAGE); + entryCreated = true; } logTextInfo = ""; - recordText = false; - } else if (tagName.equalsIgnoreCase("clean")) { - inMainDataSection = true; - } else if (tagName.equalsIgnoreCase("info")) { - inMainDataSection = true; - recordText = false; - if (logTextInfo != null) { - Matcher m = buildTimeMatcher.matcher(logTextInfo); - if (m.matches()) { - buildTime = Integer.parseInt(m.group(1)); - logger.info("Run time: " + buildTime); - } + recipeStatus = "ok"; + return entryCreated; + } + } else if (tagName.equalsIgnoreCase("error") + || tagName.equalsIgnoreCase("warning")) { + inMainDataSection = true; + recordText = false; + if (currentComponent == null) { + currentComponent = "general"; + } + addEntry(tagName, currentComponent, getCurrentFile().toString(), lineNumber, + logTextInfo); + logTextInfo = ""; + return true; + } else if (tagName.equalsIgnoreCase("whatlog") ) { + inWhatLogSection = false; + inMainDataSection = true; + recordText = false; + logTextInfo = ""; + addEntry("default", currentComponent, getCurrentFile().toString(), + streamReader.getLocation().getLineNumber(), "what log info", -1, new Metadata.WhatEntry(currentComponent, members)); + return true; + } else if (inWhatLogSection && !tagName.equalsIgnoreCase("export") && !tagName.equalsIgnoreCase("whatlog")) { + if (logTextInfo.trim().length() > 0) { + String member = SBSLogMetaDataInput.removeDriveAndBldInf(logTextInfo.trim()); + boolean exists = (new File(logTextInfo.trim())).exists(); + Metadata.WhatLogMember entry = new Metadata.WhatLogMember(member, exists); + members.add(entry); + } + logTextInfo = ""; + recordText = false; + } else if (tagName.equalsIgnoreCase("clean")) { + inMainDataSection = true; + } else if (tagName.equalsIgnoreCase("info")) { + inMainDataSection = true; + recordText = false; + if (logTextInfo != null) { + Matcher matcher = buildTimeMatcher.matcher(logTextInfo); + if (matcher.matches()) { + buildTime = Integer.parseInt(matcher.group(1)); + logger.info("Run time: " + buildTime); } - logTextInfo = ""; } + logTextInfo = ""; + } return false; } @@ -725,27 +725,27 @@ while (xmlStreamReader.hasNext()) { int eventType = xmlStreamReader.next(); switch (eventType) { - case XMLEvent.START_ELEMENT: - startElement(xmlStreamReader); - break; - case XMLEvent.END_ELEMENT: - endElement(xmlStreamReader); - break; - case XMLEvent.CHARACTERS: - String path = characters(xmlStreamReader); - if (path != null ) { - currentList = getEntry(path); - if (currentList != null && !currentList.isEmpty()) { - if (currentComponent != null) { - updateCategoryEntries(currentList, currentComponent); - CategoryEntry entry = (CategoryEntry)currentList.remove(0); - return entry; + case XMLEvent.START_ELEMENT: + startElement(xmlStreamReader); + break; + case XMLEvent.END_ELEMENT: + endElement(xmlStreamReader); + break; + case XMLEvent.CHARACTERS: + String path = characters(xmlStreamReader); + if (path != null ) { + currentList = getEntry(path); + if (currentList != null && !currentList.isEmpty()) { + if (currentComponent != null) { + updateCategoryEntries(currentList, currentComponent); + CategoryEntry entry = (CategoryEntry)currentList.remove(0); + return entry; + } } } - } - break; - default: - break; + break; + default: + break; } } if (xmlStreamReader != null) { diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/XMLLogMetaDataInput.java --- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/XMLLogMetaDataInput.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/XMLLogMetaDataInput.java Wed Jun 16 16:51:40 2010 +0300 @@ -46,11 +46,11 @@ * Constructor */ public XMLLogMetaDataInput() { - inParsing = true; - xmlInputFactory = XMLInputFactory.newInstance(); - xmlInputFactory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES,Boolean.TRUE); - xmlInputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES,Boolean.FALSE); - xmlInputFactory.setProperty(XMLInputFactory.IS_COALESCING , Boolean.TRUE); + inParsing = true; + xmlInputFactory = XMLInputFactory.newInstance(); + xmlInputFactory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES,Boolean.TRUE); + xmlInputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES,Boolean.FALSE); + xmlInputFactory.setProperty(XMLInputFactory.IS_COALESCING , Boolean.TRUE); } @@ -88,17 +88,17 @@ while (xmlStreamReader.hasNext()) { eventType = xmlStreamReader.next(); switch (eventType) { - case XMLEvent.START_ELEMENT: - entryCreated = startElement(xmlStreamReader); - break; - case XMLEvent.END_ELEMENT: - entryCreated = endElement(xmlStreamReader); - break; - case XMLEvent.CHARACTERS: - entryCreated = characters(xmlStreamReader); - break; - default: - break; + case XMLEvent.START_ELEMENT: + entryCreated = startElement(xmlStreamReader); + break; + case XMLEvent.END_ELEMENT: + entryCreated = endElement(xmlStreamReader); + break; + case XMLEvent.CHARACTERS: + entryCreated = characters(xmlStreamReader); + break; + default: + break; } if ( entryCreated) { return true; @@ -115,7 +115,7 @@ log.debug("FileNotFoundException in isEntryCreated" + ex); // CheckStyle:IllegalCatch OFF } catch (RuntimeException ex) { //have to catch this otherwise it crashes other parts of the code - throw new BuildException ("Failed during writing data to db: ", ex); + throw new BuildException("Failed during writing data to db: ", ex); } // CheckStyle:IllegalCatch ON return false; @@ -127,7 +127,7 @@ * @param streamReader: the input stream reader which contains the xml data to be parsed for recording data. * @return true if there are any element to be added to the database. */ - abstract boolean startElement (XMLStreamReader streamReader) ; + abstract boolean startElement(XMLStreamReader streamReader) ; /** * Function implemented by the subclasses to process the end event of xml stream callback. @@ -141,5 +141,5 @@ * @param streamReader: the input stream reader which contains the xml data to be parsed for recording data. * @return true if there are any element to be added to the database. */ - abstract boolean characters (XMLStreamReader streamReader); + abstract boolean characters(XMLStreamReader streamReader); } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/db/ORMMetadataDB.java --- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/db/ORMMetadataDB.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/db/ORMMetadataDB.java Wed Jun 16 16:51:40 2010 +0300 @@ -58,7 +58,7 @@ } public void finalizeMetadata(String logPath) { - MetadataUtil.finalizeMetadata(logPath); + MetadataUtil.finalizeMetadata(dbPath, logPath); } public void finalizeDB() { diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/tests/antunit/test_metadata.ant.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/metadata/tests/antunit/test_metadata.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,146 @@ + + + + Helium antlib metadata tests. + + + + + + + + + + + + + + + + + + + + + + + + + macro: ${basedir}/../src/templates + + + templatedir: "${basedir}/src/templates" + template: "components_status.xml.ftl" + dbPath: "tests/metadata_db" + countOnly: "true" + tableName: "out" + queryString: "where priority='WARNING' or priority='error'" + limit: "500" + ant: antProperties() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dbPath: ${basedir}\metadata_db + ant: antProperties() + + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/tests/antunit/test_regex.ant.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/metadata/tests/antunit/test_regex.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,800 @@ + + + Helium Antlib metadata unittests. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dbPath: ${test.temp.dir}/categorization_db + ant: antProperties() + + + + + + + + + + + + + + cleanlog_errors: ${cleanlog_errors} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + test-categorization-nocleanlog: ${nocleanlog_errors} + + + + + + + + + + + + + + + + + + macro: ${project.dir}/../../src/templates + + + + dbPath: ${test.temp.dir}/log-entry-category_component_check_db + ant: antProperties() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + macro: ${project.dir}/../../src/templates/macro + + + dbPath: ${metadata-read-db} + loginfo: xml(${project.dir}/../data/ido_abs_mcl_devlon70_robot_MCL.70.500_info.log) + ant: antProperties() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dbPath: ${test.temp.dir}/whatlog_db + ant: antProperties() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dbPath: ${test.temp.dir}/test-release-database-fmpp_db + ant: antProperties() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/tests/antunit/test_validity.ant.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/metadata/tests/antunit/test_validity.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,67 @@ + + + + Helium Antlib diamonds unittests. + + + + + + + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/tests/data/all_regex1_type.log --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/metadata/tests/data/all_regex1_type.log Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,67 @@ + + +sbs: version 2.5.3 [2009-03-12 release] + +SBS_HOME E:/Build_E/ido-config-df/sbs +Set-up E:/Build_E/ido-config-df/sbs/sbs_init.xml +E:/build_e/sbs_2.8.4/sbs/win32/mingw/bin/cpp.exe: +Command-line-arguments -s z:\output/build/canonical_system_definition_build.xml -k -c armv5 -j 4 -m z:\output\logs/ido_imm_mcl_devlon70_robot_5.1.005__armv5_multiple_thread_build_Makefile --filters=FilterHeliumLog -f z:\output\logs/ido_imm_mcl_devlon70_robot_5.1.005__armv5_multiple_thread_build_compile.log + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/tests/data/build_roms_sample.log --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/metadata/tests/data/build_roms_sample.log Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,282 @@ +Starting build: 75090 +mkdir epoc32\rombuild\temp +mkdir epoc32\rombuild\temp\config_0 +Number of threads: 4 + +++ Started at Thu May 6 13:08:38 2010 ++++ HiRes Start 1273147718 +-- cmd /c imaker WORKDIR=epoc32\rombuild\temp/config_482 -f /epoc32/rom/config/ncp79/productexample/image_conf_productexample_ui.mk TYPE=prd rofs3-dir +iMaker 10.12.01, 23-Mar-2010. +=============================================================================== +Target: rofs3-dir Duration: 00:02 Status: OK +iMaker log = `Y:/output/release_flash_images/productexample/prd/customer/vanilla/rofs3/RM-XXX_010.014_00.01_79.92_prd_imaker_rofs3-dir.log' +ROFS3 dir = `y:/output/release_flash_images/productexample/prd/customer/vanilla/rofs3' +ROFS3 image = `y:/output/release_flash_images/productexample/prd/customer/vanilla/rofs3/RM-XXX_010.014_00.01_79.92_prd.rofs3.img' - DOESN'T EXIST +ROFS3 symbols = `y:/output/release_flash_images/productexample/prd/customer/vanilla/rofs3/RM-XXX_010.014_00.01_79.92_prd.rofs3.symbol' - DOESN'T EXIST +ROFS3 flash = `y:/output/release_flash_images/productexample/prd/customer/vanilla/RM-XXX_010.014_00.01_79.92_prd.rofs3.fpsx' - DOESN'T EXIST +------------------------------------------------------------------------------- +Total duration: 00:03 Status: OK +=============================================================================== ++++ HiRes End 1273147721 +++ Finished at Thu May 6 13:08:41 2010 +++ Started at Thu May 6 13:08:41 2010 ++++ HiRes Start 1273147721 +-- cmd /c imaker WORKDIR=epoc32\rombuild\temp/config_484 -f /epoc32/rom/config/ncp79/productexample/image_conf_productexample_ui.mk TYPE=rnd udaerase-dir +iMaker 10.12.01, 23-Mar-2010. +=============================================================================== +Target: udaerase-dir Duration: 00:01 Status: OK +iMaker log = `Y:/output/release_flash_images/productexample/rnd/uda/udaerase/udadata/RM-XXX_010.014_79.92.2010.15_rnd_imaker_udaerase-dir.log' +UDA Erase flash = `y:/output/release_flash_images/productexample/rnd/uda/RM-XXX_010.014_79.92.2010.15_rnd.udaerase.fpsx' - DOESN'T EXIST +------------------------------------------------------------------------------- +Total duration: 00:02 Status: OK +=============================================================================== ++++ HiRes End 1273147723 +++ Finished at Thu May 6 13:08:43 2010 +++ Started at Thu May 6 13:08:41 2010 ++++ HiRes Start 1273147721 +-- cmd /c imaker WORKDIR=epoc32\rombuild\temp/config_485 -f /epoc32/rom/config/ncp79/productexample/image_conf_productexample_ui.mk TYPE=prd udaerase-dir +iMaker 10.12.01, 23-Mar-2010. +=============================================================================== +Target: udaerase-dir Duration: 00:01 Status: OK +iMaker log = `Y:/output/release_flash_images/productexample/prd/uda/udaerase/udadata/RM-XXX_010.014_79.92_prd_imaker_udaerase-dir.log' +UDA Erase flash = `y:/output/release_flash_images/productexample/prd/uda/RM-XXX_010.014_79.92_prd.udaerase.fpsx' - DOESN'T EXIST +------------------------------------------------------------------------------- +Total duration: 00:02 Status: OK +=============================================================================== ++++ HiRes End 1273147723 +++ Finished at Thu May 6 13:08:43 2010 +++ Started at Thu May 6 13:08:41 2010 ++++ HiRes Start 1273147721 +-- cmd /c imaker WORKDIR=epoc32\rombuild\temp/config_486 -f /epoc32/rom/config/ncp79/productexample/image_conf_productexample_ui.mk TYPE=subcon udaerase-dir +iMaker 10.12.01, 23-Mar-2010. +=============================================================================== +Target: udaerase-dir Duration: 00:01 Status: OK +iMaker log = `Y:/output/release_flash_images/productexample/subcon/uda/udaerase/udadata/RM-XXX_010.014_79.92_subcon_imaker_udaerase-dir.log' +UDA Erase flash = `y:/output/release_flash_images/productexample/subcon/uda/RM-XXX_010.014_79.92_subcon.udaerase.fpsx' - DOESN'T EXIST +------------------------------------------------------------------------------- +Total duration: 00:02 Status: OK +=============================================================================== ++++ HiRes End 1273147723 +++ Finished at Thu May 6 13:08:43 2010 +++ Started at Thu May 6 13:08:40 2010 ++++ HiRes Start 1273147720 +-- cmd /c imaker WORKDIR=epoc32\rombuild\temp/config_483 -f /epoc32/rom/config/ncp79/productexample/image_conf_productexample_ui.mk TYPE=subcon rofs3-dir +iMaker 10.12.01, 23-Mar-2010. +=============================================================================== +Target: rofs3-dir Duration: 00:02 Status: OK +iMaker log = `Y:/output/release_flash_images/productexample/subcon/customer/vanilla/rofs3/RM-XXX_010.014_00.01_79.92_subcon_imaker_rofs3-dir.log' +ROFS3 dir = `y:/output/release_flash_images/productexample/subcon/customer/vanilla/rofs3' +ROFS3 image = `y:/output/release_flash_images/productexample/subcon/customer/vanilla/rofs3/RM-XXX_010.014_00.01_79.92_subcon.rofs3.img' - DOESN'T EXIST +ROFS3 symbols = `y:/output/release_flash_images/productexample/subcon/customer/vanilla/rofs3/RM-XXX_010.014_00.01_79.92_subcon.rofs3.symbol' - DOESN'T EXIST +ROFS3 flash = `y:/output/release_flash_images/productexample/subcon/customer/vanilla/RM-XXX_010.014_00.01_79.92_subcon.rofs3.fpsx' - DOESN'T EXIST +------------------------------------------------------------------------------- +Total duration: 00:03 Status: OK +=============================================================================== ++++ HiRes End 1273147724 +++ Finished at Thu May 6 13:08:44 2010 +-- imaker -f /epoc32/rom/config/ncp79/productexample/image_conf_productexample_ui.mk TYPE=rnd core-image +++ Started at Thu May 6 13:08:45 2010 ++++ HiRes Start 1273147725.83 +imaker WORKDIR=epoc32\rombuild\temp/config_16 -f /epoc32/rom/config/ncp79/productexample/image_conf_productexample_ui.mk TYPE=rnd core-image +iMaker 10.12.01, 23-Mar-2010. +Generating file(s) for Core (ROM & ROFS1) image creation +Generating Feature manager file(s) +Creating Core (ROM & ROFS1) SOS image + +Missing file(s): +1) y:/output/release_flash_images/productexample/rnd/core/RM-XXX_010.014_79.92.2010.15_rnd/RM-XXX_010.014_79.92.2010.15_rnd_core_master.oby(1686): Missing file: '/epoc32/data/Z/resource/apps/MPSettingsROPModel.rsc' in statement 'data=' +2) y:/output/release_flash_images/productexample/rnd/core/RM-XXX_010.014_79.92.2010.15_rnd/RM-XXX_010.014_79.92.2010.15_rnd_core_master.oby(1824): Missing file: '/epoc32/data/Z/private/20021377/backup_registration.xml' in statement 'data=' +3) y:/output/release_flash_images/productexample/rnd/core/RM-XXX_010.014_79.92.2010.15_rnd/RM-XXX_010.014_79.92.2010.15_rnd_core_master.oby(2596): Missing file: '/epoc32/data/z/data/system/quickoffice/licenses/corolla/data.xml' in statement 'data=' +4) y:/output/release_flash_images/productexample/rnd/core/RM-XXX_010.014_79.92.2010.15_rnd/RM-XXX_010.014_79.92.2010.15_rnd_core_master.oby(2597): Missing file: '/epoc32/data/z/data/system/quickoffice/licenses/corolla/key' in statement 'data=' +5) y:/output/release_flash_images/productexample/rnd/core/RM-XXX_010.014_79.92.2010.15_rnd/RM-XXX_010.014_79.92.2010.15_rnd_core_master.oby(2614): Missing file: '/epoc32/data/Z/Resource/wappush/si.dtd' in statement 'data=' +6) y:/output/release_flash_images/productexample/rnd/core/RM-XXX_010.014_79.92.2010.15_rnd/RM-XXX_010.014_79.92.2010.15_rnd_core_master.oby(2615): Missing file: '/epoc32/data/Z/Resource/wappush/sl.dtd' in statement 'data=' +7) y:/output/release_flash_images/productexample/rnd/core/RM-XXX_010.014_79.92.2010.15_rnd/RM-XXX_010.014_79.92.2010.15_rnd_core_master.oby(2616): Missing file: '/epoc32/data/Z/Resource/wappush/si10.tok' in statement 'data=' +8) y:/output/release_flash_images/productexample/rnd/core/RM-XXX_010.014_79.92.2010.15_rnd/RM-XXX_010.014_79.92.2010.15_rnd_core_master.oby(2617): Missing file: '/epoc32/data/Z/Resource/wappush/sl10.tok' in statement 'data=' +9) y:/output/release_flash_images/productexample/rnd/core/RM-XXX_010.014_79.92.2010.15_rnd/RM-XXX_010.014_79.92.2010.15_rnd_core_master.oby(4905): Missing file: '/epoc32/data/Z/resource/help/juicehelp.hlp' in statement 'data=' + +Warning(s): + 1) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x000003f5 + 2) WARNING: the value of attribute statusflags has been overridden in original feature 0x000003f5 + 3) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x0000000b + 4) WARNING: the value of attribute statusflags has been overridden in original feature 0x0000000b + 5) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x00000584 + 6) WARNING: the value of attribute statusflags has been overridden in original feature 0x00000584 + 7) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x0000019b + 8) WARNING: the value of attribute statusflags has been overridden in original feature 0x0000019b + 9) WARNING: the value of attribute statusflags has been overridden in original feature 0x00000007 + 10) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x000005ff + 11) WARNING: the value of attribute statusflags has been overridden in original feature 0x000005ff + 12) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x000001f8 + 13) WARNING: the value of attribute statusflags has been overridden in original feature 0x000001f8 + 14) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x0000000c + 15) WARNING: the value of attribute statusflags has been overridden in original feature 0x0000000c + 16) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x0000007a + 17) WARNING: the value of attribute statusflags has been overridden in original feature 0x0000007a + 18) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x00000059 + 19) WARNING: the value of attribute statusflags has been overridden in original feature 0x00000059 + 20) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x00000003 + 21) WARNING: the value of attribute statusflags has been overridden in original feature 0x00000003 + 22) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x00000126 + 23) WARNING: the value of attribute statusflags has been overridden in original feature 0x00000126 + 24) WARNING: the value of attribute statusflags has been overridden in original feature 0x0000005b + 25) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x00000066 + 26) WARNING: the value of attribute statusflags has been overridden in original feature 0x00000066 + 27) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x00000001 + 28) WARNING: the value of attribute statusflags has been overridden in original feature 0x00000001 + 29) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x0000006b + 30) WARNING: the value of attribute statusflags has been overridden in original feature 0x0000006b + 31) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x000005f9 + 32) WARNING: the value of attribute statusflags has been overridden in original feature 0x000005f9 + 33) WARNING: the value of attribute statusflags has been overridden in original feature 0x00000072 + 34) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x0000000d + 35) WARNING: the value of attribute statusflags has been overridden in original feature 0x0000000d + 36) WARNING: the value of attribute hrhmacro has been overridden in original feature 0x000006a9 + 37) WARNING: the value of attribute statusflags has been overridden in original feature 0x000006a9 + 38) WARNING: Error in reading features database file "/epoc32/include/s60customswfeatures.xml" + 39) WARNING: Unknown keyword 'LOCALISE_ALL_RESOURCES_BEGIN'. Line 2133 ignored + 40) WARNING: Unknown keyword 'LOCALISE_ALL_RESOURCES_END'. Line 2134 ignored + 41) WARNING: Unknown keyword '-----------------------------------------------------------'. Line 2210 ignored + 42) WARNING: Unknown keyword '-----------------------------------------------------------'. Line 2337 ignored + 43) WARNING: Unknown keyword '-----------------------------------------------------------'. Line 2338 ignored + 44) WARNING: Unknown keyword '***'. Line 2602 ignored + 45) WARNING: Unknown keyword 'LOCALISE_ALL_RESOURCES_BEGIN'. Line 2133 ignored + 46) WARNING: Unknown keyword 'LOCALISE_ALL_RESOURCES_END'. Line 2134 ignored + 47) WARNING: Unknown keyword '-----------------------------------------------------------'. Line 2210 ignored + 48) WARNING: Unknown keyword '-----------------------------------------------------------'. Line 2337 ignored + 49) WARNING: Unknown keyword '-----------------------------------------------------------'. Line 2338 ignored + 50) WARNING: Unknown keyword '***'. Line 2602 ignored + 51) WARNING: Kernel/variant/extension + 52) WARNING: Kernel/variant/extension + 53) WARNING: Kernel/variant/extension + 54) Warning: Can't open "\epoc32\release\ARMV5\urel\AR_LServer.exe.map" or "\epoc32\release\ARMV5\urel\AR_LServer.map" + 55) Warning: Can't open "\epoc32\release\ARMV5\urel\AP_CES_CoreComponents.dll.map" or "\epoc32\release\ARMV5\urel\AP_CES_CoreComponents.map" + 56) Warning: Can't open "\epoc32\release\ARMV5\urel\AP_HDMetafile2.dll.map" or "\epoc32\release\ARMV5\urel\AP_HDMetafile2.map" + 57) Warning: Can't open "\epoc32\release\ARMV5\urel\AP_HDOfficeCommon2.dll.map" or "\epoc32\release\ARMV5\urel\AP_HDOfficeCommon2.map" + 58) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_CES_QORecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ap_CES_QORecognizer.map" + 59) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_CES_S60_CoreComponents.dll.map" or "\epoc32\release\ARMV5\urel\ap_CES_S60_CoreComponents.map" + 60) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_CES_DeviceTransport.DLL.map" or "\epoc32\release\ARMV5\urel\ap_CES_DeviceTransport.map" + 61) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_zip.dll.map" or "\epoc32\release\ARMV5\urel\ap_zip.map" + 62) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_syb_XMLarchive.dll.map" or "\epoc32\release\ARMV5\urel\ap_syb_XMLarchive.map" + 63) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_FMPluginBase.dll.map" or "\epoc32\release\ARMV5\urel\ap_FMPluginBase.map" + 64) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_CES_FILELISTFMPLUGIN.DLL.map" or "\epoc32\release\ARMV5\urel\ap_CES_FILELISTFMPLUGIN.map" + 65) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_QO_FileManager.exe.map" or "\epoc32\release\ARMV5\urel\ap_QO_FileManager.map" + 66) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_ces_ziprecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ap_ces_ziprecognizer.map" + 67) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_CES_PptRecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ap_CES_PptRecognizer.map" + 68) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_CES_PptXRecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ap_CES_PptXRecognizer.map" + 69) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_CES_XlsRecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ap_CES_XlsRecognizer.map" + 70) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_CES_XlsXRecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ap_CES_XlsXRecognizer.map" + 71) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_CES_TxtRecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ap_CES_TxtRecognizer.map" + 72) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_CES_WrdRecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ap_CES_WrdRecognizer.map" + 73) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_CES_WrdXRecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ap_CES_WrdXRecognizer.map" + 74) Warning: Can't open "\epoc32\release\ARMV5\urel\AP_CES_QPDFDescriptor.DLL.map" or "\epoc32\release\ARMV5\urel\AP_CES_QPDFDescriptor.map" + 75) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_CES_PdfRecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ap_CES_PdfRecognizer.map" + 76) Warning: Can't open "\epoc32\release\ARMV5\urel\AP_CES_PDFFILTERINFO.DLL.map" or "\epoc32\release\ARMV5\urel\AP_CES_PDFFILTERINFO.map" + 77) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_QuickofficeStub.exe.map" or "\epoc32\release\ARMV5\urel\ap_QuickofficeStub.map" + 78) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_quickpdf.exe.map" or "\epoc32\release\ARMV5\urel\ap_quickpdf.map" + 79) WARNING: File \epoc32\data\Z\Resource\APPS\ap_registration.rom does not exist or is 0 bytes in length. + 80) Warning: Can't open "\epoc32\release\ARMV5\urel\ap_CES_HTTP.dll.map" or "\epoc32\release\ARMV5\urel\ap_CES_HTTP.map" + 81) WARNING: File \epoc32\data\Z\private\102033E6\installer\inst_plugins.cfg does not exist or is 0 bytes in length. + 82) Warning: Can't open "\epoc32\release\ARMV5\urel\arcimagefundamental.dll.map" or "\epoc32\release\ARMV5\urel\arcimagefundamental.map" + 83) Warning: Can't open "\epoc32\release\ARMV5\urel\arcplatform.dll.map" or "\epoc32\release\ARMV5\urel\arcplatform.map" + 84) Warning: Can't open "\epoc32\release\ARMV5\urel\arcimagecodecs.dll.map" or "\epoc32\release\ARMV5\urel\arcimagecodecs.map" + 85) Warning: Can't open "\epoc32\release\ARMV5\urel\photoeditor.exe.map" or "\epoc32\release\ARMV5\urel\photoeditor.map" + 86) Warning: Can't open "\epoc32\release\ARMV5\urel\arcamui.dll.map" or "\epoc32\release\ARMV5\urel\arcamui.map" + 87) Warning: Can't open "\epoc32\release\ARMV5\urel\arcpebasictool.dll.map" or "\epoc32\release\ARMV5\urel\arcpebasictool.map" + 88) Warning: Can't open "\epoc32\release\ARMV5\urel\arcpebase.dll.map" or "\epoc32\release\ARMV5\urel\arcpebase.map" + 89) Warning: Can't open "\epoc32\release\ARMV5\urel\arcpemanager.dll.map" or "\epoc32\release\ARMV5\urel\arcpemanager.map" + 90) Warning: Can't open "\epoc32\release\ARMV5\urel\arcampe.dll.map" or "\epoc32\release\ARMV5\urel\arcampe.map" + 91) Warning: Can't open "\epoc32\release\ARMV5\urel\photoeditoraiwplugin.dll.map" or "\epoc32\release\ARMV5\urel\photoeditoraiwplugin.map" + 92) WARNING: File \epoc32\data\Z\Resource\APPS\registration.rom does not exist or is 0 bytes in length. + 93) Warning: Can't open "\epoc32\release\ARMV5\urel\QO_LServer.exe.map" or "\epoc32\release\ARMV5\urel\QO_LServer.map" + 94) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_devicetransport.dll.map" or "\epoc32\release\ARMV5\urel\ces_devicetransport.map" + 95) Warning: Can't open "\epoc32\release\ARMV5\urel\CES_CoreComponents.dll.map" or "\epoc32\release\ARMV5\urel\CES_CoreComponents.map" + 96) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_pdfrecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ces_pdfrecognizer.map" + 97) Warning: Can't open "\epoc32\release\ARMV5\urel\CES_OGLES_Charts.dll.map" or "\epoc32\release\ARMV5\urel\CES_OGLES_Charts.map" + 98) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_filelistfmplugin.dll.map" or "\epoc32\release\ARMV5\urel\ces_filelistfmplugin.map" + 99) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_pptfilterinfo.dll.map" or "\epoc32\release\ARMV5\urel\ces_pptfilterinfo.map" +100) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_pptfilter.dll.map" or "\epoc32\release\ARMV5\urel\ces_pptfilter.map" +101) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_pptrecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ces_pptrecognizer.map" +102) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_pptxfilterinfo.dll.map" or "\epoc32\release\ARMV5\urel\ces_pptxfilterinfo.map" +103) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_ziprecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ces_ziprecognizer.map" +104) Warning: Can't open "\epoc32\release\ARMV5\urel\QO_PPTX_Engine_Conv.dll.map" or "\epoc32\release\ARMV5\urel\QO_PPTX_Engine_Conv.map" +105) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_pptxrecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ces_pptxrecognizer.map" +106) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_qorecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ces_qorecognizer.map" +107) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_qshdescriptor.dll.map" or "\epoc32\release\ARMV5\urel\ces_qshdescriptor.map" +108) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_qwddescriptor.dll.map" or "\epoc32\release\ARMV5\urel\ces_qwddescriptor.map" +109) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_qptdescriptor.dll.map" or "\epoc32\release\ARMV5\urel\ces_qptdescriptor.map" +110) Warning: Can't open "\epoc32\release\ARMV5\urel\CES_PPTXFILTER.DLL.map" or "\epoc32\release\ARMV5\urel\CES_PPTXFILTER.map" +111) Warning: Can't open "\epoc32\release\ARMV5\urel\CES_QWS_SpellChecker.dll.map" or "\epoc32\release\ARMV5\urel\CES_QWS_SpellChecker.map" +112) Warning: Can't open "\epoc32\release\ARMV5\urel\CES_RichText_Engine.dll.map" or "\epoc32\release\ARMV5\urel\CES_RichText_Engine.map" +113) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_txtfilter.dll.map" or "\epoc32\release\ARMV5\urel\ces_txtfilter.map" +114) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_txtfilterinfo.dll.map" or "\epoc32\release\ARMV5\urel\ces_txtfilterinfo.map" +115) Warning: Can't open "\epoc32\release\ARMV5\urel\CES_S60_CoreComponents.dll.map" or "\epoc32\release\ARMV5\urel\CES_S60_CoreComponents.map" +116) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_txtrecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ces_txtrecognizer.map" +117) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_wrdfilter.dll.map" or "\epoc32\release\ARMV5\urel\ces_wrdfilter.map" +118) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_wrdfilterinfo.dll.map" or "\epoc32\release\ARMV5\urel\ces_wrdfilterinfo.map" +119) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_wrdrecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ces_wrdrecognizer.map" +120) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_wrdxfilterinfo.dll.map" or "\epoc32\release\ARMV5\urel\ces_wrdxfilterinfo.map" +121) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_wrdxrecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ces_wrdxrecognizer.map" +122) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_wrdxfilter.dll.map" or "\epoc32\release\ARMV5\urel\ces_wrdxfilter.map" +123) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_xlsfilter.dll.map" or "\epoc32\release\ARMV5\urel\ces_xlsfilter.map" +124) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_xlsfilterinfo.dll.map" or "\epoc32\release\ARMV5\urel\ces_xlsfilterinfo.map" +125) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_xlsrecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ces_xlsrecognizer.map" +126) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_xlsxfilterinfo.dll.map" or "\epoc32\release\ARMV5\urel\ces_xlsxfilterinfo.map" +127) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_xlsxrecognizer.dll.map" or "\epoc32\release\ARMV5\urel\ces_xlsxrecognizer.map" +128) Warning: Can't open "\epoc32\release\ARMV5\urel\FMPluginBase.dll.map" or "\epoc32\release\ARMV5\urel\FMPluginBase.map" +129) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_xlsxfilter.dll.map" or "\epoc32\release\ARMV5\urel\ces_xlsxfilter.map" +130) Warning: Can't open "\epoc32\release\ARMV5\urel\HDExcel2.dll.map" or "\epoc32\release\ARMV5\urel\HDExcel2.map" +131) Warning: Can't open "\epoc32\release\ARMV5\urel\HDMetafile2.dll.map" or "\epoc32\release\ARMV5\urel\HDMetafile2.map" +132) Warning: Can't open "\epoc32\release\ARMV5\urel\HDOfficeCommon2.dll.map" or "\epoc32\release\ARMV5\urel\HDOfficeCommon2.map" +133) Warning: Can't open "\epoc32\release\ARMV5\urel\QO_FileManager.exe.map" or "\epoc32\release\ARMV5\urel\QO_FileManager.map" +134) Warning: Can't open "\epoc32\release\ARMV5\urel\HDPowerPoint2.dll.map" or "\epoc32\release\ARMV5\urel\HDPowerPoint2.map" +135) Warning: Can't open "\epoc32\release\ARMV5\urel\HDWord2.dll.map" or "\epoc32\release\ARMV5\urel\HDWord2.map" +136) Warning: Can't open "\epoc32\release\ARMV5\urel\quickpoint.exe.map" or "\epoc32\release\ARMV5\urel\quickpoint.map" +137) Warning: Can't open "\epoc32\release\ARMV5\urel\quicksheet.exe.map" or "\epoc32\release\ARMV5\urel\quicksheet.map" +138) Warning: Can't open "\epoc32\release\ARMV5\urel\Quickpoint_DOM.dll.map" or "\epoc32\release\ARMV5\urel\Quickpoint_DOM.map" +139) Warning: Can't open "\epoc32\release\ARMV5\urel\Quicksheet_DOM.dll.map" or "\epoc32\release\ARMV5\urel\Quicksheet_DOM.map" +140) Warning: Can't open "\epoc32\release\ARMV5\urel\Quickword.exe.map" or "\epoc32\release\ARMV5\urel\Quickword.map" +141) Warning: Can't open "\epoc32\release\ARMV5\urel\SYB_XMLArchive.dll.map" or "\epoc32\release\ARMV5\urel\SYB_XMLArchive.map" +142) Warning: Can't open "\epoc32\release\ARMV5\urel\Quickword_DOM.dll.map" or "\epoc32\release\ARMV5\urel\Quickword_DOM.map" +143) Warning: Can't open "\epoc32\release\ARMV5\urel\QuickPDFStub.exe.map" or "\epoc32\release\ARMV5\urel\QuickPDFStub.map" +144) Warning: Can't open "\epoc32\release\ARMV5\urel\CES_HTTP.dll.map" or "\epoc32\release\ARMV5\urel\CES_HTTP.map" +145) Warning: Can't open "\epoc32\release\ARMV5\urel\ces_pdffilterinfostub.dll.map" or "\epoc32\release\ARMV5\urel\ces_pdffilterinfostub.map" +146) Warning: Can't open "\epoc32\release\ARMV5\urel\zip.dll.map" or "\epoc32\release\ARMV5\urel\zip.map" +147) Warning: Can't open "\epoc32\release\ARMV5\urel\videoeditor.exe.map" or "\epoc32\release\ARMV5\urel\videoeditor.map" +148) Warning: Can't open "\epoc32\release\ARMV5\urel\amur.dll.map" or "\epoc32\release\ARMV5\urel\amur.map" +149) Warning: Can't open "\epoc32\release\ARMV5\urel\arcavcodecs.dll.map" or "\epoc32\release\ARMV5\urel\arcavcodecs.map" +150) Warning: Can't open "\epoc32\release\ARMV5\urel\amvesession.dll.map" or "\epoc32\release\ARMV5\urel\amvesession.map" +151) Warning: Can't open "\epoc32\release\ARMV5\urel\videoeditoraiwplugin.dll.map" or "\epoc32\release\ARMV5\urel\videoeditoraiwplugin.map" +152) Warning: Can't open "\epoc32\release\ARMV5\urel\3GPExtParser.dll.map" or "\epoc32\release\ARMV5\urel\3GPExtParser.map" +153) Warning: Can't open "\epoc32\release\ARMV5\urel\VtcpCmpFilter.dll.map" or "\epoc32\release\ARMV5\urel\VtcpCmpFilter.map" +154) Warning: Can't open "\epoc32\release\ARMV5\urel\SenVtcpTransport.dll.map" or "\epoc32\release\ARMV5\urel\SenVtcpTransport.map" +155) Warning: Can't open "\epoc32\release\ARMV5\urel\wmdrmkeystorage.dll.map" or "\epoc32\release\ARMV5\urel\wmdrmkeystorage.map" +156) Warning: Can't open "\epoc32\release\ARMV5\urel\hxwmdrmplugin.dll.map" or "\epoc32\release\ARMV5\urel\hxwmdrmplugin.map" +157) Warning: Can't open "\epoc32\release\ARMV5\urel\wmdrmota.dll.map" or "\epoc32\release\ARMV5\urel\wmdrmota.map" +158) Warning: Can't open "\epoc32\release\ARMV5\urel\wmdrmpkclient.dll.map" or "\epoc32\release\ARMV5\urel\wmdrmpkclient.map" +159) Warning: Can't open "\epoc32\release\ARMV5\urel\wmdrmpkserver.exe.map" or "\epoc32\release\ARMV5\urel\wmdrmpkserver.map" +160) Warning: Can't open "\epoc32\release\ARMV5\urel\wmdrmpkclientwrapper.dll.map" or "\epoc32\release\ARMV5\urel\wmdrmpkclientwrapper.map" +161) Warning: Can't open "\epoc32\release\ARMV5\urel\cameseutility.dll.map" or "\epoc32\release\ARMV5\urel\cameseutility.map" +162) Warning: Can't open "\epoc32\release\ARMV5\urel\wmdrmagent.dll.map" or "\epoc32\release\ARMV5\urel\wmdrmagent.map" +163) Warning: Can't open "\epoc32\release\ARMV5\urel\wmdrmdla.dll.map" or "\epoc32\release\ARMV5\urel\wmdrmdla.map" +164) Warning: Can't open "\epoc32\release\ARMV5\urel\wmdrmpd.dll.map" or "\epoc32\release\ARMV5\urel\wmdrmpd.map" +165) Warning: Can't open "\epoc32\release\gcce\urel\zipmanager.exe.map" or "\epoc32\release\gcce\urel\zipmanager.map" +166) Warning: Can't open "\epoc32\release\armv5\udeb\ctcmangui.exe.map" or "\epoc32\release\armv5\udeb\ctcmangui.map" +167) Warning: Can't open "\epoc32\release\ARMV5\urel\eunits60gui.exe.map" or "\epoc32\release\ARMV5\urel\eunits60gui.map" +168) Warning: Can't open "\epoc32\release\ARMV5\urel\eunitappenvironment.exe.map" or "\epoc32\release\ARMV5\urel\eunitappenvironment.map" +169) Warning: Can't open "\epoc32\release\ARMV5\urel\euniteikappenvironment.exe.map" or "\epoc32\release\ARMV5\urel\euniteikappenvironment.map" +170) Warning: Can't open "\epoc32\release\ARMV5\urel\qakitcommonui.dll.map" or "\epoc32\release\ARMV5\urel\qakitcommonui.map" +171) Warning: Can't open "\epoc32\release\ARMV5\urel\digiaconnect.exe.map" or "\epoc32\release\ARMV5\urel\digiaconnect.map" + +Error(s): +1) ERROR: (/epoc32/include/s60customswfeatures.xml) Feature "KFEATUREIDFFMOBILITYMANAGEMENTERRORS" already exists +=============================================================================== +Target: core-image Duration: 14:26 Status: OK +iMaker log = `Y:/output/release_flash_images/productexample/rnd/core/RM-XXX_010.014_79.92.2010.15_rnd/RM-XXX_010.014_79.92.2010.15_rnd_imaker_core-image.log' +Core (ROM & ROFS1) dir = `y:/output/release_flash_images/productexample/rnd/core/RM-XXX_010.014_79.92.2010.15_rnd' +Core ROM image = `y:/output/release_flash_images/productexample/rnd/core/RM-XXX_010.014_79.92.2010.15_rnd/RM-XXX_010.014_79.92.2010.15_rnd.rom.img' +Core ROM symbols = `y:/output/release_flash_images/productexample/rnd/core/RM-XXX_010.014_79.92.2010.15_rnd/RM-XXX_010.014_79.92.2010.15_rnd.rom.symbol' +Core ROFS1 image = `y:/output/release_flash_images/productexample/rnd/core/RM-XXX_010.014_79.92.2010.15_rnd/RM-XXX_010.014_79.92.2010.15_rnd.rofs1.img' +Core ROFS1 symbols = `y:/output/release_flash_images/productexample/rnd/core/RM-XXX_010.014_79.92.2010.15_rnd/RM-XXX_010.014_79.92.2010.15_rnd.rofs1.symbol' +------------------------------------------------------------------------------- +Total duration: 14:29 Status: OK +=============================================================================== \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/tests/functionality/test_regex.ant.xml --- a/buildframework/helium/sf/java/metadata/tests/functionality/test_regex.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,759 +0,0 @@ - - - Helium Antlib metadata unittests. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dbPath: ${test.temp.dir}/categorization_db - ant: antProperties() - - - - - - - - - - - - - - cleanlog_errors: ${cleanlog_errors} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - test-categorization-nocleanlog: ${nocleanlog_errors} - - - - - - - - - - - - - - - - - - macro: ${project.dir}/../../src/templates - - - - dbPath: ${test.temp.dir}/log-entry-category_component_check_db - ant: antProperties() - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - macro: ${project.dir}/../../src/templates/macro - - - dbPath: ${metadata-read-db} - loginfo: xml(${project.dir}/../data/ido_abs_mcl_devlon70_robot_MCL.70.500_info.log) - ant: antProperties() - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dbPath: ${test.temp.dir}/whatlog_db - ant: antProperties() - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dbPath: ${test.temp.dir}/test-release-database-fmpp_db - ant: antProperties() - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/tests/output.txt --- a/buildframework/helium/sf/java/metadata/tests/output.txt Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1336 +0,0 @@ -Buildfile: functionality\test_regex.ant.xml - -test-readdata: - [fmpp] args.size:1 - [fmpp] arg-list:E:\Build_E\eclipse_fasym013\helium-antlib-trunk\sf\metadata\tests\functionality/../output/log_all_filterfile.db - [fmpp] QueryModel:select * from priority - [fmpp] query in SQLTemplateModelselect * from priority - [fmpp] QueryModel:select * from component - [fmpp] query in SQLTemplateModelselect * from component - [fmpp] QueryModel:select * from logpath - [fmpp] query in SQLTemplateModelselect * from logpath - [fmpp] isDataRead:false - [fmpp] sql queryselect * from priority - [fmpp] data:0 - [fmpp] data:'' - [fmpp] data:1 - [fmpp] data:ERROR - [fmpp] data:2 - [fmpp] data:WARNING - [fmpp] data:3 - [fmpp] data:CRITICAL - [fmpp] data:4 - [fmpp] data:REMARK - [fmpp] indexmap size5 - [fmpp] indexmap size5 - [fmpp] QueryModel:3 - [fmpp] datalist size1 - [fmpp] QueryModel:select count(logText) as COUNT from metadata_table where priority_id=3 - [fmpp] query in SQLTemplateModelselect count(logText) as COUNT from metadata_table where priority_id=3 - [fmpp] isDataRead:false - [fmpp] sql queryselect count(logText) as COUNT from metadata_table where priority_id=3 - [fmpp] data:2 - [fmpp] indexmap size1 - [fmpp] sql queryselect count(logText) as COUNT from metadata_table where priority_id=3 - [fmpp] columnName:COUNT - [fmpp] resultSet MetaData column Count=1 - [fmpp] adding records - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] QueryModel:select count(logText) as COUNT from metadata_table where priority_id=2 - [fmpp] query in SQLTemplateModelselect count(logText) as COUNT from metadata_table where priority_id=2 - [fmpp] isDataRead:false - [fmpp] sql queryselect count(logText) as COUNT from metadata_table where priority_id=2 - [fmpp] data:36 - [fmpp] indexmap size1 - [fmpp] sql queryselect count(logText) as COUNT from metadata_table where priority_id=2 - [fmpp] columnName:COUNT - [fmpp] resultSet MetaData column Count=1 - [fmpp] adding records - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] QueryModel:select count(logText) as COUNT from metadata_table where priority_id=1 - [fmpp] query in SQLTemplateModelselect count(logText) as COUNT from metadata_table where priority_id=1 - [fmpp] isDataRead:false - [fmpp] sql queryselect count(logText) as COUNT from metadata_table where priority_id=1 - [fmpp] data:32 - [fmpp] indexmap size1 - [fmpp] sql queryselect count(logText) as COUNT from metadata_table where priority_id=1 - [fmpp] columnName:COUNT - [fmpp] resultSet MetaData column Count=1 - [fmpp] adding records - [fmpp] indexmap size5 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] QueryModel:select count(logText) as COUNT from metadata_table where priority_id=0 - [fmpp] query in SQLTemplateModelselect count(logText) as COUNT from metadata_table where priority_id=0 - [fmpp] isDataRead:false - [fmpp] sql queryselect count(logText) as COUNT from metadata_table where priority_id=0 - [fmpp] data:0 - [fmpp] indexmap size1 - [fmpp] sql queryselect count(logText) as COUNT from metadata_table where priority_id=0 - [fmpp] columnName:COUNT - [fmpp] resultSet MetaData column Count=1 - [fmpp] adding records - [fmpp] indexmap size5 - [fmpp] QueryModel:4 - [fmpp] datalist size1 - [fmpp] QueryModel:select count(logText) as COUNT from metadata_table where priority_id=4 - [fmpp] query in SQLTemplateModelselect count(logText) as COUNT from metadata_table where priority_id=4 - [fmpp] isDataRead:false - [fmpp] sql queryselect count(logText) as COUNT from metadata_table where priority_id=4 - [fmpp] data:12 - [fmpp] indexmap size1 - [fmpp] sql queryselect count(logText) as COUNT from metadata_table where priority_id=4 - [fmpp] columnName:COUNT - [fmpp] resultSet MetaData column Count=1 - [fmpp] adding records - [fmpp] indexmap size5 - [fmpp] QueryModel:3 - [fmpp] datalist size1 - [fmpp] QueryModel:select * from metadata_table where priority_id=3 - [fmpp] query in SQLTemplateModelselect * from metadata_table where priority_id=3 - [fmpp] iterator constructor called - [fmpp] checking any more element - [fmpp] getting records - [fmpp] sql queryselect * from metadata_table where priority_id=3 limit 5000 offset 0; - [fmpp] columnName:component_id - [fmpp] columnName:priority_id - [fmpp] columnName:logText - [fmpp] columnName:lineNumber - [fmpp] columnName:logname_id - [fmpp] resultSet MetaData column Count=5 - [fmpp] adding records - [fmpp] adding records - [fmpp] next:count:0 - [fmpp] logtext:next:mingw_make.exe: error - [fmpp] checking any more element - [fmpp] isDataRead:false - [fmpp] sql queryselect * from component - [fmpp] data:0 - [fmpp] data:z:/sf/app/camera/group/bld.inf - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:1 - [fmpp] logtext:next:mingw_make.exe: error - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] QueryModel:select * from metadata_table where priority_id=2 - [fmpp] query in SQLTemplateModelselect * from metadata_table where priority_id=2 - [fmpp] iterator constructor called - [fmpp] checking any more element - [fmpp] getting records - [fmpp] sql queryselect * from metadata_table where priority_id=2 limit 5000 offset 0; - [fmpp] columnName:component_id - [fmpp] columnName:priority_id - [fmpp] columnName:logText - [fmpp] columnName:lineNumber - [fmpp] columnName:logname_id - [fmpp] resultSet MetaData column Count=5 - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] next:count:0 - [fmpp] logtext:next:WARNING: - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:1 - [fmpp] logtext:next:LINK : warning - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:2 - [fmpp] logtext:next::10: warning: cannot find matching deallocation function - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:3 - [fmpp] logtext:next:100) : WARNING: TEST123 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:4 - [fmpp] logtext:next:MAKEDEF WARNING: TEST - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:5 - [fmpp] logtext:next:TEST 123 \\(10) : Warning: (400) - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:6 - [fmpp] logtext:next:BLDMAKE WARNING: bldm warning - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:7 - [fmpp] logtext:next:MAKEDEF WARNING: make warning - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:8 - [fmpp] logtext:next:atest(100) : warning C aasdfa - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:9 - [fmpp] logtext:next:testas 100: warning: test123 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:10 - [fmpp] logtext:next:usage Usage Warning: warn1 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:11 - [fmpp] logtext:next:abcd mwld.exe: abcd - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:12 - [fmpp] logtext:next:Command line warning abcd - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:13 - [fmpp] logtext:next:anything ERROR: bad relocation: test123 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:14 - [fmpp] logtext:next:10 warning in component1 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:15 - [fmpp] logtext:next:EventType: Error Source: SweepNTabcde - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:16 - [fmpp] logtext:next:WARN test - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:17 - [fmpp] logtext:next:abcd :10: warning: cannot find matching deallocation function 100:note abcd - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:18 - [fmpp] logtext:next:WARNING: - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:19 - [fmpp] logtext:next:LINK : warning - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:20 - [fmpp] logtext:next::10: warning: cannot find matching deallocation function - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:21 - [fmpp] logtext:next:100) : WARNING: TEST123 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:22 - [fmpp] logtext:next:MAKEDEF WARNING: TEST - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:23 - [fmpp] logtext:next:TEST 123 \\(10) : Warning: (400) - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:24 - [fmpp] logtext:next:BLDMAKE WARNING: bldm warning - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:25 - [fmpp] logtext:next:MAKEDEF WARNING: make warning - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:26 - [fmpp] logtext:next:atest(100) : warning C aasdfa - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:27 - [fmpp] logtext:next:testas 100: warning: test123 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:28 - [fmpp] logtext:next:usage Usage Warning: warn1 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:29 - [fmpp] logtext:next:abcd mwld.exe: abcd - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:30 - [fmpp] logtext:next:Command line warning abcd - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:31 - [fmpp] logtext:next:anything ERROR: bad relocation: test123 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:32 - [fmpp] logtext:next:10 warning in component1 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:33 - [fmpp] logtext:next:EventType: Error Source: SweepNTabcde - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:34 - [fmpp] logtext:next:WARN test - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:35 - [fmpp] logtext:next:abcd :10: warning: cannot find matching deallocation function 100:note abcd - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] QueryModel:select * from metadata_table where priority_id=1 - [fmpp] query in SQLTemplateModelselect * from metadata_table where priority_id=1 - [fmpp] iterator constructor called - [fmpp] checking any more element - [fmpp] getting records - [fmpp] sql queryselect * from metadata_table where priority_id=1 limit 5000 offset 0; - [fmpp] columnName:component_id - [fmpp] columnName:priority_id - [fmpp] columnName:logText - [fmpp] columnName:lineNumber - [fmpp] columnName:logname_id - [fmpp] resultSet MetaData column Count=5 - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] next:count:0 - [fmpp] logtext:next:test FATAL ERROR(S):abcd - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:1 - [fmpp] logtext:next:): Missing file: - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:2 - [fmpp] logtext:next:abcd FLEXlm error: - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:3 - [fmpp] logtext:next:ABLD ERROR: 1234 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:4 - [fmpp] logtext:next:BLDMAKE ERROR: 43543 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:5 - [fmpp] logtext:next:fatal error U1077 error occured - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:6 - [fmpp] logtext:next:test warning U4010 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:7 - [fmpp] logtext:next:make[10]: ***abcd - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:8 - [fmpp] logtext:next:make[10]: abcd not remade because of errors - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:9 - [fmpp] logtext:next:ERROR: build error - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:10 - [fmpp] logtext:next:ERROR EC95940: ec error - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:11 - [fmpp] logtext:next:Errors caused tool to abort. asdfasdf - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:12 - [fmpp] logtext:next:test no rule to make target - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:13 - [fmpp] logtext:next:ERROR,.*no rule to make.*, - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:14 - [fmpp] logtext:next:ERROR testing - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:15 - [fmpp] logtext:next:"abcd , line 100: Error: 100abcd:. abcd - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:16 - [fmpp] logtext:next:test FATAL ERROR(S):abcd - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:17 - [fmpp] logtext:next:): Missing file: - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:18 - [fmpp] logtext:next:abcd FLEXlm error: - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:19 - [fmpp] logtext:next:ABLD ERROR: 1234 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:20 - [fmpp] logtext:next:BLDMAKE ERROR: 43543 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:21 - [fmpp] logtext:next:fatal error U1077 error occured - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:22 - [fmpp] logtext:next:test warning U4010 - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:23 - [fmpp] logtext:next:make[10]: ***abcd - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:24 - [fmpp] logtext:next:make[10]: abcd not remade because of errors - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:25 - [fmpp] logtext:next:ERROR: build error - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:26 - [fmpp] logtext:next:ERROR EC95940: ec error - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:27 - [fmpp] logtext:next:Errors caused tool to abort. asdfasdf - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:28 - [fmpp] logtext:next:test no rule to make target - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:29 - [fmpp] logtext:next:ERROR,.*no rule to make.*, - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:30 - [fmpp] logtext:next:ERROR testing - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:31 - [fmpp] logtext:next:"abcd , line 100: Error: 100abcd:. abcd - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] indexmap size5 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] QueryModel:select * from metadata_table where priority_id=0 - [fmpp] query in SQLTemplateModelselect * from metadata_table where priority_id=0 - [fmpp] iterator constructor called - [fmpp] checking any more element - [fmpp] getting records - [fmpp] sql queryselect * from metadata_table where priority_id=0 limit 5000 offset 0; - [fmpp] columnName:component_id - [fmpp] columnName:priority_id - [fmpp] columnName:logText - [fmpp] columnName:lineNumber - [fmpp] columnName:logname_id - [fmpp] resultSet MetaData column Count=5 - [fmpp] indexmap size5 - [fmpp] QueryModel:4 - [fmpp] datalist size1 - [fmpp] QueryModel:select * from metadata_table where priority_id=4 - [fmpp] query in SQLTemplateModelselect * from metadata_table where priority_id=4 - [fmpp] iterator constructor called - [fmpp] checking any more element - [fmpp] getting records - [fmpp] sql queryselect * from metadata_table where priority_id=4 limit 5000 offset 0; - [fmpp] columnName:component_id - [fmpp] columnName:priority_id - [fmpp] columnName:logText - [fmpp] columnName:lineNumber - [fmpp] columnName:logname_id - [fmpp] resultSet MetaData column Count=5 - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] next:count:0 - [fmpp] logtext:next:REMARK: - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:1 - [fmpp] logtext:next:INFO: - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:2 - [fmpp] logtext:next:anything Command line warning D4025 : test - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:3 - [fmpp] logtext:next:REMARK: test remark anything - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:4 - [fmpp] logtext:next:EventType: Error Source: GNU Make. - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:5 - [fmpp] logtext:next:INFO: any info match - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:6 - [fmpp] logtext:next:REMARK: - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:7 - [fmpp] logtext:next:INFO: - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:8 - [fmpp] logtext:next:anything Command line warning D4025 : test - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:9 - [fmpp] logtext:next:REMARK: test remark anything - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:10 - [fmpp] logtext:next:EventType: Error Source: GNU Make. - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] next:count:11 - [fmpp] logtext:next:INFO: any info match - [fmpp] checking any more element - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] indexmap size1 - [fmpp] indexmap size1 - [fmpp] QueryModel:0 - [fmpp] datalist size1 - [fmpp] QueryModel:select * from metadata_table where component_id=0 order by priority_id - [fmpp] query in SQLTemplateModelselect * from metadata_table where component_id=0 order by priority_id - [fmpp] iterator constructor called - [fmpp] checking any more element - [fmpp] getting records - [fmpp] sql queryselect * from metadata_table where component_id=0 order by priority_id limit 5000 offset 0; - [fmpp] columnName:component_id - [fmpp] columnName:priority_id - [fmpp] columnName:logText - [fmpp] columnName:lineNumber - [fmpp] columnName:logname_id - [fmpp] resultSet MetaData column Count=5 - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] adding records - [fmpp] next:count:0 - [fmpp] logtext:next:test FATAL ERROR(S):abcd - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:1 - [fmpp] logtext:next:): Missing file: - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:2 - [fmpp] logtext:next:abcd FLEXlm error: - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:3 - [fmpp] logtext:next:ABLD ERROR: 1234 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:4 - [fmpp] logtext:next:BLDMAKE ERROR: 43543 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:5 - [fmpp] logtext:next:fatal error U1077 error occured - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:6 - [fmpp] logtext:next:test warning U4010 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:7 - [fmpp] logtext:next:make[10]: ***abcd - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:8 - [fmpp] logtext:next:make[10]: abcd not remade because of errors - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:9 - [fmpp] logtext:next:ERROR: build error - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:10 - [fmpp] logtext:next:ERROR EC95940: ec error - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:11 - [fmpp] logtext:next:Errors caused tool to abort. asdfasdf - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:12 - [fmpp] logtext:next:test no rule to make target - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:13 - [fmpp] logtext:next:ERROR,.*no rule to make.*, - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:14 - [fmpp] logtext:next:ERROR testing - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:15 - [fmpp] logtext:next:"abcd , line 100: Error: 100abcd:. abcd - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:16 - [fmpp] logtext:next:test FATAL ERROR(S):abcd - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:17 - [fmpp] logtext:next:): Missing file: - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:18 - [fmpp] logtext:next:abcd FLEXlm error: - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:19 - [fmpp] logtext:next:ABLD ERROR: 1234 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:20 - [fmpp] logtext:next:BLDMAKE ERROR: 43543 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:21 - [fmpp] logtext:next:fatal error U1077 error occured - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:22 - [fmpp] logtext:next:test warning U4010 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:23 - [fmpp] logtext:next:make[10]: ***abcd - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:24 - [fmpp] logtext:next:make[10]: abcd not remade because of errors - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:25 - [fmpp] logtext:next:ERROR: build error - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:26 - [fmpp] logtext:next:ERROR EC95940: ec error - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:27 - [fmpp] logtext:next:Errors caused tool to abort. asdfasdf - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:28 - [fmpp] logtext:next:test no rule to make target - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:29 - [fmpp] logtext:next:ERROR,.*no rule to make.*, - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:30 - [fmpp] logtext:next:ERROR testing - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:31 - [fmpp] logtext:next:"abcd , line 100: Error: 100abcd:. abcd - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:1 - [fmpp] datalist size1 - [fmpp] next:count:32 - [fmpp] logtext:next:WARNING: - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:33 - [fmpp] logtext:next:LINK : warning - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:34 - [fmpp] logtext:next::10: warning: cannot find matching deallocation function - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:35 - [fmpp] logtext:next:100) : WARNING: TEST123 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:36 - [fmpp] logtext:next:MAKEDEF WARNING: TEST - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:37 - [fmpp] logtext:next:TEST 123 \\(10) : Warning: (400) - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:38 - [fmpp] logtext:next:BLDMAKE WARNING: bldm warning - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:39 - [fmpp] logtext:next:MAKEDEF WARNING: make warning - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:40 - [fmpp] logtext:next:atest(100) : warning C aasdfa - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:41 - [fmpp] logtext:next:testas 100: warning: test123 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:42 - [fmpp] logtext:next:usage Usage Warning: warn1 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:43 - [fmpp] logtext:next:abcd mwld.exe: abcd - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:44 - [fmpp] logtext:next:Command line warning abcd - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:45 - [fmpp] logtext:next:anything ERROR: bad relocation: test123 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:46 - [fmpp] logtext:next:10 warning in component1 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:47 - [fmpp] logtext:next:EventType: Error Source: SweepNTabcde - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:48 - [fmpp] logtext:next:WARN test - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:49 - [fmpp] logtext:next:abcd :10: warning: cannot find matching deallocation function 100:note abcd - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:50 - [fmpp] logtext:next:WARNING: - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:51 - [fmpp] logtext:next:LINK : warning - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:52 - [fmpp] logtext:next::10: warning: cannot find matching deallocation function - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:53 - [fmpp] logtext:next:100) : WARNING: TEST123 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:54 - [fmpp] logtext:next:MAKEDEF WARNING: TEST - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:55 - [fmpp] logtext:next:TEST 123 \\(10) : Warning: (400) - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:56 - [fmpp] logtext:next:BLDMAKE WARNING: bldm warning - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:57 - [fmpp] logtext:next:MAKEDEF WARNING: make warning - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:58 - [fmpp] logtext:next:atest(100) : warning C aasdfa - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:59 - [fmpp] logtext:next:testas 100: warning: test123 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:60 - [fmpp] logtext:next:usage Usage Warning: warn1 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:61 - [fmpp] logtext:next:abcd mwld.exe: abcd - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:62 - [fmpp] logtext:next:Command line warning abcd - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:63 - [fmpp] logtext:next:anything ERROR: bad relocation: test123 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:64 - [fmpp] logtext:next:10 warning in component1 - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:65 - [fmpp] logtext:next:EventType: Error Source: SweepNTabcde - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:66 - [fmpp] logtext:next:WARN test - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:67 - [fmpp] logtext:next:abcd :10: warning: cannot find matching deallocation function 100:note abcd - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:2 - [fmpp] datalist size1 - [fmpp] next:count:68 - [fmpp] logtext:next:mingw_make.exe: error - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:3 - [fmpp] datalist size1 - [fmpp] next:count:69 - [fmpp] logtext:next:mingw_make.exe: error - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:3 - [fmpp] datalist size1 - [fmpp] next:count:70 - [fmpp] logtext:next:REMARK: - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:4 - [fmpp] datalist size1 - [fmpp] next:count:71 - [fmpp] logtext:next:INFO: - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:4 - [fmpp] datalist size1 - [fmpp] next:count:72 - [fmpp] logtext:next:anything Command line warning D4025 : test - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:4 - [fmpp] datalist size1 - [fmpp] next:count:73 - [fmpp] logtext:next:REMARK: test remark anything - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:4 - [fmpp] datalist size1 - [fmpp] next:count:74 - [fmpp] logtext:next:EventType: Error Source: GNU Make. - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:4 - [fmpp] datalist size1 - [fmpp] next:count:75 - [fmpp] logtext:next:INFO: any info match - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:4 - [fmpp] datalist size1 - [fmpp] next:count:76 - [fmpp] logtext:next:REMARK: - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:4 - [fmpp] datalist size1 - [fmpp] next:count:77 - [fmpp] logtext:next:INFO: - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:4 - [fmpp] datalist size1 - [fmpp] next:count:78 - [fmpp] logtext:next:anything Command line warning D4025 : test - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:4 - [fmpp] datalist size1 - [fmpp] next:count:79 - [fmpp] logtext:next:REMARK: test remark anything - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:4 - [fmpp] datalist size1 - [fmpp] next:count:80 - [fmpp] logtext:next:EventType: Error Source: GNU Make. - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:4 - [fmpp] datalist size1 - [fmpp] next:count:81 - [fmpp] logtext:next:INFO: any info match - [fmpp] checking any more element - [fmpp] indexmap size5 - [fmpp] QueryModel:4 - [fmpp] datalist size1 - [fmpp] File processed. - -BUILD SUCCESSFUL -Total time: 1 second diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/tests/output1.txt --- a/buildframework/helium/sf/java/metadata/tests/output1.txt Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -Buildfile: functionality\test_regex.ant.xml - -test-readdata: - [fmpp] args.size:6 - [fmpp] arg-list:E:\Build_E\eclipse_fasym013\helium-antlib-trunk\sf\metadata\tests\output\log_all_filterfile.db - [fmpp] arg-list:LOG_ALL_FILTERFILE - [fmpp] arg-list:10 - [fmpp] arg-list:-1 - [fmpp] arg-list:where priority='WARNING' - [fmpp] arg-list:true - [fmpp] offset-1 - [fmpp] recordLimit10 - [fmpp] Initializing the db - [fmpp] updating queries - [fmpp] adding table details - [fmpp] adding record size - [fmpp] updateQuery:-1 - [fmpp] sqlquery:SELECT COUNT(*) AS COUNT FROM LOG_ALL_FILTERFILE where priority='WARNING' - [fmpp] record count:36 - [fmpp] recordcount:36 - [fmpp] updatequery:10 - [fmpp] maxoffset:4 - [fmpp] iterator constructor called - [fmpp] checking any more element - [fmpp] SQLTemplateModelIterator:offset:0 - [fmpp] adding table details - [fmpp] adding record size - [fmpp] updateQuery:0 - [fmpp] adding records - [fmpp] actual query:where priority='WARNING' - [fmpp] sql querySELECT * from LOG_ALL_FILTERFILE where priority='WARNING' limit 10 offset 0; - [fmpp] no. of columns from query result:3 - [fmpp] record size in getRecords:10 - [fmpp] actual query:where priority='WARNING' - [fmpp] sql querySELECT * from LOG_ALL_FILTERFILE where priority='WARNING' limit 10 offset 0; - [fmpp] no. of columns from query result:3 - [fmpp] record size in getRecords:10 - [fmpp] checking any more element - [fmpp] SQLTemplateModelIterator:offset:10 - [fmpp] adding table details - [fmpp] adding record size - [fmpp] updateQuery:10 - [fmpp] adding records - [fmpp] actual query:where priority='WARNING' - [fmpp] sql querySELECT * from LOG_ALL_FILTERFILE where priority='WARNING' limit 10 offset 10; - [fmpp] no. of columns from query result:3 - [fmpp] record size in getRecords:10 - [fmpp] actual query:where priority='WARNING' - [fmpp] sql querySELECT * from LOG_ALL_FILTERFILE where priority='WARNING' limit 10 offset 10; - [fmpp] no. of columns from query result:3 - [fmpp] record size in getRecords:10 - [fmpp] checking any more element - [fmpp] SQLTemplateModelIterator:offset:20 - [fmpp] adding table details - [fmpp] adding record size - [fmpp] updateQuery:20 - [fmpp] adding records - [fmpp] actual query:where priority='WARNING' - [fmpp] sql querySELECT * from LOG_ALL_FILTERFILE where priority='WARNING' limit 10 offset 20; - [fmpp] no. of columns from query result:3 - [fmpp] record size in getRecords:10 - [fmpp] actual query:where priority='WARNING' - [fmpp] sql querySELECT * from LOG_ALL_FILTERFILE where priority='WARNING' limit 10 offset 20; - [fmpp] no. of columns from query result:3 - [fmpp] record size in getRecords:10 - [fmpp] checking any more element - [fmpp] SQLTemplateModelIterator:offset:30 - [fmpp] adding table details - [fmpp] adding record size - [fmpp] updateQuery:30 - [fmpp] adding records - [fmpp] actual query:where priority='WARNING' - [fmpp] sql querySELECT * from LOG_ALL_FILTERFILE where priority='WARNING' limit 10 offset 30; - [fmpp] no. of columns from query result:3 - [fmpp] record size in getRecords:6 - [fmpp] actual query:where priority='WARNING' - [fmpp] sql querySELECT * from LOG_ALL_FILTERFILE where priority='WARNING' limit 10 offset 30; - [fmpp] no. of columns from query result:3 - [fmpp] record size in getRecords:6 - [fmpp] checking any more element - [fmpp] File processed. - -BUILD SUCCESSFUL -Total time: 0 seconds diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/tests/src/com/nokia/helium/metadata/tests/TestIMakerLogMetaDataInput.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/metadata/tests/src/com/nokia/helium/metadata/tests/TestIMakerLogMetaDataInput.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,63 @@ +/* + * 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.tests; + +import java.io.File; +import java.util.Iterator; + +import org.apache.tools.ant.Project; +import org.apache.tools.ant.types.FileSet; +import org.junit.Test; + +import com.nokia.helium.jpa.entity.metadata.Metadata; +import com.nokia.helium.metadata.ant.types.IMakerLogMetaDataInput; + +/** + * Tests the iMaker log metadata input parser. + */ +public class TestIMakerLogMetaDataInput { + + /** The number of images in the sample log file that has errors. */ + public static final int IMAGES_WITH_ERRORS_TOTAL = 5; + + /** + * Read a sample log file and verify that the right number of images (components) is identified. + */ + @Test + public void testParseIMakerLogfile() { + IMakerLogMetaDataInput imakerInput = new IMakerLogMetaDataInput(); + imakerInput.setProject(new Project()); + FileSet fileset = new FileSet(); + fileset.setDir(new File(".")); + fileset.setFile(new File("../sf/java/metadata/tests/data/build_roms_sample.log")); + imakerInput.add(fileset); + + // Iterate through the entries + Iterator inputIterator = imakerInput.iterator(); + int componentTotal = 0; + while (inputIterator.hasNext()) { + Metadata.LogEntry logEntry = inputIterator.next(); + System.out.println("logentry: " + logEntry.toString()); + componentTotal++; + } + assert (componentTotal == IMAGES_WITH_ERRORS_TOTAL); + } +} + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/tests/test_metadata.ant.xml --- a/buildframework/helium/sf/java/metadata/tests/test_metadata.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ - - - - Helium antlib metadata tests. - - - - - - - - - - - - - - - - - - - - - - - - - macro: ${basedir}/../src/templates - - - templatedir: "${basedir}/src/templates" - template: "components_status.xml.ftl" - dbPath: "tests/out.sqlite" - countOnly: "true" - tableName: "out" - queryString: "where priority='WARNING' or priority='error'" - limit: "500" - ant: antProperties() - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/metadata/tests/test_validity.ant.xml --- a/buildframework/helium/sf/java/metadata/tests/test_validity.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ - - - - Helium Antlib diamonds unittests. - - - - - - - - \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/antlib.xml --- a/buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/antlib.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/antlib.xml Wed Jun 16 16:51:40 2010 +0300 @@ -22,11 +22,11 @@ --> - - - - + + + + + - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/CMTSummaryTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/CMTSummaryTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,366 @@ +/* + * 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.quality.ant.taskdefs; + +import java.io.*; +import java.util.*; +import org.apache.log4j.Logger; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; +import java.io.FileReader; +import java.util.regex.Pattern; +import java.util.regex.Matcher; + + /** + * This Task searches the index.html files created by CMT and looks for the summary + * values at the end of the file e.g. Files: 12 LOCphy: 137. + * and takes the info and places it in an XMl file ready to be sent to diamonds. The Xml + * file is placed in the diamonds folder in the output folder and these files are then + * sent to diamonds when the build is finished soall we have to do is create the file in the + * correct folder. + * + *
    + * <hlm:cmtmetadatainput   
    +            diamondsHeaderFileName="C:\brtaylor\1\diamonds_header.xml" 
    +            diamondsFooterFileName="C:\brtaylor\1\diamonds_footer.xml"
    +            outptuFile="Z:\output\diamonds/cmt_summary_componentName_1.xml/" 
    +            inputFile="Z:\output\logs/minibuild_ido_0.0.03_test_cmt_componentName1_cmt/CMTHTML/index.html/>
    + * 
    + * + * @ant.task name="cmtsummarytask" category="Quality" + */ + +public class CMTSummaryTask extends Task { + + /** the following 2 variables are indexes to the SEARCH_TERMS_ARRAY **/ + /**index to the searched for text**/ + private static final int INPUT_TEXT_INDEX = 0; + /**index to the text to write to the xml file**/ + private static final int OUTPUT_ELEMENT_INDEX = 1; + /**get the system relevent line separator **/ + private static final String NEW_LINE = System.getProperty( "line.separator" ); + + /** this array contains the text to be searched for in the inputFile (1st element) + and the text to be written to the .xml output file (2nd element)**/ + private static final String[][] SEARCH_TERMS_ARRAY = { + //1st elem 2nd elem + {"Files:", "files"}, + {"LOCphy:", "locphy"}, + {"LOCbl:", "locbl"}, + {"LOCpro:", "locpro"}, + {"LOCcom:", "loccom"}, + {"v(G) :", "vg"}, + {"MI without comments :", "mi_wo_comments"}, + {"MI comment weight :", "mi_comment_weight"}, + {"MI:", "mi"} + }; + + /** always accesses the 1st group of the matcher**/ + private static int matcherGroupNum; //default init is 0 + + /**indexes to the SEARCH_TERMS_ARRAY**/ + private int arrayIndex; + + private int sizeArray = SEARCH_TERMS_ARRAY.length; + + private Logger log = Logger.getLogger(CMTSummaryTask.class); + /** the following variables are inputs to the class**/ + /** the file containing the CMT summary data**/ + private String inputFile; + /**name of file to write the output to**/ + private String outputFile; + + /**the following variables are used internally by the class**/ + /** each line of the input file is read into this**/ + private String line; + /**the regex for a string of digits**/ + private Pattern digitPattern = Pattern.compile("\\d+"); + + /** file descriptor for the input file**/ + private BufferedReader inputFileReader; + + /**file handler used to write the summary numbers to the output file***/ + private BufferedWriter output; //default init = null + + /**tells the main method whether it should be looking for digist or text**/ + private boolean lineStartsWithDigits; //default init = false + + /**file name of the default diamonds XML file header part (1st few lines) + used so not writing the XML text here**/ + private String diamondsHeaderFileName; + /**file name of the default diamonds XML file footer part (last line) + used so not writing the XML text here**/ + private String diamondsFooterFileName; + + + + /** + * @param outputFile + * set the output file name + * @ant.required + */ + public void setOutputFile(String outputFile) { + this.outputFile = outputFile; + } + + /** + * @return the outputFile + * the output file name + */ + public String getOutputFile() { + return outputFile; + } + + + /** + * @return the inputFile + */ + public String getinputFile() { + return inputFile; + } + + /** + * @param inputFile + * the name of file to scan and extract data from + * @ant.required + */ + public void setinputFile(String inputFile) { + this.inputFile = inputFile; + } + + /** + * @param diamondsFooterFileName + * set the diamonds footer file name + * @ant.required + */ + public void setdiamondsFooterFileName(String diamondsFooterFileName) { + this.diamondsFooterFileName = diamondsFooterFileName; + } + + /** + * @return the diamondsFooterFileName + * the diamonds footer file name + */ + public String getdiamondsFooterFileName() { + return diamondsFooterFileName; + } + + /** + * @param diamondsHeaderFileName + * set the diamonds header file name + * @ant.required + */ + public void setdiamondsHeaderFileName(String diamondsHeaderFileName) { + this.diamondsHeaderFileName = diamondsHeaderFileName; + } + + /** + * @return the diamondsFooterFileName + * the diamonds footer file name + */ + public String getdiamondsHeaderFileName() { + return diamondsHeaderFileName; + } + + + /**the main part of the code - the method that is called**/ + public void execute() { + log("CMTSummaryTask execute method with input file : " + inputFile, Project.MSG_ERR); + boolean result; + String commandString; + boolean inputFileFound = true; + BufferedReader diamondsHeaderFile; + BufferedReader diamondsFooterFile; + + Project prj = getProject(); + log("output File is " + getOutputFile(), Project.MSG_ERR); + + try { + //open the file with the CMT results init + inputFileReader = new BufferedReader(new FileReader(inputFile)); + } catch (FileNotFoundException exc) { + log("FileNotFoundException while getting the input file. : " + inputFile + " " + exc.getMessage(), Project.MSG_ERR); + inputFileFound = false; //stops an empty output file being created. + } + if (inputFileFound) { + try { + //write the title stuff for the XML diamonds schema + output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(getOutputFile()), "UTF8")); + } catch (FileNotFoundException exc) { + log("FileNotFoundException while getting the output file. : " + getOutputFile() + " " + exc.getMessage(), Project.MSG_ERR); + } catch (UnsupportedEncodingException exc) { + // We are Ignoring the errors as no need to fail the build. + log("UnsupportedEncodingException while creating the output file : " + getOutputFile() + " " + exc.getMessage(), Project.MSG_ERR); + } catch (SecurityException exc) { + // We are Ignoring the errors as no need to fail the build. + log("SecurityException while creating the output file : " + getOutputFile() + " " + exc.getMessage(), Project.MSG_ERR); + } + + if (output != null) { + //managed to open the output file + try { + //write the initial XML text to the file + String tempLine; + diamondsHeaderFile = null; + diamondsHeaderFile = new BufferedReader(new FileReader(getdiamondsHeaderFileName())); + while ((tempLine = diamondsHeaderFile.readLine()) != null) { + output.write(tempLine); + output.newLine(); + } + diamondsHeaderFile.close(); + output.write(" \r\n"); + + // CheckStyle:InnerAssignment OFF + //process each of the searchterms + while ((arrayIndex < sizeArray) && ((line = inputFileReader.readLine()) != null)) { + findTextAndOutput(); //read finput file and write the output + } + // CheckStyle:InnerAssignment ON + + //write the end of file text + output.write(" "); + output.newLine(); + + diamondsFooterFile = null; + diamondsFooterFile = new BufferedReader(new FileReader(getdiamondsFooterFileName())); + while ((tempLine = diamondsFooterFile.readLine()) != null) { + output.write(tempLine); + output.newLine(); + } + output.close(); //close the output file + diamondsFooterFile.close(); + } catch (FileNotFoundException exc) { + log("FileNotFoundException while getting the diamonds header file : " + getdiamondsHeaderFileName() + " " + exc.getMessage(), Project.MSG_ERR); + } catch (IOException exc) { + // We are Ignoring the errors as no need to fail the build. + log("IOException : " + getdiamondsHeaderFileName() + " output file = " + getOutputFile() + " " + + exc.getMessage(), Project.MSG_ERR); + } catch (IllegalArgumentException exc) { + // We are Ignoring the errors as no need to fail the build. + log("IllegalArgumentException : " + getdiamondsHeaderFileName() + " output file = " + getOutputFile() + " " + + exc.getMessage(), Project.MSG_ERR); + } + } else { + log("Error: no output File available ", Project.MSG_ERR); + } + } else { + log("Error: no input File available ", Project.MSG_ERR); + } + } + + /** + This is the function that performs the actual file searches and writes the number + following the searched for text to the output XML file + **/ + private void findTextAndOutput() + { + final int colonSkip = 2; + byte[] lineBytes = null; + int len; + int buffLen; + int lineLen; + int serchTermTextLen; + int spacesLen; + + try { + lineLen = line.length(); + while ((lineLen > 0) && (arrayIndex < sizeArray)) { + //Process each of the groups of chars in a line + if (line.startsWith(SEARCH_TERMS_ARRAY[arrayIndex][INPUT_TEXT_INDEX])) { + //found the CMT data type we are looking for so look fo r the digits now + serchTermTextLen = SEARCH_TERMS_ARRAY[arrayIndex][INPUT_TEXT_INDEX].length(); + buffLen = writeToOutput(); + if ((buffLen > 0) && (arrayIndex < sizeArray)) { + //skip over the digits so can get the next searchterm near the begining of line + line = line.substring(line.indexOf(':') + colonSkip + buffLen); + spacesLen = removeAnySpaces(); + lineLen = lineLen - (buffLen + serchTermTextLen + spacesLen); //decrease line length for the while loop + } else { + //didn't find the digits so probably at the end of the line and the digits + //are on the next line + len = line.length(); + //convert the line to bytes so we can check for a specific Character + lineBytes = line.getBytes("UTF-8"); + int sbLen = lineBytes.length; + //the last real char (i.e. not the EOL) should be '=' if the digits are on the next line + if (lineBytes[sbLen - 1] == '=') { + //found the '=' so read the next line in + lineStartsWithDigits = true; + lineLen = 0; + } else { + log("can't find the '=' at end of line ", Project.MSG_ERR); + lineLen = 0; + } + } + } else if (lineStartsWithDigits) { //probably got a line with digits on + buffLen = writeToOutput(); //definitely got a line with digits on + lineStartsWithDigits = false; + if ((buffLen > 0) && (arrayIndex < sizeArray)) { //now need to get rid of the digits and get to the next none digits char + line = line.substring(buffLen); + spacesLen = removeAnySpaces(); + lineLen = lineLen - (buffLen + spacesLen); //decrease line length for the while loop + } else { + lineLen = 0; + log("can't find the digits at beg of line ", Project.MSG_ERR); + } + } else { + lineLen = 0; + } + } + } catch (IOException exc) { + log("IOException Error searching : " + exc.getMessage(), Project.MSG_ERR); + } + return; + } + + private int writeToOutput() throws IOException + { + String buffer; + int buffLen; + + Matcher componentMatch = digitPattern.matcher(line); + if (componentMatch.find()) { + //found the digits after the search term + buffer = componentMatch.group(matcherGroupNum); + //write the XML formated nn to the output file (plus the other) + output.write(" <" + SEARCH_TERMS_ARRAY[arrayIndex][OUTPUT_ELEMENT_INDEX] + ">"); + output.write(buffer); + output.write(""); + output.newLine(); + buffLen = buffer.length(); + } else { + buffLen = 0; + log("can't find digits may be '=' at end of line ", Project.MSG_ERR); + } + return buffLen; + } + + private int removeAnySpaces() throws UnsupportedEncodingException { + byte[] lineBytes; + int num = 0; + int len = line.length(); + //convert the line to bytes so we can check for a specific Character + lineBytes = line.getBytes("UTF-8"); + //while there are still spaces at the front of the line shuffle the line along to get rid of them + while ((lineBytes[num++] == ' ') && (len > 0)) { + line = line.substring(1); //remove 1 space at front of line + len--; + } + return num; + } +} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/CMTTool.java --- a/buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/CMTTool.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,218 +0,0 @@ -/* - * 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.quality.ant.taskdefs; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.taskdefs.ExecTask; -import org.apache.tools.ant.taskdefs.condition.Os; -import org.apache.tools.ant.types.FileSet; - -/** - * CMTTool is the task used to execute the Complexity Measures Tool for C/C++. - * - *
    - * Usage:
    - * 
    - * <hlm:cmt output="${cmt.output.dir}\logs\${build.id}_${ido.name}_${componentbase}_${cmt.id}.txt>
    - *     <fileset id="input" dir="${test.data.src}">
    - *         <include name="**/*.h"/>
    - *         <include name="**/*.cpp"/>
    - *     </fileset>
    - * </hlm:cmt>
    - * 
    - * output : Name of the file to contain the results of Complexity Measures Tool.
    - * fileset: Location of the source files whose complexity is to be measured.
    - * 
    - * - * @ant.task name="cmt" category="Quality". - */ -public class CMTTool extends Task { - - private FileSet fileSet; - private String input; - private String output; - - /** - * Set the fileset. - * - * @param fileSet - * is the fileset which points to the location of source files to - * be measured. - * @ant.required - */ - public void addFileset(FileSet fileSet) { - this.fileSet = fileSet; - } - - /** - * Set the name and location of the output file to contain the result of CMT - * tool. - * - * @param output - * is the name of the result file to be generated. - * @ant.required - */ - public void setOutput(String output) { - this.output = output; - } - - /** - * Run the CMT task. - */ - public void execute() { - if (!Os.isFamily(Os.FAMILY_WINDOWS)) { - getProject() - .log("CMT supported only for windows", Project.MSG_WARN); - return; - } - validate(); - input = fileSet.getDir().getPath(); - generateFileList(); - runCmtCommand(); - runCmt2HtmlCommand(); - } - - /** - * Execute the cmt.exe command. - */ - private void runCmtCommand() { - try { - ExecTask task = getExecTask("cmttool", "cmt.exe", new File(".")); - task.createArg().setValue("-f"); - task.createArg().setValue( - input + System.getProperty("file.separator") + "files.lst"); - task.createArg().setValue("-o"); - task.createArg().setValue(output); - task.setResultProperty("cmt.status"); - task.setProject(getProject()); - task.execute(); - int status = new Integer(getProject().getProperty("cmt.status")); - getProject().log("CMT run successfully? " + (status == 0)); - } catch (BuildException ex) { - // We are Ignoring the errors as no need to fail the build. - getProject().log(ex.getMessage(), Project.MSG_WARN); - } - } - - /** - * Execute the cmt2html.bat command. - */ - private void runCmt2HtmlCommand() { - try { - File outputdir = new File(output.replace(".txt", "_cmt")); - outputdir.mkdir(); - ExecTask task = getExecTask("cmt2html", "cmt2html.bat", outputdir); - task.createArg().setValue("-i"); - task.createArg().setValue(output); - task.createArg().setValue("-nsb"); - task.setResultProperty("cmt2html.status"); - task.setProject(getProject()); - task.execute(); - int status = new Integer(getProject() - .getProperty("cmt2html.status")); - getProject().log("CMT2HTML run successfully? " + (status == 0)); - } catch (BuildException ex) { - // We are Ignoring the errors as no need to fail the build. - getProject().log(ex.getMessage(), Project.MSG_WARN); - } - } - - /** - * Return an execute task with the given inputs. - * - * @param taskName - * is the name of the execute task. - * @param cmd - * is the command to be executed by the task. - * @param outDir - * is the working directory for the task. - * @return an instance of execute task. - */ - private ExecTask getExecTask(String taskName, String cmd, File outDir) { - ExecTask task = new ExecTask(); - task.setDir(outDir); - task.setTaskName(taskName); - task.setExecutable(cmd); - return task; - } - - /** - * Method validates the required parameters and elements are set. - */ - private void validate() { - if (fileSet == null) { - raiseError("Nested Element 'fileset' missing for task 'cmt'."); - } - - if (output == null || (output != null && output.isEmpty())) { - raiseError("Parameter 'output' missing for task 'cmt'."); - } - - } - - /** - * Method is used to throw a BuildException. - * - * @param message - * is the message to be thrown. - */ - private void raiseError(String message) { - throw new BuildException(message); - } - - /** - * Generates a file containing a list of files. - */ - private void generateFileList() { - if (fileSet != null) { - DirectoryScanner ds = fileSet.getDirectoryScanner(); - ds.scan(); - String[] filelist = ds.getIncludedFiles(); - String fileSeparator = System.getProperty("file.separator"); - String lineSeparator = System.getProperty("line.separator"); - File fileList = new File(input + fileSeparator + "files.lst"); - BufferedWriter outputFile = null; - try { - outputFile = new BufferedWriter(new FileWriter(fileList)); - for (String file : filelist) { - outputFile.write(input + fileSeparator + file - + lineSeparator); - } - } catch (IOException e) { - // We are Ignoring the errors as no need to fail the build. - getProject().log(e.getMessage(), Project.MSG_WARN); - } finally { - try { - if (outputFile != null) - outputFile.close(); - } catch (IOException ex) { - // ignore exception - ex = null; - } - } - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/CMTToolTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/CMTToolTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,234 @@ +/* + * 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.quality.ant.taskdefs; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.DirectoryScanner; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; +import org.apache.tools.ant.taskdefs.ExecTask; +import org.apache.tools.ant.taskdefs.condition.Os; +import org.apache.tools.ant.types.FileSet; + +/** + * CMTTool is the task used to execute the Complexity Measures Tool for C/C++. + * + *
    + * Usage:
    + * 
    + * <hlm:cmt output="${cmt.output.dir}\logs\${build.id}_${ido.name}_${componentbase}_${cmt.id}.txt>
    + *     <fileset id="input" dir="${test.data.src}">
    + *         <include name="**/*.h"/>
    + *         <include name="**/*.cpp"/>
    + *     </fileset>
    + * </hlm:cmt>
    + * 
    + * output : Name of the file to contain the results of Complexity Measures Tool.
    + * fileset: Location of the source files whose complexity is to be measured.
    + * 
    + * + * @ant.task name="cmt" category="Quality". + */ +public class CMTToolTask extends Task { + + private List cmtFileSetList = new ArrayList(); + private File input; + private File output; + private File htmlOutputDir; + private boolean failOnError = true; + + /** + * Set the fileset. + * + * @param fileSet + * is the fileset which points to the location of source files to + * be measured. + * @ant.required + */ + public void addFileset(FileSet fileSet) { + cmtFileSetList.add(fileSet); + } + + /** + * Set the name and location of the output file to contain the result of CMT + * tool. + * + * @param output + * is the name of the result file to be generated. + * @ant.required + */ + public void setOutput(File output) { + this.output = output; + } + + /** + * @param failOnError the failOnError to set + */ + public void setFailOnError(boolean failOnError) { + this.failOnError = failOnError; + } + + /** + * @param htmlOutputDir the htmlOutputDir to set + */ + public void setHtmlOutputDir(File htmlOutputDir) { + this.htmlOutputDir = htmlOutputDir; + } + + /** + * Run the CMT task. + */ + public void execute() { + if (!Os.isFamily(Os.FAMILY_WINDOWS)) { + throw new BuildException("CMT supported only on windows platforms."); + } + validate(); + try { + input = File.createTempFile("Files", ".list"); + generateFileList(); + runCmtCommand(); + if (this.htmlOutputDir != null) { + runCmt2HtmlCommand(); + } + } catch (IOException ioe) { + throw new BuildException("Not able to generate file list for 'cmt'. ", ioe); + } catch (BuildException be) { + if (failOnError) { + throw new BuildException("Exception occured while running 'cmt' tool. ", be); + } + log("Exception occured while running 'cmt' tool. ", Project.MSG_ERR); + } finally { + if (input != null) { + input.delete(); + } + } + } + + /** + * Execute the cmt.exe command. + */ + private void runCmtCommand() { + String command = null; + if (!this.output.getParentFile().exists()) { + this.output.getParentFile().mkdirs(); + } + ExecTask task = getExecTask("cmttool", "cmt", new File(".")); + command = "cmt"; + task.createArg().setValue("-f"); + command += " " + "-f"; + task.createArg().setValue(input.toString()); + command += " " + input.toString(); + task.createArg().setValue("-o"); + command += " " + "-o"; + task.createArg().setValue(output.toString()); + command += " " + output; + task.setProject(getProject()); + log("run command: " + command); + task.execute(); + } + + /** + * Execute the cmt2html.bat command. + */ + private void runCmt2HtmlCommand() { + String command = null; + if (!this.htmlOutputDir.exists()) { + this.htmlOutputDir.mkdirs(); + } + ExecTask task = getExecTask("cmt2html", "cmt2html.bat", this.htmlOutputDir); + command = "cmt2html.bat"; + task.createArg().setValue("-i"); + command += " " + "-i"; + task.createArg().setValue(output.toString()); + command += " " + output; + task.createArg().setValue("-nsb"); + command += " " + "-nsb"; + task.setProject(getProject()); + log("run command: " + command); + task.execute(); + } + + /** + * Return an execute task with the given inputs. + * + * @param taskName + * is the name of the execute task. + * @param cmd + * is the command to be executed by the task. + * @param outDir + * is the working directory for the task. + * @return an instance of execute task. + */ + private ExecTask getExecTask(String taskName, String cmd, File outDir) { + ExecTask task = new ExecTask(); + task.setDir(outDir); + task.setTaskName(this.getTaskName()); + task.setExecutable(cmd); + return task; + } + + /** + * Method validates the required parameters and elements are set. + */ + private void validate() { + if (cmtFileSetList.size() == 0) { + throw new BuildException("Nested Element 'fileset' missing for task 'cmt'."); + } + if (output == null) { + throw new BuildException("Parameter 'output' missing for task 'cmt'."); + } + } + + /** + * Generates a file containing a list of files. + */ + private void generateFileList() { + + for (FileSet fileSet : cmtFileSetList) { + DirectoryScanner dirScanner = fileSet.getDirectoryScanner(); + dirScanner.scan(); + String[] filelist = dirScanner.getIncludedFiles(); + String lineSeparator = System.getProperty("line.separator"); + BufferedWriter outputFile = null; + try { + outputFile = new BufferedWriter(new FileWriter(input)); + for (String file : filelist) { + outputFile.write(dirScanner.getBasedir().toString() + file + + lineSeparator); + } + } catch (IOException e) { + throw new BuildException("Not able to generate file list for 'cmt'. ", e); + } finally { + try { + if (outputFile != null) + outputFile.close(); + } catch (IOException ex) { + // ignore exception + ex = null; + } + } + } + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/CodeScanner.java --- a/buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/CodeScanner.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,239 +0,0 @@ -/* - * 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.quality.ant.taskdefs; - -import java.io.*; -import java.util.Vector; - -import org.apache.tools.ant.Task; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.taskdefs.ExecTask; - -/** - * This task executes codescanner - and writes the results to the output directory. - * Codescanner parses C++ code and flags any inconsistencies or errors in output files. - * Configuration files are used to determine what passes and fails the checking e.g. maximum length of lines, - * whether 'C' type comments are allowed as well as C++ comments, does it adhere to the company coding - * guidelines and much more. Every person writing any C++ code - * should run codescanner on their code to ensure it follows the coding guidelines. The output logs - * should have no errors and preferably no warnings before the code should be checked into SCM, e.g. synergy or SVN. - * - * Below is an example of how to use the target to run codescanner. - * - *
    - * <property name="codescanner.output.dir" location="./cs" />
    - * <property name="codescanner.output.type" value="html" />
    - * <property name="codescanner.config" location="./codescanner_config.xml" />
    - *
    - * <hlm:codescanner dest="${codescanner.output.dir}"
    - *      format="${codescanner.output.type}"
    - *      failonerror="true"
    - *      configuration="${codescanner.config}">
    - *      <path refid="src.path"/>
    - *  </hlm:codescanner>
    - *  <au:assertLogContains text="Successfully executed codescanner"/>
    - *  <au:assertLogContains text="Output format: xml,html"/>
    - *  <au:assertFileExists file="${codescanner.output.dir}/problemIndex.xml"/>
    - * 
    - * - * @ant.task name="codescanner" category="Quality" - */ -public class CodeScanner extends Task { - private Vector paths = new Vector(); - private File configuration; - private String dest; - private String format = "xml,html"; - private boolean auto; - private File log; - private boolean failonerror; - - /** - * This defines if the task should fails in case of error while - * executing codescanner. - * - * @param failonerror - * @ant.not-required Default is false for backward compatibility. - */ - public void setFailonerror(boolean failonerror) { - this.failonerror = failonerror; - } - - /** - * Add path datatype to the task. - * - * @param path - */ - public void add(Path path) { - paths.add(path); - } - - /** - * Get dest attribute. - * - */ - public String getDest() { - return this.dest; - } - - /** - * Set dest attribute. - * - * @param dest - * @ant.required - */ - public void setDest(String dest) { - this.dest = dest; - } - - /** - * Get format attribute. - * - */ - public String getFormat() { - return this.format; - } - - /** - * Set format attribute. - * - * @param format - * @ant.not-required Default is xml,html - */ - public void setFormat(String format) { - this.format = format; - } - - /** - * Get configuration attribute. - * - */ - public File getConfiguration() { - return this.configuration; - } - - /** - * Set configuration attribute. - * - * @param configuration - * @ant.required - */ - public void setConfiguration(File configuration) { - this.configuration = configuration; - } - - /** - * Set auto attribute. - * - * @param auto - * @ant.not-required Default is false. - */ - public void setAuto(boolean auto) { - this.auto = auto; - } - - /** - * Set log attribute. - * - * @param log - * @ant.not-required - */ - public void setLog(File log) { - this.log = log; - } - - /** - * {@inheritDoc} - */ - @Override - public void execute() { - // creating the exec subtask - String osType = System.getProperty("os.name"); - if (!osType.toLowerCase().startsWith("win")) { - this.log("CODESCANNER: run in windows only"); - return; - } - ExecTask task = new ExecTask(); - task.setProject(getProject()); - task.setTaskName(this.getTaskName()); - task.setFailonerror(failonerror); - task.setExecutable("codescanner"); - task.setDir(new File(".")); - if (dest == null) { - throw new BuildException("'dest' attribute must be defined"); - } - if (configuration != null) { - if (!configuration.exists()) { - throw new BuildException("Could not find the file " - + configuration); - } else { - task.createArg().setValue("-c"); - task.createArg().setValue(configuration.getAbsolutePath()); - } - } else { - throw new BuildException( - "'configuration' attribute must be defined"); - } - if (!format.contains("xml")) { - setFormat("xml," + format); - } - this.log("Output format: " + format); - // -t off - task.createArg().setValue("-t"); - task.createArg().setValue(auto ? "on" : "off"); - - // -l log - if (log != null) { - this.log("Output log: " + log.getAbsolutePath()); - task.createArg().setValue("-l"); - task.createArg().setValue(log.getAbsolutePath()); - } - - // -o type - task.createArg().setValue("-o"); - task.createArg().setValue(format); - if (paths.isEmpty()) { - throw new BuildException("No input directory defined"); - } - // Getting the list of source dir to scan - Vector srcs = new Vector(); - for (Path path : paths) { - if (path.isReference()) { - path = (Path) path.getRefid().getReferencedObject(); - } - for (String apath : path.list()) { - srcs.add(apath); - } - } - for (int i = 0; i < srcs.size(); i++) { - if (i != srcs.size() - 1) { - task.createArg().setValue("-i"); - task.createArg().setValue(srcs.elementAt(i)); - } else { - task.createArg().setValue(srcs.elementAt(i)); - task.createArg().setValue(dest.toString()); - } - } - // output path - this.log("Output dir " + dest); - - // Run codescanner - task.execute(); - this.log("Successfully executed codescanner"); - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/CodeScannerTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/CodeScannerTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,239 @@ +/* + * 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.quality.ant.taskdefs; + +import java.io.*; +import java.util.Vector; + +import org.apache.tools.ant.Task; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.taskdefs.ExecTask; + +/** + * This task executes codescanner - and writes the results to the output directory. + * Codescanner parses C++ code and flags any inconsistencies or errors in output files. + * Configuration files are used to determine what passes and fails the checking e.g. maximum length of lines, + * whether 'C' type comments are allowed as well as C++ comments, does it adhere to the company coding + * guidelines and much more. Every person writing any C++ code + * should run codescanner on their code to ensure it follows the coding guidelines. The output logs + * should have no errors and preferably no warnings before the code should be checked into SCM, e.g. synergy or SVN. + * + * Below is an example of how to use the target to run codescanner. + * + *
    + * <property name="codescanner.output.dir" location="./cs" />
    + * <property name="codescanner.output.type" value="html" />
    + * <property name="codescanner.config" location="./codescanner_config.xml" />
    + *
    + * <hlm:codescanner dest="${codescanner.output.dir}"
    + *      format="${codescanner.output.type}"
    + *      failonerror="true"
    + *      configuration="${codescanner.config}">
    + *      <path refid="src.path"/>
    + *  </hlm:codescanner>
    + *  <au:assertLogContains text="Successfully executed codescanner"/>
    + *  <au:assertLogContains text="Output format: xml,html"/>
    + *  <au:assertFileExists file="${codescanner.output.dir}/problemIndex.xml"/>
    + * 
    + * + * @ant.task name="codescanner" category="Quality" + */ +public class CodeScannerTask extends Task { + private Vector paths = new Vector(); + private File configuration; + private String dest; + private String format = "xml,html"; + private boolean auto; + private File log; + private boolean failonerror; + + /** + * This defines if the task should fails in case of error while + * executing codescanner. + * + * @param failonerror + * @ant.not-required Default is false for backward compatibility. + */ + public void setFailonerror(boolean failonerror) { + this.failonerror = failonerror; + } + + /** + * Add path datatype to the task. + * + * @param path + */ + public void add(Path path) { + paths.add(path); + } + + /** + * Get dest attribute. + * + */ + public String getDest() { + return this.dest; + } + + /** + * Set dest attribute. + * + * @param dest + * @ant.required + */ + public void setDest(String dest) { + this.dest = dest; + } + + /** + * Get format attribute. + * + */ + public String getFormat() { + return this.format; + } + + /** + * Set format attribute. + * + * @param format + * @ant.not-required Default is xml,html + */ + public void setFormat(String format) { + this.format = format; + } + + /** + * Get configuration attribute. + * + */ + public File getConfiguration() { + return this.configuration; + } + + /** + * Set configuration attribute. + * + * @param configuration + * @ant.required + */ + public void setConfiguration(File configuration) { + this.configuration = configuration; + } + + /** + * Set auto attribute. + * + * @param auto + * @ant.not-required Default is false. + */ + public void setAuto(boolean auto) { + this.auto = auto; + } + + /** + * Set log attribute. + * + * @param log + * @ant.not-required + */ + public void setLog(File log) { + this.log = log; + } + + /** + * {@inheritDoc} + */ + @Override + public void execute() { + // creating the exec subtask + String osType = System.getProperty("os.name"); + if (!osType.toLowerCase().startsWith("win")) { + this.log("CODESCANNER: run in windows only"); + return; + } + ExecTask task = new ExecTask(); + task.setProject(getProject()); + task.setTaskName(this.getTaskName()); + task.setFailonerror(failonerror); + task.setExecutable("codescanner"); + task.setDir(new File(".")); + if (dest == null) { + throw new BuildException("'dest' attribute must be defined"); + } + if (configuration != null) { + if (!configuration.exists()) { + throw new BuildException("Could not find the file " + + configuration); + } else { + task.createArg().setValue("-c"); + task.createArg().setValue(configuration.getAbsolutePath()); + } + } else { + throw new BuildException( + "'configuration' attribute must be defined"); + } + if (!format.contains("xml")) { + setFormat("xml," + format); + } + this.log("Output format: " + format); + // -t off + task.createArg().setValue("-t"); + task.createArg().setValue(auto ? "on" : "off"); + + // -l log + if (log != null) { + this.log("Output log: " + log.getAbsolutePath()); + task.createArg().setValue("-l"); + task.createArg().setValue(log.getAbsolutePath()); + } + + // -o type + task.createArg().setValue("-o"); + task.createArg().setValue(format); + if (paths.isEmpty()) { + throw new BuildException("No input directory defined"); + } + // Getting the list of source dir to scan + Vector srcs = new Vector(); + for (Path path : paths) { + if (path.isReference()) { + path = (Path) path.getRefid().getReferencedObject(); + } + for (String apath : path.list()) { + srcs.add(apath); + } + } + for (int i = 0; i < srcs.size(); i++) { + if (i != srcs.size() - 1) { + task.createArg().setValue("-i"); + task.createArg().setValue(srcs.elementAt(i)); + } else { + task.createArg().setValue(srcs.elementAt(i)); + task.createArg().setValue(dest.toString()); + } + } + // output path + this.log("Output dir " + dest); + + // Run codescanner + task.execute(); + this.log("Successfully executed codescanner"); + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/Coverity.java --- a/buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/Coverity.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,198 +0,0 @@ -/* -* 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.quality.ant.taskdefs; - -import java.io.File; -import java.util.Vector; -import java.util.Map.Entry; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.taskdefs.ExecTask; - -import com.nokia.helium.core.ant.types.Variable; -import com.nokia.helium.core.ant.types.VariableSet; - -/** - * To run the coverity commands. - * - * - *
    - *      <hlm:coverity command="cov-link" dir="${build.drive}/">
    -                    <hlm:arg name="--dir" value="${coverity.output.dir}/intermidiate"/>
    -                    <hlm:arg name="--compile-arg" value="armv5"/>
    -                    <hlm:arg name="--output" value="${coverity.output.dir}/coveritylink/armv5.link"/>
    -                    <hlm:arg name="${coverity.output.dir}/coveritylink/all.link" value=""/>
    -                </hlm:coverity >
    - *      
    - * 
    - * - * @ant.task name="coverity" category="Quality". - * - */ - - -public class Coverity extends Task { - - private String command; - private boolean failOnError; - private boolean execute = true; - private String dir; - private Vector coverityOptions = new Vector(); - private Vector coverityArgs = new Vector(); - - - public void execute() { - - validateParameters(); - - runCommand(command); - - } - - - - /** - * To run the command passed into coverity tsask. - * @param command - */ - private void runCommand(String command) { - - String commandString = command; - if (!command.startsWith("cov-")) { - throw new BuildException("Coverity task can run only coverity prevent tool commands."); - } - - ExecTask task = new ExecTask(); - task.setProject(getProject()); - task.setTaskName(this.getTaskName()); - task.setFailonerror(failOnError); - task.setExecutable(command); - task.setDir(new File(this.dir)); - - for (VariableSet coverityArg : coverityOptions) { - for (Entry entry : coverityArg.getVariablesMap().entrySet() ) { - task.createArg().setValue(entry.getKey()); - task.createArg().setValue(entry.getValue().getValue()); - commandString = commandString + " " + entry.getKey() + " " + entry.getValue().getValue(); - } - } - - for (Variable coverityArg : coverityArgs) { - task.createArg().setValue(coverityArg.getName()); - task.createArg().setValue(coverityArg.getValue()); - commandString = commandString + " " + coverityArg.getName() + " " + coverityArg.getValue(); - } - - try { - log("run command: " + commandString); - if (execute) { - task.execute(); - } - } catch (BuildException be) { - if (failOnError) { - throw new BuildException("exception during coverity command '" + command + "' execution:", be); - } - } - - } - - - - /** - * To validate the parameters passed into coverity task. - */ - private void validateParameters() { - - if (command == null) { - throw new BuildException("'command' parameter should not be null for coverity task."); - } - - } - - - - /** - * @param command the command to set - * @ant.required - */ - public void setCommand(String command) { - this.command = command; - } - - /** - * @return the command - */ - public String getCommand() { - return command; - } - - /** - * @param failOnError the failOnError to set - * @ant.not-required - */ - public void setFailOnError(boolean failOnError) { - this.failOnError = failOnError; - } - - /** - * @return the dir - */ - public String getDir() { - return dir; - } - - /** - * @param dir the dir to set - * @ant.not-required - */ - public void setDir(String dir) { - this.dir = dir; - } - - /** - * @param execute the execute to set - */ - public void setExecute(boolean execute) { - this.execute = execute; - } - - - - /** - * To read the coverity arguments for coverity commands. - * @param variableArg - */ - public void addCoverityOptions(VariableSet coverityArg) { - if (!coverityOptions.contains(coverityArg)) { - coverityOptions.add(coverityArg); - } - } - - /** - * To read the individual arguments. - * @param coverityArg - */ - public void addArg(Variable coverityArg) { - if (!coverityArgs.contains(coverityArg)) { - coverityArgs.add(coverityArg); - } - } - - - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/CoverityTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/CoverityTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,188 @@ +/* + * 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.quality.ant.taskdefs; + +import java.io.File; +import java.util.Vector; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import org.apache.tools.ant.taskdefs.ExecTask; + +import com.nokia.helium.core.ant.types.VariableImpl; +import com.nokia.helium.core.ant.types.VariableSet; + +/** + * To run the coverity commands. + * + * + *
    + *      <hlm:coverity command="cov-link" dir="${build.drive}/">
    + *                     <hlm:arg name="--dir" value="${coverity.output.dir}/intermidiate"/>
    + *                     <hlm:arg name="--compile-arg" value="armv5"/>
    + *                     <hlm:arg name="--output" value="${coverity.output.dir}/coveritylink/armv5.link"/>
    + *                     <hlm:arg name="${coverity.output.dir}/coveritylink/all.link" value=""/>
    + *                 </hlm:coverity >
    + * 
    + * 
    + * + * @ant.task name="coverity" category="Quality". + * + */ + +public class CoverityTask extends Task { + + private String command; + private boolean failOnError; + private boolean execute = true; + private String dir; + private Vector coverityOptions = new Vector(); + private Vector coverityArgs = new Vector(); + + public void execute() { + + validateParameters(); + + runCommand(command); + + } + + /** + * To run the command passed into coverity task. + * + * @param command + */ + private void runCommand(String command) { + + String commandString = command; + if (!command.startsWith("cov-")) { + throw new BuildException( + "Coverity task can run only coverity prevent tool commands."); + } + + ExecTask task = new ExecTask(); + task.setProject(getProject()); + task.setTaskName(this.getTaskName()); + task.setFailonerror(failOnError); + task.setExecutable(command); + task.setDir(new File(this.dir)); + + for (VariableSet coverityArg : coverityOptions) { + task.createArg().setLine(coverityArg.getParameter(" ")); + commandString += " " + coverityArg.getParameter(" "); + } + for (VariableImpl coverityArg : coverityArgs) { + task.createArg().setLine(coverityArg.getParameter(" ")); + commandString += " " + coverityArg.getParameter(" "); + } + + try { + log("run command: " + commandString); + if (execute) { + task.execute(); + } + } catch (BuildException be) { + if (failOnError) { + throw new BuildException("exception during coverity command '" + + command + "' execution:", be); + } + } + + } + + /** + * To validate the parameters passed into coverity task. + */ + private void validateParameters() { + if (command == null) { + throw new BuildException( + "'command' parameter should not be null for coverity task."); + } + + } + + /** + * @param command + * the command to set + * @ant.required + */ + public void setCommand(String command) { + this.command = command; + } + + /** + * @return the command + */ + public String getCommand() { + return command; + } + + /** + * @param failOnError + * the failOnError to set + * @ant.not-required + */ + public void setFailOnError(boolean failOnError) { + this.failOnError = failOnError; + } + + /** + * @return the dir + */ + public String getDir() { + return dir; + } + + /** + * @param dir + * the dir to set + * @ant.not-required + */ + public void setDir(String dir) { + this.dir = dir; + } + + /** + * @param execute + * the execute to set + */ + public void setExecute(boolean execute) { + this.execute = execute; + } + + /** + * To read the coverity arguments for coverity commands. + * + * @param variableArg + */ + public void addCoverityOptions(VariableSet coverityArg) { + if (!coverityOptions.contains(coverityArg)) { + coverityOptions.add(coverityArg); + } + } + + /** + * To read the individual arguments. + * + * @param coverityArg + */ + public void addArg(VariableImpl coverityArg) { + if (!coverityArgs.contains(coverityArg)) { + coverityArgs.add(coverityArg); + } + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/tests/antunit/test_cmt.ant.xml --- a/buildframework/helium/sf/java/quality/tests/antunit/test_cmt.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/quality/tests/antunit/test_cmt.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -23,27 +23,36 @@ Helium antlib Quality CMT related tests. + + - + - - - - + + + + - - + + + + + + - - + + + - @@ -56,17 +65,27 @@ --> - + - - - - - + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/tests/data/cmt_summary_1.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/quality/tests/data/cmt_summary_1.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,15 @@ + + + 21 + + 2 + 101 + 25 + 45 + 35 + 4 + 98 + 32 + 130 + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/tests/data/cmt_summary_2.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/quality/tests/data/cmt_summary_2.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,15 @@ + + + 21 + + 3578 + 1449873 + 197449 + 883402 + 393776 + 79966 + 92 + 32 + 125 + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/tests/data/cmt_summary_3.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/quality/tests/data/cmt_summary_3.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,6 @@ + + + 21 + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/tests/data/cmt_summary_5.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/quality/tests/data/cmt_summary_5.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,15 @@ + + + 21 + + 3578 + 1449873 + 197449 + 883402 + 483 + 79966 + 92 + 32 + 125 + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/tests/data/helloworldcons/index_1.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/quality/tests/data/helloworldcons/index_1.html Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,9 @@ + + + helloworldcons.cpp 3 79 40 1051 0.18 125  +  +
    +Files: 2    LOCphy: 101     LOCbl: 25    LOCpro: 45     LOCcom: 35   ';': 25
    +v(G) : 4    MI without comments  : 98    MI comment weight    : 32    MI: 130
    +
    diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/tests/data/helloworldcons/index_2.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/quality/tests/data/helloworldcons/index_2.html Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,11 @@ + + + helloworldcons.cpp 3 79 40 1051 0.18 125  +  +
    +Files: 3578 LOCphy: 1449873 LOCbl: 197449LOCpro: 883402 LOCcom: =
    +393776';': 432445
    +v(G) : 79966MI without comments  : 92    MI comment weight    : 32    =
    +MI: 125
    +
    diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/tests/data/helloworldcons/index_3.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/quality/tests/data/helloworldcons/index_3.html Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,8 @@ + + + helloworldcons.cpp 3 79 40 1051 0.18 125  +  +
    +
    +
    diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/quality/tests/data/helloworldcons/index_5.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/quality/tests/data/helloworldcons/index_5.html Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,11 @@ + + + helloworldcons.cpp 3 79 40 1051 0.18 125  +  +
    +Files: 3578 LOCphy: 1449873 LOCbl: 197449LOCpro: 883402 LOCcom: =
    +483    ';': 432445
    +v(G) : 79966MI without comments  : 92    MI comment weight    : 32    =
    +MI: 125
    +
    diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/antlib.xml --- a/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/antlib.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/antlib.xml Wed Jun 16 16:51:40 2010 +0300 @@ -24,8 +24,8 @@ - - + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/CTCTask.java --- a/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/CTCTask.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/CTCTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,10 @@ */ package com.nokia.helium.sbs.ant.taskdefs; +import java.util.Vector; + +import com.nokia.helium.core.ant.types.VariableSet; + /** * This task is to execute the CTCWrap command with the list of sbs parameters * using sbsinput type. Based on the raptor input list of additional log file path @@ -35,19 +39,45 @@ public class CTCTask extends SBSTask { private String instrumentType = "m"; + private Vector ctcOptions = new Vector(); + /** + * Constructing the task, overriding default executable to be + * ctcwrap. + */ public CTCTask() { super(); getSbsCmd().setExecutable("ctcwrap"); } - public void setInstrumentType(String i) + /** + * Defined the instrumentation type. + * @param instrumentType the instrumentation type. + * @ant.not-required Default is 'm' + */ + public void setInstrumentType(String instrumentType) { - instrumentType = i; + this.instrumentType = instrumentType; } + /** + * Override the command line construction. + */ protected String getSBSCmdLine() { - return "-i " + instrumentType + " sbs" + super.getSBSCmdLine(); + String ctcConfig = ""; + for (VariableSet ctcOption : ctcOptions) { + ctcConfig += " " + ctcOption.getParameter(); + } + return "-i " + instrumentType + ctcConfig + " sbs" + super.getSBSCmdLine(); + } + + /** + * To read the ctc arguments for ctcwrap command. + * + * @param ctcArg + */ + public void addCTCOptions(VariableSet ctcArg) { + ctcOptions.add(ctcArg); } } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/GetSBSInputs.java --- a/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/GetSBSInputs.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* - * 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.sbs.ant.taskdefs; - -import java.util.List; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import com.nokia.helium.sbs.ant.types.*; -import com.nokia.helium.sbs.ant.*; - -/** - * This task provide a way to get the list of sbs command input for a particular - * configuration from abld. For every abld command mentioned for a configuration - * from schema 1.4.0, there should be a corresponding sbsinput and for all - * abld commands in the sysdef configuration a corresponding sbsbuild command has - * to be there. And using this task the list of sbs commands are extracted and executed - * one after another. This is only for backward compatibility, once the sysdef config - * is migrated to 3.0, this task would be deprecated. - * - * This is internal task and should not be used outside helium. - * - *
    - * Example 1:
    - * <getsbsinputs config="sysdef.configuration"
    - *      outputProperty="sbs.internal.list"/>
    - * 
    - * - * @ant.task name="getsbsinputs" category="SBS" - */ - -public class GetSBSInputs extends Task { - - private String configName; - private String outputProperty; - - /** - * Helper function to set the configuration name for - * which the sbs commands to be extracted. - * @param name of the configuration for which sbs commands to be obtained. - */ - public void setConfig(String name) { - configName = name; - } - - /** - * Helper function to retrive the sbs input list (list of sbs commands - * to be executed one after another). The list is provided with comma - * separated values. - * @param property name of the property where the sbs input list to be stored. - */ - public void setOutputProperty(String property) { - outputProperty = property; - } - - /** - * Execute the task. Finds the list of sbsinput and store it in - * outputproperty with comma separated values. - * @throws BuildException - */ - public void execute() { - if (configName == null) { - throw new BuildException("configInput is not defined"); - } - List sbsInputList = SBSBuildList.getSBSInputList(getProject(), configName); - StringBuffer inputs = new StringBuffer(); - for (SBSInput input : sbsInputList) { - if (inputs.length() > 0) { - inputs.append(","); - } - inputs.append(input.getRefid().getRefId()); - getProject().setProperty(outputProperty,inputs.toString()); - } - } -} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/GetSBSInputsTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/GetSBSInputsTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,89 @@ +/* + * 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.sbs.ant.taskdefs; + +import java.util.List; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import com.nokia.helium.sbs.ant.types.*; +import com.nokia.helium.sbs.ant.*; + +/** + * This task provide a way to get the list of sbs command input for a particular + * configuration from abld. For every abld command mentioned for a configuration + * from schema 1.4.0, there should be a corresponding sbsinput and for all + * abld commands in the sysdef configuration a corresponding sbsbuild command has + * to be there. And using this task the list of sbs commands are extracted and executed + * one after another. This is only for backward compatibility, once the sysdef config + * is migrated to 3.0, this task would be deprecated. + * + * This is internal task and should not be used outside helium. + * + *
    + * Example 1:
    + * <getsbsinputs config="sysdef.configuration"
    + *      outputProperty="sbs.internal.list"/>
    + * 
    + * + * @ant.task name="getsbsinputs" category="SBS" + */ + +public class GetSBSInputsTask extends Task { + + private String configName; + private String outputProperty; + + /** + * Helper function to set the configuration name for + * which the sbs commands to be extracted. + * @param name of the configuration for which sbs commands to be obtained. + */ + public void setConfig(String name) { + configName = name; + } + + /** + * Helper function to retrive the sbs input list (list of sbs commands + * to be executed one after another). The list is provided with comma + * separated values. + * @param property name of the property where the sbs input list to be stored. + */ + public void setOutputProperty(String property) { + outputProperty = property; + } + + /** + * Execute the task. Finds the list of sbsinput and store it in + * outputproperty with comma separated values. + * @throws BuildException + */ + public void execute() { + if (configName == null) { + throw new BuildException("configInput is not defined"); + } + List sbsInputList = SBSBuildList.getSBSInputList(getProject(), configName); + StringBuffer inputs = new StringBuffer(); + for (SBSInput input : sbsInputList) { + if (inputs.length() > 0) { + inputs.append(","); + } + inputs.append(input.getRefid().getRefId()); + getProject().setProperty(outputProperty,inputs.toString()); + } + } +} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/SBSCoverity.java --- a/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/SBSCoverity.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* - * 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.sbs.ant.taskdefs; - -import java.util.Vector; -import java.util.Map.Entry; - -import com.nokia.helium.core.ant.types.Variable; -import com.nokia.helium.core.ant.types.VariableSet; - -/** - * This task is to execute the cov-build command with the list of sbs parameters - * using sbsinput type. Based on the raptor input list of additional log file - * path used needs to be set, so that the scanlog, additional log files are - * generated properly. - * - *
    - * Example 1:
    - * 
    - * <coveritybuild sbsinput="sbs.input" sysdefFile="system.def.file"
    - *      workingDir="build.drive" failOnError="false" 
    - *      cleanLog="sbs.log.file.clean.log" 
    - *      failOnError="false" 
    - *      errorfile="path to error file"/>
    - * 
    - * - * @ant.task name="coveritybuild" category="SBS" - */ -public class SBSCoverity extends SBSTask { - - private Vector coverityOptions = new Vector(); - - /** - * Default constructor. - */ - public SBSCoverity() { - super(); - setAddMakeOptions(false); - getSbsCmd().setExecutable("cov-build"); - } - - - protected String getSBSCmdLine() { - - StringBuffer coverityCmdOptions = new StringBuffer(); - - String coverityConfig = ""; - for (VariableSet coverityArg : coverityOptions) { - for (Entry entry : coverityArg.getVariablesMap() - .entrySet()) { - coverityConfig = coverityConfig + entry.getKey() + " " - + entry.getValue().getValue() + " "; - } - } - coverityCmdOptions.append(coverityConfig + "sbs" + super.getSBSCmdLine()); - return coverityCmdOptions.toString(); - - } - - /** - * @param pattern. To set the pattern to be read from error to super class. - */ - protected String getErrorStreamPattern() { - return "ERROR"; - } - - - /** - * To read the coverity arguments for cov-build command. - * - * @param coverityArg - */ - public void addCoverityOptions(VariableSet coverityArg) { - if (!coverityOptions.contains(coverityArg)) { - coverityOptions.add(coverityArg); - } - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/SBSCoverityTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/SBSCoverityTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,80 @@ +/* + * 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.sbs.ant.taskdefs; + +import java.util.Vector; + +import com.nokia.helium.core.ant.types.VariableSet; + +/** + * This task is to execute the cov-build command with the list of sbs parameters + * using sbsinput type. Based on the raptor input list of additional log file + * path used needs to be set, so that the scanlog, additional log files are + * generated properly. + * + *
    + * Example 1:
    + * 
    + * <coveritybuild sbsinput="sbs.input" sysdefFile="system.def.file"
    + *      workingDir="build.drive" failOnError="false" 
    + *      cleanLog="sbs.log.file.clean.log" 
    + *      failOnError="false" 
    + *      errorfile="path to error file"/>
    + * 
    + * + * @ant.task name="coveritybuild" category="SBS" + */ +public class SBSCoverityTask extends SBSTask { + + private Vector coverityOptions = new Vector(); + + /** + * Default constructor. + */ + public SBSCoverityTask() { + super(); + setAddMakeOptions(false); + getSbsCmd().setExecutable("cov-build"); + } + + + protected String getSBSCmdLine() { + String coverityConfig = ""; + for (VariableSet coverityArg : coverityOptions) { + coverityConfig += " " + coverityArg.getParameter(" "); + } + return coverityConfig + " sbs" + super.getSBSCmdLine(); + } + + /** + * @param pattern. To set the pattern to be read from error to super class. + */ + protected String getErrorStreamPattern() { + return "ERROR"; + } + + + /** + * To read the coverity arguments for cov-build command. + * + * @param coverityArg + */ + public void addCoverityOptions(VariableSet coverityArg) { + coverityOptions.add(coverityArg); + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/SBSTask.java --- a/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/SBSTask.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/SBSTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -32,7 +32,8 @@ import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; -import com.nokia.helium.core.ant.types.Variable; + +import com.nokia.helium.core.ant.MappedVariable; import com.nokia.helium.core.ant.types.VariableSet; import com.nokia.helium.sbs.ant.types.*; import org.apache.log4j.Logger; @@ -339,14 +340,20 @@ sbsCmd.addErrorLineHandler(sbsErrorConsumer); } } catch (java.io.FileNotFoundException ex) { - log.info("file path: " + errorFile + "Not valid" ); + log("file path: " + errorFile + "Not valid" ); } startTime = new Date(); try { - log(getSbsCmd().getExecutable() + " commands: " + getSBSCmdLine()); + String cmdLine = getSBSCmdLine(); + if (cmdLine == null) { + // this happens in case there is nothing to be done, let's just run + // sbs anyway so the output log is generated + cmdLine = " --logfile " + getOutputLog().getAbsolutePath(); + } + log(getSbsCmd().getExecutable() + " commands: " + cmdLine); if (executeCmd) { - sbsCmd.execute(getSBSCmdLine()); + sbsCmd.execute(cmdLine); } } catch (SBSException sex) { log.debug("SBS exception occured during sbs execution", sex); @@ -536,14 +543,14 @@ StringBuffer cmdOptions = new StringBuffer(); VariableSet sbsOptions = sbsInput.getFullSBSOptions(); cmdOptions.append(" -s " + sysDefFile); - Collection variableList = sbsOptions.getVariables(); + Collection variableList = sbsOptions.getVariables(); if (sbsOptions != null ) { if (variableList.isEmpty()) { throw new BuildException("sbsoptions cannot be empty for input: " + sbsInputName); } } cmdOptions.append(" --logfile " + getOutputLog().getAbsolutePath()); - for (Variable variable : variableList) { + for (MappedVariable variable : variableList) { if (variable.getParameter().startsWith("--logfile")) { this.log("The following command line argument will be ignored: " + variable.getParameter(), Project.MSG_WARN); } else { @@ -559,10 +566,7 @@ cmdOptions.append(" -j " + ppThreads); } variableList = sbsMakeOptions.getVariables(); - //if (variableList.isEmpty()) { - // throw new BuildException("sbs make options cannot be empty for input: " + sbsInputName); - //} - for (Variable variable : variableList) { + for (MappedVariable variable : variableList) { cmdOptions.append(" --mo="); cmdOptions.append(variable.getParameter()); } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/types/SBSInput.java --- a/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/types/SBSInput.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/types/SBSInput.java Wed Jun 16 16:51:40 2010 +0300 @@ -18,13 +18,14 @@ package com.nokia.helium.sbs.ant.types; import com.nokia.helium.core.ant.types.VariableSet; -import com.nokia.helium.core.ant.VariableIFImpl; +import com.nokia.helium.core.ant.MappedVariable; +import com.nokia.helium.core.ant.VariableMap; import java.util.Collection; -import com.nokia.helium.core.ant.types.Variable; import org.apache.tools.ant.BuildException; import java.util.Vector; + +import org.apache.tools.ant.types.DataType; import org.apache.tools.ant.types.Reference; -import org.apache.log4j.Logger; /** * Helper class to store the variable set (list of variables @@ -37,19 +38,11 @@ * * @ant.type name="sbsinput" category="SBS" */ -public class SBSInput extends VariableIFImpl { - - private static Logger log = Logger.getLogger(SBSInput.class); +public class SBSInput extends DataType implements VariableMap { private Vector sbsOptions = new Vector(); private Vector sbsMakeOptions = new Vector(); private Vector sbsInputList = new Vector(); - - /** - * Constructor - */ - public SBSInput() { - } /** * Creates an empty variable element and adds @@ -235,7 +228,7 @@ } if (fullList != null) { for (VariableSet varSet : fullList) { - for (Variable var : varSet.getVariables()) { + for (MappedVariable var : varSet.getVariables()) { if (resultSet == null) { resultSet = new VariableSet(); } @@ -297,7 +290,7 @@ ppThreads = currentThread; resultSet.setPPThreads(ppThreads); } - for (Variable var : varSet.getVariables()) { + for (MappedVariable var : varSet.getVariables()) { resultSet.add(var); } } @@ -309,8 +302,8 @@ * Helper function to return the collection of variabes associated with this * @return collection of sbs options associatied with this sbsinput. */ - public Collection getVariables() { - Collection varList = null; + public Collection getVariables() { + Collection varList = null; VariableSet options = getFullSBSOptions(); if (options != null) { varList = options.getVariables(); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/types/SBSMakeOptions.java --- a/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/types/SBSMakeOptions.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/types/SBSMakeOptions.java Wed Jun 16 16:51:40 2010 +0300 @@ -18,7 +18,6 @@ package com.nokia.helium.sbs.ant.types; import com.nokia.helium.core.ant.types.VariableSet; -import org.apache.log4j.Logger; import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.BuildException; import java.util.List; @@ -44,19 +43,11 @@ */ public class SBSMakeOptions extends VariableSet { - private static Logger log = Logger.getLogger(SBSMakeOptions.class); - private String engine; private String ppThreads; - private boolean initialized; - /** - * Constructor - */ - public SBSMakeOptions() { - } /** * Helper function called by ant to create the new sbs make options @@ -129,7 +120,6 @@ * input. */ private void initializeAll() { - Object sbsInputObject = null; List varSets = getVariableSets(); initialize(this); for (VariableSet varSet : varSets) { diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sbs/tests/antunit/test_ctc.ant.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/sbs/tests/antunit/test_ctc.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,83 @@ + + + + + Helium Antlib ctc-sbs unittests. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sbs/tests/antunit/test_sbs_coverity.ant.xml --- a/buildframework/helium/sf/java/sbs/tests/antunit/test_sbs_coverity.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/sbs/tests/antunit/test_sbs_coverity.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -26,7 +26,7 @@ - + @@ -50,7 +50,7 @@ workingDir="${working.dir}" execute="false"> - +
    @@ -82,7 +82,7 @@ workingDir="${working.dir}" execute="false"> - +
    @@ -96,11 +96,29 @@ - +
    + + + + + + + + + + + + + + + + +
    \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sbs/tests/antunit/test_sbs_input.ant.xml --- a/buildframework/helium/sf/java/sbs/tests/antunit/test_sbs_input.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/sbs/tests/antunit/test_sbs_input.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -26,7 +26,6 @@ - @@ -66,6 +65,10 @@ + + + + @@ -234,9 +237,9 @@ - + - +
    @@ -258,13 +261,15 @@
    - + + - - + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/AddAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/AddAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,60 @@ +/* + * 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.scm.ant.actions; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.command.add.AddScmResult; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.tools.ant.BuildException; + +/** + * Adding a set of files into SCM control. + * + *
    + * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    + *   <hlm:add>
    + *      <fileset dir="${repo.dir}/test1">
    + *         <include name="**" />
    + *         <exclude name="** /.${repo.type}/**" />
    + *      </fileset>
    + *   </hlm:add>
    + * </hlm:scm>
    + *
    + * 
    + * + * @ant.type name="add" category="SCM" + */ +public class AddAction extends BaseDirectoryScmAction { + + /** + * {@inheritDoc} + * @throws ScmException + */ + @Override + public void execute(ScmRepository repository) throws ScmException { + ScmManager scmManager = getTask().getScmManager(); + + AddScmResult result = scmManager.add(repository, getScmFileSet()); + + if (!result.isSuccess()) { + throw new BuildException("SCM add action failed."); + } + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/BaseDirectoryScmAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/BaseDirectoryScmAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,88 @@ +/* + * 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.scm.ant.actions; + +import java.io.File; +import java.util.ArrayList; + +import org.apache.maven.scm.ScmFileSet; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.DirectoryScanner; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.types.FileSet; + +/** + * Handles configuration of directory-based SCM task commands. + */ +public abstract class BaseDirectoryScmAction extends ScmAction { + private String basedir; + + /** + * Only one fileset is valid because all the SCM commands work on just one + * Sdirectory. + */ + private FileSet fileSet; + + /** + * Get the basedir. + * + * @return the basedir attribute as a string. + */ + public String getBasedir() { + if (fileSet != null) { + return fileSet.getDir(getProject()).getAbsolutePath(); + } + return basedir; + } + + /** + * Location of the current checkout in most of the case. + * + * @param basedir + * the directory to use on the local machine + * + * @ant.required + */ + public void setBasedir(String basedir) { + this.basedir = basedir; + } + + public void addFileset(FileSet set) { + fileSet = set; + } + + public ScmFileSet getScmFileSet() { + ArrayList files = new ArrayList(); + if (fileSet == null) { + if (basedir == null) { + throw new BuildException( + "Need a fileset or basedir attribute to be defined."); + } + return new ScmFileSet(new File(basedir)); + } + DirectoryScanner scanner = fileSet.getDirectoryScanner(getTask() + .getProject()); + String[] fileNames = scanner.getIncludedFiles(); + for (String fileName : fileNames) { + log("ScmFileSet: adding " + fileName, Project.MSG_DEBUG); + files.add(new File(fileName)); + } + ScmFileSet scmFileSet = new ScmFileSet(fileSet.getDir(), files); + return scmFileSet; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/BranchAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/BranchAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.scm.ant.actions; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.command.branch.BranchScmResult; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.tools.ant.BuildException; + + +/** + * This action will create new branch using a specific name. + * + *
    + * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    + *    <hlm:branch baseDir="${repo.dir}/test1" name="test branch 1.0" />
    + * </hlm:scm>
    + * 
    + * + * @ant.type name="branch" category="SCM" + */ +public class BranchAction extends BaseDirectoryScmAction { + + private String name; + + /** + * Sets the branch name + * + * @param name + * @ant.required + */ + public void setName(String name) { + this.name = name; + } + + /** + * {@inheritDoc} + */ + @Override + public void execute(ScmRepository repository) { + + if (name == null) + throw new BuildException("'name' attribute is not defined."); + + ScmManager scmManager = getTask().getScmManager(); + BranchScmResult result; + + try { + result = scmManager.branch(repository, getScmFileSet(), name); + if (!result.isSuccess()) { + throw new BuildException("SCM branch action error: " + + result.getProviderMessage()); + } + getTask().log( + "Branch '" + name + "' has been created successfully."); + } catch (ScmException e) { + throw new BuildException("SCM Branch action failed: " + + e.toString()); + } + + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/ChangelogAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/ChangelogAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,255 @@ +/* + * 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.scm.ant.actions; + +import java.util.Date; +import java.text.SimpleDateFormat; +import java.util.Iterator; +import java.io.*; +import java.text.ParseException; + +import org.dom4j.Document; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; +import org.dom4j.DocumentException; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmRevision; +import org.apache.maven.scm.ChangeSet; +import org.apache.maven.scm.command.changelog.ChangeLogScmResult; +import org.apache.maven.scm.command.changelog.ChangeLogSet; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.tools.ant.BuildException; + + +/** + * Get change log within a date range i.e startDate and endDate; + * OR get change log of a number of days i.e numDays + * OR get change log within a range of starVersion and endVersion + * Parameters either startDate="20090317 18:49:31" endDate="20090318 24:49:31" datePattern="yyyyMMdd HH:mm:ss" + * Or numDays='1' + * Or startVersion="1" endVersion="2" + * Add logOutput="xml" to output log in xml format + * + *
    + * <hlm:scm verbose="false" scmUrl="scm:hg:${repo.dir}/changelog">
    + *     <hlm:changelog basedir="${repo.dir}/changelog" startVersion="1" endVersion="2"/>
    + *     <hlm:changelog baseDir="${repo.dir}/changelog" numDays='1' />
    + * </hlm:scm>
    + * 
    + * + * @ant.type name="changelog" category="SCM" + */ +public class ChangelogAction extends BaseDirectoryScmAction { + + private String startDate; + + private String endDate; + + private String datePattern; + + private String logOutput; + + private int numDays; + + private String startVersion; + + private String endVersion; + private File xmlbom; + + + /** + * Start version + * + * @ant.not-required + */ + public void setStartVersion(String startVersion) { + this.startVersion = startVersion; + } + + /** + * End version + * + * @ant.not-required + */ + public void setEndVersion(String endVersion) { + this.endVersion = endVersion; + } + + /** + * Start date + * + * @ant.not-required + */ + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + /** + * End date + * + * @ant.not-required + */ + public void setEndDate(String endDate) { + this.endDate = endDate; + } + + /** + * Number of days + * + * @ant.not-required + */ + public void setNumDays(int numDays) { + this.numDays = numDays; + } + + /** + * Date pattern default is EEE MMM dd HH:mm:ss yyyy Z + * + * @ant.not-required + */ + public void setDatePattern(String datePattern) { + this.datePattern = datePattern; + } + + /** + * Output pattern default is log output, to get xml output set logoutput=xml + * + * @ant.not-required + */ + public void setLogOutput(String logOutput) + { + this.logOutput = logOutput; + } + + /** + * File for xml output of changeset list + * + * @ant.not-required + */ + public void setXmlbom(File xmlbom) + { + this.xmlbom = xmlbom; + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + @Override + public void execute(ScmRepository repository) throws ScmException + { + ScmManager scmManager = getTask().getScmManager(); + ScmRevision startRevision = new ScmRevision(startVersion); + ScmRevision endRevision = new ScmRevision(endVersion); + + ChangeLogScmResult result; + Date start = null; + Date end = null; + + if (numDays == 0 && (startDate != null || endDate != null) ) + { + try { + SimpleDateFormat format = new SimpleDateFormat(datePattern); + start = format.parse(startDate); + end = format.parse(endDate); + } catch (ParseException e) { + throw new ScmException("Date Format not supported:" + e.getMessage()); + } + } + else + { + start = null; + end = null; + } + try + { + if (startVersion == null) + result = scmManager.changeLog(repository, getScmFileSet(), start, end, numDays, null, datePattern); + else + result = scmManager.changeLog(repository, getScmFileSet(), startRevision, endRevision, datePattern); + } catch (ScmException e) { + throw new BuildException("Execution of SCM changelog action failed."); + } + if (!result.isSuccess()) { + throw new BuildException("SCM changelog command unsuccessful."); + } + // Output changelog information + ChangeLogSet changelogSet = result.getChangeLog(); + if (logOutput != null && logOutput.equals("xml")) + { + getTask().log(changelogSet.toXML()); + } + else if (xmlbom != null) + { + String output = ""; + for (Object object : changelogSet.getChangeSets()) + { + String revision = ""; + ChangeSet changeSet = (ChangeSet)object; + for (String line : changeSet.toString().split("\n")) + { + if (line.contains("revision:")) + revision = line.replace("revision:", ""); + } + + output = output + "" + revision + "" + changeSet.getComment() + "" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(changeSet.getDate()) + ""; + } + String[] path = getTask().getScmUrl().split("/"); + String xml = "untitled\n"; + String thisproject = "" + "" + path[path.length - 1] + "" + "" + getTask().getScmUrl() + "" + "mercurial" + output + "\n"; + xml = xml + thisproject; + try { + if (xmlbom.exists()) + { + SAXReader xmlReader = new SAXReader(); + Document antDoc = xmlReader.read(xmlbom); + for (Iterator iterator = antDoc.selectNodes("//project").iterator(); iterator.hasNext();) + { + boolean equal = false; + Element element = (Element) iterator.next(); + for (Iterator iterator2 = antDoc.selectNodes("//baseline").iterator(); iterator2.hasNext();) + { + Element e2 = (Element) iterator2.next(); + if (e2.getText().equals(getTask().getScmUrl())) + equal = true; + } + if (!equal) + xml = xml + element.asXML() + "\n"; + } + } + xml = xml + ""; + + FileWriter fstream = new FileWriter(xmlbom); + BufferedWriter out = new BufferedWriter(fstream); + out.write(xml); + out.close(); + } catch (DocumentException e) { e.printStackTrace(); } + catch (IOException e) { e.printStackTrace(); } + } + else + { + Iterator iterator = changelogSet.getChangeSets().iterator(); + while (iterator.hasNext()) + { + getTask().log(iterator.next().toString()); + } + } + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/CheckinAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/CheckinAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.scm.ant.actions; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.command.checkin.CheckInScmResult; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.tools.ant.BuildException; + + +/** + * Check in a specific set of files to the repository. + * + *
    + * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    + *    <hlm:checkin message="Adding not_in_repo.txt...">
    + *        <fileset dir="${repo.dir}/test1">
    + *            <include name="not_in_repo.txt" />
    + *            <exclude name="** /.${repo.type}/**" / >
    + *        </fileset >
    + *    </hlm:checkin >
    + * </hlm:scm>
    + * 
    + * + * @ant.type name="checkin" category="SCM" + */ +public class CheckinAction extends BaseDirectoryScmAction { + private String message; + + public String getMessage() { + return message; + } + + /** + * @param message + * the message associated to the commit. + * @ant.required + */ + public void setMessage(String message) { + this.message = message; + } + + @Override + public void execute(ScmRepository repository) throws ScmException { + ScmManager scmManager = getTask().getScmManager(); + + if (message == null) + throw new BuildException( + "'message attribute has not been defined.'"); + + CheckInScmResult result; + try { + result = scmManager.checkIn(repository, getScmFileSet(), message); + } catch (ScmException e) { + throw new BuildException("SCM checkin action failed."); + } + + if (!result.isSuccess()) { + throw new BuildException("SCM checkin action failed."); + } + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/CheckoutAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/CheckoutAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,107 @@ +/* + * 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.scm.ant.actions; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.command.checkout.CheckOutScmResult; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.tools.ant.BuildException; +import org.apache.maven.scm.ScmRevision; +import org.apache.maven.scm.ScmTag; + +import com.nokia.helium.scm.ant.types.Tag; +import com.nokia.helium.scm.ant.types.Revision; + +import java.util.ArrayList; +import java.util.List; + +/** + * Checkout the defined project. Depending on the kind of repository used this + * can mean for example the cloning of a repository in the case of Mercurial or the copying of + * a repository in the case of SVN. + * + *
    + * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test3">
    + *     <hlm:checkout baseDir="${repo.dir}/cloned" />
    + * </hlm:scm>
    + * 
    + * + * @ant.type name="checkout" category="SCM" + */ +public class CheckoutAction extends BaseDirectoryScmAction { + private List tags = new ArrayList(); + private List revisions = new ArrayList(); + + public Tag createTag() { + Tag tag = new Tag(); + add(tag); + return tag; + } + + public void add(Tag tag) { + tags.add(tag); + } + + public Revision createRevision() { + Revision revision = new Revision(); + add(revision); + return revision; + } + + public void add(Revision revision) { + revisions.add(revision); + } + + @Override + public void execute(ScmRepository repository) throws ScmException { + ScmManager scmManager = getTask().getScmManager(); + + if (tags.size() > 1) + throw new ScmException( + "You can only specify one tag nested element."); + + if (revisions.size() > 1) + throw new ScmException( + "You can only specify one revision nested element."); + + if ((tags.size() == 1) && (revisions.size() == 1)) { + throw new ScmException( + "You can not specify nested element 'revision' and 'tag' together."); + } + + CheckOutScmResult result; + try { + if (tags.size() == 1) { + result = scmManager.checkOut(repository, getScmFileSet(), + new ScmTag(tags.get(0).getName())); + } else if (revisions.size() == 1) { + result = scmManager.checkOut(repository, getScmFileSet(), + new ScmRevision(revisions.get(0).getName())); + } else { + result = scmManager.checkOut(repository, getScmFileSet()); + } + } catch (ScmException e) { + throw new BuildException("SCM checkout action failed: " + e); + } + + if (!result.isSuccess()) { + throw new BuildException("SCM checkout action failed."); + } + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/DiffAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/DiffAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,86 @@ +/* + * 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.scm.ant.actions; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmRevision; +import org.apache.maven.scm.command.diff.DiffScmResult; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.tools.ant.BuildException; + + +/** + * Display the difference of the working copy with the latest copy in the + * configured scm url. + * + *
    + * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    + *    <hlm:diff>
    + *        <fileset dir="${repo.dir}/test1">
    + *            <include name="**" />
    + *            <exclude name="** /.${repo.type}/**" />
    + *        </fileset>
    + *    </hlm:diff>
    + * </hlm:scm>
    + * 
    + * + * @ant.type name="diff" category="SCM" + */ +public class DiffAction extends BaseDirectoryScmAction { + private String startVersion; + private String endVersion; + + public String getStartVersion() { + return startVersion; + } + + public void setStartVersion(String startVersion) { + this.startVersion = startVersion; + } + + public String getEndVersion() { + return endVersion; + } + + public void setEndVersion(String endVersion) { + this.endVersion = endVersion; + } + + @Override + public void execute(ScmRepository repository) throws ScmException { + + ScmManager scmManager = getTask().getScmManager(); + DiffScmResult result; + + try { + result = scmManager.diff(repository, getScmFileSet(), + new ScmRevision(startVersion), new ScmRevision(endVersion)); + } catch (ScmException e) { + throw new BuildException("SCM diff action failed." + e.getMessage()); + } + + if (!result.isSuccess()) { + throw new BuildException("SCM diff action failed." + + result.getProviderMessage()); + } + + // Output diff information + log(result.getPatch()); + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/ExportAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/ExportAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,119 @@ +/* + * 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.scm.ant.actions; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmTag; +import org.apache.maven.scm.command.export.ExportScmResult; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.tools.ant.BuildException; + +import com.nokia.helium.scm.ant.types.Tag; + +/** + * Get a snapshot of a particular revision into a folder. + * + *
    + * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test2">
    + *    <hlm:export basedir="${repo.dir}/test2" destpath="${repo.dir}/export" />
    + * </hlm:scm>
    + * 
    + * + * @ant.type name="export" category="SCM" + */ +public class ExportAction extends BaseDirectoryScmAction { + + private File destPath; + private List tags = new ArrayList(); + + /** + * Create a tag sub-element. + * @return the tag element. + */ + public Tag createTag() { + Tag tag = new Tag(); + add(tag); + return tag; + } + + /** + * Add a tag. + * @param tag + */ + public void add(Tag tag) { + tags.add(tag); + } + + /** + * {@inheritDoc} + */ + @Override + public void execute(ScmRepository repository) throws ScmException { + ScmManager scmManager = getTask().getScmManager(); + + if (getDestPath() == null) + throw new ScmException("destPath attribute has not been provided."); + + if (tags.size() > 1) + throw new ScmException( + "You can only specify one tag nested element."); + + ExportScmResult result; + try { + if (tags.size() == 0) { + getTask().log( + "Exporting " + getScmFileSet().getBasedir() + " under " + + getDestPath().getAbsolutePath() + "."); + result = scmManager.export(repository, getScmFileSet(), + getDestPath().getAbsolutePath()); + } else { + String tagName = tags.get(0).getName(); + getTask().log( + "Exporting revision " + tagName + " of " + + getScmFileSet().getBasedir() + " under " + + getDestPath().getAbsolutePath() + "."); + result = scmManager.export(repository, getScmFileSet(), + new ScmTag(tagName), getDestPath().getAbsolutePath()); + } + } catch (ScmException e) { + throw new BuildException("SCM export action failed: " + e); + } + if (!result.isSuccess()) { + throw new BuildException("SCM export action failed: " + + result.getProviderMessage()); + } + // Dump created files. + for (Object file : result.getExportedFiles().toArray()) { + getTask().log(file.toString()); + } + } + + public File getDestPath() { + return destPath; + } + + public void setDestPath(File destPath) { + this.destPath = destPath; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/InfoAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/InfoAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,64 @@ +/* + * 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.scm.ant.actions; + +import java.io.File; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.tools.ant.BuildException; + +import com.nokia.maven.scm.command.info.InfoScmResult; +import com.nokia.maven.scm.manager.ExtendedScmManager; + +/** + * This action will display the global revision id for the repository. + * + *
    + * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    + *    <hlm:checkout baseDir="${repo.dir}/info" />
    + *    <hlm:info baseDir="${repo.dir}/info"/>
    + * </hlm:scm>
    + * 
    + * + * @ant.type name="info" category="SCM" + */ +public class InfoAction extends BaseDirectoryScmAction { + + + @Override + public void execute(ScmRepository repository) throws ScmException { + InfoScmResult result; + try { + ExtendedScmManager scmManager = (ExtendedScmManager) getTask() + .getScmManager(); + result = scmManager.info(repository, new File(this.getBasedir())); + + if (!result.isSuccess()) { + throw new BuildException("SCM tags action error: " + + result.getProviderMessage()); + } + getTask().log(result.getRevision()); + + } catch (ScmException e) { + throw new BuildException("SCM info action failed: " + + e.getMessage()); + } + + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/InitAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/InitAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.scm.ant.actions; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; + +import com.nokia.maven.scm.provider.ScmProviderExt; + +/** + * Create a new repository. In the following example the new_repo mercurial repository + * will be created under /some/path/. E.g: + * + *
    + * <hlm:scm verbose="true" scmUrl="scm:hg:/some/path/new_repo">
    + *     <hlm:checkout baseDir="scm:hg:/some/path/new_repo" />
    + * </hlm:scm>
    + * 
    + * + * @ant.type name="init" category="SCM" + */ +public class InitAction extends BaseDirectoryScmAction { + + /** + * {@inheritDoc} + */ + @Override + public void execute(ScmRepository repository) throws ScmException { + ScmManager scmManager = getTask().getScmManager(); + ScmProvider provider = scmManager.getProviderByUrl(getTask().getScmUrl()); + + getTask().log("InitAction: " + repository); + ScmProviderExt providerExt = (ScmProviderExt) provider; + providerExt.init(repository); + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/PullAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/PullAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.scm.ant.actions; + +import java.io.File; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.tools.ant.BuildException; + +import com.nokia.maven.scm.command.pull.PullScmResult; +import com.nokia.maven.scm.manager.ExtendedScmManager; + +/** + * Retrieve a set of changes from a remote database. This action is only + * supported in distributed SCM such as Mercurial or Git. + * + * @ant.type name="pull" category="SCM" + */ +public class PullAction extends BaseDirectoryScmAction { + @Override + public void execute(ScmRepository repository) throws ScmException { + PullScmResult result; + try { + ExtendedScmManager scmManager = (ExtendedScmManager) getTask() + .getScmManager(); + result = scmManager.pull(repository, new File(this.getBasedir())); + if (!result.isSuccess()) { + throw new BuildException("SCM pull action error: " + + result.getProviderMessage()); + } + } catch (ScmException e) { + throw new BuildException("SCM pull action failed: " + + e.getMessage()); + } + + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/RemoveAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/RemoveAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,77 @@ +/* + * 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.scm.ant.actions; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.command.remove.RemoveScmResult; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.tools.ant.BuildException; + + +/** + * Remove a set of file(s) from SCM control. + * + *
    + * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    + *    <hlm:remove message="Nothing to remove...">
    + *        <fileset dir="${repo.dir}/test1">
    + *            <include name="not_in_repo.txt" />
    + *        </fileset>
    + *    </hlm:remove>
    + * </hlm:scm>
    + * 
    + * + * @ant.type name="remove" category="SCM" + */ +public class RemoveAction extends BaseDirectoryScmAction { + private String message; + + public String getMessage() { + return message; + } + + /** + * @param message + * the message associated to the change + * @ant.required + */ + public void setMessage(String message) { + this.message = message; + } + + @Override + public void execute(ScmRepository repository) throws ScmException { + if (message == null) + throw new BuildException("message attribute has not been defined."); + // if (getBasedir() == null) + // throw new BuildException("basedir attribute has not been defined."); + + ScmManager scmManager = getTask().getScmManager(); + RemoveScmResult result; + try { + result = scmManager.remove(repository, getScmFileSet(), message); + } catch (ScmException e) { + throw new BuildException("SCM remove action failed: " + e); + } + + if (!result.isSuccess()) { + throw new BuildException("SCM remove action failed."); + } + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/ScmAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/ScmAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,71 @@ +/* + * 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.scm.ant.actions; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.tools.ant.ProjectComponent; + +import com.nokia.helium.scm.ant.taskdefs.ScmTask; + +/** + * Abstract class which implements common setting between + * ScmAction implementations. + * + * Any implementing action must implement the execute method as + * a execution of the action. The owning task should be used + * to log message to the user. + */ +public abstract class ScmAction extends ProjectComponent { + private ScmTask scmtask; + + /** + * @return the task + */ + public ScmTask getTask() { + return scmtask; + } + + /** + * @param task + * the task to set + */ + public void setTask(ScmTask task) { + this.scmtask = task; + } + + /** + * Get the action name based on the classname. + * @return the lowercase class name. + */ + public String getName() { + String className = getClass().getName(); + String commandName = className + .substring(className.lastIndexOf('.') + 1).toLowerCase(); + return commandName; + } + + /** + * This method needs to be implemented by your subclass. + * It is executed during the Task execute to achieve + * the relevant action. + * @param repository + * @throws ScmException + */ + public abstract void execute(ScmRepository repository) throws ScmException; +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/StatusAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/StatusAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.scm.ant.actions; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.command.status.StatusScmResult; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.tools.ant.BuildException; + + +/** + * Status will execute status action on the relevant repository, and reports + * basedir, or a specific set of file status. + * + *
    + * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    + *    <hlm:status>
    + *       <fileset dir="${repo.dir}/test1">
    + *          <include name="**" />
    + *          <exclude name="** /.${repo.type}/**" />
    + *       </fileset>
    + *    </hlm:status>
    + * </hlm:scm >
    + * 
    + * + * @ant.type name="status" category="SCM" + */ +public class StatusAction extends BaseDirectoryScmAction { + + @Override + public void execute(ScmRepository repository) throws ScmException { + ScmManager scmManager = getTask().getScmManager(); + + StatusScmResult result = scmManager.status(repository, getScmFileSet()); + + if (!result.isSuccess()) { + throw new BuildException("SCM status action failed: " + + result.getProviderMessage()); + } + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/TagAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/TagAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,98 @@ +/* + * 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.scm.ant.actions; + +import java.io.File; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.command.tag.TagScmResult; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.tools.ant.BuildException; + +import com.nokia.maven.scm.manager.ExtendedScmManager; + +/** + * This action will tag current repository revision using a specific name. + * + *
    + * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    + *     <hlm:tag baseDir="${repo.dir}/test1" name="0.0.1" />
    + * </hlm:scm>
    + * 
    + * + * @ant.type name="tag" category="SCM" + */ +public class TagAction extends BaseDirectoryScmAction { + private String name; + private String level = "normal"; + + /** + * String that will be used to tag the current revision. + * + * @param name + * Name of the tag + * @ant.required + */ + public void setName(String name) { + this.name = name; + } + + /** + * String that will be used to determine tag types, eg. local. + * + * @param level + * Level of the tag eg.local + * @ant.not-required + */ + public void setLevel(String level) { + this.level = level; + } + + @Override + public void execute(ScmRepository repository) throws ScmException { + TagScmResult result; + + if (name == null) + throw new BuildException("'name' attribute is not defined."); + + if (getBasedir() == null) + throw new BuildException("'basedir' attribute is not defined."); + + try { + ExtendedScmManager scmManager = (ExtendedScmManager) getTask() + .getScmManager(); + if (level.equals(new String("local"))) { + result = scmManager.tag(repository, new ScmFileSet(new File( + getBasedir())), name, level); + } else { + result = scmManager.tag(repository, new ScmFileSet(new File( + getBasedir())), name); + } + + if (!result.isSuccess()) { + throw new BuildException("SCM tag action error: " + + result.getProviderMessage()); + } + getTask().log("Tag '" + name + "' has been created successfully."); + } catch (ScmException e) { + throw new BuildException("SCM tag action failed: " + e.toString()); + } + + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/TagsAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/TagsAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,92 @@ +/* + * 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.scm.ant.actions; + +import java.io.File; +import java.util.List; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmTag; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.tools.ant.BuildException; + +import com.nokia.helium.scm.ant.types.TagSet; +import com.nokia.maven.scm.command.tags.TagsScmResult; +import com.nokia.maven.scm.manager.ExtendedScmManager; + +/** + * This action will tag current repository revision using a specific name. + * + *
    + * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    + *     <hlm:tags baseDir="${repo.dir}/test1" reference="my.tags" />
    + * </hlm:scm>
    + * 
    + * + * @ant.type name="tags" category="SCM" + */ +public class TagsAction extends BaseDirectoryScmAction { + + private String reference; + + /** + * Defines the id of the result type generated by the query. + * @param reference the name of the reference to use. + * @ant.not-required Only log result by default. + */ + public void setReference(String reference) { + this.reference = reference; + } + + /** + * {@inheritDoc} + */ + @Override + public void execute(ScmRepository repository) throws ScmException { + TagsScmResult result; + try { + ExtendedScmManager scmManager = (ExtendedScmManager) getTask() + .getScmManager(); + result = scmManager.tags(repository, new File(this.getBasedir())); + if (!result.isSuccess()) { + throw new BuildException("SCM tags action error: " + + result.getProviderMessage()); + } + + // Creating a TagSet + List tags = result.getTags(); + TagSet tagSet = new TagSet(); + tagSet.setProject(getProject()); + getTask().log("Tag list:"); + for (ScmTag tag : tags) { + tagSet.createTag().setName(tag.getName()); + getTask().log(" * " + tag.getName()); + } + // Creating new reference + if (reference != null) { + getTask().log("Creating reference: " + reference); + getProject().addReference(reference, tagSet); + } + + } catch (ScmException e) { + throw new BuildException("SCM tags action failed: " + + e.getMessage()); + } + + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/UpdateAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/actions/UpdateAction.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,96 @@ +/* + * 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.scm.ant.actions; + +import java.util.List; + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmTag; +import org.apache.maven.scm.command.update.UpdateScmResult; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.tools.ant.BuildException; +import org.apache.maven.scm.ScmRevision; + +import com.nokia.helium.scm.ant.types.Tag; +import com.nokia.helium.scm.ant.types.Revision; + +/** + * Update the defined project for a specific revision or tag. + * + *
    + * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    + *     <hlm:update basedir="${repo.dir}/test1" />
    + * </hlm:scm>
    + *
    + * + * @ant.type name="update" category="SCM" + */ +public class UpdateAction extends BaseDirectoryScmAction { + + private Tag tag; + private Revision revision; + + public void add(Tag tag) { + this.tag = tag; + } + + public Tag createTag() { + this.tag = new Tag(); + return this.tag; + } + + public void add(Revision revision) { + this.revision = revision; + } + + public Revision createRevision() { + this.revision = new Revision(); + return this.revision; + } + + @Override + @SuppressWarnings("unchecked") + public void execute(ScmRepository repository) throws ScmException { + ScmManager scmManager = getTask().getScmManager(); + + UpdateScmResult result; + if (tag != null) { + result = scmManager.update(repository, getScmFileSet(), + new ScmTag(tag.getName())); + } else if (revision != null) { + result = scmManager.update(repository, getScmFileSet(), + new ScmRevision(revision.getName())); + } else { + result = scmManager.update(repository, getScmFileSet()); + } + + if (!result.isSuccess()) { + throw new BuildException("SCM update action error: " + + result.getProviderMessage()); + } + + List files = result.getUpdatedFiles(); + for (ScmFile scmFile : files) { + getTask().log(scmFile.toString()); + } + + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/AddAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/AddAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.command.add.AddScmResult; -import org.apache.maven.scm.manager.ScmManager; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.tools.ant.BuildException; - -/** - * Adding a set of files into SCM control. - * - *
    - * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    - *   <hlm:add>
    - *      <fileset dir="${repo.dir}/test1">
    - *         <include name="**" />
    - *         <exclude name="** /.${repo.type}/**" />
    - *      </fileset>
    - *   </hlm:add>
    - * </hlm:scm>
    - *
    - * 
    - * - * @ant.type name="add" category="SCM" - */ -public class AddAction extends BaseDirectoryScmAction { - - /** - * {@inheritDoc} - * @throws ScmException - */ - @Override - public void execute(ScmRepository repository) throws ScmException { - ScmManager scmManager = getTask().getScmManager(); - - AddScmResult result = scmManager.add(repository, getScmFileSet()); - - if (!result.isSuccess()) { - throw new BuildException("SCM add action failed."); - } - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/BaseDirectoryScmAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/BaseDirectoryScmAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import java.io.File; -import java.util.ArrayList; - -import org.apache.maven.scm.ScmFileSet; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.types.FileSet; - -/** - * Handles configuration of directory-based SCM task commands. - */ -public abstract class BaseDirectoryScmAction extends ScmAction { - private String basedir; - - /** - * Only one fileset is valid because all the SCM commands work on just one - * Sdirectory. - */ - private FileSet fileSet; - - /** - * Get the basedir. - * - * @return the basedir attribute as a string. - */ - public String getBasedir() { - if (fileSet != null) { - return fileSet.getDir(getProject()).getAbsolutePath(); - } - return basedir; - } - - /** - * Location of the current checkout in most of the case. - * - * @param basedir - * the directory to use on the local machine - * - * @ant.required - */ - public void setBasedir(String basedir) { - this.basedir = basedir; - } - - public void addFileset(FileSet set) { - fileSet = set; - } - - public ScmFileSet getScmFileSet() { - ArrayList files = new ArrayList(); - if (fileSet == null) { - if (basedir == null) { - throw new BuildException( - "Need a fileset or basedir attribute to be defined."); - } - return new ScmFileSet(new File(basedir)); - } - DirectoryScanner scanner = fileSet.getDirectoryScanner(getTask() - .getProject()); - String[] fileNames = scanner.getIncludedFiles(); - for (String fileName : fileNames) { - log("ScmFileSet: adding " + fileName, Project.MSG_DEBUG); - files.add(new File(fileName)); - } - ScmFileSet scmFileSet = new ScmFileSet(fileSet.getDir(), files); - return scmFileSet; - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/BranchAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/BranchAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.command.branch.BranchScmResult; -import org.apache.maven.scm.manager.ScmManager; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.tools.ant.BuildException; - -/** - * This action will create new branch using a specific name. - * - *
    - * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    - *    <hlm:branch baseDir="${repo.dir}/test1" name="test branch 1.0" />
    - * </hlm:scm>
    - * 
    - * - * @ant.type name="branch" category="SCM" - */ -public class BranchAction extends BaseDirectoryScmAction { - - private String name; - - /** - * Sets the branch name - * - * @param name - * @ant.required - */ - public void setName(String name) { - this.name = name; - } - - /** - * {@inheritDoc} - */ - @Override - public void execute(ScmRepository repository) { - - if (name == null) - throw new BuildException("'name' attribute is not defined."); - - ScmManager scmManager = getTask().getScmManager(); - BranchScmResult result; - - try { - result = scmManager.branch(repository, getScmFileSet(), name); - if (!result.isSuccess()) { - throw new BuildException("SCM branch action error: " - + result.getProviderMessage()); - } - getTask().log( - "Branch '" + name + "' has been created successfully."); - } catch (ScmException e) { - throw new BuildException("SCM Branch action failed: " - + e.toString()); - } - - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/ChangelogAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/ChangelogAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,256 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import java.util.Date; -import java.text.SimpleDateFormat; -import java.util.Iterator; -import java.io.*; -import java.io.IOException; -import java.text.ParseException; - -import org.dom4j.Document; -import org.dom4j.Element; -import org.dom4j.io.SAXReader; -import org.dom4j.DocumentException; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.ScmRevision; -import org.apache.maven.scm.ChangeSet; -import org.apache.maven.scm.command.changelog.ChangeLogScmResult; -import org.apache.maven.scm.command.changelog.ChangeLogSet; -import org.apache.maven.scm.manager.ScmManager; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.tools.ant.BuildException; - -/** - * Get change log within a date range i.e startDate and endDate; - * OR get change log of a number of days i.e numDays - * OR get change log within a range of starVersion and endVersion - * Parameters either startDate="20090317 18:49:31" endDate="20090318 24:49:31" datePattern="yyyyMMdd HH:mm:ss" - * Or numDays='1' - * Or startVersion="1" endVersion="2" - * Add logOutput="xml" to output log in xml format - * - *
    - * <hlm:scm verbose="false" scmUrl="scm:hg:${repo.dir}/changelog">
    - *     <hlm:changelog basedir="${repo.dir}/changelog" startVersion="1" endVersion="2"/>
    - *     <hlm:changelog baseDir="${repo.dir}/changelog" numDays='1' />
    - * </hlm:scm>
    - * 
    - * - * @ant.type name="changelog" category="SCM" - */ -public class ChangelogAction extends BaseDirectoryScmAction { - - private String startDate; - - private String endDate; - - private String datePattern; - - private String logOutput; - - private int numDays; - - private String startVersion; - - private String endVersion; - private File xmlbom; - - - /** - * Start version - * - * @ant.not-required - */ - public void setStartVersion(String startVersion) { - this.startVersion = startVersion; - } - - /** - * End version - * - * @ant.not-required - */ - public void setEndVersion(String endVersion) { - this.endVersion = endVersion; - } - - /** - * Start date - * - * @ant.not-required - */ - public void setStartDate(String startDate) { - this.startDate = startDate; - } - - /** - * End date - * - * @ant.not-required - */ - public void setEndDate(String endDate) { - this.endDate = endDate; - } - - /** - * Number of days - * - * @ant.not-required - */ - public void setNumDays(int numDays) { - this.numDays = numDays; - } - - /** - * Date pattern default is EEE MMM dd HH:mm:ss yyyy Z - * - * @ant.not-required - */ - public void setDatePattern(String datePattern) { - this.datePattern = datePattern; - } - - /** - * Output pattern default is log output, to get xml output set logoutput=xml - * - * @ant.not-required - */ - public void setLogOutput(String logOutput) - { - this.logOutput = logOutput; - } - - /** - * File for xml output of changeset list - * - * @ant.not-required - */ - public void setXmlbom(File xmlbom) - { - this.xmlbom = xmlbom; - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - @Override - public void execute(ScmRepository repository) throws ScmException - { - ScmManager scmManager = getTask().getScmManager(); - ScmRevision startRevision = new ScmRevision(startVersion); - ScmRevision endRevision = new ScmRevision(endVersion); - - ChangeLogScmResult result; - Date start = null; - Date end = null; - - if (numDays == 0 && (startDate != null || endDate != null) ) - { - try { - SimpleDateFormat format = new SimpleDateFormat(datePattern); - start = format.parse(startDate); - end = format.parse(endDate); - } catch (ParseException e) { - throw new ScmException("Date Format not supported:" + e.getMessage()); - } - } - else - { - start = null; - end = null; - } - try - { - if (startVersion == null) - result = scmManager.changeLog(repository, getScmFileSet(), start, end, numDays, null, datePattern); - else - result = scmManager.changeLog(repository, getScmFileSet(), startRevision, endRevision, datePattern); - } catch (ScmException e) { - throw new BuildException( - "Execution of SCM changelog action failed."); - } - if (!result.isSuccess()) { - throw new BuildException("SCM changelog command unsuccessful."); - } - // Output changelog information - ChangeLogSet changelogSet = result.getChangeLog(); - if (logOutput != null && logOutput.equals("xml")) - { - getTask().log(changelogSet.toXML()); - } - else if (xmlbom != null) - { - String output = ""; - for (Object o : changelogSet.getChangeSets()) - { - String revision = ""; - ChangeSet c = (ChangeSet)o; - for (String x : c.toString().split("\n")) - { - if (x.contains("revision:")) - revision = x.replace("revision:", ""); - } - - output = output + "" + revision + "" + c.getComment() + "" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(c.getDate()) + ""; - } - String[] path = getTask().getScmUrl().split("/"); - String xml = "untitled\n"; - String thisproject = "" + "" + path[path.length - 1] + "" + "" + getTask().getScmUrl() + "" + "mercurial" + output + "\n"; - xml = xml + thisproject; - try { - if (xmlbom.exists()) - { - SAXReader xmlReader = new SAXReader(); - Document antDoc = xmlReader.read(xmlbom); - for (Iterator iterator = antDoc.selectNodes("//project").iterator(); iterator.hasNext();) - { - boolean equal = false; - Element e = (Element) iterator.next(); - for (Iterator iterator2 = antDoc.selectNodes("//baseline").iterator(); iterator2.hasNext();) - { - Element e2 = (Element) iterator2.next(); - if (e2.getText().equals(getTask().getScmUrl())) - equal = true; - } - if (!equal) - xml = xml + e.asXML() + "\n"; - } - } - xml = xml + ""; - - FileWriter fstream = new FileWriter(xmlbom); - BufferedWriter out = new BufferedWriter(fstream); - out.write(xml); - out.close(); - } catch (DocumentException e) { e.printStackTrace(); } - catch (IOException e) { e.printStackTrace(); } - } - else - { - Iterator iterator = changelogSet.getChangeSets().iterator(); - while (iterator.hasNext()) - { - getTask().log(iterator.next().toString()); - } - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/CheckinAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/CheckinAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.command.checkin.CheckInScmResult; -import org.apache.maven.scm.manager.ScmManager; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.tools.ant.BuildException; - -/** - * Check in a specific set of files to the repository. - * - *
    - * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    - *    <hlm:checkin message="Adding not_in_repo.txt...">
    - *        <fileset dir="${repo.dir}/test1">
    - *            <include name="not_in_repo.txt" />
    - *            <exclude name="** /.${repo.type}/**" / >
    - *        </fileset >
    - *    </hlm:checkin >
    - * </hlm:scm>
    - * 
    - * - * @ant.type name="checkin" category="SCM" - */ -public class CheckinAction extends BaseDirectoryScmAction { - private String message; - - public String getMessage() { - return message; - } - - /** - * @param message - * the message associated to the commit. - * @ant.required - */ - public void setMessage(String message) { - this.message = message; - } - - @Override - public void execute(ScmRepository repository) throws ScmException { - ScmManager scmManager = getTask().getScmManager(); - - if (message == null) - throw new BuildException( - "'message attribute has not been defined.'"); - - CheckInScmResult result; - try { - result = scmManager.checkIn(repository, getScmFileSet(), message); - } catch (ScmException e) { - throw new BuildException("SCM checkin action failed."); - } - - if (!result.isSuccess()) { - throw new BuildException("SCM checkin action failed."); - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/CheckoutAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/CheckoutAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.command.checkout.CheckOutScmResult; -import org.apache.maven.scm.manager.ScmManager; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.tools.ant.BuildException; -import org.apache.maven.scm.ScmRevision; -import org.apache.maven.scm.ScmTag; - -import com.nokia.helium.scm.ant.types.Tag; -import com.nokia.helium.scm.ant.types.Revision; - -import java.util.ArrayList; -import java.util.List; - -/** - * Checkout the defined project. Depending on the kind of repository used this - * can mean for example the cloning of a repository in the case of Mercurial or the copying of - * a repository in the case of SVN. - * - *
    - * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test3">
    - *     <hlm:checkout baseDir="${repo.dir}/cloned" />
    - * </hlm:scm>
    - * 
    - * - * @ant.type name="checkout" category="SCM" - */ -public class CheckoutAction extends BaseDirectoryScmAction { - private List tags = new ArrayList(); - private List revisions = new ArrayList(); - - public Tag createTag() { - Tag tag = new Tag(); - add(tag); - return tag; - } - - public void add(Tag tag) { - tags.add(tag); - } - - public Revision createRevision() { - Revision revision = new Revision(); - add(revision); - return revision; - } - - public void add(Revision revision) { - revisions.add(revision); - } - - @Override - public void execute(ScmRepository repository) throws ScmException { - ScmManager scmManager = getTask().getScmManager(); - - if (tags.size() > 1) - throw new ScmException( - "You can only specify one tag nested element."); - - if (revisions.size() > 1) - throw new ScmException( - "You can only specify one revision nested element."); - - if ((tags.size() == 1) && (revisions.size() == 1)) { - throw new ScmException( - "You can not specify nested element 'revision' and 'tag' together."); - } - - CheckOutScmResult result; - try { - if (tags.size() == 1) { - result = scmManager.checkOut(repository, getScmFileSet(), - new ScmTag(tags.get(0).getName())); - } else if (revisions.size() == 1) { - result = scmManager.checkOut(repository, getScmFileSet(), - new ScmRevision(revisions.get(0).getName())); - } else { - result = scmManager.checkOut(repository, getScmFileSet()); - } - } catch (ScmException e) { - throw new BuildException("SCM checkout action failed: " + e); - } - - if (!result.isSuccess()) { - throw new BuildException("SCM checkout action failed."); - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/DiffAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/DiffAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.ScmRevision; -import org.apache.maven.scm.command.diff.DiffScmResult; -import org.apache.maven.scm.manager.ScmManager; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.tools.ant.BuildException; - -/** - * Display the difference of the working copy with the latest copy in the - * configured scm url. - * - *
    - * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    - *    <hlm:diff>
    - *        <fileset dir="${repo.dir}/test1">
    - *            <include name="**" />
    - *            <exclude name="** /.${repo.type}/**" />
    - *        </fileset>
    - *    </hlm:diff>
    - * </hlm:scm>
    - * 
    - * - * @ant.type name="diff" category="SCM" - */ -public class DiffAction extends BaseDirectoryScmAction { - private String startVersion; - private String endVersion; - - public String getStartVersion() { - return startVersion; - } - - public void setStartVersion(String startVersion) { - this.startVersion = startVersion; - } - - public String getEndVersion() { - return endVersion; - } - - public void setEndVersion(String endVersion) { - this.endVersion = endVersion; - } - - @Override - public void execute(ScmRepository repository) throws ScmException { - - ScmManager scmManager = getTask().getScmManager(); - DiffScmResult result; - - try { - result = scmManager.diff(repository, getScmFileSet(), - new ScmRevision(startVersion), new ScmRevision(endVersion)); - } catch (ScmException e) { - throw new BuildException("SCM diff action failed." + e.getMessage()); - } - - if (!result.isSuccess()) { - throw new BuildException("SCM diff action failed." - + result.getProviderMessage()); - } - - // Output diff information - log(result.getPatch()); - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/ExportAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/ExportAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.ScmTag; -import org.apache.maven.scm.command.export.ExportScmResult; -import org.apache.maven.scm.manager.ScmManager; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.tools.ant.BuildException; - -import com.nokia.helium.scm.ant.types.Tag; - -/** - * Get a snapshot of a particular revision into a folder. - * - *
    - * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test2">
    - *    <hlm:export basedir="${repo.dir}/test2" destpath="${repo.dir}/export" />
    - * </hlm:scm>
    - * 
    - * - * @ant.type name="export" category="SCM" - */ -public class ExportAction extends BaseDirectoryScmAction { - - private File destPath; - private List tags = new ArrayList(); - - /** - * Create a tag sub-element. - * @return the tag element. - */ - public Tag createTag() { - Tag tag = new Tag(); - add(tag); - return tag; - } - - /** - * Add a tag. - * @param tag - */ - public void add(Tag tag) { - tags.add(tag); - } - - /** - * {@inheritDoc} - */ - @Override - public void execute(ScmRepository repository) throws ScmException { - ScmManager scmManager = getTask().getScmManager(); - - if (getDestPath() == null) - throw new ScmException("destPath attribute has not been provided."); - - if (tags.size() > 1) - throw new ScmException( - "You can only specify one tag nested element."); - - ExportScmResult result; - try { - if (tags.size() == 0) { - getTask().log( - "Exporting " + getScmFileSet().getBasedir() + " under " - + getDestPath().getAbsolutePath() + "."); - result = scmManager.export(repository, getScmFileSet(), - getDestPath().getAbsolutePath()); - } else { - String t = tags.get(0).getName(); - getTask().log( - "Exporting revision " + t + " of " - + getScmFileSet().getBasedir() + " under " - + getDestPath().getAbsolutePath() + "."); - result = scmManager.export(repository, getScmFileSet(), - new ScmTag(t), getDestPath().getAbsolutePath()); - } - } catch (ScmException e) { - throw new BuildException("SCM export action failed: " + e); - } - if (!result.isSuccess()) { - throw new BuildException("SCM export action failed: " - + result.getProviderMessage()); - } - // Dump created files. - for (Object file : result.getExportedFiles().toArray()) { - getTask().log(file.toString()); - } - } - - public File getDestPath() { - return destPath; - } - - public void setDestPath(File destPath) { - this.destPath = destPath; - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/InfoAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/InfoAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import java.io.File; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.tools.ant.BuildException; - -import com.nokia.maven.scm.command.info.InfoScmResult; -import com.nokia.maven.scm.manager.ExtendedScmManager; - -/** - * This action will display the global revision id for the repository. - * - *
    - * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    - *    <hlm:checkout baseDir="${repo.dir}/info" />
    - *    <hlm:info baseDir="${repo.dir}/info"/>
    - * </hlm:scm>
    - * 
    - * - * @ant.type name="info" category="SCM" - */ -public class InfoAction extends BaseDirectoryScmAction { - - - @Override - public void execute(ScmRepository repository) throws ScmException { - InfoScmResult result; - try { - ExtendedScmManager scmManager = (ExtendedScmManager) getTask() - .getScmManager(); - result = scmManager.info(repository, new File(this.getBasedir())); - - if (!result.isSuccess()) { - throw new BuildException("SCM tags action error: " - + result.getProviderMessage()); - } - getTask().log(result.getRevision()); - - } catch (ScmException e) { - throw new BuildException("SCM info action failed: " - + e.getMessage()); - } - - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/InitAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/InitAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.manager.ScmManager; -import org.apache.maven.scm.provider.ScmProvider; -import org.apache.maven.scm.repository.ScmRepository; - -import com.nokia.maven.scm.provider.ScmProviderExt; - -/** - * Create a new repository. In the following example the new_repo mercurial repository - * will be created under /some/path/. E.g: - * - *
    - * <hlm:scm verbose="true" scmUrl="scm:hg:/some/path/new_repo">
    - *     <hlm:checkout baseDir="scm:hg:/some/path/new_repo" />
    - * </hlm:scm>
    - * 
    - * - * @ant.type name="init" category="SCM" - */ -public class InitAction extends BaseDirectoryScmAction { - - /** - * {@inheritDoc} - */ - @Override - public void execute(ScmRepository repository) throws ScmException { - ScmManager scmManager = getTask().getScmManager(); - ScmProvider provider = scmManager.getProviderByUrl(getTask().getScmUrl()); - - getTask().log("InitAction: " + repository); - ScmProviderExt providerExt = (ScmProviderExt) provider; - providerExt.init(repository); - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/PullAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/PullAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import java.io.File; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.tools.ant.BuildException; - -import com.nokia.maven.scm.command.pull.PullScmResult; -import com.nokia.maven.scm.manager.ExtendedScmManager; - -/** - * Retrieve a set of changes from a remote database. This action is only - * supported in distributed SCM such as Mercurial or Git. - * - * @ant.type name="pull" category="SCM" - */ -public class PullAction extends BaseDirectoryScmAction { - @Override - public void execute(ScmRepository repository) throws ScmException { - PullScmResult result; - try { - ExtendedScmManager scmManager = (ExtendedScmManager) getTask() - .getScmManager(); - result = scmManager.pull(repository, new File(this.getBasedir())); - if (!result.isSuccess()) { - throw new BuildException("SCM pull action error: " - + result.getProviderMessage()); - } - } catch (ScmException e) { - throw new BuildException("SCM pull action failed: " - + e.getMessage()); - } - - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/RemoveAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/RemoveAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.command.remove.RemoveScmResult; -import org.apache.maven.scm.manager.ScmManager; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.tools.ant.BuildException; - -/** - * Remove a set of file(s) from SCM control. - * - *
    - * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    - *    <hlm:remove message="Nothing to remove...">
    - *        <fileset dir="${repo.dir}/test1">
    - *            <include name="not_in_repo.txt" />
    - *        </fileset>
    - *    </hlm:remove>
    - * </hlm:scm>
    - * 
    - * - * @ant.type name="remove" category="SCM" - */ -public class RemoveAction extends BaseDirectoryScmAction { - private String message; - - public String getMessage() { - return message; - } - - /** - * @param message - * the message associated to the change - * @ant.required - */ - public void setMessage(String message) { - this.message = message; - } - - @Override - public void execute(ScmRepository repository) throws ScmException { - if (message == null) - throw new BuildException("message attribute has not been defined."); - // if (getBasedir() == null) - // throw new BuildException("basedir attribute has not been defined."); - - ScmManager scmManager = getTask().getScmManager(); - RemoveScmResult result; - try { - result = scmManager.remove(repository, getScmFileSet(), message); - } catch (ScmException e) { - throw new BuildException("SCM remove action failed: " + e); - } - - if (!result.isSuccess()) { - throw new BuildException("SCM remove action failed."); - } - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/ScmAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/ScmAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.tools.ant.ProjectComponent; - -/** - * Abstract class which implements common setting between - * ScmAction implementations. - * - * Any implementing action must implement the execute method as - * a execution of the action. The owning task should be used - * to log message to the user. - */ -public abstract class ScmAction extends ProjectComponent { - private ScmTask scmtask; - - /** - * @return the task - */ - public ScmTask getTask() { - return scmtask; - } - - /** - * @param task - * the task to set - */ - public void setTask(ScmTask task) { - this.scmtask = task; - } - - /** - * Get the action name based on the classname. - * @return the lowercase class name. - */ - public String getName() { - String className = getClass().getName(); - String commandName = className - .substring(className.lastIndexOf('.') + 1).toLowerCase(); - return commandName; - } - - /** - * This method needs to be implemented by your subclass. - * It is executed during the Task execute to achieve - * the relevant action. - * @param repository - * @throws ScmException - */ - public abstract void execute(ScmRepository repository) throws ScmException; -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/ScmTask.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/ScmTask.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/ScmTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -27,6 +27,22 @@ import org.apache.tools.ant.Task; import org.apache.maven.scm.ScmException; +import com.nokia.helium.scm.ant.actions.AddAction; +import com.nokia.helium.scm.ant.actions.BranchAction; +import com.nokia.helium.scm.ant.actions.ChangelogAction; +import com.nokia.helium.scm.ant.actions.CheckinAction; +import com.nokia.helium.scm.ant.actions.CheckoutAction; +import com.nokia.helium.scm.ant.actions.DiffAction; +import com.nokia.helium.scm.ant.actions.ExportAction; +import com.nokia.helium.scm.ant.actions.InfoAction; +import com.nokia.helium.scm.ant.actions.InitAction; +import com.nokia.helium.scm.ant.actions.PullAction; +import com.nokia.helium.scm.ant.actions.RemoveAction; +import com.nokia.helium.scm.ant.actions.ScmAction; +import com.nokia.helium.scm.ant.actions.StatusAction; +import com.nokia.helium.scm.ant.actions.TagAction; +import com.nokia.helium.scm.ant.actions.TagsAction; +import com.nokia.helium.scm.ant.actions.UpdateAction; import com.nokia.maven.scm.manager.BasicExtendedScmManager; import com.nokia.maven.scm.manager.ExtendedScmManager; import com.nokia.maven.scm.provider.hg.HgScmProviderExt; diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/StatusAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/StatusAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.command.status.StatusScmResult; -import org.apache.maven.scm.manager.ScmManager; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.tools.ant.BuildException; - -/** - * Status will execute status action on the relevant repository, and reports - * basedir, or a specific set of file status. - * - *
    - * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    - *    <hlm:status>
    - *       <fileset dir="${repo.dir}/test1">
    - *          <include name="**" />
    - *          <exclude name="** /.${repo.type}/**" />
    - *       </fileset>
    - *    </hlm:status>
    - * </hlm:scm >
    - * 
    - * - * @ant.type name="status" category="SCM" - */ -public class StatusAction extends BaseDirectoryScmAction { - - @Override - public void execute(ScmRepository repository) throws ScmException { - ScmManager scmManager = getTask().getScmManager(); - - StatusScmResult result = scmManager.status(repository, getScmFileSet()); - - if (!result.isSuccess()) { - throw new BuildException("SCM status action failed: " - + result.getProviderMessage()); - } - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/TagAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/TagAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import java.io.File; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.ScmFileSet; -import org.apache.maven.scm.command.tag.TagScmResult; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.tools.ant.BuildException; - -import com.nokia.maven.scm.manager.ExtendedScmManager; - -/** - * This action will tag current repository revision using a specific name. - * - *
    - * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    - *     <hlm:tag baseDir="${repo.dir}/test1" name="0.0.1" />
    - * </hlm:scm>
    - * 
    - * - * @ant.type name="tag" category="SCM" - */ -public class TagAction extends BaseDirectoryScmAction { - private String name; - private String level = "normal"; - - /** - * String that will be used to tag the current revision. - * - * @param name - * Name of the tag - * @ant.required - */ - public void setName(String name) { - this.name = name; - } - - /** - * String that will be used to determine tag types, eg. local. - * - * @param level - * Level of the tag eg.local - * @ant.not-required - */ - public void setLevel(String level) { - this.level = level; - } - - @Override - public void execute(ScmRepository repository) throws ScmException { - TagScmResult result; - - if (name == null) - throw new BuildException("'name' attribute is not defined."); - - if (getBasedir() == null) - throw new BuildException("'basedir' attribute is not defined."); - - try { - ExtendedScmManager scmManager = (ExtendedScmManager) getTask() - .getScmManager(); - if (level.equals(new String("local"))) { - result = scmManager.tag(repository, new ScmFileSet(new File( - getBasedir())), name, level); - } else { - result = scmManager.tag(repository, new ScmFileSet(new File( - getBasedir())), name); - } - - if (!result.isSuccess()) { - throw new BuildException("SCM tag action error: " - + result.getProviderMessage()); - } - getTask().log("Tag '" + name + "' has been created successfully."); - } catch (ScmException e) { - throw new BuildException("SCM tag action failed: " + e.toString()); - } - - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/TagsAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/TagsAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import java.io.File; -import java.util.List; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.ScmTag; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.tools.ant.BuildException; - -import com.nokia.helium.scm.ant.types.TagSet; -import com.nokia.maven.scm.command.tags.TagsScmResult; -import com.nokia.maven.scm.manager.ExtendedScmManager; - -/** - * This action will tag current repository revision using a specific name. - * - *
    - * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    - *     <hlm:tags baseDir="${repo.dir}/test1" reference="my.tags" />
    - * </hlm:scm>
    - * 
    - * - * @ant.type name="tags" category="SCM" - */ -public class TagsAction extends BaseDirectoryScmAction { - - private String reference; - - /** - * Defines the id of the result type generated by the query. - * @param reference the name of the reference to use. - * @ant.not-required Only log result by default. - */ - public void setReference(String reference) { - this.reference = reference; - } - - /** - * {@inheritDoc} - */ - @Override - public void execute(ScmRepository repository) throws ScmException { - TagsScmResult result; - try { - ExtendedScmManager scmManager = (ExtendedScmManager) getTask() - .getScmManager(); - result = scmManager.tags(repository, new File(this.getBasedir())); - if (!result.isSuccess()) { - throw new BuildException("SCM tags action error: " - + result.getProviderMessage()); - } - - // Creating a TagSet - List tags = result.getTags(); - TagSet tagSet = new TagSet(); - tagSet.setProject(getProject()); - getTask().log("Tag list:"); - for (ScmTag tag : tags) { - tagSet.createTag().setName(tag.getName()); - getTask().log(" * " + tag.getName()); - } - // Creating new reference - if (reference != null) { - getTask().log("Creating reference: " + reference); - getProject().addReference(reference, tagSet); - } - - } catch (ScmException e) { - throw new BuildException("SCM tags action failed: " - + e.getMessage()); - } - - } -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/UpdateAction.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/taskdefs/UpdateAction.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* - * 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.scm.ant.taskdefs; - -import java.util.List; - -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.ScmFile; -import org.apache.maven.scm.ScmTag; -import org.apache.maven.scm.command.update.UpdateScmResult; -import org.apache.maven.scm.manager.ScmManager; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.tools.ant.BuildException; -import org.apache.maven.scm.ScmRevision; - -import com.nokia.helium.scm.ant.types.Tag; -import com.nokia.helium.scm.ant.types.Revision; - -/** - * Update the defined project for a specific revision or tag. - * - *
    - * <hlm:scm verbose="true" scmUrl="scm:${repo.type}:${repo.dir}/test1">
    - *     <hlm:update basedir="${repo.dir}/test1" />
    - * </hlm:scm>
    - *
    - * - * @ant.type name="update" category="SCM" - */ -public class UpdateAction extends BaseDirectoryScmAction { - - private Tag tag; - private Revision revision; - - public void add(Tag tag) { - this.tag = tag; - } - - public Tag createTag() { - this.tag = new Tag(); - return this.tag; - } - - public void add(Revision revision) { - this.revision = revision; - } - - public Revision createRevision() { - this.revision = new Revision(); - return this.revision; - } - - @Override - @SuppressWarnings("unchecked") - public void execute(ScmRepository repository) throws ScmException { - ScmManager scmManager = getTask().getScmManager(); - - UpdateScmResult result; - if (tag != null) { - result = scmManager.update(repository, getScmFileSet(), - new ScmTag(tag.getName())); - } else if (revision != null) { - result = scmManager.update(repository, getScmFileSet(), - new ScmRevision(revision.getName())); - } else { - result = scmManager.update(repository, getScmFileSet()); - } - - if (!result.isSuccess()) { - throw new BuildException("SCM update action error: " - + result.getProviderMessage()); - } - - List files = result.getUpdatedFiles(); - for (ScmFile scmFile : files) { - getTask().log(scmFile.toString()); - } - - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/maven/scm/provider/hg/HgScmProviderExt.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/maven/scm/provider/hg/HgScmProviderExt.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/maven/scm/provider/hg/HgScmProviderExt.java Wed Jun 16 16:51:40 2010 +0300 @@ -76,7 +76,7 @@ @Override public CheckOutScmResult checkout(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) - throws ScmException { + throws ScmException { HgCheckOutCommand command = new HgCheckOutCommand(); command.setLogger(getLogger()); @@ -87,7 +87,7 @@ @Override public ChangeLogScmResult changelog(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) - throws ScmException { + throws ScmException { HgChangeLogCommand command = new HgChangeLogCommand(); command.setLogger(getLogger()); @@ -96,7 +96,7 @@ } public PullScmResult pull(ScmRepository repository, File path) - throws ScmException { + throws ScmException { HgPullCommand command = new HgPullCommand(); command.setLogger(getLogger()); return (PullScmResult) command.executeCommand(repository @@ -107,7 +107,7 @@ @Override public UpdateScmResult update(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) - throws ScmException { + throws ScmException { HgUpdateCommand command = new HgUpdateCommand(); command.setLogger(getLogger()); return (UpdateScmResult) command.executeCommand(repository, fileSet, @@ -133,7 +133,7 @@ @Override public RemoveScmResult remove(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) - throws ScmException { + throws ScmException { HgRemoveCommand command = new HgRemoveCommand(); command.setLogger(getLogger()); return (RemoveScmResult) command.execute(repository, fileSet, @@ -142,7 +142,7 @@ protected BranchScmResult branch(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) - throws ScmException { + throws ScmException { HgBranchCommand command = new HgBranchCommand(); command.setLogger(getLogger()); return (BranchScmResult) command.execute(repository, fileSet, @@ -151,7 +151,7 @@ protected ExportScmResult export(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) - throws ScmException { + throws ScmException { HgExportCommand command = new HgExportCommand(); command.setLogger(getLogger()); return (ExportScmResult) command.execute(repository, fileSet, @@ -161,7 +161,7 @@ @Override public TagScmResult tag(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) - throws ScmException { + throws ScmException { HgTagCommand command = new HgTagCommand(); command.setLogger(getLogger()); return (TagScmResult) command.execute(repository, fileSet, parameters); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/maven/scm/provider/hg/VersionChangeSet.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/maven/scm/provider/hg/VersionChangeSet.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/maven/scm/provider/hg/VersionChangeSet.java Wed Jun 16 16:51:40 2010 +0300 @@ -74,9 +74,9 @@ { String result = ""; for (ScmVersion versions : getScmVersion()) { - if (!versions.getName().equals("")) - { - result += versions.getType().toLowerCase() + ":" + versions.getName() + "\n"; + if (!versions.getName().equals("")) + { + result += versions.getType().toLowerCase() + ":" + versions.getName() + "\n"; } } if (getAuthor() != null) @@ -123,13 +123,13 @@ } for (ScmVersion versions : getScmVersion()) { - if (!versions.getName().equals("")) - { - buffer.append("\t\t<" + versions.getType().toLowerCase() + ">\n") + if (!versions.getName().equals("")) + { + buffer.append("\t\t<" + versions.getType().toLowerCase() + ">\n") .append("\t\t\t") .append(versions.getName()) .append("\n"); - buffer.append("\t\t\n"); + buffer.append("\t\t\n"); } } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/maven/scm/provider/hg/command/export/HgExportCommand.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/maven/scm/provider/hg/command/export/HgExportCommand.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/maven/scm/provider/hg/command/export/HgExportCommand.java Wed Jun 16 16:51:40 2010 +0300 @@ -82,11 +82,11 @@ protected List getFiles(File dir) { List files = new ArrayList(); - for (File f : dir.listFiles()) { - if (f.isFile()) { - files.add(f.getAbsolutePath()); - } else if (f.isDirectory()) { - files.addAll(getFiles(f)); + for (File file : dir.listFiles()) { + if (file.isFile()) { + files.add(file.getAbsolutePath()); + } else if (file.isDirectory()) { + files.addAll(getFiles(file)); } } return files; diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/scm/src/com/nokia/maven/scm/provider/hg/command/tag/HgTagCommand.java --- a/buildframework/helium/sf/java/scm/src/com/nokia/maven/scm/provider/hg/command/tag/HgTagCommand.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/scm/src/com/nokia/maven/scm/provider/hg/command/tag/HgTagCommand.java Wed Jun 16 16:51:40 2010 +0300 @@ -125,8 +125,8 @@ StringBuffer result = new StringBuffer(); int i = 0; for (String cmd : cmds) { - String s = cmd; - result.append(s); + String cmdStr = cmd; + result.append(cmdStr); if (i < cmds.length - 1) { result.append(" "); } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/signaling/signaling.rst --- a/buildframework/helium/sf/java/signaling/signaling.rst Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/signaling/signaling.rst Wed Jun 16 16:51:40 2010 +0300 @@ -1,16 +1,20 @@ + +.. index:: + module: Configuring Signaling + ===================== Configuring Signaling ===================== Helium signaling framework offers you a simplest way to control -failures on build flow, and provides you an easy way to get reporting on +failures on build flow, and provides you with an easy way to get reporting on some crucial steps of your build. The configuration ----------------- -The signaling configuration is divided on three parts: +The signaling configuration is divided into three parts: * the signalListenerConfig: defines the signal * the signalInput: defines what to do when a signal is raised @@ -37,9 +41,9 @@ -A signal will then be triggered each time the **target-name** completed. The signalInput will then defined how it should be handled. +A signal will then be triggered each time the **target-name** completed. The signalInput will then define how it should be handled. -Other way to trigger a signal is by using the signal task: +Another way to trigger a signal is by using the signal task: .. code-block:: xml @@ -71,13 +75,13 @@ -This will run all notifier from the customNotifier configuration then fail the build. +This will run all notifiers from the customNotifier configuration then fail the build. .. code-block:: xml -This will defer the failure at the end of the build, no notifier will be run. +This will defer the failure to the end of the build, no notifier will be run. notifierList ............ @@ -111,7 +115,7 @@ * send an email to additional users e.g: user@foo.com, user@bar.com * defer the build failure. -You configuration should contains (e.g build.xml) +Your configuration should contain (e.g build.xml) .. code-block:: xml @@ -138,17 +142,17 @@ A custom notifierList has been created with **myCustomNotifierList** as reference ID. It defines -a emailNotifier which uses the default email template under Helium (${helium.dir}/tools/common/templates/log/email_new.html.ftl). -It also set the title of you email to be "[signal] My build goes wrong: ${signal.name}" (signal.name property will be replace by the signal name raised). -**notifyWhen** attribute will make the notifier to send a notification only on build failure. +an emailNotifier which uses the default email template under Helium (${helium.dir}/tools/common/templates/log/email_new.html.ftl). +It also sets the title of your email to be "[signal] My build goes wrong: ${signal.name}" (signal.name property will be replaced by the signal name raised). +**notifyWhen** attribute will make the notifier send a notification only on build failure. Finally the two additional email addresses will be set using the **additionalrecipients** attribute. -We then need to link the signal configuration and our custom the notifier list. The signalInput element is use to achieve that. -It must be defined using the same reference ID (see reference overriding howto) as the one in the Helium configuration, the naming convention for this is: **Input**. +We then need to link the signal configuration and our custom signal to the notifier list, the signalInput element is used to achieve this. +It must be defined using the same reference ID (see reference overriding how to) as the one in the Helium configuration, the naming convention for this is: **Input**. Its **failbuild** attribute is set to **defer** which will configure the build to keepgoing, and fail at the end of the build flow. Finally an embedded notifierListRef element will reference our custom notifier list: **myCustomNotifierList**. -While failing the signaling framework will execute all notifier defined and then store internally the build failure so it can raise it again at the end of the execution. +While failing the signaling framework will execute all notifiers defined and then store internally the build failure so it can raise it again at the end of the execution. Example: Report specific errors not included by default diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/antlib.xml --- a/buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/antlib.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/antlib.xml Wed Jun 16 16:51:40 2010 +0300 @@ -22,8 +22,8 @@ --> - - + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/taskdefs/ClearDeferredFailures.java --- a/buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/taskdefs/ClearDeferredFailures.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* 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.signal.ant.taskdefs; - -import org.apache.tools.ant.Task; -import com.nokia.helium.signal.SignalStatusList; - -/** - * This class implements a task that clear all pending failure. It is quite - * useful for testing. - * @ant.task name="clearDeferredFailures" category="Signaling" - */ -public class ClearDeferredFailures extends Task { - - /** - * Does the cleaning. - */ - @Override - public void execute() { - log("Clearing all pending failures."); - SignalStatusList.getDeferredSignalList().clearStatusList(); - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/taskdefs/ClearDeferredFailuresTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/taskdefs/ClearDeferredFailuresTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.signal.ant.taskdefs; + +import org.apache.tools.ant.Task; +import com.nokia.helium.signal.SignalStatusList; + +/** + * This class implements a task that clear all pending failure. It is quite + * useful for testing. + * @ant.task name="clearDeferredFailures" category="Signaling" + */ +public class ClearDeferredFailuresTask extends Task { + + /** + * Does the cleaning. + */ + @Override + public void execute() { + log("Clearing all pending failures."); + SignalStatusList.getDeferredSignalList().clearStatusList(); + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/taskdefs/Signal.java --- a/buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/taskdefs/Signal.java Tue Apr 27 08:33:08 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,172 +0,0 @@ -/* - * 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.signal.ant.taskdefs; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.Target; -import java.util.Vector; -import com.nokia.helium.signal.ant.SignalList; -import com.nokia.helium.signal.ant.types.SignalNotifierInput; - -/** - * This task provide a way to raise a signal. - * If the provided result is different from 0 then the mentioned signal - * is raised. - * - * You can emit a signal based from the signal task, its behavior will get defined by the - * nested signalInput element. e.g: - *
    - * <target name="raise-signal">
    - *   <-- Some computation that sets result property -->
    - *   <property name="result" value="1"/>
    - *   
    - *   <hlm:signal name="compileSignal" result="${result}">
    - *       <-- Let's refer to some existing signal input configuration -->
    - *       <hlm:signalInput refid="testDeferredSignalInput" />
    - *   </hlm:signal>
    - * </target>
    - * 
    - * - * The execution of the signal task will behave depending on the compileSignal configuration, - * if not defined the build will fail. - * - * @ant.task name="signal" category="Signaling" - */ -public class Signal extends Task { - - private String name; - private String message; - private Integer result; - - private Vector signalNotifierInputs = new Vector(); - - public String getMessage() { - return message; - } - - /** - * Helper function called by ant to create the new signalinput - */ - public SignalNotifierInput createSignalNotifierInput() { - SignalNotifierInput input = new SignalNotifierInput(); - add(input); - return input; - } - - public SignalNotifierInput getSignalNotifierInput() { - return (SignalNotifierInput)signalNotifierInputs.elementAt(0); - } - /** - * Helper function to add the created signalinput - * @param filter to be added to the filterset - */ - public void add(SignalNotifierInput input) { - signalNotifierInputs.add(input); - } - - - /** - * Error message. - * - * @ant.not-required - */ - public void setMessage(String message) { - this.message = message; - } - - - public String getName() { - return name; - } - - /** - * Signal name to emit. - * - * @ant.required - */ - public void setName(String name) { - this.name = name; - } - - /** - * integer value representing the number of errors. - * - * @ant.required - */ - public void setResult(int result) { - this.result = new Integer(result); - } - - @Override - public void execute() { - if (name == null) - throw new BuildException("'name' attribute is not defined."); - if (result == null) { - result = new Integer(0); - } - - SignalList signalList = new SignalList(getProject()); - boolean failStatus = result.intValue() != 0; - if (failStatus) { - // keep same message as earlier. - log(name - + ": " - + name - + " signal failed. Expected result was 0, actual result was " - + result); - - if (message == null) { - message = "Expected result was 0, actual result was " + result; - } - } - - // notify the user - String targetName = "signalExceptionTarget"; - Target target = this.getOwningTarget(); - if (target != null) { - targetName = target.getName(); - } - - if (signalNotifierInputs.isEmpty()) { - Object config = getProject().getReference(name); - if (config == null) { - throw new BuildException("Could not find signal config for signal name: " + name); - } - signalList.sendSignal(getName(), result.intValue() != 0); - if (result.intValue() != 0) { - // keep same message as earlier. - log(name - + ": " - + name - + " signal failed. Expected result was 0, actual result was " - + result); - - if (message == null) { - message = "Expected result was 0, actual result was " + result; - } - signalList.fail(getName(), this.getOwningTarget().getName(), message); - } - - } else { - signalList.processForSignal(getProject(), getSignalNotifierInput(), getName(), - targetName, message, failStatus); - } - } - -} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/taskdefs/SignalTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/taskdefs/SignalTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,172 @@ +/* + * 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.signal.ant.taskdefs; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import org.apache.tools.ant.Target; +import java.util.Vector; +import com.nokia.helium.signal.ant.SignalList; +import com.nokia.helium.signal.ant.types.SignalNotifierInput; + +/** + * This task provide a way to raise a signal. + * If the provided result is different from 0 then the mentioned signal + * is raised. + * + * You can emit a signal based from the signal task, its behavior will get defined by the + * nested signalInput element. e.g: + *
    + * <target name="raise-signal">
    + *   <-- Some computation that sets result property -->
    + *   <property name="result" value="1"/>
    + *   
    + *   <hlm:signal name="compileSignal" result="${result}">
    + *       <-- Let's refer to some existing signal input configuration -->
    + *       <hlm:signalInput refid="testDeferredSignalInput" />
    + *   </hlm:signal>
    + * </target>
    + * 
    + * + * The execution of the signal task will behave depending on the compileSignal configuration, + * if not defined the build will fail. + * + * @ant.task name="signal" category="Signaling" + */ +public class SignalTask extends Task { + + private String name; + private String message; + private Integer result; + + private Vector signalNotifierInputs = new Vector(); + + public String getMessage() { + return message; + } + + /** + * Helper function called by ant to create the new signalinput + */ + public SignalNotifierInput createSignalNotifierInput() { + SignalNotifierInput input = new SignalNotifierInput(); + add(input); + return input; + } + + public SignalNotifierInput getSignalNotifierInput() { + return (SignalNotifierInput)signalNotifierInputs.elementAt(0); + } + /** + * Helper function to add the created signalinput + * @param filter to be added to the filterset + */ + public void add(SignalNotifierInput input) { + signalNotifierInputs.add(input); + } + + + /** + * Error message. + * + * @ant.not-required + */ + public void setMessage(String message) { + this.message = message; + } + + + public String getName() { + return name; + } + + /** + * Signal name to emit. + * + * @ant.required + */ + public void setName(String name) { + this.name = name; + } + + /** + * integer value representing the number of errors. + * + * @ant.required + */ + public void setResult(int result) { + this.result = new Integer(result); + } + + @Override + public void execute() { + if (name == null) + throw new BuildException("'name' attribute is not defined."); + if (result == null) { + result = new Integer(0); + } + + SignalList signalList = new SignalList(getProject()); + boolean failStatus = result.intValue() != 0; + if (failStatus) { + // keep same message as earlier. + log(name + + ": " + + name + + " signal failed. Expected result was 0, actual result was " + + result); + + if (message == null) { + message = "Expected result was 0, actual result was " + result; + } + } + + // notify the user + String targetName = "signalExceptionTarget"; + Target target = this.getOwningTarget(); + if (target != null) { + targetName = target.getName(); + } + + if (signalNotifierInputs.isEmpty()) { + Object config = getProject().getReference(name); + if (config == null) { + throw new BuildException("Could not find signal config for signal name: " + name); + } + signalList.sendSignal(getName(), result.intValue() != 0); + if (result.intValue() != 0) { + // keep same message as earlier. + log(name + + ": " + + name + + " signal failed. Expected result was 0, actual result was " + + result); + + if (message == null) { + message = "Expected result was 0, actual result was " + result; + } + signalList.fail(getName(), this.getOwningTarget().getName(), message); + } + + } else { + signalList.processForSignal(getProject(), getSignalNotifierInput(), getName(), + targetName, message, failStatus); + } + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/types/EMAILNotifier.java --- a/buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/types/EMAILNotifier.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/types/EMAILNotifier.java Wed Jun 16 16:51:40 2010 +0300 @@ -185,69 +185,69 @@ String additionalRecipientsUpdated = getProject().replaceProperties(additionalRecipients); log.debug("Sending data by e-mail."); - EmailDataSender emailSender; - if (rootdnUpdated != null) - { - String[] to = null; - if (additionalRecipientsUpdated != null) - { - to = additionalRecipientsUpdated.split(","); - } - emailSender = new EmailDataSender(to, smtpUpdated, ldapUpdated, rootdnUpdated); - } - else + EmailDataSender emailSender; + if (rootdnUpdated != null) + { + String[] to = null; + if (additionalRecipientsUpdated != null) { - emailSender = new EmailDataSender( - additionalRecipientsUpdated, smtpUpdated, ldapUpdated); + to = additionalRecipientsUpdated.split(","); } - if (from != null) - { - emailSender.setFrom(from); + emailSender = new EmailDataSender(to, smtpUpdated, ldapUpdated, rootdnUpdated); + } + else + { + emailSender = new EmailDataSender( + additionalRecipientsUpdated, smtpUpdated, ldapUpdated); + } + if (from != null) + { + emailSender.setFrom(from); + } + log.debug("EmailNotifier:arlist: " + additionalRecipientsUpdated); + Project subProject = getProject().createSubProject(); + subProject.setProperty("signal.name", signalName); + subProject.setProperty("signal.status", "" + failStatus); + subProject.setProperty("signal.message", "" + message); + + emailSender.addCurrentUserToAddressList(); + String filePath = ""; + File fileToSend = null; + if (notifierInput != null) { + fileToSend = notifierInput.getFile(".*.html"); + if (fileToSend != null) { + filePath = fileToSend.toString(); } - log.debug("EmailNotifier:arlist: " + additionalRecipientsUpdated); - Project subProject = getProject().createSubProject(); - subProject.setProperty("signal.name", signalName); - subProject.setProperty("signal.status", "" + failStatus); - subProject.setProperty("signal.message", "" + message); - emailSender.addCurrentUserToAddressList(); - String filePath = ""; - File fileToSend = null; - if (notifierInput != null) { - fileToSend = notifierInput.getFile(".*.html"); - if (fileToSend != null) { - filePath = fileToSend.toString(); - } - - } - if (fileToSend == null) { - File emailOutputFile; - try { - emailOutputFile = File.createTempFile("helium_", "email.html"); - emailOutputFile.deleteOnExit(); - log.debug("sending data by e-mail:outputDir: " - + emailOutputFile.getAbsolutePath()); + } + if (fileToSend == null) { + File emailOutputFile; + try { + emailOutputFile = File.createTempFile("helium_", "email.html"); + emailOutputFile.deleteOnExit(); + log.debug("sending data by e-mail:outputDir: " + + emailOutputFile.getAbsolutePath()); - List sourceList = new ArrayList(); - sourceList.add(new PropertiesSource("ant", getProject() - .getProperties())); - Hashtable signalProperties = new Hashtable(); - signalProperties.put("signal.name", signalName); - signalProperties.put("signal.status", "" + failStatus); - signalProperties.put("signal.message", "" + message); - sourceList.add(new PropertiesSource("signaling", - signalProperties)); + List sourceList = new ArrayList(); + sourceList.add(new PropertiesSource("ant", getProject() + .getProperties())); + Hashtable signalProperties = new Hashtable(); + signalProperties.put("signal.name", signalName); + signalProperties.put("signal.status", "" + failStatus); + signalProperties.put("signal.message", "" + message); + sourceList.add(new PropertiesSource("signaling", + signalProperties)); - templateProcessor.convertTemplate(defaultTemplate, emailOutputFile, - sourceList); - filePath = emailOutputFile.toString(); - } catch (IOException e) { - log.debug("EmailNotifier: IOexception: ", e); - } + templateProcessor.convertTemplate(defaultTemplate, emailOutputFile, + sourceList); + filePath = emailOutputFile.toString(); + } catch (IOException e) { + log.debug("EmailNotifier: IOexception: ", e); } - emailSender.sendData("signaling", filePath, - "application/html", subProject - .replaceProperties(title), null); + } + emailSender.sendData("signaling", filePath, + "application/html", subProject + .replaceProperties(title), null); } } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/types/ExecuteTaskNotifier.java --- a/buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/types/ExecuteTaskNotifier.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/types/ExecuteTaskNotifier.java Wed Jun 16 16:51:40 2010 +0300 @@ -88,7 +88,7 @@ prj.setProperty("signal.message", message ); // Converting the list of inputs into a string. String inputs = ""; - if (notifierInput != null) { + if (notifierInput != null && notifierInput.getFile() != null) { inputs += notifierInput.getFile().toString(); } prj.setProperty("signal.notifier.inputs", inputs); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/types/SignalNotifierList.java --- a/buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/types/SignalNotifierList.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/types/SignalNotifierList.java Wed Jun 16 16:51:40 2010 +0300 @@ -19,7 +19,6 @@ package com.nokia.helium.signal.ant.types; import org.apache.tools.ant.types.DataType; -import org.apache.tools.ant.BuildException; import com.nokia.helium.signal.Notifier; @@ -57,9 +56,6 @@ * @throws HlmAntLibException */ public Vector getNotifierList() { - if (notifierlist.isEmpty()) { - throw new BuildException(" Signal notifierlist is empty."); - } return notifierlist; } } diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/signaling/tests/antunit/signaling_test.ant.xml --- a/buildframework/helium/sf/java/signaling/tests/antunit/signaling_test.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/signaling/tests/antunit/signaling_test.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -68,20 +68,20 @@
    - - + + - - + + - - + + - - + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/signaling/tests/antunit/test_signaling_config.ant.xml --- a/buildframework/helium/sf/java/signaling/tests/antunit/test_signaling_config.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/signaling/tests/antunit/test_signaling_config.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -20,14 +20,14 @@ ============================================================================ --> - + signalInput and notifierList test configuration - + @@ -62,9 +62,9 @@ - + - + @@ -95,17 +95,17 @@ - + - + - + - + @@ -115,19 +115,19 @@ - + - - + + - - + + - - + + @@ -135,9 +135,9 @@ - + - + @@ -148,54 +148,54 @@ - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -204,9 +204,9 @@ - + - + @@ -239,7 +239,7 @@ - + @@ -248,7 +248,7 @@ - + @@ -257,9 +257,9 @@ - + - + @@ -268,9 +268,9 @@ - + - + @@ -286,9 +286,9 @@ - + - + @@ -297,9 +297,9 @@ - + - + @@ -309,9 +309,9 @@ - + - + @@ -321,9 +321,9 @@ - + - + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/synergy/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/synergy/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,30 @@ + + + + Helium Antlib Legacy build file. + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/synergy/ivy.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/synergy/ivy.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,33 @@ + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/synergy/src/com/nokia/helium/synergy/ant/antlib.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/synergy/src/com/nokia/helium/synergy/ant/antlib.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,27 @@ + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/synergy/src/com/nokia/helium/synergy/ant/taskdefs/AbstractScmBaseTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/synergy/src/com/nokia/helium/synergy/ant/taskdefs/AbstractScmBaseTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,465 @@ +/* + * 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.synergy.ant.taskdefs; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; +import java.io.File; +import java.io.IOException; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; +import org.apache.tools.ant.taskdefs.Execute; +import org.apache.tools.ant.taskdefs.LogStreamHandler; +import org.apache.tools.ant.taskdefs.condition.Os; + +import com.nokia.helium.core.FileUtils; + +/** + * AbstractScmBaseTask is an abstract class for GSCM related tasks + * such as rebaseline and deconfigure. + * + * @ant.task category="SCM" + * + */ +public abstract class AbstractScmBaseTask extends Task { + + // common attributes + private String database; // -d dbname = Database name (or database path) + private String password; // -U password = UNIX password + private String ccmProject; // -p projectname = Project name (incompatible + // with -B) + + private Integer verbosity; + + private StringBuffer commandString = new StringBuffer(); + private List commands = new ArrayList(); + + /** + * Return the Synergy project name. + * + * @return the Synergy project name. + */ + public String getCcmProject() { + return ccmProject; + } + + /** + * Set Synergy Project Name to be used. + * + * @param ccmProject + * is the Synergy project name to set + * @ant.required + */ + public void setCcmProject(String ccmProject) { + this.ccmProject = ccmProject; + log("Set ccmProject to " + ccmProject); + } + + /** + * Return the database name. + * + * @return the database name. + */ + public String getDatabase() { + return database; + } + + /** + * Set Synergy Database name to be used. + * + * @param database + * is the name of the Synergy database to set. + * @ant.required + */ + public void setDatabase(String database) { + this.database = database; + log("Set database to " + database); + } + + /** + * Return the Synergy password. + * + * @return the Synergy password. + */ + public String getPassword() { + return password; + } + + /** + * Set Synergy Password to be used. + * + * @param password + * is the password to set. + * @ant.required + */ + public void setPassword(String password) { + this.password = password; + log("Set password to ****** "); + } + + /** + * Return the verbosity. + * + * @return the verbosity. + */ + public Integer getVerbosity() { + return verbosity; + } + + /** + * Set verbosity level to be used. Verbosity level ( 0 - quiet, 1 - verbose, + * 2 - very verbose). Exception will be raised for any other value. + * + * @param verbosity + * is the verbosity level to set. + * @ant.not-required + */ + public void setVerbosity(Integer verbosity) { + this.verbosity = verbosity; + log("Set verbosity to " + verbosity); + } + + /** + * Method executes the current task. + * + */ + @Override + public void execute() { + // Set execution script + String script = getExecutionScript(); + String systemPath = System.getenv("PATH"); + String[] pathDirs = systemPath.split(File.pathSeparator); + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + // Under windows it is not in the path... + String[] customPathDirs = new String[pathDirs.length + 1]; + System.arraycopy(pathDirs, 0, customPathDirs, 0, pathDirs.length); + customPathDirs[customPathDirs.length - 1] = "C:\\apps\\base-apps\\bin"; + pathDirs = customPathDirs; + } else { + // Under Linux environment it is a perl script... + script = script + ".pl"; + } + + File scriptFile = FileUtils + .findExecutableOnPath(script, pathDirs); + if (scriptFile == null) { + throw new BuildException("Could not find " + script + + " application in the path."); + } + appendToCommandLine(scriptFile.getAbsolutePath()); + + // Build command argument list + buildCommandList(); + + // handle the command arguments + handleCommandArguments(); + + // configure verbosity + configureVerbosity(); + + // Execute the command-line launching as a separate process + runCommand(); + log("Completed successfully."); + } + + /** + * Method appends the given prefix and the command to the command string if + * the input cmd string is not null. + * + * @param prefix + * is the prefix of the cmd string input. + * @param cmd + * is the cmd string to be appended to main command string. + */ + protected void appendToCommandLine(String prefix, Object cmd) { + if (cmd != null) { + commandString.append(prefix); + commandString.append(" "); + commandString.append(cmd); + commandString.append(" "); + } + } + + /** + * Method appends the given prefix to the command string if the boolean + * value input is set true. + * + * @param prefix + * is the prefix to be appended to the command string. + * @param bool + * indicates whether to append the prefix or not. + */ + protected void appendToCommandLine(String prefix, Boolean bool) { + if (bool != null && bool) { + appendToCommandLine(prefix); + } + } + + /** + * Method appends the given cmd to the command string. + * + * @param cmd + * is the command string to be appended. + */ + protected void appendToCommandLine(String cmd) { + commandString.append(cmd); + commandString.append(" "); + } + + /** + * Add the given command argument to the command list. + * + * @param fieldName + * is the name of the task field. + * @param cmdArg + * is the command argument to be added to the command list. + * @param required + * indicates whether the command argument is mandatory or not. + * @param fieldValue + * is the value of the given field + */ + protected void addCommandArg(String fieldName, String cmdArg, + Boolean required, Object fieldValue) { + SCMCommandArgument cmdObj = new SCMCommandArgument(fieldName, cmdArg, + required, fieldValue); + commands.add(cmdObj); + } + + /** + * Add the given command argument to the command list. By default, the input + * command argument will be optional. + * + * @param fieldName + * is the name of the task field. + * @param cmdArg + * is the command argument to be added to the command list. + * @param fieldValue + * is the value of the given field + */ + protected void addCommandArg(String fieldName, String cmdArg, + Object fieldValue) { + addCommandArg(fieldName, cmdArg, false, fieldValue); + } + + /** + * Method validates the given arguments. + */ + protected abstract void validateArguments(); + + /** + * Get the name of the script to execute + * + * @return the script name to execute + */ + protected abstract String getExecutionScript(); + + /** + * Build a command list consisting of all the required and optional command + * arguments of the current task. + */ + protected abstract void buildCommandList(); + + /** + * Method returns the correct verbosity level for the input choice. + * + * @param choice + * is the verbosity choice set by user. + * @return the verbosity level to set. + */ + protected abstract String getVerbosity(int choice); + + // ----------------------------------- PRIVATE METHODS + // -------------------------------------- + + /** + * Method returns the requested {@link Field} object from the input + * {@link Class}. If the requested field is not found in the given + * {@link Class} then all its super classes are searched recursively. + * + * @param clazz + * is the {@link Class} of which the field is requested. + * @param fieldName + * is the name of the requested field. + * @return the requested field. + */ + private Field getField(Class clazz, String fieldName) { + Field field = null; + if (clazz != null) { + try { + field = clazz.getDeclaredField(fieldName); + } catch (NoSuchFieldException nsfe) { + field = getField(clazz.getSuperclass(), fieldName); + } + } + return field; + } + + /** + * Method process the command arguments set in the command list. + * + * @throws Exception + * if any error occurs while processing the command arguments. + */ + private void handleCommandArguments() { + StringBuffer missingArgs = new StringBuffer(); + Field field = null; + for (SCMCommandArgument cmdObj : commands) { + field = getField(getClass(), cmdObj.fieldName); + if (field != null) { + Object fieldValue = field.getType().cast(cmdObj.fieldValue); + check4MandatoryCmdArguments(cmdObj, fieldValue, missingArgs); + buildCommand(cmdObj, fieldValue); + } + } + // handle missing args if any + handleMissingArguments(missingArgs); + validateArguments(); + } + + /** + * Method checks for the mandatory command arguments. + * + * @param cmdObj + * is the {@link SCMCommandArgument} used in verification + * @param fieldValue + * is the field value to verify + * @param missingArgs + * contains the mandatory command arguments which are missing. + */ + private void check4MandatoryCmdArguments(SCMCommandArgument cmdObj, + Object fieldValue, StringBuffer missingArgs) { + if (cmdObj.required && fieldValue == null) { + missingArgs.append(cmdObj.fieldName); + missingArgs.append(" "); + } + } + + /** + * Method is used to construct an executable command string. + * + * @param cmdObj + * is the {@link SCMCommandArgument} + * @param fieldValue + * is the fieldValue containing the actual command argument. + */ + private void buildCommand(SCMCommandArgument cmdObj, Object fieldValue) { + if (fieldValue instanceof Boolean) { + appendToCommandLine(cmdObj.commandArgument, (Boolean)fieldValue); + } else { + appendToCommandLine(cmdObj.commandArgument, fieldValue); + } + } + + /** + * Method throws a {@link BuildException} if any mandatory command arguments + * are missing. + * + * @param missingArgs + * is the {@link StringBuffer} consisting of mandatory command + * arguments which are missing. + */ + private void handleMissingArguments(StringBuffer missingArgs) { + if (missingArgs.length() > 0) { + throw new BuildException("Error: mandatory attributes are not defined - " + + missingArgs.toString()); + } + } + + /** + * Configure the verbosity set by the user. + */ + private void configureVerbosity() { + if (verbosity != null) { + appendToCommandLine(getVerbosity(verbosity)); + } + } + + /** + * Execute the specified command. + * + * @throws Exception + * if execution fails or any error occurs while execution of the + * command. + */ + private void runCommand() { + String[] cmdline = commandString.toString().split(" "); + /* + * Note: static method call to Execute.runCommand does not run the given + * script here due to the setting of vmLauncher which acutally + * tries executing the script using Runtime.getRuntime().exec() method + * and this method cannot run the script without reference to the cmd or + * shell. (Similar with ExecTask) + * + * So creating an instance of Execute class helps to disable the + * vmLauncher and an OS dependent shellLauncher will be available for + * the execution of the script. + */ + // Make sure we replace the password on the command line before printing. + log("Executing: " + commandString.toString().replace(" " + password + " ", " *** ")); + Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO, + Project.MSG_ERR)); + exe.setAntRun(getProject()); + exe.setCommandline(cmdline); + exe.setVMLauncher(false); + try { + int retval = exe.execute(); + if (Execute.isFailure(retval)) { + throw new BuildException("Error: Script execution failure."); + } + } catch (IOException th) { + th.printStackTrace(); + throw new BuildException("Error: Script execution failure."); + } + } + + // ************************************* PRIVATE CLASSES + // *************************************** + + /** + * SCMCommandArgument is a private class and represents a + * normal java bean which is used to hold the information related to SCM + * command arguments. + */ + private class SCMCommandArgument { + + private String fieldName; + private Object fieldValue; + private String commandArgument; + private Boolean required; + + /** + * Create an instance of {@link SCMCommandArgument}. + * + * @param fieldName + * is the name of the task field + * @param commandArg + * is the SCM command argument + * @param reqd + * indicates the input command argument is mandatory or not. + */ + protected SCMCommandArgument(String fieldName, String commandArg, + Boolean reqd, Object fieldValue) { + this.fieldName = fieldName; + this.commandArgument = commandArg; + this.required = reqd; + this.fieldValue = fieldValue; + } + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/synergy/src/com/nokia/helium/synergy/ant/taskdefs/DeconfigureTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/synergy/src/com/nokia/helium/synergy/ant/taskdefs/DeconfigureTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.synergy.ant.taskdefs; + +import org.apache.tools.ant.BuildException; + +/** + * ANT wrapper task for the GSCM deconfigure.pl script. + * + * @ant.task name="deconfigure" category="SCM" + */ +public class DeconfigureTask extends AbstractScmBaseTask { + // The attributes of this task + private Boolean considerBranchReleases; + + /** + * Return the considerBranchReleases. + * + * @return the considerBranchReleases. + */ + public Boolean getConsiderBranchReleases() { + return considerBranchReleases; + } + + /** + * Set if we want deconfigure.pl script to check for branch differences + * based on the 'included_releases' attribute of project. + * + * @param considerBranchReleases + * @ant.not-required Default is no. + */ + public void setconsiderBranchReleases(Boolean considerBranchReleases) { + this.considerBranchReleases = considerBranchReleases; + log("Set considerBranchReleases to " + considerBranchReleases); + } + + /** + * Build a command list consisting of all the required and optional command + * arguments of the current task. + */ + protected void buildCommandList() { + addCommandArg("database", "-d", true, getDatabase()); + addCommandArg("password", "-P", true, getPassword()); + addCommandArg("ccmProject", "-p", true, getCcmProject()); + addCommandArg("considerBranchReleases", "-b", + getConsiderBranchReleases()); + } + + /** + * Method validates the given arguments. + */ + protected void validateArguments() { + // Do nothing + } + + /** + * Set the execution script. + * + */ + protected String getExecutionScript() { + return "deconfigure"; + } + + /** + * Method returns the correct verbosity level for the input choice. + * + * @param choice + * is the verbosity choice set by user. + * @return the verbosity level to set. + */ + protected String getVerbosity(int choice) { + String cmd = ""; + switch (choice) { + case 0 : + cmd = "-q "; + break; + case 1 : + cmd = "-V "; + break; + case 2 : + cmd = "-W "; + break; + default : + throw new BuildException( + "Error: Verbosity level is not recognised. " + + "Legal values are: 0 - quiet, 1 - verbose or 2 - very verbose"); + } + return cmd; + } + +} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/synergy/src/com/nokia/helium/synergy/ant/taskdefs/RBTTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/synergy/src/com/nokia/helium/synergy/ant/taskdefs/RBTTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,510 @@ +/* + * 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.synergy.ant.taskdefs; + +import org.apache.tools.ant.BuildException; + +/** + * ANT wrapper task for the GSCM rbt.pl script. + * + *
    + * Deconfigure Only:
    + * 
    + * Usage: <hlm:rebaseanddeconf database="${dbname}"
    + *                              password="${UNIX-password}" 
    + *                              verbosity="${0-3}"
    + *                              ccmProject="${ccm.project.name}" 
    + *                              release="${release.name}"
    + *                              deconfigure="yes" />
    + * 
    + * + *
    + * Rebaseline Only:
    + * 
    + * Usage:   <hlm:rebaseanddeconf database="${dbname}"
    + *                              password="${UNIX-password}" 
    + *                              verbosity="${0-3}"
    + *                              ccmProject="${ccm.project.name}"
    + *                              release="${release.name}" 
    + *                              releaseBaseline="yes" 
    + *                              skipDeconfigure="yes" />
    + * 
    + * + *
    + * Rebaseline with deconfigure:
    + * 
    + * Usage:   <hlm:rebaseanddeconf database="${dbname}"
    + *                              password="${UNIX-password}" 
    + *                              verbosity="${0-3}"
    + *                              ccmProject="${ccm.project.name}"
    + *                              release="${release.name}" 
    + *                              releaseBaseline="yes" 
    + *                              deconfigure="yes" />
    + * 
    + * + * @ant.task name="rebaseanddeconf" category="SCM" + */ +public class RBTTask extends AbstractScmBaseTask { + + // The attributes of this task + private String baseline; // -B baselinename = Four-part name of existing + // baseline (incompatible with -p and -n) + private String version; // -v version = New project hierarchy version + private String release; // -r release = New release object name (Two-part + // name) + private String newBaselineName; // -n name = New baseline name + + private Boolean releaseBaseline; // -R = Release the newly created baseline + private Boolean publish; // -P = Publish the newly created baseline + private Boolean deconfigure; // -s = Replace subprojects only (NO + // REBASELINE) + private Boolean leaveFoldersWritable; // -F = Don't freeze folders (Leave + // folders writable) + private Boolean enableTaskRebadgingGenericRelease; // -t = Enable task + // rebadging (associated + // modifiable tasks with + // generic release only) + private Boolean enableTaskRebadging; // -T = Enable task rebadging (all + // associated modifiable tasks) + private Boolean rebadgeObjectVersions; // -o = Rebadge object versions + // (requires ccm_admin) + private Boolean createBaselineForRollingReleaseTag; // -i = Create + // additional + // integration baseline + // for rolling-release + // tag + private Boolean skipDeconfigure; // -S = Do NOT replace subprojects (NO + // DECONFIGURE) + private Boolean active; // -a = Specified release remains active + private Boolean useBranchReleaseMethodology; // -b = Utilize branch release + + // methodology + + /** + * Return the baseline. + * + * @return the baseline. + */ + public String getBaseline() { + return baseline; + } + + /** + * Set four-part name of existing baseline (incompatible with 'projectName' + * and 'baselineName' attributes) to be used by rebaseline.pl script. + * + * @param baseline + * is the baseline to set + * @ant.not-required + */ + public void setBaseline(String baseline) { + this.baseline = baseline; + log("Set baseline to " + baseline); + } + + /** + * Return the version. + * + * @return the version. + */ + public String getVersion() { + return version; + } + + /** + * Set version of new project created. + * + * @param version + * is the version to set. + * @ant.not-required + */ + public void setVersion(String version) { + this.version = version; + log("Set version to " + version); + } + + /** + * Return the leaveFoldersWritable. + * + * @return the leaveFoldersWritable. + */ + public Boolean getLeaveFoldersWritable() { + return leaveFoldersWritable; + } + + /** + * Set whether to leave the folders writable in the baseline project + * created. + * + * @param leaveFoldersWritable + * indicates whether to leave folders writable. + * @ant.not-required Default is no. + */ + public void setLeaveFoldersWritable(Boolean leaveFoldersWritable) { + this.leaveFoldersWritable = leaveFoldersWritable; + log("Set leaveFoldersWritable to " + leaveFoldersWritable); + } + + /** + * Return the rebadgeObjectVersions + * + * @return the rebadgeObjectVersions. + */ + public Boolean getRebadgeObjectVersions() { + return rebadgeObjectVersions; + } + + /** + * Set whether to rebadge object versions in the rebaseline.pl script. + * + * @param rebadgeObjectVersions + * indicates whether to rebadge object versions to a given + * release tag. + * @ant.not-required Default is no. + */ + public void setRebadgeObjectVersions(Boolean rebadgeObjectVersions) { + this.rebadgeObjectVersions = rebadgeObjectVersions; + log("Set rebadgeObjectVersions to " + rebadgeObjectVersions); + } + + /** + * Return the releaseBaseline. + * + * @return the releaseBaseline. + */ + public Boolean getReleaseBaseline() { + return releaseBaseline; + } + + /** + * Set whether to release the newly created baseline or not. + * + * @param releaseBaseline + * indicates whether to release the newly created baseline + */ + public void setReleaseBaseline(Boolean releaseBaseline) { + this.releaseBaseline = releaseBaseline; + log("Set releaseBaseline to " + releaseBaseline); + } + + /** + * Return the publish. + * + * @return the publish. + */ + public Boolean getPublish() { + return publish; + } + + /** + * Set whether to publish the newly created baseline or not. + * + * @param publish + * the publish to set + */ + public void setPublish(Boolean publish) { + this.publish = publish; + log("Set publish to " + publish); + } + + /** + * Return the createBaselineForRollingReleaseTag. + * + * @return the createBaselineForRollingReleaseTag. + */ + public Boolean getCreateBaselineForRollingReleaseTag() { + return createBaselineForRollingReleaseTag; + } + + /** + * Set whether to create additional integration baseline for rolling-release + * tag. + * + * @param createBaselineForRollingReleaseTag + * @ant.not-required Default is no. + */ + public void setCreateBaselineForRollingReleaseTag( + Boolean createBaselineForRollingReleaseTag) { + this.createBaselineForRollingReleaseTag = createBaselineForRollingReleaseTag; + log("Set createBaselineForRollingReleaseTag to " + + createBaselineForRollingReleaseTag); + } + + /** + * Return the enableTaskRebadgingGenericRelease. + * + * @return the enableTaskRebadgingGenericRelease. + */ + public Boolean getEnableTaskRebadgingGenericRelease() { + return enableTaskRebadgingGenericRelease; + } + + /** + * Set enable task rebadging (associated modifiable tasks with generic + * release only). Not supported in rebaseline.pl + * + * @param enableTaskRebadgingGenericRelease + * the enableTaskRebadgingGenericRelease to set + */ + public void setEnableTaskRebadgingGenericRelease( + Boolean enableTaskRebadgingGenericRelease) { + this.enableTaskRebadgingGenericRelease = enableTaskRebadgingGenericRelease; + log("Set enableTaskRebadgingGenericRelease to " + + enableTaskRebadgingGenericRelease); + } + + /** + * Return the enableTaskRebadging + * + * @return the enableTaskRebadging. + */ + public Boolean getEnableTaskRebadging() { + return enableTaskRebadging; + } + + /** + * Set enable task rebadging (all associated modifiable tasks). Not + * supported in rebaseline.pl + * + * @param enableTaskRebadging + * the enableTaskRebadging to set + */ + public void setEnableTaskRebadging(Boolean enableTaskRebadging) { + this.enableTaskRebadging = enableTaskRebadging; + log("Set enableTaskRebadging to " + enableTaskRebadging); + } + + /** + * Return the skipDeconfigure. + * + * @return the skipDeconfigure. + */ + public Boolean getSkipDeconfigure() { + return skipDeconfigure; + } + + /** + * Set to skip deconfigure. + * + * @param skipDeconfigure + * the skipDeconfigure to set + */ + public void setSkipDeconfigure(Boolean skipDeconfigure) { + this.skipDeconfigure = skipDeconfigure; + log("Set skipDeconfigure to " + skipDeconfigure); + } + + /** + * Return the deconfigure + * + * @return the deconfigure. + */ + public Boolean getDeconfigure() { + return deconfigure; + } + + /** + * Set deconfigure. + * + * @param deconfigure + * the deconfigure to set + */ + public void setDeconfigure(Boolean deconfigure) { + this.deconfigure = deconfigure; + log("Set deconfigure to " + deconfigure); + } + + /** + * Return the active. + * + * @return the active. + */ + public Boolean getActive() { + return active; + } + + /** + * Set whether the current release is active or not. + * + * @param active + * the active to set + */ + public void setActive(Boolean active) { + this.active = active; + log("Set active to " + active); + } + + /** + * Return useBranchReleaseMethodology. + * + * @return the useBranchReleaseMethodology. + */ + public Boolean getUseBranchReleaseMethodology() { + return useBranchReleaseMethodology; + } + + /** + * Set whether to utilize branch release methodology or not. + * + * @param useBranchReleaseMethodology + * is the boolean value to set. + * @ant.not-required Default is no. + */ + public void setUseBranchReleaseMethodology( + Boolean useBranchReleaseMethodology) { + this.useBranchReleaseMethodology = useBranchReleaseMethodology; + log("Set useBranchReleaseMethodology to " + useBranchReleaseMethodology); + } + + /** + * Return the release tag. + * + * @return the release tag. + */ + public String getRelease() { + return release; + } + + /** + * Set release tag (Two-part name) for the release project created. + * + * @param release + * is the release tag to set + * @ant.not-required + */ + public void setRelease(String release) { + this.release = release; + log("Set release to " + release); + } + + /** + * Return the newBaselineName. + * + * @return the newBaselineName. + */ + public String getNewBaselineName() { + return newBaselineName; + } + + /** + * Set new baseline name to use. + * + * @param newBaselineName + * is the new baseline name to set. + * @ant.not-required + */ + public void setNewBaselineName(String newBaselineName) { + this.newBaselineName = newBaselineName; + log("Set newBaselineName to " + newBaselineName); + } + + protected String getExecutionScript() { + return "rbt"; + } + + /** + * Build a command list consisting of all the required and optional command + * arguments of the current task. + */ + protected void buildCommandList() { + addCommandArg("database", "-d", true, getDatabase()); + addCommandArg("password", "-U", true, getPassword()); + addCommandArg("ccmProject", "-p", getCcmProject()); + addCommandArg("baseline", "-B", getBaseline()); + addCommandArg("version", "-v", getVersion()); + addCommandArg("releaseBaseline", "-R", getReleaseBaseline()); + addCommandArg("publish", "-P", getPublish()); + addCommandArg("deconfigure", "-s", getDeconfigure()); + addCommandArg("leaveFoldersWritable", "-F", getLeaveFoldersWritable()); + addCommandArg("enableTaskRebadgingGenericRelease", "-t", + getEnableTaskRebadgingGenericRelease()); + addCommandArg("enableTaskRebadging", "-T", getEnableTaskRebadging()); + addCommandArg("rebadgeObjectVersions", "-o", getRebadgeObjectVersions()); + addCommandArg("createBaselineForRollingReleaseTag", "-i", + getCreateBaselineForRollingReleaseTag()); + addCommandArg("active", "-a", getActive()); + addCommandArg("skipDeconfigure", "-S", getSkipDeconfigure()); + addCommandArg("useBranchReleaseMethodology", "-b", + getUseBranchReleaseMethodology()); + addCommandArg("release", "-r", getRelease()); + addCommandArg("newBaselineName", "-n", getNewBaselineName()); + } + + /** + * Method validates the given arguments. + */ + protected void validateArguments() { + + if (baseline != null + && (getCcmProject() != null || newBaselineName != null)) { + throw new BuildException( + "Error: Option 'baseline' cannot be used with 'ccmProject' and 'newBaselineName'"); + } + + if (deconfigure != null && deconfigure && skipDeconfigure != null + && skipDeconfigure) { + throw new BuildException( + "Error: Use option either 'deconfigure' or 'skipDeconfigure'"); + } + + if (deconfigure != null && deconfigure && release == null) { + throw new BuildException( + "Error: Option 'release' is mandatory if 'deconfigure' is set"); + } + + if (publish != null && publish && releaseBaseline != null + && releaseBaseline) { + throw new BuildException( + "Error: Use Option either 'publish' or 'releaseBaseline'"); + } + + if (enableTaskRebadging != null && enableTaskRebadging + && enableTaskRebadgingGenericRelease != null + && enableTaskRebadgingGenericRelease) { + throw new BuildException( + "Error: Use Option either 'enableTaskRebadging' or 'enableTaskRebadgingGenericRelease'"); + } + } + + /** + * {@inheritDoc} + */ + protected String getVerbosity(int choice) { + String cmd = ""; + switch (choice) { + case 0 : + cmd = "-Q"; + break; + case 1 : + cmd = "-V"; + break; + case 2 : + cmd = "-I"; + break; + case 3 : + cmd = "-W"; + break; + default : + throw new BuildException("Error: Verbosity level is not recognised. " + + "Legal values are: 0 - quiet, 1 - verbose, 2 - Interactive " + + "or 3 - Walk-through Rehearsal"); + } + return cmd; + } + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/synergy/src/com/nokia/helium/synergy/ant/taskdefs/RebaselineTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/synergy/src/com/nokia/helium/synergy/ant/taskdefs/RebaselineTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,115 @@ +/* + * 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.synergy.ant.taskdefs; + +import org.apache.tools.ant.BuildException; + +/** + * ANT wrapper task for the GSCM rebaseline.pl script. <hlm:rebaseline + * database="to1tobet" + * ccmProject="helium-to1tobet#helium_4.49:project:vc1s60p1#1" + * password="test"/> + * + * @ant.task name="rebaseline" category="SCM" + */ +public class RebaselineTask extends RBTTask { + // The attributes of this task + private Boolean disableTaskRebadging; + + /** + * Return disableTaskRebadging + * + * @return the disableTaskRebadging. + */ + public Boolean getDisableTaskRebadging() { + return disableTaskRebadging; + } + + /** + * Set whether to disable task rebadging (incompatible with + * 'rebadgeObjectVersions' attribute) in the rebaseline.pl script. + * + * @param disableTaskRebadging + * @ant.not-required Default is no. + */ + public void setdisableTaskRebadging(boolean disableTaskRebadging) { + this.disableTaskRebadging = disableTaskRebadging; + log("Set disableTaskRebadging to " + disableTaskRebadging); + } + + /** + * Set the execution script. + * + */ + protected String getExecutionScript() { + return "rebaseline"; + } + + /** + * Build a command list consisting of all the required and optional command + * arguments of the current task. + */ + protected void buildCommandList() { + addCommandArg("database", "-d", true, getDatabase()); + addCommandArg("password", "-P", true, getPassword()); + addCommandArg("ccmProject", "-p", true, getCcmProject()); + addCommandArg("release", "-r", getRelease()); + addCommandArg("baseline", "-B", getBaseline()); + addCommandArg("version", "-v", getVersion()); + addCommandArg("newBaselineName", "-n", getNewBaselineName()); + addCommandArg("releaseBaseline", "-R", getReleaseBaseline()); + addCommandArg("leaveFolderswritable", "-w", getLeaveFoldersWritable()); + addCommandArg("disableTaskRebadging", "-x", getDisableTaskRebadging()); + addCommandArg("rebadgeObjectVersions", "-a", getRebadgeObjectVersions()); + addCommandArg("useBranchReleaseMethodology", "-b", + getUseBranchReleaseMethodology()); + addCommandArg("createBaselineForRollingReleaseTag", "-i", + getCreateBaselineForRollingReleaseTag()); + } + + /** + * Method returns the correct verbosity level for the input choice. + * + * @param choice + * is the verbosity choice set by user. + * @return the verbosity level to set. + */ + protected String getVerbosity(int choice) { + String cmd = ""; + switch (choice) { + case 0 : + cmd = "-q "; + break; + case 1 : + cmd = "-V "; + break; + default : + throw new BuildException("Error: Verbosity level is not recognised. " + + "Legal values are: 0 - quiet, 1 - verbose."); + } + return cmd; + } + + /** + * Method validates the given arguments. + */ + protected void validateArguments() { + // Do nothing + } + +} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/synergy/tests/antunit/test_deconfigure_task.ant.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/synergy/tests/antunit/test_deconfigure_task.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,135 @@ + + + + + Deconfigure testing targets for script deconfigure.pl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/synergy/tests/antunit/test_rebaseanddeconf_task.ant.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/synergy/tests/antunit/test_rebaseanddeconf_task.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,263 @@ + + + + + Rebaseline and Deconfigure testing targets for script rbt.pl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/synergy/tests/antunit/test_rebaseline_task.ant.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/synergy/tests/antunit/test_rebaseline_task.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,189 @@ + + + + + Rebaseline testing targets for script rebaseline.pl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/synergy/tests/bld.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/synergy/tests/bld.sh Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,22 @@ +#!/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 +ant $* diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/synergy/tests/build.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/synergy/tests/build.bat Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,31 @@ +@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%) +call ant %* +if "%ERRORLEVEL%" neq "0" (goto error) +endlocal +goto :eof + +:error +endlocal +if "%OS%"=="Windows_NT" color 00 diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/synergy/tests/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/synergy/tests/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,27 @@ + + + + Helium antlib legacy tests. + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/PackageMap.java --- a/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/PackageMap.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/PackageMap.java Wed Jun 16 16:51:40 2010 +0300 @@ -47,20 +47,20 @@ * @throws PackageMapParsingException in case of error */ public PackageMap(File file) throws PackageMapParsingException { - try { - DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - Document doc = builder.parse(file); - if (!doc.getDocumentElement().getNodeName().equals("PackageMap")) { - throw new PackageMapParsingException("Invalid XML format for " + file.getAbsolutePath() + " root element must be PackageMap"); - } - if (!doc.getDocumentElement().hasAttribute("root")) { - throw new PackageMapParsingException("root attribute under element " + doc.getDocumentElement().getTagName() + " is missing in file: " + file); - } - if (!doc.getDocumentElement().hasAttribute("layer")) { - throw new PackageMapParsingException("layer attribute under element " + doc.getDocumentElement().getTagName() + " is missing in file: " + file); - } - setRoot(doc.getDocumentElement().getAttribute("root")); - setLayer(doc.getDocumentElement().getAttribute("layer")); + try { + DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document doc = builder.parse(file); + if (!doc.getDocumentElement().getNodeName().equals("PackageMap")) { + throw new PackageMapParsingException("Invalid XML format for " + file.getAbsolutePath() + " root element must be PackageMap"); + } + if (!doc.getDocumentElement().hasAttribute("root")) { + throw new PackageMapParsingException("root attribute under element " + doc.getDocumentElement().getTagName() + " is missing in file: " + file); + } + if (!doc.getDocumentElement().hasAttribute("layer")) { + throw new PackageMapParsingException("layer attribute under element " + doc.getDocumentElement().getTagName() + " is missing in file: " + file); + } + setRoot(doc.getDocumentElement().getAttribute("root")); + setLayer(doc.getDocumentElement().getAttribute("layer")); } catch (ParserConfigurationException e) { throw new PackageMapParsingException("Error from the XML parser configuration: " + e.getMessage(), e); } catch (SAXException e) { diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/antlib.xml --- a/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/antlib.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/antlib.xml Wed Jun 16 16:51:40 2010 +0300 @@ -27,6 +27,8 @@ + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/taskdefs/CreatePackageMappingTask.java --- a/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/taskdefs/CreatePackageMappingTask.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/taskdefs/CreatePackageMappingTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -76,7 +76,6 @@ private Map pkgMapping = new HashMap(); private File epocroot; private File destFile; - private Map pkgQualityMapping = new HashMap(); private String filteredDirSet; /** @@ -84,75 +83,50 @@ * @param pkgMapFile a pointer to a package map file. * @throws PackageMapParsingException */ - protected void retrievePackageMapping(File pkgMapFile) throws PackageMapParsingException { + protected void retrievePackageMapping(File pkgMapFile, List filterDirs) throws PackageMapParsingException { PackageMap parser = new PackageMap(pkgMapFile); - log("parent file: " + pkgMapFile.getParentFile()); + log("parent file: " + pkgMapFile.getParentFile(), Project.MSG_DEBUG); log("parent file: " + getEpocroot() + parser.getRoot() + "/" + parser.getLayer() + - "/" + pkgMapFile.getParentFile().getName()); - pkgMapping.put(pkgMapFile.getParentFile(), - new File(getEpocroot(), parser.getRoot() + "/" + parser.getLayer() + + "/" + pkgMapFile.getParentFile().getName(), Project.MSG_DEBUG); + if (filterDirs == null) { + pkgMapping.put(pkgMapFile.getParentFile(), + new File(getEpocroot(), parser.getRoot() + "/" + parser.getLayer() + "/" + pkgMapFile.getParentFile().getName())); + } else { + for (File dir : filterDirs) { + if (pkgMapFile.getParentFile().equals(dir)) { + pkgMapping.put(pkgMapFile.getParentFile(), + new File(getEpocroot(), parser.getRoot() + "/" + parser.getLayer() + + "/" + pkgMapFile.getParentFile().getName())); + return; + } + } + } } - protected void createIniFile() throws IOException { - File baseQualityMappingFolder = destFile.getParentFile(); - if (!baseQualityMappingFolder.exists()) { - throw new BuildException("Folder not exists: " - + baseQualityMappingFolder); - } + @SuppressWarnings("unchecked") + protected List getFilterDir() throws IOException { if (filteredDirSet != null) { - Hashtable references = getProject().getReferences(); + Hashtable references = getProject().getReferences(); Object filteredDirSetObject = references.get(filteredDirSet); - log("filteredDirSetObject: " + filteredDirSetObject); if (filteredDirSetObject != null) { - if (! (filteredDirSetObject instanceof DirSet)) { - throw new BuildException ("filteredDirSet is not of type " - + "fileset"); + if (!(filteredDirSetObject instanceof DirSet)) { + throw new BuildException("filteredDirSet is not of type " + + "dirset"); } List fileList = new ArrayList(); DirSet dset = (DirSet)filteredDirSetObject; DirectoryScanner ds = dset.getDirectoryScanner(getProject()); String[] includedFiles = ds.getIncludedDirectories(); - log("includedFiles.size: " + includedFiles.length); - for ( String file : includedFiles ) { + for (String file : includedFiles) { fileList.add(new File(ds.getBasedir(), file)); - log("includedfile: " + file); } - Properties properties = new Properties(); - for (File qualityDir : fileList) { - log("qualityDir: " + qualityDir, - Project.MSG_DEBUG); - for (File key : pkgMapping.keySet()) { - log("pkgMapping:key: " + key, - Project.MSG_DEBUG); - if ((qualityDir.getAbsolutePath()).equals(key.getAbsolutePath())) { - String replacedKey = key.getAbsolutePath().replace('\\', '/'); - String replacedValue = - pkgMapping.get(key).getAbsolutePath().replace('\\', '/'); - properties.setProperty(replacedKey, - replacedValue); - } - } - } - if (properties.isEmpty() ) { - log("No mapping found for quality dir input: " + - filteredDirSet, Project.MSG_WARN); - return; - } - log("Creating " + destFile); - FileOutputStream fos = new FileOutputStream(destFile); - properties.store(fos, "DO NOT EDIT - File generated automatically"); - fos.close(); - return; + return fileList; } else { - log("filteredDirSet is not valid, using default mapping", - Project.MSG_WARN); + throw new BuildException("Id '" + filteredDirSet + "' doesn't reference a type."); } - } else { - log("filterDirSet attribute is not set, using default mapping ", - Project.MSG_WARN); - createDefaultIniFile(destFile); } + return null; } /** * Generates the ini file. @@ -160,12 +134,13 @@ * @throws IOException in case of error while generating the file. */ @SuppressWarnings("unchecked") - protected void createDefaultIniFile(File mappingFile) throws IOException { + protected void createIniFile(File mappingFile) throws IOException { + List filterDirs = getFilterDir(); for (ResourceCollection rc : resourceCollections) { Iterator ri = (Iterator)rc.iterator(); while (ri.hasNext()) { - Resource r = ri.next(); - File pkgFile = new File(r.toString()); // toString is representing the abs path + Resource resource = ri.next(); + File pkgFile = new File(resource.toString()); // toString is representing the abs path log("Checking " + pkgFile.getName(), Project.MSG_DEBUG); if (pkgFile.getName().equalsIgnoreCase(PACKAGE_DEFINITION_FILENAME) && pkgFile.exists()) { @@ -176,14 +151,15 @@ if (pkgMapFile.exists()) { log("Found package: " + pkgFile); try { - retrievePackageMapping(pkgMapFile); + retrievePackageMapping(pkgMapFile, filterDirs); } catch (PackageMapParsingException e) { log(e.getMessage(), Project.MSG_ERR); if (shouldFailOnError()) { throw new BuildException(e.getMessage(), e); } } - } else { + } else if (!(new File(pkgFile.getParentFile(), + "../../" + PACKAGE_MAP_FILENAME).exists())) { log("Could not find: " + pkgMapFile.getAbsolutePath(), Project.MSG_ERR); if (shouldFailOnError()) { @@ -216,6 +192,10 @@ properties.setProperty(replacedKey, replacedValue); } + if (properties.isEmpty() && filteredDirSet != null) { + log("Empty mapping after filtering (filter: " + + filteredDirSet + ")", Project.MSG_WARN); + } log("Creating " + mappingFile); FileOutputStream fos = new FileOutputStream(mappingFile); properties.store(fos, "DO NOT EDIT - File generated automatically"); @@ -230,14 +210,11 @@ throw new BuildException("The 'epocroot' attribute is not defined"); } if (destFile == null) { - throw new BuildException("destFile is must"); + throw new BuildException("The 'destFile' attribute is not defined"); } - try { - if (destFile != null) { - createIniFile(); - } + createIniFile(destFile); } catch (FileNotFoundException e) { throw new BuildException("Error generating the output file: " + e.getMessage(), e); } catch (IOException e) { diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/taskdefs/CreateRootSysdefTask.java --- a/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/taskdefs/CreateRootSysdefTask.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/taskdefs/CreateRootSysdefTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -65,6 +65,7 @@ private Map> layers = new HashMap>(); private File epocroot; private boolean failOnError = true; + private boolean checkPackageExists; private File template; /** @@ -86,30 +87,55 @@ for (ResourceCollection rc : resourceCollections) { Iterator ri = (Iterator)rc.iterator(); while (ri.hasNext()) { - Resource r = ri.next(); - File pkgDefFile = new File(r.toString()); - log("pkgDefFile :" + pkgDefFile); + Resource resource = ri.next(); + File pkgDefFile = new File(resource.toString()); + log("Package definition file: " + pkgDefFile); if (!pkgDefFile.exists() || !(pkgDefFile.getName().equalsIgnoreCase( CreatePackageMappingTask.PACKAGE_DEFINITION_FILENAME))) { throw new BuildException("Missing Package Definition file"); } - File pkgDir = new File(r.toString()).getParentFile(); + File pkgDir = pkgDefFile.getParentFile(); File pkgMapFile = new File(pkgDir, CreatePackageMappingTask.PACKAGE_MAP_FILENAME); try { if (pkgMapFile.exists()) { + log("Package map file: " + pkgMapFile); + if (!checkPackageExists) { addPackage(pkgMapFile, pkgDir.getName()); - log("Adding: " + pkgMapFile, Project.MSG_DEBUG); + } else { + PackageMap pkgMap = new PackageMap(pkgMapFile); + File destPkg = new File(epocroot, pkgMap.getRoot() + File.separator + + pkgMap.getLayer() + File.separator + pkgDir.getName() + File.separator + + CreatePackageMappingTask.PACKAGE_DEFINITION_FILENAME); + if (destPkg.exists()) { + addPackage(pkgMapFile, pkgDir.getName()); + } else { + log("Could not find " + destPkg.getAbsolutePath() + + " so entry is not added to the root system definition.", Project.MSG_ERR); + } + } } else { - pkgMapFile = new File(pkgDir, "/../../" + CreatePackageMappingTask.PACKAGE_MAP_FILENAME); - log("pkgMapFile: " + pkgMapFile); - File base1File = new File(r.toString()).getParentFile(); - String base1 = base1File.getName(); - log("base1: " + base1); - String base2 = base1File.getParentFile().getName(); - log("base2: " + base2); + pkgMapFile = new File(pkgDir.getParentFile().getParentFile(), CreatePackageMappingTask.PACKAGE_MAP_FILENAME); + log("Package map file: " + pkgMapFile); if (pkgMapFile.exists()) { - addPackage(pkgMapFile, base2 + "/" + base1); + if (!checkPackageExists) { + addPackage(pkgMapFile, pkgDir.getName()); + } else { + PackageMap pkgMap = new PackageMap(pkgMapFile); + File destPkg = new File(epocroot, pkgMap.getRoot() + File.separator + + pkgMap.getLayer() + File.separator + + pkgMapFile.getParentFile().getName() + File.separator + + pkgDir.getParentFile().getName() + File.separator + pkgDir.getName() + + File.separator + + CreatePackageMappingTask.PACKAGE_DEFINITION_FILENAME); + if (destPkg.exists()) { + addPackage(pkgMapFile, pkgDir.getParentFile().getName() + + File.separator + pkgDir.getName()); + } else { + log("Could not find " + destPkg.getAbsolutePath() + + " so entry is not added to the root system definition.", Project.MSG_ERR); + } + } } else { log("Could not find: " + pkgMapFile.toString(), Project.MSG_ERR); if (shouldFailOnError()) { @@ -133,6 +159,7 @@ private void addPackage(File pkgMapFile, String pkgPath) throws PackageMapParsingException { + log("Adding: " + pkgMapFile, Project.MSG_DEBUG); // Adding the package in the structure. PackageMap pkgMap = new PackageMap(pkgMapFile); if (!roots.containsKey(pkgMap.getRoot())) { @@ -196,6 +223,16 @@ public boolean shouldFailOnError() { return failOnError; } + + /** + * Defines if the task should check the existence of the + * target package_definition.xml under epocroot. + * @param checkPackageExists + * @ant.not-required Default false + */ + public void setCheckPackageExists(boolean checkPackageExists) { + this.checkPackageExists = checkPackageExists; + } /** * Support of nested resource collection like path or fileset. @@ -278,7 +315,7 @@ String rel = getEpocroot().toURI().relativize(getDestFile().getParentFile().toURI()).getPath(); String[] relArray = rel.split("/"); // This is an URI not a File. rel = ""; - for (String e : relArray) { + for (String string : relArray) { rel += ".." + File.separatorChar; } return rel; diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/taskdefs/FilterTask.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/taskdefs/FilterTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.sysdef.ant.taskdefs; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.util.FileUtils; + +import com.nokia.helium.sysdef.ant.types.Filter; +import com.nokia.helium.sysdef.ant.types.FilterSet; + +/** + *

    This task allows to do the filtering operation on system definition file v3.0.

    + * + *

    The following example shows how you can join the X:\layer.sysdef.xml under + * X:\filtered_layer.sysdef.xml.

    + * + * E.g: + *
    + *   <hlm:filterSysdef epocroot="X:\" srcfile="X:\layer.sysdef.xml" 
    + *                      destfile="X:\filtered_layer.sysdef.xml">
    + *       <filterset> 
    + *           <filter filter="test" type="has" /> 
    + *       </filterset> 
    + *   </hlm:filterSysdef>
    + * 
    + * + * For more information about system definition file v3.0 please check + * http://developer.symbian.org/wiki/index.php/System_Definition. + * + * @ant.task name="filterSysdef" category="Sysdef" + */ +public class FilterTask extends AbstractSydefTask { + private static final String XSLT = "sf/os/buildtools/bldsystemtools/sysdeftools/filtering.xsl"; + private List filterSets = new ArrayList(); + + /** + * Running the filtering operation on src file and put the result in dest file. + * @param src the source file + * @param dest the destination file + * @param filter the filter to use + * @param filterType the filter type to use (e.g has, only, with) + */ + protected void filter(File src, File dest, String filter, String filterType) { + Map params = new Hashtable(); + params.put("filter-type", filterType); + params.put("filter", filter); + transform(params); + } + + /** + * Create a FilterSet object to store filters. + * @return a new FilterSet object + */ + public FilterSet createFilterSet() { + FilterSet filterset = new FilterSet(); + filterSets.add(filterset); + return filterset; + } + + /** + * Add a FilterSet object. + */ + public void add(FilterSet filterset) { + filterSets.add(filterset); + } + + /** + * {@inheritDoc} + */ + public void execute() { + check(); + if (filterSets.isEmpty()) { + throw new BuildException("You must define at least one nested filterset element."); + } + log("Filtering " + this.getSrcFile()); + for (FilterSet filterSet : filterSets) { + if (filterSet.isReference()) { + filterSet = (FilterSet)filterSet.getRefid().getReferencedObject(); + } + List toDelete = new ArrayList(); + try { + File src = this.getSrcFile(); + File dst = null; + for (Filter filter : filterSet.getFilters()) { + if (filter.getFilter() == null) { + throw new BuildException("'filter' attribute is not defined."); + } + dst = File.createTempFile("sysdef", ".xml", this.getEpocroot()); + toDelete.add(dst); + filter(src, dst, filter.getFilter(), filter.getType()); + // Dest is the input for next loop. + src = dst; + } + if (dst != null) { + log("Creating " + this.getDestFile()); + FileUtils.getFileUtils().copyFile(dst, getDestFile()); + } else { + // If nothing to do it is just identity, + // so copying the source file + log("Creating " + this.getDestFile()); + FileUtils.getFileUtils().copyFile(getSrcFile(), getDestFile()); + } + } catch (IOException e) { + throw new BuildException(e.getMessage(), e); + } finally { + for (File file : toDelete) { + file.delete(); + } + } + } + } + + /** + * {@inheritDoc} + */ + @Override + File getXsl() { + return new File(this.getEpocroot(), XSLT); + } +} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/taskdefs/MergeTask.java --- a/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/taskdefs/MergeTask.java Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/taskdefs/MergeTask.java Wed Jun 16 16:51:40 2010 +0300 @@ -101,8 +101,8 @@ for (ResourceCollection rc : resourceCollections) { Iterator ri = (Iterator)rc.iterator(); while (ri.hasNext()) { - Resource r = ri.next(); - File rFile = new File(r.toString()); + Resource resource = ri.next(); + File rFile = new File(resource.toString()); if (first) { log("Merging " + rFile); tempFile.delete(); diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/types/Filter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/types/Filter.java Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,59 @@ +/* +* 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.sysdef.ant.types; + +/** + * This type defines a system definition filter. + * + */ +public class Filter { + private String filter; + private String type = "has"; + + /** + * Define the filter + * @param filter the filter string. + */ + public void setFilter(String filter) { + this.filter = filter; + } + + /** + * Get the filter. + */ + public String getFilter() { + return filter; + } + + /** + * Define the filter type + * @param type + * @ant.not-required Default has. + */ + public void setType(SydefFilterTypeEnum type) { + this.type = type.getValue(); + } + + /** + * Get the filter type. + * @return + */ + public String getType() { + return type; + } + +} \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/types/FilterSet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/types/FilterSet.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.sysdef.ant.types; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.tools.ant.types.DataType; + +/** + * This Ant type defines a set of system definition + * filters. + * + */ +public class FilterSet extends DataType { + private List filters = new ArrayList(); + + /** + * Create a new nested filter. + */ + public Filter createFilter() { + Filter filter = new Filter(); + filters.add(filter); + return filter; + } + + /** + * Get the list of filter + * @return a list of filters + */ + public List getFilters() { + return filters; + } + + +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/types/SydefFilterTypeEnum.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/types/SydefFilterTypeEnum.java Wed Jun 16 16:51:40 2010 +0300 @@ -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.sysdef.ant.types; + +import org.apache.tools.ant.types.EnumeratedAttribute; + +/** + * This class defines the keyword supported by the type + * attribute of the Filter class. + * + * It currenly defines the following keywords: only, with, has. + */ +public class SydefFilterTypeEnum extends EnumeratedAttribute { + private String[] values = {"only", "with", "has"}; + + /** + * {@inheritDoc} + */ + @Override + public String[] getValues() { + return values; + } +} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/tests/antunit/test_create_root_sysdef.ant.xml --- a/buildframework/helium/sf/java/sysdef/tests/antunit/test_create_root_sysdef.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/sysdef/tests/antunit/test_create_root_sysdef.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -1,7 +1,7 @@ + + Helium antlib filter sysdef tests. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/tests/antunit/test_mapping_file_creation.ant.xml --- a/buildframework/helium/sf/java/sysdef/tests/antunit/test_mapping_file_creation.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/java/sysdef/tests/antunit/test_mapping_file_creation.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -42,13 +42,15 @@ - - - - - - - + + + + + + + + + @@ -58,11 +60,24 @@
    - + + + + + + + + + + + + + - - + + @@ -89,13 +104,17 @@ + + + + filterDirSet="filter.dir" destFile="${epocroot.temp}/quality.ini"> + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/tests/data/filter/canonical_system_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/sysdef/tests/data/filter/canonical_system_definition.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/tests/data/rootsysdef/epocroot_valid/root/layer/valid_package/package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/sysdef/tests/data/rootsysdef/epocroot_valid/root/layer/valid_package/package_definition.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/tests/data/rootsysdef/epocroot_valid/root/layer/vendor_package/package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/sysdef/tests/data/rootsysdef/epocroot_valid/root/layer/vendor_package/package_definition.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/tests/data/rootsysdef/epocroot_valid/root/layer/vendor_package/package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/sysdef/tests/data/rootsysdef/epocroot_valid/root/layer/vendor_package/package_map.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,23 @@ + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/java/sysdef/tests/data/rootsysdef/epocroot_valid/root/layer/vendor_package/vendor_package_info/nokia_vendor_package_metadata/package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/java/sysdef/tests/data/rootsysdef/epocroot_valid/root/layer/vendor_package/vendor_package_info/nokia_vendor_package_metadata/package_definition.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/ivy.xml --- a/buildframework/helium/sf/python/pythoncore/ivy.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/ivy.xml Wed Jun 16 16:51:40 2010 +0300 @@ -39,5 +39,6 @@ + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/archive/builders.py --- a/buildframework/helium/sf/python/pythoncore/lib/archive/builders.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/archive/builders.py Wed Jun 16 16:51:40 2010 +0300 @@ -115,10 +115,23 @@ writer.close() def getCommonUncRoots(self, uncPaths): - """get common UNC roots""" + """ Get common UNC roots. + The following [r'\\server1\foo\bar', r'\\server2\foo', r'\\server1\foo'] input + will return [r'\\server1\foo\', r'\\server2\foo']. + """ commonRoots = {} + uncPaths = [os.path.normpath(p_path) for p_path in uncPaths] + # sorting the input by alphabetical order, so smaller roots + # are coming first. + uncPaths.sort() for p_path in uncPaths: - commonRoots["\\\\" + os.sep.join(p_path[2:].split(os.sep)[0:2]) + os.sep] = 1 + common_path = "\\\\" + for p_comp in p_path[2:].split(os.sep): + common_path = common_path + p_comp + os.sep + if common_path in commonRoots: + break + else: + commonRoots[common_path] = 1 return commonRoots.keys() def getPrefix(self, dir, commonUncRoots): @@ -138,7 +151,7 @@ # Of course this is only on windows platform if os.sep == '\\': for config in self.configs: - (drive, root_dir) = os.path.splitdrive(os.path.normpath(config['root.dir'])) + (drive, root_dir) = os.path.splitdrive(os.path.abspath(os.path.normpath(config['root.dir']))) _logger.debug("drive=%s, root_dir=%s" % (drive, root_dir)) if drive == "": self.listToFindPrefix.append(root_dir) @@ -153,14 +166,16 @@ substDrives.append(driveMapping[root] + os.sep) for config in self.configs: - (drive, root_dir) = os.path.splitdrive(os.path.normpath(config['root.dir']) + os.sep) + (drive, root_dir) = os.path.splitdrive(os.path.abspath(os.path.normpath(config['root.dir'])) + os.sep) if drive == "": for root in driveMapping: if root_dir.startswith(root): config['root.dir'] = os.path.normpath(driveMapping[root] + os.sep + root_dir[len(root):len(root_dir)]) _logger.info("Updated %s in %s" % (root_dir, config['root.dir'])) config['unsubst.dir'] = driveMapping[root] - break + break + else: + _logger.error("Could not find root for %s." % root_dir) elif drive != build_drive: if config['root.dir'] not in substDrives: substDrives.append(config['root.dir']) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/archive/selectors.py --- a/buildframework/helium/sf/python/pythoncore/lib/archive/selectors.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/archive/selectors.py Wed Jun 16 16:51:40 2010 +0300 @@ -141,9 +141,9 @@ return True return False -SELECTORS = {'policy': lambda config: DistributionPolicySelector(config.get_list('policy.filenames', ['Distribution.Policy.S60']), config['policy.value']), - 'symbian.policy': lambda config: SymbianPolicySelector(config.get_list('policy.filenames', ['distribution.policy']), config['policy.value']), - 'distribution.policy.s60': lambda config: DistributionPolicySelector(['Distribution.Policy.S60'], config['distribution.policy.s60'], config['ignore.missing.policyfiles'] == 'true'), +SELECTORS = {'policy': lambda config: DistributionPolicySelector(config.get_list('policy.filenames', ['Distribution.Policy.S60', 'distribution.policy', 'distribution.policy.pp']), config['policy.value']), + 'symbian.policy': lambda config: SymbianPolicySelector(config.get_list('policy.filenames', ['distribution.policy']), config['policy.value']), + 'distribution.policy.s60': lambda config: DistributionPolicySelector(['Distribution.Policy.S60', 'distribution.policy', 'distribution.policy.pp'], config['distribution.policy.s60'], config['ignore.missing.policyfiles'] == 'true'), } def get_selector(name, config): diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/ats3/__init__.py --- a/buildframework/helium/sf/python/pythoncore/lib/ats3/__init__.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/ats3/__init__.py Wed Jun 16 16:51:40 2010 +0300 @@ -50,41 +50,52 @@ self._opts = opts c_parser = parser.CppParser() temp_dict = {} - pkg_parser = parser.PkgFileParser() # Customize some attributes from how optparse leaves them. - self.build_drive = path(self._opts.build_drive) + if hasattr(self._opts, 'build_drive'): + self.build_drive = path(self._opts.build_drive) self.file_store = path(self._opts.file_store) self.flash_images = split_paths(self._opts.flash_images) - self.sis_files = split_paths(self._opts.sis_files) - self.config_file = self._opts.config - self.obey_pkgfiles = to_bool(self._opts.obey_pkgfiles) - self.hti = to_bool(self._opts.hti) - self.specific_pkg = self._opts.specific_pkg - if self.specific_pkg == '': - self.specific_pkg = None + if hasattr(self._opts, 'sis_files'): + self.sis_files = split_paths(self._opts.sis_files) + if hasattr(self._opts, 'config'): + self.config_file = self._opts.config + if hasattr(self._opts, 'obey_pkgfiles'): + self.obey_pkgfiles = to_bool(self._opts.obey_pkgfiles) + if hasattr(self._opts, 'hti'): + self.hti = to_bool(self._opts.hti) + if hasattr(self._opts, 'test_type'): + self.test_type = self._opts.test_type + if hasattr(self._opts, 'specific_pkg'): + self.specific_pkg = self._opts.specific_pkg + if self.specific_pkg == '': + self.specific_pkg = None self.tsrc_paths_dict = {} - - ats_nd = self._opts.ctc_run_process_params.strip() - if ats_nd != "": - ats_nd = ats_nd.split("#")[0].strip() - if ats_nd == "": - self._opts.ctc_run_process_params = "" - _logger.warning("Property \'ats.ctc.host\' is not set. Code coverage measurement report(s) will not be created.") + if hasattr(self._opts, 'ctc_run_process_params'): + ats_nd = self._opts.ctc_run_process_params.strip() + if ats_nd != "": + ats_nd = ats_nd.split("#")[0].strip() + if ats_nd == "": + self._opts.ctc_run_process_params = "" + _logger.warning("Property \'ats.ctc.host\' is not set. Code coverage measurement report(s) will not be created.") main_comps = [] for tsrc in tsrc_paths: hrh = os.path.join(self.build_drive + os.sep, 'epoc32', 'include', 'feature_settings.hrh') - if os.path.exists(hrh): - temp_dict = c_parser.get_cpp_output(path(tsrc), "d", hrh) + if os.path.exists(tsrc): + if os.path.exists(hrh): + temp_dict = c_parser.get_cpp_output(path(tsrc), "d", hrh) + else: + temp_dict = c_parser.get_cpp_output(path(tsrc), "d") + for t_key, t_value in temp_dict.items(): + self.tsrc_paths_dict[t_key] = t_value else: - temp_dict = c_parser.get_cpp_output(path(tsrc), "d") - for t_key, t_value in temp_dict.items(): - self.tsrc_paths_dict[t_key] = t_value + _logger.error(tsrc + ' not found') #preparing a list of main components for main_component in self.tsrc_paths_dict.keys(): + pkg_parser = parser.PkgFileParser(main_component) if self.obey_pkgfiles == "True": if pkg_parser.get_pkg_files(main_component) != []: main_comps.append(main_component) @@ -126,27 +137,48 @@ def __init__(self, config): self.diamonds_build_url = config.diamonds_build_url - self.ctc_run_process_params = config.ctc_run_process_params + if hasattr(config, 'ctc_run_process_params'): + self.ctc_run_process_params = config.ctc_run_process_params self.testrun_name = config.testrun_name - self.harness = config.harness + if hasattr(config, 'harness'): + self.harness = config.harness self.device_type = config.device_type - self.device_hwid = config.device_hwid - self.plan_name = config.plan_name + if hasattr(config, 'device_hwid'): + self.device_hwid = config.device_hwid + if hasattr(config, 'plan_name'): + self.plan_name = config.plan_name self.report_email = config.report_email + self.report_type = 'ATS3_REPORT' + if hasattr(config, 'report_type'): + self.report_type = config.report_type self.file_store = config.file_store self.test_timeout = config.test_timeout - self.eunitexerunner_flags = config.eunitexerunner_flags + if hasattr(config, 'eunitexerunner_flags'): + self.eunitexerunner_flags = config.eunitexerunner_flags self.sets = [] self.src_dst = [] self.pmd_files = [] self.trace_activation_files = [] - self.trace_enabled = to_bool(config.trace_enabled) - self.ctc_enabled = to_bool(config.ctc_enabled) - self.multiset_enabled = to_bool(config.multiset_enabled) - self.monsym_files = config.monsym_files - self.hti = config.hti + self.trace_enabled = 'False' + if hasattr(config, 'trace_enabled'): + self.trace_enabled = to_bool(config.trace_enabled) + self.ctc_enabled = 'False' + if hasattr(config, 'ctc_enabled'): + self.ctc_enabled = to_bool(config.ctc_enabled) + if hasattr(config, 'multiset_enabled'): + self.multiset_enabled = to_bool(config.multiset_enabled) + if hasattr(config, 'monsym_files'): + self.monsym_files = config.monsym_files + if hasattr(config, 'hti'): + self.hti = config.hti + if hasattr(config, 'custom_template'): + self.custom_template = config.custom_template self.component_path = "" self.custom_dir = None + if hasattr(config, 'flash_images'): + self.flash_images = config.flash_images + if hasattr(config, 'test_type'): + self.test_type = config.test_type def insert_set(self, data_files=None, config_files=None, engine_ini_file=None, image_files=None, sis_files=None, @@ -206,6 +238,7 @@ eunit = False stif = False stifunit = False + generic = False for setd in self.sets: if setd["test_harness"] == "STIF": stif = True @@ -213,8 +246,12 @@ eunit = True elif setd["test_harness"] == "STIFUNIT": stifunit = True + else: + generic = True - if eunit and stif: + if stif and generic: + self.harness = "MULTI_HARNESS_GENERIC_STIF" + elif eunit and stif: self.harness = "MULTI_HARNESS" elif eunit: self.harness = "EUNIT" @@ -259,14 +296,14 @@ email_action = ("SendEmailAction", (("subject", self.EMAIL_SUBJECT), - ("type", "ATS3_REPORT"), + ("type", self.report_type), ("send-files", "true"), ("additional-description", email_url), ("to", self.report_email))) else: email_action = ("SendEmailAction", (("subject", self.EMAIL_SUBJECT), - ("type", "ATS3_REPORT"), + ("type", self.report_type), ("send-files", "true"), ("to", self.report_email))) ats3_report = ("FileStoreAction", @@ -427,6 +464,8 @@ default="") cli.add_option("--report-email", help="Email notification receivers", default="") + cli.add_option("--report-type", help="Email notification type", + default="") cli.add_option("--plan-name", help="Name of the test plan", default="plan") cli.add_option("--sis-files", help="Paths to the sis files", diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/ats3/aste.py --- a/buildframework/helium/sf/python/pythoncore/lib/ats3/aste.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/ats3/aste.py Wed Jun 16 16:51:40 2010 +0300 @@ -446,7 +446,6 @@ if opts.verbose: _logger.setLevel(logging.DEBUG) logging.basicConfig(level=logging.DEBUG) - _ = tempfile.mkdtemp() config = Configuration(opts) create_drop(config) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/ats3/custom.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/python/pythoncore/lib/ats3/custom.py Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,62 @@ +#============================================================================ +#Name : custom.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 ats3 +import ats3.dropgenerator as adg +from optparse import OptionParser +from path import path # pylint: disable-msg=F0401 +import logging +_logger = logging.getLogger('ats') + +def create_drop(config): + """Create a test drop.""" + test_plan = ats3.Ats3TestPlan(config) + test_plan.set_plan_harness() + flash_images = [path(p) for p in config.flash_images] + test_plan.insert_set(image_files=flash_images) + generator = adg.Ats3TemplateTestDropGenerator() + _logger.info("generating drop file: %s" % config.drop_file) + generator.generate(test_plan, output_file=config.drop_file, config_file=config.config_file) + +def main(): + cli = OptionParser(usage="%prog [options]") + cli.add_option("--device-type", help="Device type (e.g. 'PRODUCT')", default="unknown") + cli.add_option("--diamonds-build-url", help="Diamonds build url", default='') + cli.add_option("--drop-file", help="Name for the final drop zip file", default="ATS3Drop.zip") + cli.add_option("--file-store", help="Destination path for reports.", default="") + cli.add_option("--flash-images", help="Paths to the flash image files", default="") + cli.add_option("--report-email", help="Email notification receivers", default="") + cli.add_option("--testrun-name", help="Name of the test run", default="run") + cli.add_option("--config", help="Path to the config file", default="") + cli.add_option("--test-timeout", help="Test execution timeout value (default: %default)", default="60") + cli.add_option("--custom-template", help="Path to the ats template file") + cli.add_option("--ats4-enabled", help="ATS4 enabled", default="True") + cli.add_option("--verbose", help="Increase output verbosity", action="store_true", default=True) + cli.add_option("--test-type", help="Name of test harness") + opts, _ = cli.parse_args() + + if opts.verbose: + _logger.setLevel(logging.DEBUG) + logging.basicConfig(level=logging.DEBUG) + + config = ats3.Configuration(opts, []) + create_drop(config) + +if __name__ == "__main__": + main() \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/ats3/dropgenerator.py --- a/buildframework/helium/sf/python/pythoncore/lib/ats3/dropgenerator.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/ats3/dropgenerator.py Wed Jun 16 16:51:40 2010 +0300 @@ -818,6 +818,8 @@ harness = test_plan["harness"] if harness == "MULTI_HARNESS": input_targets(test_plan, root, ["STIF", "EUNIT"]) + elif harness == "MULTI_HARNESS_GENERIC_STIF": + input_targets(test_plan, root, ["STIF", "GENERIC"]) elif harness == "STIF": input_targets(test_plan, root, ["STIF"]) elif harness == "EUNIT": @@ -983,7 +985,11 @@ loader = jinja2.ChoiceLoader([jinja2.PackageLoader(__name__, 'templates')] + customdirs) env = jinja2.Environment(loader=loader) - template = env.from_string(pkg_resources.resource_string(__name__, 'ats4_template.xml'))# pylint: disable-msg=E1101 + + if hasattr(test_plan, 'custom_template'): + template = env.from_string(open(test_plan.custom_template).read()) + else: + template = env.from_string(pkg_resources.resource_string(__name__, 'ats4_template.xml'))# pylint: disable-msg=E1101 xmltext = template.render(test_plan=test_plan, os=os, atspath=atspath, atsself=self).encode('ISO-8859-1') return et.ElementTree(et.XML(xmltext)) \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/ats3/parsers.py --- a/buildframework/helium/sf/python/pythoncore/lib/ats3/parsers.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/ats3/parsers.py Wed Jun 16 16:51:40 2010 +0300 @@ -143,8 +143,7 @@ a dictionary (or nested dictionary) of paths and their dependencies. """ bld_parser = BldFileParser() - pkg_parser = PkgFileParser() - mmp_parser = MmpFileParser() + pkg_parser = PkgFileParser(bldpath=path_to_bld) temp_path = os.getcwd() parent = os.getcwd() @@ -186,6 +185,7 @@ break for t_case in test_cases: + mmp_parser = MmpFileParser(t_case[1]) if t_case[0] == t_case[1] and (not bld_parser.get_test_mmp_files(t_case[1])): del t_case elif t_case[0] in main_level: @@ -376,9 +376,10 @@ - libraries listed in the mmp """ - def __init__(self): + def __init__(self, bldpath): self.mmp_files = [] self.path_to_mmp = "" + self.bldpath = bldpath def get_target_filetype(self, path_to_mmp = None): """ @@ -464,10 +465,9 @@ self.path_to_mmp = path(self.path_to_mmp) if not ".mmp" in str(self.path_to_mmp).lower(): bld_parser = BldFileParser() - self.mmp_files = bld_parser.get_test_mmp_files(self.path_to_mmp, False) - - for mpath in self.mmp_files: - lst_mmp_paths.append(os.path.join(self.path_to_mmp, mpath)) + self.mmp_files = bld_parser.get_test_mmp_files(self.bldpath) + if self.mmp_files: + lst_mmp_paths = lst_mmp_paths + self.mmp_files else: lst_mmp_paths.append(self.path_to_mmp) @@ -545,18 +545,19 @@ for every file in the pkg file """ - def __init__(self, platform = None, specific_pkg = None): + def __init__(self, bldpath, platform = None, specific_pkg = None, drive=''): self.platform = platform self.build_platform = None if self.platform is not None and "_" in self.platform: plat_tar = re.search(r"(.*)_(.*).pkg", self.platform) self.build_platform, self.build_target = plat_tar.groups() - self.drive = "" + self.drive = drive self._files = [] self.pkg_files = [] self.pkg_file_path = None self.exclude = "" self.location = None + self.bldpath = bldpath self.specific_pkg = specific_pkg if specific_pkg: self.platform = specific_pkg + '.pkg' @@ -636,11 +637,11 @@ for p_file in self.get_pkg_files(self.location, True): self._files.append(p_file) - return self.__read_pkg_file(self._files) + return self.read_pkg_file(self._files) def __map_pkg_path(self, pkg_line, pkg_file_path, pkg_file): """Parse package file to get the src and dst paths" for installing files""" - mmp_parser = MmpFileParser() + mmp_parser = MmpFileParser(self.bldpath) ext = "" val1 = "" val2 = "" @@ -669,7 +670,7 @@ val1 = val1.lower().replace("$(target)", self.build_target) if path.isabs(path(val1).normpath()): - map_src = str(path.joinpath(self.drive, val1).normpath()) + map_src = os.path.normpath(os.path.join(self.drive, val1)) elif re.search(r"\A\w", val1, 1): map_src = str(path.joinpath(self.pkg_file_path + os.sep, os.path.normpath(val1)).normpath()) else: @@ -684,10 +685,10 @@ map_dst = map_dst.replace("$:", "c:") map_dst = re.sub(r'^(\w)', r'\1', map_dst).strip() indx = map_dst.rsplit(".") - try: + if len(indx) > 1: ext = indx[1] - except IndexError: - _logger.warning("Index Error in map_pkg_path()") + else: + _logger.warning("File extension not found for " + map_dst) _test_type_ = "" _target_filename_ = "" @@ -738,10 +739,12 @@ if not map_src or map_src == "." or not map_dst or map_dst == ".": return None - + if not os.path.exists(map_src): + _logger.error(map_src + ' not found') + return None return path(map_src).normpath(), path(map_dst).normpath(), file_type, pkg_file - def __read_pkg_file(self, pkg_files): + def read_pkg_file(self, pkg_files): """Reads contents of PKG file""" pkg_paths = [] for pkg_file in pkg_files: @@ -755,7 +758,7 @@ except UnicodeError: file1 = open(pkg_file, 'r') lines = file1.readlines() - pkg_file_path = path((pkg_file.rsplit(os.sep, 1))[0]) + pkg_file_path = path(os.path.dirname(pkg_file)) for line in lines: pkg_path = self.__map_pkg_path(line, pkg_file_path, os.path.basename(pkg_file)) if pkg_path is None: diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/ats3/testconfigurator.py --- a/buildframework/helium/sf/python/pythoncore/lib/ats3/testconfigurator.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/ats3/testconfigurator.py Wed Jun 16 16:51:40 2010 +0300 @@ -45,10 +45,7 @@ def __init__(self, config): self.target_platform = config.target_platform - self.pkg_parser = parser.PkgFileParser(self.target_platform.replace(" ", "_")+".pkg", config.specific_pkg) - self.bld_parser = parser.BldFileParser() - self.mmp_parser = parser.MmpFileParser() self.data_dirs = config.data_dir self.flash_images = [path(p) for p in config.flash_images] @@ -61,6 +58,7 @@ self.trace_enabled = config.trace_enabled self.excludable_dlls = [] self.custom_dir = None + self.specific_pkg = config.specific_pkg def insert_testset_stif(self, src_dst, pkg_paths): """Inserts test set data to test plan for stif""" @@ -109,13 +107,14 @@ self.custom_dir = self.tsrc_dir.joinpath("custom") _logger.debug("using customized testing from %s" % self.custom_dir) if os.path.exists(self.tsrc_bld_dir.joinpath("group","bld.inf")): - mmp_files = self.bld_parser.get_test_mmp_files(self.tsrc_bld_dir.joinpath("group","bld.inf")) + bldinf = self.tsrc_bld_dir.joinpath("group","bld.inf") else: - mmp_files = self.bld_parser.get_test_mmp_files(self.tsrc_bld_dir.joinpath("bld.inf")) - - test_harness = self.mmp_parser.get_harness(mmp_files) - - pkg_paths = self.pkg_parser.get_data_files(self.tsrc_pkg_files(_paths_dict_), self.build_drive) + bldinf = self.tsrc_bld_dir.joinpath("bld.inf") + mmp_files = self.bld_parser.get_test_mmp_files(bldinf) + mmp_parser = parser.MmpFileParser(bldinf) + test_harness = mmp_parser.get_harness(mmp_files) + pkg_parser = parser.PkgFileParser(bldinf, self.target_platform.replace(" ", "_")+".pkg", self.specific_pkg) + pkg_paths = pkg_parser.get_data_files(self.tsrc_pkg_files(_paths_dict_), self.build_drive) if self.trace_enabled == "True": try: pmd_files = self.tsrc_pmd_files() @@ -135,7 +134,7 @@ elif test_harness == "EUNIT": try: - src_dst = self.pkg_parser.get_data_files(self.tsrc_pkg_files(_paths_dict_), self.build_drive) + src_dst = pkg_parser.get_data_files(self.tsrc_pkg_files(_paths_dict_), self.build_drive) except OSError: _logger.warning("No pkg file found in the directory ( %s )" % self.tsrc_pkg_dir) @@ -148,7 +147,7 @@ for dll_file in testmodule_files: if not self.check_dll_duplication(dll_file.name, src_dst): - _dll_type_ = self.mmp_parser.get_dll_type(self.tsrc_bld_dir) + _dll_type_ = mmp_parser.get_dll_type(self.tsrc_bld_dir) if dll_file.name in self.excludable_dlls: src_dst.append((dll_file, path(r"c:\sys\bin").joinpath(dll_file.name), "data:%s" % _dll_type_)) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/atsant.py --- a/buildframework/helium/sf/python/pythoncore/lib/atsant.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/atsant.py Wed Jun 16 16:51:40 2010 +0300 @@ -31,11 +31,12 @@ class IConfigATS(object): """ Class used to read configuration file iconfig.xml """ - def __init__(self, imagesdir): + def __init__(self, imagesdir, productname): self.imagesdir = imagesdir + self.productname = productname self.config = self.getconfig() - def getconfig(self, type=None): + def getconfig(self, type=None, productname=None): """get configuration""" noncust = None for root, _, files in os.walk(self.imagesdir, topdown=False): @@ -45,8 +46,8 @@ configBuilder = configuration.NestedConfigurationBuilder(open(filePath, 'r')) configSet = configBuilder.getConfiguration() for config in configSet.getConfigurations(): - if type: - if type in config.type: + if type and productname: + if type in config.type and config['PRODUCT_NAME'] in productname: return config else: noncust = config @@ -68,7 +69,7 @@ """find images""" output = '' for imagetype, imagetypename in [('core', 'CORE'), ('langpack', 'ROFS2'), ('cust', 'ROFS3'), ('udaerase', 'UDAERASE')]: - iconfigxml = self.getconfig(imagetype) + iconfigxml = self.getconfig(imagetype, self.productname) if iconfigxml == None: iconfigxml = self.config @@ -83,14 +84,25 @@ raise Exception(image + ' not found') else: if imagetype == 'core': - raise Exception(imagetypename + '_FLASH not found in iconfig.xml') + raise Exception(imagetypename + '_FLASH not found in iconfig.xml in ' + self.imagesdir) print imagetypename + '_FLASH not found in iconfig.xml' return output -def files_to_test(canonicalsysdeffile, excludetestlayers, idobuildfilter, builddrive): +def get_boolean(string_val): + """if parameter passed in is not present in the project it will produce 'none' + as a result so this will be converted to boolean false as will all values + except true.""" + retVal = False + if (string_val == 'true'): + retVal = True + return retVal + + +def files_to_test(canonicalsysdeffile, excludetestlayers, idobuildfilter, builddrive, createmultipledropfiles): """list the files to test""" sdf = sysdef.api.SystemDefinition(canonicalsysdeffile) - + + single_key = 'singledropfile' #default single drop file name modules = {} for layr in sdf.layers: if re.match(r".*_test_layer$", layr): @@ -104,8 +116,12 @@ layer = sdf.layers[layr] for mod in layer.modules: - if mod.name not in modules: + if get_boolean(createmultipledropfiles): #creating single drop file? + if single_key not in modules: #have we already added the key to the dictionary? + modules[single_key] = [] #no so add it + elif mod.name not in modules: modules[mod.name] = [] + single_key = mod.name #change the key name to write to modules for unit in mod.units: include_unit = True if idobuildfilter != None: @@ -128,6 +144,6 @@ if len(unit.filters) == 0: include_unit = True if include_unit: - modules[mod.name].append(os.path.join(builddrive + os.sep, unit.path)) + modules[single_key].append(os.path.join(builddrive + os.sep, unit.path)) + return modules - return modules diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/ccm/__init__.py --- a/buildframework/helium/sf/python/pythoncore/lib/ccm/__init__.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/ccm/__init__.py Wed Jun 16 16:51:40 2010 +0300 @@ -1201,7 +1201,7 @@ result = self._session.execute("finduse \"%s\"" % self, FinduseResult(self)) return result.output - def delete(self, recurse=False): + def delete(self, recurse=False, scope=None): """ Delete a synergy project. """ args = "" if recurse: @@ -1209,8 +1209,10 @@ parg = "" if self.type == "project": parg = "-project" + if scope: + args = args + ' -scope "' + scope + '"' result = self._session.execute("delete %s %s \"%s\"" % (args, parg, self)) - if result.status != 0 and result.status != None: + if (result.status != 0 and result.status != None) or (result.output.strip().startswith('Cannot use')): raise CCMException("An error occurred while deleting object %s (error status: %s)\n%s" % (self, result.status, result.output), result) return result @@ -1440,6 +1442,46 @@ raise CCMException("Error checking out project %s,\n%s" % (self.objectname, result.output), result) return result + def create_release_tag(self, release, new_tag): + """ creates new release tag """ + role = self._session.role + + if role is None: + self._session.role = "developer" + role = self._session.role + + args = "release -create %s -from %s -bl %s -active -allow_parallel_check_out" % (new_tag, release, release) + self._session.role = "build_mgr" + + result = self._session.execute(" %s" \ + % (args), Result(self._session)) + self._session.role = role + + return result.output + + def delete_release_tag(self, release, new_tag): + """ deletes new release tag """ + + role = self._session.role + if role is None: + self._session.role = "developer" + role = self._session.role + + + self._session.role = "build_mgr" + + result = self._session.execute("pg -l -r %s -u" \ + % (new_tag), Result(self._session)) + result = self._session.execute("pg -d \"%s\" -m" \ + % (result.output), Result(self._session)) + result = self._session.execute("release -d %s -force" \ + % (new_tag), Result(self._session)) + + self._session.role = role + + return result.output + + def work_area(self, maintain, recursive=None, relative=None, path=None, pst=None, wat=False): """ Configure the work area. This allow to enable it or disable it, set the path, recursion... """ args = "" @@ -1980,5 +2022,5 @@ # The location of the ccm binary must be located to know where the _router.adr file is, to support # switching databases. CCM_BIN = fileutils.which("ccm") -if os.sep == '\\': - CCM_BIN = fileutils.which("ccm.exe") +if CCM_BIN: + CCM_BIN = os.path.normcase(CCM_BIN) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/ccm/extra.py --- a/buildframework/helium/sf/python/pythoncore/lib/ccm/extra.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/ccm/extra.py Wed Jun 16 16:51:40 2010 +0300 @@ -133,7 +133,7 @@ _logger.error( "Exception occured in request #%s: %s\n%s" % (request.requestID, exc_info[1], traceback.format_exception(exc_info[0], exc_info[1], exc_info[2]))) exceptions.append(exc_info[1]) - def handle_result(result): + def handle_result(request, result): """append the result""" results.append(result) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/fileutils.py --- a/buildframework/helium/sf/python/pythoncore/lib/fileutils.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/fileutils.py Wed Jun 16 16:51:40 2010 +0300 @@ -361,17 +361,25 @@ def which(executable): """ Search for executable in the PATH.""" pathlist = os.environ['PATH'].split(os.pathsep) + pathexts = [''] + if os.sep == '\\': + pathexts = os.environ['PATHEXT'].split(os.pathsep) + for folder in pathlist: - filename = os.path.join(folder, executable) - try: - status = os.stat(filename) - except os.error: - continue - # Check if the path is a regular file - if stat.S_ISREG(status[stat.ST_MODE]): - mode = stat.S_IMODE(status[stat.ST_MODE]) - if mode & 0111: - return os.path.normpath(filename) + for pathext in pathexts: + exename = executable + if os.sep == '\\' and not exename.lower().endswith(pathext.lower()): + exename = exename + pathext + filename = os.path.join(folder, exename) + try: + status = os.stat(filename) + except os.error: + continue + # Check if the path is a regular file + if stat.S_ISREG(status[stat.ST_MODE]): + mode = stat.S_IMODE(status[stat.ST_MODE]) + if mode & 0111: + return os.path.normpath(filename) return None @@ -467,14 +475,18 @@ def getmd5(fullpath, chunk_size=2**16): """ returns the md5 value""" - file_handle = open(fullpath, "rb") - md5 = hashlib.md5() - while 1: - chunk = file_handle.read(chunk_size) - if not chunk: - break - md5.update(chunk) - file_handle.close() + for trial in range(3): + try: + file_handle = open(fullpath, "rb") + md5 = hashlib.md5() + while 1: + chunk = file_handle.read(chunk_size) + if not chunk: + break + md5.update(chunk) + file_handle.close() + except Exception, exc: + LOGGER.warning("Error happened on %d trial: %s" % (trial, str(exc))) return md5.hexdigest() def read_symbian_policy_content(filename): diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/getVariantConfiguration.py --- a/buildframework/helium/sf/python/pythoncore/lib/getVariantConfiguration.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/getVariantConfiguration.py Wed Jun 16 16:51:40 2010 +0300 @@ -1,5 +1,5 @@ #============================================================================ -#Name : getVariantConfiguration.py +#Name : getvariantconfiguration.py #Part of : Helium #Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). @@ -16,6 +16,7 @@ # #Description: #=============================================================================== +"""get variant configuration""" import configuration import sys @@ -66,9 +67,9 @@ alreadyDone[variant['PRODUCT_NAME']] = {} if variant.type not in alreadyDone[variant['PRODUCT_NAME']] and variant['PRODUCT_NAME'] == product: alreadyDone[variant['PRODUCT_NAME']][variant.type] = True - v = VariantInfo(variant['ROFS2_DIR']) - if len(str(v)) > 0: - outfile.write(str(v)+"\n") + v_info = VariantInfo(variant['ROFS2_DIR']) + if len(str(v_info)) > 0: + outfile.write(str(v_info)+"\n") outfile.close() except Exception, exc: print "ERROR: %s" % exc diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/helium/logger.py --- a/buildframework/helium/sf/python/pythoncore/lib/helium/logger.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/helium/logger.py Wed Jun 16 16:51:40 2010 +0300 @@ -17,13 +17,11 @@ #Description: #=============================================================================== -## -# Logger module -# Description : Port to python of the ISIS::Logger3 perl module -# -# 1.0.0 (13/12/2006) -# - First version of the module. -## +""" Port to python of the ISIS::Logger3 perl module + + 1.0.0 (13/12/2006) + - First version of the module. +""" # pylint: disable-msg=E1101,E1103 @@ -32,42 +30,35 @@ import datetime import traceback -# -# This is an Internal helper call. -# class _CustomizePrint(object): + """ This is an Internal helper call. """ - ## - # Initialise the instance content - # @param logger a Logger instance - # @param name method name (e.g. Print, Error), could be any strings def __init__(self, logger, name): + """Initialise the instance content + @param logger a Logger instance + @param name method name (e.g. Print, Error), could be any strings""" self.__logger = logger self.__name = name - ## - # Make this object callable. Call _print from the logger instance. - # @params *args a list of arguments def __call__(self, *args): - self.__logger._print(self.__name, args) - -## -# The Logger enables to create xml logging in Python. -# + """Make this object callable. Call _print from the logger instance. + @params *args a list of arguments""" + self.__logger._print(self.__name, args) + + class Logger(object): """ Logger class used to create xml logging in python """ - ## - # Constructor of the Logger. def __init__(self): + """Constructor of the Logger.""" self.__step = 1 self.__doc = xml.dom.minidom.Document() - self.__lognode = self.__doc.createElementNS("", "__log") + self.__lognode = self.__doc.createElementNS("", "__log") self.__header = self.__doc.createElementNS("", "__header") self.__footer = self.__doc.createElementNS("", "__footer") self.__summary = self.__doc.createElementNS("", "__summary") self.__lognode.appendChild(self.__header) self.__lognode.appendChild(self.__summary) - self.__lognode.appendChild(self.__footer) + self.__lognode.appendChild(self.__footer) self.__lognode.setAttributeNS("", "date", "%s" % datetime.datetime.now().ctime()) self.__footer.setAttributeNS("", "title", "") self.__footer.setAttributeNS("", "subtitle", "") @@ -79,117 +70,106 @@ self.__verbose = True #<__log date="Wed Dec 6 03:07:25 2006"> - ## - # Set the url of interface to use. def SetInterface(self, url): + """Set the url of interface to use.""" self.__lognode.setAttributeNS("", "interface", url) - ## - # Enable/Disable shell output - # @param v boolean to set the logger output def SetVerbose(self, v): + """Enable/Disable shell output + @param v boolean to set the logger output""" self.__verbose = v - ## - # Set the title of the document - # @param title the title to set - def SetTitle(self, title): + def SetTitle(self, title): + """Set the title of the document + @param title the title to set""" self.__header.setAttributeNS("", "title", title) - ## - # Set the subtitle of the document - # @param subtitle the subtitle to set - def SetSubTitle(self, title): + def SetSubTitle(self, title): + """Set the subtitle of the document + @param subtitle the subtitle to set""" self.__header.setAttributeNS("", "subtitle", title) - ## - # Set the sumamry title - # @param title the title to set def SetSummaryTitle(self, title): + """Set the sumamry title + @param title the title to set""" self.__summary.setAttributeNS("", "title", title) - ## - # Creates a summary couple. - # @param tag the description - # @param value the value def AddSummaryElement(self, tag, value): - e = self.__doc.createElementNS("", "__elmt") - e.setAttributeNS("", "tag", tag) - e.setAttributeNS("", "val", value) - self.__summary.appendChild(e) + """Creates a summary couple. + @param tag the description + @param value the value""" + elem = self.__doc.createElementNS("", "__elmt") + elem.setAttributeNS("", "tag", tag) + elem.setAttributeNS("", "val", value) + self.__summary.appendChild(elem) - ## - # Open a MainContent section. - # @param title title of the MainContent section def OpenMainContent(self, title=""): + """Open a MainContent section. + @param title title of the MainContent section""" self.__stack.append(self.__current_node) - n = self.__doc.createElementNS("", "task") - n.setAttributeNS("", "name", title) - n.setAttributeNS("", "type", "maincontent") - n.setAttributeNS("", "time", datetime.datetime.now().ctime()) - self.__current_node.appendChild(n) - self.__current_node = n + node = self.__doc.createElementNS("", "task") + node.setAttributeNS("", "name", title) + node.setAttributeNS("", "type", "maincontent") + node.setAttributeNS("", "time", datetime.datetime.now().ctime()) + self.__current_node.appendChild(node) + self.__current_node = node if self.__verbose: print ("---------------------------------------------------------------------") print (" %s" % title) print ("---------------------------------------------------------------------") - ## - # Close the current main content section. - # Make sure you have closed other Event/Section first def CloseMainContent(self): + """ Close the current main content section. + Make sure you have closed other Event/Section first""" if self.__current_node.nodeName != "task" and not (self.__current_node.attributes.has_key('type') and self.__current_node.attributes['type']=="maincontent"): raise Exception("not closing a 'maincontent' typed node") self.__current_node = self.__stack.pop() - ## - # Create an Event section (can be opened/closed) - # @param title title of the MainContent section def OpenEvent(self, title=""): + """Create an Event section (can be opened/closed) + @param title title of the MainContent section""" self.__stack.append(self.__current_node) - n = self.__doc.createElementNS("", "task") - n.setAttributeNS("", "name", title) - n.setAttributeNS("", "type", "event") - n.setAttributeNS("", "time", datetime.datetime.now().ctime()) - self.__current_node.appendChild(n) - self.__current_node = n + node = self.__doc.createElementNS("", "task") + node.setAttributeNS("", "name", title) + node.setAttributeNS("", "type", "event") + node.setAttributeNS("", "time", datetime.datetime.now().ctime()) + self.__current_node.appendChild(node) + self.__current_node = node if self.__verbose: print ("---------------------------------------------------------------------") print (" + %s" % title) def SetCustomOutputer(self, type, classname, config = None): - n = self.__doc.createElementNS("", "__customoutputer") - n.setAttributeNS("", "type", type) - n.setAttributeNS("", "module", classname) + """set custom out puter""" + node = self.__doc.createElementNS("", "__customoutputer") + node.setAttributeNS("", "type", type) + node.setAttributeNS("", "module", classname) if config != None: - n.appendChild(config) - self.__lognode.appendChild(n) + node.appendChild(config) + self.__lognode.appendChild(node) - ## - # Close the current Event - # Make sure you have closed other Event/Section first def CloseEvent(self): + """# Close the current Event + Make sure you have closed other Event/Section first""" if self.__current_node.nodeName != "task" and (self.__current_node.attributes.has_key('type') and self.__current_node.attributes['type']=="event"): raise Exception("not closing a 'event' typed node") self.__current_node = self.__stack.pop() - ## - # __getattribute__ has been overrided to enable dynamic messaging. - # @param attr the name of the method (or attribute...) def __getattribute__(self, attr): + """__getattribute__ has been overrided to enable dynamic messaging. + @param attr the name of the method (or attribute...)""" try: return object.__getattribute__(self, attr) except AttributeError: return _CustomizePrint(self, attr) - - ## - # Generic method that handle the print in the XML document - # @param kind type of output - # @param *args a list of arguments (must be strings) + def _print(self, kind, *args): + """Generic method that handle the print in the XML document + @param kind type of output + @param *args a list of arguments (must be strings)""" output = u"".join(map(lambda x: u"%s" % x, list(*args))) nodetype = kind.lower() msgtype = "" @@ -197,13 +177,12 @@ msgtype = "%s:" % nodetype.upper() if self.__verbose: print "%s %s" % (msgtype, output.encode('utf-8')) - - - n = self.__doc.createElementNS("", "message") - n.setAttributeNS("", "priority", nodetype) + + node = self.__doc.createElementNS("", "message") + node.setAttributeNS("", "priority", nodetype) #n.setAttributeNS("", "time", datetime.datetime.now().ctime()) - n.appendChild(self.__doc.createCDATASection(output)) - self.__current_node.appendChild(n) + node.appendChild(self.__doc.createCDATASection(output)) + self.__current_node.appendChild(node) # nodetype = kind.lower() # if kind.lower() != "print" and kind.lower() != "printraw": # nodename = kind.lower() @@ -220,22 +199,22 @@ # self.__current_node.appendChild(n) - ## - # def SetFooterTitle(self, title): + """set footer title""" self.__footer.attributes['title'] = title def SetFooterSubTitle(self, subtitle): + """set footer sub title""" self.__footer.attributes['subtitle'] = subtitle def Die(self, title, subtitle, exception): + """Die - kill it off?""" self.SetFooterTitle(title) self.SetFooterSubTitle("%s\nException raised: %s\n%s" % (subtitle, exception, traceback.format_exc())) - ## - # Write the DOM tree into a file. - # @param filename the file to write in. - def WriteToFile(self, filename): + def WriteToFile(self, filename): + """Write the DOM tree into a file. + @param filename the file to write in.""" file_object = open(filename, "w") file_object.write(codecs.BOM_UTF8) file_object.write(self.__doc.toprettyxml(encoding = "utf-8")) @@ -245,5 +224,5 @@ ## # Write the DOM tree into a file. # @param filename the file to write in. - def __str__(self): + def __str__(self): return self.__doc.toprettyxml(encoding="utf-8") diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/helium/output/__init__.py --- a/buildframework/helium/sf/python/pythoncore/lib/helium/output/__init__.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/helium/output/__init__.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,4 +16,4 @@ # #Description: #=============================================================================== - +""" init file for XML component handler""" diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/helium/output/widgets.py --- a/buildframework/helium/sf/python/pythoncore/lib/helium/output/widgets.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/helium/output/widgets.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,7 +16,7 @@ # #Description: #=============================================================================== - +""" handles components in XML documents""" # pylint: disable-msg=E1101 @@ -27,6 +27,7 @@ pass def getDOMContainer(self): + """get DOM container""" pass @@ -34,28 +35,30 @@ """ A widget of type Box """ def __init__(self, doc, container, divId = "mb", divClass = "mc"): Widget.__init__(self) - d1 = doc.createElementNS("", "div") - d1.setAttributeNS("", "id", divId) - container.appendChild(d1) - mc = doc.createElementNS("", "div") - mc.setAttributeNS("", "class", divClass) - d1.appendChild(mc) + doc_1 = doc.createElementNS("", "div") + doc_1.setAttributeNS("", "id", divId) + container.appendChild(doc_1) + m_c = doc.createElementNS("", "div") + m_c.setAttributeNS("", "class", divClass) + doc_1.appendChild(m_c) self.__doc = doc self.__title = None - self.__mc = mc + self.__mc = m_c def setTitle(self, title=""): + """set the title""" if self.__title == None: - t = self.__doc.createElementNS("", "h1") - self.__mc.insertBefore(t, self.__mc.firstChild) + t_doc = self.__doc.createElementNS("", "h1") + self.__mc.insertBefore(t_doc, self.__mc.firstChild) self.__title = self.__doc.createTextNode(title) - t.appendChild(self.__title) + t_doc.appendChild(self.__title) self.__title.data = title def getDOMContainer(self): + """get DOM container""" return self.__mc -class Summary(Box): +class Summary(Box): """ A widget representing a summary component """ def __init__(self, doc, container): Box.__init__(self, doc, container, divId = "s_mb", divClass = "s_mc") @@ -74,33 +77,35 @@ def addElement(self, tag, value): + """add Element""" row = self._Box__doc.createElementNS("", "tr") #Tag - td = self._Box__doc.createElementNS("", "td") - td.setAttributeNS("", "valign", "top") - td.setAttributeNS("", "nowrap", "nowrap") + t_d = self._Box__doc.createElementNS("", "td") + t_d.setAttributeNS("", "valign", "top") + t_d.setAttributeNS("", "nowrap", "nowrap") div = self._Box__doc.createElementNS("", "div") div.setAttributeNS("", "class", "s_tag") div.appendChild(self._Box__doc.createTextNode(tag)) - td.appendChild(div) - row.appendChild(td) + t_d.appendChild(div) + row.appendChild(t_d) # Value - td = self._Box__doc.createElementNS("", "td") - td.setAttributeNS("", "width", "100%") + t_d = self._Box__doc.createElementNS("", "td") + t_d.setAttributeNS("", "width", "100%") div = self._Box__doc.createElementNS("", "div") div.setAttributeNS("", "class", "s_val") div.appendChild(self._Box__doc.createTextNode(value)) - td.appendChild(div) - row.appendChild(td) + t_d.appendChild(div) + row.appendChild(t_d) self.__table.appendChild(row) def addStatistics(self, type, value): + """add Statistics""" if self.__table_stat == None: - h1 = self._Box__doc.createElementNS("", "h1") - h1.appendChild(self._Box__doc.createTextNode("Global Statistics")) - self.getDOMContainer().appendChild(h1) + head1 = self._Box__doc.createElementNS("", "h1") + head1.appendChild(self._Box__doc.createTextNode("Global Statistics")) + self.getDOMContainer().appendChild(head1) div = self._Box__doc.createElementNS("", "div") div.setAttributeNS("", "class", "t_wrapper") @@ -116,12 +121,12 @@ self.__table_stat.appendChild(row) self.__table_stat = row - td = self._Box__doc.createElementNS("", "td") + t_d = self._Box__doc.createElementNS("", "td") div = self._Box__doc.createElementNS("", "div") div.setAttributeNS("", "class", "gbl_cnt_" + type) div.appendChild(self._Box__doc.createTextNode("%d %ss" % (value, type))) - td.appendChild(div) - self.__table_stat.appendChild(td) + t_d.appendChild(div) + self.__table_stat.appendChild(t_d) @@ -172,7 +177,7 @@ # append container node_head.appendChild(showall) node_head.appendChild(hideall) - node_head.appendChild(self.__togglenode) + node_head.appendChild(self.__togglenode) contentx = doc.createElementNS("", "div") contentx.setAttributeNS("", "id", "Content%d" % id) @@ -186,9 +191,11 @@ self.__node_info = None def setTitle(self, title = ""): + """set Title""" self.__title.data = title def addStatistics(self, type, value): + """add Statistics""" if self.__node_info == None: self.__node_info = self.__doc.createElementNS("", "span") self.__node_info.setAttributeNS("", "class", "node_info") @@ -202,6 +209,7 @@ # def getDOMContainer(self): + """get DOM Container""" return self.__container @@ -217,27 +225,30 @@ h_wrapper.appendChild(h_elmt) container.appendChild(h_wrapper) #title - t = self.__doc.createElementNS("", "div") + t_elem = self.__doc.createElementNS("", "div") self.__title = doc.createTextNode("") - t.appendChild(self.__title) - t.setAttributeNS("", "class", "h_title") - h_elmt.appendChild(t) + t_elem.appendChild(self.__title) + t_elem.setAttributeNS("", "class", "h_title") + h_elmt.appendChild(t_elem) #subtitle - t = self.__doc.createElementNS("", "div") + t_elem = self.__doc.createElementNS("", "div") self.__subtitle = doc.createTextNode("") - t.appendChild(self.__subtitle) - t.setAttributeNS("", "class", "h_subtitle") - h_elmt.appendChild(t) + t_elem.appendChild(self.__subtitle) + t_elem.setAttributeNS("", "class", "h_subtitle") + h_elmt.appendChild(t_elem) - def setTitle(self, title): + def setTitle(self, title): + """set Title""" self.__title.data = title - def setSubTitle(self, title): + def setSubTitle(self, title): + """set Sub Title""" self.__subtitle.data = title def getDOMContainer(self): + """get DOM Container""" return None class Footer(Widget): @@ -252,22 +263,24 @@ h_wrapper.appendChild(h_elmt) container.appendChild(h_wrapper) #title - t = self.__doc.createElementNS("", "div") + t_elem = self.__doc.createElementNS("", "div") self.__title = doc.createTextNode("") - t.appendChild(self.__title) - t.setAttributeNS("", "class", "f_title") - h_elmt.appendChild(t) + t_elem.appendChild(self.__title) + t_elem.setAttributeNS("", "class", "f_title") + h_elmt.appendChild(t_elem) #subtitle - t = self.__doc.createElementNS("", "div") + t_elem = self.__doc.createElementNS("", "div") self.__subtitle = doc.createTextNode("") - t.appendChild(self.__subtitle) - t.setAttributeNS("", "class", "f_subtitle") - h_elmt.appendChild(t) + t_elem.appendChild(self.__subtitle) + t_elem.setAttributeNS("", "class", "f_subtitle") + h_elmt.appendChild(t_elem) - def setTitle(self, title): + def setTitle(self, title): + """set Title""" self.__title.data = title - def setSubTitle(self, title): + def setSubTitle(self, title): + """set Sub Title""" self.__subtitle.data = title class Text(Widget): @@ -280,20 +293,25 @@ container.appendChild(self.__div) def setIcon(self, name): + """set Icon""" self.__div.setAttributeNS("", "class", name) - def appendText(self, text): + def appendText(self, text): + """append Text""" def pushContent(arg): + """push Content""" self.getDOMContainer().appendChild(self.__doc.createTextNode(arg)) self.getDOMContainer().appendChild(self.__doc.createElementNS("","br")) - map(pushContent, text.strip().split("\n")) + map(pushContent, text.strip().split("\n")) def getDOMContainer(self): + """get DOM Container""" return self.__div class RawText(Text): """ This class represents a raw text component """ def appendText(self, text): + """append Text""" for child in xml.dom.minidom.parseString("" + text.strip() + "").documentElement.childNodes: self.getDOMContainer().appendChild(child.cloneNode(True)) @@ -305,6 +323,5 @@ self._Text__div.appendChild(self.__bold) def getDOMContainer(self): + """get DOM COntainer""" return self.__bold - - \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/helium/outputer.py --- a/buildframework/helium/sf/python/pythoncore/lib/helium/outputer.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/helium/outputer.py Wed Jun 16 16:51:40 2010 +0300 @@ -17,13 +17,11 @@ #Description: #=============================================================================== -## -# Outputer module -# Description : Port to python of the ISIS::Logger3::XML2HTML perl module -# -# 1.0.0 (13/12/2006) -# - First version of the module. -## +"""Port to python of the ISIS::Logger3::XML2HTML perl module + +1.0.0 (13/12/2006) + - First version of the module.""" + import codecs import xml.dom.minidom from helium.output.widgets import * @@ -35,31 +33,36 @@ class Configuration: """ Class for isis Configuration """ def __init__(self, url): - f = urllib2.urlopen(url)# - data = f.read() - f.close() + url_file = urllib2.urlopen(url)# + data = url_file.read() + url_file.close() self.__xml = amara.parse(data) def getClass(self, type, default = None): + """get Class""" return self._getValue(type, "class", default) def getImg(self, type, default = None): + """ get Image""" return self._getValue(type, "img", default) def getWidth(self, type, default = None): + """get Width""" return self._getValue(type, "width", default) def getHeight(self, type, default = None): + """get height""" return self._getValue(type, "height", default) def _getValue(self, type, attr, default = None): - r = self.__xml.xml_xpath("/htmloutput/icons/icon[@type='%s']" % type) - if len(r) == 0: + """get value""" + r_attr = self.__xml.xml_xpath("/htmloutput/icons/icon[@type='%s']" % type) + if len(r_attr) == 0: if default == None: raise Exception("Not found") else: return default - return r[0][attr] + return r_attr[0][attr] class XML2XHTML: """ This class is used to generate an html file from the given xml """ @@ -77,7 +80,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd") self.__doc = dom.createDocument(None, "html", doctype) self.__xhtml = self.__doc.getElementsByTagName("html")[0] - self.__xhtml.setAttributeNS("", "xmlns", "http://www.w3.org/1999/xhtml") + self.__xhtml.setAttributeNS("", "xmlns", "http://www.w3.org/1999/xhtml") self.__id = 0 self.__xhtml_summary = None self.__tags = {} @@ -92,47 +95,51 @@ '__event' : XML2XHTML.forname('helium.output.widgets.Event')} def _getId(self): + """get ID""" self.__id += 1 return self.__id def addCSSLink(self, url): + """add CSS Link""" self.__css.append(url) def addJScriptLink(self, url): + """add Script Link""" self.__javascript.append(url) def _generateCSSLinks(self, container): + """generate CSS Links""" for link in self.__css: - l = self.__doc.createElementNS("", "link") + l_link = self.__doc.createElementNS("", "link") if self.__usedataurl: - l.setAttributeNS("", "href", dataurl.from_url(link)) + l_link.setAttributeNS("", "href", dataurl.from_url(link)) else: - l.setAttributeNS("", "href", link) - l.setAttributeNS("", "rel", "stylesheet") - l.setAttributeNS("", "type", "text/css") - container.appendChild(l) - + l_link.setAttributeNS("", "href", link) + l_link.setAttributeNS("", "rel", "stylesheet") + l_link.setAttributeNS("", "type", "text/css") + container.appendChild(l_link) + def _generateJScriptLink(self, container): + """generate J Script Link""" for link in self.__javascript: - l = self.__doc.createElementNS("", "script") + l_link = self.__doc.createElementNS("", "script") if self.__usedataurl: - l.setAttributeNS("", "src", dataurl.from_url(link)) + l_link.setAttributeNS("", "src", dataurl.from_url(link)) else: - l.setAttributeNS("", "src", link) - l.setAttributeNS("", "type", "text/javascript") - l.appendChild(self.__doc.createTextNode("")) - container.appendChild(l) - - + l_link.setAttributeNS("", "src", link) + l_link.setAttributeNS("", "type", "text/javascript") + l_link.appendChild(self.__doc.createTextNode("")) + container.appendChild(l_link) + def generate(self): + """generate""" root = self.__srcdoc.documentElement if root.tagName != "__log": raise Exception("Invalid document must be __log.") - for c in root.getElementsByTagName("__customoutputer"): - self.__factory[c.attributes['type'].value] = XML2XHTML.forname(c.attributes['module'].value) + for cust_out in root.getElementsByTagName("__customoutputer"): + self.__factory[cust_out.attributes['type'].value] = XML2XHTML.forname(cust_out.attributes['module'].value) - head = self.__doc.createElementNS("", "head") title = self.__doc.createElementNS("", "title") self.__title = self.__doc.createTextNode("") @@ -145,72 +152,76 @@ body = self.__doc.createElementNS("", "body") self.__xhtml.appendChild(head) self.__xhtml.appendChild(body) - - - for c in root.childNodes: - if c.nodeType == xml.dom.Node.ELEMENT_NODE and c.tagName == "__header": - self._handleHeader(c, body) - elif c.nodeType == xml.dom.Node.ELEMENT_NODE and c.tagName == "__summary": - self._handleSummary(c, body) - elif c.nodeType == xml.dom.Node.ELEMENT_NODE and c.tagName == "__maincontent": - self._handleMainContent(c, body) - elif c.nodeType == xml.dom.Node.ELEMENT_NODE and c.tagName == "build": - self._handleBuild(c, body) - elif c.nodeType == xml.dom.Node.ELEMENT_NODE and c.tagName == "task" and c.attributes.has_key('type') and c.attributes['type'] == "maincontent": - self._handleMainContent(c, body) + + for child in root.childNodes: + if child.nodeType == xml.dom.Node.ELEMENT_NODE and child.tagName == "__header": + self._handleHeader(child, body) + elif child.nodeType == xml.dom.Node.ELEMENT_NODE and child.tagName == "__summary": + self._handleSummary(child, body) + elif child.nodeType == xml.dom.Node.ELEMENT_NODE and child.tagName == "__maincontent": + self._handleMainContent(child, body) + elif child.nodeType == xml.dom.Node.ELEMENT_NODE and child.tagName == "build": + self._handleBuild(child, body) + elif child.nodeType == xml.dom.Node.ELEMENT_NODE and child.tagName == "task" and child.attributes.has_key('type') and child.attributes['type'] == "maincontent": + self._handleMainContent(child, body) try: footer = root.getElementsByTagName("__footer")[0] - f = self.__factory["__footer"](self.__doc, body) + f_foot = self.__factory["__footer"](self.__doc, body) if footer.attributes.has_key("title"): - f.setTitle(footer.attributes['title'].value) + f_foot.setTitle(footer.attributes['title'].value) if footer.attributes.has_key("subtitle"): - f.setSubTitle(footer.attributes['subtitle'].value) - except Exception: + f_foot.setSubTitle(footer.attributes['subtitle'].value) + except Exception: pass # Generate summary self._createSummary() def _handleHeader(self, node, container): - h = self.__factory["__header"](self.__doc, container) + """handle Header""" + header = self.__factory["__header"](self.__doc, container) if node.attributes.has_key('title'): self.__title.data = node.attributes['title'].value - h.setTitle(node.attributes['title'].value) + header.setTitle(node.attributes['title'].value) if node.attributes.has_key("subtitle"): - h.setSubTitle(node.attributes['subtitle'].value) + header.setSubTitle(node.attributes['subtitle'].value) def _handleSummary(self, node, container): + """handle Summary""" box = self.__factory["__summary"](self.__doc, container) if node.attributes.has_key('title'): box.setTitle(node.attributes["title"].value) - for c in node.getElementsByTagName("__elmt"): - box.addElement(c.attributes['tag'].value, c.attributes['val'].value) + for c_tag in node.getElementsByTagName("__elmt"): + box.addElement(c_tag.attributes['tag'].value, c_tag.attributes['val'].value) self.__xhtml_summary = box def _handleBuild(self, node, container): - for c in node.childNodes: - if c.nodeType == xml.dom.Node.ELEMENT_NODE and c.tagName == "task" and c.attributes.has_key('type') and c.attributes['type'].value == 'maincontent': - self._handleMainContent(c, container) + """handle Build""" + for child in node.childNodes: + if child.nodeType == xml.dom.Node.ELEMENT_NODE and child.tagName == "task" and child.attributes.has_key('type') and child.attributes['type'].value == 'maincontent': + self._handleMainContent(child, container) def _handleMainContent(self, node, container): + """handle Main Content""" box = self.__factory["__maincontent"](self.__doc, container) if node.attributes.has_key("title"): box.setTitle(node.attributes["title"].value) if node.attributes.has_key("name"): box.setTitle(node.attributes["name"].value) - for c in node.childNodes: - if c.nodeType == xml.dom.Node.ELEMENT_NODE and c.tagName == "__event": - self._handleEvent(c, box.getDOMContainer()) - elif c.nodeType == xml.dom.Node.ELEMENT_NODE and c.tagName == "task" and c.attributes.has_key('type') and c.attributes['type'].value == 'event': - self._handleEvent(c, box.getDOMContainer()) - elif c.nodeType == xml.dom.Node.ELEMENT_NODE and c.tagName == "message": - self._handleMessage(c, box.getDOMContainer()) - elif c.nodeType == xml.dom.Node.ELEMENT_NODE: - self._handlePrint(c, box.getDOMContainer()) + for child in node.childNodes: + if child.nodeType == xml.dom.Node.ELEMENT_NODE and child.tagName == "__event": + self._handleEvent(child, box.getDOMContainer()) + elif child.nodeType == xml.dom.Node.ELEMENT_NODE and child.tagName == "task" and child.attributes.has_key('type') and child.attributes['type'].value == 'event': + self._handleEvent(child, box.getDOMContainer()) + elif child.nodeType == xml.dom.Node.ELEMENT_NODE and child.tagName == "message": + self._handleMessage(child, box.getDOMContainer()) + elif child.nodeType == xml.dom.Node.ELEMENT_NODE: + self._handlePrint(child, box.getDOMContainer()) def _handleEvent(self, node, container): + """hnadle Event""" tags = self.__tags self.__tags = {} event = self.__factory["__event"](self.__doc, container, self._getId()) @@ -218,59 +229,62 @@ event.setTitle(node.attributes['title'].value) elif node.attributes.has_key('name'): event.setTitle(node.attributes['name'].value) - for c in node.childNodes: - if c.nodeType == xml.dom.Node.ELEMENT_NODE and c.tagName == "__event": - self._handleEvent(c, event.getDOMContainer()) - elif c.nodeType == xml.dom.Node.ELEMENT_NODE and c.tagName == "task" and c.attributes.has_key('type') and c.attributes['type'].value == 'event': - self._handleEvent(c, event.getDOMContainer()) - elif c.nodeType == xml.dom.Node.ELEMENT_NODE and c.tagName == "message": - self._handleMessage(c, event.getDOMContainer()) - elif c.nodeType == xml.dom.Node.ELEMENT_NODE: - self._handlePrint(c, event.getDOMContainer()) + for child in node.childNodes: + if child.nodeType == xml.dom.Node.ELEMENT_NODE and child.tagName == "__event": + self._handleEvent(child, event.getDOMContainer()) + elif child.nodeType == xml.dom.Node.ELEMENT_NODE and child.tagName == "task" and child.attributes.has_key('type') and child.attributes['type'].value == 'event': + self._handleEvent(child, event.getDOMContainer()) + elif child.nodeType == xml.dom.Node.ELEMENT_NODE and child.tagName == "message": + self._handleMessage(child, event.getDOMContainer()) + elif child.nodeType == xml.dom.Node.ELEMENT_NODE: + self._handlePrint(child, event.getDOMContainer()) keys = self.__tags.keys() keys.sort() - for name in keys: + for name in keys: event.addStatistics(name.replace("__", ""), self.__tags[name]) self.__tags = self._mergeStatistics(tags, self.__tags) def _handleMessage(self, node, container): + """ handle Message""" if node.attributes['priority'].value == "printraw": - t = self.__factory["__printraw"](self.__doc, container) - for n in node.childNodes: - if n.nodeType == xml.dom.Node.CDATA_SECTION_NODE: - t.appendText(n.data) + t_print = self.__factory["__printraw"](self.__doc, container) + for n_node in node.childNodes: + if n_node.nodeType == xml.dom.Node.CDATA_SECTION_NODE: + t_print.appendText(n_node.data) else: - t = self.__factory["__print"](self.__doc, container) - for n in node.childNodes: - if n.nodeType == xml.dom.Node.CDATA_SECTION_NODE: - t.appendText(n.data) + t_print = self.__factory["__print"](self.__doc, container) + for n_node in node.childNodes: + if n_node.nodeType == xml.dom.Node.CDATA_SECTION_NODE: + t_print.appendText(n_node.data) if node.attributes['priority'].value != "print": - t.setIcon(self.__config.getClass(node.attributes['priority'].value, "icn_dft")) + t_print.setIcon(self.__config.getClass(node.attributes['priority'].value, "icn_dft")) if self.__tags.has_key(node.attributes['priority'].value): self.__tags[node.attributes['priority'].value] += 1 else: self.__tags[node.attributes['priority'].value] = 1 def _handlePrint(self, node, container): + """handle print""" if node.tagName == "__printraw": - t = self.__factory["__printraw"](self.__doc, container) - for n in node.childNodes: - if n.nodeType == xml.dom.Node.CDATA_SECTION_NODE or n.nodeType == xml.dom.Node.TEXT_NODE: - t.appendText(n.data) + t_print = self.__factory["__printraw"](self.__doc, container) + for n_node in node.childNodes: + if n_node.nodeType == xml.dom.Node.CDATA_SECTION_NODE or n_node.nodeType == xml.dom.Node.TEXT_NODE: + t_print.appendText(n_node.data) else: - t = self.__factory["__print"](self.__doc, container) - for n in node.childNodes: - if n.nodeType == xml.dom.Node.CDATA_SECTION_NODE or n.nodeType == xml.dom.Node.TEXT_NODE: - t.appendText(n.data) + t_print = self.__factory["__print"](self.__doc, container) + for n_node in node.childNodes: + if n_node.nodeType == xml.dom.Node.CDATA_SECTION_NODE or n_node.nodeType == xml.dom.Node.TEXT_NODE: + t_print.appendText(n_node.data) if node.tagName != "__print": - t.setIcon(self.__config.getClass(node.tagName, "icn_dft")) + t_print.setIcon(self.__config.getClass(node.tagName, "icn_dft")) if self.__tags.has_key(node.tagName): self.__tags[node.tagName] += 1 else: self.__tags[node.tagName] = 1 def _createSummary(self): + """create Summary""" # pylint: disable-msg=E1101 if self.__xhtml_summary == None: self.__xhtml_summary = Summary(self.__doc, self.__body) @@ -279,29 +293,30 @@ keys.sort() for name in keys: self.__xhtml_summary.addStatistics(name.replace("__", ""), self.__tags[name]) + # pylint: enable-msg=E1101 - def _mergeStatistics(self, tags, newTags): + """merge Statistics""" for name in newTags.keys(): if tags.has_key(name): tags[name] += newTags[name] else: tags[name] = newTags[name] return tags - - def WriteToFile(self, filename): + + def WriteToFile(self, filename): + """write to file""" file_object = open(filename, "w") file_object.write(codecs.BOM_UTF8) file_object.write(self.__doc.toprettyxml(encoding="utf-8")) file_object.close() - - + + @staticmethod def forname(classname): - r = re.match("^(?P(?:\w+\.?)*)\.(?P(\w+?))$", classname) - if r != None: - return getattr(__import__(r.groupdict()['modname'], [], [], r.groupdict()['classname']), r.groupdict()['classname']) + """forname""" + result = re.match("^(?P(?:\w+\.?)*)\.(?P(\w+?))$", classname) + if result != None: + return getattr(__import__(result.groupdict()['modname'], [], [], result.groupdict()['classname']), result.groupdict()['classname']) else: raise Exception("Error retreiving module and classname for %s" % classname) - - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/heliumlogging.py --- a/buildframework/helium/sf/python/pythoncore/lib/heliumlogging.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/heliumlogging.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,14 +16,16 @@ # #Description: #=============================================================================== +""" helium logging file""" import os import logging import logging.config + if os.environ.has_key("HELIUM_CACHE_DIR"): - logconf = os.path.join(os.environ['HELIUM_CACHE_DIR'], "logging." + os.environ['PID'] + ".conf") + _logconf = os.path.join(os.environ['HELIUM_CACHE_DIR'], "logging." + os.environ['PID'] + ".conf") else: - logconf = os.path.join(os.getcwd(), "logging.conf") + _logconf = os.path.join(os.getcwd(), "logging.conf") -if os.path.exists(logconf): - logging.config.fileConfig(logconf) \ No newline at end of file +if os.path.exists(_logconf): + logging.config.fileConfig(_logconf) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/iadinfo.py --- a/buildframework/helium/sf/python/pythoncore/lib/iadinfo.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/iadinfo.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,7 @@ # #Description: #=============================================================================== +""" IAD info """ import sys, os import struct @@ -26,20 +27,22 @@ try : from pyasn1.codec.der import decoder from pyasn1.type import base -except : +except ImportError: PyASN1Availabe = False def _findItem(item, itemParent, index, objectIdentifier) : + """find Item""" if isinstance(item, base.AbstractSimpleAsn1Item) : if item == objectIdentifier : return itemParent[index + 1] else: - for i in range(len(item)) : - found = _findItem(item[i], item, i, objectIdentifier) + for i_item in range(len(item)) : + found = _findItem(item[i_item], item, i_item, objectIdentifier) if found: return found def findItem(decodedCert, objectIdentifier) : + """find item""" return _findItem(decodedCert, None, 0, objectIdentifier) @@ -49,6 +52,7 @@ pass def parse(self, decodedCert) : + """parse certificate Organisation""" self.commonName = findItem(decodedCert, (2, 5, 4, 3)) self.countryCode = findItem(decodedCert, (2, 5, 4, 6)) self.locality = findItem(decodedCert, (2, 5, 4, 7)) @@ -57,6 +61,7 @@ self.organization = findItem(decodedCert, (2, 5, 4, 10)) def readableStr(self) : + """readable String""" buf = "" if self.commonName : buf += self.commonName.prettyPrint() + "\n" @@ -78,6 +83,7 @@ pass def parse(self, decodedCert) : + """parse""" self.issuer = CertificateOrganization() self.issuer.parse(decodedCert[0][3]) @@ -85,10 +91,11 @@ self.signer.parse(decodedCert[0][5]) def readableStr(self) : + """readable String""" buf = "Signer:\n " + "\n ".join(self.signer.readableStr().split('\n')) + "\n" buf += "Issuer:\n " + "\n ".join(self.issuer.readableStr().split('\n')) + "\n" return buf - + class SISFileHeader : """ Class SIS File header """ @@ -106,6 +113,7 @@ self.subFields = [] def readFieldLength(self, fileReader) : + """read Field Length""" length = fileReader.readBytesAsUint(4) if length & 0x80000000 > 0 : length = length << 32 @@ -113,6 +121,7 @@ return length def findField(self, fieldType, startIndex=0) : + """find Field""" result = None index = startIndex @@ -124,9 +133,11 @@ return (result, index) def readableStr(self) : + """readable String""" return "" def traverse(self, handler, depth=0) : + """ traverse""" handler.handleField(self, depth) for field in self.subFields : field.traverse(handler, depth + 1) @@ -137,6 +148,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialisation From File""" self.length = self.readFieldLength(fileReader) fileReader.readPlainBytes(self.length) @@ -147,6 +159,7 @@ self.data = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) buf = fileReader.readPlainBytes(self.length) self.data = u"" @@ -156,6 +169,7 @@ self.data += unichr(ord(temp[0]) | ord(temp[1]) << 8) def readableStr(self) : + """readable String""" return self.data class SISArrayField(SISField) : @@ -164,18 +178,19 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) type = fileReader.readBytesAsInt(4) - l = self.length - 4 - while l > 0 : + l_len = self.length - 4 + while l_len > 0 : field = SISFieldTypes[type]() field.type = type field.initFromFile(fileReader) self.subFields.append(field) - l -= field.length + 4 # field length + the length field + l_len -= field.length + 4 # field length + the length field padding = fileReader.skipPadding() - l -= padding + l_len -= padding class SISCompressedField(SISField) : """ Class SIS CompressedField """ @@ -186,6 +201,7 @@ self.data = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) self.algorithm = fileReader.readBytesAsUint(4) self.uncompressedDataSize = fileReader.readBytesAsUint(8) @@ -202,6 +218,7 @@ self.version = (- 1, - 1, - 1) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) major = fileReader.readBytesAsInt(4) minor = fileReader.readBytesAsInt(4) @@ -209,6 +226,7 @@ self.version = (major, minor, build) def readableStr(self) : + """readable string""" return str(self.version) class SISVersionRangeField(SISField) : @@ -219,6 +237,7 @@ self.toVersion = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.fromVersion = fieldParser.parseField(fileReader) @@ -234,12 +253,14 @@ self.day = None def initFromFile(self, fileReader) : + """initialise from File""" self.length = self.readFieldLength(fileReader) self.year = fileReader.readBytesAsUint(2) self.month = fileReader.readBytesAsUint(1) self.day = fileReader.readBytesAsUint(1) def readableStr(self) : + """readable string""" return str(self.year) + "." + str(self.month) + "." + str(self.day) class SISTimeField(SISField) : @@ -251,12 +272,14 @@ self.seconds = None def initFromFile(self, fileReader) : + """initialise from File""" self.length = self.readFieldLength(fileReader) self.hours = fileReader.readBytesAsUint(1) self.minutes = fileReader.readBytesAsUint(1) self.seconds = fileReader.readBytesAsUint(1) def readableStr(self) : + """readable String""" return str(self.hours) + ":" + str(self.minutes) + ":" + str(self.seconds) class SISDateTimeField(SISField) : @@ -267,6 +290,7 @@ self.time = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.date = fieldParser.parseField(fileReader) @@ -279,10 +303,12 @@ self.uid = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) self.uid = fileReader.readBytesAsUint(4) def readableStr(self) : + """readable String""" return hex(self.uid) class SISLanguageField(SISField) : @@ -292,10 +318,12 @@ self.language = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) self.language = fileReader.readBytesAsUint(4) def readableStr(self) : + """readable String""" return str(self.language) class SISContentsField(SISField) : @@ -304,6 +332,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() field = fieldParser.parseField(fileReader) @@ -320,6 +349,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() bufferReader = SISBufferReader(fileReader.readPlainBytes(self.length)) @@ -336,6 +366,7 @@ self.installFlags = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # UID @@ -353,6 +384,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # languages @@ -363,6 +395,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # options @@ -373,6 +406,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # target devices @@ -385,6 +419,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # UID @@ -402,6 +437,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # properties @@ -414,13 +450,13 @@ self.value = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) self.key = fileReader.readBytesAsInt(4) self.value = fileReader.readBytesAsInt(4) -# There is a type for this field, but there is no definition of the field contents class SISSignaturesField(SISUnsupportedField) : - """ Class SISSignaturesField """ + """ Class SISSignaturesField There is a type for this field, but there is no definition of the field contents""" pass class SISCertificateChainField(SISField) : @@ -429,6 +465,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # certificate data @@ -439,6 +476,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # logo file @@ -454,6 +492,7 @@ self.fileIndex = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() @@ -471,6 +510,7 @@ self.fileIndex = fileReader.readBytesAsUint(4) def readableStr(self) : + """readable string""" return "index: " + str(self.fileIndex) class SISHashField(SISField) : @@ -480,6 +520,7 @@ self.algorithm = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.algorithm = fileReader.readBytesAsUint(4) @@ -491,6 +532,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # expression @@ -503,6 +545,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # expression @@ -517,6 +560,7 @@ self.ifBlocks = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) @@ -531,6 +575,7 @@ self.integerValue = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.operator = fileReader.readBytesAsUint(4) @@ -549,6 +594,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # data units @@ -559,6 +605,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # file data @@ -569,6 +616,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # raw file data @@ -579,6 +627,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # names @@ -590,6 +639,7 @@ self.checksum = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) self.checksum = fileReader.readBytesAsUint(2) @@ -600,6 +650,7 @@ self.checksum = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) self.checksum = fileReader.readBytesAsUint(2) @@ -609,6 +660,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # signature algorithm @@ -621,6 +673,7 @@ self.data = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) self.data = fileReader.readPlainBytes(self.length) @@ -630,6 +683,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # algorithm identifier @@ -640,6 +694,7 @@ SISField.__init__(self) def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) fieldParser = SISFieldParser() self.subFields.append(fieldParser.parseField(fileReader)) # signatures @@ -652,6 +707,7 @@ self.dataIndex = None def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) self.dataIndex = fileReader.readBytesAsUint(4) @@ -663,6 +719,7 @@ self.readableCaps = [] def initFromFile(self, fileReader) : + """initialise From File""" self.length = self.readFieldLength(fileReader) self.capabilities = fileReader.readBytesAsUint(self.length) @@ -671,6 +728,7 @@ self.readableCaps.append(CapabilityNames[i]) def readableStr(self) : + """readable string""" return " ".join(self.readableCaps) SISFieldTypes = { @@ -841,44 +899,49 @@ self.bytesRead = 0 def readUnsignedBytes(self, numBytes) : + """read Unsigned bytes""" buf = self.readPlainBytes(numBytes) if len(buf) < numBytes : return [] format = "" - for i in range(numBytes) : + for _ in range(numBytes) : format += "B" return struct.unpack(format, buf) def readSignedBytes(self, numBytes) : + """read signed bytes""" buf = self.readPlainBytes(numBytes) if len(buf) < numBytes : return [] format = "" - for i in range(numBytes) : + for _ in range(numBytes) : format += "b" return struct.unpack(format, buf) def readBytesAsUint(self, numBytes) : + """read bytes as Unit""" result = 0 bytes = self.readUnsignedBytes(numBytes) if len(bytes) == numBytes : - for i in range(numBytes) : - result |= bytes[i] << (i * 8) + for i_byte in range(numBytes) : + result |= bytes[i_byte] << (i_byte * 8) return result def readBytesAsInt(self, numBytes) : + """read bytes as Integer""" result = 0 bytes = self.readSignedBytes(numBytes) if len(bytes) == numBytes : - for i in range(numBytes) : - result |= bytes[i] << (i * 8) + for i_byte in range(numBytes) : + result |= bytes[i_byte] << (i_byte * 8) return result def skipPadding(self) : + """skip padding""" result = 0 if self.bytesRead % 4 != 0 : paddingLength = 4 - self.bytesRead % 4 @@ -888,6 +951,7 @@ return result def readPlainBytes(self, numBytes) : + """read plain bytes""" pass class SISFileReader(SISReader) : @@ -899,6 +963,7 @@ self.bytesRead = 0 def readPlainBytes(self, numBytes) : + """read Plain byytes""" if self.eof : return "" @@ -916,6 +981,7 @@ return buf def isEof(self) : + """is it End of File""" return self.eof class SISBufferReader(SISReader) : @@ -925,6 +991,7 @@ self.bytesRead = 0 def readPlainBytes(self, numBytes) : + """read Plain bytes""" if self.isEof() : return "" @@ -938,6 +1005,7 @@ return result def isEof(self) : + """is it End of File""" return self.bytesRead >= len(self.buffer) class SISFieldParser : @@ -967,18 +1035,21 @@ self.fileHeader = SISFileHeader() def parse(self, filename) : + """parse""" fin = open(filename, 'rb') fileReader = SISFileReader(fin) self.parseHeader(fileReader) self.parseSISFields(fileReader) def parseHeader(self, fileReader) : + """parse Holder""" self.fileHeader.uid1 = fileReader.readBytesAsUint(4) self.fileHeader.uid2 = fileReader.readBytesAsUint(4) self.fileHeader.uid3 = fileReader.readBytesAsUint(4) self.fileHeader.uidChecksum = fileReader.readBytesAsUint(4) def parseSISFields(self, fileReader) : + """parse SIS Fileds""" parser = SISFieldParser() while not fileReader.isEof() : self.subFields.append(parser.parseField(fileReader)) @@ -990,7 +1061,8 @@ self.fileDatas = [] self.signatureCertificateChains = [] - def handleField(self, field, depth) : + def handleField(self, field, _) : + """handle Field""" if field.type == FileDescriptionField : self.files.append(field) elif field.type == FileDataField : @@ -999,31 +1071,32 @@ self.signatureCertificateChains.append(field) def execute(self, options) : - for f in self.files : + """execute""" + for f_file in self.files : if options.info : - buf = " " + f.findField(StringField)[0].readableStr() - caps = f.findField(CapabilitiesField)[0] + buf = " " + f_file.findField(StringField)[0].readableStr() + caps = f_file.findField(CapabilitiesField)[0] if caps : - buf += " [" + " ".join(f.findField(CapabilitiesField)[0].readableCaps) + "]" + buf += " [" + " ".join(f_file.findField(CapabilitiesField)[0].readableCaps) + "]" print buf if options.extract : - parts = f.findField(StringField)[0].readableStr().split("\\") + parts = f_file.findField(StringField)[0].readableStr().split("\\") if len(parts[len(parts) - 1]) > 0 : path = os.path.abspath(options.extract) path += os.sep + os.sep.join(parts[1: - 1]) if not os.path.exists(path) : os.makedirs(path) newFile = file(path + os.sep + parts[len(parts) - 1], "wb") - newFile.write(self.fileDatas[f.fileIndex].findField(CompressedField)[0].data) + newFile.write(self.fileDatas[f_file.fileIndex].findField(CompressedField)[0].data) newFile.close() - for s in self.signatureCertificateChains : + for sig in self.signatureCertificateChains : if options.certificate: - buf = s.findField(CertificateChainField)[0].subFields[0].data + buf = sig.findField(CertificateChainField)[0].subFields[0].data print "Certificate chain:" - i = 1 + i_num = 1 while len(buf) > 0 : - print " Certificate " + str(i) + ":" - i += 1 + print " Certificate " + str(i_num) + ":" + i_num += 1 decoded = decoder.decode(buf) cer = CertificateInfo() cer.parse(decoded[0]) @@ -1032,13 +1105,14 @@ buf = decoded[1] class ContentPrinter : - """ A handler class which prints the field contents """ + """ A handler class which prints the field contents """ def __init__(self) : pass def handleField(self, field, depth) : + """handle Field""" buf = "" - for i in range(depth) : + for _ in range(depth) : buf += " " buf += FieldNames[field.type] + " " if len(field.readableStr()) > 0 : @@ -1060,21 +1134,23 @@ self.installFlags = 0 def handleDependency(self, field) : + """handle dependancy""" dep = [0, - 1, - 1, - 1, - 1, - 1, - 1] dep[0] = field.subFields[0].uid if field.subFields[1] and field.subFields[1].type == VersionRangeField : - r = field.subFields[1] - if r.fromVersion != None : - dep[1] = r.fromVersion.version[0] - dep[2] = r.fromVersion.version[1] - dep[3] = r.fromVersion.version[2] - if r.toVersion != None : - dep[4] = r.toVersion.version[0] - dep[5] = r.toVersion.version[1] - dep[6] = r.toVersion.version[2] + res = field.subFields[1] + if res.fromVersion != None : + dep[1] = res.fromVersion.version[0] + dep[2] = res.fromVersion.version[1] + dep[3] = res.fromVersion.version[2] + if res.toVersion != None : + dep[4] = res.toVersion.version[0] + dep[5] = res.toVersion.version[1] + dep[6] = res.toVersion.version[2] return dep - def handleField(self, field, depth) : + def handleField(self, field, _) : + """handle Field""" if field.type == InfoField : self.packageVersion = field.subFields[4].version self.packageVersionField = field.subFields[4] @@ -1089,14 +1165,15 @@ elif field.type == LanguageField : self.languages.append(field.language) elif field.type == PrerequisitiesField : - for f in field.subFields[0].subFields : - dependency = self.handleDependency(f) + for f_field in field.subFields[0].subFields : + dependency = self.handleDependency(f_field) self.platformDependencies.append(dependency) - for f in field.subFields[1].subFields : - dependency = self.handleDependency(f) + for f_field in field.subFields[1].subFields : + dependency = self.handleDependency(f_field) self.packageDependencies.append(dependency) def getInfo (self, fileName) : + """get Info""" sisInfo = SISInfo() sisInfo.parse(fileName) handler = IADHandler() @@ -1142,5 +1219,5 @@ return info if __name__ == "__main__" : - handler = IADHandler() - print (handler.getInfo (sys.argv[1])) + _handler = IADHandler() + print (_handler.getInfo (sys.argv[1])) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/icf2txt.py --- a/buildframework/helium/sf/python/pythoncore/lib/icf2txt.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/icf2txt.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,7 @@ # #Description: #=============================================================================== +""" icf 2 text""" import sys import amara @@ -33,6 +34,7 @@ return result def main(): + """main method in the file""" if len(sys.argv) != 3: print "Usage: icf2txt.py bom.xml out.txt" sys.exit(1) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/ido.py --- a/buildframework/helium/sf/python/pythoncore/lib/ido.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/ido.py Wed Jun 16 16:51:40 2010 +0300 @@ -44,7 +44,7 @@ """ This function returns a datetime object representing the monday from closest odd week. """ - isoyear, isoweek, isoday = now.isocalendar() + _, isoweek, isoday = now.isocalendar() week = isoweek - 1 day = isoday - 1 monday = now - datetime.timedelta(days=day + week.__mod__(2) * 7) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/idoprep.py --- a/buildframework/helium/sf/python/pythoncore/lib/idoprep.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/idoprep.py Wed Jun 16 16:51:40 2010 +0300 @@ -27,7 +27,7 @@ import ido logging.basicConfig(level=logging.INFO) -logger = logging.getLogger("check_latest_release") +_logger = logging.getLogger("check_latest_release") def validate(grace, service, product, release): """ Validate s60 grace server, s60 grace service, s60 grace product and @@ -50,7 +50,7 @@ revision = rev if cachefilename: - logger.info(str("Using cache file: %s" % cachefilename)) + _logger.info(str("Using cache file: %s" % cachefilename)) checkmd5 = False if s60gracecheckmd5 != None: @@ -64,10 +64,10 @@ result = [] for rel in os.listdir(branch): relpath = os.path.join(branch, rel) - logger.info("Checking: %s" % str(relpath)) + _logger.info("Checking: %s" % str(relpath)) res = re.match(r"%s%s$" % (release, revision), rel, re.I) if res != None: - logger.info("Found: %s" % str(relpath)) + _logger.info("Found: %s" % str(relpath)) result.append(relpath) result.sort(reverse=True) use_tickler = False @@ -79,22 +79,22 @@ try: metadata_filename = symrec.find_latest_metadata(str(rel)) if metadata_filename is not None and os.path.exists(metadata_filename): - logger.info(str("Validating: %s" % metadata_filename)) + _logger.info(str("Validating: %s" % metadata_filename)) if (use_tickler): validator = symrec.ValidateTicklerReleaseMetadata(metadata_filename, cachefilename) else: validator = symrec.ValidateReleaseMetadataCached(metadata_filename, cachefilename) if validator.is_valid(checkmd5): - logger.info(str("%s is valid." % rel)) + _logger.info(str("%s is valid." % rel)) validresults.append(rel) break else: - logger.info(str("%s is not a valid release." % rel)) + _logger.info(str("%s is not a valid release." % rel)) elif metadata_filename is None: - logger.info(str("Could not find the release metadata file under %s" % rel)) - except Exception, e: - logger.warning(str("WARNING: %s: %s" % (rel , e))) - logger.warning(("%s is not a valid release." % rel)) + _logger.info(str("Could not find the release metadata file under %s" % rel)) + except Exception, exc: + _logger.warning(str("WARNING: %s: %s" % (rel , exc))) + _logger.warning(("%s is not a valid release." % rel)) traceback.print_exc() result = validresults @@ -108,13 +108,13 @@ vfile = os.path.join(buiddrive + os.sep, 's60_version.txt') version = None if (os.path.exists(vfile)): - logger.info("Are we still up-to-date compare to %s" % str(vfile)) - f = open(str(vfile), 'r') - version = f.readline() - logger.info(str("'%s' == '%s'" % (version, resultname))) - f.close() + _logger.info("Are we still up-to-date compare to %s" % str(vfile)) + f_file = open(str(vfile), 'r') + version = f_file.readline() + _logger.info(str("'%s' == '%s'" % (version, resultname))) + f_file.close() else: - logger.info("Version file not found getting new environment...") + _logger.info("Version file not found getting new environment...") return version def create_ado_mapping(sysdefconfig, adomappingfile, adoqualitymappingfile, builddrive, adoqualitydirs): @@ -122,7 +122,6 @@ input = open(sysdefconfig, 'r') output = open(adomappingfile, 'w') outputquality = open(adoqualitymappingfile, 'w') - components = {} for sysdef in input.readlines(): sysdef = sysdef.strip() if len(sysdef) > 0: diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/integration/__init__.py --- a/buildframework/helium/sf/python/pythoncore/lib/integration/__init__.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/integration/__init__.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,4 +16,4 @@ # #Description: #=============================================================================== - +""" integration.quality and integration.ant initialisation file""" diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/integration/quality.py --- a/buildframework/helium/sf/python/pythoncore/lib/integration/quality.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/integration/quality.py Wed Jun 16 16:51:40 2010 +0300 @@ -110,14 +110,19 @@ class PolicyValidator(object): - """ Validate policy files on a hierarchy. """ - def __init__(self, policyfiles=None, csvfile=None, ignoreroot=False): + """ Validate policy files on a hierarchy. """ + def __init__(self, policyfiles=None, csvfile=None, ignoreroot=False, excludes=None): """The constructor """ if policyfiles is None: policyfiles = ['distribution.policy.s60'] self._policyfiles = policyfiles self._ids = None self._ignoreroot = ignoreroot + + if not excludes: + self._excludes = [] + else: + self._excludes = excludes def load_policy_ids(self, csvfile): """ Load the icds from the CSV file. @@ -125,7 +130,7 @@ """ self._ids = {} reader = csv.reader(open(csvfile, "rU")) - for row in reader: + for row in reader: if len(row)>=3 and re.match(r"^\s*\d+\s*$", row[0]): self._ids[row[0]] = row if row[1].lower() != "yes" and row[1].lower() != "no" and row[1].lower() != "bin": @@ -133,7 +138,7 @@ def validate_content(self, filename): """ Validating the policy file content. If it cannot be decoded, - it reports an 'invalidencoding'. + it reports an 'invalidencoding'. Case 'notinidlist': value is not defined under the id list. """ value = None @@ -141,7 +146,7 @@ value = fileutils.read_policy_content(filename) except Exception: yield ["invalidencoding", filename, None] - if value is not None: + if value is not None: if self._ids != None: if value not in self._ids: yield ["notinidlist", filename, value] @@ -150,9 +155,9 @@ """ find the policy file under path using filenames under the list. """ for filename in self._policyfiles: if os.sep != '\\': - for f in os.listdir(path): - if f.lower() == filename.lower(): - return os.path.join(path, f) + for f_file in os.listdir(path): + if f_file.lower() == filename.lower(): + return os.path.join(path, f_file) if os.path.exists(os.path.join(path, filename)): return os.path.join(path, filename) return None @@ -184,7 +189,8 @@ # report an error is the directory has no DP file # and any files underneith. for item in os.listdir(dirpath): - if os.path.isfile(os.path.join(dirpath, item)): + if os.path.isfile(os.path.join(dirpath, item)) \ + and item not in self._excludes: yield ['missing', dirpath, None] break diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/log2xml.py --- a/buildframework/helium/sf/python/pythoncore/lib/log2xml.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/log2xml.py Wed Jun 16 16:51:40 2010 +0300 @@ -17,8 +17,8 @@ #Description: #=============================================================================== -""" Symbian log converter. -""" +""" Symbian log converter.""" + import xml.dom.minidom import sys import os @@ -82,6 +82,7 @@ def find_priority(line, config): + """find priority""" keys = config.keys() keys.reverse() for category in keys: @@ -98,14 +99,16 @@ self.__stack = [] def pop(self): + """pop off the stack""" result = None try: result = self.__stack.pop() - except IndexError, e: + except IndexError: result = self.__default return result def push(self, item): + """push on the stack""" self.__stack.append(item) def __len__(self): @@ -116,16 +119,16 @@ These are the only allowed characters: #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]. """ result = "" - for c in list(text): - v = ord(c) - if v == 0x9 or v == 0xa or v == 0xd: - result += c - elif v>=0x20 and v <= 0xd7ff: - result += c - elif v>=0xe000 and v <= 0xfffd: - result += c - elif v>=0x10000 and v <= 0x10ffff: - result += c + for char in list(text): + v_char = ord(char) + if v_char == 0x9 or v_char == 0xa or v_char == 0xd: + result += char + elif v_char>=0x20 and v_char <= 0xd7ff: + result += char + elif v_char>=0xe000 and v_char <= 0xfffd: + result += char + elif v_char>=0x10000 and v_char <= 0x10ffff: + result += char else: result += " " return result @@ -142,7 +145,7 @@ self.__intask = 0 def close(self): - # closing open tasks... + """ closing open tasks""" while self.__intask > 0: self.close_task() self.__stream.write("\t\n") @@ -150,23 +153,25 @@ self.__stream.close() def open_task(self, name): + """open taks""" self.__indent += "\t" self.__intask += 1 self.__stream.write("%s\n" % (self.__indent, name)) def close_task(self): + """close task""" if self.__intask > 0: self.__intask -= 1 self.__stream.write("%s\n" % (self.__indent)) self.__indent = self.__indent[:-1] def message(self, priority, msg): + """message""" try: acdata = to_cdata(msg.decode('utf-8', 'ignore')) self.__stream.write("%s\n" % (self.__indent+"\t", priority, acdata)) - except UnicodeDecodeError, e: - print e - + except UnicodeDecodeError, exc: + print exc def convert(inputfile, outputfile, fulllogging=True, configuration=DEFAULT_CONFIGURATION): @@ -324,28 +329,31 @@ class ContentWriter(ContentHandler): """ SAX Content writer. Parse and write an XML file. """ - def __init__(self, os, indent=""): - self.os = os + def __init__(self, op_sys, indent=""): + self.os = op_sys self.indent = indent self.__content = u"" def startElement(self, name, attrs): - self.os.write(self.indent + "<" + name) + """start Element""" + self.os.write(self.indent + "<" + name) if attrs.getLength() > 0: - self.os.write(" ") - self.os.write(" ".join(map(lambda x: "%s=\"%s\"" % (x, attrs.getValue(x)), attrs.getNames()))) + self.os.write(" ") + self.os.write(" ".join(map(lambda x: "%s=\"%s\"" % (x, attrs.getValue(x)), attrs.getNames()))) self.os.write(">\n") self.indent += "\t" self.__content = "" def endElement(self, name): + """end element""" if len(self.__content) > 0: - self.os.write(self.indent + self.__content + "\n") + self.os.write(self.indent + self.__content + "\n") self.indent = self.indent[:-1] self.os.write("%s\n" % (self.indent, name)) self.__content = "" - def characters(self, content): + def characters(self, content): + """characters""" self.__content += unicode(escape(content.strip())) class AppendSummary(ContentWriter): @@ -355,9 +363,11 @@ self.xmllog = xmllog def startDocument(self): + """start document""" self.os.write('\n') def startElement(self, name, attrs): + """start element""" ContentWriter.startElement(self, name, attrs) if name == "logSummary": parser = make_parser() @@ -381,10 +391,11 @@ outfile.close() # Updating the summary file. os.unlink(summary) - os.rename(summary + ".tmp", summary) + os.rename(summary + ".tmp", summary) def symbian_log_header(output, config, command, dir): + """symbian log header""" output.log("===-------------------------------------------------") output.log("=== %s" % config) output.log("===-------------------------------------------------") @@ -394,18 +405,20 @@ output.log("++ Started at %s" % datetime.datetime.now().ctime()) output.log("+++ HiRes Start %f" % time.time()) output.log("Chdir %s" % dir) - + def symbian_log_footer(output): + """symbian log footer""" output.log("+++ HiRes End %f" % time.time()) output.log("++ Finished at %s" % datetime.datetime.now().ctime()) - - + + if __name__ == "__main__": convert(sys.argv[1], "%s.xml" % sys.argv[1], fulllogging=False) - """ An empty summary: - - """ + # An empty summary: + # + # + #s = open(r"z:\summary.xml", "w") #s.write("""""") #s.close() diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/nokia/__init__.py --- a/buildframework/helium/sf/python/pythoncore/lib/nokia/__init__.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/nokia/__init__.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,4 +16,4 @@ # #Description: #=============================================================================== - +"""python core library init file for nokia code""" diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/nokia/gscm.py --- a/buildframework/helium/sf/python/pythoncore/lib/nokia/gscm.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/nokia/gscm.py Wed Jun 16 16:51:40 2010 +0300 @@ -42,12 +42,12 @@ def __get_gscm_info(method, dbname): """ Generic method that call function 'method' on GSCM wrapper script. """ - (fd, filename) = tempfile.mkstemp() - f = os.fdopen(fd, 'w') - f.write(pkg_resources.resource_string(__name__, "get_gscm_info.pl"))# pylint: disable-msg=E1101 - f.close() + (f_desc, filename) = tempfile.mkstemp() + f_file = os.fdopen(f_desc, 'w') + f_file.write(pkg_resources.resource_string(__name__, "get_gscm_info.pl"))# pylint: disable-msg=E1101 + f_file.close() command = "perl " + filename - command += " %s %s" % (method, dbname) + command += " %s %s" % (method, dbname) _logger.debug("Running command: %s" % command) (output, status) = _execute(command) _logger.debug("Status: %s" % status) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/nokia/nokiaccm.py --- a/buildframework/helium/sf/python/pythoncore/lib/nokia/nokiaccm.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/nokia/nokiaccm.py Wed Jun 16 16:51:40 2010 +0300 @@ -80,7 +80,7 @@ _logger.info('Database engine set using .netrc (%s)' % n_engine) engine = n_engine except IOError: - _logger.debug('Error accessing .netrc file') + _logger.warning('Warning: Cannot access .netrc file') # using environment username in case username is not defined. if username == None: @@ -100,6 +100,7 @@ for current_session in current_sessions: if current_session.dbpath == dbpath: return current_session + raise ccm.CCMException('No existing session found') else: if ccm.CCM_BIN == None: raise ccm.CCMException("Could not find CM/Synergy executable in the path.") diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pathaddition/__init__.py --- a/buildframework/helium/sf/python/pythoncore/lib/pathaddition/__init__.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pathaddition/__init__.py Wed Jun 16 16:51:40 2010 +0300 @@ -17,3 +17,4 @@ #Description: #=============================================================================== +"""python core library path addition initialisation file""" diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pathaddition/relative.py --- a/buildframework/helium/sf/python/pythoncore/lib/pathaddition/relative.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pathaddition/relative.py Wed Jun 16 16:51:40 2010 +0300 @@ -27,7 +27,7 @@ import re # matches http:// and ftp:// and mailto:// -protocolPattern = re.compile(r'^\w+://') +_protocolPattern = re.compile(r'^\w+://') def isabs(string): """ @@ -36,7 +36,7 @@ for addresses beginning in http:// or ftp:// or ldap:// - they are considered "absolute" paths. """ - if protocolPattern.match(string): + if _protocolPattern.match(string): return True return os.path.isabs(string) @@ -57,48 +57,49 @@ return os.path.abspath(retval) -def pathsplit(p, rest=None): +def pathsplit(p_spath, rest=None): """ Split path to pieces """ if rest is None: rest = [] - (h, t) = os.path.split(p) - if len(h) < 1: - return [t]+rest - if len(t) < 1: - return [h]+rest - return pathsplit(h, [t]+rest) + (h_folder, t_file) = os.path.split(p_spath) + if len(h_folder) < 1: + return [t_file]+rest + if len(t_file) < 1: + return [h_folder]+rest + return pathsplit(h_folder, [t_file]+rest) -def commonpath(l1, l2, common=None): +def commonpath(l_1, l_2, common=None): """ return the common path""" if common is None: common = [] - if len(l1) < 1: - return (common, l1, l2) - if len(l2) < 1: - return (common, l1, l2) - if l1[0] != l2[0]: - return (common, l1, l2) - return commonpath(l1[1:], l2[1:], common+[l1[0]]) + if len(l_1) < 1: + return (common, l_1, l_2) + if len(l_2) < 1: + return (common, l_1, l_2) + if l_1[0] != l_2[0]: + return (common, l_1, l_2) + return commonpath(l_1[1:], l_2[1:], common+[l_1[0]]) -def relpath(p1, p2): - (common, l1, l2) = commonpath(pathsplit(p1), pathsplit(p2)) - p = [] - if len(l1) > 0: - p = [ '../' * len(l1) ] - p = p + l2 - if len(p) is 0: +def relpath(p_1, p_2): + """relative path""" + (_, l_1, l_2) = commonpath(pathsplit(p_1), pathsplit(p_2)) + p_path = [] + if len(l_1) > 0: + p_path = [ '../' * len(l_1) ] + p_path = p_path + l_2 + if len(p_path) is 0: return "." - return os.path.join( *p ) - - + return os.path.join( *p_path ) + + def abs2rel(path, base = None): """ @return a relative path from base to path. base can be absolute, or relative to curdir, or defaults to curdir. """ - if protocolPattern.match(path): + if _protocolPattern.match(path): return path if base is None: base = os.curdir @@ -116,14 +117,13 @@ if len(paths) == 1: return paths[0] - def _commonprefix_internal(p1, p2): - c = commonpath(pathsplit(p1), pathsplit(p2))[0] - if len(c) == 0: + def _commonprefix_internal(p_1, p_2): + """common prefix internal""" + c_path = commonpath(pathsplit(p_1), pathsplit(p_2))[0] + if len(c_path) == 0: return '' - return os.path.join(*c) + return os.path.join(*c_path) common = _commonprefix_internal(paths[0], paths[1]) - for p in paths[2:]: - common = _commonprefix_internal(common, p) + for p_path in paths[2:]: + common = _commonprefix_internal(common, p_path) return common - - \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pkg2iby.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/python/pythoncore/lib/pkg2iby.py Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,87 @@ +#============================================================================ +#Name : pkg2iby.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 +import ats3 +import os + +def main(): + if len(sys.argv) < 3: + print 'Usage: ' + sys.argv[0] + ' builddrive tef pkg1 pkg2 ..' + sys.exit(1) + generateromcontent(sys.argv[1], sys.argv[2], sys.argv[3:]) + +def generateromcontent(drive, testtype, pkgs): + ibyfilename = os.path.join(drive + os.sep, 'epoc32', 'rom', 'include', 'atsauto.iby') + execfilename = os.path.join(drive + os.sep, 'epoc32', 'data', 'atsautoexec.bat') + rtestexecfilename = os.path.join(drive + os.sep, 'epoc32', 'data', 'atsrtestexec.bat') + dummyexecfilename = os.path.join(drive + os.sep, 'epoc32', 'data', 'dummy.bat') + pkgfilesnames = [] + for p in pkgs: + pkgfilesnames.append(os.path.join(drive + os.sep, p)) + pkg_parser = ats3.parsers.PkgFileParser(None, drive=drive) + pkgfiles = pkg_parser.read_pkg_file(pkgfilesnames) + + writeautoexec = False + + myiby = open(ibyfilename, 'w') + atsautoexec = open(execfilename, 'w') + atsrtestexec = open(rtestexecfilename, 'w') + dummyexec = open(dummyexecfilename, 'w') + dummyexec.close() + + myiby.write("#ifndef __ATSAUTO_IBY__\n") + myiby.write("#define __ATSAUTO_IBY__\n") + + atsautoexec.write(r'md c:\logs' + '\n') + atsautoexec.write(r'md c:\logs\testresults' + '\n') + atsautoexec.write(r'md c:\logs\testexecute' + '\n') + + for src, dst, filetype, _ in pkgfiles: + (_, dst) = os.path.splitdrive(dst) + dst_nodrive = 'atsdata' + dst + dst = r'z:\atsdata' + dst + myiby.write('data=' + src + ' ' + dst_nodrive + '\n') + if 'testscript' in filetype and testtype == 'tef': + atsautoexec.write('testexecute.exe ' + dst + '\n') + atsautoexec.write('thindump -nop c:\\logs\\testexecute\\' + os.path.basename(dst.replace('.script', '.htm')) + '\n') + writeautoexec = True + if 'testscript' in filetype and testtype == 'mtf': + atsautoexec.write('testframework.exe ' + dst + '\n') + atsautoexec.write('thindump -nop c:\\logs\\testresults\\' + os.path.basename(dst.replace('.script', '.htm')) + '\n') + writeautoexec = True + if '.exe' in dst and testtype == 'rtest': + atsrtestexec.write(dst + '\n') + writeautoexec = True + if writeautoexec: + myiby.write("#include \n") + myiby.write(r'data=' + execfilename + ' autoexec.bat' + '\n') + if testtype == 'rtest': + atsautoexec.write(r'runtests \sys\bin\atsrtestexec.bat' + '\n') + myiby.write(r'data=' + rtestexecfilename + r' \sys\bin\atsrtestexec.bat' + '\n') + + + myiby.write(r'data=' + dummyexecfilename + r' z:\dummytest.txt' + '\n') + atsautoexec.write(r'RUNTESTS z:\dummytest.txt -p') + myiby.write("#endif\n") + myiby.close() + atsautoexec.close() + atsrtestexec.close() + +if __name__ == "__main__": + main() \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/preparation.py --- a/buildframework/helium/sf/python/pythoncore/lib/preparation.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/preparation.py Wed Jun 16 16:51:40 2010 +0300 @@ -28,6 +28,8 @@ import ccm import ccm.extra import fileutils +from xml.dom.minidom import getDOMImplementation + # Uncomment this line to enable logging in this module, or configure logging elsewhere logging.basicConfig(level=logging.INFO) @@ -80,10 +82,15 @@ It should implement the action to achieve. """ pass - + + def extract_release_data(self): + """ This method is used to retrieve current project + environment data. (e.g. project name) + """ + return None def get_session(self): - """ Helper that retreive the session from the builder. Setting threads correctly. """ + """ Helper that retrieve the session from the builder. Setting threads correctly. """ if self._config.has_key('database'): return self._builder.session(self._config['database'], self.get_threads()) if not self._config.has_key('host'): @@ -240,13 +247,34 @@ co_role = ccm.get_role_for_purpose(session, str(self._config['purpose'])) session.role = co_role try: - delResult = result.delete(recurse=True) + delResult = result.delete(scope='project_and_subproject_hierarchy') finally: session.role = role ccm.log_result(delResult, ccm.CHECKOUT_LOG_RULES, _logger) - + def extract_release_data(self): + """ Extracting data for a checked out project. """ + data = None + session = self.get_session() + project = session.create(self._config.name) + session.home = self._config['dir'] + + result = self.__find_project(project) + if (result != None) and (self._config.get_boolean('releasable', False)): + if 'baseline.release' in self._config: + data = {} + _logger.info("Releasing: '%s'" % result) + data['name'] = result.objectname + data['database'] = session.database() + data['role'] = ccm.get_role_for_purpose(session, str(self._config['purpose'])) + data['dir'] = os.path.normpath(self._config['dir']) + data['pst'] = result.name + data['release'] = self._config['baseline.release'] + else: + _logger.warning("Could not release " + result.objectname + " because the 'baseline.release' property is missing.") + return data + def execute(self): """ Creates a checkout of the project, or updates an existing checkout if one is found. @@ -602,6 +630,28 @@ session.role = role + def extract_release_data(self): + """ Extracting data for an updated project. """ + data = None + session = self.get_session() + project = session.create(self._config.name) + + session.home = self._config['dir'] + + if self._config.get_boolean('releasable', False): + if 'baseline.release' in self._config: + data = {} + _logger.info("Releasing: '%s'" % project) + data['name'] = project.objectname + data['database'] = session.database() + data['role'] = ccm.get_role_for_purpose(session, str(self._config['purpose'])) + data['dir'] = os.path.normpath(self._config['dir']) + data['pst'] = project.name + data['release'] = self._config['baseline.release'] + else: + _logger.warning("Could not release " + project + " because the 'baseline.release' property is missing.") + return data + class PreparationBuilder(object): """ Creates an updated work area from a configuration. """ def __init__(self, configs, username = None, password = None, cache=None): @@ -635,6 +685,26 @@ for action in self._actions: action.execute() + def extract_release_data(self, filename): + """ Extract project information into an xml file. """ + + impl = getDOMImplementation() + + doc = impl.createDocument(None, "release", None) + top_element = doc.documentElement + + for action in self._actions: + data = action.extract_release_data() + if data: + project_node = doc.createElement('project') + for attr in data: + project_node.setAttribute(attr, data[attr]) + top_element.appendChild(project_node) + + f_file = open(filename, 'w+') + f_file.write(doc.toprettyxml(indent=" ")) + f_file.close() + def session(self, database, size=1, engine=None, dbpath=None): """ Handles pool rather that sessions. """ assert size > 0, "The pool must contains at least one session!" diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/__init__.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/__init__.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/__init__.py Wed Jun 16 16:51:40 2010 +0300 @@ -17,3 +17,4 @@ #Description: #=============================================================================== +"""python core library python core python tests initialisation file""" diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_archive.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_archive.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_archive.py Wed Jun 16 16:51:40 2010 +0300 @@ -35,7 +35,7 @@ _logger = logging.getLogger('test.archive') -root_test_dir = test_fileutils.root_test_dir +_root_test_dir = test_fileutils._root_test_dir def setup_module(): """ Creates some test data files for file-related testing. """ @@ -55,7 +55,7 @@ builder = configuration.NestedConfigurationBuilder(os.environ['TEST_DATA'] + '/data/archive_test_input.cfg.xml') archiveConfigSet = builder.getConfiguration() archivePreBuilder = archive.ArchivePreBuilder(archiveConfigSet, "config", index=0) - buildFilePath = os.path.join(root_test_dir, r'archive_test.ant.xml') + buildFilePath = os.path.join(_root_test_dir, r'archive_test.ant.xml') archivePreBuilder.write(buildFilePath) build_file = open(buildFilePath) build_file_content = build_file.read() @@ -80,9 +80,9 @@ def test_manifest_files(self): """ A LogicalArchive can create a correct manifest. """ - configDict = {'root.dir': root_test_dir, - 'temp.build.dir': os.path.join(root_test_dir, 'temp_build_files'), - 'archives.dir': root_test_dir, + configDict = {'root.dir': _root_test_dir, + 'temp.build.dir': os.path.join(_root_test_dir, 'temp_build_files'), + 'archives.dir': _root_test_dir, 'name': 'manifest_test', 'include': 'dir1/*.txt', 'archive.tool': '7za' @@ -94,10 +94,10 @@ expectedPaths = [os.path.normpath('dir1/file1.txt')] - includeFilePath = os.path.join(root_test_dir, 'temp_build_files/manifest_test_includefile.txt') + includeFilePath = os.path.join(_root_test_dir, 'temp_build_files/manifest_test_includefile.txt') - with open(includeFilePath) as f: - content = f.readlines() + with open(includeFilePath) as f_file: + content = f_file.readlines() print content print expectedPaths content = [s.strip().lower() for s in content] @@ -105,9 +105,9 @@ def test_empty_manifest_file(self): """ A LogicalArchive can handle empty manifest. """ - configDict = {'root.dir': root_test_dir, - 'temp.build.dir': os.path.join(root_test_dir, 'temp_build_files'), - 'archives.dir': root_test_dir, + configDict = {'root.dir': _root_test_dir, + 'temp.build.dir': os.path.join(_root_test_dir, 'temp_build_files'), + 'archives.dir': _root_test_dir, 'name': 'manifest_test', 'include': 'nothing', 'archive.tool': '7za' @@ -119,27 +119,27 @@ expectedPaths = [] - includeFilePath = os.path.join(root_test_dir, 'temp_build_files/manifest_test_includefile.txt') + includeFilePath = os.path.join(_root_test_dir, 'temp_build_files/manifest_test_includefile.txt') - with open(includeFilePath) as f: - content = f.readlines() + with open(includeFilePath) as f_file: + content = f_file.readlines() print content print expectedPaths - content = [s.strip().lower() for s in content] + content = [s_1.strip().lower() for s_1 in content] self.assert_(content == expectedPaths) def test_manifest_files_with_exclude_list(self): """ A LogicalArchive can create a correct manifest. """ - excludelst = os.path.join(root_test_dir, 'exclude.lst') + excludelst = os.path.join(_root_test_dir, 'exclude.lst') flh = open(excludelst, 'w+') flh.write("/epoc32/tools/variant/variant.cfg\n") flh.write("\\epoc32\\tools\\abld.pl\n") - flh.write(os.path.join(root_test_dir, 'dir1', 'file1.txt') + "\n") - flh.write(os.path.join(root_test_dir, 'dir1/subdir1/subdir1_file.txt') + "\n") + flh.write(os.path.join(_root_test_dir, 'dir1', 'file1.txt') + "\n") + flh.write(os.path.join(_root_test_dir, 'dir1/subdir1/subdir1_file.txt') + "\n") flh.close() - configDict = {'root.dir': root_test_dir, - 'temp.build.dir': os.path.join(root_test_dir, 'temp_build_files'), - 'archives.dir': root_test_dir, + configDict = {'root.dir': _root_test_dir, + 'temp.build.dir': os.path.join(_root_test_dir, 'temp_build_files'), + 'archives.dir': _root_test_dir, 'name': 'manifest_test', 'include': 'dir1/**', 'exclude.lst': excludelst, @@ -157,29 +157,29 @@ ] expectedPaths.sort() - includeFilePath = os.path.join(root_test_dir, 'temp_build_files/manifest_test_includefile.txt') + includeFilePath = os.path.join(_root_test_dir, 'temp_build_files/manifest_test_includefile.txt') - with open(includeFilePath) as f: - content = f.readlines() + with open(includeFilePath) as f_file: + content = f_file.readlines() print content print expectedPaths - content = [s.strip().lower() for s in content] + content = [s_1.strip().lower() for s_1 in content] content.sort() self.assert_(content == expectedPaths) - def test_manifest_files_with_exclude_list_abs_nodrive(self): + def test_manifestfiles_wth_xcld_lst_abs_ndrv(self): """ A LogicalArchive can create a correct manifest with external list and drive. """ - rtd = os.path.splitdrive(os.path.abspath(root_test_dir))[1] - excludelst = os.path.join(root_test_dir, 'exclude.lst') + rtd = os.path.splitdrive(os.path.abspath(_root_test_dir))[1] + excludelst = os.path.join(_root_test_dir, 'exclude.lst') flh = open(excludelst, 'w+') flh.write("/epoc32/tools/variant/variant.cfg\n") flh.write("\\epoc32\\tools\\abld.pl\n") flh.write(os.path.join(rtd, 'dir1', 'file1.txt') + "\n") flh.write(os.path.join(rtd, 'dir1/subdir1/subdir1_file.txt') + "\n") flh.close() - configDict = {'root.dir': os.path.abspath(root_test_dir), - 'temp.build.dir': os.path.join(root_test_dir, 'temp_build_files'), - 'archives.dir': root_test_dir, + configDict = {'root.dir': os.path.abspath(_root_test_dir), + 'temp.build.dir': os.path.join(_root_test_dir, 'temp_build_files'), + 'archives.dir': _root_test_dir, 'name': 'manifest_test', 'include': 'dir1/**', 'exclude.lst': excludelst, @@ -197,14 +197,14 @@ ] expectedPaths.sort() - includeFilePath = os.path.join(root_test_dir, 'temp_build_files/manifest_test_includefile.txt') + includeFilePath = os.path.join(_root_test_dir, 'temp_build_files/manifest_test_includefile.txt') - with open(includeFilePath) as f: - content = f.readlines() + with open(includeFilePath) as f_file: + content = f_file.readlines() if os.sep == '\\': - content = [s.strip().lower() for s in content] + content = [s_1.strip().lower() for s_1 in content] else: - content = [s.strip() for s in content] + content = [s_1.strip() for s_1 in content] content.sort() print content print expectedPaths @@ -243,9 +243,9 @@ def do_distribution_policy_config(self, expected_paths, policy): """ . """ - configDict = {'root.dir': root_test_dir, - 'temp.build.dir': os.path.join(root_test_dir, 'temp_build_files'), - 'archives.dir': root_test_dir, + configDict = {'root.dir': _root_test_dir, + 'temp.build.dir': os.path.join(_root_test_dir, 'temp_build_files'), + 'archives.dir': _root_test_dir, 'name': 's60_policy_test', 'include': 's60/', 'distribution.policy.s60': policy, @@ -256,10 +256,10 @@ builder = archive.ArchivePreBuilder(configuration.ConfigurationSet([config]), "config", index=0) builder.build_manifest(config) - includeFilePath = os.path.join(root_test_dir, 'temp_build_files/s60_policy_test_includefile.txt') + includeFilePath = os.path.join(_root_test_dir, 'temp_build_files/s60_policy_test_includefile.txt') - with open(includeFilePath) as f: - content = f.readlines() + with open(includeFilePath) as f_file: + content = f_file.readlines() if os.sep == '\\': content = [s.strip().lower() for s in content] else: @@ -277,9 +277,9 @@ def test_split_manifest_file_unicode(self): """ A LogicalArchive can split a manifest correctly. """ - configDict = {'root.dir': os.path.abspath(root_test_dir), - 'temp.build.dir': os.path.abspath(os.path.join(root_test_dir, 'temp_build_files')), - 'archives.dir': os.path.abspath(root_test_dir), + configDict = {'root.dir': os.path.abspath(_root_test_dir), + 'temp.build.dir': os.path.abspath(os.path.join(_root_test_dir, 'temp_build_files')), + 'archives.dir': os.path.abspath(_root_test_dir), 'name': 'manifest_test_unicode', 'max.files.per.archive': '1', 'include': 'test_unicode/', @@ -288,22 +288,22 @@ config = configuration.Configuration(configDict) builder = archive.ArchivePreBuilder(configuration.ConfigurationSet([config]), "config", index=0) - manifest_file_path = builder.build_manifest(config) + manifest_file_path = builder.build_manifest(config) builder.manifest_to_commands(config, manifest_file_path) - includeFilePath = os.path.join(root_test_dir, 'temp_build_files/manifest_test_unicode_includefile.txt') - includeFilePath1 = os.path.join(root_test_dir, 'temp_build_files/manifest_test_unicode_part01.txt') - includeFilePath2 = os.path.join(root_test_dir, 'temp_build_files/manifest_test_unicode_part02.txt') - includeFilePath3 = os.path.join(root_test_dir, 'temp_build_files/manifest_test_unicode_part03.txt') + includeFilePath = os.path.join(_root_test_dir, 'temp_build_files/manifest_test_unicode_includefile.txt') + includeFilePath1 = os.path.join(_root_test_dir, 'temp_build_files/manifest_test_unicode_part01.txt') + includeFilePath2 = os.path.join(_root_test_dir, 'temp_build_files/manifest_test_unicode_part02.txt') + includeFilePath3 = os.path.join(_root_test_dir, 'temp_build_files/manifest_test_unicode_part03.txt') - with open(includeFilePath) as f: - content = f.readlines() - with open(includeFilePath1) as f: - content1 = f.readlines() - with open(includeFilePath2) as f: - content2 = f.readlines() - with open(includeFilePath3) as f: - content3 = f.readlines() + with open(includeFilePath) as f_file: + content = f_file.readlines() + with open(includeFilePath1) as f_file: + content1 = f_file.readlines() + with open(includeFilePath2) as f_file: + content2 = f_file.readlines() + with open(includeFilePath3) as f_file: + content3 = f_file.readlines() print "content: ", content print "content1: ", content1 print "content2: ", content2 @@ -316,9 +316,9 @@ def test_distribution_policy_mapper_config(self): """ Testing the policy mapper. """ - configDict = {'root.dir': root_test_dir, - 'temp.build.dir': os.path.join(root_test_dir, 'temp_build_files'), - 'archives.dir': root_test_dir, + configDict = {'root.dir': _root_test_dir, + 'temp.build.dir': os.path.join(_root_test_dir, 'temp_build_files'), + 'archives.dir': _root_test_dir, 'name': 's60_policy_mapper_test', 'include': 's60/', 'archive.tool': '7za', @@ -372,11 +372,11 @@ if os.sep == '\\': for i in range(len(expected_paths9999)): expected_paths9999[i] = expected_paths9999[i].lower() - includeFilePath = os.path.join(root_test_dir, 'temp_build_files/s60_policy_mapper_test_includefile.txt') - includeFilePath0 = os.path.join(root_test_dir, 'temp_build_files/s60_policy_mapper_test_0.txt') - includeFilePath1 = os.path.join(root_test_dir, 'temp_build_files/s60_policy_mapper_test_1.txt') - includeFilePath9999 = os.path.join(root_test_dir, 'temp_build_files/s60_policy_mapper_test_9999.txt') - includeFilePathInternal = os.path.join(root_test_dir, 'temp_build_files/s60_policy_mapper_test.internal.txt') + includeFilePath = os.path.join(_root_test_dir, 'temp_build_files/s60_policy_mapper_test_includefile.txt') + includeFilePath0 = os.path.join(_root_test_dir, 'temp_build_files/s60_policy_mapper_test_0.txt') + includeFilePath1 = os.path.join(_root_test_dir, 'temp_build_files/s60_policy_mapper_test_1.txt') + includeFilePath9999 = os.path.join(_root_test_dir, 'temp_build_files/s60_policy_mapper_test_9999.txt') + includeFilePathInternal = os.path.join(_root_test_dir, 'temp_build_files/s60_policy_mapper_test.internal.txt') content = self.__read_manifest(includeFilePath) expected_paths.sort() @@ -408,12 +408,14 @@ print "Commands : ", cmds assert len(cmds) == 3 +# pylint: disable-msg=C0103 def test_distribution_policy_mapper_config_no_zip2zip(self): """ Testing the policy mapper. """ - configDict = {'root.dir': root_test_dir, - 'temp.build.dir': os.path.join(root_test_dir, 'temp_build_files'), - 'archives.dir': root_test_dir, + + configDict = {'root.dir': _root_test_dir, + 'temp.build.dir': os.path.join(_root_test_dir, 'temp_build_files'), + 'archives.dir': _root_test_dir, 'name': 's60_policy_mapper_test_noz2z', 'include': 's60/', 'archive.tool': '7za', @@ -431,7 +433,7 @@ 's60' + os.sep + 'component_private' + os.sep + 'Distribution.Policy.S60', 's60' + os.sep + 'component_public' + os.sep + 'component_public_file.txt', 's60' + os.sep + 'component_public' + os.sep + 'Distribution.Policy.S60', - 's60' + os.sep + 'Distribution.Policy.S60', + 's60' + os.sep + 'Distribution.Policy.S60', 's60' + os.sep + 'missing' + os.sep + 'subdir' + os.sep + 'another_subdir' + os.sep + 'to_be_removed_9999.txt', 's60' + os.sep + 'missing' + os.sep + 'subdir' + os.sep + 'Distribution.Policy.S60', 's60' + os.sep + 'missing' + os.sep + 'subdir' + os.sep + 'not_to_be_removed_0.txt', @@ -468,11 +470,11 @@ expected_paths9999[i] = expected_paths9999[i].lower() expected_paths.sort() - includeFilePath = os.path.join(root_test_dir, 'temp_build_files/s60_policy_mapper_test_includefile.txt') - includeFilePath0 = os.path.join(root_test_dir, 'temp_build_files/s60_policy_mapper_test_0.txt') - includeFilePath1 = os.path.join(root_test_dir, 'temp_build_files/s60_policy_mapper_test_1.txt') - includeFilePath9999 = os.path.join(root_test_dir, 'temp_build_files/s60_policy_mapper_test_9999.txt') - includeFilePathInternal = os.path.join(root_test_dir, 'temp_build_files/s60_policy_mapper_test_noz2z.internal.txt') + includeFilePath = os.path.join(_root_test_dir, 'temp_build_files/s60_policy_mapper_test_includefile.txt') + includeFilePath0 = os.path.join(_root_test_dir, 'temp_build_files/s60_policy_mapper_test_0.txt') + includeFilePath1 = os.path.join(_root_test_dir, 'temp_build_files/s60_policy_mapper_test_1.txt') + includeFilePath9999 = os.path.join(_root_test_dir, 'temp_build_files/s60_policy_mapper_test_9999.txt') + includeFilePathInternal = os.path.join(_root_test_dir, 'temp_build_files/s60_policy_mapper_test_noz2z.internal.txt') content = self.__read_manifest(includeFilePath) expected_paths.sort() @@ -501,16 +503,17 @@ assert os.path.exists(includeFilePathInternal) == False print "Commands : ", cmds assert len(cmds) == 1 +# pylint: enable-msg=C0103 - def test_distribution_policy_mapper_remover_config(self): + def test_dist_policy_mapper_remover_config(self): """ Testing the policy remover mapper. """ - configDict = {'root.dir': root_test_dir, - 'temp.build.dir': os.path.join(root_test_dir, 'temp_build_files'), - 'archives.dir': root_test_dir, + configDict = {'root.dir': _root_test_dir, + 'temp.build.dir': os.path.join(_root_test_dir, 'temp_build_files'), + 'archives.dir': _root_test_dir, 'name': 's60_policy_mapper_test', 'include': 's60/', - 'policy.root.dir': os.path.join(root_test_dir, 's60'), + 'policy.root.dir': os.path.join(_root_test_dir, 's60'), 'archive.tool': '7za', 'mapper': 'policy.remover', 'policy.zip2zip': 'true', @@ -556,9 +559,9 @@ for i in range(len(expected_paths1)): expected_paths1[i] = expected_paths1[i].lower() expected_paths1.sort() - includeFilePath = os.path.join(root_test_dir, 'temp_build_files/s60_policy_mapper_test_includefile.txt') - includeFilePath0 = os.path.join(root_test_dir, 'temp_build_files/s60_policy_mapper_test_0.txt') - includeFilePath1 = os.path.join(root_test_dir, 'temp_build_files/s60_policy_mapper_test_1.txt') + includeFilePath = os.path.join(_root_test_dir, 'temp_build_files/s60_policy_mapper_test_includefile.txt') + includeFilePath0 = os.path.join(_root_test_dir, 'temp_build_files/s60_policy_mapper_test_0.txt') + includeFilePath1 = os.path.join(_root_test_dir, 'temp_build_files/s60_policy_mapper_test_1.txt') content = self.__read_manifest(includeFilePath) expected_paths.sort() @@ -582,14 +585,14 @@ assert len(cmds[3]) == 7 - def test_distribution_policy_mapper_sf_remover_config(self): + def test_dist_policy_mapper_sf_remvr_config(self): """ Testing the policy SFL remover mapper. """ - configDict = {'root.dir': root_test_dir, - 'temp.build.dir': os.path.join(root_test_dir, 'temp_build_files'), - 'archives.dir': root_test_dir, + configDict = {'root.dir': _root_test_dir, + 'temp.build.dir': os.path.join(_root_test_dir, 'temp_build_files'), + 'archives.dir': _root_test_dir, 'name': 'sf_policy_sf_mapper_test', 'include': 'sf/', - 'policy.root.dir': os.path.join(root_test_dir, 'sf'), + 'policy.root.dir': os.path.join(_root_test_dir, 'sf'), 'archive.tool': '7za', 'mapper': 'sfl.policy.remover', 'policy.zip2zip': 'false', @@ -656,12 +659,12 @@ for i in range(len(expected_paths9)): expected_paths9[i] = expected_paths9[i].lower() - includeFilePath = os.path.join(root_test_dir, 'temp_build_files/sf_policy_sf_mapper_test_includefile.txt') - includeFilePath0 = os.path.join(root_test_dir, 'temp_build_files/sf_policy_sf_mapper_test_0.txt') - includeFilePath1 = os.path.join(root_test_dir, 'temp_build_files/sf_policy_sf_mapper_test_1.txt') - includeFilePath3 = os.path.join(root_test_dir, 'temp_build_files/sf_policy_sf_mapper_test_3.txt') - includeFilePath7 = os.path.join(root_test_dir, 'temp_build_files/sf_policy_sf_mapper_test_7.txt') - includeFilePath9 = os.path.join(root_test_dir, 'temp_build_files/sf_policy_sf_mapper_test_9999.txt') + includeFilePath = os.path.join(_root_test_dir, 'temp_build_files/sf_policy_sf_mapper_test_includefile.txt') + includeFilePath0 = os.path.join(_root_test_dir, 'temp_build_files/sf_policy_sf_mapper_test_0.txt') + includeFilePath1 = os.path.join(_root_test_dir, 'temp_build_files/sf_policy_sf_mapper_test_1.txt') + includeFilePath3 = os.path.join(_root_test_dir, 'temp_build_files/sf_policy_sf_mapper_test_3.txt') + includeFilePath7 = os.path.join(_root_test_dir, 'temp_build_files/sf_policy_sf_mapper_test_7.txt') + includeFilePath9 = os.path.join(_root_test_dir, 'temp_build_files/sf_policy_sf_mapper_test_9999.txt') content = self.__read_manifest(includeFilePath) @@ -708,14 +711,14 @@ print cmd assert len(cmds[1]) == len(expected_paths)-len(expected_paths3), "Remore must be equal to len(expected_paths) - len(expected_paths3)" - def test_distribution_policy_mapper_epl_remover_config(self): + def test_dist_policy_mapper_epl_remvr_config(self): """ Testing the policy EPL remover mapper. """ - configDict = {'root.dir': root_test_dir, - 'temp.build.dir': os.path.join(root_test_dir, 'temp_build_files'), - 'archives.dir': root_test_dir, + configDict = {'root.dir': _root_test_dir, + 'temp.build.dir': os.path.join(_root_test_dir, 'temp_build_files'), + 'archives.dir': _root_test_dir, 'name': 'sf_policy_epl_mapper_test', 'include': 'sf/', - 'policy.root.dir': os.path.join(root_test_dir, 'sf'), + 'policy.root.dir': os.path.join(_root_test_dir, 'sf'), 'archive.tool': '7za', 'mapper': 'epl.policy.remover', 'policy.zip2zip': 'false', @@ -782,12 +785,12 @@ for i in range(len(expected_paths9)): expected_paths9[i] = expected_paths9[i].lower() - includeFilePath = os.path.join(root_test_dir, 'temp_build_files/sf_policy_epl_mapper_test_includefile.txt') - includeFilePath0 = os.path.join(root_test_dir, 'temp_build_files/sf_policy_epl_mapper_test_0.txt') - includeFilePath1 = os.path.join(root_test_dir, 'temp_build_files/sf_policy_epl_mapper_test_1.txt') - includeFilePath3 = os.path.join(root_test_dir, 'temp_build_files/sf_policy_epl_mapper_test_3.txt') - includeFilePath7 = os.path.join(root_test_dir, 'temp_build_files/sf_policy_epl_mapper_test_7.txt') - includeFilePath9 = os.path.join(root_test_dir, 'temp_build_files/sf_policy_epl_mapper_test_9999.txt') + includeFilePath = os.path.join(_root_test_dir, 'temp_build_files/sf_policy_epl_mapper_test_includefile.txt') + includeFilePath0 = os.path.join(_root_test_dir, 'temp_build_files/sf_policy_epl_mapper_test_0.txt') + includeFilePath1 = os.path.join(_root_test_dir, 'temp_build_files/sf_policy_epl_mapper_test_1.txt') + includeFilePath3 = os.path.join(_root_test_dir, 'temp_build_files/sf_policy_epl_mapper_test_3.txt') + includeFilePath7 = os.path.join(_root_test_dir, 'temp_build_files/sf_policy_epl_mapper_test_7.txt') + includeFilePath9 = os.path.join(_root_test_dir, 'temp_build_files/sf_policy_epl_mapper_test_9999.txt') content = self.__read_manifest(includeFilePath) @@ -836,8 +839,8 @@ def __read_manifest(self, manifest): """ read the file and sort""" - with open(manifest) as f: - content = f.readlines() + with open(manifest) as f_file: + content = f_file.readlines() if os.sep == '\\': content = [s.strip().lower() for s in content] else: @@ -848,9 +851,9 @@ def test_split_manifest_file(self): """ A LogicalArchive can split a manifest correctly. """ - configDict = {'root.dir': os.path.abspath(root_test_dir), - 'temp.build.dir': os.path.abspath(os.path.join(root_test_dir, 'temp_build_files')), - 'archives.dir': os.path.abspath(root_test_dir), + configDict = {'root.dir': os.path.abspath(_root_test_dir), + 'temp.build.dir': os.path.abspath(os.path.join(_root_test_dir, 'temp_build_files')), + 'archives.dir': os.path.abspath(_root_test_dir), 'name': 'manifest_test', 'max.files.per.archive': '1', 'include': 'dir/', @@ -867,16 +870,16 @@ expectedPaths1 = ['dir' + os.sep + 'emptysubdir1\n'] expectedPaths2 = ['dir' + os.sep + 'emptysubdir2\n'] - includeFilePath = os.path.join(root_test_dir, 'temp_build_files/manifest_test_includefile.txt') - includeFilePath1 = os.path.join(root_test_dir, 'temp_build_files/manifest_test_part01.txt') - includeFilePath2 = os.path.join(root_test_dir, 'temp_build_files/manifest_test_part02.txt') + includeFilePath = os.path.join(_root_test_dir, 'temp_build_files/manifest_test_includefile.txt') + includeFilePath1 = os.path.join(_root_test_dir, 'temp_build_files/manifest_test_part01.txt') + includeFilePath2 = os.path.join(_root_test_dir, 'temp_build_files/manifest_test_part02.txt') - with open(includeFilePath) as f: - content = f.readlines() - with open(includeFilePath1) as f: - content1 = f.readlines() - with open(includeFilePath2) as f: - content2 = f.readlines() + with open(includeFilePath) as f_file: + content = f_file.readlines() + with open(includeFilePath1) as f_file: + content1 = f_file.readlines() + with open(includeFilePath2) as f_file: + content2 = f_file.readlines() print "content: ", content print "content1: ", content1 print "content2: ", content2 @@ -892,16 +895,16 @@ """test root drive value""" def test_checkRootDirValue(self): """ Testing the root drive value. """ - configDict = {'root.dir': root_test_dir, - 'temp.build.dir': os.path.join(root_test_dir, 'temp_build_files'), - 'archives.dir': root_test_dir, + configDict = {'root.dir': _root_test_dir, + 'temp.build.dir': os.path.join(_root_test_dir, 'temp_build_files'), + 'archives.dir': _root_test_dir, 'name': 'regular_path_test', 'include': 'dir1/*.txt', 'archive.tool': '7za' } configDictUnc = {'root.dir': "\\\\server\\share\\dir", - 'temp.build.dir': os.path.join(root_test_dir, 'temp_build_files'), - 'archives.dir': root_test_dir, + 'temp.build.dir': os.path.join(_root_test_dir, 'temp_build_files'), + 'archives.dir': _root_test_dir, 'name': 'unc_test', 'include': 'dir1/*.txt', 'archive.tool': '7za' @@ -920,8 +923,8 @@ '\\\\server2\\share\\somedir']) self.assert_(len(roots) == 3) self.assert_('\\\\server\\share\\' in roots) - self.assert_('\\\\server\\share1\\' in roots) - self.assert_('\\\\server2\\share\\' in roots) + self.assert_('\\\\server\\share1\\dir\\' in roots) + self.assert_('\\\\server2\\share\\somedir\\' in roots) class MockedConfigBuilder: """.""" @@ -942,28 +945,29 @@ def unSubStituteDrives(self, drive): """ unsubstitute the drive""" pass - + def rewriteXMLFile(self, xml_file, parse_xml_file): """re-write XML file""" doc = xml.dom.minidom.parse(xml_file) out = open(parse_xml_file, 'w') doc.writexml(out, indent='') out.close() - - + + class ZipArchiverTest(unittest.TestCase): """ Unit test case for seven zip archiver """ def test_extension(self): - t = archive.tools.SevenZipArchiver() - self.assert_(t.extension() == ".zip") + """test extension""" + t_tools = archive.tools.SevenZipArchiver() + self.assert_(t_tools.extension() == ".zip") class SevenZipFormatArchiverTest(unittest.TestCase): """ Testing 7z archiver class """ def test_archive(self): """ Testing whether the ant file for running 7z is created """ - configDict = {'root.dir': os.path.abspath(root_test_dir), - 'temp.build.dir': os.path.abspath(os.path.join(root_test_dir, 'temp_build_files')), - 'archives.dir': os.path.abspath(root_test_dir), + configDict = {'root.dir': os.path.abspath(_root_test_dir), + 'temp.build.dir': os.path.abspath(os.path.join(_root_test_dir, 'temp_build_files')), + 'archives.dir': os.path.abspath(_root_test_dir), 'name': 'manifest_test', 'max.files.per.archive': '1', 'include': 'dir/', @@ -974,7 +978,7 @@ builder = archive.ArchivePreBuilder(configuration.ConfigurationSet([config]), "config", index=0) manifest_file_path = builder.build_manifest(config) builder.manifest_to_commands(config, manifest_file_path) - tmpfilename = os.path.join(os.path.abspath(root_test_dir),'test_archive_7z.xml') + tmpfilename = os.path.join(os.path.abspath(_root_test_dir),'test_archive_7z.xml') builder.write(tmpfilename) tmpfileh = open(tmpfilename,'r') content = tmpfileh.read() diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_ats3.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_ats3.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_ats3.py Wed Jun 16 16:51:40 2010 +0300 @@ -722,7 +722,7 @@ def test_harness(self): """ Detect test harness.""" - mmp_parser = parser.MmpFileParser() + mmp_parser = parser.MmpFileParser(None) group = TSRC.joinpath("group") for harness, mmp in [ ("STIF", group / "stif.mmp"), diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_ats4.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_ats4.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_ats4.py Wed Jun 16 16:51:40 2010 +0300 @@ -695,7 +695,7 @@ def test_harness(self): """ Detect test harness.""" - mmp_parser = parser.MmpFileParser() + mmp_parser = parser.MmpFileParser(None) group = TSRC.joinpath("group") for harness, mmp in [ ("STIF", group / "stif.mmp"), diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_atsant.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_atsant.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_atsant.py Wed Jun 16 16:51:40 2010 +0300 @@ -27,17 +27,23 @@ import atsant -def test_atsant(): +def test_atsant_multipledrop(): """test atsant and check 3 files in the file""" - files = atsant.files_to_test(os.path.join(os.environ['TEST_DATA'], 'data/packageiad/layers.sysdef.xml'), None, None, 'z:') + files = atsant.files_to_test(os.path.join(os.environ['TEST_DATA'], 'data/packageiad/layers.sysdef.xml'), None, None, 'z:', 'false') assert len(files) == 3 - + +def test_atsant_singledrop(): + """test atsant and check 1 files in the file""" + files = atsant.files_to_test(os.path.join(os.environ['TEST_DATA'], 'data/packageiad/layers.sysdef.xml'), None, None, 'z:', 'true') + assert len(files) == 1 + def test_IConfigATS(): + """test I config ATS""" tmpdir = tempfile.mkdtemp() shutil.copy(os.path.join(os.environ['TEST_DATA'], 'data', 'example_corernd.iconfig.xml'), os.path.join(tmpdir, 'example_corernd.iconfig.xml')) open(os.path.join(tmpdir, 'RX-60_00_rnd.core.fpsx'), 'w').close() open(os.path.join(tmpdir, 'RX-60_00.01_rnd.rofs2.fpsx'), 'w').close() open(os.path.join(tmpdir, 'RX-60_00_rnd.rofs3.fpsx'), 'w').close() open(os.path.join(tmpdir, 'RX-60_00_rnd.udaerase.fpsx'), 'w').close() - ic = atsant.IConfigATS(tmpdir) - ic.findimages() \ No newline at end of file + i_c = atsant.IConfigATS(tmpdir, '') + i_c.findimages() diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_atscustom.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_atscustom.py Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,37 @@ +#============================================================================ +#Name : test_atsant.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: +#=============================================================================== + +""" ats3 custom.py module tests. """ + +import tempfile +import os + +class Bunch(object): + """ Configuration object. Argument from constructor are converted into class attributes. """ + def __init__(self, **kwargs): + self.__dict__.update(kwargs) + +def test_atscustom(): + import ats3 + import ats3.custom + output = os.path.join(tempfile.mkdtemp(), 'ATS3Drop.zip') + opts = Bunch(file_store='', flash_images='', diamonds_build_url='', testrun_name='', device_type='', report_email='', test_timeout='', drop_file=output, config_file='') + config = ats3.Configuration(opts, []) + ats3.custom.create_drop(config) + assert os.path.exists(output) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_buildmodel.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_buildmodel.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_buildmodel.py Wed Jun 16 16:51:40 2010 +0300 @@ -30,7 +30,7 @@ _logger = logging.getLogger('test.bom') -database = "to1tobet" +_database = "to1tobet" class BOMMockFolder: """ This class provides a mock folder """ @@ -50,10 +50,12 @@ @property def tasks(self): + """tasks""" return [] @property def folders(self): + """folders""" return [BOMMockFolder('5856', 'tr1s60', "all completed tasks for release ABS_domain/abs.mcl for collaborative projects", [])] class BOMMock: @@ -63,10 +65,12 @@ self.config['build.id'] = "mock" @property - def projects(self): + def projects(self): + """projects""" return [BOMMockProject('ABS_domain-abs.mcl_200843:project:tr1s60#1')] def all_baselines(self): + """all baselines""" return [] # Refactor required: See http://delivery.nmp.nokia.com/trac/helium/ticket/1517 @@ -78,7 +82,7 @@ # def test_bom_output(self): # """ Test basic BOM execution. Only new spec format will be covered!""" # try: -# session = ccm.open_session(database=database) +# session = ccm.open_session(_database=_database) # except ccm.CCMException: # print "Skipping BOMTest test cases." # return @@ -134,6 +138,7 @@ self.assertEqual(None, delta_bom_content_validity) def test_BOMXMLWriter(self): + """test BOM XML writer""" config_data = {'delivery': os.environ['TEST_DATA'] + '/data/test_delivery.xml', 'prep.xml': os.environ['TEST_DATA'] + '/data/test_prep.xml', 'build.id': 'buildid', 'symbian_rel_week': r'${symbian.version.week}', 'symbian_rel_ver': r'${symbian.version}', 'symbian_rel_year': r'${symbian.version.year}', 's60_version': r'${s60.version}', 's60_release': r'${s60.release}', 'currentRelease.xml': os.environ['TEST_DATA'] + "tests/data/symrec/generated_release_metadata.xml"} bom = build.model.BOM(configuration.Configuration(config_data)) xml_writer = build.model.BOMXMLWriter(bom) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_comments.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_comments.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_comments.py Wed Jun 16 16:51:40 2010 +0300 @@ -27,7 +27,7 @@ """ Test cases for Comments.py. """ def setUp(self): - # Initialize the sample files into two Comment Parsers. + """ Initialize the sample files into two Comment Parsers.""" self.parser1 = comments.CommentParser( [os.environ['TEST_DATA'] + '/data/comments_test.txt'], 'branchInfo' ) self.parser2 = comments.CommentParser( [os.environ['TEST_DATA'] + '/data/comments_test.cpp', os.environ['TEST_DATA'] + '/data/comments_test.bat', os.environ['TEST_DATA'] + '/data/comments_test.h', os.environ['TEST_DATA'] + '/data/comments_test.hrh', @@ -40,9 +40,8 @@ - """ Unit test for method scan() in comments.py. It also tested scan_content by using scan() - """ def test_scan(self): + """ Unit test for method scan() in comments.py. It also tested scan_content by using scan()""" #doc1 for only one txt file. doc1 = amara.parse(self.parser1.scan().xml()) #doc2 for all other 14 types of files. It also included two types of cmd files. diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_configuration_model.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_configuration_model.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_configuration_model.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,7 @@ # #Description: #=============================================================================== +""" test configuration model""" import logging import os @@ -26,7 +27,7 @@ import configuration_model -logger = logging.getLogger('test.configuration_model') +_logger = logging.getLogger('test.configuration_model') #logging.basicConfig(level=logging.DEBUG) class GroupDefTest(unittest.TestCase): @@ -58,7 +59,7 @@ assert len(items) == 2 assert isinstance(items[0], configuration_model.MissingFromDataModelItem) - def test_required_property_in_group_not_defined(self): + def test_rqrd_property_in_group_not_defined(self): """ Required property in a group missing from config is identified. """ config = configuration.Configuration({'test.property.1': '1', 'test.property.3': '3'}) items = self.model.validate_config(config) @@ -73,7 +74,7 @@ """ Basic validation item usage. """ item = configuration_model.MissingFromDataModelItem('test.property') self.assert_(str(item) == 'Property not in data model: test.property') - item.log(logger) + item.log(_logger) class DataModelTest(unittest.TestCase): diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_documentation.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_documentation.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_documentation.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,7 @@ # #Description: #=============================================================================== +""" test documentation """ import tempfile import os @@ -30,6 +31,7 @@ class DocumentationTest(unittest.TestCase): """ Unit tests for documentation module """ def test_APIDeltaWriter(self): + """test API Delta writer""" (fileDes, tempFileName) = tempfile.mkstemp() old_db = os.path.join(os.environ['TEST_DATA'], 'data', 'docs', 'sample_old_db.xml') new_db = os.path.join(os.environ['TEST_DATA'], 'data', 'docs', 'sample_new_db.xml') diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_fileutils.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_fileutils.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_fileutils.py Wed Jun 16 16:51:40 2010 +0300 @@ -151,12 +151,12 @@ 'sf/component_private/Distribution.Policy.S60': '1', } -""" Used by test_archive. """ -root_test_dir = "build/_test_" + str(time.strftime("%H.%M.%S")) - +# Used by test_archive. +_root_test_dir = "build/_test_" + str(time.strftime("%H.%M.%S")) + def _testpath(subpath): """ Normalised path for test paths. """ - return os.path.normpath(os.path.join(root_test_dir, subpath)) + return os.path.normpath(os.path.join(_root_test_dir, subpath)) def setup_module(): """ Setup files test config. @@ -167,7 +167,7 @@ #print 'setup_module()' #print _test_file_content.keys() for child_path in _test_file_paths: - path = os.path.join(root_test_dir, child_path) + path = os.path.join(_root_test_dir, child_path) path_dir = path path_dir = os.path.dirname(path) @@ -185,8 +185,8 @@ def teardown_module(): """ Teardown test config. """ - if os.path.exists(root_test_dir): - fileutils.rmtree(root_test_dir) + if os.path.exists(_root_test_dir): + fileutils.rmtree(_root_test_dir) class FileScannerTest(unittest.TestCase): @@ -342,7 +342,7 @@ testpaths = [_testpath('dir1/file1.txt'), _testpath('dir1/file2.doc'), _testpath('dir1/file3_no_extension'), - _testpath('dir1/subdir3')] + _testpath('dir1/subdir3')] result.sort() testpaths.sort() @@ -359,7 +359,7 @@ result = [] testpaths = [_testpath('dir1/file3_no_extension'), _testpath('dir1/subdir2/subdir2_file_no_extension'), - _testpath('dir1/subdir3')] + _testpath('dir1/subdir3')] [result.append(path) for path in scanner.scan()] result.sort() testpaths.sort() @@ -377,7 +377,7 @@ _testpath('s60/UPPERCASE_MISSING/subdir/Distribution.Policy.S60'), _testpath('s60/UPPERCASE_MISSING/subdir/not_to_be_removed_0.txt'), _testpath('s60/UPPERCASE_MISSING/subdir/another_subdir/to_be_removed_9999.txt') - ] + ] [result.append(path) for path in scanner.scan()] testpaths.sort() @@ -392,7 +392,7 @@ scanner = fileutils.FileScanner(_testpath('')) scanner.add_include('dir/emptysubdir1/') result = [] - testpaths = [_testpath('dir/emptysubdir1')] + testpaths = [_testpath('dir/emptysubdir1')] [result.append(path) for path in scanner.scan()] result.sort() @@ -409,7 +409,7 @@ scanner.add_exclude('emptydirerror/dir/subdir/') scanner.add_exclude('emptydirerror/dir/emptysubdir/') result = [] - testpaths = [] + testpaths = [] [result.append(path) for path in scanner.scan()] result.sort() @@ -426,7 +426,7 @@ scanner.add_exclude('dir/emptysubdir3/') result = [] testpaths = [_testpath('dir/emptysubdir1'), - _testpath('dir/emptysubdir2')] + _testpath('dir/emptysubdir2')] [result.append(path) for path in scanner.scan()] print result @@ -443,7 +443,7 @@ result = [] [result.append(path) for path in scanner.scan()] testpaths = [_testpath('s60/component_public/component_public_file.txt'), - _testpath('s60/component_public/distribution.policy.s60')] + _testpath('s60/component_public/distribution.policy.s60')] result = [s.lower() for s in result] result.sort() @@ -462,12 +462,13 @@ result = [] [result.append(path) for path in scanner.scan()] - testpaths = [] + testpaths = [] assert result == testpaths def test_symbian_distribution_policy_cat_a(self): + """test symbian distribution policy category A""" scanner = fileutils.FileScanner(_testpath('')) scanner.add_include('s60src/src-a/') selector = archive.selectors.SymbianPolicySelector(['distribution.policy'], 'A') @@ -479,7 +480,8 @@ assert result == testpaths - def test_symbian_distribution_policy_cat_b(self): + def test_symbian_distribution_policy_cat_b(self): + """test symbian distribution policy category B""" scanner = fileutils.FileScanner(_testpath('')) scanner.add_include('s60src/src-b/') selector = archive.selectors.SymbianPolicySelector(['distribution.policy'], 'B') @@ -489,9 +491,10 @@ [result.append(path) for path in scanner.scan()] testpaths = [_testpath('s60src/src-b/distribution.policy')] - assert result == testpaths + assert result == testpaths - def test_symbian_distribution_policy_cat_not_a_not_b(self): + def test_symbian_dist_policy_cat_not_a_not_b(self): + """test symbian distribution policy category not A and not B""" scanner = fileutils.FileScanner(_testpath('')) scanner.add_include('s60src/src-c/') selector = archive.selectors.SymbianPolicySelector(['distribution.policy'], '!A,!B') @@ -502,7 +505,7 @@ testpaths = [_testpath('s60src/src-c/distribution.policy')] - assert result == testpaths + assert result == testpaths def test_find_subroots(self): @@ -528,11 +531,12 @@ scanner.add_include('**/dir') scanner.add_include('foo/**/dir') result = scanner.find_subroots() - _logger.debug(result) + _logger.debug(result) assert result == [_testpath('')] def test_load_policy_content(self): + """test load policy content""" try: fileutils.load_policy_content(_testpath('test_policies/1/Distribution.Policy.S60')) assert "Should fail while loading 'test_policies/1/Distribution.Policy.S60'." @@ -545,8 +549,9 @@ assert "Should not fail while loading 's60/Distribution.Policy.S60'." - def assert_policy_file(self, filename, value=None, exception=False): - if exception: + def assert_policy_file(self, filename, value=None, excptn=False): + """assert policy file""" + if excptn: try: fileutils.read_policy_content(filename) assert "Should fail while loading '%s'." % filename @@ -554,8 +559,10 @@ pass else: assert fileutils.read_policy_content(filename) == value - def assert_symbian_policy_file(self, filename, value=None, exception=False): - if exception: + + def assert_symbian_policy_file(self, filename, value=None, excptn=False): + """assert symbian policy file""" + if excptn: try: fileutils.read_symbian_policy_content(filename) assert "Should fail while loading '%s'." % filename @@ -569,18 +576,18 @@ self.assert_policy_file(_testpath('s60/Distribution.Policy.S60'), value='0') self.assert_policy_file(_testpath('s60/component_private/Distribution.Policy.S60'), value='1') - self.assert_policy_file(_testpath('test_policies/1/Distribution.Policy.S60'), exception=True) - self.assert_policy_file(_testpath('test_policies/2/Distribution.Policy.S60'), exception=True) - self.assert_policy_file(_testpath('test_policies/3/Distribution.Policy.S60'), exception=True) - self.assert_policy_file(_testpath('test_policies/4/Distribution.Policy.S60'), exception=True) - self.assert_policy_file(_testpath('test_policies/5/Distribution.Policy.S60'), exception=True) - self.assert_policy_file(_testpath('test_policies/6/Distribution.Policy.S60'), exception=True) + self.assert_policy_file(_testpath('test_policies/1/Distribution.Policy.S60'), excptn=True) + self.assert_policy_file(_testpath('test_policies/2/Distribution.Policy.S60'), excptn=True) + self.assert_policy_file(_testpath('test_policies/3/Distribution.Policy.S60'), excptn=True) + self.assert_policy_file(_testpath('test_policies/4/Distribution.Policy.S60'), excptn=True) + self.assert_policy_file(_testpath('test_policies/5/Distribution.Policy.S60'), excptn=True) + self.assert_policy_file(_testpath('test_policies/6/Distribution.Policy.S60'), excptn=True) def test_read_policy_content_strict_focalid(self): """ Testing Focal ID support. """ self.assert_policy_file(_testpath('test_policies/7/Distribution.Policy.S60'), value='08421A2') - self.assert_policy_file(_testpath('test_policies/8/Distribution.Policy.S60'), exception=True) - self.assert_policy_file(_testpath('test_policies/9/Distribution.Policy.S60'), exception=True) + self.assert_policy_file(_testpath('test_policies/8/Distribution.Policy.S60'), excptn=True) + self.assert_policy_file(_testpath('test_policies/9/Distribution.Policy.S60'), excptn=True) def test_read_symbian_policy_content_strict(self): """ Test symbian policy content using strict rules. """ @@ -589,15 +596,16 @@ self.assert_symbian_policy_file(_testpath('symbian/dir1/distribution.policy'), value='B') self.assert_symbian_policy_file(_testpath('symbian/dir2/distribution.policy'), value='C') self.assert_symbian_policy_file(_testpath('symbian/dir3/distribution.policy'), value='D') - self.assert_symbian_policy_file(_testpath('symbian/dir4/distribution.policy'), exception=True) - self.assert_symbian_policy_file(_testpath('symbian/dir5/distribution.policy'), exception=True) + self.assert_symbian_policy_file(_testpath('symbian/dir4/distribution.policy'), excptn=True) + self.assert_symbian_policy_file(_testpath('symbian/dir5/distribution.policy'), excptn=True) class TestLongPath(unittest.TestCase): """ Unit test case for testing long path strings """ - long_path = os.path.join(root_test_dir, '01234567890123456789012345678901234567890123456789', + long_path = os.path.join(_root_test_dir, '01234567890123456789012345678901234567890123456789', '01234567890123456789012345678901234567890123456789', '01234567890123456789012345678901234567890123456789', '01234567890123456789012345678901234567890123456789', '01234567890123456789012345678901234567890123456789') def setUp(self): + """setup automatically called before running the tests""" self.mkdirs(os.path.join(self.long_path, r'dir1')) self.mkdirs(os.path.join(self.long_path, r'dir2')) if not '\\\\?\\' + os.path.abspath((os.path.join( self.long_path, r'foo.txt'))): @@ -605,6 +613,7 @@ win32file.CreateFileW('\\\\?\\' + os.path.abspath(os.path.join(self.long_path, r'foo.txt')), 0, 0, None, win32file.CREATE_NEW, 0, None) def mkdirs(self, path): + """create folders""" if not os.path.isabs(path): path = os.path.join(os.path.abspath('.'), os.path.normpath(path)) if not os.path.exists(os.path.dirname(path)): @@ -612,10 +621,11 @@ self.mkdir(path) def mkdir(self, path): + """create a folder""" if 'java' in sys.platform: import java.io - f = java.io.File(path) - if not f.exists(): + f_file = java.io.File(path) + if not f_file.exists(): os.mkdir(path) elif not os.path.exists(path): if sys.platform == "win32": @@ -628,15 +638,17 @@ os.mkdir(path) def test_rmtree_long_path(self): - fileutils.rmtree(root_test_dir) + """test remove tree with a long path name""" + fileutils.rmtree(_root_test_dir) assert not os.path.exists(self.long_path) - assert not os.path.exists(root_test_dir) + assert not os.path.exists(_root_test_dir) def test_rmtree_long_path_unc_format(self): + """test remove tree with long path name and UNC format""" if sys.platform == "win32": - fileutils.rmtree(u"\\\\?\\" + os.path.join(os.path.abspath('.'), root_test_dir)) + fileutils.rmtree(u"\\\\?\\" + os.path.join(os.path.abspath('.'), _root_test_dir)) assert not os.path.exists(self.long_path) - assert not os.path.exists(root_test_dir) + assert not os.path.exists(_root_test_dir) class DestInSrcTest(unittest.TestCase): """ Unit test case to test fileutils.destinsrc """ @@ -667,3 +679,19 @@ src = r"Z:/a/b/CC" dst = r"Z:/a/b/c/d" assert fileutils.destinsrc(src, dst) is False + + +class WhichTest(unittest.TestCase): + """ Testing the which implementation. """ + + def test_existing_file(self): + """ Test an existing executable is found (cmd on windows, bash on other os) """ + if os.sep == '\\': + assert fileutils.which("cmd") != None + else: + assert fileutils.which("bash") != None + + def test_non_existing_file(self): + """ Test a non existing executable is not found """ + assert fileutils.which("foobar_app") == None + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_logger.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_logger.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_logger.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,7 @@ # #Description: #=============================================================================== +""" test logger""" import logging import os @@ -27,7 +28,7 @@ # Uncomment this line to enable logging in this module, or configure logging elsewhere #logging.basicConfig(level=logging.DEBUG) -logger = logging.getLogger('test.helium.logger') +_logger = logging.getLogger('test.helium.logger') class TestHeliumLogger(unittest.TestCase): @@ -52,7 +53,7 @@ mclogger.CloseMainContent() mclogger.WriteToFile('log.xml') - logger.info(mclogger) + _logger.info(mclogger) os.unlink('log.xml') @@ -71,7 +72,7 @@ mclogger.CloseMainContent() mclogger.WriteToFile('log.xml') - logger.info(mclogger) + _logger.info(mclogger) os.unlink('log.xml') @@ -86,7 +87,7 @@ mclogger.CloseMainContent() mclogger.WriteToFile('log.xml') - logger.info(mclogger) + _logger.info(mclogger) out = helium.outputer.XML2XHTML('log.xml') out.generate() diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_packageiad.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_packageiad.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_packageiad.py Wed Jun 16 16:51:40 2010 +0300 @@ -25,7 +25,7 @@ import logging -logger = logging.getLogger('test.packageiad') +_logger = logging.getLogger('test.packageiad') logging.basicConfig(level=logging.INFO) @@ -40,22 +40,22 @@ #def test_package_main(self): - """ Test the package IAD class. - - iad = __import__('packageiad') - sysdef = os.path.join(os.environ['TEST_DATA'], 'data', 'packageiad', 'layers.sysdef.xml') - sysdefconfigs = "developer_mc_4032" - builddrive = os.path.join(os.environ['TEST_DATA'], 'data', 'packageiad') - result = iad.main(sysdef, sysdefconfigs, builddrive) """ +# test the package IAD class. +# +# iad = __import__('packageiad') +# sysdef = os.path.join(os.environ['TEST_DATA'], 'data', 'packageiad', 'layers.sysdef.xml') +# sysdefconfigs = "developer_mc_4032" +# builddrive = os.path.join(os.environ['TEST_DATA'], 'data', 'packageiad') +# result = iad.main(sysdef, sysdefconfigs, builddrive) #def test_package_processSisDir(self): - """ Test the packageiad test_package_processSisDir method. - - iad = __import__('packageiad') - packager = iad.IADPackager() #init the packager - builddrive = os.path.join(os.environ['TEST_DATA'], 'data', 'packageiad') - buildDirs = os.path.join(os.environ['TEST_DATA'], 'data', 'packageiad', 'sis\\') - packager.processSisDir(buildDirs, builddrive + "\\epoc32\\tools\\makesis.exe") """ +# test the packageiad test_package_processSisDir method. +# +# iad = __import__('packageiad') +# packager = iad.IADPackager() #init the packager +# builddrive = os.path.join(os.environ['TEST_DATA'], 'data', 'packageiad') +# buildDirs = os.path.join(os.environ['TEST_DATA'], 'data', 'packageiad', 'sis\\') +# packager.processSisDir(buildDirs, builddrive + "\\epoc32\\tools\\makesis.exe") def test_createPackage(): """ test the create package method """ @@ -68,7 +68,7 @@ currentDir = os.getcwd() packager.createPackage(topDir, packageName) if not os.path.exists('testPackage.zip') and not os.path.isfile('testPackage.zip'): - logger.info("testPackage.zip file not created") + _logger.info("testPackage.zip file not created") assert (os.path.exists('testPackage.zip') and os.path.isfile('testPackage.zip')) os.chdir(currentDir) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_parsers.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_parsers.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_parsers.py Wed Jun 16 16:51:40 2010 +0300 @@ -18,6 +18,7 @@ # #Description: #=============================================================================== +""" test parsers""" import os import tempfile @@ -353,7 +354,7 @@ self.tcp = ats3.parsers.PkgFileParser("tc1.pkg") self.data_files = [ - (path(TSRC_DIR+r"" + os.sep + "tsrc" + os.sep + "tc1" + os.sep + "data" + os.sep + "file1.dll").normpath(), path(r"c:" + os.sep + "sys" + os.sep + "bin" + os.sep + "file1.dll").normpath(), "testmodule", 'tc1.pkg'), + (path(TSRC_DIR+r"" + os.sep + "tsrc" + os.sep + "tc1" + os.sep + "data" + os.sep + "file1.dll").normpath(), path(r"c:" + os.sep + "sys" + os.sep + "bin" + os.sep + "file1.dll").normpath(), "data:dependent", 'tc1.pkg'), (path(TSRC_DIR+r"" + os.sep + "tsrc" + os.sep + "tc1" + os.sep + "data" + os.sep + "file1.txt").normpath(), path(r"e:" + os.sep + "sys" + os.sep + "bin" + os.sep + "file1.txt").normpath(), "data", 'tc1.pkg'), (path(TSRC_DIR+r"" + os.sep + "tsrc" + os.sep + "tc1" + os.sep + "data" + os.sep + "file2.mp3").normpath(), path(r"e:" + os.sep + "sys" + os.sep + "bin" + os.sep + "file2.mp3").normpath(), "data", 'tc1.pkg'), (path(TSRC_DIR+r"" + os.sep + "tsrc" + os.sep + "tc1" + os.sep + "data" + os.sep + "TestFramework.ini").normpath(), path(r"c:" + os.sep + "sys" + os.sep + "bin" + os.sep + "TestFramework.ini").normpath(), "engine_ini", 'tc1.pkg'), @@ -362,6 +363,8 @@ (path(TSRC_DIR+r"" + os.sep + "tsrc" + os.sep + "tc1" + os.sep + "data" + os.sep + "tc1.sisx").normpath(), path(r"e:" + os.sep + "sys" + os.sep + "bin" + os.sep + "tc1.sisx").normpath(), "", 'tc1.pkg'), (path(TSRC_DIR+r"" + os.sep + "tsrc" + os.sep + "tc1" + os.sep + "data" + os.sep + "DUMP.xyz").normpath(), path(r"e:" + os.sep + "sys" + os.sep + "bin" + os.sep + "DUMP.xyz").normpath(), "data", 'tc1.pkg'), ] + for p, _, _, _ in self.data_files: + open(p, 'w').close() def test_get_pkg_files(self): """Test if pkg files are returned from a specified location""" @@ -382,15 +385,13 @@ self.data_files.pop() assert self.tcp.get_data_files(self.pkg_file_path1, "d:", "\.xyz") == self.data_files - def test_data_files_creation_without_drive_with_exclude(self): + def test_data_files_create_no_drive_wth_excl(self): """ Tests if PKG file parser creates data files list as expected without drive with exclude""" - self.data_files.pop() assert self.tcp.get_data_files(self.pkg_file_path1, "", "\.xyz") == self.data_files - def test_data_files_creation_without_drive_without_exclude(self): + def test_data_file_creation_no_drive_no_excl(self): """ Tests if PKG file parser creates data files list as expected without drive without exclude""" - assert self.tcp.get_data_files(self.pkg_file_path1, "") == self.data_files @@ -400,6 +401,7 @@ mocker.MockerTestCase.__init__(self, methodName) def setUp(self): + """setUp called before running tests automatically""" self.bld_path = os.path.normpath(os.path.join(TSRC_DIR, "tsrc", "group")) self.bld_path_comp1 = os.path.normpath(os.path.join(TSRC_DIR, "tsrc", "tc1", "group")) self.tcp = ats3.parsers.CppParser() @@ -586,8 +588,8 @@ """Tests if test mmp files are included""" self.lst_test_mmp = [] - for p in self.path_list: - self.lst_test_mmp.append(self.tcp.get_test_mmp_files(os.path.normpath(os.path.join(p, "bld.inf")), False)) + for p_list in self.path_list: + self.lst_test_mmp.append(self.tcp.get_test_mmp_files(os.path.normpath(os.path.join(p_list, "bld.inf")), False)) assert self.lst_test_mmp == self.test_mmp_files @@ -611,7 +613,7 @@ def test_empty_parameter(self): """Tests if 'None' is returned when bld file path is empty""" - upper_bld_path = os.path.dirname(self.bld_path) + _ = os.path.dirname(self.bld_path) assert self.tcp.get_test_mmp_files("") == None @@ -621,9 +623,10 @@ mocker.MockerTestCase.__init__(self, methodName) def setUp(self): + """setUp called before tests are runn (automatically)""" self.bld_path = os.path.normpath(os.path.join(TSRC_DIR, "tsrc", "group", "bld.inf")) upper_bld_path = os.path.dirname(self.bld_path) - self.tcp = ats3.parsers.MmpFileParser() + self.tcp = ats3.parsers.MmpFileParser(self.bld_path) self.tc1_type = "dll" self.tc1_name = "tc1.dll" self.tc1_dll_type = "executable" @@ -684,4 +687,5 @@ mocker.MockerTestCase.__init__(self, methodName) def setUp(self): + """setUp automatically called before the tests are run""" pass diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_pkg2iby.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_pkg2iby.py Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,46 @@ +#============================================================================ +#Name : test_ant.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: +#=============================================================================== + +""" pkg2iby.py module tests. """ + +import tempfile +import os + +def test_pkg2iby(): + import pkg2iby + tmpdir = tempfile.mkdtemp() + os.makedirs(os.path.join(tmpdir, 'epoc32', 'rom', 'include')) + os.makedirs(os.path.join(tmpdir, 'epoc32', 'data')) + os.makedirs(os.path.join(tmpdir, 'sf')) + + open(os.path.join(tmpdir, 'a.exe'), 'w').close() + open(os.path.join(tmpdir, 'a.dat'), 'w').close() + open(os.path.join(tmpdir, 'sf', 'a.script'), 'w').close() + + (f_desc, filename) = tempfile.mkstemp() + f_file = os.fdopen(f_desc, 'w') + f_file.write(r'"/sf/a.script"-"c:\a.script"' + '\n') + f_file.write(r'"/a.exe"-"c:\graphics\a.exe"' + '\n') + f_file.write(r'"/a.dat"-"c:\graphics\a.dat"' + '\n') + f_file.close() + + pkg2iby.generateromcontent(tmpdir, 'tef', [filename]) + assert os.path.exists(os.path.join(tmpdir, 'epoc32', 'data', 'atsautoexec.bat')) + assert os.path.exists(os.path.join(tmpdir, 'epoc32', 'rom', 'include', 'atsauto.iby')) + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_timeout_launcher.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_timeout_launcher.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_timeout_launcher.py Wed Jun 16 16:51:40 2010 +0300 @@ -39,14 +39,16 @@ # pylint: disable-msg=C0103 + class os(object): #has to be named this as it is mocking os method. """ dummy the os function call""" -# pylint: enable-msg=C0103 + def kill(self, pid, value): """dummy OS class""" pid = value #just for pylint value = pid #just for pylint return 1 +# pylint: enable-msg=C0103 class TimeoutLauncherTest(mocker.MockerTestCase): """class containing methods to test the timeout launcher""" diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/__init__.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/__init__.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/__init__.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,4 +16,4 @@ # #Description: #=============================================================================== - +""" python core library python core tests initialisation file""" diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_amara.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_amara.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_amara.py Wed Jun 16 16:51:40 2010 +0300 @@ -24,12 +24,13 @@ from xmlhelper import recursive_node_scan def test_amara(): - x = amara.parse(r'Add rofsfiles for usage in paged images') - assert str(x.commentLog.branchInfo) == 'Add rofsfiles for usage in paged images' + """test amara""" + xxx = amara.parse(r'Add rofsfiles for usage in paged images') + assert str(xxx.commentLog.branchInfo) == 'Add rofsfiles for usage in paged images' - x = amara.parse(r'12') - for y in x.commentLog.branchInfo: - assert str(y) == '1' + xxx = amara.parse(r'12') + for yyy in xxx.commentLog.branchInfo: + assert str(yyy) == '1' break myxml = """""" @@ -72,8 +73,8 @@ xcf4 = amara.parse(r"

    ") found = False - for p in xcf4.xml_xpath("//p"): - assert str(p.name) == '1' + for p_path in xcf4.xml_xpath("//p"): + assert str(p_path.name) == '1' found = True assert found diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_bomtofile.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_bomtofile.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_bomtofile.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,9 @@ # #Description: #=============================================================================== +""" test BOM to file""" + +# pylint: disable-msg=R0201 import tempfile from shutil import rmtree @@ -94,5 +97,6 @@ def __init__(self, baseline): self.baseline = baseline - def create(self, project): + def create(self, _): + """create""" return _emulateProject(self.baseline) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_build_io.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_build_io.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_build_io.py Wed Jun 16 16:51:40 2010 +0300 @@ -18,6 +18,8 @@ #=============================================================================== """ Test the build.io module. """ +# pylint: disable-msg=R0201 +#method could be a function warning removed import logging import unittest @@ -25,7 +27,7 @@ import build.io -logger = logging.getLogger('test.build.io') +_logger = logging.getLogger('test.build.io') class AbldLogWhatReaderTest(unittest.TestCase): diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccm_4pn.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccm_4pn.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccm_4pn.py Wed Jun 16 16:51:40 2010 +0300 @@ -20,12 +20,14 @@ """ Test cases for ccm python toolkit. """ +# pylint: disable-msg=R0201 + import unittest import ccm import logging -logger = logging.getLogger('test.ccm') +_logger = logging.getLogger('test.ccm') class FourPartNameTest(unittest.TestCase): @@ -95,7 +97,7 @@ assert not fpn1.is_same_family(fpn2), "Should not be from the same family" def testConvert(self): - # Test task displayname tranformation + """ Test task displayname tranformation""" fpn = ccm.FourPartName("Task mydb#123") assert fpn.type == "task" # Test folder displayname tranformation @@ -123,13 +125,13 @@ try: fpn = ccm.FourPartName("task mydb#123") assert False, "Should raise InvalidFourPartNameException when parsing'task mydb#123'" - except ccm.InvalidFourPartNameException, e: + except ccm.InvalidFourPartNameException: pass try: fpn = ccm.FourPartName("folder mydb#123") assert False, "Should raise InvalidFourPartNameException when parsing'folder mydb#123'" - except ccm.InvalidFourPartNameException, e: + except ccm.InvalidFourPartNameException: pass diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccm_object.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccm_object.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccm_object.py Wed Jun 16 16:51:40 2010 +0300 @@ -20,13 +20,16 @@ """ Test cases for ccm python toolkit. unitesting CCMObject functionality """ + +# pylint: disable-msg=R0201 + import unittest import ccm import logging # Uncomment this line to enable logging in this module, or configure logging elsewhere logging.basicConfig(level=logging.DEBUG) -logger = logging.getLogger('test.ccm_objects') +_logger = logging.getLogger('test.ccm_objects') # #class CCMObjectTest(unittest.TestCase): # """ Module related to CCMObject (and related) function testing. """ @@ -35,7 +38,7 @@ # #vc1tltst # self.session = ccm.open_session(database = 'to1tobet') # if self.session is None: -# logger.error("Error creating connection.") +# _logger.error("Error creating connection.") # raise Exception("Couldn't open a session.") # # def tearDown(self): @@ -56,10 +59,10 @@ # project = self.session.create("mc-mc_4032_0728:project:vc1s60p1#1") # release = self.session.create("mc/next") # if not project.exists(): -# logger.error("Project doesn't exists.") +# _logger.error("Project doesn't exists.") # return # if not release.exists(): -# logger.error("Release doesn't exists.") +# _logger.error("Release doesn't exists.") # return # # coproject = project.checkout(release).project @@ -83,10 +86,12 @@ self._database = database def database(self): + """database """ return self._database def execute(self, cmdline, result=None): - logger.debug(cmdline) + """execute""" + _logger.debug(cmdline) if result == None: result = ccm.Result(self) if self._behave.has_key(cmdline): @@ -99,6 +104,7 @@ class CCMObjectTest(unittest.TestCase): """ Unit test case for CCMObject functionality """ def test_get_baseline(self): + """test get baseline""" behave = {'up -show baseline_project "foo-1.0:project:db#1" -f "%displayname" -u': """foo-1.0:project:db#1 does not have a baseline project. """, 'up -show baseline_project "foo-2.0:project:db#1" -f "%displayname" -u': """foo-1.0:project:db#1 @@ -117,16 +123,33 @@ project = session.create('project-1:project:db#1') result = project.delete() assert "Deleting object 'project-1:project:db#1'" in result.output - + + def test_delete_project_scope(self): + """ Check project deletion with custom scope """ + behave = {'delete -scope "project_and_subproject_hierarchy" -project "project-1:project:db#1"': "Deleting object 'project-1:project:db#1'"} + session = MockResultSession(behave) + project = session.create('project-1:project:db#1') + result = project.delete(scope='project_and_subproject_hierarchy') + assert "Deleting object 'project-1:project:db#1'" in result.output + + def test_delete_project_invalid_args(self): + """ Check project synergy is failing in case of bad synergy parameters for delete """ + behave = {'delete -project "project-1:project:db#1"': "Cannot use '-scope' option with '-r' option."} + session = MockResultSession(behave) + project = session.create('project-1:project:db#1') + try: + result = project.delete(recurse=True, scope='project_and_subproject_hierarchy') + assert False, "The delete method must fail in case of synergy failure" + except: + pass + def test_delete_object(self): """ Check object deletion """ behave = {'delete "object-1:object:db#1"': "Deleting object 'object-1:object:db#1'"} session = MockResultSession(behave) - o = session.create('object-1:object:db#1') - result = o.delete() + obj = session.create('object-1:object:db#1') + result = obj.delete() assert "Deleting object 'object-1:object:db#1'" in result.output if __name__ == "__main__": unittest.main() - - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccm_results.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccm_results.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccm_results.py Wed Jun 16 16:51:40 2010 +0300 @@ -25,8 +25,9 @@ import os import logging +# pylint: disable-msg=R0201 -logger = logging.getLogger('test.ccm_results') +_logger = logging.getLogger('test.ccm_results') logging.basicConfig(level=logging.INFO) class CounterHandler(logging.Handler): @@ -54,11 +55,13 @@ self._database = database def database(self): + """database""" return self._database def execute(self, cmdline, result=None): + """execute""" if result == None: - result = ccm.Result(self) + result = ccm.Result(self) if self._behave.has_key(cmdline): result.statuserrors = 0 result.output = self._behave[cmdline] @@ -97,6 +100,7 @@ def test_ObjectListResult(self): + """test object list result""" behave = { 'test_ObjectListResult': """mc-mc_0638:project:vc1s60p1#1 mc-mc_4031_0642:project:vc1s60p1#1 mc-mc_4031_0646:project:vc1s60p1#1 @@ -126,11 +130,12 @@ session = MockResultSession(behave) result = session.execute('test_ObjectListResult', ccm.ObjectListResult(session)) assert len(result.output) == 24, "output doesn't contains the right number of result project." - for o in result.output: - assert o.type == 'project' - assert o.name == 'mc' + for obj in result.output: + assert obj.type == 'project' + assert obj.name == 'mc' def test_WorkAreaInfoResult(self): + """ test work area info result""" behave = { 'test_WorkAreaInfoResult': """ Project Maintain Copies Relative Time Translate Modify Path ------------------------------------------------------------------- @@ -158,8 +163,8 @@ """} session = MockResultSession(behave) - object = session.create("Ibusal_internal-fa1f5132#wbernard16:project:jk1imeng#1") - result = session.execute('test_FinduseResult', ccm.FinduseResult(object)) + obj = session.create("Ibusal_internal-fa1f5132#wbernard16:project:jk1imeng#1") + result = session.execute('test_FinduseResult', ccm.FinduseResult(obj)) print result.output assert len(result.output) == 1 assert result.output[0]['project'].objectname == "IBUSAL_RapidoYawe-fa1f5132#wbernard16:project:jk1imeng#1" @@ -169,7 +174,7 @@ def test_read_ccmwaid_info(self): """ Testing read_ccmwaid_info, open a _ccmwaid.inf file and check the extracted data. """ data = ccm.read_ccmwaid_info(os.path.join(os.environ['TEST_DATA'], 'data', 'test_ccmwaid.inf')) - logger.debug(data) + _logger.debug(data) assert data['database'] == "jk1f5132" assert data['objectname'] == "sa1spp#1/project/S60/jk1f5132#wbernard" @@ -215,7 +220,7 @@ """} session = MockResultSession(behave) result = session.execute('test_update', ccm.UpdateResult(session)) - #logger.debug(result.output) + #_logger.debug(result.output) assert len(result.output['tasks']) == 4, "Number of tasks doesn't match." assert len(result.output['modifications']) == 4, "Number of modifications doesn't match." assert len(result.output['errors']) == 1, "Number of errors doesn't match." @@ -246,12 +251,12 @@ """} session = MockResultSession(behave) result = session.execute('test_update', ccm.UpdateResult(session)) - #logger.debug(result.output) - #logger.debug(result.output.keys()) - #logger.debug(len(result.output['tasks'])) - #logger.debug(len(result.output['modifications'])) - #logger.debug(len(result.output['errors'])) - #logger.debug(len(result.output['warnings'])) + #_logger.debug(result.output) + #_logger.debug(result.output.keys()) + #_logger.debug(len(result.output['tasks'])) + #_logger.debug(len(result.output['modifications'])) + #_logger.debug(len(result.output['errors'])) + #_logger.debug(len(result.output['warnings'])) assert (len(result.output['tasks']) == 0), "Number of tasks doesn't match." assert (len(result.output['modifications']) == 0), "Number of modifications doesn't match." @@ -259,8 +264,8 @@ assert (len(result.output['warnings']) == 5), "Number of warnings doesn't match." - def test_UpdateTemplateInformation_result(self): - """ Validating UpdateTemplateInformation.""" + def test_UpdateTemplateInformation_result(self): + """ Validating UpdateTemplateInformation.""" behave = {'test_update' : """Baseline Selection Mode: Latest Baseline Projects Prep Allowed: No Versions Matching: *abs.50* @@ -276,7 +281,7 @@ """} session = MockResultSession(behave) result = session.execute('test_update', ccm.UpdateTemplateInformation(session)) - #logger.debug(result.output) + #_logger.debug(result.output) assert result.output['baseline_selection_mode'] == "Latest Baseline Projects", "BSM doesn't match." assert result.output['prep_allowed'] == False, "Prep allowed doesn't match." assert result.output['version_matching'] == "*abs.50*", "Version matching doesn't match." @@ -284,9 +289,9 @@ assert result.output['modifiable_in_database'] == "tr1s60", "Modifiable in Database doesn't match." assert result.output['in_use_for_release'] == True, "In Use For Release doesn't match." - def test_ConflictsResult_result(self): - """ Validating ConflictsResult.""" - behave = {'test_update' : """ + def test_ConflictsResult_result(self): + """ Validating ConflictsResult.""" + behave = {'test_update' : """ Project: Cartman-Release_v4 No conflicts detected. @@ -318,15 +323,15 @@ """} session = MockResultSession(behave) result = session.execute('test_update', ccm.ConflictsResult(session)) - #logger.debug(result.output) + #_logger.debug(result.output) # pylint: disable-msg=E1103 assert len(result.output.keys()) == 7, "Should detect 7 projects." subproj = session.create("Cartman_sub_sub_sub02-Release_v4:project:%s#1" % session.database()) assert len(result.output[subproj]) == 2, "%s should contain 2 conflicts" % subproj.objectname - def test_DataMapperListResult_result(self): - """ Validating DataMapperListResult.""" + def test_DataMapperListResult_result(self): + """ Validating DataMapperListResult.""" behave = {'test_query' : """>>>objectname>>>task5204-1:task:tr1test1>>>task_synopsis>>>Create Cartman_sub03>>> >>>objectname>>>task5223-1:task:tr1test1>>>task_synopsis>>>cartman/next test1>>> >>>objectname>>>task5224-1:task:tr1test1>>>task_synopsis>>>test.txt>>> @@ -336,11 +341,11 @@ """} session = MockResultSession(behave) result = session.execute('test_query', ccm.DataMapperListResult(session, '>>>', ['objectname', 'task_synopsis'], ['ccmobject', 'string'])) - logger.debug(result.output) + _logger.debug(result.output) assert len(result.output) == 6 - def test_UpdatePropertiesRefreshResult_result(self): - """ Validating UpdatePropertiesRefreshResult.""" + def test_UpdatePropertiesRefreshResult_result(self): + """ Validating UpdatePropertiesRefreshResult.""" behave = {'test_refresh' : """Refreshing baseline and tasks for project grouping 'All cartman/next Integration Testing Projects from Database tr1test1'. Replacing tasks in folder tr1test1#2045 Removed the following tasks from folder tr1test1#2045 @@ -357,7 +362,7 @@ """} session = MockResultSession(behave) result = session.execute('test_refresh', ccm.UpdatePropertiesRefreshResult(session)) - logger.debug(result.output) + _logger.debug(result.output) assert result.output['added'] == [session.create("Task tr1test1#5223")] assert result.output['removed'] == [session.create("Task tr1test1#5225")] @@ -388,11 +393,11 @@ Serious: Update failed. """ - logger = logging.getLogger('count.logger') - logger.setLevel(logging.WARNING) + _logger = logging.getLogger('count.logger') + _logger.setLevel(logging.WARNING) handler = CounterHandler() - logger.addHandler(handler) - ccm.log_result(log, ccm.UPDATE_LOG_RULES, logger) + _logger.addHandler(handler) + ccm.log_result(log, ccm.UPDATE_LOG_RULES, _logger) print handler.warnings print handler.errors assert handler.warnings == 5 @@ -410,11 +415,11 @@ Copy Project complete with 1 errors. WARNING: There is no matching baseline project for 'ci-hitchcock_nga' in baseline 'tr1s60#ABS_domain_mcl92-abs.mcl.92_200907'. This baseline might not be complete """ - logger = logging.getLogger('count.logger') - logger.setLevel(logging.WARNING) + _logger = logging.getLogger('count.logger') + _logger.setLevel(logging.WARNING) handler = CounterHandler() - logger.addHandler(handler) - ccm.log_result(log, ccm.CHECKOUT_LOG_RULES, logger) + _logger.addHandler(handler) + ccm.log_result(log, ccm.CHECKOUT_LOG_RULES, _logger) print handler.warnings print handler.errors assert handler.warnings == 4 @@ -433,11 +438,11 @@ You can use Reconcile to resolve work area conflicts Warning: Conflicts detected during synchronization. Check your logs. """ - logger = logging.getLogger('count.logger') - logger.setLevel(logging.WARNING) + _logger = logging.getLogger('count.logger') + _logger.setLevel(logging.WARNING) handler = CounterHandler() - logger.addHandler(handler) - ccm.log_result(log, ccm.SYNC_LOG_RULES, logger) + _logger.addHandler(handler) + ccm.log_result(log, ccm.SYNC_LOG_RULES, _logger) print handler.warnings print handler.errors assert handler.warnings == 0 diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccmutil.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccmutil.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccmutil.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,7 @@ # #Description: #=============================================================================== +"""test ccm utilities""" import unittest import ccmutil @@ -27,6 +28,8 @@ logging.basicConfig(level=logging.INFO) def open_session(username=None, password=None, engine=None, dbpath=None, database=None, reuse=True): + """open session""" + reuse = True #just for pylint return MockSession(None, username, password, engine, dbpath, database) nokia.nokiaccm.open_session = open_session @@ -40,12 +43,12 @@ username = 'username' password = 'password' engine = "ccm.engine.host" - dbpath = "ccm.database.path" + dbpath = "ccm.database.path" try: session = ccmutil.get_session(database, username, password, engine, dbpath) - except Exception, ex: + except Exception: print "Error creating session" - assert session is None + assert session is None def test_get_session_without_database_set(self): """ Testing get_session method without database set""" @@ -54,12 +57,12 @@ username = 'username' password = 'password' engine = "ccm.engine.host" - dbpath = "ccm.database.path" + dbpath = "ccm.database.path" try: session = ccmutil.get_session(database, username, password, engine, dbpath) - except Exception, ex: - print "Error creating session" - assert session is None + except Exception: + print "Error creating session" + assert session is None def test_get_session(self): """ Testing get_session method """ @@ -77,19 +80,19 @@ self._session_addr = "LOCALHOST:127.0.0.1:1234" else: ccm.Session.start(username, password, engine, dbpath) - + def database(self): + """database""" _logger.info("running database from MockResultSession") return self._database def execute(self, cmdline, result=None): + """execute""" if result == None: - result = ccm.Result(self) + result = ccm.Result(self) if self._behave.has_key(cmdline): result.statuserrors = 0 result.output = self._behave[cmdline] else: result.status = -1 return result - - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_compilation.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_compilation.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_compilation.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,9 @@ # #Description: #=============================================================================== +"""test compilation """ + +# pylint: disable-msg=R0201 import unittest import compilation @@ -30,7 +33,7 @@ class CompilationTest(unittest.TestCase): """ Unit test case for compilation.py """ - def test_read_output_binaries_per_unit_with_empty_logs_list(self): + def test_read_op_bins_per_unt_empty_logs_lst(self): """ Testing read_output_binaries_per_unit method with empty log list """ sysdefpath = os.path.join(os.environ['TEST_DATA'], 'data', 'compile', 'sysdefs', 'canonical_system_definition.xml') sysDef = sysdef.api.SystemDefinition(sysdefpath) @@ -45,7 +48,7 @@ loglist = os.path.join(os.environ['TEST_DATA'], 'data', 'compile', 'logs', 'test_build.log') bsl.read_output_binaries_per_unit(loglist.split(';')) - def test_read_binary_sizes_in_rom_output_logs_with_empty_logs_list(self): + def test_read_bin_sizes_rom_op_empty_logs_lst(self): """ Testing read_binary_sizes_in_rom_output_logs method with empty log list """ sysdefpath = os.path.join(os.environ['TEST_DATA'], 'data', 'compile', 'sysdefs', 'canonical_system_definition.xml') sysDef = sysdef.api.SystemDefinition(sysdefpath) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_configuration.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_configuration.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_configuration.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,9 @@ # #Description: #=============================================================================== +""" test configuration """ + +# pylint: disable-msg=R0201 import logging import StringIO @@ -212,7 +215,7 @@ builder = configuration.NestedConfigurationBuilder(StringIO.StringIO(config_text)) configSet = builder.getConfiguration() configs = configSet.getConfigurations('test_spec_1') - (out, outputFile) = tempfile.mkstemp('.tmp', 'zip_test') + (_, outputFile) = tempfile.mkstemp('.tmp', 'zip_test') builder.writeToXML(outputFile, configs, 'test_spec_1') builder = configuration.NestedConfigurationBuilder(open(outputFile), 'r') @@ -224,7 +227,7 @@ builder = configuration.NestedConfigurationBuilder(StringIO.StringIO(config_text)) configSet = builder.getConfiguration() configs = configSet.getConfigurations('test_spec') - (out, outputFile) = tempfile.mkstemp('.tmp', 'zip_test') + (_, outputFile) = tempfile.mkstemp('.tmp', 'zip_test') builder.writeToXML(outputFile, configs ) builder = configuration.NestedConfigurationBuilder(open(outputFile), 'r') @@ -235,7 +238,6 @@ - class PropertiesConfigurationTest(unittest.TestCase): """ Test plain text configuration files. """ def test_text_config(self): @@ -250,9 +252,9 @@ config = configuration.PropertiesConfiguration(open(os.path.join(os.environ['TEST_DATA'], 'data/ant_config_test.txt'), 'r')) config['foo'] = "bar" - (fd, filename) = tempfile.mkstemp() - f = os.fdopen(fd, 'w') - config.store(f) + (f_d, filename) = tempfile.mkstemp() + f_file = os.fdopen(f_d, 'w') + config.store(f_file) config = configuration.PropertiesConfiguration(open(filename)) assert config['text.a'] == 'text.value.A' diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ctc.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ctc.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ctc.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,7 @@ # #Description: #=============================================================================== +""" test ctc""" import unittest import ctc @@ -27,7 +28,7 @@ _logger = logging.getLogger('test.configuration') logging.basicConfig(level=logging.INFO) -root_test_dir = tempfile.mkdtemp() +_root_test_dir = tempfile.mkdtemp() _test_file_paths = [ "ctc/dir/component1/group/MON.SYM", "ctc/dir/component2/group/", @@ -36,7 +37,7 @@ def _testpath(subpath): """ Normalised path for test paths. """ - return os.path.normpath(os.path.join(root_test_dir, subpath)) + return os.path.normpath(os.path.join(_root_test_dir, subpath)) _test_file_content = {} @@ -47,7 +48,7 @@ for testing various file selection and archiving operations. """ for child_path in _test_file_paths: - path = os.path.join(root_test_dir, child_path) + path = os.path.join(_root_test_dir, child_path) path_dir = path path_dir = os.path.dirname(path) @@ -65,27 +66,32 @@ def teardown_module(): """ Teardown test config. """ - if os.path.exists(root_test_dir): - fileutils.rmtree(root_test_dir) + if os.path.exists(_root_test_dir): + fileutils.rmtree(_root_test_dir) class MockUploader(ctc.MonSymFTPUploader): """ This class provides a mock MonSymFTPUploader """ def _open(self): + """open""" pass def _close(self): + """close""" pass def _ftpmkdirs(self, dir): + """ftp make dirs""" pass def _send(self, src, dst): + """send""" pass class NestedConfigurationBuilderTest(unittest.TestCase): """ Unit test for ctc uploader """ def test_uploader(self): + """test uploader""" paths = [ "ctc/dir/component1/group/MON.SYM", "ctc/dir/component2/group/MON.SYM", "ctc/dir/component3/group/MON.SYM", diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_deltazip.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_deltazip.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_deltazip.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,7 @@ # #Description: #=============================================================================== +""" test delta zip""" from __future__ import with_statement import unittest @@ -28,6 +29,7 @@ class DeltaZipTest( unittest.TestCase ): """ Unit tests for the delta zip tool. """ def setUp(self): + """setUp automatically called before running the tests""" self.cwd_backup = os.getcwd() self.logger = logging.getLogger('test.deltazip') self.root = os.environ['TEST_DATA'] @@ -37,9 +39,9 @@ logging.basicConfig(level=logging.INFO) def test_MD5SignatureBuilder(self): - + """test MD5 signature Builder""" output = os.path.join(self.output2, 'md5_list.txt') - md5output = os.path.join(self.output2, 'delta.md5') + _ = os.path.join(self.output2, 'delta.md5') if os.path.exists(output): os.remove(output) @@ -49,7 +51,9 @@ if sys.platform == 'win32': assert os.path.splitdrive(self.root)[0] + os.sep not in open(output).read() assert os.path.exists(output) + def test_DeltaZipBuilder(self): + """test delta Zip Builder""" if not os.path.exists(self.output): os.mkdir(self.output) @@ -101,18 +105,19 @@ delta.create_delta_zip(deltazipfile, deletefile, 1, deltaantfile) def test_changedFiles(self): + """test changed Files""" dir1 = tempfile.mkdtemp() dir2 = tempfile.mkdtemp() - with open(os.path.join(dir1, '1'), 'w') as f1: - f1.write('Directory:%s\n' % self.root) - f1.write('myfile1 TYPE=unknown format MD5=34dcda0d351c75e4942b55e1b2e2422g') - with open(os.path.join(dir2, '2'), 'w') as f2: - f2.write('Directory:%s\n' % self.root) - f2.write('myfile1 TYPE=unknown format MD5=34dcda0d351c75e4542b55e1b2e2422g') + with open(os.path.join(dir1, '1'), 'w') as f_1: + f_1.write('Directory:%s\n' % self.root) + f_1.write('myfile1 TYPE=unknown format MD5=34dcda0d351c75e4942b55e1b2e2422g') + with open(os.path.join(dir2, '2'), 'w') as f_2: + f_2.write('Directory:%s\n' % self.root) + f_2.write('myfile1 TYPE=unknown format MD5=34dcda0d351c75e4542b55e1b2e2422g') assert delta_zip.changedFiles(dir1, dir2) == [os.path.join(self.root, 'myfile1')] def tearDown(self): - """ Restore path """ + """ Restore path automatically called when all test have been run""" os.chdir(self.cwd_backup) \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_dependancygraph.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_dependancygraph.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_dependancygraph.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,7 @@ # #Description: #=============================================================================== +"""test dependancy graph""" import unittest import dependancygraph @@ -28,22 +29,23 @@ logging.basicConfig(level=logging.INFO) class DependancygraphTest(unittest.TestCase): - """ Acceptance tests for dependancygraph.py """ + """ Acceptance tests for dependancygraph.py """ def test_dependancygraph(self): - (fd, filename) = tempfile.mkstemp() - f = os.fdopen(fd, 'w') - f.write('test') - f.close() + """test dependancy graph""" + (f_d, filename) = tempfile.mkstemp() + f_file = os.fdopen(f_d, 'w') + f_file.write('test') + f_file.close() path1 = None path2 = None - for p in sys.path: - for x in [p, os.path.join(p, '..')]: - if os.path.exists(x) and os.path.isdir(x): - for egg in os.listdir(x): + for p_path in sys.path: + for xxx in [p_path, os.path.join(p_path, '..')]: + if os.path.exists(xxx) and os.path.isdir(xxx): + for egg in os.listdir(xxx): if egg.endswith('.egg'): if path1 == None: - path1 = x - if path1 and path1 != x: - path2 = x + path1 = xxx + if path1 and path1 != xxx: + path2 = xxx if path1 and path2: dependancygraph.createGraph(os.path.join(os.environ['TEST_DATA'], 'data', 'ivy.xml'), filename, path1, path2, False) \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_docs.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_docs.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_docs.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,9 @@ # #Description: #=============================================================================== +"""test docs """ + +# pylint: disable-msg=R0201 import unittest import docs diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_escapeddict.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_escapeddict.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_escapeddict.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,9 @@ # #Description: #=============================================================================== +"""test escaped dict """ + +# pylint: disable-msg=R0201 import logging import unittest @@ -23,19 +26,21 @@ import escapeddict -logger = logging.getLogger('test.escapeddict') +_logger = logging.getLogger('test.escapeddict') class EscapedDictTest(unittest.TestCase): """ Acceptance tests for escapeddict.py """ def test_escape(self): + """test escape""" testdict = escapeddict.EscapedDict({'key1': 'value1', 'key2': 'value2 ${key1}'}) for key in testdict.keys(): - logger.info(testdict[key]) + _logger.info(testdict[key]) assert testdict['key1'] == 'value1' assert testdict['key2'] == 'value2 value1' def test_escape_no_value_present(self): + """test escape no value present""" testdict = escapeddict.EscapedDict({'key1': 'value1', 'key2': 'value2 ${key_not_present} ${key1}'}) for key in testdict.keys(): print testdict[key] @@ -43,6 +48,7 @@ assert testdict['key2'] == 'value2 ${key_not_present} value1' def test_escape_value_as_list(self): + """test escape value as list""" testdict = escapeddict.EscapedDict({'key1': 'value1', 'key2': ['value2', '${key1}']}) for key in testdict.keys(): print testdict[key] diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_freedisk.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_freedisk.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_freedisk.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,9 @@ # #Description: #=============================================================================== +""" test free disk """ + +# pylint: disable-msg=R0201 import unittest import logging @@ -31,7 +34,7 @@ if sys.platform == "win32": from win32api import GetLogicalDriveStrings - logger = logging.getLogger('test_freedisk') + _logger = logging.getLogger('test_freedisk') ## MAKE SURE that the drive being tested MUST be there. class ToolTest(unittest.TestCase): diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_gscm.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_gscm.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_gscm.py Wed Jun 16 16:51:40 2010 +0300 @@ -21,6 +21,8 @@ """ +# pylint: disable-msg=R0201 + import logging import unittest import os @@ -35,6 +37,7 @@ """ Test cases for gscm python wrapper. """ def setUp(self): + """setUp automatically called before running the tests""" if os.environ.has_key('CCM_DATABASE'): self.ccmdatabase = os.environ['CCM_DATABASE'] else: diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ido.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ido.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ido.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,7 @@ # #Description: #=============================================================================== +""" test IDO""" import unittest import ido @@ -51,9 +52,9 @@ def test_ido_sysdef_invalid(self): """ Verifying get_sysdef_location method with invalid sysdef""" - (fd, filename) = mkstemp() - os.write(fd,'Test sysdef file') - os.close(fd) + (f_d, filename) = mkstemp() + os.write(f_d,'Test sysdef file') + os.close(f_d) location = ido.get_sysdef_location(filename); os.unlink(filename) assert location == None diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_integration_ant.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_integration_ant.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_integration_ant.py Wed Jun 16 16:51:40 2010 +0300 @@ -18,6 +18,8 @@ #=============================================================================== """ Testing integration.ant module """ +# pylint: disable-msg=R0201 + import tempfile import os import logging @@ -53,19 +55,19 @@ """Emulate attributes""" def __init__(self, outputFilename): self.outputFilename = outputFilename - def get(self, attribute): + def get(self, _): """Emulate get method""" return self.outputFilename class _emulateElements(): """Emulate elements""" - def get(self, fileset): + def get(self, _): """Emulate get method""" return _emulateFileset() class _emulateFileset(): """Emulate fileset""" - def get(self, eid): + def get(self, _): """Emulate get method""" return _emulateDirScanner() def size(self): @@ -83,7 +85,7 @@ return ['test_build_compile.log'] elif os.sep == '/': return ['test_build_compile_linux.log'] - def getDirectoryScanner(self, project): + def getDirectoryScanner(self, _): """Emulate getDirectoryScanner method """ return self def getBasedir(self): diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_log2xml.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_log2xml.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_log2xml.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,9 @@ # #Description: #=============================================================================== +""" test log to XML """ + +# pylint: disable-msg=R0201 import unittest import logging @@ -24,7 +27,7 @@ from xml.dom import minidom import tempfile -logger = logging.getLogger('test.log2xml') +_logger = logging.getLogger('test.log2xml') class Log2XMLTest(unittest.TestCase): diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_misc.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_misc.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_misc.py Wed Jun 16 16:51:40 2010 +0300 @@ -47,7 +47,10 @@ import optparse +# pylint: disable-msg=W0613 + def testCallback(option, opt, value, parser): + """test Call back""" pass parser = optparse.OptionParser() diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_path_match.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_path_match.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_path_match.py Wed Jun 16 16:51:40 2010 +0300 @@ -23,7 +23,7 @@ def test_path_match_ant_match(): - # Matching stuff + """ Matching stuff""" assert pathaddition.match.ant_match(r"CVS/Repository", r"**/CVS/*") == True assert pathaddition.match.ant_match(r"org/apache/CVS/Entries", r"**/CVS/*") == True assert pathaddition.match.ant_match(r"org/apache/jakarta/tools/ant/CVS/Entries", r"**/CVS/*") == True diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_pathaddition_relative.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_pathaddition_relative.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_pathaddition_relative.py Wed Jun 16 16:51:40 2010 +0300 @@ -24,6 +24,7 @@ def test_commonprefix(): + """ tst common prefix""" paths = ['E:/Build_E/ido_wa/ido_lcdo_mcl_product_52_ec/LC_Domain/LC_Domain/localconnectivity', 'E:/Build_E/ido_wa/ido_lcdo_mcl_product_52_ec/LC_Domain_osext/LC_Domain_osext/localconnectivityextensions', 'E:/Build_E/ido_wa/ido_lcdo_mcl_product_52_ec/LC_Domain_osext/LC_Domain_osext/localconnectivityextensions/src', diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_policy_validator.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_policy_validator.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_policy_validator.py Wed Jun 16 16:51:40 2010 +0300 @@ -53,6 +53,9 @@ 's60/new_rules/', 's60/new_rules/subdir1/invalid.txt', 's60/new_rules/subdir2/', + 's60/new_rules_excludes/.static_wa', + 's60/new_rules_excludes/subdir1/invalid.txt', + 's60/new_rules_excludes/subdir2/', ] _test_file_content = { @@ -114,12 +117,12 @@ def test_policy_validator(self): """ Testing the policy validator behaviour. """ - validator = integration.quality.PolicyValidator() + validator = integration.quality.PolicyValidator(excludes=".static_wa") errors = [] errors.extend(validator.validate(self._testpath('s60'))) errors.sort() print errors - assert len(errors) == 5 + assert len(errors) == 6 # Invalid encoding: contains other stuff than policy id. @@ -146,4 +149,9 @@ assert errors[4][0] == "missing" assert errors[4][1].lower() == self._testpath('s60' + os.sep + 'new_rules' + os.sep + 'subdir1').lower() assert errors[4][2] == None + + # Policy file is missing + assert errors[5][0] == "missing" + assert errors[5][1].lower() == self._testpath('s60' + os.sep + 'new_rules_excludes' + os.sep + 'subdir1').lower() + assert errors[5][2] == None diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_preparation.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_preparation.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_preparation.py Wed Jun 16 16:51:40 2010 +0300 @@ -18,6 +18,8 @@ #=============================================================================== """ Testing preparation module """ +# pylint: disable-msg=R0201 + import tempfile from shutil import rmtree import os @@ -49,7 +51,7 @@ def _fastSnapshot(project, target_dir, threads): """ Emulate ccm.extra.FastSnapshot method for unit testing """ - "Snapshot Created" + #Snapshot Created def _updateResultSimple(session): """ Emulate ccm.UpdateResultSimple method for unit testing """ @@ -94,7 +96,7 @@ ccm.extra.FastSnapshot = _fastSnapshot ccm.UpdateResultSimple = _updateResultSimple ccm.extra.FastMaintainWorkArea = _fastMaintainWorkArea - """Setup a temporary project directory for unit testing""" + #Setup a temporary project directory for unit testing self.dirname = os.path.join(tempfile.gettempdir(), 'pyUnitTestHeliumProject') self.filename = os.path.join(self.dirname, 'project.version') if os.path.exists(self.dirname): diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_session_provider.py --- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_session_provider.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_session_provider.py Wed Jun 16 16:51:40 2010 +0300 @@ -17,9 +17,10 @@ #Description: #=============================================================================== -""" Test cases for ccm python toolkit. +""" Test cases for ccm python toolkit.""" -""" +# pylint: disable-msg=R0201 + import unittest import ccm import ccm.extra @@ -81,7 +82,7 @@ """ Test the opening of an invalid database. """ prov = ccm.extra.SessionProvider(opener=MockOpener()) try: - dbase = prov.get(database="invaliddb") + _ = prov.get(database="invaliddb") assert False, "Should raise Exception when giving unexisting dbase.'" except Exception, exc: _logger.info(exc) @@ -114,7 +115,7 @@ """ Test the opening of an invalid database (cached). """ prov = ccm.extra.CachedSessionProvider(opener=MockOpener()) try: - dbase = prov.get(database="invaliddb") + _ = prov.get(database="invaliddb") assert False, "Should raise Exception when giving unexisting dbase.'" except Exception, exc: _logger.info(exc) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/rtfutils.py --- a/buildframework/helium/sf/python/pythoncore/lib/rtfutils.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/rtfutils.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,9 @@ # #Description: #=============================================================================== +""" rtf utilis""" + +# pylint: disable-msg=R0201 import csv import os @@ -47,11 +50,12 @@ template.close() def _rtftable(self, errors, output, tagtoreplace, template): - PyRTF.Elements.StandardColours.append(PyRTF.PropertySets.Colour('NokiaBlue', 153, 204, 255)) + """rtf table""" + PyRTF.Elements.StandardColours.append(PyRTF.PropertySets.Colour('NokiaBlue', 153, 204, 255)) - DR = PyRTF.Renderer() + d_r = PyRTF.Renderer() doc = PyRTF.Document() - ss = doc.StyleSheet + s_s = doc.StyleSheet section = PyRTF.Section() doc.Sections.append( section ) @@ -66,21 +70,21 @@ assert len(row) == 3 if style == None: - style = ss.ParagraphStyles.Heading2 + style = s_s.ParagraphStyles.Heading2 else: - style = ss.ParagraphStyles.Normal + style = s_s.ParagraphStyles.Normal # Handle each value from the row rowcell = [] - for value in row: + for value in row: cell = PyRTF.Text( value ) rowcell.append(PyRTF.Cell( PyRTF.Paragraph(style, cell) )) table.AddRow( *rowcell ) section.append( table ) string = StringIO.StringIO() - DR.Write( doc, string ) + d_r.Write( doc, string ) keep = '' for line in string.getvalue().splitlines(): @@ -106,20 +110,21 @@ template.close() def _rtfimage(self, image, output, tagtoreplace, template): - TEMP_FILE = 'image_temp.rtf' + """rtf image""" + temp_file = 'image_temp.rtf' - DR = PyRTF.Renderer() + d_r = PyRTF.Renderer() doc = PyRTF.Document() - ss = doc.StyleSheet + _ = doc.StyleSheet section = PyRTF.Section() doc.Sections.append( section ) - section.append( PyRTF.Image( image ) ) + section.append( PyRTF.Image( image ) ) - tempOutput = file( TEMP_FILE, 'w' ) - DR.Write( doc, tempOutput ) + tempOutput = file( temp_file, 'w' ) + d_r.Write( doc, tempOutput ) - tempOutput = file( TEMP_FILE, 'rb' ) + tempOutput = file( temp_file, 'rb' ) keep = '' for line in tempOutput: @@ -137,7 +142,7 @@ line = line.replace(tagtoreplace, keep) output.write(line) - os.remove(TEMP_FILE) + os.remove(temp_file) def rtfconvert(self, inputfilename, outputfilename): """ Converts a property file to be RTF link syntax """ @@ -150,7 +155,8 @@ outputfile.close() def _rtfconvert(self, inputfile, outputfile): - p = re.compile(r'(.+=)((\\\\|http|\.\\|ftp)(.+))') + """rtf convert""" + ppp = re.compile(r'(.+=)((\\\\|http|\.\\|ftp)(.+))') for line in inputfile: newline = line @@ -165,7 +171,7 @@ newline = newline.replace('\\','\\\\\\\\\\\\\\\\') - newline = p.sub('\g<1>{_backslash_field{_backslash_*_backslash_fldinst HYPERLINK \g<2>}}', newline) + newline = ppp.sub('\g<1>{_backslash_field{_backslash_*_backslash_fldinst HYPERLINK \g<2>}}', newline) newline = newline.replace('_backslash_', r'\\') diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/sis.py --- a/buildframework/helium/sf/python/pythoncore/lib/sis.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/sis.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,7 @@ # #Description: #=============================================================================== +""" SIS """ import os import buildtools @@ -78,7 +79,7 @@ raise Exception("Invalid property %s if using new 'input' SIS configuration" % property_) input_ = config['input'] - (input_path, input_name) = os.path.split(input_) + (input_path, _) = os.path.split(input_) (input_root, input_ext) = os.path.splitext(input_) valid_extensions = ['.pkg', '.sis', '.sisx'] if input_ext not in valid_extensions: @@ -105,7 +106,3 @@ # Copy content to SIS files directory copyCommand = buildtools.Copy(output, config['build.sisfiles.dir']) commandList.addCommand(copyCommand, newstage=True) - - - - diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/symbian/__init__.py --- a/buildframework/helium/sf/python/pythoncore/lib/symbian/__init__.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/symbian/__init__.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,4 +16,4 @@ # #Description: #=============================================================================== - +""" python core library symbian initialisation file""" diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/symbian/log.py --- a/buildframework/helium/sf/python/pythoncore/lib/symbian/log.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/symbian/log.py Wed Jun 16 16:51:40 2010 +0300 @@ -62,14 +62,14 @@ self.__file = fileobject def parse(self): - """ Function that run the parsing of the log. + """ Function that run the parsing of the log. """ #=== Stage=1 started Fri Apr 18 21:09:55 2008 match_stage = re.compile(r"===\s+(?:Stage=)?(.+)\s+(started|finished)\s+(.+)") # === Stage=1 == ncp_psw match_component_start = re.compile(r"===\s+(?:Stage=)?(.+?)\s+==\s+(.+)") - match_component_finished = re.compile(r"\+\+\s+Finished\s+at") + match_component_finished = re.compile(r"\+\+\s+Finished\s+at") # === Stage=1 == ncp_psw match_component_cmdline = re.compile(r"--\s+(.+)") match_component_chdir = re.compile(r"Chdir\s+(.+)|cd\s+(.*?)\s+.*") @@ -83,51 +83,51 @@ line = line.strip() _logger.debug(line) if component_name == None: - _logger.debug("Searching stage") - m = match_stage.match(line) - _logger.debug(m) - if m != None: - _logger.debug("Found stage %s, %s" % (m.group(2), m.group(3))) - if m.group(2) == "started": - self.start_stage(m.group(1), m.group(3)) + _logger.debug("Searching stage") + m_match = match_stage.match(line) + _logger.debug(m_match) + if m_match != None: + _logger.debug("Found stage %s, %s" % (m_match.group(2), m_match.group(3))) + if m_match.group(2) == "started": + self.start_stage(m_match.group(1), m_match.group(3)) else: component_name = None cmdline = None chdir = None content = StringIO.StringIO() - self.end_stage(m.group(1), m.group(3)) + self.end_stage(m_match.group(1), m_match.group(3)) else: _logger.debug("Searching for component") - m = match_component_start.match(line) - if m != None: - _logger.debug("Found component: %s" % m.group(2)) - component_name = m.group(2) + m_match = match_component_start.match(line) + if m_match != None: + _logger.debug("Found component: %s" % m_match.group(2)) + component_name = m_match.group(2) else: _logger.debug("Searching for component end") - m = match_component_finished.match(line) - if m != None: + m_match = match_component_finished.match(line) + if m_match != None: self.task(component_name, cmdline, chdir, content.getvalue()) - component_name = None + component_name = None cmdline = None chdir = None - content = StringIO.StringIO() + content = StringIO.StringIO() if cmdline == None: _logger.debug("Searching for component command line") - m = match_component_cmdline.match(line) - if m != None: - _logger.debug("Found command line: %s" % m.group(1)) - cmdline = m.group(1) + m_match = match_component_cmdline.match(line) + if m_match != None: + _logger.debug("Found command line: %s" % m_match.group(1)) + cmdline = m_match.group(1) else: _logger.debug("Searching for component dir") if chdir == None: - m = match_component_chdir.match(line) - if m != None: - chdir = m.group(1) + m_match = match_component_chdir.match(line) + if m_match != None: + chdir = m_match.group(1) if chdir == None: - chdir = m.group(2) + chdir = m_match.group(2) _logger.debug("Found dir: %s" % chdir) continue - if not line.startswith("++ ") and not line.startswith("+++ "): + if not line.startswith("++ ") and not line.startswith("+++ "): _logger.debug("Adding content") content.write(line + "\n") diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/symbian/raptor.py --- a/buildframework/helium/sf/python/pythoncore/lib/symbian/raptor.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/symbian/raptor.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,7 +16,7 @@ # #Description: #=============================================================================== - +""" raptor """ import os import fileutils diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/symrec.py --- a/buildframework/helium/sf/python/pythoncore/lib/symrec.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/symrec.py Wed Jun 16 16:51:40 2010 +0300 @@ -30,6 +30,7 @@ logging.basicConfig(level=logging.INFO) def _cleanup_list(input): + """cleanup list""" result = [] for chars in input: if chars is not None and chars.strip() != "": @@ -92,10 +93,12 @@ @property def name(self): + """name""" return self.__xml.getAttribute('name') @property def files(self): + """files""" result = [] for filen in self.__xml.getElementsByTagName('file'): result.append(filen.getAttribute('name')) @@ -103,6 +106,7 @@ @property def instructions(self): + """instructions""" result = [] for instr in self.__xml.getElementsByTagName('instructions'): result.append(instr.getAttribute('name')) @@ -147,7 +151,7 @@ self._releaseDetails.appendChild(releaseID) # service - serv = self._xml.createElement(u'service') + serv = self._xml.createElement(u'service') xml_setattr(serv, 'name', unicode(service)) releaseID.appendChild(serv) # product @@ -223,6 +227,7 @@ def keys(self): + """keys""" keys = [] for pkg in self._releaseFiles.getElementsByTagName('package'): keys.append(pkg.getAttribute('name')) @@ -276,10 +281,11 @@ return None def getVariantPackage(self, variant_name): + """get variant package""" for variant in self._xml.getElementsByTagName('variant'): if variant.getAttribute('name').lower() == variant_name.lower(): - for x in variant.getElementsByTagName('file'): - return x.getAttribute('name') + for xxx in variant.getElementsByTagName('file'): + return xxx.getAttribute('name') def xml(self): """ Returning the XML as a string. """ @@ -297,8 +303,8 @@ def servicepacks(self): """ Getting the service pack names. """ result = [] - for sp in self._releaseInformation.getElementsByTagName('servicePack'): - result.append(ServicePack(sp)) + for spack in self._releaseInformation.getElementsByTagName('servicePack'): + result.append(ServicePack(spack)) return result filename = property(lambda self:self._filename) @@ -324,6 +330,7 @@ for name in self.keys(): fullname = os.path.join(self._filepath, name) if os.path.exists(fullname): + LOGGER.info("Calculating the MD5 of " + fullname) result = self[name] result['md5checksum'] = unicode(fileutils.getmd5(fullname)) result['size'] = unicode(os.path.getsize(fullname)) @@ -343,9 +350,9 @@ status = os.path.join(os.path.dirname(self._filename), 'HYDRASTATUS.xml') if os.path.exists(status): hydraxml = xml.dom.minidom.parse(open(status, "r")) - for t in hydraxml.getElementsByTagName('state')[0].childNodes: - if t.nodeType == t.TEXT_NODE: - if t.nodeValue != 'Ready': + for t_name in hydraxml.getElementsByTagName('state')[0].childNodes: + if t_name.nodeType == t_name.TEXT_NODE: + if t_name.nodeValue != 'Ready': LOGGER.error("HYDRASTATUS.xml is not ready") return False if checkPath: @@ -378,13 +385,13 @@ LOGGER.error("%s md5checksum missmatch." % path) return False - for sp in self.servicepacks: - for name in sp.files: + for spack in self.servicepacks: + for name in spack.files: path = os.path.join(self.location, name) if not os.path.exists(path): LOGGER.error("%s doesn't exist." % path) return False - for name in sp.instructions: + for name in spack.instructions: path = os.path.join(self.location, name) if not os.path.exists(path): LOGGER.error("%s doesn't exist." % path) @@ -431,6 +438,7 @@ self.excludes = excludes def archives_to_tdd(self, metadata): + """archives""" tdd = "\t[\n" for name in metadata.keys(): path_ = os.path.join(os.path.dirname(metadata.filename), name) @@ -495,36 +503,40 @@ return result def in_cache(self, metadatas, key): + """in cache""" for metadata in metadatas: if metadata[0] == key: return True return False def value_from_cache(self, metadatas, key): + """value from cache""" for metadata in metadatas: if metadata[0] == key: return metadata[1] return None def load_cache(self): + """load cache""" metadatas = [] if self.__cachefile is not None and os.path.exists(self.__cachefile): - f = open(self.__cachefile, "rb") - for row in csv.reader(f): + f_file = open(self.__cachefile, "rb") + for row in csv.reader(f_file): if len(row) == 2: metadatas.append([os.path.normpath(row[0]), row[1].lower() == "true"]) elif len(row) == 1: # backward compatibility with old cache. metadatas.append([os.path.normpath(row[0]), True]) - f.close() + f_file.close() return metadatas def update_cache(self, metadatas): + """update cache""" if self.__cachefile is not None and os.path.exists(os.path.dirname(self.__cachefile)): - f = open(self.__cachefile, "wb") - writer = csv.writer(f) + f_file = open(self.__cachefile, "wb") + writer = csv.writer(f_file) writer.writerows(metadatas) - f.close() + f_file.close() class ValidateTicklerReleaseMetadata(ValidateReleaseMetadataCached): """ This class validate if a metadata file is stored in the correct location and diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/sysdef/__init__.py --- a/buildframework/helium/sf/python/pythoncore/lib/sysdef/__init__.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/sysdef/__init__.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,4 +16,4 @@ # #Description: #=============================================================================== - +""" python core library sysdef initialisation""" diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/sysdef/api.py --- a/buildframework/helium/sf/python/pythoncore/lib/sysdef/api.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/sysdef/api.py Wed Jun 16 16:51:40 2010 +0300 @@ -554,7 +554,7 @@ #TODO - handle duplicate names of different types if not self._cache.has_key(element.get_id()): self._cache[element.get_id()] = element - _logger.info('Adding SysDef element to cache: %s' % str(element)) + #_logger.info('Adding SysDef element to cache: %s' % str(element)) else: _logger.warning("Element already exists: %s" % element.name) diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/timeout_launcher.py --- a/buildframework/helium/sf/python/pythoncore/lib/timeout_launcher.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/timeout_launcher.py Wed Jun 16 16:51:40 2010 +0300 @@ -30,14 +30,15 @@ # Platform -windows = False +_windows = False if sys.platform == "win32": import win32process import win32con import win32api - windows = True + _windows = True def main(): + """main method """ cmdarg = False cmdline = [] timeout = None @@ -64,36 +65,36 @@ finish = time.time() + timeout timedout = False shell = True - if windows: + if _windows: shell = False - p = subprocess.Popen(' '.join(cmdline), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=shell) - while (p.poll() == None): + p_file = subprocess.Popen(' '.join(cmdline), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=shell) + while (p_file.poll() == None): if time.time() > finish: timedout = True break time.sleep(1) if timedout: print "ERROR: Application has timed out (timeout=%s)." % timeout - if windows: + if _windows: try: print "ERROR: Trying to kill the process..." - handle = win32api.OpenProcess(True, win32con.PROCESS_TERMINATE, p.pid) + handle = win32api.OpenProcess(True, win32con.PROCESS_TERMINATE, p_file.pid) win32process.TerminateProcess(handle, -1) print "ERROR: Process killed..." except Exception, exc: print "ERROR: %s" % exc else: # pylint: disable-msg=E1101 - os.kill(p.pid, 9) + os.kill(p_file.pid, 9) print "ERROR: exiting..." raise Exception("Timeout exception.") else: - print p.communicate()[0] - sys.exit(p.returncode) + print p_file.communicate()[0] + sys.exit(p_file.returncode) else: - p = subprocess.Popen(' '.join(cmdline), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) - print p.communicate()[0] - sys.exit(p.returncode) + p_file = subprocess.Popen(' '.join(cmdline), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) + print p_file.communicate()[0] + sys.exit(p_file.returncode) if __name__ == '__main__': main() \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/unittestadditions.py --- a/buildframework/helium/sf/python/pythoncore/lib/unittestadditions.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/unittestadditions.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,9 +16,13 @@ # #Description: #=============================================================================== +""" unit test additions""" + import logging -logger = logging.getLogger('unittestadditions') +_logger = logging.getLogger('unittestadditions') + +# pylint: disable-msg=C0103 class skip(object): """ Skip decorator. The decorated function will only be called @@ -35,11 +39,13 @@ self.shouldSkip = shouldSkip self.returns = returns - def __call__(self, f): - """ Returns the function f if shouldSkip is False. Else a stub function is returned. """ + def __call__(self, f_file): + """ Returns the function f_file if shouldSkip is False. Else a stub function is returned. """ def __skiptest(*args, **kargs): - logger.warning("Skipping test %s" % f.__name__) + """skip test""" + _logger.warning("Skipping test %s" % f_file.__name__) return self.returns if self.shouldSkip: return __skiptest - return f + return f_file +# pylint: enable-msg=C0103 diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/sf/python/pythoncore/lib/xmlhelper.py --- a/buildframework/helium/sf/python/pythoncore/lib/xmlhelper.py Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/sf/python/pythoncore/lib/xmlhelper.py Wed Jun 16 16:51:40 2010 +0300 @@ -16,6 +16,7 @@ # #Description: #=============================================================================== +""" XML helper""" import re from xml.dom import Node @@ -37,6 +38,6 @@ name is a regular expression. """ results = node_scan(node, name) - for subnode in node.childNodes: + for subnode in node.childNodes: results.extend(recursive_node_scan(subnode, name)) return results diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tests/data/diamonds-faults_compile.text.log --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/tests/data/diamonds-faults_compile.text.log Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,1 @@ +ERROR: This error must not affect the test. diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tests/minibuilds/ats/build.xml --- a/buildframework/helium/tests/minibuilds/ats/build.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tests/minibuilds/ats/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -38,27 +38,21 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - + + @@ -68,10 +62,10 @@ - - - - + + + + @@ -121,15 +115,14 @@ - + - - - - - + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tests/minibuilds/ido-sbs-coverity/build.xml --- a/buildframework/helium/tests/minibuilds/ido-sbs-coverity/build.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tests/minibuilds/ido-sbs-coverity/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -26,6 +26,11 @@ + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tests/minibuilds/ido-sbs/build.xml --- a/buildframework/helium/tests/minibuilds/ido-sbs/build.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tests/minibuilds/ido-sbs/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -65,6 +65,12 @@ + + + + + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tests/minibuilds/ido/build.xml --- a/buildframework/helium/tests/minibuilds/ido/build.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tests/minibuilds/ido/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -21,194 +21,200 @@ ============================================================================ --> - - - + + + - - - + + + - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - + + + + + + - - - + + + - - - - + + + + - - + + - - + + - - + + - - + + - - - - - - + + + + + + - - + + - - + mini-build-cleanup, + ido-build, + check-diamonds, + mini-build-check, + run-hack" /> - - + + - - - - - - - + + + + + + + doc: xml(${helium.build.dir}/temp/test.minibuild-ido.xml) database: xml(${database.file}) - - - + + + The summary of Ant code coverage: ${ant.coverage.summary} - - - doc: xml(${helium.build.dir}/temp/test.minibuild-ido.xml) + + + doc: xml(${helium.build.dir}/temp/test.minibuild-ido.xml) database: xml(${database.file}) - - - + + + - - - + + + - - - - + + + + - - - - + + + + - - - - + + + + - + - - - - - + + + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - '${arm.compiler.version}' - + + + + '${arm.compiler.version}' + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tests/minibuilds/ido/config/delivery.xml --- a/buildframework/helium/tests/minibuilds/ido/config/delivery.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tests/minibuilds/ido/config/delivery.xml Wed Jun 16 16:51:40 2010 +0300 @@ -29,14 +29,17 @@ - + - + - + + + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tests/minibuilds/ido/sysdefs/minibuild_ido.sysdef.xml --- a/buildframework/helium/tests/minibuilds/ido/sysdefs/minibuild_ido.sysdef.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tests/minibuilds/ido/sysdefs/minibuild_ido.sysdef.xml Wed Jun 16 16:51:40 2010 +0300 @@ -20,7 +20,7 @@ ============================================================================ --> - + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tests/minibuilds/ido/sysdefs/sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/tests/minibuilds/ido/sysdefs/sysdef_1_4_0.dtd Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tests/minibuilds/prep-wa-synergy71/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/tests/minibuilds/prep-wa-synergy71/build.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + doc: xml(${helium.build.dir}/temp/test.minibuild-ido.xml) + database: xml(${database.file}) + + + + +The summary of Ant code coverage: + +${ant.coverage.summary} + + + doc: xml(${helium.build.dir}/temp/test.minibuild-ido.xml) + database: xml(${database.file}) + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tests/minibuilds/prep-wa-synergy71/hlm.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/tests/minibuilds/prep-wa-synergy71/hlm.bat Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,20 @@ +@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 + +..\..\..\hlm.bat %* + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/common/common.ant.xml --- a/buildframework/helium/tools/common/common.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tools/common/common.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -350,37 +350,42 @@ + - + + - - ([a-z0-9[\\d\\_\\.\\@\\{\\}\\$]]*) - ([a-z0-9[\\d\\-]]*) - - ([a-z0-9][a-zA-Z0-9]*) - ([a-z0-9[\\d\\.\\_\\-]]*) - - ^build.xml$|ant.xml$|antlib.xml$ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/common/common.antlib.xml --- a/buildframework/helium/tools/common/common.antlib.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tools/common/common.antlib.xml Wed Jun 16 16:51:40 2010 +0300 @@ -50,15 +50,13 @@ - @@ -79,18 +77,16 @@ - @@ -179,6 +175,7 @@ ]]> + @@ -196,6 +193,7 @@ ]]> + @@ -205,13 +203,13 @@ log2xml.symbian_log_header(self, attributes.get('config'), attributes.get('command'), attributes.get('dir')) + import log2xml log2xml.symbian_log_footer(self) - @@ -268,6 +266,7 @@ + @@ -293,7 +292,6 @@ - @@ -363,6 +361,7 @@ output.close() ]]> + @@ -389,6 +388,7 @@ ]]> + @@ -415,6 +415,7 @@ ]]> + @@ -462,8 +463,9 @@ self.log("Result: %s" % attributes.get('resultproperty')) project.setProperty(str(attributes.get('resultproperty')), str(result)) ]]> - + + @@ -519,6 +521,7 @@ + @@ -571,6 +574,7 @@ ]]> + @@ -587,18 +591,23 @@ else: failonerror = False if drive == None or len(str(drive)) != 2: - raise Exception("'drive' attribute is missing or invalid. " + str(drive)) - drive = str(drive) - try: - self.log(str("Unsubsting %s..." % drive)) - fileutils.unsubst(drive) - except Exception, e: if failonerror: - raise e + raise Exception("'drive' attribute is missing or invalid: " + str(drive)) else: - self.log(str("Error: %s" % e)) + self.log("Drive doesn't need unsubsting: " + str(drive)) + else: + drive = str(drive) + try: + self.log(str("Unsubsting %s..." % drive)) + fileutils.unsubst(drive) + except Exception, e: + if failonerror: + raise e + else: + self.log(str("Error: %s" % e)) + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/common/docs.ant.xml --- a/buildframework/helium/tools/common/docs.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tools/common/docs.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -38,6 +38,12 @@ --> + + + @@ -81,7 +87,7 @@ - doc: xml(${database.file}) @@ -122,13 +128,27 @@ + + + + + + ant: antProperties() + doc: xml(${database.file}) + + + + + + helium-api-dependency-images,helium-api-rst-docs"/> - + @@ -140,7 +160,7 @@ Copying textdocs source directory: @{dir} - @@ -321,6 +341,8 @@ + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/common/dtd/sysdef_2_0_1.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/tools/common/dtd/sysdef_2_0_1.dtd Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/common/dtd/sysdef_dtd_2_0_1.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/buildframework/helium/tools/common/dtd/sysdef_dtd_2_0_1.xml Wed Jun 16 16:51:40 2010 +0300 @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]> + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/common/helium_docs.ant.xml --- a/buildframework/helium/tools/common/helium_docs.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tools/common/helium_docs.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -229,8 +229,16 @@ + + - + + + + + + + + +<#include "diamonds_header.ftl"> + +<#assign db = pp.loadData('com.nokia.helium.metadata.ORMFMPPLoader', "${dbPath}") > + + + + <#list db['native:java.lang.String']['select DISTINCT component.component from component where component.component like \'%.fpsx\''] as component> + + + <#assign status = "ok"> + <#list db['jpa']['select m from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p JOIN m.component as c where UPPER(p.priority)=\'ERROR\' and c.component=\'${component}\''] as m> + <#assign match = m.text?matches(".*?fpsx' - DOESN'T EXIST")> + <#if match> + <#assign status = "failed"> + + + ${status} + + ${component} + N/A + <#assign type = component?matches("([^.]+)\\.fpsx")[0]> + ${type?groups[1]} + + <#list db['jpa']['select m from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p JOIN m.component as c where UPPER(p.priority)=\'ERROR\' and c.component=\'${component}\''] as m> + ${m.text} + + + + <#list db['jpa']['select m from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p JOIN m.component as c where UPPER(p.priority)=\'WARNING\' and c.component=\'${component}\''] as m> + ${m.text} + + + + + + +<#include "diamonds_footer.ftl"> + + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/common/templates/diamonds/faults_metadata_orm.ftl --- a/buildframework/helium/tools/common/templates/diamonds/faults_metadata_orm.ftl Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tools/common/templates/diamonds/faults_metadata_orm.ftl Wed Jun 16 16:51:40 2010 +0300 @@ -1,6 +1,6 @@ <#-- ============================================================================ -Name : macro.ftl +Name : faults_metadata_orm.ftl Part of : Helium Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). @@ -25,27 +25,32 @@ <#assign table_info = pp.loadData('com.nokia.helium.metadata.ORMFMPPLoader', "${dbPath}") > + + + ${table_info['jpasingle']['select Count(w.id) from WhatLogEntry w JOIN w.component as c JOIN c.logFile as l where LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\''][0]} + + - ${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\' and p.priority like \'%ERROR%\''][0] - + table_info['jpasingle']['select Count(w.id) from WhatLogEntry w JOIN w.component as c JOIN c.logFile as l where LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\' and w.missing = \'true\''][0]} - ${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\' and p.priority like \'%WARNING%\''][0]} - ${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\' and p.priority like \'%WARNING%\''][0]} + ${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\' and p.priority = \'ERROR\''][0] + + table_info['jpasingle']['select Count(w.id) from WhatLogEntry w JOIN w.component as c JOIN c.logFile as l where LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\' and w.missing = \'true\''][0]} + ${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\' and p.priority = \'WARNING\''][0]} + ${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\' and UPPER(p.priority) = \'WARNING\''][0]} - ${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\' and p.priority like \'%REMARK%\''][0]} - <#list table_info['native:java.lang.String']['select DISTINCT component.component from component INNER JOIN logfile ON logfile.logpath_id=component.logpath_id where logfile.path like \'%_compile%.log\' and logfile.path not like \'%_compile_clean%.log\''] as component> + ${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\' and UPPER(p.priority) = \'REMARK\''][0]} + <#list table_info['native:java.lang.String']['select DISTINCT component.component from component INNER JOIN logfile ON logfile.logpath_id=component.logpath_id where logfile.path like \'%_compile.log\' and logfile.path not like \'%\\_clean\\_%compile.log\''] as component> ${component} - ${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p JOIN m.component as c where UPPER(p.priority) like \'%ERROR%\' and c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\''][0] - + table_info['jpasingle']['select Count(w.id) from WhatLogEntry w JOIN w.component as c JOIN c.logFile as l where c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\' and w.missing = \'true\''][0]} - ${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p JOIN m.component as c where UPPER(p.priority) like \'%WARNING%\' and c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\''][0]} - ${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p JOIN m.component as c where UPPER(p.priority) like \'%REMARK%\' and c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\''][0]} + ${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p JOIN m.component as c where UPPER(p.priority)=\'ERROR\' and c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\''][0] + + table_info['jpasingle']['select Count(w.id) from WhatLogEntry w JOIN w.component as c JOIN c.logFile as l where c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\' and w.missing = \'true\''][0]} + ${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p JOIN m.component as c where UPPER(p.priority)=\'WARNING\' and c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\''][0]} + ${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p JOIN m.component as c where UPPER(p.priority)=\'REMARK\' and c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\''][0]} + + - - <#list table_info['native:java.lang.String']['select DISTINCT component.component from component INNER JOIN logfile ON logfile.logpath_id=component.logpath_id where logfile.path like \'%_compile%.log\' and logfile.path not like \'%_compile_clean%.log\''] as component> - + <#list table_info['native:java.lang.String']['select DISTINCT component.component from component INNER JOIN logfile ON logfile.logpath_id=component.logpath_id where logfile.path like \'%_compile.log\' and logfile.path not like \'%\\_clean\\_%compile.log\''] as component> ${component} diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/common/templates/ido/ido-cmt-ant.xml.ftl --- a/buildframework/helium/tools/common/templates/ido/ido-cmt-ant.xml.ftl Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tools/common/templates/ido/ido-cmt-ant.xml.ftl Wed Jun 16 16:51:40 2010 +0300 @@ -30,7 +30,8 @@ - + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/common/templates/log/cc_summary_metadata_orm.html.ftl --- a/buildframework/helium/tools/common/templates/log/cc_summary_metadata_orm.html.ftl Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tools/common/templates/log/cc_summary_metadata_orm.html.ftl Wed Jun 16 16:51:40 2010 +0300 @@ -69,7 +69,7 @@ <#list colors?keys as type> <#assign count = table_info['jpasingle']['select count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.component as c where (UPPER(p.priority)=\'${type?upper_case}\' and c.id=${component.id})'][0] > <#if type=='error'> - <#assign count_missing = table_info['jpasingle']['select count(w.id) from WhatLogEntry w JOIN w.component c where c.logPathID=${logfile.id} and w.missing=\'true\''][0]> + <#assign count_missing = table_info['jpasingle']['select count(w.id) from WhatLogEntry w JOIN w.component c where c.logPathID=${logfile.id} and c.id=${component.id} and w.missing=\'true\''][0]> <#assign count = count?number + count_missing?number> <#if (count?number > 0)> diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/common/test/test_common.ant.xml --- a/buildframework/helium/tools/common/test/test_common.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tools/common/test/test_common.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -28,7 +28,7 @@ - + @@ -247,6 +247,7 @@ + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/common/test/test_scanlog.ant.xml --- a/buildframework/helium/tools/common/test/test_scanlog.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tools/common/test/test_scanlog.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -28,7 +28,7 @@ - + @@ -104,10 +104,12 @@ - - + + - + + + @@ -190,11 +192,27 @@ + + + + + + + + + + + + + + + + + ${scanlog} + - - + + + + + - - + + - - + + + + + @@ -255,11 +281,11 @@ - - + + - - + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/common/test/test_scanlog_regex.ant.xml --- a/buildframework/helium/tools/common/test/test_scanlog_regex.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tools/common/test/test_scanlog_regex.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -26,7 +26,7 @@ - + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/common/testing.ant.xml --- a/buildframework/helium/tools/common/testing.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tools/common/testing.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -125,6 +125,7 @@ + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/compile/cmaker.ant.xml --- a/buildframework/helium/tools/compile/cmaker.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tools/compile/cmaker.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -100,14 +100,15 @@ - + + - + @@ -119,7 +120,7 @@ - + @@ -129,14 +130,15 @@ - + + - + - + @@ -144,14 +146,15 @@ - + + - + - + @@ -159,14 +162,15 @@ - + + - + - + @@ -182,7 +186,7 @@ - + @@ -193,14 +197,15 @@ - + + - + - + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/compile/compile.ant.xml --- a/buildframework/helium/tools/compile/compile.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tools/compile/compile.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -58,6 +58,7 @@ + @@ -77,12 +78,10 @@ - + - - - + - + @@ -284,12 +284,10 @@ This is used at the end of compilation to log the compile time to the GTI database. + @deprecated Implementation of the feature has changed, and the target is not needed anymore --> - - - - + Warning: this target is deprecated, please remove it from your configuration + @@ -40,9 +41,8 @@ - + + @@ -62,6 +62,7 @@ + @@ -110,7 +111,10 @@ - @@ -131,7 +135,10 @@ - @@ -157,10 +164,10 @@ - @@ -192,9 +199,8 @@ - + + @@ -218,14 +224,14 @@ - + --> @@ -308,7 +314,8 @@ task.execute(); - + + @@ -325,6 +332,7 @@ ]]> + + diff -r 85df38eb4012 -r c7c26511138f buildframework/helium/tools/compile/ebs/ebs.ant.xml --- a/buildframework/helium/tools/compile/ebs/ebs.ant.xml Tue Apr 27 08:33:08 2010 +0300 +++ b/buildframework/helium/tools/compile/ebs/ebs.ant.xml Wed Jun 16 16:51:40 2010 +0300 @@ -49,8 +49,9 @@ - +