xref: /aosp_15_r20/external/grpc-grpc-java/examples/example-servlet/build.gradle (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1plugins {
2    // ASSUMES GRADLE 5.6 OR HIGHER. Use plugin version 0.8.10 with earlier gradle versions
3    id 'com.google.protobuf' version '0.8.17'
4    // Generate IntelliJ IDEA's .idea & .iml project files
5    id 'idea'
6    id 'war'
7}
8
9repositories {
10    maven { // The google mirror is less flaky than mavenCentral()
11        url "https://maven-central.storage-download.googleapis.com/maven2/" }
12    mavenLocal()
13}
14
15sourceCompatibility = 1.8
16targetCompatibility = 1.8
17
18def grpcVersion = '1.56.1-SNAPSHOT' // CURRENT_GRPC_VERSION
19def protocVersion = '3.22.3'
20
21dependencies {
22    implementation "io.grpc:grpc-protobuf:${grpcVersion}",
23            "io.grpc:grpc-servlet:${grpcVersion}",
24            "io.grpc:grpc-stub:${grpcVersion}"
25
26    compileOnly "javax.servlet:javax.servlet-api:4.0.1",
27            "org.apache.tomcat:annotations-api:6.0.53"
28}
29
30protobuf {
31    protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
32    plugins { grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" } }
33    generateProtoTasks {
34        all()*.plugins { grpc {} }
35    }
36}
37
38// Inform IDEs like IntelliJ IDEA, Eclipse or NetBeans about the generated code.
39sourceSets {
40    main {
41        java {
42            srcDirs 'build/generated/source/proto/main/grpc'
43            srcDirs 'build/generated/source/proto/main/java'
44        }
45    }
46}
47