Skip to content

cc_binary can't be passed to inherit_attrs #505

@isus-ipanienko

Description

@isus-ipanienko

I want to wrap cc_binary in macros to select a different compiler for multiple binaries. I came up with this which works perfectly with native cc_binary.

def _wrap_impl(name, **kwargs):
    cc_binary(
        name = name,
        **kwargs,
    )

    _transition_to_clang(
        name = name + "_transition",
        binary = name,
    )

cc_wrap = macro(
    inherit_attrs = native.cc_binary,
    implementation = _wrap_impl,
)

When I change native.cc_binary to cc_binary from rules_cc, I get an error since the latter is exported as a function instead of a rule, contrary to what the cc_binary docstring in rules_cc/cc/cc_binary.bzl states.

Metadata

Metadata

Assignees

No one assigned

    Labels

    untriagedTeam member has to triage this issue - assign priority, type, and owner (if possible).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions