MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / Setup

Method Setup

conformance/service.cc:583–627  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

581 }
582
583 absl::StatusOr<std::unique_ptr<const cel::Runtime>> Setup(
584 absl::string_view container) {
585 RuntimeOptions options(options_);
586 options.container = std::string(container);
587 CEL_ASSIGN_OR_RETURN(
588 auto builder, CreateStandardRuntimeBuilder(
589 google::protobuf::DescriptorPool::generated_pool(), options));
590
591 if (enable_optimizations_) {
592 CEL_RETURN_IF_ERROR(cel::extensions::EnableConstantFolding(
593 builder, google::protobuf::MessageFactory::generated_factory()));
594 }
595 CEL_RETURN_IF_ERROR(cel::EnableReferenceResolver(
596 builder, cel::ReferenceResolverEnabled::kAlways));
597 if (enable_select_optimization_) {
598 CEL_RETURN_IF_ERROR(cel::extensions::EnableSelectOptimization(builder));
599 }
600
601 auto& type_registry = builder.type_registry();
602 // Use linked pbs in the generated descriptor pool.
603 CEL_RETURN_IF_ERROR(RegisterProtobufEnum(
604 type_registry,
605 cel::expr::conformance::proto2::GlobalEnum_descriptor()));
606 CEL_RETURN_IF_ERROR(RegisterProtobufEnum(
607 type_registry,
608 cel::expr::conformance::proto3::GlobalEnum_descriptor()));
609 CEL_RETURN_IF_ERROR(RegisterProtobufEnum(
610 type_registry,
611 cel::expr::conformance::proto2::TestAllTypes::NestedEnum_descriptor()));
612 CEL_RETURN_IF_ERROR(RegisterProtobufEnum(
613 type_registry,
614 cel::expr::conformance::proto3::TestAllTypes::NestedEnum_descriptor()));
615
616 CEL_RETURN_IF_ERROR(cel::extensions::RegisterComprehensionsV2Functions(
617 builder.function_registry(), options));
618 CEL_RETURN_IF_ERROR(cel::extensions::EnableOptionalTypes(builder));
619 CEL_RETURN_IF_ERROR(cel::extensions::RegisterEncodersFunctions(
620 builder.function_registry(), options));
621 CEL_RETURN_IF_ERROR(cel::extensions::RegisterStringsFunctions(
622 builder.function_registry(), options));
623 CEL_RETURN_IF_ERROR(cel::extensions::RegisterMathExtensionFunctions(
624 builder.function_registry(), options));
625
626 return std::move(builder).Build();
627 }
628
629 void Parse(const conformance::v1alpha1::ParseRequest& request,
630 conformance::v1alpha1::ParseResponse& response) override {

Callers

nothing calls this directly

Calls 9

EnableReferenceResolverFunction · 0.85
EnableSelectOptimizationFunction · 0.85
RegisterProtobufEnumFunction · 0.85
EnableOptionalTypesFunction · 0.85
RegisterStringsFunctionsFunction · 0.85
BuildMethod · 0.45

Tested by

no test coverage detected