diff --git a/bom/build.gradle.kts b/bom/build.gradle.kts index a5060961..53f79e83 100644 --- a/bom/build.gradle.kts +++ b/bom/build.gradle.kts @@ -26,6 +26,7 @@ dependencies { api(project(":cel-core")) api(project(":cel-generated-antlr", "shadow")) api(project(":cel-generated-pb")) + api(project(":cel-generated-pb3")) api(project(":cel-conformance")) api(project(":cel-jackson")) api(project(":cel-tools")) diff --git a/conformance/build.gradle.kts b/conformance/build.gradle.kts index 613d3174..e8e8e313 100644 --- a/conformance/build.gradle.kts +++ b/conformance/build.gradle.kts @@ -33,12 +33,14 @@ sourceSets.main { java.srcDir(layout.buildDirectory.dir("generated/source/proto/main/grpc")) } +configurations.all { exclude(group = "org.projectnessie.cel", module = "cel-generated-pb") } + dependencies { implementation(project(":cel-core")) implementation(testFixtures(project(":cel-core"))) - implementation(testFixtures(project(":cel-generated-pb"))) + implementation(testFixtures(project(":cel-generated-pb3"))) - implementation(libs.protobuf.java) + implementation(libs.protobuf.java) { version { strictly(libs.versions.protobuf3.get()) } } implementation(libs.grpc.protobuf) implementation(libs.grpc.stub) @@ -59,7 +61,7 @@ configure { // Configure the protoc executable protoc { // Download from repositories - artifact = "com.google.protobuf:protoc:${libs.versions.protobuf.get()}" + artifact = "com.google.protobuf:protoc:${libs.versions.protobuf3.get()}" } plugins { this.create("grpc") { artifact = "io.grpc:protoc-gen-grpc-java:${libs.versions.grpc.get()}" } diff --git a/generated-pb3/build.gradle.kts b/generated-pb3/build.gradle.kts new file mode 100644 index 00000000..de2c819e --- /dev/null +++ b/generated-pb3/build.gradle.kts @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2021 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. + */ + +import com.google.protobuf.gradle.ProtobufExtension +import com.google.protobuf.gradle.ProtobufPlugin + +plugins { + `java-library` + `maven-publish` + signing + `cel-conventions` + `java-test-fixtures` +} + +apply() + +sourceSets.main { + java.srcDir(layout.buildDirectory.dir("generated/source/proto/main/java")) + java.destinationDirectory.set(layout.buildDirectory.dir("classes/java/generated")) +} + +sourceSets.test { + java.srcDir(layout.buildDirectory.dir("generated/source/proto/test/java")) + java.destinationDirectory.set(layout.buildDirectory.dir("classes/java/generatedTest")) +} + +dependencies { + api(libs.protobuf.java) { version { strictly(libs.versions.protobuf3.get()) } } + + // Since we need the protobuf stuff in this cel-core module, it's easy to generate the + // gRPC code as well. But do not expose the gRPC dependencies "publicly". + compileOnly(libs.grpc.protobuf) + compileOnly(libs.grpc.stub) + compileOnly(libs.tomcat.annotations.api) +} + +// *.proto files taken from https://github.com/googleapis/googleapis/ repo, available as a git +// submodule +configure { + // Configure the protoc executable + protoc { + // Download from repositories + artifact = "com.google.protobuf:protoc:${libs.versions.protobuf3.get()}" + } +} diff --git a/generated-pb3/src b/generated-pb3/src new file mode 120000 index 00000000..454c0e97 --- /dev/null +++ b/generated-pb3/src @@ -0,0 +1 @@ +../generated-pb/src \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6a9e6d51..9575f250 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,7 +14,8 @@ jmh = "1.37" junit = "5.10.3" nessieBuildPlugins = "0.2.24" nessieRunPlugin = "0.27.3" -protobuf = "3.25.4" +protobuf = "4.27.3" +protobuf3 = "3.25.4" protobufPlugin = "0.9.4" shadowPlugin = "8.1.1" slf4j = "1.7.36" diff --git a/settings.gradle.kts b/settings.gradle.kts index 4f604424..1e7d5435 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -91,6 +91,8 @@ celProject("generated-antlr") celProject("generated-pb") +celProject("generated-pb3") + celProject("core") celProject("jackson")