Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/buildstream/_elementsources.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def __init__(self, context: Context, project: "Project", plugin: Plugin):
self._cache_key = None # Our cached cache key
self._proto = None # The cached Source proto

self._cache = {}

# get_project():
#
# Return the project associated with this object
Expand Down Expand Up @@ -462,6 +464,10 @@ def _stage(self, *, stop=None):
if source == stop:
break

if source in self._cache:
vdir = CasBasedDirectory(cas, digest=self._cache[source])
continue

if source._directory:
vsubdir = vdir.open_directory(source._directory.lstrip(os.path.sep), create=True)
else:
Expand All @@ -483,6 +489,8 @@ def _stage(self, *, stop=None):
source_dir = self._sourcecache.export(source)
vsubdir.import_files(source_dir, collect_result=False)

self._cache[source] = vsubdir._get_digest()

return vdir

# Context manager that stages sources in a cas based or temporary file
Expand Down
Loading