From 969b6eaa60d5da0154685bd52317f4b9b8f7eef4 Mon Sep 17 00:00:00 2001 From: Sokwhan Huh Date: Mon, 13 Jan 2025 15:19:47 -0800 Subject: [PATCH] Isolate CelAbstractSyntaxTree and CelSource from common build target PiperOrigin-RevId: 715126056 --- common/BUILD.bazel | 17 ++++++- .../src/main/java/dev/cel/common/BUILD.bazel | 51 ++++++++++++++++++- 2 files changed, 65 insertions(+), 3 deletions(-) diff --git a/common/BUILD.bazel b/common/BUILD.bazel index af0bf8ab..78ab669b 100644 --- a/common/BUILD.bazel +++ b/common/BUILD.bazel @@ -6,8 +6,13 @@ package( ) java_library( + # TODO: Split this target and migrate consumers name = "common", - exports = ["//common/src/main/java/dev/cel/common"], + exports = [ + "//common/src/main/java/dev/cel/common", + "//common/src/main/java/dev/cel/common:cel_ast", + "//common/src/main/java/dev/cel/common:cel_source", + ], ) java_library( @@ -72,3 +77,13 @@ java_library( name = "source_location", exports = ["//common/src/main/java/dev/cel/common:source_location"], ) + +java_library( + name = "cel_source", + exports = ["//common/src/main/java/dev/cel/common:cel_source"], +) + +java_library( + name = "cel_ast", + exports = ["//common/src/main/java/dev/cel/common:cel_ast"], +) diff --git a/common/src/main/java/dev/cel/common/BUILD.bazel b/common/src/main/java/dev/cel/common/BUILD.bazel index 31fd401c..0592bce6 100644 --- a/common/src/main/java/dev/cel/common/BUILD.bazel +++ b/common/src/main/java/dev/cel/common/BUILD.bazel @@ -10,11 +10,9 @@ package( # keep sorted COMMON_SOURCES = [ - "CelAbstractSyntaxTree.java", "CelDescriptorUtil.java", "CelDescriptors.java", "CelException.java", - "CelSource.java", ] # keep sorted @@ -49,6 +47,8 @@ java_library( tags = [ ], deps = [ + ":cel_ast", + ":cel_source", ":error_codes", ":source", ":source_location", @@ -72,6 +72,8 @@ java_library( tags = [ ], deps = [ + ":cel_ast", + ":cel_source", ":common", ":source", ":source_location", @@ -116,6 +118,8 @@ java_library( tags = [ ], deps = [ + ":cel_ast", + ":cel_source", "//common", "//common/ast:expr_converter", "//common/types:cel_proto_types", @@ -131,7 +135,10 @@ java_library( tags = [ ], deps = [ + ":cel_ast", + ":cel_source", ":common", + "//common:cel_source", "//common/ast:expr_v1alpha1_converter", "//common/types:cel_v1alpha1_types", "@com_google_googleapis//google/api/expr/v1alpha1:expr_java_proto", @@ -164,6 +171,7 @@ java_library( tags = [ ], deps = [ + ":cel_ast", ":mutable_source", "//common", "//common/ast", @@ -178,6 +186,7 @@ java_library( tags = [ ], deps = [ + ":cel_source", ":common", "//:auto_value", "//common/ast:mutable_expr", @@ -213,6 +222,44 @@ java_library( ], ) +java_library( + name = "cel_source", + srcs = ["CelSource.java"], + tags = [ + "alt_dep=//common:cel_source", + "avoid_dep", + ], + deps = [ + ":source", + ":source_location", + "//:auto_value", + "//common/annotations", + "//common/ast", + "//common/internal", + "@maven//:com_google_errorprone_error_prone_annotations", + "@maven//:com_google_guava_guava", + ], +) + +java_library( + name = "cel_ast", + srcs = ["CelAbstractSyntaxTree.java"], + tags = [ + "alt_dep=//common:cel_ast", + "avoid_dep", + ], + deps = [ + ":cel_source", + "//:auto_value", + "//common/annotations", + "//common/ast", + "//common/types", + "//common/types:type_providers", + "@maven//:com_google_errorprone_error_prone_annotations", + "@maven//:com_google_guava_guava", + ], +) + java_library( name = "source", srcs = SOURCE_SOURCES,