use of com.google.devtools.build.lib.skyframe.DiffAwareness.View in project bazel by bazelbuild.
the class DiffAwarenessManager method getDiff.
/**
* Gets the set of changed files since the last call with this path entry, or
* {@code ModifiedFileSet.EVERYTHING_MODIFIED} if this is the first such call.
*/
public ProcessableModifiedFileSet getDiff(EventHandler eventHandler, Path pathEntry, OptionsClassProvider options) {
DiffAwarenessState diffAwarenessState = maybeGetDiffAwarenessState(pathEntry);
if (diffAwarenessState == null) {
return BrokenProcessableModifiedFileSet.INSTANCE;
}
DiffAwareness diffAwareness = diffAwarenessState.diffAwareness;
View newView;
try {
newView = diffAwareness.getCurrentView(options);
} catch (BrokenDiffAwarenessException e) {
handleBrokenDiffAwareness(eventHandler, pathEntry, e);
return BrokenProcessableModifiedFileSet.INSTANCE;
}
View baselineView = diffAwarenessState.baselineView;
if (baselineView == null) {
LOG.info("Initial baseline view for " + pathEntry + " is " + newView);
diffAwarenessState.baselineView = newView;
return BrokenProcessableModifiedFileSet.INSTANCE;
}
ModifiedFileSet diff;
LOG.info("About to compute diff between " + baselineView + " and " + newView + " for " + pathEntry);
try {
diff = diffAwareness.getDiff(baselineView, newView);
} catch (BrokenDiffAwarenessException e) {
handleBrokenDiffAwareness(eventHandler, pathEntry, e);
return BrokenProcessableModifiedFileSet.INSTANCE;
} catch (IncompatibleViewException e) {
throw new IllegalStateException(pathEntry + " " + baselineView + " " + newView, e);
}
ProcessableModifiedFileSet result = new ProcessableModifiedFileSetImpl(diff, pathEntry, newView);
return result;
}
use of com.google.devtools.build.lib.skyframe.DiffAwareness.View in project bazel by bazelbuild.
the class MacOSXFsEventsDiffAwarenessTest method testSimple.
@Test
public void testSimple() throws Exception {
View view1 = underTest.getCurrentView(watchFsEnabledProvider);
scratchFile("a/b/c");
scratchFile("b/c/d");
// Wait until the events propagate
Thread.sleep(200);
View view2 = underTest.getCurrentView(watchFsEnabledProvider);
assertDiff(view1, view2, "a", "a/b", "a/b/c", "b", "b/c", "b/c/d");
rmdirs(watchedPath.resolve("a"));
rmdirs(watchedPath.resolve("b"));
// Wait until the events propagate
Thread.sleep(200);
View view3 = underTest.getCurrentView(watchFsEnabledProvider);
assertDiff(view2, view3, "a", "a/b", "a/b/c", "b", "b/c", "b/c/d");
}
Aggregations