google/flogger

[Bazel CI] Error No repository visible as '@google_bazel_common' from main repository.

Closed this issue · 11 comments

CI: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/4089#0191a183-1b36-4309-90c3-da14321b5668

Platform: Ubuntu

Logs:

ERROR: �[0mSkipping '//...': error loading package under directory '': error loading package 'tools': Unable to find package for @@[unknown repo 'google_bazel_common' requested from @@]//tools/javadoc:javadoc.bzl: The repository '@@[unknown repo 'google_bazel_common' requested from @@]' could not be resolved: No repository visible as '@google_bazel_common' from main repository.
ERROR: �[0merror loading package under directory '': error loading package 'tools': Unable to find package for @@[unknown repo 'google_bazel_common' requested from @@]//tools/javadoc:javadoc.bzl: The repository '@@[unknown repo 'google_bazel_common' requested from @@]' could not be resolved: No repository visible as '@google_bazel_common' from main repository.
ERROR: �[0mBuild did NOT complete successfully
FAILED:�[0m 
FAILED:�[0m 
Error: The command exited with status 1�[0m
error: The plugin docker command hook exited with status 1

Culprit: bazelbuild/bazel@5881c38

Steps:

git clone https://github.com/google/flogger
git reset a08edf0832ad58d3babd54720f4a8ae2018ed109  --hard
export USE_BAZEL_VERSION=ed8ed01cf3c86485dbd1d756b6e891daad892358
bazel build //... 

CC Greenteam @mai93

@cpovirk Can you please take a look? WORKSPACE will be disabled by default in Bazel 8. See bazelbuild/bazel#23023

Looks like we have to transitively migrate our entire dependency chain of bazel repos.

Indeed, and I would recommend replacing google_bazel_common with rules_jvm_external for fetching java dependencies. Judging from the WORKSPACE file, it should be straight forward.

And you can still use repository rules in MODULE.bazel via use_repo_rule

Is there a replacement for native.android_sdk_repository that's usable from a MODULE.bazel file? https://github.com/google/bazel-common/blob/5956b5573bb8e21839120e1d2bfc7cc97717f737/workspace_defs.bzl#L67-L71

Looks like it should be https://github.com/bazelbuild/rules_android, but that's apparently still experimental and spits out errors unless certain flags are given.

Correct https://github.com/bazelbuild/rules_android is the Starlark replacement for the native android rules (native.android_sdk_repository etc). They are not "1.0" yet because there is still some clean up / migrating to do, but they're usable, and in particular the flags mentioned won't be needed with bazel 7.4, which is being released soon.

But before getting too much deeper into this, are the android rules even needed for flogger? I don't see anything Android in BUILD files:
https://github.com/search?q=repo%3Agoogle%2Fflogger%20android&type=code

Not for flogger per se, but we need to migrate bazel-common before we can migrate flogger, so we need to make sure that bazel-common remains usable for other projects that depend on it.

But maybe this is also a good opportunity to replace that with the javadoc rule from rules_jvm_external.

Yeah it would be much simpler to cut the dependency on the android rules, if possible

Once upon a time, I think the Android rules were used by Dagger. Dagger has since inlined bazel-common into their own repo, thus leaving themselves with their own separate future problem :) (@bcorso in case we end up doing anything that is of interest to Dagger)

(Here's one use of javadoc_library that might care about Android support. But presumably they can migrate to rules_jvm_external, too.)