Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions extensions/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ cc_library(
"//common:type",
"//common:value",
"//compiler",
"//eval/public:cel_function_registry",
"//eval/public:cel_options",
"//internal:status_macros",
"//runtime:function_registry",
"//runtime:runtime_options",
Expand Down
11 changes: 11 additions & 0 deletions extensions/sets_functions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "common/decl.h"
#include "common/type.h"
#include "common/value.h"
#include "eval/public/cel_function_registry.h"
#include "eval/public/cel_options.h"
#include "internal/status_macros.h"
#include "runtime/function_registry.h"
#include "runtime/runtime_options.h"
Expand All @@ -30,6 +32,9 @@
#include "google/protobuf/message.h"

namespace cel::extensions {
using google::api::expr::runtime::CelFunctionRegistry;
using google::api::expr::runtime::ConvertToRuntimeOptions;
using google::api::expr::runtime::InterpreterOptions;

namespace {

Expand Down Expand Up @@ -157,4 +162,10 @@ absl::Status RegisterSetsFunctions(FunctionRegistry& registry,
return absl::OkStatus();
}

absl::Status RegisterSetsFunctions(CelFunctionRegistry* registry,
const InterpreterOptions& options) {
return RegisterSetsFunctions(registry->InternalGetRegistry(),
ConvertToRuntimeOptions(options));
}

} // namespace cel::extensions
6 changes: 6 additions & 0 deletions extensions/sets_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "absl/status/status.h"
#include "checker/type_checker_builder.h"
#include "compiler/compiler.h"
#include "eval/public/cel_function_registry.h"
#include "eval/public/cel_options.h"
#include "runtime/function_registry.h"
#include "runtime/runtime_options.h"

Expand All @@ -34,6 +36,10 @@ inline CompilerLibrary SetsCompilerLibrary() {
absl::Status RegisterSetsFunctions(FunctionRegistry& registry,
const RuntimeOptions& options);

absl::Status RegisterSetsFunctions(
google::api::expr::runtime::CelFunctionRegistry* registry,
const google::api::expr::runtime::InterpreterOptions& options);

} // namespace cel::extensions

#endif // THIRD_PARTY_CEL_CPP_EXTENSIONS_SETS_FUNCTIONS_H_
8 changes: 4 additions & 4 deletions extensions/sets_functions_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ TEST_P(CelSetsFunctionsTest, EndToEnd) {
options.enable_qualified_identifier_rewrites = true;
std::unique_ptr<CelExpressionBuilder> builder =
CreateCelExpressionBuilder(options);
ASSERT_OK(RegisterSetsFunctions(builder->GetRegistry()->InternalGetRegistry(),
cel::RuntimeOptions{}));
ASSERT_OK(google::api::expr::runtime::RegisterBuiltinFunctions(
builder->GetRegistry(), options));
ASSERT_THAT(RegisterSetsFunctions(builder->GetRegistry(), options), IsOk());
ASSERT_THAT(google::api::expr::runtime::RegisterBuiltinFunctions(
builder->GetRegistry(), options),
IsOk());

// Create CelExpression from AST (Expr object).
ASSERT_OK_AND_ASSIGN(auto cel_expr, builder->CreateExpression(&checked_expr));
Expand Down