Skip to content

Commit

Permalink
Rename bazel_version repository to avoid conflict
Browse files Browse the repository at this point in the history
We use a synthetic `bazel_version` repository to make the Bazel version
available in more contexts (see [bazelbuild/bazel#8305][i8305]). But
some other repositories do so, too, with the same repository name and a
different repository structure. In particular, it is not currently
possible to use `rules_rust` and certain versions of `upb` (downstream
of protobuf) in the same repository, due to their definition here:

https://github.com/protocolbuffers/upb/blob/c1357afb2e39df671d89eaec49033b5329f36a3e/bazel/repository_defs.bzl#L7-L10

An easy workaround is to disambiguate the name. It looks much easier to
change `rules_rust` than to change `upb` and update its long chain of
workspace dependencies, hence this patch. :-)

See my comment on bazelbuild#268 for more details and a full repro:
bazelbuild#268 (comment)

[i8305]: bazelbuild/bazel#8305

Test Plan:
Tested by adding the README’s workspace stanza to TensorBoard (at
current master, 8d629954c251). It fails at `rules_rust = 5998baf`,
but succeeds with a `local_repository` that has this patch.

wchargin-branch: disambiguate-bazel-version-repo
wchargin-source: 7d8ca1dd816cca59f4e1099257e6bd3a77475368
  • Loading branch information
wchargin committed Oct 21, 2020
1 parent 7b8219a commit ae94263
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bzl_library(
name = "all_deps",
srcs = [
"@bazel_tools//tools:bzl_srcs",
"@bazel_version//:def.bzl",
"@io_bazel_rules_rust_bazel_version//:def.bzl",
],
deps = [
"@bazel_skylib//:workspace",
Expand Down
2 changes: 1 addition & 1 deletion rust/private/rustc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ load(
"C_COMPILE_ACTION_NAME",
)
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
load("@bazel_version//:def.bzl", "BAZEL_VERSION")
load("@io_bazel_rules_rust_bazel_version//:def.bzl", "BAZEL_VERSION")
load("@io_bazel_rules_rust//rust:private/legacy_cc_starlark_api_shim.bzl", "get_libs_for_static_executable")
load("@io_bazel_rules_rust//rust:private/utils.bzl", "get_lib_name", "relativize")

Expand Down
2 changes: 1 addition & 1 deletion workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ def rust_workspace():

bazel_skylib_workspace()

bazel_version(name = "bazel_version")
bazel_version(name = "io_bazel_rules_rust_bazel_version")

0 comments on commit ae94263

Please sign in to comment.