aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ProcessPackageDirectory.java5
-rwxr-xr-xsrc/test/shell/bazel/empty_package.sh13
2 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ProcessPackageDirectory.java b/src/main/java/com/google/devtools/build/lib/skyframe/ProcessPackageDirectory.java
index d6c5ff03cb..349aec4b15 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ProcessPackageDirectory.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ProcessPackageDirectory.java
@@ -16,6 +16,7 @@ package com.google.devtools.build.lib.skyframe;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
+import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.events.Event;
@@ -197,6 +198,10 @@ public class ProcessPackageDirectory {
&& PathPackageLocator.DEFAULT_TOP_LEVEL_EXCLUDES.contains(basename)) {
continue;
}
+ if (basename.equals(Label.EXTERNAL_PACKAGE_NAME.getPathString())) {
+ // Not a real package.
+ continue;
+ }
PathFragment subdirectory = rootRelativePath.getRelative(basename);
// If this subdirectory is one of the excluded paths, don't recurse into it.
diff --git a/src/test/shell/bazel/empty_package.sh b/src/test/shell/bazel/empty_package.sh
index d6476522de..867fb01502 100755
--- a/src/test/shell/bazel/empty_package.sh
+++ b/src/test/shell/bazel/empty_package.sh
@@ -44,4 +44,17 @@ EOF
expect_log "SCREEEECH"
}
+function test_empty_external() {
+ mkdir foo
+ cd foo
+ touch WORKSPACE
+ # Create a dummy BUILD file, otherwise `bazel build` will complain that there
+ # were no targets to build.
+ cat > BUILD <<EOF
+exports_files(["BUILD"])
+EOF
+ mkdir external
+ bazel build ... &> $TEST_log || fail "Failed to build ..."
+}
+
run_suite "empty package tests"