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

copy_to_directory includes all files as runfiles #748

Closed
dieortin opened this issue Feb 6, 2024 · 3 comments · Fixed by #886
Closed

copy_to_directory includes all files as runfiles #748

dieortin opened this issue Feb 6, 2024 · 3 comments · Fixed by #886
Assignees
Labels
bug Something isn't working

Comments

@dieortin
Copy link

dieortin commented Feb 6, 2024

What happened?

When I use copy_to_directory in any step of my build, all copied files get included into archives generated with pkg_tar and include_runfiles=True. This makes it so, in addition to our binaries, we also get source files in the archive.
This is because all files are added to the runfiles member of DefaultInfo: https://github.com/aspect-build/bazel-lib/blob/71a80525891942267bf1335d830652a0115dcfce/lib/private/copy_to_directory.bzl#L294C28-L294C36

Would it be possible to add an attribute to control whether files are added to runfiles or not?

Version

Development (host) and target OS/architectures: SUSE SLE RT 15 SP4

Output of bazel --version: bazel 6.5.0

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file: 1.37.0

Language(s) and/or frameworks involved:

How to reproduce

No response

Any other information?

No response

@dieortin dieortin added the bug Something isn't working label Feb 6, 2024
@github-actions github-actions bot added the untriaged Requires traige label Feb 6, 2024
@alexeagle alexeagle removed the untriaged Requires traige label Feb 8, 2024
@alexeagle
Copy link
Collaborator

I could imagine introducing a data attribute next to srcs, but it would be a breaking change to stop including the srcs in runfiles so I'm not sure that's feasible.

@dieortin
Copy link
Author

dieortin commented Feb 8, 2024

That’s a good idea.
Our current workaround is to have a custom rule that removes all runfiles from a target (we’re copying only C++ source files in our case)

@dieortin
Copy link
Author

dieortin commented Feb 8, 2024

What about adding an attribute that does not add to runfiles? That would make the change non-breaking, although I’m not sure about naming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants