Skip to content

Use @@ to refer to main repository

Stephen Ryan requested to merge update_main_repository_references into main

Since Bazel 7.1.0, references to the main repository should be done with @@ instead of @.

This change is documented here: https://bazel.build/versions/7.1.0/concepts/labels

Labels starting with @@// are references to the main repository ...

Compared to the previous version https://bazel.build/versions/7.0.0/concepts/labels

Labels starting with @// are references to the main repository ...

Using @// does not cause problems for building in this repository or for direct consumers. But when building a repo with an indirect dependency on gt_gen_core, it will show ... No repository visible as '@' from repository .... This can be resolved by using @@//.

As an example, when using Bazel modules, a repository test_one which depends directly on gt_gen_core will build without any issues. When another repository, test_two depends directly on test_one and therefore indirectly on gt_gen_core, it will give the following error.

ERROR: no such package '@@[unknown repo '' requested from @@test_one~~gt_gen_core_extension~gt_gen_core]//third_party/nlohmann_json': The repository '@@[unknown repo '' requested from @@test_one~~gt_gen_core_extension~gt_gen_core]' could not be resolved: No repository visible as '@' from repository '@@test_one~~gt_gen_core_extension~gt_gen_core'

Merge request reports

Loading