-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fix Incompatible Target Skipping for test args #13219
Fix Incompatible Target Skipping for test args #13219
Conversation
@gregestren , FYI. |
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.
Nice catch! Overall looks great. Just one quick comment request.
@@ -453,6 +453,20 @@ public static RunfilesSupport withExecutable( | |||
computeActionEnvironment(ruleContext)); | |||
} | |||
|
|||
/** | |||
* Creates and returns a {@link RunfilesSupport} object for the given rule and executable. This | |||
* version discards all arguments. Only use this for Incompatible Target Skipping. |
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.
Can you link this more precisely to a specific file or source javadoc?
This comment comes from the hard-learned lesson that even specific concepts can be fuzzy to devs who haven't focused specifically on them. Precise links are always great for that.
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 can't verify that the link renders correctly, but I added a link to https://docs.bazel.build/versions/master/platforms.html#skipping-incompatible-targets
Would you prefer a link to the site/docs/platforms.md
file instead?
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.
That's fine, thanks. Just anything to connect the breadcrumbs.
Before the fix the test in this patch would error out with the following message: ERROR: ...: in args attribute of sh_test rule //target_skipping:foo_test: label '//target_skipping:some_foo3_target' in $(location) expression expands to no files The problem was that the `RunfilesSupport` class for the `RunfilesProvider` instance was computing the arguments as the incompatible target was being constructed. That meant that the arguments get evaluated and it would try to resolve things like `$(location :incompatible_dep)`. That can't really succeed so bazel would throw an error. This patch makes it so arguments are ignored when constructing an incompatible target.
3d0f99d
to
ea86bf5
Compare
Before the fix, the test in this patch would error out with the following message: ERROR: ...: in args attribute of sh_test rule //target_skipping:foo_test: label '//target_skipping:some_foo3_target' in $(location) expression expands to no files The problem was that the `RunfilesSupport` class for the `RunfilesProvider` instance was computing the arguments as the incompatible target was being constructed. That meant that the arguments get evaluated and it would try to resolve things like `$(location :incompatible_dep)`. That can't really succeed so bazel would throw an error. This patch makes it so arguments are ignored when constructing an incompatible target. Closes #13219. PiperOrigin-RevId: 363233765
Before the fix, the test in this patch would error out with the
following message:
The problem was that the
RunfilesSupport
class for theRunfilesProvider
instance was computing the arguments as theincompatible target was being constructed. That meant that the
arguments get evaluated and it would try to resolve things like
$(location :incompatible_dep)
. That can't really succeed so bazelwould throw an error.
This patch makes it so arguments are ignored when constructing an
incompatible target.