From 645e5387c2f81765654ce4543ce1f00092e3381b Mon Sep 17 00:00:00 2001 From: Chandan Singh Date: Wed, 10 Apr 2019 18:58:00 +0100 Subject: WIP: Allow symbolic links to subprojects TODO: - [ ] Decide on the proper name of the "element" configuration option - [ ] Check if this works in various corner cases - [ ] Add tests - [ ] Add docs --- buildstream/_loader/loader.py | 9 ++++++++- buildstream/plugins/elements/junction.py | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/buildstream/_loader/loader.py b/buildstream/_loader/loader.py index 6d8310cfa..23612979b 100644 --- a/buildstream/_loader/loader.py +++ b/buildstream/_loader/loader.py @@ -578,7 +578,14 @@ class Loader(): else: raise - loader = project.loader + # Check if an element was specified to use as a symlink + if element.junctioned_element: + loader = project.loader._get_loader(element.junctioned_element, rewritable=rewritable, ticker=ticker, + level=level+1, fetch_subprojects=fetch_subprojects, + provenance=provenance) + else: + loader = project.loader + self._loaders[filename] = loader return loader diff --git a/buildstream/plugins/elements/junction.py b/buildstream/plugins/elements/junction.py index ec7832bc6..f7ee2ab72 100644 --- a/buildstream/plugins/elements/junction.py +++ b/buildstream/plugins/elements/junction.py @@ -48,6 +48,9 @@ Overview # Optionally look in a subpath of the source repository for the project path: projects/hello + # Optionally specify the element in the subproject to use as junction + element: junctions/sub-project.bst + .. note:: Junction elements may not specify any dependencies as they are simply @@ -140,6 +143,7 @@ class JunctionElement(Element): BST_FORBID_RDEPENDS = True def configure(self, node): + self.junctioned_element = self.node_get_member(node, str, 'element', default=None) self.path = self.node_get_member(node, str, 'path', default='') self.options = self.node_get_member(node, Mapping, 'options', default={}) -- cgit v1.2.1