Targets placed under source code subdirectory named "external" fail to compile with "file not found" errors
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
Consider a source code tree which has one of its directories named "external":
```
"source root"
| - foo
| | - dir with targets
| | - dir with more targets
| - external
| | - dir with broken targets
| | | - dir with more broken targets
```
It appears, that bazel (at least the version I'm using) can not correctly compile targets nested under top level "external" subdirectory.
I'm aware that bazel uses a subdirectory called "external" to store dependencies in the build tree, but this should not infringe on the ability of users to have a directory, so called, in their source tree.
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Rename one of the immediate subdirs of any source tree to "external", try to build targets under that directory. I, obviously, had not tried all possible rules, but those I tried are broken (spurious "file not found" errors).
### Which operating system are you running Bazel on?
Linux
### What is the output of `bazel info release`?
release 5.2.0
### 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 master; git rev-parse HEAD` ?
_No response_
### Have you found anything relevant by searching the web?
Tough luck searching for issues with "external" key word in the query. :-)
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
The report names no source files, tests, or Bazel entry points. Start by reproducing the failure with a minimal workspace containing a top-level external directory, then compare builds for targets inside and outside it. Done means targets nested under external compile without spurious file-not-found errors.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100