Skip to content

Commit f72177a

Browse files
ChinmayMadeshicopybara-github
authored andcommitted
Support for Dot graph via graphviz
PiperOrigin-RevId: 806237118
1 parent 00de410 commit f72177a

File tree

17 files changed

+987
-20
lines changed

17 files changed

+987
-20
lines changed

parser/src/main/java/dev/cel/parser/CelUnparserVisitor.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,17 @@ public String unparse() {
6666
return stringBuilder.toString();
6767
}
6868

69+
/**
70+
* Unparses a specific {@link CelExpr} node within the AST.
71+
*
72+
* <p>This method exists to allow unparsing of an arbitrary node within the stored AST in this
73+
* visitor.
74+
*/
75+
public String unparse(CelExpr expr) {
76+
visit(expr);
77+
return stringBuilder.toString();
78+
}
79+
6980
private static String maybeQuoteField(String field) {
7081
if (RESTRICTED_FIELD_NAMES.contains(field)
7182
|| !IDENTIFIER_SEGMENT_PATTERN.matcher(field).matches()) {

testing/src/main/java/dev/cel/testing/testrunner/BUILD.bazel

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ java_library(
1515
],
1616
deps = [
1717
":annotations",
18+
":cel_coverage_index",
1819
":cel_test_suite",
1920
":cel_test_suite_exception",
2021
":cel_test_suite_text_proto_parser",
@@ -33,7 +34,11 @@ java_library(
3334
srcs = ["JUnitXmlReporter.java"],
3435
tags = [
3536
],
36-
deps = ["@maven//:com_google_guava_guava"],
37+
deps = [
38+
":cel_coverage_index",
39+
"@maven//:com_google_guava_guava",
40+
"@maven//:org_jspecify_jspecify",
41+
],
3742
)
3843

3944
java_library(
@@ -42,11 +47,32 @@ java_library(
4247
tags = [
4348
],
4449
deps = [
50+
":cel_coverage_index",
4551
":cel_expression_source",
4652
":cel_test_context",
4753
":cel_test_suite",
4854
":test_runner_library",
4955
"@maven//:junit_junit",
56+
"@maven//:org_jspecify_jspecify",
57+
],
58+
)
59+
60+
java_library(
61+
name = "cel_coverage_index",
62+
srcs = ["CelCoverageIndex.java"],
63+
tags = [
64+
],
65+
deps = [
66+
"//:auto_value",
67+
"//common:cel_ast",
68+
"//common/ast",
69+
"//common/navigation",
70+
"//common/types:type_providers",
71+
"//parser:unparser_visitor",
72+
"//runtime:evaluation_listener",
73+
"@maven//:com_google_code_findbugs_annotations",
74+
"@maven//:com_google_errorprone_error_prone_annotations",
75+
"@maven//:com_google_guava_guava",
5076
],
5177
)
5278

@@ -56,6 +82,7 @@ java_library(
5682
tags = [
5783
],
5884
deps = [
85+
":cel_coverage_index",
5986
":cel_expression_source",
6087
":cel_test_context",
6188
":cel_test_suite",
@@ -80,6 +107,7 @@ java_library(
80107
"@cel_spec//proto/cel/expr:expr_java_proto",
81108
"@maven//:com_google_guava_guava",
82109
"@maven//:com_google_protobuf_protobuf_java",
110+
"@maven//:org_jspecify_jspecify",
83111
],
84112
)
85113

0 commit comments

Comments
 (0)