Skip to content

Commit e9bc732

Browse files
l46kokcopybara-github
authored andcommitted
Add CelLiteDescriptorPool and DefaultLiteDescriptorPool
PiperOrigin-RevId: 748060303
1 parent 5b4b234 commit e9bc732

File tree

61 files changed

+2534
-350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2534
-350
lines changed

WORKSPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,11 @@ http_archive(
242242
)
243243

244244
# cel-spec api/expr canonical protos
245-
CEL_SPEC_VERSION = "0.20.0"
245+
CEL_SPEC_VERSION = "0.23.1"
246246

247247
http_archive(
248248
name = "cel_spec",
249-
sha256 = "9f4acb83116f68af8a6b6acf700561a22a1bd8a9ad2f49bf642b7f9b8f285043",
249+
sha256 = "8bafa44e610eb281df8b1268a42b5e2d7b76d60d0b3c817835cfcfd14cc2bc9c",
250250
strip_prefix = "cel-spec-" + CEL_SPEC_VERSION,
251251
urls = [
252252
"https://github.com/google/cel-spec/archive/" +

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ java_library(
5959
"@maven//:com_google_truth_extensions_truth_proto_extension",
6060
"@maven//:junit_junit",
6161
"@maven//:org_jspecify_jspecify",
62+
"@maven_android//:com_google_protobuf_protobuf_javalite",
6263
],
6364
)
6465

codelab/src/main/codelab/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ java_library(
3939
"@maven//:com_google_guava_guava", # unuseddeps: keep
4040
"@maven//:com_google_protobuf_protobuf_java", # unuseddeps: keep
4141
"@maven//:com_google_protobuf_protobuf_java_util", # unuseddeps: keep
42+
"@maven_android//:com_google_protobuf_protobuf_javalite", # unuseddeps: keep
4243
],
4344
)

codelab/src/main/codelab/solutions/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@ java_library(
4040
"@maven//:com_google_guava_guava",
4141
"@maven//:com_google_protobuf_protobuf_java",
4242
"@maven//:com_google_protobuf_protobuf_java_util",
43+
"@maven_android//:com_google_protobuf_protobuf_javalite",
4344
],
4445
)

common/internal/BUILD.bazel

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ java_library(
1616
exports = ["//common/src/main/java/dev/cel/common/internal:comparison_functions"],
1717
)
1818

19+
java_library(
20+
name = "default_lite_descriptor_pool",
21+
exports = ["//common/src/main/java/dev/cel/common/internal:default_lite_descriptor_pool"],
22+
)
23+
1924
cel_android_library(
2025
name = "comparison_functions_android",
2126
exports = ["//common/src/main/java/dev/cel/common/internal:comparison_functions_android"],
@@ -97,3 +102,8 @@ cel_android_library(
97102
name = "internal_android",
98103
exports = ["//common/src/main/java/dev/cel/common/internal:internal_android"],
99104
)
105+
106+
java_library(
107+
name = "proto_java_qualified_names",
108+
exports = ["//common/src/main/java/dev/cel/common/internal:proto_java_qualified_names"],
109+
)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ java_library(
208208
"@maven//:com_google_guava_guava",
209209
"@maven//:com_google_protobuf_protobuf_java",
210210
"@maven//:com_google_protobuf_protobuf_java_util",
211+
"@maven_android//:com_google_protobuf_protobuf_javalite",
211212
],
212213
)
213214

common/src/main/java/dev/cel/common/ast/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ java_library(
5353
"@maven//:com_google_guava_guava",
5454
"@maven//:com_google_protobuf_protobuf_java",
5555
"@maven//:org_jspecify_jspecify",
56+
"@maven_android//:com_google_protobuf_protobuf_javalite",
5657
],
5758
)
5859

@@ -114,7 +115,7 @@ java_library(
114115
":ast",
115116
"//common/annotations",
116117
"@maven//:com_google_guava_guava",
117-
"@maven//:com_google_protobuf_protobuf_java",
118+
"@maven_android//:com_google_protobuf_protobuf_javalite",
118119
],
119120
)
120121

@@ -138,7 +139,6 @@ cel_android_library(
138139
"//:auto_value",
139140
"//common/annotations",
140141
"@maven//:com_google_errorprone_error_prone_annotations",
141-
"@maven//:com_google_protobuf_protobuf_java",
142142
"@maven//:org_jspecify_jspecify",
143143
"@maven_android//:com_google_guava_guava",
144144
"@maven_android//:com_google_protobuf_protobuf_javalite",

common/src/main/java/dev/cel/common/internal/BUILD.bazel

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ java_library(
4747
"@maven//:com_google_guava_guava",
4848
"@maven//:com_google_protobuf_protobuf_java",
4949
"@maven//:org_antlr_antlr4_runtime",
50+
"@maven_android//:com_google_protobuf_protobuf_javalite",
5051
],
5152
)
5253

