Open source LoadingPhaseRunnerTest and its Skyframe companion.

I had to make a small change to ExternalFilesHelper. The Bazel test setup
creates a remote repository for the tools, so we always have external files,
incl. during loading. However, some of the tests don't setup an output
directory, but instead pass null, which would lead to a crash.

--
MOS_MIGRATED_REVID=110669993
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java b/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java
index de553d0..fabe2b5 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ExternalFilesHelper.java
@@ -16,6 +16,7 @@
 import com.google.devtools.build.lib.cmdline.Label;
 import com.google.devtools.build.lib.pkgcache.PathPackageLocator;
 import com.google.devtools.build.lib.util.Preconditions;
+import com.google.devtools.build.lib.vfs.Path;
 import com.google.devtools.build.lib.vfs.RootedPath;
 import com.google.devtools.build.skyframe.SkyFunction;
 
@@ -81,7 +82,9 @@
       throw new FileOutsidePackageRootsException(rootedPath);
     }
 
-    if (!rootedPath.asPath().startsWith(
+    // The outputBase may be null if we're not actually running a build.
+    Path outputBase = pkgLocator.get().getOutputBase();
+    if (outputBase != null && !rootedPath.asPath().startsWith(
         pkgLocator.get().getOutputBase().getRelative(Label.EXTERNAL_PATH_PREFIX))) {
       return;
     }