Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

katre
Copy link
Member

@katre katre commented Nov 24, 2020

This will allow us to keep the configured target key between lookup rounds.

Fixes #11993.

@google-cla google-cla bot added the cla: yes label Nov 24, 2020
This will allow us to keep the configured target key between lookup
rounds.

Fixes bazelbuild#11993.
@katre katre force-pushed the i11993-04-keyed-config-target branch from 234d1cb to 4ceaa1e Compare November 25, 2020 12:50
@katre katre changed the title [WIP] Change ConfiguredTargetQuery to use KeyedConfiguredTarget as a value. Change ConfiguredTargetQuery to use KeyedConfiguredTarget as a value. Nov 25, 2020
@katre katre marked this pull request as ready for review November 25, 2020 12:51
@katre katre requested a review from juliexxia November 25, 2020 13:00
Copy link
Contributor

@juliexxia juliexxia left a 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)
Copy link
Contributor

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?

Copy link
Member Author

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) {
Copy link
Contributor

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 =
Copy link
Contributor

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 ?

Copy link
Member Author

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() {
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@bazel-io bazel-io closed this in 34d9823 Nov 25, 2020
@katre katre deleted the i11993-04-keyed-config-target branch November 25, 2020 20:51
philwo pushed a commit that referenced this pull request Mar 15, 2021
This will allow us to keep the configured target key between lookup rounds.

Fixes #11993.

Closes #12547.

PiperOrigin-RevId: 344299744
philwo pushed a commit that referenced this pull request Mar 15, 2021
This will allow us to keep the configured target key between lookup rounds.

Fixes #11993.

Closes #12547.

PiperOrigin-RevId: 344299744
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cquery produces non-actionable warning related to toolchains
2 participants