Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

bzlmod: should I use repo_name or not in bazel_dep?

31 views
Skip to first unread message

Ming Zhao

unread,
Aug 26, 2024, 10:02:53 AM8/26/24
to bazel-discuss
First, bzlmod is great! It significantly reduces the amount of boilerplate to use external dependencies. 

One confusion I have is a lot of modules defined in the registry usually have different names than their original repo_name that was referred using the WORKSPACE.

For example:

I would use bazel_dep(name = "rules_go", version = "0.48.0")
to pull golang build rules, and reference it in the BUILD file using @rules_go.

However, previously they are usually declared as below and referred as io_bazel_rules_go

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "e6a6c016b0663e06fa5fccf1cd8152eab8aa8180c583ec20c872f4f9953a7ac5",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.22.1/rules_go-v0.22.1.tar.gz",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.22.1/rules_go-v0.22.1.tar.gz",
    ],
)

The question: should I continue adding repo_name = "io_bazel_rules_go" to the bazel_dep directive, or take the chance to update the reference, to just have a single name to refer one unit?

Xudong Yang

unread,
Aug 27, 2024, 2:16:56 AM8/27/24
to Ming Zhao, bazel-discuss
It doesn't really matter; the usage of `repo_name` is local to your module only, and invisible to any other module. You can call it whatever you want. If you want to take this chance to align your references, that's fine too.

--
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/CAN0GiO12zi5zuwUngGS2bAL%3D-FgqXPO8bzHFZvhy1xpw6EidLg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages