Commit 6e2e976c authored by Jonathan Maw's avatar Jonathan Maw 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.
parent 38dc2dda
......@@ -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
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment