-
Notifications
You must be signed in to change notification settings - Fork 180
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
feature request: Create common rule for symlinking #248
Comments
I have some reservations about this. I don't have time to do a deep explanation this week, so I'm just asking questions about the need and the PR you sent. Because knowing the needs is important to evaluate the PR. why does someone need a symlink?
If we only are doing this to rename in a performant way, why can't we make this a If we are doing this to define packaging structures, then I don't think we want to build the symlinks. We want package rules that describe the need for the symlink, and the packager gets to pick what it builds. For example, it is reasonable for a developer with remote build to have a windows host, but build a tarball that contains a symlink. |
The purpose of this new rule is to have a faster way to give a file a new name. The reason why we need to make files available under different names is that some tools unfortunately behave differently depending on their name (e.g. I'm not sure what you mean with naked symlinks. Are you talking about the experimental unresolved symlinks in Bazel which allow creating symlinks which point to arbitrary strings (bazelbuild/bazel#10298)? If so, then, at this moment, I don't have any intention in supporting them in the For the actual implementation, I think you may not yet be aware of the brand-new |
Thanks. The use case makes things much clearer. If you want it for speed, let's make a rule name that declares that intent, something like 'lightweight_copy. Of course, that name is ugly, but the point is that we hint that it is less resource consumptive and that does not mean "always a symlnk". Or maybe this could just be a parameter to copy_file, like "allow_fast_copy". By naked, I did mean dangling. I'm aware of the symlink action. My intent is that the rule name here does not make people believe they are getting deep properties of a symlink. I've been working on packaging rules a lot lately, and there, the symlink-ness property does matter. That is, if the rule says symlink and you are building a zip file from windows and expect the symlink to be created in the zip file, you would be disappointed. But if the rule as called lightweight_copy I would not have that expectation. Does that make sense to you? |
Thanks! Yeah, that makes sense. I'm leaning more towards a parameter on |
Sounds good to me. |
This change adds a new parameter `allow_symlinks` to `copy_file` that allows the action to create a symlink instead of doing an expensive copy if the execution platform (host) allows it. Updates bazelbuild#248
* copy_file: Add parameter to allow symlinks This change adds a new parameter `allow_symlinks` to `copy_file` that allows the action to create a symlink instead of doing an expensive copy if the execution platform (host) allows it. Updates #248 * Update docs * Refactor `is_executable` into attribute * Fix typo * s/_impl/_copy_file_impl/
I believe this issue is closed by #252? |
It would be great if skylib had a rule similar to
copy_file
that, instead of manually copying the file, usesctx.actions.symlink
(since Bazel 3.2).This could be either implemented as a new rule (
symlink_file
?), or as attribute ofcopy_file
(which could potentially become the default behavior in the future).The text was updated successfully, but these errors were encountered: