From 452fdce3d0f80e1fec671237c97d7e43b0773d5f 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 c02562ee6..a08ec571c 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -254,6 +254,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) @@ -1151,6 +1152,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