private IncrementalResult CheckInputGlobChanges(ProjectGraphNode graphNode, CompilerIO compilerIO) { // check cache against input glob pattern changes var incrementalCacheFile = graphNode.ProjectContext.IncrementalCacheFile(_configuration, _buildBasePath, _outputPath); if (!File.Exists(incrementalCacheFile)) { // cache is not present (first compilation); can't determine if globs changed; cache will be generated after build processes project return(IncrementalResult.DoesNotNeedRebuild); } var incrementalCache = IncrementalCache.ReadFromFile(incrementalCacheFile); var diffResult = compilerIO.DiffInputs(incrementalCache.CompilerIO); if (diffResult.Deletions.Any()) { return(new IncrementalResult("Input items removed from last build", diffResult.Deletions)); } if (diffResult.Additions.Any()) { return(new IncrementalResult("Input items added from last build", diffResult.Additions)); } return(IncrementalResult.DoesNotNeedRebuild); }
private IncrementalResult CheckInputGlobChanges(ProjectGraphNode graphNode, CompilerIO compilerIO) { // check cache against input glob pattern changes var incrementalCacheFile = graphNode.ProjectContext.IncrementalCacheFile(_configuration, _buildBasePath, _outputPath); if (!File.Exists(incrementalCacheFile)) { // cache is not present (first compilation); can't determine if globs changed; cache will be generated after build processes project return(IncrementalResult.DoesNotNeedRebuild); } var incrementalCache = IncrementalCache.ReadFromFile(incrementalCacheFile); var diffResult = compilerIO.DiffInputs(incrementalCache.CompilerIO); if (diffResult.Deletions.Any()) { return(new IncrementalResult("Input items removed from last build", diffResult.Deletions)); } if (diffResult.Additions.Any()) { return(new IncrementalResult("Input items added from last build", diffResult.Additions)); } var keys = incrementalCache.BuildArguments.Keys.Union(_incrementalAffectingArguments.Keys); var mismatchedKeys = keys.Where(k => { string cachedVal; string currentVal; return(!incrementalCache.BuildArguments.TryGetValue(k, out cachedVal) || !_incrementalAffectingArguments.TryGetValue(k, out currentVal) || !string.Equals(cachedVal ?? string.Empty, currentVal ?? string.Empty, StringComparison.Ordinal)); }); if (mismatchedKeys.Any()) { return(new IncrementalResult("Build arguments changed since last build", mismatchedKeys)); } return(IncrementalResult.DoesNotNeedRebuild); }
private IncrementalResult CheckInputGlobChanges(ProjectGraphNode graphNode, CompilerIO compilerIO) { // check cache against input glob pattern changes var incrementalCacheFile = graphNode.ProjectContext.IncrementalCacheFile(_configuration, _buildBasePath, _outputPath); if (!File.Exists(incrementalCacheFile)) { // cache is not present (first compilation); can't determine if globs changed; cache will be generated after build processes project return IncrementalResult.DoesNotNeedRebuild; } var incrementalCache = IncrementalCache.ReadFromFile(incrementalCacheFile); var diffResult = compilerIO.DiffInputs(incrementalCache.CompilerIO); if (diffResult.Deletions.Any()) { return new IncrementalResult("Input items removed from last build", diffResult.Deletions); } if (diffResult.Additions.Any()) { return new IncrementalResult("Input items added from last build", diffResult.Additions); } var keys = incrementalCache.BuildArguments.Keys.Union(_incrementalAffectingArguments.Keys); var mismatchedKeys = keys.Where(k => { string cachedVal; string currentVal; return !incrementalCache.BuildArguments.TryGetValue(k, out cachedVal) || !_incrementalAffectingArguments.TryGetValue(k, out currentVal) || !string.Equals(cachedVal ?? string.Empty, currentVal ?? string.Empty, StringComparison.Ordinal); }); if (mismatchedKeys.Any()) { return new IncrementalResult("Build arguments changed since last build", mismatchedKeys); } return IncrementalResult.DoesNotNeedRebuild; }