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 d6c5ff03cb0219..349aec4b15b740 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 @@ 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 @@ private Iterable getSubdirDeps( && 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 d6476522de2014..867fb0150287c8 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 < $TEST_log || fail "Failed to build ..." +} + run_suite "empty package tests"