Skip to content

Commit 94160c0

Browse files
dmitriplotnikovcopybara-github
authored andcommitted
Implement CelEnvironmentExporter.
This exporter infers from a concrete Cel instance all the parameters to reconstruct a CelEnvironment. The exporter functionality is not complete yet, please don't start using it yet. PiperOrigin-RevId: 786058908
1 parent 477e6ca commit 94160c0

11 files changed

Lines changed: 743 additions & 5 deletions

File tree

bundle/BUILD.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ java_library(
2424
name = "environment_yaml_parser",
2525
exports = ["//bundle/src/main/java/dev/cel/bundle:environment_yaml_parser"],
2626
)
27+
28+
java_library(
29+
name = "environment_exporter",
30+
visibility = ["//:internal"],
31+
exports = ["//bundle/src/main/java/dev/cel/bundle:environment_exporter"],
32+
)

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,32 @@ java_library(
111111
],
112112
)
113113

114+
java_library(
115+
name = "environment_exporter",
116+
srcs = [
117+
"CelEnvironmentExporter.java",
118+
],
119+
tags = [
120+
],
121+
deps = [
122+
":environment",
123+
"//:auto_value",
124+
"//bundle:cel",
125+
"//checker:standard_decl",
126+
"//common:compiler_common",
127+
"//common:options",
128+
"//common/internal:env_visitor",
129+
"//common/types:cel_proto_types",
130+
"//common/types:cel_types",
131+
"//common/types:type_providers",
132+
"//extensions",
133+
"//extensions:extension_library",
134+
"@cel_spec//proto/cel/expr:checked_java_proto",
135+
"@maven//:com_google_errorprone_error_prone_annotations",
136+
"@maven//:com_google_guava_guava",
137+
],
138+
)
139+
114140
java_library(
115141
name = "required_fields_checker",
116142
srcs = [

bundle/src/main/java/dev/cel/bundle/CelEnvironment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public static Builder newBuilder() {
185185
.setVariables(ImmutableSet.of())
186186
.setFunctions(ImmutableSet.of());
187187
}
188-
188+
189189
/** Extends the provided {@link CelCompiler} environment with this configuration. */
190190
public CelCompiler extend(CelCompiler celCompiler, CelOptions celOptions)
191191
throws CelEnvironmentException {

0 commit comments

Comments
 (0)