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
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ public static CelBuilder plannerCelBuilder() {
CelCheckerLegacyImpl.newBuilder().setStandardEnvironmentEnabled(true)),
CelRuntimeImpl.newBuilder())
// CEL-Internal-2
.setOptions(
CelOptions.current()
.enableHeterogeneousNumericComparisons(true)
.enableTimestampEpoch(true)
.build());
.setOptions(CelOptions.current().enableHeterogeneousNumericComparisons(true).build());
}

private CelExperimentalFactory() {}
Expand Down
1 change: 0 additions & 1 deletion bundle/src/test/java/dev/cel/bundle/CelImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2109,7 +2109,6 @@ public void program_fdsContainsWktDependency_descriptorInstancesMatch() throws E
standardCelBuilderWithMacros()
.addMessageTypes(descriptors)
// CEL-Internal-2
.setOptions(CelOptions.current().enableTimestampEpoch(true).build())
.setContainer(CelContainer.ofName("cel.expr.conformance.proto3"))
.build();
CelAbstractSyntaxTree ast =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void toCheckerBuilder_isImmutable() {
public void toCheckerBuilder_singularFields_copied() {
CelStandardDeclarations subsetDecls =
CelStandardDeclarations.newBuilder().includeFunctions(StandardFunction.BOOL).build();
CelOptions celOptions = CelOptions.current().enableTimestampEpoch(true).build();
CelOptions celOptions = CelOptions.current().build();
CelContainer celContainer = CelContainer.ofName("foo");
CelType expectedResultType = SimpleType.BOOL;
CelTypeProvider customTypeProvider =
Expand Down
12 changes: 9 additions & 3 deletions common/src/main/java/dev/cel/common/CelOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,20 @@ public abstract static class Builder {
public abstract Builder enableHomogeneousLiterals(boolean value);

/**
* Enable the {@code int64_to_timestamp} overload which creates a timestamp from Uxix epoch
* Enable the {@code int64_to_timestamp} overload which creates a timestamp from Unix epoch
* seconds.
*
* <p>This option will be automatically enabled after a sufficient period of time has elapsed to
* ensure that all runtimes support the implementation.
* <p>Historically used to opt-in to this feature, this option is now enabled by default across
* all runtimes.
*
* <p>TODO: Remove this feature once it has been auto-enabled.
*
* @deprecated This option is now enabled by default. If you are passing {@code true}, simply
* remove this method call. If you are passing {@code false} to disable this feature, subset
* the environment instead using {@code dev.cel.checker.CelStandardDeclarations} and {@code
* dev.cel.runtime.CelStandardFunctions}.
*/
@Deprecated
public abstract Builder enableTimestampEpoch(boolean value);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public final class ConformanceTest extends Statement {

private static final CelOptions OPTIONS =
CelOptions.current()
.enableTimestampEpoch(true)
.enableHeterogeneousNumericComparisons(true)
.enableProtoDifferencerEquality(true)
.enableOptionalSyntax(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,7 @@ private CelBuilder newCelBuilder(int version) {
}

return celBuilder
.setOptions(
CelOptions.current()
.enableTimestampEpoch(true)
.enableHeterogeneousNumericComparisons(true)
.build())
.setOptions(CelOptions.current().enableHeterogeneousNumericComparisons(true).build())
.setStandardMacros(CelStandardMacro.STANDARD_MACROS)
.setContainer(CelContainer.ofName("cel.expr.conformance.proto3"))
.addMessageTypes(TestAllTypes.getDescriptor())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
@RunWith(TestParameterInjector.class)
public class ConstantFoldingOptimizerTest {
private static final CelOptions CEL_OPTIONS =
CelOptions.current().populateMacroCalls(true).enableTimestampEpoch(true).build();
CelOptions.current().populateMacroCalls(true).build();
private static final Cel CEL =
CelFactory.standardCelBuilder()
.addVar("x", SimpleType.DYN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ public class InliningOptimizerTest {
"child",
StructTypeReference.create(TestAllTypes.NestedMessage.getDescriptor().getFullName()))
.addVar("shadowed_ident", SimpleType.INT)
.setOptions(
CelOptions.current().populateMacroCalls(true).enableTimestampEpoch(true).build())
.setOptions(CelOptions.current().populateMacroCalls(true).build())
.build();

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,7 @@ private static CelBuilder newCelBuilder() {
.addMessageTypes(TestAllTypes.getDescriptor())
.setContainer(CelContainer.ofName("cel.expr.conformance.proto3"))
.setStandardMacros(CelStandardMacro.STANDARD_MACROS)
.setOptions(
CelOptions.current().enableTimestampEpoch(true).populateMacroCalls(true).build())
.setOptions(CelOptions.current().populateMacroCalls(true).build())
.addCompilerLibraries(
CelExtensions.optional(), CelExtensions.bindings(), CelExtensions.comprehensions())
.addRuntimeLibraries(CelExtensions.optional(), CelExtensions.comprehensions())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ private static CelBuilder newCelBuilder() {
return CelFactory.standardCelBuilder()
.addMessageTypes(TestAllTypes.getDescriptor())
.setStandardMacros(CelStandardMacro.STANDARD_MACROS)
.setOptions(
CelOptions.current().enableTimestampEpoch(true).populateMacroCalls(true).build())
.setOptions(CelOptions.current().populateMacroCalls(true).build())
.addCompilerLibraries(CelExtensions.bindings())
.addFunctionDeclarations(
CelFunctionDecl.newFunctionDeclaration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ public final class CelRuntimeExperimentalFactory {
public static CelRuntimeBuilder plannerRuntimeBuilder() {
return CelRuntimeImpl.newBuilder()
// CEL-Internal-2
.setOptions(
CelOptions.current()
.enableTimestampEpoch(true)
.enableHeterogeneousNumericComparisons(true)
.build());
.setOptions(CelOptions.current().enableHeterogeneousNumericComparisons(true).build());
}

private CelRuntimeExperimentalFactory() {}
Expand Down
3 changes: 1 addition & 2 deletions runtime/src/test/java/dev/cel/runtime/ActivationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@
public final class ActivationTest {

private static final CelOptions TEST_OPTIONS =
CelOptions.current().enableTimestampEpoch(true).enableUnsignedLongs(true).build();
CelOptions.current().enableUnsignedLongs(true).build();

private static final CelOptions TEST_OPTIONS_SKIP_UNSET_FIELDS =
CelOptions.current()
.enableTimestampEpoch(true)
.enableUnsignedLongs(true)
.fromProtoUnsetFieldOption(CelOptions.ProtoUnsetFieldOptions.SKIP)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public void unsignedLongsDisabled_int64Identity_throws() {
public void timestampEpochDisabled_int64Identity_throws() {
CelCompiler celCompiler =
CelCompilerFactory.standardCelCompilerBuilder()
.setOptions(CelOptions.current().enableTimestampEpoch(true).build())
.setOptions(CelOptions.current().build())
.build();
CelRuntime celRuntime =
CelRuntimeFactory.standardCelRuntimeBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import dev.cel.bundle.CelFactory;
import dev.cel.common.CelAbstractSyntaxTree;
import dev.cel.common.CelContainer;
import dev.cel.common.CelOptions;
import dev.cel.common.types.OpaqueType;
import dev.cel.common.types.OptionalType;
import dev.cel.common.types.ProtoMessageTypeProvider;
Expand All @@ -44,7 +43,6 @@ public class DescriptorTypeResolverTest {

private static final Cel CEL =
CelFactory.standardCelBuilder()
.setOptions(CelOptions.current().enableTimestampEpoch(true).build())
.setTypeProvider(PROTO_MESSAGE_TYPE_PROVIDER)
.addCompilerLibraries(CelOptionalLibrary.INSTANCE)
.addRuntimeLibraries(CelOptionalLibrary.INSTANCE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ public void planner_unknownResultSet_success() {
celRuntime =
newBaseRuntimeBuilder(
CelOptions.current()
.enableTimestampEpoch(true)
.enableHeterogeneousNumericComparisons(true)
.enableOptionalSyntax(true)
.comprehensionMaxIterations(1_000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ public abstract class BaseInterpreterTest extends CelBaselineTestCase {

private static final CelOptions BASE_CEL_OPTIONS =
CelOptions.current()
.enableTimestampEpoch(true)
.enableHeterogeneousNumericComparisons(true)
.enableOptionalSyntax(true)
.comprehensionMaxIterations(1_000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public abstract class CelBaselineTestCase extends BaselineTestCase {
protected static final int COMPREHENSION_MAX_ITERATIONS = 1_000;
protected static final CelOptions TEST_OPTIONS =
CelOptions.current()
.enableTimestampEpoch(true)
.enableHeterogeneousNumericComparisons(true)
.enableHiddenAccumulatorVar(true)
.enableOptionalSyntax(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@

@RunWith(TestParameterInjector.class)
public class RegexLiteralValidatorTest {
private static final CelOptions CEL_OPTIONS =
CelOptions.current().enableTimestampEpoch(true).build();
private static final CelOptions CEL_OPTIONS = CelOptions.current().build();

private static final Cel CEL = CelFactory.standardCelBuilder().setOptions(CEL_OPTIONS).build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@

@RunWith(TestParameterInjector.class)
public class TimestampLiteralValidatorTest {
private static final CelOptions CEL_OPTIONS =
CelOptions.current().enableTimestampEpoch(true).build();
private static final CelOptions CEL_OPTIONS = CelOptions.current().build();

private static final Cel CEL = CelFactory.standardCelBuilder().setOptions(CEL_OPTIONS).build();

Expand Down Expand Up @@ -205,7 +204,7 @@ public void parentIsNotCallExpr_doesNotThrow(String source) throws Exception {
public void env_withSetResultType_success() throws Exception {
Cel cel =
CelFactory.standardCelBuilder()
.setOptions(CelOptions.current().enableTimestampEpoch(true).build())
.setOptions(CelOptions.current().build())
.setResultType(SimpleType.BOOL)
.build();
CelValidator validator =
Expand Down
Loading