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 committed Aug 23, 2024
1 parent d7de68f commit dfa8311
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 @@ -45,6 +45,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 dfa8311

Please sign in to comment.