This is an automated email from the ASF dual-hosted git repository. github-bot pushed a commit to branch 214-filter-workspacing-rework in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 11571c4cadc4249a1e61355c446af5215f0a73c1 Author: Jonathan Maw <[email protected]> AuthorDate: Wed Mar 21 15:34:56 2018 +0000 filter.py: Redirect _get_real_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. --- buildstream/plugins/elements/filter.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/buildstream/plugins/elements/filter.py b/buildstream/plugins/elements/filter.py index 2487a97..68f54db 100644 --- a/buildstream/plugins/elements/filter.py +++ b/buildstream/plugins/elements/filter.py @@ -32,6 +32,11 @@ 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, instead +of erroring due to a lack of sources, this element will transparently +pass on the workspace opening/closing/resetting to its sole +build-dependency. + The default configuration and possible options are as such: .. literalinclude:: ../../../buildstream/plugins/elements/filter.yaml :language: yaml @@ -102,6 +107,13 @@ class FilterElement(Element): exclude=self.exclude, orphans=self.include_orphans) return "" + def _get_real_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_real_element() + return output_elm + def setup(): return FilterElement
