bazel-skylib icon indicating copy to clipboard operation
bazel-skylib copied to clipboard

copy_file doesn't work for directories

Open alexeagle opened this issue 2 years ago • 0 comments

There should be a way to copy directories, just like we copy files.

It would use ctx.actions.declare_directory so that Bazel tracks the result as a TreeArtifact.

We need this in rules_nodejs for example, because third-party packages are always on disk as directories, and globbing them as a bunch of files runs into filename restrictions (spaces in names) and is very non-performant (thousands of files to symlink into execroot/runfiles trees).

Another reasoning for this: RBE doesn't allow InputArtifacts that are directories (see @ulfjack's note on https://github.com/bazelbuild/bazel/commit/c64421bc35214f0414e4f4226cc953e8c55fa0d2) so it's necessary to copy them as TreeArtifacts to use them in remote-compatible actions.

alexeagle avatar Oct 09 '21 18:10 alexeagle