bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.21k stars 4.06k forks source link

Expose `action_configs` as an attr in cc_toolchain_config rules #21824

Open jondo2010 opened 7 months ago

jondo2010 commented 7 months ago

Description of the feature request:

The built-in cc_common.create_cc_toolchain_config_info() has an argument for action_configs.

The cc_toolchain_config rules in bazel_tools however don't expose this, and the only way to build a CC toolchain with customized action_args content is to write your own cc_toolchain_config rule.

It would be great if the cc_toolchain_config rules in bazel_tools simply exposed this as an optional attr to toolchain developers.

Which category does this issue belong to?

C++ Rules

What underlying problem are you trying to solve with this feature?

I am integrating GCC based toolchains from a commercial vendor that require network access to contact their license server.

When using Bazel sandboxing, network access is not permitted. It is possible to explicitly allow nework by tagging individual build targets with requires-network, but it is more robust to do this at the toolchain level using execution_requirements = ["requires-network"] in an action_config for each compile tool.

Which operating system are you running Bazel on?

6.5.0

What is the output of bazel info release?

6.5.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

jondo2010 commented 7 months ago

Quite happy to open a PR to add this if it would be accepted.

comius commented 7 months ago

I'm not absolutely sure which cc_toolchain_config you're talking about. There are several in bazel tools and in rules_cc. I'm not terribly familiar with the history of those. Our general direction is to move things out of build_tools into rules_cc (or other repos).

If you submit a PR, I'm inclined to accept it (but I'll only get more familiar with this parts of the code base once I see the changes you're making).