Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Bazel in Disconnected Environment

23 views
Skip to first unread message

Eric Stoces

unread,
Oct 2, 2024, 8:02:18 AM10/2/24
to bazel-discuss
I am trying to use Bazel in a disconnected environment. I cloned the bazel-central-repository and am hosting it in a remote in that environment. How do I use it using the new dependency model (MODULE.bazel)?

I am using use_extension(), git_repository(), but it still tried to get it from https://bcr.bazle.build. ChatGPT told me to use local_repository() to tell Bazel where the repo is. Is this correct? How do I specify a path that is user dependent? Is this the correct way to use a cloned BCR repo?

Below is my MODULE.bazel file.

------------------------------------------------------------------------------------------------------------------------ # MODULE.bazel
module(name = "hello-world")
# Declare the dependency
bazel_dep(name = "rules_cc", version = "0.0.10") # Use the extension to define the repository git_repo_extension = use_extension("@rules_cc//:defs.bzl", "git_repository") # Define the git repository using the extension git_repo_extension.git_repository( name = "hosted_bcr", remote = "http://my_gitlab/PF/bazel-central-registry.git", branch = "feature/pf-43042", # commit = "<commit_sha>" # specify commit SHA if needed )

#Define the local repository local_repository( name = "rules_cc", path = "/???where_is_this???/rules_cc", )


David Turner

unread,
Oct 2, 2024, 9:10:37 AM10/2/24
to Eric Stoces, bazel-discuss
Hello Eric, have you tried using the `--registry=` option when invoking Bazel. See https://stackoverflow.com/questions/76877026/use-bzlmod-with-registry-on-local-file-system

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/d7401f72-4639-461e-9280-6fd390dcf612n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages