Skip to content

Commit a008695

Browse files
jckingcopybara-github
authored andcommitted
Break the world
Historically C++ was implemented using the unversioned protobuf descriptors. It eventually included a mix of the versioned variant. When moving to OSS, unversioned protobuf descriptors were rewritten to the versioned variant unconditionally. This has created a bit of a conundrum, now that their is an unversioned canonical protobuf descriptor in cel-spec. We have decided to bit the bullet and break the world. The versioned and unversioned protobuf descriptors are wire compatible, so if you run into issues you can serialize and parse to convert between the two. PiperOrigin-RevId: 689784464
1 parent 4d4a1a4 commit a008695

149 files changed

Lines changed: 938 additions & 921 deletions

File tree

Some content is hidden

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

base/ast_internal/expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ using TypeKind =
575575
absl::Nullable<std::unique_ptr<Type>>, ErrorType,
576576
AbstractType>;
577577

578-
// Analogous to google::api::expr::v1alpha1::Type.
578+
// Analogous to cel::expr::Type.
579579
// Represents a CEL type.
580580
//
581581
// TODO: align with value.proto

bazel/deps.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ def cel_spec_deps():
142142
url = "https://github.com/bazelbuild/rules_python/releases/download/0.33.2/rules_python-0.33.2.tar.gz",
143143
)
144144

145-
CEL_SPEC_GIT_SHA = "f027a86d2e5bf18f796be0c4373f637a61041cde" # Aug 23, 2024
145+
CEL_SPEC_GIT_SHA = "373994d7e20e582fce56767b01ac5039524cddab" # Oct 23, 2024
146146
http_archive(
147147
name = "com_google_cel_spec",
148-
sha256 = "006594fa4f97819a4e4cd98404e4522f5f46ed5ac65402b354649bcc871b0cf2",
148+
sha256 = "b498a768140fc0ed0314eef8b2519a48287661d09ca15b17c8ca34088af6aac3",
149149
strip_prefix = "cel-spec-" + CEL_SPEC_GIT_SHA,
150150
urls = ["https://github.com/google/cel-spec/archive/" + CEL_SPEC_GIT_SHA + ".zip"],
151151
)

checker/internal/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ cc_test(
175175
"@com_google_absl//absl/status",
176176
"@com_google_absl//absl/status:status_matchers",
177177
"@com_google_absl//absl/strings",
178-
"@com_google_cel_spec//proto/test/v1/proto2:test_all_types_cc_proto",
179-
"@com_google_cel_spec//proto/test/v1/proto3:test_all_types_cc_proto",
178+
"@com_google_cel_spec//proto/cel/expr/conformance/proto2:test_all_types_cc_proto",
179+
"@com_google_cel_spec//proto/cel/expr/conformance/proto3:test_all_types_cc_proto",
180180
"@com_google_protobuf//:protobuf",
181181
],
182182
)

checker/internal/type_checker_impl_test.cc

Lines changed: 54 additions & 54 deletions
Large diffs are not rendered by default.

checker/optional_test.cc

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ TEST(OptionalTest, OptSelectDoesNotAnnotateFieldType) {
8181
CreateTypeCheckerBuilder(GetSharedTestingDescriptorPool()));
8282
ASSERT_THAT(builder.AddLibrary(StandardLibrary()), IsOk());
8383
ASSERT_THAT(builder.AddLibrary(OptionalCheckerLibrary()), IsOk());
84-
builder.set_container("google.api.expr.test.v1.proto3");
84+
builder.set_container("cel.expr.conformance.proto3");
8585
ASSERT_OK_AND_ASSIGN(std::unique_ptr<TypeChecker> checker,
8686
std::move(builder).Build());
8787

@@ -227,10 +227,10 @@ INSTANTIATE_TEST_SUITE_P(
227227
new AstType(ast_internal::PrimitiveType::kString)))))},
228228
TestCase{"['v1', ?'v2']", _,
229229
"expected type 'optional_type<string>' but found 'string'"},
230-
TestCase{"google.api.expr.test.v1.proto3.TestAllTypes{?single_int64: "
230+
TestCase{"cel.expr.conformance.proto3.TestAllTypes{?single_int64: "
231231
"optional.of(1)}",
232232
Eq(AstType(ast_internal::MessageType(
233-
"google.api.expr.test.v1.proto3.TestAllTypes")))},
233+
"cel.expr.conformance.proto3.TestAllTypes")))},
234234
TestCase{"[0][?1]",
235235
IsOptionalType(AstType(ast_internal::PrimitiveType::kInt64))},
236236
TestCase{"[[0]][?1][?1]",
@@ -250,19 +250,18 @@ INSTANTIATE_TEST_SUITE_P(
250250
TestCase{"optional.of('abc').optFlatMap(x, optional.of(x + 'def'))",
251251
IsOptionalType(AstType(ast_internal::PrimitiveType::kString))},
252252
// Legacy nullability behaviors.
253-
TestCase{"google.api.expr.test.v1.proto3.TestAllTypes{?null_value: "
253+
TestCase{"cel.expr.conformance.proto3.TestAllTypes{?null_value: "
254254
"optional.of(0)}",
255255
Eq(AstType(ast_internal::MessageType(
256-
"google.api.expr.test.v1.proto3.TestAllTypes")))},
257-
TestCase{
258-
"google.api.expr.test.v1.proto3.TestAllTypes{?null_value: null}",
259-
Eq(AstType(ast_internal::MessageType(
260-
"google.api.expr.test.v1.proto3.TestAllTypes")))},
261-
TestCase{"google.api.expr.test.v1.proto3.TestAllTypes{?null_value: "
256+
"cel.expr.conformance.proto3.TestAllTypes")))},
257+
TestCase{"cel.expr.conformance.proto3.TestAllTypes{?null_value: null}",
258+
Eq(AstType(ast_internal::MessageType(
259+
"cel.expr.conformance.proto3.TestAllTypes")))},
260+
TestCase{"cel.expr.conformance.proto3.TestAllTypes{?null_value: "
262261
"optional.of(null)}",
263262
Eq(AstType(ast_internal::MessageType(
264-
"google.api.expr.test.v1.proto3.TestAllTypes")))},
265-
TestCase{"google.api.expr.test.v1.proto3.TestAllTypes{}.?single_int64 "
263+
"cel.expr.conformance.proto3.TestAllTypes")))},
264+
TestCase{"cel.expr.conformance.proto3.TestAllTypes{}.?single_int64 "
266265
"== null",
267266
Eq(AstType(ast_internal::PrimitiveType::kBool))}));
268267

@@ -311,11 +310,10 @@ INSTANTIATE_TEST_SUITE_P(
311310
OptionalTests, OptionalStrictNullAssignmentTest,
312311
::testing::Values(
313312
TestCase{
314-
"google.api.expr.test.v1.proto3.TestAllTypes{?single_int64: null}",
315-
_,
313+
"cel.expr.conformance.proto3.TestAllTypes{?single_int64: null}", _,
316314
"expected type of field 'single_int64' is 'optional_type<int>' but "
317315
"provided type is 'null_type'"},
318-
TestCase{"google.api.expr.test.v1.proto3.TestAllTypes{}.?single_int64 "
316+
TestCase{"cel.expr.conformance.proto3.TestAllTypes{}.?single_int64 "
319317
"== null",
320318
_, "no matching overload for '_==_'"}));
321319

codelab/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ cc_library(
4848
"@com_google_absl//absl/status",
4949
"@com_google_absl//absl/status:statusor",
5050
"@com_google_absl//absl/strings",
51-
"@com_google_googleapis//google/api/expr/v1alpha1:syntax_cc_proto",
51+
"@com_google_cel_spec//proto/cel/expr:syntax_cc_proto",
5252
"@com_google_protobuf//:protobuf",
5353
],
5454
)
@@ -80,7 +80,7 @@ cc_library(
8080
"@com_google_absl//absl/status",
8181
"@com_google_absl//absl/status:statusor",
8282
"@com_google_absl//absl/strings",
83-
"@com_google_googleapis//google/api/expr/v1alpha1:syntax_cc_proto",
83+
"@com_google_cel_spec//proto/cel/expr:syntax_cc_proto",
8484
"@com_google_googleapis//google/rpc/context:attribute_context_cc_proto",
8585
"@com_google_protobuf//:protobuf",
8686
],

