summaryrefslogtreecommitdiff
path: root/src/buildstream/_project.py
diff options
context:
space:
mode:
authorTristan van Berkom <tristan.vanberkom@codethink.co.uk>2020-05-20 19:17:10 +0900
committerTristan van Berkom <tristan.vanberkom@codethink.co.uk>2020-05-28 15:02:23 +0900
commit3f418029af80591d7a4592ee7e5a9312dfdf2d54 (patch)
tree4e4716ac33b864d7c65de8db23242335a296c54d /src/buildstream/_project.py
parent1a85a6d5524a4eddaa6c0382fb936732c29fffb3 (diff)
downloadbuildstream-3f418029af80591d7a4592ee7e5a9312dfdf2d54.tar.gz
_pluginfactory: Delegating the work of locating plugins to the PluginOrigin
This way we split up the logic of how to load plugins from different origins into their respective classes. This commit also: o Introduces PluginType (which is currently either SOURCE or ELEMENT) o Reduces the complexity of the PluginFactory constructor o Kills the loaded_dependencies list and the all_loaded_plugins API, and replaces both of these with a new list_plugins() API. Consequently the jobpickler.py from the scheduler, and the widget.py from the frontend, are updated to use list_plugins(). o Split up the PluginOrigin implementations into separate files Instead of having all PluginOrigin classes in pluginorigin.py, split it up into one base class and separate files for each implementation, which is more inline with BuildStream coding style. This has the unfortunate side effect of adding load_plugin_origin() into the __init__.py file, because keeping new_from_node() as a PluginOrigin class method cannot be done without introducing a cyclic dependency with PluginOrigin and it's implementations.
Diffstat (limited to 'src/buildstream/_project.py')
-rw-r--r--src/buildstream/_project.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/buildstream/_project.py b/src/buildstream/_project.py
index 1c6e7e950..508afa68b 100644
--- a/src/buildstream/_project.py
+++ b/src/buildstream/_project.py
@@ -36,7 +36,7 @@ from ._artifactcache import ArtifactCache
from ._sourcecache import SourceCache
from .node import ScalarNode, SequenceNode, _assert_symbol_name
from .sandbox import SandboxRemote
-from ._pluginfactory import ElementFactory, SourceFactory, PluginOrigin
+from ._pluginfactory import ElementFactory, SourceFactory, load_plugin_origin
from .types import CoreWarnings
from ._projectrefs import ProjectRefs, ProjectRefStorage
from ._loader import Loader
@@ -951,7 +951,7 @@ class Project:
# Load the plugin origins and register them to their factories
origins = config.get_sequence("plugins", default=[])
for origin_node in origins:
- origin = PluginOrigin.new_from_node(self, origin_node)
+ origin = load_plugin_origin(self, origin_node)
for kind, conf in origin.elements.items():
output.element_factory.register_plugin_origin(kind, origin, conf.allow_deprecated)
for kind, conf in origin.sources.items():