1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15- package com .google .devtools .build .lib .bazel .bzlmod .modquery ;
15+ package com .google .devtools .build .lib .bazel .bzlmod .modcommand ;
1616
1717import static com .google .common .collect .ImmutableSet .toImmutableSet ;
1818import static com .google .common .collect .ImmutableSortedMap .toImmutableSortedMap ;
3535import com .google .devtools .build .lib .bazel .bzlmod .ModuleKey ;
3636import com .google .devtools .build .lib .bazel .bzlmod .Tag ;
3737import com .google .devtools .build .lib .bazel .bzlmod .Version ;
38- import com .google .devtools .build .lib .bazel .bzlmod .modquery . ModqueryExecutor .ResultNode .IsExpanded ;
39- import com .google .devtools .build .lib .bazel .bzlmod .modquery . ModqueryExecutor .ResultNode .IsIndirect ;
40- import com .google .devtools .build .lib .bazel .bzlmod .modquery . ModqueryExecutor .ResultNode .NodeMetadata ;
38+ import com .google .devtools .build .lib .bazel .bzlmod .modcommand . ModExecutor .ResultNode .IsExpanded ;
39+ import com .google .devtools .build .lib .bazel .bzlmod .modcommand . ModExecutor .ResultNode .IsIndirect ;
40+ import com .google .devtools .build .lib .bazel .bzlmod .modcommand . ModExecutor .ResultNode .NodeMetadata ;
4141import com .google .devtools .build .lib .packages .RawAttributeMapper ;
4242import com .google .devtools .build .lib .packages .Rule ;
4343import com .google .devtools .build .lib .query2 .query .output .BuildOutputFormatter .AttributeReader ;
6262import net .starlark .java .eval .Starlark ;
6363
6464/**
65- * Executes inspection queries for {@link
66- * com.google.devtools.build.lib.bazel.commands.ModqueryCommand} and prints the resulted output to
67- * the reporter's output stream using the different defined {@link OutputFormatters}.
65+ * Executes inspection queries for {@link com.google.devtools.build.lib.bazel.commands.ModCommand}
66+ * and prints the resulted output to the reporter's output stream using the different defined {@link
67+ * OutputFormatters}.
6868 */
69- public class ModqueryExecutor {
69+ public class ModExecutor {
7070
7171 private final ImmutableMap <ModuleKey , AugmentedModule > depGraph ;
7272 private final ImmutableTable <ModuleExtensionId , ModuleKey , ModuleExtensionUsage > extensionUsages ;
7373 private final ImmutableSetMultimap <ModuleExtensionId , String > extensionRepos ;
7474 private final Optional <MaybeCompleteSet <ModuleExtensionId >> extensionFilter ;
75- private final ModqueryOptions options ;
75+ private final ModOptions options ;
7676 private final PrintWriter printer ;
7777 private ImmutableMap <ModuleExtensionId , ImmutableSetMultimap <String , ModuleKey >>
7878 extensionRepoImports ;
7979
80- public ModqueryExecutor (
81- ImmutableMap <ModuleKey , AugmentedModule > depGraph , ModqueryOptions options , Writer writer ) {
80+ public ModExecutor (
81+ ImmutableMap <ModuleKey , AugmentedModule > depGraph , ModOptions options , Writer writer ) {
8282 this (
8383 depGraph ,
8484 ImmutableTable .of (),
@@ -88,12 +88,12 @@ public ModqueryExecutor(
8888 writer );
8989 }
9090
91- public ModqueryExecutor (
91+ public ModExecutor (
9292 ImmutableMap <ModuleKey , AugmentedModule > depGraph ,
9393 ImmutableTable <ModuleExtensionId , ModuleKey , ModuleExtensionUsage > extensionUsages ,
9494 ImmutableSetMultimap <ModuleExtensionId , String > extensionRepos ,
9595 Optional <MaybeCompleteSet <ModuleExtensionId >> extensionFilter ,
96- ModqueryOptions options ,
96+ ModOptions options ,
9797 Writer writer ) {
9898 this .depGraph = depGraph ;
9999 this .extensionUsages = extensionUsages ;
@@ -106,7 +106,7 @@ public ModqueryExecutor(
106106 this .extensionRepoImports = computeRepoImportsTable (depGraph .keySet ());
107107 }
108108
109- public void tree (ImmutableSet <ModuleKey > from ) {
109+ public void graph (ImmutableSet <ModuleKey > from ) {
110110 ImmutableMap <ModuleKey , ResultNode > result =
111111 expandAndPrune (from , computeExtensionFilterTargets (), false );
112112 OutputFormatters .getFormatter (options .outputFormat )
@@ -129,7 +129,7 @@ public void allPaths(ImmutableSet<ModuleKey> from, ImmutableSet<ModuleKey> to) {
129129 .output (result , depGraph , extensionRepos , extensionRepoImports , printer , options );
130130 }
131131
132- public void show (ImmutableMap <String , BzlmodRepoRuleValue > targetRepoRuleValues ) {
132+ public void showRepo (ImmutableMap <String , BzlmodRepoRuleValue > targetRepoRuleValues ) {
133133 RuleDisplayOutputter outputter = new RuleDisplayOutputter (printer );
134134 for (Entry <String , BzlmodRepoRuleValue > e : targetRepoRuleValues .entrySet ()) {
135135 printer .printf ("## %s:\n " , e .getKey ());
@@ -230,9 +230,9 @@ private class ResultGraphPruner {
230230 /**
231231 * Constructs a ResultGraphPruner to prune the result graph after the specified depth.
232232 *
233- * @param targets If not complete, it means that the result tree contains paths to some specific
234- * targets. This will cause some branches to contain, after the specified depths, some
235- * targets or target parents. As any other nodes omitted, transitive edges (embedding
233+ * @param targets If not complete, it means that the result graph contains paths to some
234+ * specific targets. This will cause some branches to contain, after the specified depths,
235+ * some targets or target parents. As any other nodes omitted, transitive edges (embedding
236236 * multiple edges) will be stored as <i>indirect</i>.
237237 * @param oldResult The unpruned result graph.
238238 */
@@ -559,8 +559,7 @@ public abstract static class NodeMetadata {
559559
560560 private static NodeMetadata create (
561561 IsExpanded isExpanded , IsIndirect isIndirect , IsCycle isCycle ) {
562- return new AutoValue_ModqueryExecutor_ResultNode_NodeMetadata (
563- isExpanded , isIndirect , isCycle );
562+ return new AutoValue_ModExecutor_ResultNode_NodeMetadata (isExpanded , isIndirect , isCycle );
564563 }
565564 }
566565
@@ -583,7 +582,7 @@ public ImmutableSortedSet<Entry<ModuleKey, NodeMetadata>> getChildrenSortedByEdg
583582 }
584583
585584 static ResultNode .Builder builder () {
586- return new AutoValue_ModqueryExecutor_ResultNode .Builder ().setTarget (false );
585+ return new AutoValue_ModExecutor_ResultNode .Builder ().setTarget (false );
587586 }
588587
589588 @ AutoValue .Builder
0 commit comments