bazelbuild / bazelbuild/bazel

feature request: repository_ctx.copy

Open
#11,858 7 comments 0 reactions 0 assignees View on GitHub
not stale P2 team-ExternalDeps type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the problem / feature request:

I'd like a `repository_ctx.copy` function, to copy file. I'm currently using `repository_ctx.template`, but that's an abuse of the API and it does not work with binariy files: #11857

### Feature requests: what underlying problem are you trying to solve with this feature?

Coping file in repository rules. I can use `execute(["cp", ...)`, but a `copy` api can be more convenient and more robust as it does not depend on the availability of a `cp` command.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing repository_ctx.template implementation and the repository-rules context it uses. Confirm how binary files are currently handled, then define the copy API's behavior and tests around copying files without relying on an external cp command.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.