Skip to content

bazel query doesn't work correctly with external repositories. #10234

Closed

Description

@meteorcloudy

Description of the problem / feature request:

Currently, Bazel doesn't support .bazelignore for external repository, but .bazelignore still affects the behavior of bazel query on external repositories.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

mkdir -p other_repo/foo/bar
touch other_repo/WORKSPACE
touch other_repo/foo/bar/file.txt
cat >> other_repo/foo/bar/BUILD <<EOF
filegroup(
  name = "file",
  srcs = ["file.txt"],
)
EOF

mkdir my_repo
cat >> my_repo/WORKSPACE <<EOF
local_repository(
  name = "other_repo",
  path = "../other_repo",
)
EOF
cat >> my_repo/.bazelignore <<EOF
foo/bar
EOF

cd my_repo

bazel query @other_repo//foo/bar/...
Starting local Bazel server and connecting to it...
ERROR: no targets found beneath 'foo/bar'
Loading: 0 packages loaded

rm .bazelignore

bazel query @other_repo//foo/bar/...
@other_repo//foo/bar:file

.bazelignore should only affects packages in main repo, not the packages with the same path in external repo.

What's the output of bazel info release?

1.1.0

Solution

We plan to add support of .bazelignore file for external repo in #9080, this bug should be fixed by reading the .bazelignore file from the correct places based on where the packages come from. For example, when query @other_repo//foo/bar/... we should use .bazelignore file from @other_repo instead of the one from the main repo.

Activity

  1. self-assigned this
    on Nov 14, 2019
  2. added
    P2
    on Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2type: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions