-
Notifications
You must be signed in to change notification settings - Fork 4k
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 skylib's analysistest #12368
Fix incompatible target skipping for skylib's analysistest #12368
Conversation
In bazelbuild#12366, Keith Smiley (@keith) reported that he was having trouble using the new `target_compatible_with` attribute in `rules_swift`. Specifically, setting it on an `analysistest` test target was giving him the following error: ERROR: /workdir/test/BUILD:13:29: in coverage_xcode_prefix_map_test rule //test:coverage_settings_xcode_prefix_map: rules with analysis_test=true must return an instance of AnalysisTestResultInfo ERROR: Analysis of target '//test:coverage_settings_xcode_prefix_map' failed; build aborted: Analysis of target '//test:coverage_settings_xcode_prefix_map' failed This was caused by the fact that for incompatible targets we create a dummy `ConfiguredTarget` that only provides the bare minimum to make the rest of bazel happy before it gets skipped. It turns out that `analysistest` rules have additional checks that need to be satisfied. This patch aims to satisfy those additional checks without impacting functionality. Fixes bazelbuild#12366
@keith , when you have a chance, could you do me a favor and give this a try? I realized just now that the test case I used is slightly different from your use case, but I'm hoping it'll still work. If it doesn't work, I'll take another look tomorrow or Thursday. |
@gregestren , does this look reasonable? Using |
It looks reasonable to me given the context. What about it do you find invasive? |
"invasive" was definitely the wrong word to use, apologies. Looking at it with fresh eyes, it's not looking that bad. Sorry for the confusion. |
I validated this now correctly skips the test:
|
@gregestren can you help land this? |
I started merging on Friday but ran into some CI silliness. Stay tuned... |
In #12366, Keith Smiley (@keith) reported that he was having trouble
using the new
target_compatible_with
attribute inrules_swift
.Specifically, setting it on an
analysistest
test target was givinghim the following error:
This was caused by the fact that for incompatible targets we create a
dummy
ConfiguredTarget
that only provides the bare minimum to makethe rest of bazel happy before it gets skipped. It turns out that
analysistest
rules have additional checks that need to be satisfied.This patch aims to satisfy those additional checks without impacting
functionality.
Fixes #12366