Skip to content

Commit

Permalink
Use param files to invoke process_target.py
Browse files Browse the repository at this point in the history
Without a param file invocations fail with "Argument list too long" when run
on larger projects.
  • Loading branch information
mrkkrp authored and martis42 committed Sep 4, 2024
1 parent 2d7a82c commit bc5bd28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/aspect/dwyu.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ def _process_target(ctx, target, defines, output_path, is_target_under_inspectio
if verbose:
args.add("--verbose")

args.set_param_file_format("multiline")
args.use_param_file("--param_file=%s", use_always = True)

ctx.actions.run(
inputs = header_files,
executable = ctx.executable._process_target,
Expand Down
6 changes: 5 additions & 1 deletion src/aspect/process_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ def cli() -> Namespace:
)
parser.add_argument("--verbose", action="store_true", help="Print debugging output")

args = parser.parse_args()
if len(sys.argv) == 2 and sys.argv[1].startswith("--param_file="):
param_file = Path(sys.argv[1][len("--param_file=") :])
args = parser.parse_args(param_file.read_text().splitlines())
else:
args = parser.parse_args()
if args.verbose:
logging.getLogger().setLevel(logging.DEBUG)

Expand Down

0 comments on commit bc5bd28

Please sign in to comment.