static void ExtractMetaToCache( List <ChangeInfo> changes, Dictionary <string, ChangeInfo> cache) { HashSet <string> indexedPaths = BuildIndexedPathsForChanges(changes); for (int i = changes.Count - 1; i >= 0; i--) { ChangeInfo currentChange = changes[i]; if (!MetaPath.IsMetaPath(currentChange.Path)) { continue; } string realPath = MetaPath.GetPathFromMetaPath(currentChange.Path); if (!indexedPaths.Contains(BuildKey.BuildCacheKey( currentChange.ChangeTypes, realPath))) { continue; } // found foo.c and foo.c.meta // with the same chage types - move .meta to cache cache.Add(BuildKey.ForChange(currentChange), currentChange); changes.RemoveAt(i); } }
static HashSet <string> BuildIndexedPathsForChanges( List <ChangeInfo> changes) { HashSet <string> result = new HashSet <string>(); foreach (ChangeInfo change in changes) { if (MetaPath.IsMetaPath(change.Path)) { continue; } result.Add(BuildKey.ForChange(change)); } return(result); }