Commit Graph

10 Commits

Author SHA1 Message Date
Charly Delay
c53730d781 gnathub: introduce Runner & Reporter interface
The GNAThub.Plugin class is no longer an abstract class and
GNAThub.Runner & GNAThub.Reporter are two new interfaces exposing
respectively run() and report(). Plugins now have tools execution
done in run() methods, and results collection done in report() methods
(when it make sense for the plugin, ie. coverage plugins only implement
the GNAThub.Reporter interface whereas eg. CodePeer plugin implements
both GNAThub.Runner and GNAThub.Reporter interfaces).

Change-Id: Ic702a98eb3bb02e7f7416b5ff3c998f9b20eaefc
TN: P720-035
2017-01-18 16:04:50 -05:00
Charly Delay
cf7de3c106 testsuite: refactor for clarity and maintenance
Change-Id: I1d500175c06a0839268c8a3c4bfc31043c1bf259
2015-09-30 18:23:28 +02:00
Charly Delay
20b809d27c gnathub: add support for cross options (--target, --RTS)
* add support in GNAThub for --target and --RTS command line
   switches.
 * add support for Target and Runtime attributes defined in the project
   file.
 * add tests to cover the new API methods (Project.target &
   Project.runtime).

Change-Id: I42a88471598fefec16a7505ad70cd24b08f3dd8b
TN: O909-050
2015-09-28 21:56:06 +02:00
JC Delay
caf8b756bd Revamp of the documentation
This commit introduces several changes:

  * rewrite the docstring of Python scripts to use AdaCore style and
    have a consistent documentation notation across projects
  * add plug-ins documentation to the generated doc, so that users don't
    need to dive into the source files when developing their own
    plug-ins
  * use a custom style for the HTML documentation (lighter & easier to
    read)

Change-Id: Ied42183e866ee552b90af2f4ef1d2410be601ca4
2014-10-13 17:03:34 +02:00
JC Delay
1233534158 Unify GNAThub.Plugin.name()
Provide a default implementation to the GNAThub.Plugin.name property:

    return type(self).__name__

Use plugin().name along with plugin.__name__ to discriminate plugins
from their name in the plugin-runner.py.

Change-Id: Ie478427ffd78c45cdab8dd1e842b3736020cd710
TN: N623-022
2014-08-14 19:48:58 +02:00
JC Delay
497fa66e8b gnathub: update testsuite with new support.
Change-Id: Id628a5f3eff0776c91315aac54db2db8ed828495
Issue: DSH-60.
2014-04-25 16:48:22 +02:00
JC Delay
6b7eacf677 Update GNAThub.Plugin interface.
Remove two deprecated methods: fqn and display_command_line(), and a
deprecated attribute: LOG_FILE.
Also refactor the code and normalize the plug-ins output.

Change-Id: I1a346f0dc4c705cf03199f348006aabdab0ad56f
2014-03-31 19:05:24 +02:00
JC Delay
e7d4c7147d Refactor logging module.
Distinguish routines to print GNAThub output with routines to log the
execution of GNAThub and its plug-ins.

Define a new Logger class and export it to Python. Plug-ins can simply
use the pre-defined self.log instance variable for logging.

Update all occurrences of printing and logging in the sources.
Also update two tests to ensure they do not attempt to run any other
plug-in than SonarConfig.

Change-Id: I47bd3a4fc243a70c12138ca2b8e854d770dbae82
2014-03-31 15:23:57 +02:00
JC Delay
213bd23696 Rationalize plug-in loading mechanism.
It relies on the definition of three concepts:

    * Repositories (containing one or more scripts)
    * Scripts (containing one or more plug-ins)
    * Plug-ins (the actual piece of code that GNAThub will execute)

The notion of "core" and "extra" plug-ins is replaced by two
repositories: [system] and the [global].

Those repositories contains scripts that themselves contains plug-ins.
The user can define a [local] repository in it project file. This is
done with the 'Local_Repository' attribute. It replaces the previous
'Specific_Plugins' attribute.

GNAThub lists all available scripts, and loads them to create a list of
plug-ins (actual Python classes).

The user can then select the plug-ins to run:

    * With a switch on the command line (--plugins)
    * With an attribute of the project ('Plugins')

Both expect a list of plug-ins names. The name of a plug-in is the name
of the Python class (case-insensitive).

If none is specified, GNAThub executes all plug-ins it has found.

src/gnathub/ChangeLog:

    * gnathub-project.adb (GNAThub.repositories): New function. It
      returns a dictionary associating the name of a repository with the
      path to the actual directory.
      (GNAThub.core_plugins, GNAThub.extra_plugins): Remove functions.
    * gnathub-project.adb: Replace attribute Specific_Plugins by
      Local_Repository.

src/lib/ChangeLog:

    * GNAThub/__init__.py (GNAThub.repositories): Write the
      documentation for the new function.
      (GNAThub.core_plugins, GNAThub.extra_plugins): Remove functions.
      (register, run): Remove those function since they are only used by
      the plugin-runner.py.
    * scripts/plugin-runner.py: Full re-write of this script.

docs/source/user-manual/execute_driver.rst: Update documentation.

testsuite/tests/api-python/*: Update test cases.

Issue: DSH-37
Change-Id: Ic65001ce01eb3a625e0e08cd4b2747dbbb166846
2014-03-26 20:51:10 +01:00
JC Delay
2902e46ed0 Testsuite refactoring.
Add support for custom category names through YAML configuration file.
This allows results to not be stored with the same hierarchy as the
actual tests (the testsuite is more stable with this mode).

Also renames the testsuite directory.

Change-Id: I4e4b997d6b3732d116fb2fc7605d8f99d8117857
2014-03-10 19:33:10 +01:00