Skip to content

Support output group in copy_file #609

@joca-bt

Description

@joca-bt

Copying a file generated by an output group is not supported, requiring custom rules or workarounds.

Could you consider adding an optional argument output_group to copy_file?

For example, this is our local copy_file implementation:

def _copy_file_impl(name, src, out, output_group, visibility):
    _filegroup = "{}-filegroup".format(name)

    native.filegroup(
        name = _filegroup,
        srcs = [src],
        output_group = output_group,
    )

    native.genrule(
        name = name,
        cmd = "cp $< $@",
        srcs = [_filegroup],
        outs = [out],
        visibility = visibility,
    )

copy_file = macro(
    implementation = _copy_file_impl,
    attrs = {
        "src": attr.label(
            mandatory = True,
            configurable = False,
        ),
        "out": attr.label(
            mandatory = True,
            configurable = False,
        ),
        "output_group": attr.string(
            mandatory = True,
            configurable = False,
        ),
    },
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions