From fd014ad0bd24ffe93c065a1f4ad5aee0a8921749 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 11:43:59 +0000 Subject: [PATCH 1/3] Update dependency io.quarkus to v4 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 88c65a25..ac3ff2bc 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,7 +16,7 @@ nessieRunPlugin = "0.27.3" protobuf = "4.36.2" protobuf3 = { strictly = "[3.25.9, 3.26[", prefer = "3.25.9" } protobufPlugin = "0.10.1" -quarkus = "3.40.1.2" +quarkus = "4.0.1" shadowPlugin = "9.6.1" slf4j = "1.7.36" spotlessPlugin = "8.12.0" From 339743c067502592b689ba1ee50d743907333e48 Mon Sep 17 00:00:00 2001 From: Robert Stupp Date: Sat, 28 Nov 2026 10:54:28 +0100 Subject: [PATCH 2/3] Adapt Quarkus smoke tests to Quarkus 4 Quarkus 4 uses Jackson 3 and no longer provides Jackson 2 databind, so `quarkus-smoke-standalone` now declares Jackson 2 explicitly to keep covering `cel-standalone` with Jackson 2. `quarkus-smoke-core-pb3-jackson3` now uses `enforcedPlatform` for the Quarkus BOM, as generated Quarkus Gradle projects do. This keeps Jackson 3 at the version Quarkus manages, which its native-image substitutions require. --- quarkus-smoke-core-pb3-jackson3/build.gradle.kts | 2 +- quarkus-smoke-standalone/build.gradle.kts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/quarkus-smoke-core-pb3-jackson3/build.gradle.kts b/quarkus-smoke-core-pb3-jackson3/build.gradle.kts index 7a652b06..931a0cbf 100644 --- a/quarkus-smoke-core-pb3-jackson3/build.gradle.kts +++ b/quarkus-smoke-core-pb3-jackson3/build.gradle.kts @@ -37,7 +37,7 @@ if (testNativeRequested) { dependencies { // This smoke project deliberately verifies Protobuf 3, while the Quarkus BOM tracks Protobuf 4. - implementation(platform(libs.quarkus.bom)) { + implementation(enforcedPlatform(libs.quarkus.bom)) { exclude(group = "com.google.protobuf", module = "protobuf-java") } implementation("io.quarkus:quarkus-arc") diff --git a/quarkus-smoke-standalone/build.gradle.kts b/quarkus-smoke-standalone/build.gradle.kts index 497049fe..a238e9c8 100644 --- a/quarkus-smoke-standalone/build.gradle.kts +++ b/quarkus-smoke-standalone/build.gradle.kts @@ -36,10 +36,13 @@ if (testNativeRequested) { } dependencies { - implementation(platform(libs.quarkus.bom)) + implementation(enforcedPlatform(libs.quarkus.bom)) implementation("io.quarkus:quarkus-arc") implementation("io.quarkus:quarkus-rest-jackson") implementation(project(":cel-standalone")) { isTransitive = false } + // Quarkus 4 uses Jackson 3; this smoke test covers cel-standalone with Jackson 2. + implementation(platform(libs.jackson2.bom)) + implementation("com.fasterxml.jackson.core:jackson-databind") testImplementation("io.quarkus:quarkus-junit5") testImplementation("io.rest-assured:rest-assured") From 1b3d8bc17a77859487b3b745a25076501df45dd3 Mon Sep 17 00:00:00 2001 From: Robert Stupp Date: Sat, 28 Nov 2026 10:49:39 +0100 Subject: [PATCH 3/3] Add Quarkus native smoke test for cel-core with cel-generated-pb None of the existing Quarkus smoke tests covers the non-relocated `cel-generated-pb` (Protobuf 4) native-image metadata: the standalone test uses the relocated copy and the other test uses `cel-generated-pb3`. Add `quarkus-smoke-core-pb4-jackson3`, using `cel-core`, `cel-generated-pb`, and `cel-jackson3`. `protobuf-java` is excluded from the enforced Quarkus BOM, because the generated classes require a Protobuf runtime at least as new as their gencode. Document that requirement in the README and point to `cel-standalone` for projects whose platform manages an older `protobuf-java`. --- README.md | 6 + .../main/kotlin/cel-conventions.gradle.kts | 1 + .../build.gradle.kts | 60 ++++++++ .../smoke/corepb4jackson3/SmokeResource.java | 142 ++++++++++++++++++ .../src/main/resources/application.properties | 18 +++ .../SmokeResourceNativeIT.java | 21 +++ .../corepb4jackson3/SmokeResourceTest.java | 37 +++++ settings.gradle.kts | 2 + 8 files changed, 287 insertions(+) create mode 100644 quarkus-smoke-core-pb4-jackson3/build.gradle.kts create mode 100644 quarkus-smoke-core-pb4-jackson3/src/main/java/org/projectnessie/cel/quarkus/smoke/corepb4jackson3/SmokeResource.java create mode 100644 quarkus-smoke-core-pb4-jackson3/src/main/resources/application.properties create mode 100644 quarkus-smoke-core-pb4-jackson3/src/native-test/java/org/projectnessie/cel/quarkus/smoke/corepb4jackson3/SmokeResourceNativeIT.java create mode 100644 quarkus-smoke-core-pb4-jackson3/src/test/java/org/projectnessie/cel/quarkus/smoke/corepb4jackson3/SmokeResourceTest.java diff --git a/README.md b/README.md index fbb49c0f..7487f34f 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,12 @@ longer choose a generated protobuf runtime transitively. Add exactly one of thes Do not put both generated protobuf artifacts on the same classpath; they provide the same generated CEL protobuf classes for different protobuf runtime choices. +The generated protobuf classes check at runtime that `protobuf-java` is at least as new as the +protobuf version they were generated with. If your framework or platform BOM manages an older +`protobuf-java` (for example, Quarkus 4.0 manages 4.35.x), loading CEL-Java fails with a +`ProtobufRuntimeVersionException`. Either override the managed `protobuf-java` version, or use +[`cel-standalone`](#dependency-free-artifact), which relocates its protobuf dependencies. + ## Usage ### Basic scripts diff --git a/build-logic/src/main/kotlin/cel-conventions.gradle.kts b/build-logic/src/main/kotlin/cel-conventions.gradle.kts index 8a66f9c5..785fcf51 100644 --- a/build-logic/src/main/kotlin/cel-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/cel-conventions.gradle.kts @@ -23,6 +23,7 @@ val nonPublishedProjects = "cel-conformance", "cel-quarkus-smoke-standalone", "cel-quarkus-smoke-core-pb3-jackson3", + "cel-quarkus-smoke-core-pb4-jackson3", ) if (project.name !in nonPublishedProjects) { diff --git a/quarkus-smoke-core-pb4-jackson3/build.gradle.kts b/quarkus-smoke-core-pb4-jackson3/build.gradle.kts new file mode 100644 index 00000000..58fc2755 --- /dev/null +++ b/quarkus-smoke-core-pb4-jackson3/build.gradle.kts @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2026 The Authors of CEL-Java + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + alias(libs.plugins.quarkus) + id("cel-conventions") + `java-library` +} + +description = "Quarkus native smoke test for cel-core, cel-generated-pb, and cel-jackson3" + +val testNativeRequested = + gradle.startParameter.taskNames.any { taskName -> + taskName == "testNative" || taskName == "${project.path}:testNative" + } + +if (testNativeRequested) { + quarkus { + set("native.enabled", "true") + set("native.container-build", "true") + set("package.jar.enabled", "false") + } +} + +dependencies { + // cel-generated-pb requires a Protobuf runtime at least as new as its gencode, which can be newer + // than the Protobuf version managed by the Quarkus BOM. + implementation(enforcedPlatform(libs.quarkus.bom)) { + exclude(group = "com.google.protobuf", module = "protobuf-java") + } + implementation("io.quarkus:quarkus-arc") + implementation("io.quarkus:quarkus-rest-jackson") + implementation(project(":cel-core")) + implementation(project(":cel-generated-pb")) + implementation(testFixtures(project(":cel-generated-pb"))) + implementation(project(":cel-jackson3")) + + testImplementation("io.quarkus:quarkus-junit5") + testImplementation("io.rest-assured:rest-assured") +} + +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 +} + +tasks.withType().configureEach { options.release.set(21) } diff --git a/quarkus-smoke-core-pb4-jackson3/src/main/java/org/projectnessie/cel/quarkus/smoke/corepb4jackson3/SmokeResource.java b/quarkus-smoke-core-pb4-jackson3/src/main/java/org/projectnessie/cel/quarkus/smoke/corepb4jackson3/SmokeResource.java new file mode 100644 index 00000000..c45030f4 --- /dev/null +++ b/quarkus-smoke-core-pb4-jackson3/src/main/java/org/projectnessie/cel/quarkus/smoke/corepb4jackson3/SmokeResource.java @@ -0,0 +1,142 @@ +/* + * Copyright (C) 2026 The Authors of CEL-Java + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.projectnessie.cel.quarkus.smoke.corepb4jackson3; + +import static java.util.Arrays.asList; +import static java.util.Map.of; +import static org.projectnessie.cel.Env.newCustomEnv; +import static org.projectnessie.cel.EnvOption.declarations; +import static org.projectnessie.cel.EnvOption.types; +import static org.projectnessie.cel.Library.StdLib; + +import com.google.protobuf.Int32Value; +import dev.cel.expr.conformance.proto3.NestedTestAllTypes; +import dev.cel.expr.conformance.proto3.TestAllTypes; +import io.quarkus.runtime.annotations.RegisterForReflection; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import java.time.Instant; +import org.projectnessie.cel.Ast; +import org.projectnessie.cel.Env; +import org.projectnessie.cel.Env.AstIssuesTuple; +import org.projectnessie.cel.Program; +import org.projectnessie.cel.Program.EvalResult; +import org.projectnessie.cel.checker.Decls; +import org.projectnessie.cel.common.types.Err; +import org.projectnessie.cel.common.types.pb.ProtoTypeRegistry; +import org.projectnessie.cel.common.types.ref.Val; +import org.projectnessie.cel.types.jackson3.Jackson3Registry; + +@Path("/cel/native-smoke") +public class SmokeResource { + private static final String JACKSON_EXPRESSION = + "input.name == \"reports\" && request.time < timestamp(\"2026-08-01T00:00:00Z\")"; + + private static final String PROTO_EXPRESSION = "proto.single_int32_wrapper == 123"; + + @GET + @Produces(MediaType.APPLICATION_JSON) + public SmokeResponse smoke() { + return new SmokeResponse( + "cel-core+cel-generated-pb+cel-jackson3", evaluateJackson(), evaluateProto()); + } + + private boolean evaluateJackson() { + Env env = + newCustomEnv( + Jackson3Registry.newRegistry(), + asList( + StdLib(), + types(Input.class), + declarations( + Decls.newVar("input", Decls.newObjectType(Input.class.getName())), + Decls.newVar("request.time", Decls.Timestamp)))); + + Program program = compile(env, JACKSON_EXPRESSION); + EvalResult result = + program.eval( + of( + "input", + new Input("reports"), + "request.time", + Instant.parse("2026-07-31T23:59:59Z"))); + return booleanResult(result); + } + + private boolean evaluateProto() { + Env env = + newCustomEnv( + ProtoTypeRegistry.newRegistry(), + asList( + StdLib(), + types(TestAllTypes.getDefaultInstance()), + declarations( + Decls.newVar( + "proto", + Decls.newObjectType(TestAllTypes.getDescriptor().getFullName()))))); + + Program program = compile(env, PROTO_EXPRESSION); + EvalResult result = + program.eval( + of( + "proto", + TestAllTypes.newBuilder().setSingleInt32Wrapper(Int32Value.of(123)).build())); + return booleanResult(result); + } + + private static Program compile(Env env, String expression) { + AstIssuesTuple parsed = env.parse(expression); + if (parsed.hasIssues()) { + throw new IllegalStateException("parse failed: " + parsed.getIssues()); + } + + Ast ast = parsed.getAst(); + AstIssuesTuple checked = env.check(ast); + if (checked.hasIssues()) { + throw new IllegalStateException("check failed: " + checked.getIssues()); + } + + return env.program(checked.getAst()); + } + + private static boolean booleanResult(EvalResult result) { + Val value = result.getVal(); + if (Err.isError(value)) { + throw new IllegalStateException("evaluation failed: " + value); + } + return value.booleanValue(); + } + + public record SmokeResponse(String engine, boolean jackson, boolean protobuf) {} + + @RegisterForReflection(targets = {TestAllTypes.class, NestedTestAllTypes.class}) + static final class ProtobufReflection {} + + @RegisterForReflection + public static final class Input { + private final String name; + + public Input(String name) { + this.name = name; + } + + public String getName() { + return name; + } + } +} diff --git a/quarkus-smoke-core-pb4-jackson3/src/main/resources/application.properties b/quarkus-smoke-core-pb4-jackson3/src/main/resources/application.properties new file mode 100644 index 00000000..7de0b692 --- /dev/null +++ b/quarkus-smoke-core-pb4-jackson3/src/main/resources/application.properties @@ -0,0 +1,18 @@ +# +# Copyright (C) 2026 The Authors of CEL-Java +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +quarkus.banner.enabled=false +quarkus.http.test-port=8183 diff --git a/quarkus-smoke-core-pb4-jackson3/src/native-test/java/org/projectnessie/cel/quarkus/smoke/corepb4jackson3/SmokeResourceNativeIT.java b/quarkus-smoke-core-pb4-jackson3/src/native-test/java/org/projectnessie/cel/quarkus/smoke/corepb4jackson3/SmokeResourceNativeIT.java new file mode 100644 index 00000000..f8c9b565 --- /dev/null +++ b/quarkus-smoke-core-pb4-jackson3/src/native-test/java/org/projectnessie/cel/quarkus/smoke/corepb4jackson3/SmokeResourceNativeIT.java @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2026 The Authors of CEL-Java + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.projectnessie.cel.quarkus.smoke.corepb4jackson3; + +import io.quarkus.test.junit.QuarkusIntegrationTest; + +@QuarkusIntegrationTest +class SmokeResourceNativeIT extends SmokeResourceTest {} diff --git a/quarkus-smoke-core-pb4-jackson3/src/test/java/org/projectnessie/cel/quarkus/smoke/corepb4jackson3/SmokeResourceTest.java b/quarkus-smoke-core-pb4-jackson3/src/test/java/org/projectnessie/cel/quarkus/smoke/corepb4jackson3/SmokeResourceTest.java new file mode 100644 index 00000000..4f464aa7 --- /dev/null +++ b/quarkus-smoke-core-pb4-jackson3/src/test/java/org/projectnessie/cel/quarkus/smoke/corepb4jackson3/SmokeResourceTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2026 The Authors of CEL-Java + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.projectnessie.cel.quarkus.smoke.corepb4jackson3; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.equalTo; + +import io.quarkus.test.junit.QuarkusTest; +import org.junit.jupiter.api.Test; + +@QuarkusTest +class SmokeResourceTest { + @Test + void evaluatesCelExpressions() { + given() + .when() + .get("/cel/native-smoke") + .then() + .statusCode(200) + .body("engine", equalTo("cel-core+cel-generated-pb+cel-jackson3")) + .body("jackson", equalTo(true)) + .body("protobuf", equalTo(true)); + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index d1ccd059..96888aeb 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -158,4 +158,6 @@ celProject("quarkus-smoke-standalone") celProject("quarkus-smoke-core-pb3-jackson3") +celProject("quarkus-smoke-core-pb4-jackson3") + celProject("bom")