Add use_param_file c++ feature as a replacement for controlling param files #20890
Labels
P3
We're not considering working on this, but happy to review a PR. (No assignee)
team-Rules-CPP
Issues for C++ rules
type: feature request
Description of the feature request:
If the
use_param_file
feature will be enabled for a given action then bazel will pass parameters through a param file. Param file name will be available throughparam_file
build variable which toolchain config will need to handle in flag_set.This way one will be able to selectively use param files for applicable actions, and pass param file in toolchain specific way.
Currently available support requires one to specify
supports_param_files
toolchain parameter, remember to enablearchive_param_file
feature and enablecompiler_param_file
feature to support param files in most actions. Also, linker param files are handled differently (through linker_param_file build variable), than compile param file for which handling is hardcoded to always use @ name.Which category does this issue belong to?
C++/Objective-C Rules
What underlying problem are you trying to solve with this feature?
Param files are used to overcome limits of commandline argument length. It's especially important for windows which has much tighter requirements. Providing simpler solution than current will be more flexible by allowing per action selection whether param file is enabled, more consistent by using feature for all actions, and hopefully less error prone due to that.
It will replace current knobs:
cc_toolchain.supports_param_files
- enables param files for linking actions. If enabled, param file is available throughlinker_param_file
build variable.archive_param_file
(added in bff9730) - enables param files for static linking actions, applicable only ifsupports_param_files
is also setcompiler_param_file
(added in df3d8cb) - enables param files for compile actions. If enabled then bazel unconditionally adds@<param-file>
flag to command line (code)Which operating system are you running Bazel on?
linux, bazel
What is the output of
bazel info release
?6.4
If
bazel info release
returnsdevelopment 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?
Generic bug with some comments where users discovered which features to use:
#17068 - Bazel 6.0.0 upgrade not possible due to "command is longer than CreateProcessW's limit (32767 characters)
Bugs related to passing param file as argument:
#16168 - compiler_param_file does not use custom flag prefix from "flag_groups"
(fixed) #18074 - linker_param_file only added to command line if it starts with "@"
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: