bazelbuild/bazel

Error Message Could be Improved for `http_file`

Open

#16.375 aberto em 2 de out. de 2022

Ver no GitHub
 (8 comments) (0 reactions) (0 assignees)Java (4.465 forks)batch import
P3bad error messaginggood first issuehelp wantedteam-ExternalDepstype: bug

Métricas do repositório

Stars
 (25.384 stars)
Métricas de merge de PR
 (Mesclagem média 22d 20h) (77 fundiu PRs em 30d)

Description

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

Guia do colaborador