-
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
Change ConfiguredTargetQuery to use KeyedConfiguredTarget as a value. #12547
Conversation
This will allow us to keep the configured target key between lookup rounds. Fixes bazelbuild#11993.
234d1cb
to
4ceaa1e
Compare
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.
Overall looks great!
@@ -180,14 +176,17 @@ public Target getTargetFromConfiguredTarget(ConfiguredTarget configuredTarget) { | |||
} | |||
|
|||
/** Returns the rule that generates the given output file. */ | |||
public RuleConfiguredTarget getGeneratingConfiguredTarget(OutputFileConfiguredTarget oct) | |||
RuleConfiguredTarget getGeneratingConfiguredTarget(KeyedConfiguredTarget kct) |
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.
Should we assert that this KeyedConfiguredTarget contains an OutputFileConfiguredTarget if we're going to cast on 186?
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.
Done.
.setConfiguredTarget(target) | ||
.setConfiguration(getConfiguration(target)) | ||
.build(); | ||
protected ConfiguredTargetKey getSkyKey(KeyedConfiguredTarget target) { |
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 think this method's assumptions have caused other issues in the past so it's nice we can tighten it up here.
@@ -120,9 +119,9 @@ public void testLabelFunction_getCorrectlyConfiguredDeps() throws Exception { | |||
setUpLabelsFunctionTests(); | |||
|
|||
// Test that this retrieves the correctly configured version(s) of the dep(s). | |||
ConfiguredTarget patchDep = | |||
KeyedConfiguredTarget patchDep = |
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 we add a test case for the situation that caused #11993 ?
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.
Good point. Added to //src/test/shell/bazel:toolchain_transition_test
@@ -355,4 +354,29 @@ EOF | |||
expect_log 'extra_lib: message: extra_lib foo, target_dep: target, tool_dep: exec-alpha' | |||
} | |||
|
|||
function test_toolchain_transition_cquery() { |
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.
Do you mind adding a comment about what this seemingly innocuous test case is testing for?
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.
Done.
This will allow us to keep the configured target key between lookup rounds.
Fixes #11993.