Skip to content

Commit 5de9888

Browse files
gregestrencopybara-github
authored andcommitted
cquery: make it easier to source Starlark transitions
**Before:** ``` $ bazel cquery --transitions=lite <query with a target with a self (rule) transition> FunctionPatchTransition -> //the:target (abcd1) ``` **After:** ``` $ bazel cquery --transitions=lite <query with a target with a self (rule) transition>` Starlark transition:foo/bar/transition_def.bzl:21:32 -> //the:target (abcd1) ``` **Implementation notes:** - This is a no-op for native transitions: https://github.com/bazelbuild/bazel/blob/a9206ebe275ce3de22f5c68b03ad58f6ae0b0cb2/src/main/java/com/google/devtools/build/lib/analysis/config/transitions/ConfigurationTransition.java#L96 - StarlarkTransition.getName() already has the most helpful form: https://github.com/bazelbuild/bazel/blob/a9206ebe275ce3de22f5c68b03ad58f6ae0b0cb2/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkTransition.java#L72 - This only updates rule transitions (rules that self-transition). Attribute transitions (transitions applied to rule attributes) already have this behavior: https://github.com/bazelbuild/bazel/blob/1661a9c3128dca895f4853c8c8d022902bf90d7e/src/main/java/com/google/devtools/build/lib/query2/cquery/TransitionsOutputFormatterCallback.java#L172 PiperOrigin-RevId: 422373835
1 parent 6104e8f commit 5de9888

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/main/java/com/google/devtools/build/lib/query2/cquery/TransitionsOutputFormatterCallback.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ private static String getRuleClassTransition(ConfiguredTarget ct, Target target)
202202
output =
203203
factory
204204
.create(RuleTransitionData.create(target.getAssociatedRule()))
205-
.getClass()
206-
.getSimpleName()
205+
.getName()
207206
.concat(" -> ");
208207
}
209208
}

0 commit comments

Comments
 (0)