Move the Globber interface into its own file.

--
MOS_MIGRATED_REVID=113893917
diff --git a/src/main/java/com/google/devtools/build/lib/packages/GlobCache.java b/src/main/java/com/google/devtools/build/lib/packages/GlobCache.java
index 5838867..748d9ab 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/GlobCache.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/GlobCache.java
@@ -22,6 +22,7 @@
 import com.google.common.util.concurrent.SettableFuture;
 import com.google.devtools.build.lib.cmdline.PackageIdentifier;
 import com.google.devtools.build.lib.concurrent.ThreadSafety;
+import com.google.devtools.build.lib.packages.Globber.BadGlobException;
 import com.google.devtools.build.lib.util.Pair;
 import com.google.devtools.build.lib.util.Preconditions;
 import com.google.devtools.build.lib.vfs.Path;
@@ -47,12 +48,6 @@
   // Used outside of Bazel!
 @ThreadSafety.ThreadCompatible
 public class GlobCache {
-  public static class BadGlobException extends Exception {
-    BadGlobException(String message) {
-      super(message);
-    }
-  }
-
   /**
    * A mapping from glob expressions (e.g. "*.java") to the list of files it
    * matched (in the order returned by VFS) at the time the package was
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Globber.java b/src/main/java/com/google/devtools/build/lib/packages/Globber.java
new file mode 100644
index 0000000..d3e3f13
--- /dev/null
+++ b/src/main/java/com/google/devtools/build/lib/packages/Globber.java
@@ -0,0 +1,55 @@
+// Copyright 2016 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package com.google.devtools.build.lib.packages;
+
+import com.google.devtools.build.lib.util.Pair;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Set;
+
+/** Interface for evaluating globs during package loading. */
+public interface Globber {
+  /** An opaque token for fetching the result of a glob computation. */
+  abstract static class Token {}
+
+  /** Used to indicate an invalid glob pattern. */
+  static class BadGlobException extends Exception {
+    public BadGlobException(String message) {
+      super(message);
+    }
+  }
+
+  /**
+   * Asynchronously starts the given glob computation and returns a token for fetching the
+   * result.
+   *
+   * @throws BadGlobException if any of the patterns in {@code includes} or {@code excludes} are
+   *     invalid.
+   */
+  Token runAsync(List<String> includes, List<String> excludes, boolean excludeDirs)
+      throws BadGlobException;
+
+  /** Fetches the result of a previously started glob computation. */
+  List<String> fetch(Token token) throws IOException, InterruptedException;
+
+  /** Should be called when the globber is about to be discarded due to an interrupt. */
+  void onInterrupt();
+
+  /** Should be called when the globber is no longer needed. */
+  void onCompletion();
+
+  /** Returns all the glob computations requested before {@link #onCompletion} was called. */
+    Set<Pair<String, Boolean>> getGlobPatterns();
+}
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Package.java b/src/main/java/com/google/devtools/build/lib/packages/Package.java
index c861bfe..1201d72 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Package.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Package.java
@@ -33,7 +33,6 @@
 import com.google.devtools.build.lib.events.Location;
 import com.google.devtools.build.lib.packages.AttributeMap.AcceptsLabelAttribute;
 import com.google.devtools.build.lib.packages.License.DistributionType;
-import com.google.devtools.build.lib.packages.PackageFactory.Globber;
 import com.google.devtools.build.lib.util.Pair;
 import com.google.devtools.build.lib.util.Preconditions;
 import com.google.devtools.build.lib.vfs.Canonicalizer;
diff --git a/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java b/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java
index b2aa1f6..c1f30df 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/PackageFactory.java
@@ -29,7 +29,7 @@
 import com.google.devtools.build.lib.events.Location;
 import com.google.devtools.build.lib.events.NullEventHandler;
 import com.google.devtools.build.lib.events.StoredEventHandler;
-import com.google.devtools.build.lib.packages.GlobCache.BadGlobException;
+import com.google.devtools.build.lib.packages.Globber.BadGlobException;
 import com.google.devtools.build.lib.packages.License.DistributionType;
 import com.google.devtools.build.lib.packages.Preprocessor.AstAfterPreprocessing;
 import com.google.devtools.build.lib.packages.RuleFactory.BuildLangTypedAttributeValuesMap;
@@ -124,31 +124,6 @@
         throws EvalException;
   }
 
