Commit f10e4fa
authored
fix: correctly handle an empty chdir argument on js_run_binary (#2817)
The `js_run_binary` macro has a `chdir` parameter for determining the
working directory where the target should run, and this should take
precedence over the `chdir` attribute on the underlying `js_binary`.
Currently this does not work correctly if you set `chdir =
package_name()` on a `js_run_binary` at the top level of a repo, because
in that case `chdir` is the empty string and it is ignored. This change
fixes that problem by having the macro make a distinction between `None`
and the empty string, and if `chdir` is empty then we replace it with a
dot so that it represents the top-level package.
This does for `js_run_binary` what 7d28f8e recently did for `js_binary`
and `js_test`.
---
### Changes are visible to end-users: yes
- Searched for relevant documentation and updated as needed: yes
- Breaking change (forces users to change their own code or config): no
- Suggested release notes appear below: yes
The `js_run_binary` macro now correctly handles an empty string for
`chdir`.
### Test plan
- Covered by existing test cases
- New test cases added1 parent 19955f0 commit f10e4fa
2 files changed
Lines changed: 27 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
10 | 35 | | |
11 | 36 | | |
12 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
298 | | - | |
| 297 | + | |
| 298 | + | |
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| |||
0 commit comments