diff options
-rw-r--r-- | buildstream/element.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/buildstream/element.py b/buildstream/element.py index 60e81fda1..f00bb18fd 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -511,6 +511,19 @@ class Element(Plugin): return None + def get_artifact_version(self): + """Return the element plugin's artifact version + + Returns: + (int): Artifact version + + Elements must implement this method if they change their unique + key structure in an incompatible way or trigger a change in the + build output for the same unique key. Every further change + requires a bump the returned version. + """ + return 0 + ############################################################# # Abstract Element Methods # ############################################################# @@ -801,6 +814,20 @@ class Element(Plugin): return True + # _get_core_artifact_version(): + # + # Return the artifact version of core BuildStream. + # + # Returns + # (int): Artifact version + # + # The returned version requires a bump whenever the cache key + # algorithm, the artifact structure, or the artifact metadata + # changes in an incompatible way. + # + def _get_core_artifact_version(self): + return 0 + # __calculate_cache_key(): # # Calculates the cache key @@ -833,6 +860,8 @@ class Element(Plugin): context = self.get_context() project = self.get_project() return utils._generate_key({ + 'artifact-version': "{}.{}".format(self._get_core_artifact_version(), + self.get_artifact_version()), 'context': context._get_cache_key(), 'project': project._get_cache_key(), 'element': self.get_unique_key(), |