Skip to content

Commit d69abcd

Browse files
committed
fix: spill module mapping args to a file
1 parent bb6249b commit d69abcd

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ Unreleased changes template.
5959
* (pypi) The `ppc64le` is now pointing to the right target in the `platforms` package.
6060
* (gazelle) No longer incorrectly merge `py_binary` targets during partial updates in
6161
`file` generation mode. Fixed in [#2619](https://github.com/bazelbuild/rules_python/pull/2619).
62+
* (gazelle) Don't collapse depsets to a list or into args when generating the modules mapping file.
63+
Support spilling modules mapping args into a params file.
6264

6365
{#v0-0-0-added}
6466
### Added

gazelle/modules_mapping/def.bzl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,21 @@ module name doesn't match the wheel distribution name.
2525

2626
def _modules_mapping_impl(ctx):
2727
modules_mapping = ctx.actions.declare_file(ctx.attr.modules_mapping_name)
28-
args = ctx.actions.args()
2928
all_wheels = depset(
3029
[whl for whl in ctx.files.wheels],
3130
transitive = [dep[DefaultInfo].files for dep in ctx.attr.wheels] + [dep[DefaultInfo].data_runfiles.files for dep in ctx.attr.wheels],
3231
)
33-
args.add("--output_file", modules_mapping.path)
32+
33+
args = ctx.actions.args()
34+
args.use_param_file(param_file_arg = "@%s")
3435
if ctx.attr.include_stub_packages:
3536
args.add("--include_stub_packages")
37+
args.add("--output_file", modules_mapping)
3638
args.add_all("--exclude_patterns", ctx.attr.exclude_patterns)
37-
args.add_all("--wheels", [whl.path for whl in all_wheels.to_list()])
39+
args.add_all("--wheels", all_wheels)
40+
3841
ctx.actions.run(
39-
inputs = all_wheels.to_list(),
42+
inputs = all_wheels,
4043
outputs = [modules_mapping],
4144
executable = ctx.executable._generator,
4245
arguments = [args],

gazelle/modules_mapping/generator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def data_has_purelib_or_platlib(path):
152152
parser = argparse.ArgumentParser(
153153
prog="generator",
154154
description="Generates the modules mapping used by the Gazelle manifest.",
155+
fromfile_prefix_chars="@",
155156
)
156157
parser.add_argument("--output_file", type=str)
157158
parser.add_argument("--include_stub_packages", action="store_true")

0 commit comments

Comments
 (0)