Description of the problem / feature request:
bazel query --output build //external:something may print wrong version of something
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
WORKSPACE
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//:a.bzl", "add_skylib")
add_skylib()
http_archive(
name = "bazel_skylib",
urls = [
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
],
sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
)
a.bzl
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def add_skylib():
http_archive(
name = "bazel_skylib",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
],
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
)
BUILD: empty file
$ bazel query --output build //external:bazel_skylib
http_archive(
name = "bazel_skylib",
urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz"],
sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
)
$ cat "`bazel info output_base`/external/bazel_skylib/version.bzl"
...
version = "1.0.2"
Interestingly adding
load("@bazel_skylib//:version.bzl", "version")
to WORKSPACE makes bazel use 1.0.3. Though there also are cases when having
http_archive(name = "foo" ...)
load("@foo//:something.bzl", "something')
fail because some other dependency manages to override/pre-load foo and bazel fails on not finding something.bzl in non-workspace version (can try to create a bigger repro where bazel_skylib is used in WORKSPACE but version is still mismatching between bazel query and actual external dependency)
What operating system are you running Bazel on?
NixOS
What's the output of bazel info release?
Tried on 3.3.1 and 4.0.0
Description of the problem / feature request:
bazel query --output build //external:somethingmay print wrong version ofsomethingBugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
WORKSPACE
a.bzl
BUILD: empty file
Interestingly adding
to WORKSPACE makes bazel use 1.0.3. Though there also are cases when having
fail because some other dependency manages to override/pre-load
fooand bazel fails on not findingsomething.bzlin non-workspace version (can try to create a bigger repro wherebazel_skylibis used in WORKSPACE but version is still mismatching betweenbazel queryand actual external dependency)What operating system are you running Bazel on?
NixOS
What's the output of
bazel info release?Tried on 3.3.1 and 4.0.0