xref: /aosp_15_r20/external/grpc-grpc-java/examples/example-gauth/build.gradle (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1plugins {
2    // Provide convenience executables for trying out the examples.
3    id 'application'
4    // ASSUMES GRADLE 5.6 OR HIGHER. Use plugin version 0.8.10 with earlier gradle versions
5    id 'com.google.protobuf' version '0.8.17'
6    // Generate IntelliJ IDEA's .idea & .iml project files
7    id 'idea'
8}
9
10repositories {
11    maven { // The google mirror is less flaky than mavenCentral()
12        url "https://maven-central.storage-download.googleapis.com/maven2/"
13    }
14    mavenCentral()
15    mavenLocal()
16}
17
18sourceCompatibility = 1.8
19targetCompatibility = 1.8
20
21// IMPORTANT: You probably want the non-SNAPSHOT version of gRPC. Make sure you
22// are looking at a tagged version of the example and not "master"!
23
24// Feel free to delete the comment at the next line. It is just for safely
25// updating the version in our release process.
26def grpcVersion = '1.56.1-SNAPSHOT' // CURRENT_GRPC_VERSION
27def protobufVersion = '3.22.3'
28def protocVersion = protobufVersion
29
30
31dependencies {
32    implementation "io.grpc:grpc-protobuf:${grpcVersion}"
33    implementation "io.grpc:grpc-stub:${grpcVersion}"
34    implementation "io.grpc:grpc-auth:${grpcVersion}"
35    compileOnly "org.apache.tomcat:annotations-api:6.0.53"
36    implementation "com.google.auth:google-auth-library-oauth2-http:0.9.0"
37    implementation "com.google.api.grpc:grpc-google-cloud-pubsub-v1:0.1.24"
38    runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"
39}
40
41protobuf {
42    protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
43    plugins {
44        grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
45    }
46    generateProtoTasks {
47        all()*.plugins { grpc {} }
48    }
49}
50
51// Inform IDEs like IntelliJ IDEA, Eclipse or NetBeans about the generated code.
52sourceSets {
53    main {
54        java {
55            srcDirs 'build/generated/source/proto/main/grpc'
56            srcDirs 'build/generated/source/proto/main/java'
57        }
58    }
59}
60
61startScripts.enabled = false
62
63task googleAuthClient(type: CreateStartScripts) {
64    mainClass = 'io.grpc.examples.googleAuth.GoogleAuthClient'
65    applicationName = 'google-auth-client'
66    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
67    classpath = startScripts.classpath
68}
69
70applicationDistribution.into('bin') {
71    from(googleAuthClient)
72    fileMode = 0755
73}
74