summaryrefslogtreecommitdiff
path: root/src/buildstream/plugins
diff options
context:
space:
mode:
authorThomas Coldrick <thomas.coldrick@codethink.co.uk>2019-09-10 10:53:17 +0100
committerThomas Coldrick <othko97@gmail.com>2019-09-16 06:55:56 +0000
commit8ff9262d9843a8e858a594c787ddbd156b4b3d3b (patch)
treeb566da3f861a1b1e1d0ebe10692d3e50506691ef /src/buildstream/plugins
parent766c6c8d3e051011f90a920ece736de36f380bdd (diff)
downloadbuildstream-8ff9262d9843a8e858a594c787ddbd156b4b3d3b.tar.gz
filter.py: Allow passing integration commands
It is tedious to manually copy the integration commands of the parent element into a filter element, so this allows it to be done automatically. Here we modify FilterElement.integrate() to allow us to pass through the parent's integration commands, iff an option is set. Also adds a test for the new feature, but this is not as comprehensive as would be idea, as getting to the integration commands which are run is a little more difficult. Addresses #1107
Diffstat (limited to 'src/buildstream/plugins')
-rw-r--r--src/buildstream/plugins/elements/filter.py9
-rw-r--r--src/buildstream/plugins/elements/filter.yaml5
2 files changed, 13 insertions, 1 deletions
diff --git a/src/buildstream/plugins/elements/filter.py b/src/buildstream/plugins/elements/filter.py
index c2c2e0125..795d8910b 100644
--- a/src/buildstream/plugins/elements/filter.py
+++ b/src/buildstream/plugins/elements/filter.py
@@ -168,7 +168,7 @@ class FilterElement(Element):
def configure(self, node):
node.validate_keys([
- 'include', 'exclude', 'include-orphans'
+ 'include', 'exclude', 'include-orphans', 'pass-integration'
])
self.include_node = node.get_sequence('include')
@@ -177,6 +177,7 @@ class FilterElement(Element):
self.include = self.include_node.as_str_list()
self.exclude = self.exclude_node.as_str_list()
self.include_orphans = node.get_bool('include-orphans')
+ self.pass_integration = node.get_bool('pass-integration', False)
def preflight(self):
# Exactly one build-depend is permitted
@@ -252,6 +253,12 @@ class FilterElement(Element):
output_elm = build_deps[0]._get_source_element()
return output_elm
+ def integrate(self, sandbox):
+ if self.pass_integration:
+ for dep in self.dependencies(Scope.BUILD, recurse=False):
+ dep.integrate(sandbox)
+ super().integrate(sandbox)
+
def setup():
return FilterElement
diff --git a/src/buildstream/plugins/elements/filter.yaml b/src/buildstream/plugins/elements/filter.yaml
index 9c2bf69f4..12a82a9cb 100644
--- a/src/buildstream/plugins/elements/filter.yaml
+++ b/src/buildstream/plugins/elements/filter.yaml
@@ -27,3 +27,8 @@ config:
# the parent element.
#
include-orphans: False
+
+ # Whether to pass the 'integration-commands' of the
+ # parent element through the filter.
+ #
+ pass-integration: False