bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
22.77k stars 3.99k forks source link

Incomplete stacktrace in `bazel mod show_repo` #22603

Open laurentlb opened 1 month ago

laurentlb commented 1 month ago

Description of the bug:

The command bazel mod show_repo includes a stacktrace at the end of the output. In most cases, it just says <builtin> in <toplevel>, which doesn't give any information. I'd expect for example to get the line of bazel_dep in a MODULE.bazel file.

Example:

$ bazel mod show_repo rules_cc@0.0.9
## rules_cc@0.0.9:
# <builtin>
http_archive(
  name = "rules_cc~",
  urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"],
  integrity = "sha256-IDeHW5pEVtzkp50RKorohbvEqtlo5lh9ym5k86CQDN8=",
  strip_prefix = "rules_cc-0.0.9",
  remote_file_urls = {},
  remote_file_integrity = {},
  remote_patches = {"https://bcr.bazel.build/modules/rules_cc/0.0.9/patches/module_dot_bazel_version.patch": "sha256-mM+qzOI0SgAdaJBlWOSMwMPKpaA9b7R37Hj/tp5bb4g="},
  remote_patch_strip = 0,
)
# Rule rules_cc~ instantiated at (most recent call last):
#   <builtin> in <toplevel>
# Rule http_archive defined at (most recent call last):
#   /Users/laurent/output_base/external/bazel_tools/tools/build_defs/repo/http.bzl:388:31 in <toplevel>

Which category does this issue belong to?

No response

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?

No response

What is the output of bazel info release?

No response

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

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

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

meteorcloudy commented 1 month ago

We are actually not sure about what information should be shown, feel free to make a suggestion!

laurentlb commented 1 month ago

I guess it would be useful to print information to find where it comes from (e.g. lines in the MODULE file). I don't know if this information is available anywhere else.

meteorcloudy commented 1 month ago

But the same module could be referenced in different MODULE.bazel file. If you want to know, why a specific version of the module is selected, you can try bazel mod graph?