|
| 1 | +/* |
| 2 | + * Copyright (C) 2021 The Authors of CEL-Java |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +import com.google.protobuf.gradle.ProtobufExtension |
| 18 | +import com.google.protobuf.gradle.ProtobufPlugin |
| 19 | + |
| 20 | +plugins { |
| 21 | + `java-library` |
| 22 | + `maven-publish` |
| 23 | + signing |
| 24 | + `cel-conventions` |
| 25 | + `java-test-fixtures` |
| 26 | +} |
| 27 | + |
| 28 | +apply<ProtobufPlugin>() |
| 29 | + |
| 30 | +sourceSets.main { |
| 31 | + java.srcDir(layout.buildDirectory.dir("generated/source/proto/main/java")) |
| 32 | + java.destinationDirectory.set(layout.buildDirectory.dir("classes/java/generated")) |
| 33 | +} |
| 34 | + |
| 35 | +sourceSets.test { |
| 36 | + java.srcDir(layout.buildDirectory.dir("generated/source/proto/test/java")) |
| 37 | + java.destinationDirectory.set(layout.buildDirectory.dir("classes/java/generatedTest")) |
| 38 | +} |
| 39 | + |
| 40 | +dependencies { |
| 41 | + api(libs.protobuf.java) { version { strictly(libs.versions.protobuf3.get()) } } |
| 42 | + |
| 43 | + // Since we need the protobuf stuff in this cel-core module, it's easy to generate the |
| 44 | + // gRPC code as well. But do not expose the gRPC dependencies "publicly". |
| 45 | + compileOnly(libs.grpc.protobuf) |
| 46 | + compileOnly(libs.grpc.stub) |
| 47 | + compileOnly(libs.tomcat.annotations.api) |
| 48 | +} |
| 49 | + |
| 50 | +// *.proto files taken from https://github.com/googleapis/googleapis/ repo, available as a git |
| 51 | +// submodule |
| 52 | +configure<ProtobufExtension> { |
| 53 | + // Configure the protoc executable |
| 54 | + protoc { |
| 55 | + // Download from repositories |
| 56 | + artifact = "com.google.protobuf:protoc:${libs.versions.protobuf3.get()}" |
| 57 | + } |
| 58 | +} |
0 commit comments