Avoid snapshotting a given file or directory from multiple threads at the same time. Also moved responsibility for hashing a file/directory and caching the result in-memory from `DefaultTransformedFileCache` to `FileSystemSnapshotter` and friends, so that this is available outside of artifact transform caching and so that there is a single place that makes the decision for whether information for a given file/directory can be reused or should be calculated again.
Improved performance when searching for the result of an artifact transform. Assume that files and directories that live in the downloaded artifact cache or artifact transform output cache are unlikely to change during a build, and so calculate the content hash for these files only once per build. A previous change removed the multiple scanning of these files, however, the calculation of the hash from the snapshot is currently still expensive, so do this only once per build.
Maintain a faster in-memory cache of transform -> result, in order to check whether the result still exists once per build.