-  /** Interface for evaluating globs during package loading. */
-  public static interface Globber {
-    /** An opaque token for fetching the result of a glob computation. */
-    abstract static class Token {}
-
-    /**
-     * Asynchronously starts the given glob computation and returns a token for fetching the
-     * result.
-     */
-    Token runAsync(List<String> includes, List<String> excludes, boolean excludeDirs)
-        throws BadGlobException;
-
-    /** Fetches the result of a previously started glob computation. */
-    List<String> fetch(Token token) throws IOException, InterruptedException;
-
-    /** Should be called when the globber is about to be discarded due to an interrupt. */
-    void onInterrupt();
-
-    /** Should be called when the globber is no longer needed. */
-    void onCompletion();
-
-    /** Returns all the glob computations requested before {@link #onCompletion} was called. */
-    Set<Pair<String, Boolean>> getGlobPatterns();
-  }
-
   /**
    * An extension to the global namespace of the BUILD language.
    */
@@ -531,7 +506,7 @@
     if (async) {
       try {
         context.globber.runAsync(includes, excludes, excludeDirs);
-      } catch (GlobCache.BadGlobException e) {
+      } catch (BadGlobException e) {
         // Ignore: errors will appear during the actual evaluation of the package.
       }
       globList = GlobList.captureResults(includes, excludes, ImmutableList.<String>of());
@@ -563,7 +538,7 @@
               "error globbing [" + Joiner.on(", ").join(includes) + "]: " + expected.getMessage()));
       context.pkgBuilder.setContainsErrors();
       return GlobList.captureResults(includes, excludes, ImmutableList.<String>of());
-    } catch (GlobCache.BadGlobException e) {
+    } catch (BadGlobException e) {
       throw new EvalException(ast.getLocation(), e.getMessage());
     }
   }
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Preprocessor.java b/src/main/java/com/google/devtools/build/lib/packages/Preprocessor.java
index 1bf5654..1cca195 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Preprocessor.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Preprocessor.java
@@ -17,7 +17,6 @@
 import com.google.common.collect.Iterables;
 import com.google.devtools.build.lib.events.Event;
 import com.google.devtools.build.lib.events.StoredEventHandler;
-import com.google.devtools.build.lib.packages.PackageFactory.Globber;
 import com.google.devtools.build.lib.syntax.BuildFileAST;
 import com.google.devtools.build.lib.syntax.Environment;
 import com.google.devtools.build.lib.syntax.ParserInputSource;
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
index 03b0f5f..13c0e92 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
@@ -31,12 +31,12 @@
 import com.google.devtools.build.lib.packages.BuildFileContainsErrorsException;
 import com.google.devtools.build.lib.packages.BuildFileNotFoundException;
 import com.google.devtools.build.lib.packages.CachingPackageLocator;
+import com.google.devtools.build.lib.packages.Globber;
 import com.google.devtools.build.lib.packages.InvalidPackageNameException;
 import com.google.devtools.build.lib.packages.NoSuchPackageException;
 import com.google.devtools.build.lib.packages.Package;
 import com.google.devtools.build.lib.packages.Package.LegacyBuilder;
 import com.google.devtools.build.lib.packages.PackageFactory;
-import com.google.devtools.build.lib.packages.PackageFactory.Globber;
 import com.google.devtools.build.lib.packages.Preprocessor;
 import com.google.devtools.build.lib.packages.Preprocessor.AstAfterPreprocessing;
 import com.google.devtools.build.lib.packages.RuleVisibility;