-
-
Notifications
You must be signed in to change notification settings - Fork 45
fix java.io.IOException: ... Argument list too long
during pex generation.
#543
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
base: main
Are you sure you want to change the base?
Conversation
…ng` during pex generation. In certain circumstance, a large number of `--source` args are passed to the `_pex` script which causes an IOException to be thrown by bazel. This refactors the rule to write the args to a file and pass that single path as an arg to the `_pex` script. The script then opens that file and feeds it into the arg parser instead. fixes aspect-build#542
|
I could add a new |
@@ -113,10 +113,18 @@ def _py_python_pex_impl(ctx): | |||
) | |||
args.add(output, format = "--output-file=%s") | |||
|
|||
# The argument list can become quite long which can throw java.io.IOException Argument list too long. | |||
# Instead write the args to a file and read that file at runtime | |||
args_file = ctx.actions.declare_file("args.txt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://bazel.build/rules/lib/builtins/Args.html#use_param_file is what you want here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can revert everything else on this by using args.use_param_file(use_always = True)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I hadn't seen that api before. I don't write rules often.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know when you make the changes, i'll review again.
In certain circumstance, a large number of
--source
args are passed to the_pex
script which causes an IOException to be thrown by bazel. This refactors the rule to write the args to a file and pass that single path as an arg to the_pex
script. The script then opens that file and feeds it into the arg parser instead.fixes #542
Test plan
py/tests/py-pex-binary