Activate interleaved package and transitive target loading

Hooks up the recently introduced interleaved loading functions to
normal graph loading.

--
MOS_MIGRATED_REVID=97679451
diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/TargetPattern.java b/src/main/java/com/google/devtools/build/lib/cmdline/TargetPattern.java
index c10b252..9960b4a 100644
--- a/src/main/java/com/google/devtools/build/lib/cmdline/TargetPattern.java
+++ b/src/main/java/com/google/devtools/build/lib/cmdline/TargetPattern.java
@@ -148,11 +148,18 @@
 
   /**
    * Returns {@code true} iff this pattern has type {@code Type.TARGETS_BELOW_DIRECTORY} and
-   * {@code containedPattern} is contained by or equals this pattern. For example,
-   * returns {@code true} for {@code this = TargetPattern ("//...")} and {@code containedPattern
-   * = TargetPattern ("//foo/...")}.
+   * {@param directory} is contained by or equals this pattern's directory. For example,
+   * returns {@code true} for {@code this = TargetPattern ("//...")} and {@code directory
+   * = "foo")}.
    */
-  public abstract boolean containsBelowDirectory(TargetPattern containedPattern);
+  public abstract boolean containsBelowDirectory(String directory);
+
+  /**
+   * Shorthand for {@code containsBelowDirectory(containedPattern.getDirectory())}.
+   */
+  public boolean containsBelowDirectory(TargetPattern containedPattern) {
+    return containsBelowDirectory(containedPattern.getDirectory());
+  }
 
   /**
    * Returns the most specific containing directory of the patterns that could be matched by this
@@ -165,6 +172,13 @@
    */
   public abstract String getDirectory();
 
+  /**
+   * Returns {@code true} iff this pattern has type {@code Type.TARGETS_BELOW_DIRECTORY} or
+   * {@code Type.TARGETS_IN_PACKAGE} and the target pattern suffix specified it should match
+   * rules only.
+   */
+  public abstract boolean getRulesOnly();
+
   private static final class SingleTarget extends TargetPattern {
 
     private final String targetName;
@@ -187,7 +201,7 @@
     }
 
     @Override
-    public boolean containsBelowDirectory(TargetPattern containedPattern) {
+    public boolean containsBelowDirectory(String directory) {
       return false;
     }
 
@@ -197,6 +211,11 @@
     }
 
     @Override
+    public boolean getRulesOnly() {
+      return false;
+    }
+
+    @Override
     public boolean equals(Object o) {
       if (this == o) {
         return true;
@@ -251,7 +270,7 @@
     }
 
     @Override
-    public boolean containsBelowDirectory(TargetPattern containedPattern) {
+    public boolean containsBelowDirectory(String directory) {
       return false;
     }
 
@@ -262,6 +281,11 @@
     }
 
     @Override
+    public boolean getRulesOnly() {
+      return false;
+    }
+
+    @Override
     public boolean equals(Object o) {
       if (this == o) {
         return true;
@@ -315,7 +339,7 @@
     }
 
     @Override
-    public boolean containsBelowDirectory(TargetPattern containedPattern) {
+    public boolean containsBelowDirectory(String directory) {
       return false;
     }
 
@@ -325,6 +349,11 @@
     }
 
     @Override
+    public boolean getRulesOnly() {
+      return rulesOnly;
+    }
+
+    @Override
     public boolean equals(Object o) {
       if (this == o) {
         return true;
@@ -399,12 +428,11 @@
     }
 
     @Override
-    public boolean containsBelowDirectory(TargetPattern containedPattern) {
-      // Note that merely checking to see if the containedPattern's string expression beginsWith
-      // the TargetsBelowDirectory's directory is insufficient. "food" begins with "foo", but
-      // "//foo/..." does not contain "//food/...".
-      String containedDirectory = containedPattern.getDirectory() + "/";
-      return containedDirectory.startsWith(directory + "/");
+    public boolean containsBelowDirectory(String containedDirectory) {
+      // Note that merely checking to see if the directory startsWith the TargetsBelowDirectory's
+      // directory is insufficient. "food" begins with "foo", but "//foo/..." does not contain
+      // "//food/...".
+      return directory.isEmpty() || (containedDirectory + "/").startsWith(directory + "/");
     }
 
     @Override
@@ -413,6 +441,11 @@
     }
 
     @Override
+    public boolean getRulesOnly() {
+      return rulesOnly;
+    }
+
+    @Override
     public boolean equals(Object o) {
       if (this == o) {
         return true;