codelab/exercise1.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <memory>
1818
#include <string>
1919

20-
#include "google/api/expr/v1alpha1/syntax.pb.h"
20+
#include "proto/cel/expr/syntax.pb.h"
2121
#include "google/protobuf/arena.h"
2222
#include "absl/status/status.h"
2323
#include "absl/strings/str_cat.h"
@@ -54,7 +54,7 @@ absl::StatusOr<std::string> ConvertResult(const CelValue& value) {
5454
absl::StatusOr<std::string> ParseAndEvaluate(absl::string_view cel_expr) {
5555
// === Start Codelab ===
5656
// Parse the expression using ::google::api::expr::parser::Parse;
57-
// This will return a google::api::expr::v1alpha1::ParsedExpr message.
57+
// This will return a cel::expr::ParsedExpr message.
5858

5959
// Setup a default environment for building expressions.
6060
// std::unique_ptr<CelExpressionBuilder> builder =

codelab/exercise2.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <memory>
1818
#include <string>
1919

20-
#include "google/api/expr/v1alpha1/syntax.pb.h"
20+
#include "proto/cel/expr/syntax.pb.h"
2121
#include "google/rpc/context/attribute_context.pb.h"
2222
#include "google/protobuf/arena.h"
2323
#include "absl/status/status.h"
@@ -35,7 +35,7 @@
3535
namespace google::api::expr::codelab {
3636
namespace {
3737

38-
using ::google::api::expr::v1alpha1::ParsedExpr;
38+
using ::cel::expr::ParsedExpr;
3939
using ::google::api::expr::parser::Parse;
4040
using ::google::api::expr::runtime::Activation;
4141
using ::google::api::expr::runtime::CelError;

codelab/solutions/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ cc_library(
3232
"@com_google_absl//absl/status",
3333
"@com_google_absl//absl/status:statusor",
3434
"@com_google_absl//absl/strings",
35-
"@com_google_googleapis//google/api/expr/v1alpha1:syntax_cc_proto",
35+
"@com_google_cel_spec//proto/cel/expr:syntax_cc_proto",
3636
"@com_google_protobuf//:protobuf",
3737
],
3838
)
@@ -63,7 +63,7 @@ cc_library(
6363
"@com_google_absl//absl/status",
6464
"@com_google_absl//absl/status:statusor",
6565
"@com_google_absl//absl/strings",
66-
"@com_google_googleapis//google/api/expr/v1alpha1:syntax_cc_proto",
66+
"@com_google_cel_spec//proto/cel/expr:syntax_cc_proto",
6767
"@com_google_googleapis//google/rpc/context:attribute_context_cc_proto",
6868
"@com_google_protobuf//:protobuf",
6969
],

codelab/solutions/exercise1.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <memory>
1818
#include <string>
1919

20-
#include "google/api/expr/v1alpha1/syntax.pb.h"
20+
#include "proto/cel/expr/syntax.pb.h"
2121
#include "google/protobuf/arena.h"
2222
#include "absl/status/status.h"
2323
#include "absl/strings/str_cat.h"
@@ -34,7 +34,7 @@
3434
namespace google::api::expr::codelab {
3535
namespace {
3636

37-
using ::google::api::expr::v1alpha1::ParsedExpr;
37+
using ::cel::expr::ParsedExpr;
3838
using ::google::api::expr::parser::Parse;
3939
using ::google::api::expr::runtime::Activation;
4040
using ::google::api::expr::runtime::CelExpression;

0 commit comments

Comments
 (0)