-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why does ctx.actions.args.param_file_arg accept a constant argument #10616
Comments
The argument needs to contain |
What do these options mean? Are they documented? I’m not trying to troll but I honestly don’t understand the API choice here |
The question is: what does the tool you're calling expect? If it's just the filename, then pass "%s". For gcc and clang, the tool expects "@%s". The '%s' substring is replaced with the filename, so for gcc, the invocation is actually "gcc @param-file". Does that make sense? In some cases Bazel decides whether to use a param file on-the-fly depending on the actual size of the command line. I'm not sure if this API exposes that or if it can be controlled. Note that there is a Bazel build command-line flag to force it to always use param files. |
No worries, it just shows that the documentation needs improvement and examples. If you take $ gcc hello.c -c To use a params file, you will do instead:
That's gcc command-line syntax. To pass a param file, you need to put So when you want to use a param file, you tell Bazel how to pass the argument to the tool, such as |
Thank you both for explaining! |
It seems that I think it's better not to have a default value. The user should really check with the tool is expecting. I'll keep this issue open as a documentation problem. |
SGTM. Thanks for the clarifications. |
Description of the problem / feature request:
I'm now using
ctx.actions.args.param_file_arg
and U don't understand why we need to pass a constant argument ("%s"
). If it's constant why not hide it from the user?What's the output of
bazel info release
?2.0.0
Have you found anything relevant by searching the web?
https://docs.bazel.build/versions/master/skylark/lib/Args.html#use_param_file
The text was updated successfully, but these errors were encountered: