P3bad error messaginggood first issuehelp wantedteam-ExternalDepstype: bug
仓库指标
- Star
- (25,384 star)
- PR 合并指标
- (平均合并 22天 20小时) (30 天内合并 77 个 PR)
描述
Description of the issue
The error messages when referencing an http_file in the srcs section can be cryptic and could be improved to help the user fix the problem.
Repro
# WORKSPACE
http_file(
name = "available_port_finder",
downloaded_file_path = "AvailablePortFinder.java",
urls = [
"https://svn.apache.org/viewvc/camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/AvailablePortFinder.java?revision=1232764&view=co",
],
)
# BUILD
java_library(
name = "available_port_finder",
srcs = [
"@available_port_finder//:AvailablePortFinder.java",
],
)
Then run:
$ bazel build //:available_port_finder
From here, one gets this message:
ERROR: /usr/local/home/aryehh/Development/code/BUILD.bazel:11:13: no such package '@available_port_finder//': BUILD file not found in directory '' of external repository @available_port_finder. Add a BUILD file to a directory to mark it as a package. and referenced by '//:available_port_finder'
ERROR: Analysis of target '//:available_port_finder' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.172s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured)
FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured)
The way to fix the issue is to put "@available_port_finder//file" in the srcs attribute of the java_library.
Expected Behavior
Bazel tells the user to reference file instead of the downloaded_file_path (name of the file)
Which operating system are you running Bazel on?
Debian Rodete
What is the output of bazel info release?
bazel 5.3.1
If bazel info release returns development version or (@non-git), tell us how you built Bazel.
release 5.3.1