@@ -61,7 +62,6 @@ cel_android_library(
6162
"//common/ast:ast_android",
6263
"@maven//:com_google_errorprone_error_prone_annotations",
6364
"@maven//:com_google_guava_guava",
64-
"@maven//:com_google_protobuf_protobuf_java",
6565
"@maven//:org_antlr_antlr4_runtime",
6666
"@maven_android//:com_google_guava_guava",
6767
"@maven_android//:com_google_protobuf_protobuf_javalite",
@@ -140,6 +140,7 @@ java_library(
140140
":proto_java_qualified_names",
141141
"//common/annotations",
142142
"@maven//:com_google_protobuf_protobuf_java",
143+
"@maven_android//:com_google_protobuf_protobuf_javalite",
143144
],
144145
)
145146

@@ -152,7 +153,7 @@ java_library(
152153
":reflection_util",
153154
"//common/annotations",
154155
"@maven//:com_google_guava_guava",
155-
"@maven//:com_google_protobuf_protobuf_java",
156+
"@maven_android//:com_google_protobuf_protobuf_javalite",
156157
],
157158
)
158159

@@ -174,6 +175,7 @@ java_library(
174175
"@maven//:com_google_errorprone_error_prone_annotations",
175176
"@maven//:com_google_guava_guava",
176177
"@maven//:com_google_protobuf_protobuf_java",
178+
"@maven_android//:com_google_protobuf_protobuf_javalite",
177179
],
178180
)
179181

@@ -191,6 +193,7 @@ java_library(
191193
"@maven//:com_google_errorprone_error_prone_annotations",
192194
"@maven//:com_google_guava_guava",
193195
"@maven//:com_google_protobuf_protobuf_java",
196+
"@maven_android//:com_google_protobuf_protobuf_javalite",
194197
],
195198
)
196199

@@ -207,6 +210,7 @@ java_library(
207210
"@maven//:com_google_guava_guava",
208211
"@maven//:com_google_protobuf_protobuf_java",
209212
"@maven//:org_jspecify_jspecify",
213+
"@maven_android//:com_google_protobuf_protobuf_javalite",
210214
],
211215
)
212216

@@ -245,7 +249,6 @@ java_library(
245249
"//common/annotations",
246250
"@maven//:com_google_guava_guava",
247251
"@maven//:com_google_protobuf_protobuf_java",
248-
"@maven//:org_jspecify_jspecify",
249252
],
250253
)
251254

@@ -291,6 +294,34 @@ java_library(
291294
],
292295
)
293296

297+
java_library(
298+
name = "cel_lite_descriptor_pool",
299+
srcs = ["CelLiteDescriptorPool.java"],
300+
tags = [
301+
],
302+
deps = [
303+
"//protobuf:cel_lite_descriptor",
304+
"@maven//:com_google_errorprone_error_prone_annotations",
305+
],
306+
)
307+
308+
java_library(
309+
name = "default_lite_descriptor_pool",
310+
srcs = ["DefaultLiteDescriptorPool.java"],
311+
tags = [
312+
],
313+
deps = [
314+
":cel_lite_descriptor_pool",
315+
"//common/annotations",
316+
"//common/internal:well_known_proto",
317+
"//protobuf:cel_lite_descriptor",
318+
"@maven//:com_google_errorprone_error_prone_annotations",
319+
"@maven//:com_google_guava_guava",
320+
"@maven//:com_google_protobuf_protobuf_java",
321+
"@maven_android//:com_google_protobuf_protobuf_javalite",
322+
],
323+
)
324+
294325
java_library(
295326
name = "safe_string_formatter",
296327
srcs = ["SafeStringFormatter.java"],
@@ -309,6 +340,7 @@ java_library(
309340
tags = [
310341
],
311342
deps = [
343+
"//common/annotations",
312344
"@maven//:com_google_guava_guava",
313345
"@maven//:com_google_protobuf_protobuf_java",
314346
],
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2025 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package dev.cel.common.internal;
16+
17+
import com.google.errorprone.annotations.Immutable;
18+
import dev.cel.protobuf.CelLiteDescriptor.MessageLiteDescriptor;
19+
import java.util.Optional;
20+
21+
/**
22+
* CelLiteDescriptorPool allows lookup of {@link MessageLiteDescriptor} by its fully qualified name.
23+
*/
24+
@Immutable
25+
public interface CelLiteDescriptorPool {
26+
Optional<MessageLiteDescriptor> findDescriptor(String protoTypeName);
27+
28+
MessageLiteDescriptor getDescriptorOrThrow(String protoTypeName);
29+
}

0 commit comments

Comments
 (0)