From 444da8d0230a2471d9cd684ab83902d9b859e845 Mon Sep 17 00:00:00 2001 From: James Ennis Date: Thu, 11 Jul 2019 15:55:03 +0100 Subject: element.py: Cache whether we've resolved the initial state --- src/buildstream/_pipeline.py | 3 ++- src/buildstream/element.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/buildstream/_pipeline.py b/src/buildstream/_pipeline.py index a9d88befd..af60ffde5 100644 --- a/src/buildstream/_pipeline.py +++ b/src/buildstream/_pipeline.py @@ -131,7 +131,8 @@ class Pipeline(): # greater value. for element in self.dependencies(targets, Scope.ALL): # Determine initial element state. - element._update_state() + if not element._resolved_initial_state: + element._update_state() # We may already have Elements which are cached and have their runtimes # cached, if this is the case, we should immediately notify their reverse diff --git a/src/buildstream/element.py b/src/buildstream/element.py index f9065997b..51a143113 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -253,6 +253,7 @@ class Element(Plugin): self.__buildable_callback = None # Callback to BuildQueue self._depth = None # Depth of Element in its current dependency graph + self._resolved_initial_state = False # Whether the initial state of the Element has been resolved # Ensure we have loaded this class's defaults self.__init_defaults(project, plugin_conf, meta.kind, meta.is_junction) @@ -1196,6 +1197,8 @@ class Element(Plugin): # This must be called whenever the state of an element may have changed. # def _update_state(self): + if not self._resolved_initial_state: + self._resolved_initial_state = True context = self._get_context() # Compute and determine consistency of sources -- cgit v1.2.1