Skip to content

Commit 0ebcc31

Browse files
l46kokcopybara-github
authored andcommitted
Add a canonicalization pass to CEL verifier
PiperOrigin-RevId: 957797112
1 parent 2da98c9 commit 0ebcc31

11 files changed

Lines changed: 1450 additions & 50 deletions

verifier/BUILD.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,10 @@ java_library(
6161
visibility = [":verifier_internal"],
6262
exports = ["//verifier/src/main/java/dev/cel/verifier:z3_impl"],
6363
)
64+
65+
java_library(
66+
name = "canonicalization_optimizer",
67+
compatible_with = [],
68+
visibility = [":verifier_internal"],
69+
exports = ["//verifier/src/main/java/dev/cel/verifier:canonicalization_optimizer"],
70+
)

verifier/src/main/java/dev/cel/verifier/BUILD.bazel

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ java_library(
3535
deps = [
3636
":verifier",
3737
":z3_impl",
38+
"//bundle:cel",
39+
"//checker:checker_builder",
40+
"//compiler",
41+
"//compiler:compiler_builder",
42+
"//parser:parser_builder",
43+
"//runtime",
3844
],
3945
)
4046

@@ -119,6 +125,29 @@ java_library(
119125
],
120126
)
121127

128+
java_library(
129+
name = "canonicalization_optimizer",
130+
srcs = ["CanonicalizationOptimizer.java"],
131+
tags = [
132+
],
133+
deps = [
134+
"//:auto_value",
135+
"//bundle:cel",
136+
"//common:cel_ast",
137+
"//common:mutable_ast",
138+
"//common:mutable_source",
139+
"//common:operator",
140+
"//common/ast",
141+
"//common/ast:mutable_expr",
142+
"//common/navigation:common",
143+
"//common/navigation:mutable_navigation",
144+
"//common/values:cel_byte_string",
145+
"//optimizer:ast_optimizer",
146+
"//optimizer:mutable_ast",
147+
"@maven//:com_google_guava_guava",
148+
],
149+
)
150+
122151
java_library(
123152
name = "z3_impl",
124153
srcs = [
@@ -135,10 +164,12 @@ java_library(
135164
tags = [
136165
],
137166
deps = [
167+
":canonicalization_optimizer",
138168
":numeric_bounds",
139169
":type_system",
140170
":verifier",
141171
"//:auto_value",
172+
"//bundle:cel",
142173
"//common:cel_ast",
143174
"//common:compiler_common",
144175
"//common:operator",
@@ -147,6 +178,9 @@ java_library(
147178
"//common/types",
148179
"//common/types:cel_types",
149180
"//common/types:type_providers",
181+
"//optimizer",
182+
"//optimizer:optimization_exception",
183+
"//optimizer:optimizer_builder",
150184
"//verifier/axioms",
151185
"@maven//:com_google_errorprone_error_prone_annotations",
152186
"@maven//:com_google_guava_guava",

0 commit comments

Comments
 (0)