-
-
Notifications
You must be signed in to change notification settings - Fork 694
Use symlink instead of changing output path #4348
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
base: master
Are you sure you want to change the base?
Conversation
a2138a3
to
6e35c5c
Compare
and create a symlink if "out" is specified. This reduces cache invalidation on mode changes.
This reduces duplication.
6e35c5c
to
3295db9
Compare
I generally like this change, I just want to make sure we get the defaults right without breaking anyone too much.
Could you explain what kind of problems this could cause?
I wonder whether we could unconditionally create the symlink, but when CC @jayconrod |
Only when explicitly setting
I only tried to reconstruct past issues starting from the linked #2466 which introduced the current behavior.
Unconditionally creating the symlink would be my preferred approach. I am not sure if I fully understand what you are proposing, but when I tried to always create the symlink without introducing |
@mering Could you please create an issue describing what you want to do? It would be better to discuss the change in behavior before we get to the implementation. Some concerns:
I wonder if a better solution for #2463 would have been for Gazelle to set |
Created #4350.
I know that for runfiles and for
IIUC bazel rules should correctly resolve the symlinks.
This is referring to the warning in the previous docstring of the
I would like to avoid having to specify the value of
Yes, |
Thanks for creating #4350, let's move discussion there. |
What type of PR is this?
What does this PR do? Why is it needed?
Always write the binary to the mode specific directory. Create a symlink when
out
is specified. This reduces cache invalidation.The output path is determined via
rules_go/go/private/actions/binary.bzl
Line 55 in cd29704
rules_go/go/private/context.bzl
Lines 147 to 161 in cd29704
This means for a
go_binary
target//path/to:target
it would bepath/to/target_/target
instead of the exptected/path/to/target
. This behavior was introduced in #2466.In most of the cases, the old behavior is expected (most rules create a file matching the rule name). Only when using Gazelle where one doesn't have direct control, this can cause problems. This change introduces an additional attribute to explicitly opt back into having the binary available at the expected path by creating a symlink without duplicating the target
name
asout
.In the future this could be explicitly set to
False
by Gazelle and then default toTrue
to align better with user expectations while still working around issues with auto-generated targets.Which issues(s) does this PR fix?
Other notes for review