Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't propagate compatible_with to the underlying cargo_build_script rust_binary target #1754

Merged
merged 3 commits into from
Jan 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address comments
scentini committed Jan 5, 2023
commit 3ea0ba80050225d2ac9f146ef6da0fb992086b34
11 changes: 8 additions & 3 deletions cargo/private/cargo_build_script_wrapper.bzl
Original file line number Diff line number Diff line change
@@ -94,7 +94,10 @@ def cargo_build_script(
rustc_flags (list, optional): List of compiler flags passed to `rustc`.
visibility (list of label, optional): Visibility to apply to the generated build script output.
tags: (list of str, optional): Tags to apply to the generated build script output.
**kwargs: Forwards to the underlying `rust_binary` rule.
**kwargs: Forwards to the underlying `rust_binary` rule. An exception is the `compatible_with`
attribute, which shouldn't be forwarded to the `rust_binary`, as the `rust_binary` is only
built and used in `exec` mode. We propagate the `compatible_with` attribute to the `_build_scirpt_run`
target.
"""

# This duplicates the code in _cargo_build_script_impl because we need to make these
@@ -111,8 +114,10 @@ def cargo_build_script(
if "manual" not in binary_tags:
binary_tags.append("manual")
build_script_kwargs = {}
binary_kwargs = kwargs
if "compatible_with" in kwargs:
krasimirgg marked this conversation as resolved.
Show resolved Hide resolved
build_script_kwargs["compatible_with"] = kwargs.pop("compatible_with")
build_script_kwargs["compatible_with"] = kwargs["compatible_with"]
binary_kwargs.pop("compatible_with")

rust_binary(
name = name + "_",
@@ -123,7 +128,7 @@ def cargo_build_script(
rustc_env = rustc_env,
rustc_flags = rustc_flags,
tags = binary_tags,
**kwargs
**binary_kwargs
)
_build_script_run(
name = name,