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

Buildozer: changing attributes in override functions of MODULE.bazel #1218

Open
linzhp opened this issue Nov 13, 2023 · 6 comments
Open

Buildozer: changing attributes in override functions of MODULE.bazel #1218

linzhp opened this issue Nov 13, 2023 · 6 comments

Comments

@linzhp
Copy link
Contributor

linzhp commented Nov 13, 2023

Buildozer is not able to recognize the functions with module_name in MODULE.bazel file. So buildozer print //MODULE.bazel:all would print something like:

main module
rules_python bazel_dep
rules_python_gazelle_plugin bazel_dep
gazelle bazel_dep
hermetic_cc_toolchain bazel_dep
bazel_skylib bazel_dep
rules_proto_grpc bazel_dep
 archive_override
rules_proto_grpc_python bazel_dep
 archive_override

Note that the archive_override doesn't have name. So we can't update them from command line.

We can follow the convention of Bazel to create a target rules_proto_grpc~override when Buildozer sees a *_override rule with module_name = "rules_proto_grpc".

@tyler-french
Copy link
Contributor

We may want to consider having a different attr marked as the "identifier" for different rule kinds.

For example, with gazelle overrides, we use path as the identifier.

That way these could be identifiable:

go_deps.from_file
 go_deps.gazelle_override
 go_deps.gazelle_override
 go_deps.gazelle_override
 go_deps.gazelle_override
 go_deps.gazelle_override
 go_deps.gazelle_override
 go_deps.gazelle_override
 go_deps.gazelle_override
 go_deps.gazelle_override
 go_deps.gazelle_override
 go_deps.gazelle_override
 go_deps.module_override
 go_deps.module_override
 go_deps.module_override
 go_deps.module_override
 go_deps.module_override
 go_deps.module_override
 go_deps.module
 go_deps.archive_override
 go_deps.module
 go_deps.archive_override
 go_deps.module
 go_deps.archive_override

@fmeum
Copy link
Contributor

fmeum commented Nov 14, 2023

I think we want new buildozer syntax here, maybe //some/pkg:some_attr=foo?

@linzhp
Copy link
Contributor Author

linzhp commented Nov 14, 2023

Do we need new syntax? I was thinking buildozer "set some_attr foo" //MODULE.bazel:rules_proto_grpc~override. Does that work?

@fmeum
Copy link
Contributor

fmeum commented Nov 15, 2023

That feels quite magic and ties Buildozer to an implementation detail of Bazel (canonical repository names). It also doesn't allow specifying extension tags such as go_deps.gazelle_override, which can be combined with other overrides.

@linzhp
Copy link
Contributor Author

linzhp commented Nov 15, 2023

are you suggesting something like buildozer "set some_attr foo" //MODULE.bazel:path=golang.org/x/tools

@fmeum
Copy link
Contributor

fmeum commented Nov 16, 2023

are you suggesting something like buildozer "set some_attr foo" //MODULE.bazel:path=golang.org/x/tools

Yes, exactly that, where :name=foo would match the current behavior. There could be other syntax for this, but the functionality of matching by a custom attribute is the extension I would like best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants