bazelbuild / bazelbuild/bazel-skylib

Support output group in copy_file

Open
#609 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
444
Forks
202
PR merge metrics
No merged PRs in 30d

Description

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,
),
},
)
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the repository's copy_file implementation and compare its arguments with the requested optional output_group argument. Use the provided local implementation as the behavioral reference, then verify that copying a file generated by an output group works without custom rules or workarounds.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.