summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Maat <tm@tlater.net>2018-03-23 10:29:20 +0000
committerTristan Maat <tristan.maat@codethink.co.uk>2018-03-27 14:32:54 +0100
commit989bb3fe000dc8c843b7a8293f9cf0a3293b8d39 (patch)
tree3b3bd6ed47c93a9110fb70d2c0b9ebde7c6d3775
parent1d9ea9171dbf4c3244c9acf8da7a00c6825c3217 (diff)
downloadbuildstream-989bb3fe000dc8c843b7a8293f9cf0a3293b8d39.tar.gz
element.py: Disallow incremental builds for caches that can't diff
-rw-r--r--buildstream/element.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index fa523d8b1..cddadd56f 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -499,7 +499,8 @@ class Element(Plugin):
files_written = {}
old_dep_keys = {}
- if self._workspaced():
+ if self._can_build_incrementally():
+ project = self._get_project()
workspace = self._get_workspace()
if workspace.last_successful:
@@ -1537,6 +1538,9 @@ class Element(Plugin):
# Run shells with network enabled and readonly root.
return sandbox.run(argv, flags, env=environment)
+ def _can_build_incrementally(self):
+ return self._workspaced() and self.__artifacts.can_diff()
+
# _stage_sources_in_sandbox():
#
# Stage this element's sources to a directory inside sandbox
@@ -1548,7 +1552,9 @@ class Element(Plugin):
#
def _stage_sources_in_sandbox(self, sandbox, directory, mount_workspaces=True):
- if mount_workspaces:
+ # Only artifact caches that implement diff() are allowed to
+ # perform incremental builds.
+ if mount_workspaces and self._can_build_incrementally():
workspace = self._get_workspace()
# First, mount sources that have an open workspace
sources_to_mount = [source for source in self.sources() if source._has_workspace()]
@@ -1579,7 +1585,7 @@ class Element(Plugin):
# If mount_workspaces is set, sources with workspace are mounted
# directly inside the sandbox so no need to stage them here.
- if mount_workspaces:
+ if mount_workspaces and self._can_build_incrementally():
sources = [source for source in self.sources() if not source._has_workspace()]
else:
sources = self.sources()