1 Plugin structure
1.1 Properties used by plugins
1.1.1 General properties
notest |
disables all plugins registered at TEST target |
no<"plugin name"> |
disable this plugin |
src.location |
sets the location of source files (any language) |
1.1.2 Language specific properties
java.src.location |
sets the location of java source files |
java.class.location |
sets the location of java class files |
java.jar.location |
sets the location of java jar files |
java.lib.location |
sets the location of java lib files |
1.1.3 Plugin specific properties
Plugin specific properties can be used to set a threshold or allow for any other customization that may be necessary for the plugin. These properties should start with <plugin.name>. For example findbugs.class.location or findbugs.failure.threshold.
1.2 Methods called by plugin framework
1.2.1 Register
def register(self,pluginManager):
Is called once to register the plugin.
It sets where the plugin should be executed, normally during 'pretest'.
Here the plugin also verifies that the plugin is correctly installed, i.e. it has the files it needs. If it does not find any missing files it calls
self.pluginManager.register(self.__module__, definition)
1.2.2 Execute
{def execute(self,profile=None,command=None,target=None,targetString=None,propertyManager=None,buildStatus=None,cmds={},**kw):}
Is called for each component.
Runs the metric application, for example with an apache-ant command.
1.2.3 Publish
def publish(self,profile=None,command=None,target=None,targetString=None,propertyManager=None,buildStatus=None,**kw):
Is called for each component.
Publishes metric data for each component and links to the detailed html/xml pages created by the metrics application.
Creates the module metrics:
metrics = buildStatus.CreateMetrics('Plugin name')
metrics.detailshtmllink = #path to component specific .html page (created by metrics application, not the plugin).
metrics.detailsxmllink = #path to component specific .xml page (created by metrics application, not the plugin)
metrics.values = #array with all the values
metrics.value = #overall value
metrics.type = #integer, float, percent, etc.
metrics.unit = #bugs, violations, etc.
buildStatus.setModuleMetrics(propertyManager['moduleName'],propertyManager['name'],propertyManager['projectName'],metrics)
1.2.4 Finalise
def finalise(self,profile=None,command=None,target=None,targetString=None,propertyManager=None,buildStatus=None,**kw):
Is called once to finalise the plugin.
First it creates the plugin specific report page from a template file. It replaces lines in the template .html file with html created by the plugin.
Then it creates the summary page located in the /reports/index.html page in the report where it shows the metric data as an average of each component's data.
metrics = buildStatus.CreateMetrics('Plugin name')
metrics.detailshtmllink = 'plugin name/index.html' #path to plugin specific .html page.
metrics.values = #array with all the values
metrics.value = #overall value
metrics.type = #integer, float, percent, etc.
metrics.unit = #bugs, violations, etc.
buildStatus.setOverallMetrics(metrics)
--
FabioCapannini - 12-Sep-2011