Refactor WalkableGraph and BuildDriver interfaces

Remove WalkableGraph#isUpToDate and BuildDriver#alreadyEvaluated and delegate the
work to implementation.

RELNOTES: None
PiperOrigin-RevId: 179815374
diff --git a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
index f3bdc78..883047e 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
@@ -248,24 +248,21 @@
   private void beforeEvaluateQuery(QueryExpression expr)
       throws QueryException, InterruptedException {
     Set<SkyKey> roots = getGraphRootsFromExpression(expr);
-    if (graph == null || !graphFactory.isUpToDate(roots)) {
-      // If this environment is uninitialized or the graph factory needs to evaluate, do so. We
-      // assume here that this environment cannot be initialized-but-stale if the factory is up
-      // to date.
-      EvaluationResult<SkyValue> result;
-      try (AutoProfiler p = AutoProfiler.logged("evaluation and walkable graph", logger)) {
-        result = graphFactory.prepareAndGet(roots, loadingPhaseThreads, universeEvalEventHandler);
-      }
 
+    EvaluationResult<SkyValue> result;
+    try (AutoProfiler p = AutoProfiler.logged("evaluation and walkable graph", logger)) {
+      result = graphFactory.prepareAndGet(roots, loadingPhaseThreads, universeEvalEventHandler);
+    }
+
+    if (graph == null || graph != result.getWalkableGraph()) {
       checkEvaluationResult(roots, result);
-
       packageSemaphore = makeFreshPackageMultisetSemaphore();
       graph = result.getWalkableGraph();
       blacklistPatternsSupplier = InterruptibleSupplier.Memoize.of(new BlacklistSupplier(graph));
-
       graphBackedRecursivePackageProvider =
           new GraphBackedRecursivePackageProvider(graph, universeTargetPatternKeys, pkgPath);
     }
+
     if (executor == null) {
       executor = MoreExecutors.listeningDecorator(
           new ThreadPoolExecutor(