bazel should not build/test targets inside output_base if output_base is in source tree
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
When we build/test with bazel in CI, we run with this command:
```
bazel --output_base=output test //...
```
However, if any external deps contain test targets, these are picked up by the build, evaluated in the context of outer workspace, and fail.
```
ERROR: Skipping '//...': error loading package under directory '': error loading package 'output/external/our_rules~/tests/lib/libb': cannot load '//:tools/defs.bzl': no such file
```
The question is: should the directory that bazel creates with --output_base be automatically ignored in build/test steps if it's inside the workspace?
### Which category does this issue belong to?
Core
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
_No response_
### Which operating system are you running Bazel on?
windows
### What is the output of `bazel info release`?
bazel 7.2.1
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse HEAD` ?
_No response_
### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
_No response_
### Have you found anything relevant by searching the web?
_No response_
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.