You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add flag to use cquery
This PR adds two flags `--useCquery` and `--cqueryCommandOptions` which
enables using `bazel cquery` instead of `bazel query` when computing
build graph. This creates more accurate build graph and hence hash
computation is more accurate with less false positives.
A e2e test is added to demonstrate this change.
* use deps() for cquery
* add test covering source code change
* Update E2ETest.kt
fix comment
Copy file name to clipboardExpand all lines: cli/src/main/kotlin/com/bazel_diff/cli/GenerateHashesCommand.kt
+19-1
Original file line number
Diff line number
Diff line change
@@ -59,7 +59,7 @@ class GenerateHashesCommand : Callable<Int> {
59
59
60
60
@CommandLine.Option(
61
61
names = ["-co", "--bazelCommandOptions"],
62
-
description = ["Additional space separated Bazel command options used when invoking Bazel"],
62
+
description = ["Additional space separated Bazel command options used when invoking `bazel query`"],
63
63
scope =CommandLine.ScopeType.INHERIT,
64
64
converter = [OptionsConverter::class],
65
65
)
@@ -73,6 +73,22 @@ class GenerateHashesCommand : Callable<Int> {
73
73
)
74
74
var fineGrainedHashExternalRepos:Set<String> = emptySet()
75
75
76
+
@CommandLine.Option(
77
+
names = ["--useCquery"],
78
+
negatable =true,
79
+
description = ["If true, use cquery instead of query when generating dependency graphs. Using cquery would yield more accurate build graph at the cost of slower query execution. When this is set, one usually also wants to set `--cqueryCommandOptions` to specify a targeting platform. Note that this flag only works with Bazel 6.2.0 or above because lower versions does not support `--query_file` flag."],
80
+
scope =CommandLine.ScopeType.INHERIT
81
+
)
82
+
var useCquery =false
83
+
84
+
@CommandLine.Option(
85
+
names = ["--cqueryCommandOptions"],
86
+
description = ["Additional space separated Bazel command options used when invoking `bazel cquery`. This flag is has no effect if `--useCquery`is false."],
87
+
scope =CommandLine.ScopeType.INHERIT,
88
+
converter = [OptionsConverter::class],
89
+
)
90
+
var cqueryCommandOptions:List<String> = emptyList()
91
+
76
92
@CommandLine.Option(
77
93
names = ["-k", "--keep_going"],
78
94
negatable =true,
@@ -108,6 +124,8 @@ class GenerateHashesCommand : Callable<Int> {
0 commit comments