summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Maat <tristan.maat@codethink.co.uk>2017-09-08 17:42:14 +0100
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-09-14 14:36:32 -0400
commit5438fe308a1843e7cddcfbaf1c662d1d52c1b15e (patch)
tree0ffe0df8a62e846d2d0fb6a284f207741e4c599b
parent032d0f3bbc337663576fdeee70f6a49e66f836c8 (diff)
downloadbuildstream-5438fe308a1843e7cddcfbaf1c662d1d52c1b15e.tar.gz
Add loaded plugins to log
-rw-r--r--buildstream/_frontend/widget.py26
-rw-r--r--buildstream/_plugincontext.py7
2 files changed, 32 insertions, 1 deletions
diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py
index a51915038..c04cdafb7 100644
--- a/buildstream/_frontend/widget.py
+++ b/buildstream/_frontend/widget.py
@@ -441,6 +441,10 @@ class LogLine(Widget):
text += self.format_values(values)
text += '\n'
+ # Plugins
+ text += self.format_plugins(pipeline.element_factory.loaded_dependencies,
+ pipeline.source_factory.loaded_dependencies)
+
# Pipeline state
text += self.content_profile.fmt("Pipeline\n", bold=True)
if deps is None:
@@ -505,6 +509,28 @@ class LogLine(Widget):
if log_file:
click.echo(text, file=log_file, color=False, nl=False)
+ def format_plugins(self, element_plugins, source_plugins):
+ text = ""
+
+ if not (element_plugins or source_plugins):
+ return text
+
+ text += self.content_profile.fmt("Loaded Plugins\n", bold=True)
+
+ if element_plugins:
+ text += self.format_profile.fmt(" Element Plugins\n")
+ for plugin in element_plugins:
+ text += self.content_profile.fmt(" - {}\n".format(plugin))
+
+ if source_plugins:
+ text += self.format_profile.fmt(" Source Plugins\n")
+ for plugin in source_plugins:
+ text += self.content_profile.fmt(" - {}\n".format(plugin))
+
+ text += '\n'
+
+ return text
+
def format_values(self, values, style_value=True):
text = ''
max_key_len = 0
diff --git a/buildstream/_plugincontext.py b/buildstream/_plugincontext.py
index 96ee2e2c5..e725211a9 100644
--- a/buildstream/_plugincontext.py
+++ b/buildstream/_plugincontext.py
@@ -42,11 +42,13 @@ from . import utils
#
class PluginContext():
- def __init__(self, plugin_base, base_type, searchpath=None):
+ def __init__(self, plugin_base, base_type, searchpath=None, dependencies=None):
if not searchpath:
raise PluginError("Cannot create plugin context without any searchpath")
+ self.dependencies = dependencies
+ self.loaded_dependencies = []
self.base_type = base_type # The base class plugins derive from
self.types = {} # Plugin type lookup table by kind
@@ -107,6 +109,9 @@ class PluginContext():
.format(self.base_type.__name__, kind))
self.types[kind] = self.load_plugin(source, package, defaults)
+ if dist:
+ self.loaded_dependencies.append(kind)
+
return self.types[kind]
def load_plugin(self, source, kind, defaults):