buildtools icon indicating copy to clipboard operation
buildtools copied to clipboard

Support editing `archive_override`s in MODULE.bazel with buildozer

Open keith opened this issue 2 years ago • 1 comments

If you have a MODULE.bazel with something like:

archive_override(
    module_name = "apple_support",
    integrity = "sha256-O5jDzs0Q/DAfEGMWsZn1jBQ7VIQ0aQjgAUPl/skjIv4=",
    strip_prefix = "apple_support-65d28246a1b6d4f98549b364d8d5cf3cefe9758c",
    urls = [
        "https://github.com/bazelbuild/apple_support/archive/65d28246a1b6d4f98549b364d8d5cf3cefe9758c.tar.gz",
    ],
)

bazel_dep(name = "apple_support", version = "1.3.2", repo_name = "build_bazel_apple_support")

You can inspect the archive_overrides by specifying that rule type:

% buildozer 'print module_name' MODULE.bazel:%archive_override
apple_support

But if you try to print a label, it prints nothing, same with if you try to print a name. Because of this I don't think there's a way to single out a specific archive_override to automate changing properties of it?

keith avatar Jan 19 '23 22:01 keith

I also ran into this. You can either use :%<line_no> to specify a particular archive_override or temporarily rename module_name to name on :%archive_override, then reference it like a regular rule, then rename back.

fmeum avatar Mar 17 '23 14:03 fmeum