-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
Ensure lockfile target exists before injecting a dependency to it. #17365
Ensure lockfile target exists before injecting a dependency to it. #17365
Conversation
@Eric-Arellano @stuhood ping |
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.
Hm, does this mean that if you have your repo in the wrong shape that we simply don't add the dependency at all on lockfile targets? That also seems broken.
What about your earlier idea to instead use an unambigous target name? If that's too hard to performantely check which target names already exist, then use some special value extremely unlikely to be claimed, like __resolve_my_resolve__
The issue was that we don't know the other targets at the time we need to pick our target name. Going with a very obtruse name to avoid a potential name collision feels.. not great. This fix avoids a real issue at the cost of not getting the benefit of this new feature, with the easy fix of adjusting either the conflicting target's name or the name of the resolve, or moving either the lockfile or the conflicting target to another path. (just to give a hint that there are more than one way to work around the issue presented in #17343) |
Maybe we log then a warning about the collision? And add this edge case to the On that note, would be good to use a rule_helper for DRY |
@Eric-Arellano @stuhood ping. I think we may want to pick this to 2.15.x as well. |
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.
Thank you.
This problem seems loosely related to the idea of "hygienic macros": i.e., that a macro should be able to define anonymous variables which can't collide with or pollute the original namespace. But I don't know how to do that and still have consumers later depend-on/find them... maybe by having the request for the syntethic target use something other than its name/address?
In any case: shipping to unblock the fix.
…17365) * Ensure lockfile target exists before injecting a dependency to it. * add feature toggle for python lockfiles targets. * Refactor requirement generators to use a common rule helper. * Warn when lockfile targets are being shadowed. * make ignored arg optional
…herry-pick of #17365) (#17505) Ensure lockfile target exists before injecting a dependency to it. (#17365) * Ensure lockfile target exists before injecting a dependency to it. * add feature toggle for python lockfiles targets. * Refactor requirement generators to use a common rule helper. * Warn when lockfile targets are being shadowed. * make ignored arg optional
Fixes #17343
Example warning message when the
_lockfiles
target is being shadowed: