bazel-skylib icon indicating copy to clipboard operation
bazel-skylib copied to clipboard

Support custom `mnemonic` and `progress_message`

Open joshua-k-harris opened this issue 1 year ago • 4 comments
trafficstars

Adds support for adding a custom mnemonic and progress_message for copy_file, copy_directory and run_binary rules.

Addresses #489 and #426

joshua-k-harris avatar Mar 06 '24 10:03 joshua-k-harris

cc @brandjon

Setting mnemonics from targets is something we had huge problems with internally.

comius avatar Mar 14 '24 17:03 comius

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?

joshua-k-harris avatar Mar 18 '24 15:03 joshua-k-harris

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.

comius avatar Jul 12 '24 20:07 comius

Thanks @comius for the context. I opened https://github.com/bazelbuild/bazel/issues/23575 on the Bazel side.

sitaktif avatar Sep 10 '24 09:09 sitaktif