Skip to content

Commit

Permalink
Properly report missing external repositiones during pattern evaluation.
Browse files Browse the repository at this point in the history
Fixes #3836.

Change-Id: Icc9e8e08c4336fc20f46b6b878986b991d62ab18
PiperOrigin-RevId: 181949937
  • Loading branch information
dslomov authored and Copybara-Service committed Jan 15, 2018
1 parent 146ff24 commit f071102
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,8 @@ public Iterable<PathFragment> getPackagesUnderDirectory(
}

if (!repositoryValue.repositoryExists()) {
// This shouldn't be possible; we're given a repository, so we assume that the caller has
// already checked for its existence.
throw new IllegalStateException(String.format("No such repository '%s'", repository));
eventHandler.handle(Event.error(String.format("No such repository '%s'", repository)));
return ImmutableList.of();
}
roots.add(repositoryValue.getPath());
}
Expand Down
5 changes: 5 additions & 0 deletions src/test/shell/bazel/external_correctness_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -331,4 +331,9 @@ function test_top_level_dir_changes_nobatch() {
top_level_dir_changes_helper --nobatch
}

function test_non_extsietnt_repo_in_pattern() {
bazel build @non_existent_repo//... &> $TEST_log && fail "Expected build to fail"
expect_log "ERROR: No such repository '@non_existent_repo'"
}

run_suite "//external correctness tests"

0 comments on commit f071102

Please sign in to comment.