bazel-skylib
bazel-skylib copied to clipboard
Support custom `mnemonic` and `progress_message`
Adds support for adding a custom mnemonic and progress_message for copy_file, copy_directory and run_binary rules.
Addresses #489 and #426
cc @brandjon
Setting mnemonics from targets is something we had huge problems with internally.
cc @brandjon
Setting mnemonics from targets is something we had huge problems with internally.
Does this impact the inclusion of this change or can you restrict the use of the attributes internally?
Setting mnemonics from targets is something we had huge problems with internally.
Does this impact the inclusion of this change or can you restrict the use of the attributes internally?
We can't restrict them internally - we only monitor them :(.
The attributes should be restricted in Bazel and this would be a very welcome contribution. The idea is, that ctx.actions.run(mnemonic) can only be set to a literal string. This way you can still use your own mnemonics, but you're more limited and you can't do for i in range(10000000): my_macro(mnemonic=i). (Creating 1M different mnemonics happened to us). Technically Starlark already has a bag of all the literals, because it's interning them. One would need to check that mnemonics is in that bag.
This PR is acceptable after the PR in Bazel.
Thanks @comius for the context. I opened https://github.com/bazelbuild/bazel/issues/23575 on the Bazel side.