Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sgowroji opened this issue Aug 30, 2024 · 11 comments
Assignees
Labels
P3 type=other Miscellaneous activities not covered by other type= labels

Comments

@sgowroji
Copy link

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

@meteorcloudy
Copy link

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

@chaoren chaoren added type=defect Bug, not working as expected P2 type=other Miscellaneous activities not covered by other type= labels and removed type=defect Bug, not working as expected labels Sep 23, 2024
@chaoren chaoren self-assigned this Sep 23, 2024
@chaoren
Copy link
Member

chaoren commented Sep 24, 2024

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

@meteorcloudy
Copy link

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

@chaoren
Copy link
Member

chaoren commented Sep 30, 2024

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.

@meteorcloudy
Copy link

/cc @ted-xie @ahumesky

@ahumesky
Copy link

ahumesky commented Oct 1, 2024

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

@chaoren
Copy link
Member

chaoren commented Oct 1, 2024

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.

@chaoren
Copy link
Member

chaoren commented Oct 1, 2024

@chaoren
Copy link
Member

chaoren commented Oct 1, 2024

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

@ahumesky
Copy link

ahumesky commented Oct 1, 2024

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

@cpovirk
Copy link
Member

cpovirk commented Oct 1, 2024

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 type=other Miscellaneous activities not covered by other type= labels
Projects
None yet
Development

No branches or pull requests

5 participants