summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2018-03-21 15:34:56 +0000
committerJonathan Maw <jonathan.maw@codethink.co.uk>2018-05-17 16:45:50 +0100
commit6e2e976c0ef903b2cb69900962b6746a4ca075b0 (patch)
tree07bb444a6fe6a5cd587fd3092acc5c68df6025a9
parent38dc2dda47b152105c57de938812d1163a4c29f0 (diff)
downloadbuildstream-6e2e976c0ef903b2cb69900962b6746a4ca075b0.tar.gz
filter.py: Redirect _get_source_element() calls to its build depend
We do this because trying to open/close/reset a workspace on a filter element doesn't make sense, but is probably meant for the element that the filter element filters.
-rw-r--r--buildstream/plugins/elements/filter.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/buildstream/plugins/elements/filter.py b/buildstream/plugins/elements/filter.py
index 1c1a59b76..8ce16ff9f 100644
--- a/buildstream/plugins/elements/filter.py
+++ b/buildstream/plugins/elements/filter.py
@@ -32,6 +32,10 @@ they must be runtime dependencies only. This can be useful to propagate
runtime dependencies forward from this filter element onto its reverse
dependencies.
+When workspaces are opened, closed or reset on this element, or this
+element is tracked, instead of erroring due to a lack of sources, this
+element will transparently pass on the command to its sole build-dependency.
+
The default configuration and possible options are as such:
.. literalinclude:: ../../../buildstream/plugins/elements/filter.yaml
:language: yaml
@@ -103,6 +107,13 @@ class FilterElement(Element):
exclude=self.exclude, orphans=self.include_orphans)
return ""
+ def _get_source_element(self):
+ # Filter elements act as proxies for their sole build-dependency
+ build_deps = list(self.dependencies(Scope.BUILD, recurse=False))
+ assert len(build_deps) == 1
+ output_elm = build_deps[0]._get_source_element()
+ return output_elm
+
def setup():
return FilterElement