Commit 0dd018b
authored
feat(whl_install): enable path mapping for remote cache deduplication (#906)
## Summary
Adds `supports-path-mapping: "1"` to the `WhlInstall` action, allowing
remote build systems to deduplicate wheel installation actions across
configurations that differ only in their config segment (e.g. different
`--compilation_mode` values that don't affect installed wheel content).
Path mapping requires that file arguments are passed as `File` objects
to `ctx.actions.args` rather than `.path` strings — Bazel cannot rewrite
string literals when computing the remote cache key. This PR switches
all file arguments accordingly:
- `install_dir` and `archive` passed as `File` objects via `args.add()`
- Patch files switched from `for f in patch_files: args.add("--patch",
f.path)` to `args.add_all(patch_files, before_each = "--patch")`
- `exec_runtime.interpreter` was already passed as a `File` object
Also adds `mnemonic = "WhlInstall"` for clearer identification in build
output and remote cache tooling.
## Compatibility
`supports-path-mapping` is a no-op unless the user opts in with
`--experimental_output_paths=strip`, so this is safe for all existing
users.
The known Bazel tree-artifact + path-mapping bug
(bazelbuild/bazel#23681) was specific to C++ header discovery and was
fixed in Bazel 7.4.0. There are no known issues with `declare_directory`
outputs in Starlark actions.
One edge case to be aware of: Bazel silently produces wrong results when
a path-mapped action runs under a local/unsandboxed execution strategy
(bazelbuild/bazel#28910). Users who override
`--strategy=WhlInstall=local` should not use
`--experimental_output_paths=strip`.
## Test plan
- [x] Existing e2e suite passes (patching, compile_pyc, crossbuild
tests)1 parent 8efcc57 commit 0dd018b
2 files changed
Lines changed: 30 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
33 | 38 | | |
34 | | - | |
35 | | - | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
| |||
100 | 108 | | |
101 | 109 | | |
102 | 110 | | |
103 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
104 | 115 | | |
105 | 116 | | |
106 | 117 | | |
| |||
0 commit comments