-
Notifications
You must be signed in to change notification settings - Fork 559
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Propagate testonly et al for wheel
.dist
targets (#1064)
* Propagate testonly et al for wheel `.dist` targets The `.dist` target depends on the wheel, so it must copy the `testonly` setting as well as some others. * Also adds a utility function to do this, since the multi-version rules also do this copying. Fixes #1057 * fixup! Allow building with unreleased Bazel versions. (#1063)
- Loading branch information
Showing
5 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""Functionality shared by multiple pieces of code.""" | ||
|
||
def copy_propagating_kwargs(from_kwargs, into_kwargs = None): | ||
"""Copies args that must be compatible between two targets with a dependency relationship. | ||
This is intended for when one target depends on another, so they must have | ||
compatible settings such as `testonly` and `compatible_with`. This usually | ||
happens when a macro generates multiple targets, some of which depend | ||
on one another, so their settings must be compatible. | ||
Args: | ||
from_kwargs: keyword args dict whose common kwarg will be copied. | ||
into_kwargs: optional keyword args dict that the values from `from_kwargs` | ||
will be copied into. The values in this dict will take precedence | ||
over the ones in `from_kwargs` (i.e., if this has `testonly` already | ||
set, then it won't be overwritten). | ||
NOTE: THIS WILL BE MODIFIED IN-PLACE. | ||
Returns: | ||
Keyword args to use for the depender target derived from the dependency | ||
target. If `into_kwargs` was passed in, then that same object is | ||
returned; this is to facilitate easy `**` expansion. | ||
""" | ||
if into_kwargs == None: | ||
into_kwargs = {} | ||
|
||
# Include tags because people generally expect tags to propagate. | ||
for attr in ("testonly", "tags", "compatible_with", "restricted_to"): | ||
if attr in from_kwargs and attr not in into_kwargs: | ||
into_kwargs[attr] = from_kwargs[attr] | ||
return into_kwargs |