-
Notifications
You must be signed in to change notification settings - Fork 0
cquery: Include toolchains as ruleInputs #22
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ | |
| import com.google.common.collect.ImmutableMap; | ||
| import com.google.common.collect.ImmutableMultimap; | ||
| import com.google.common.collect.ImmutableSet; | ||
| import com.google.common.collect.ImmutableSortedSet; | ||
| import com.google.common.collect.Iterables; | ||
| import com.google.common.collect.Maps; | ||
| import com.google.common.hash.HashFunction; | ||
|
|
@@ -170,12 +171,12 @@ public ThreadSafeOutputFormatterCallback<Target> createStreamCallback( | |
| } | ||
|
|
||
| /** Converts a logical {@link Target} object into a {@link Build.Target} protobuffer. */ | ||
| public Build.Target toTargetProtoBuffer(Target target) throws InterruptedException { | ||
| return toTargetProtoBuffer(target, /*extraDataForAttrHash=*/ ""); | ||
| public Build.Target toTargetProtoBuffer(Target target, ImmutableSortedSet<Label> extraImplicitDeps) throws InterruptedException { | ||
| return toTargetProtoBuffer(target, extraImplicitDeps, /*extraDataForAttrHash=*/ ""); | ||
|
Comment on lines
+174
to
+175
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extract Common LogicMethod signature changed without updating all callers, requiring duplicate parameter handling. This creates maintenance burden when signature changes occur in the future. Standards
|
||
| } | ||
|
|
||
| /** Converts a logical {@link Target} object into a {@link Build.Target} protobuffer. */ | ||
| public Build.Target toTargetProtoBuffer(Target target, Object extraDataForAttrHash) | ||
| private Build.Target toTargetProtoBuffer(Target target, ImmutableSortedSet<Label> extraImplicitDeps, Object extraDataForAttrHash) | ||
| throws InterruptedException { | ||
| Build.Target.Builder targetPb = Build.Target.newBuilder(); | ||
|
|
||
|
|
@@ -243,7 +244,11 @@ public Build.Target toTargetProtoBuffer(Target target, Object extraDataForAttrHa | |
| // Include explicit elements for all direct inputs and outputs of a rule; this goes beyond | ||
| // what is available from the attributes above, since it may also (depending on options) | ||
| // include implicit outputs, exec-configuration outputs, and default values. | ||
| rule.getSortedLabels(dependencyFilter) | ||
| ImmutableSortedSet<Label> ruleInputs = ImmutableSortedSet.<Label>naturalOrder() | ||
| .addAll(rule.getSortedLabels(dependencyFilter)) | ||
| .addAll(extraImplicitDeps) | ||
| .build(); | ||
|
Comment on lines
+247
to
+250
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a comment explaining why // Include explicit elements for all direct inputs and outputs of a rule; this goes beyond
// what is available from the attributes above, since it may also (depending on options)
// include implicit outputs, exec-configuration outputs, and default values.
// Using ImmutableSortedSet to ensure deterministic order of rule inputs.
ImmutableSortedSet<Label> ruleInputs = ImmutableSortedSet.<Label>naturalOrder()
.addAll(rule.getSortedLabels(dependencyFilter))
.addAll(extraImplicitDeps)
.build(); |
||
| ruleInputs | ||
| .forEach(input -> rulePb.addRuleInput(input.toString())); | ||
| rule.getOutputFiles().stream() | ||
| .distinct() | ||
|
|
@@ -565,7 +570,7 @@ public void processOutput(Iterable<Target> partialResult) | |
| // constructing and serializing a QueryResult proto are protected by test coverage and proto | ||
| // best practices. | ||
| for (Target target : partialResult) { | ||
| codedOut.writeMessage(QueryResult.TARGET_FIELD_NUMBER, toTargetProtoBuffer(target)); | ||
| codedOut.writeMessage(QueryResult.TARGET_FIELD_NUMBER, toTargetProtoBuffer(target, ImmutableSortedSet.of())); | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
Potential NPE Risk
No null check on implicitDep.getLabel() which could cause NullPointerException. If ConfiguredTargetKey contains null Label, system reliability will be compromised.
Standards