-
-
Notifications
You must be signed in to change notification settings - Fork 676
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
allow patching to stdlib #3670
allow patching to stdlib #3670
Conversation
From a usability perspective, do we want to allow patching on |
go/private/sdk.bzl
Outdated
@@ -149,6 +149,7 @@ go_download_sdk_rule = repository_rule( | |||
"_sdk_build_file": attr.label( | |||
default = Label("//go/private:BUILD.sdk.bazel"), | |||
), | |||
"patches": attr.label_list(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add patches
, we should also add patch_prefix
. Could you add that and move these attributes above the implicit _sdk_build_file
attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the meaning of patch_prefix
. Could you explain it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that, the attribute I suggested doesn't exist. What I really meant is patch_args
(see the same attribute on http_archive
), which can be used to set the length of the segment that should be stripped from patch paths via -p
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have moved attributes to _sdk_build_file
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all done @fmeum
cc45410
to
16011d7
Compare
Sorry, I just forgot about this PR! |
I created #3698 because I couldn't figure out how to update this PR. I think the only change I made was to remove |
@hunshcn FYI the difference between the two PRs was that #3684 was intended for the Bzlmod extension, whereas this one is focused on Let me know what you think @fmeum! |
@tyler-french i think the usage of patch_args in this patch function should be similar to the patch_args in go_repository. https://github.com/bazelbuild/bazel-gazelle/blob/master/repository.md#go_repository Since this pr is for the workspace, it can be merged only by resolving the conflict, but the parameter form of patch_args needs to be discussed. @fmeum |
We should be as restrictive as possible since we will need to maintain all uses in the long term. It seems a bit improper to allow
I think it would be best to limit the users rather than follow this design pattern. FWIW We also need to maintain this into the future, and being more restricted here makes it more maintainable since we know the user can only modify the strip. To help with this, I removed the Also, do you have examples for usage of the However, I am happy to go in either direction. Maybe @linzhp if you have any opinions. |
I agree that there is no need to allow allow local_sdk and wrap_sdk to patch the SDK:
With regards to the patch attributes, I don't have strong opinion on either direction. On one hand, they are consistent with http_archive in WORKSPACE; on the other hand, bzlmod prefers more restrictive attributes like |
Api consistency is a very important thing, should not be broken. |
92b2b57
to
90fd788
Compare
@fmeum action need |
I took some time to think this through:
|
So your suggestion is not to merge and keep the status quo, right? |
That also depends on your original motivation to propose this change. I would like to learn more about your use case and which change would allow you to do something that otherwise wouldn't be possible. For example, it would be interesting to see whether the indirection through |
actually,
Actually, I originally just wanted to add the patch capability to go_download_sdk 461EBCC. At your suggestion (add patch_prefix and move to _sdk_build_file), I modified the implementation. But #3684 was merged, which I don't think is in line with the initial discussion. At the same time, it is not elegant for the api usage in WORKSPACE (patch_strip, even this is int) |
What type of PR is this?
Bug fix
What does this PR do? Why is it needed?
allow patching to stdlib. maybe a unreleased bug fix
Which issues(s) does this PR fix?
None
Other notes for review