bazelbuild / bazelbuild/bazel

Allow setting `use_param_file` and `set_param_file_format` on frozen `action.args()` objects, or allow creating mutable copies of `args` objects

Open
#20,746 4 comments 0 reactions 0 assignees View on GitHub
not stale P4 team-Rules-CPP type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

When using [`Action.args`](https://bazel.build/rules/lib/builtins/Action#args) the returned `args` objects are frozen, and thus [`use_param_file`](https://bazel.build/rules/lib/builtins/Args.html#use_param_file) and [`set_param_file_format`](https://bazel.build/rules/lib/builtins/Args.html#set_param_file_format) can't be called on them. There should be a way to change the params file options for those objects, or better yet a way to make a mutable copy that we can set them on.

### Which category does this issue belong to?

_No response_

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

Some actions (e.g. `CppCompileAction`) return `args` objects without params file options set on them, even if the underlying action did have those options set on them. While for this exact action we can possibly use the experimental and undocumented `--experimental_use_cpp_compile_action_args_params_file` flag, other actions might not have set params file options. This is an issue when a shadowed action, or a new action created in an aspect, uses these args objects, since the command-line length can exceed OS limits.

### Which operating system are you running Bazel on?

macOS

### What is the output of `bazel info release`?

release 7.0.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 master; 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_

Contributor guide

Open the contributing guide

Research direction

Start with the Action.args entry point and the Args.use_param_file and Args.set_param_file_format APIs, then trace how CppCompileAction exposes its args and how --experimental_use_cpp_compile_action_args_params_file changes that behavior. Done means defining and documenting a supported way to configure parameter-file options on returned args objects without exceeding command-line limits for shadowed or aspect-created actions.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.