You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: correctly handle empty chdir on js_binary (#2815)
The `js_binary` rule has a `chdir` attribute, and it is common to set
`chdir = package_name()` to indicate that the binary should run under
the target bin directory in the subdirectory corresponding to the
current package.
The logic for this checks `if ctx.attr.chdir`, which is usually fine but
does not work correctly when the target is at the top level of an
external repo. In that case `package_name()` is empty, making `chdir`
falsy, but we do still need to change directories since the package is
in an external repo.
This change fixes that bug and adds a test verifying that the binary
runs in the expected working directory.
---
### 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_binary rule now correctly handles an empty chdir in a target in
an external repo.
### Test plan
- Covered by existing test cases
- New test cases added
0 commit comments